@jxsuite/compiler 11.1.1 → 11.2.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 +254 -206
- package/dist/compiler.js +183 -135
- package/package.json +11 -19
- package/src/cli.ts +25 -3
- package/src/compiler.ts +13 -0
- package/src/shared.ts +521 -64
- package/src/site/asset-mounts.ts +2 -5
- package/src/site/build-time-request.ts +144 -0
- package/src/site/component-set.ts +117 -6
- package/src/site/db-push.ts +22 -2
- package/src/site/format-host.ts +2 -1
- package/src/site/i18n.ts +10 -137
- package/src/site/layout-resolver.ts +20 -3
- package/src/site/pages-discovery.ts +90 -4
- package/src/site/preview-server.ts +39 -10
- package/src/site/project-sections.ts +34 -2
- package/src/site/prototype-resolver.ts +74 -19
- package/src/site/schema-command.ts +4 -0
- package/src/site/section-push.ts +132 -0
- package/src/site/site-build.ts +353 -139
- package/src/site/validate-command.ts +146 -12
- package/src/site/well-known.ts +2 -2
- package/src/switch-cases.ts +176 -0
- package/src/targets/compile-client.ts +324 -72
- package/src/targets/compile-element.ts +165 -17
- package/src/targets/compile-static.ts +28 -4
package/dist/cli.js
CHANGED
|
@@ -1,71 +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
|
|
2
|
+
import{createRequire as IM}from"node:module";var RM=Object.create;var{getPrototypeOf:TM,defineProperty:NS,getOwnPropertyNames:JM}=Object;var MS=Object.prototype.hasOwnProperty;function NM(e){return this[e]}var MM,DM,Mr=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?MM??=new WeakMap:DM??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?RM(TM(e)):{};let i=t||!e||!e.__esModule||!MS.call(e,"default")?NS(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of JM(e))if(!MS.call(i,a))NS(i,a,{get:NM.bind(e,a),enumerable:!0})}if(r)s.set(e,i);return i};var G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var F=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var bt=IM(import.meta.url);function O(e){return typeof e==="string"}function Ve(e){return typeof e==="number"}function tt(e){return typeof e==="boolean"}function $t(e){return typeof e==="function"}function V(e){return typeof e==="object"&&e!==null}function M(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function de(e){return M(e)&&typeof e.$ref==="string"}function Dt(e){return M(e)&&e.$prototype==="Function"}function ln(e){return M(e)&&M(e.$expression)}function An(e){return ln(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function cn(e){return Dt(e)&&Array.isArray(e.body)}function Cn(e){return M(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function vs(e){return M(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Cu(e){return M(e)&&!e.$prototype&&!e.$expression&&"default"in e}function ar(e){if(!M(e))return!1;let t=Object.keys(e);if(t.length===0||"default"in e||"$prototype"in e||"$expression"in e)return!1;let n=!1;for(let r of t){if(!LS.has(r))return!1;if(!LM.has(r))n=!0}return n}function qe(e){return M(e)&&e.$prototype==="Array"}function FS(e){return(Array.isArray(e)?e:[e]).some((n)=>qe(n))}function VS(e){return M(e)&&e.$prototype==="Class"}function It(e){return M(e)}function ce(e){return typeof e==="string"&&e.includes("${")}function Ru(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(Es(e))}function Km(e){return e.$prototype==="Function"||O(e.role)&&e.role!=="field"}function Es(e){if(!/[/'"`]/u.test(e))return e;let t=_u.get(e);if(t!==void 0)return t;let n=WS(e);if(_u.size>=qS)_u.clear();return _u.set(e,n),n}function HS(e){if(!e.includes("${"))return FM;let t=Au.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];WS(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(DS(e,l,r+c))}if(o===-1)break;let i=VM(e,o);if(i===-1)r=o+2;else n.push(DS(e,o,i)),r=i}if(Au.size>=qS)Au.clear();return Au.set(e,n),n}function DS(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function VM(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 HM(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function IS(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 WS(e,t){let n=e.split(""),r=(c)=>{if(n[c]!==void 0&&n[c]!==`
|
|
4
4
|
`)n[c]=" "},s=[],o=t!==void 0,i="",a=-1,l=0;while(l<e.length){let c=e.charAt(l);if(o)if(c==="\\")r(l),r(l+1),l+=2;else if(c==="`"&&!(t&&s.length===0))o=!1,i=c,l+=1;else if(c==="$"&&e.charAt(l+1)==="{"){if(s.length===0)t?.push(l,-1);s.push(0),o=!1,i="{",l+=2}else r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="/")while(l<e.length&&e.charAt(l)!==`
|
|
5
5
|
`)r(l),l+=1;else if(c==="/"&&e.charAt(l+1)==="*"){let u=e.indexOf("*/",l+2),d=u===-1?e.length:u+2;for(;l<d;l+=1)r(l)}else if(c==="'"||c==='"'){l+=1;while(l<e.length&&e.charAt(l)!==c&&e.charAt(l)!==`
|
|
6
|
-
`){if(e.charAt(l)==="\\")r(l),l+=1;r(l),l+=1}i=c,l+=1}else if(c==="`")o=!0,l+=1;else if(t&&c==="/"&&
|
|
7
|
-
`,"\r"]);
|
|
8
|
-
`],["r","\r"],["t","\t"]])});function ye(e){return e instanceof Error?e.message:String(e)}function
|
|
9
|
-
`,patched:!0}}function
|
|
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==="/"&&qM.has(i)&&!HM(e,i,a)&&IS(e,l)>0){let u=IS(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 qo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Tu(e){if(!e)return[];return e.map((t)=>O(t)?t:t.name)}function BS(e){return typeof e==="string"}function Kn(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!M(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 M(t.cases)&&Object.values(t.cases).every((n)=>O(n))&&typeof t.default==="string";return!1}function Ho(e){if(BS(e))return[e];if(!Kn(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}function US(e){return BS(e)?e:Ho(e).join("|")}function Ni(e){return e.startsWith("#")}function Mi(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}var LS,LM,_u,qS=2048,FM,Au,qM;var ae=F(()=>{LS=new Set(["$comment","$ref","additionalProperties","allOf","anyOf","const","deprecated","description","enum","examples","exclusiveMaximum","exclusiveMinimum","format","items","maxItems","maxLength","maximum","minItems","minLength","minimum","multipleOf","not","oneOf","pattern","prefixItems","properties","readOnly","required","title","type","uniqueItems","writeOnly"]),LM=new Set(["$comment","deprecated","description","examples","format","readOnly","title","writeOnly"]);_u=new Map;FM=[],Au=new Map;qM=new Set("(,=:[!&|?{;+-*%<>~^")});function GS(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():UM(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+=WM.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(KS.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"&&BM(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(!zM(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 BM(e,t){let n=t;while(n<e.length&&KS.has(e[n]))n+=1;return e[n]??""}function UM(e,t){return e===""?t:`${e}.${t}`}function zS(e){let t=/^(-?)(\d+)(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/.exec(e);if(t===null)return null;let n=t[3]??"",r=`${t[2]}${n}`.replace(/^0+/,""),s=r.replace(/0+$/,"");if(s==="")return{digits:"",exponent:0,negative:t[1]==="-"};let o=Number(t[4]??"0")-n.length+(r.length-s.length);return{digits:s,exponent:o,negative:t[1]==="-"}}function zM(e){let t=Number(e);if(!Number.isFinite(t))return!1;let n=zS(e);if(n===null)return!1;if(n.digits!==""&&n.exponent<0)return!0;let r=zS(String(t));return r!==null&&r.negative===n.negative&&r.digits===n.digits&&r.exponent===n.exponent}function XS(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.isFinite(Number(e.detail))?`number ${e.detail} in ${t} cannot be represented exactly and will change when `+"the document is written back (RFC 7493 §2.2)":`number ${e.detail} in ${t} is outside the range of a double and would be `+"written back as null (RFC 7493 §2.2)"}var KS,WM;var YS=F(()=>{KS=new Set([" ","\t",`
|
|
7
|
+
`,"\r"]);WM=new Map([["b","\b"],["f","\f"],["n",`
|
|
8
|
+
`],["r","\r"],["t","\t"]])});function ye(e){return e instanceof Error?e.message:String(e)}function Gm(e,t,n){if(O(e))return ZS.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((r,s)=>Gm(r,t===""?String(s):`${t}.${s}`,n));if(M(e))return QS(e,t,n);return e}function QS(e,t,n){let r={};for(let[s,o]of Object.entries(e)){let i=ZS.test(s)?s.normalize("NFC"):s;if(n!==void 0){if(i==="__proto__"){n.push({key:i,kind:"proto",path:t});continue}if(Object.hasOwn(r,i)){n.push({key:i,kind:"collision",path:t});continue}}r[i]=Gm(o,t===""?i:`${t}.${i}`,n)}return r}function Ju(e){return QS(e,"")}function KM(e){let t=e.path===""?"the document root":`"${e.path}"`;return e.kind==="proto"?`key "__proto__" in ${t} is not allowed`:`key "${e.key}" in ${t} is spelt twice, in two Unicode normalization forms, and `+"normalizing (UAX #31 §R4) would discard the first"}function Di(e,t,n="JSON document"){let r;try{r=JSON.parse(e)}catch(l){throw Error(`Failed to parse ${n} at ${t}: ${ye(l)}`,{cause:l})}let s=GS(e);if(s.length>0){let l=s.map((c)=>XS(c)).join("; ");throw Error(`Invalid ${n} at ${t}: ${l}`)}let o=r,i=[],a=Gm(o,"",i);if(i.length>0){let l=i.map((c)=>KM(c)).join("; ");throw Error(`Invalid ${n} at ${t}: ${l}`)}return a}function Xm(e,t,n){let r=Di(e,t,n);if(!M(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);return r}function $l(e,t){return Xm(e,t,"Jx document")}function ew(e,t){return Xm(e,t,"project config")}function Sl(e,t){return Xm(e,t,"class definition")}var ZS;var St=F(()=>{ae();YS();ZS=/[^\p{ASCII}]/u});import{spawn as GM}from"node:child_process";import{createRequire as XM}from"node:module";import{join as YM}from"node:path";function tw(e,t){try{return XM(YM(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 Nu(e,t,n,r=GM,s=process){let o=tw(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 Ym=()=>{};import{spawn as ZM}from"node:child_process";function nw(e,t,n=ZM,r=process){return Nu("convert",e,t,n,r)}var rw=F(()=>{Ym()});import{spawn as QM}from"node:child_process";function sw(e,t,n=QM,r=process){return Nu("format",e,t,n,r)}var ow=F(()=>{Ym()});function eD(e){return JSON.parse(e)}function Ii(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function tD(e){return Ii(e)&&typeof e.binding==="string"}function nD(e){try{let t=eD(e);return Ii(t)?t:void 0}catch{return}}function iw(e,t){if(t.length===0)return{content:e??"",patched:!1};let n={};if(e){let r=nD(e);if(r===void 0)return{content:e,patched:!1};n=r}for(let r of t)aw(n,r);return{content:`${JSON.stringify(n,null,"\t")}
|
|
9
|
+
`,patched:!0}}function aw(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]=rD(Array.isArray(s)?s:[],r);continue}if(Ii(r)){if(Ii(s))aw(s,r);else if(s===void 0)e[n]=structuredClone(r);continue}if(s===void 0)e[n]=r}}function rD(e,t){let n=[...e];for(let r of t){if(!tD(r)){if(!n.some((a)=>JSON.stringify(a)===JSON.stringify(r)))n.push(structuredClone(r));continue}let s=n.findIndex((i)=>Ii(i)&&i.binding===r.binding),o=n[s];if(Ii(o))n[s]={...o,...r};else n.push(structuredClone(r))}return n}var lw=()=>{};function Li(e){if(!O(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(!cw.test(s)||!cw.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&&sD.has(u)?u:null,p=d===null?l:l.slice(d.length+1);if(p==="")return null;let m={};for(let g of n){let y=g.indexOf("=");if(y===-1)return null;let h=g.slice(0,y).trim().toLowerCase(),x=g.slice(y+1).trim();if(h==="")return null;if(x.startsWith('"')&&x.endsWith('"')&&x.length>=2)x=x.slice(1,-1);m[h]=x}return{parameters:m,subtype:p,suffix:a,tree:d,type:s}}function oD(e){let t=e.tree===null?"":`${e.tree}.`,n=e.suffix===null?"":`+${e.suffix}`,r=Object.entries(e.parameters).map(([s,o])=>`; ${s}=${o}`).join("");return`${e.type}/${t}${e.subtype}${n}${r}`}function dw(e){if(!O(e)||e.trim()==="")return"expected a media type string";if(!e.includes("/"))return`"${e}" has no "/" — a media type is type/subtype (RFC 6838 §4.2)`;if(Li(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function Mu(e){let t=Li(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}`}function iD(e){return e in pw}function mw(e){let t=Li(e);if(t===null)return null;let n={...t.parameters};if(t.type==="text"&&!("charset"in n))n.charset="utf-8";for(let[r,s]of Object.entries(n))if(!aD.test(s))n[r]=`"${s.replaceAll("\\",String.raw`\\`).replaceAll('"',String.raw`\"`)}"`;return oD({...t,parameters:n})}function hw(e,t){let n=e.lastIndexOf(".");if(n<=e.lastIndexOf("/")||n<=e.lastIndexOf("\\"))return null;let r=e.slice(n).toLowerCase(),s=t?.mediaTypeFor(r)??null;if(s!==null)return s;return iD(r)?pw[r]:null}var cw,sD,uw="text/markdown; variant=GFM",fw="application/yaml",pw,aD;var Zm=F(()=>{ae();cw=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,sD=new Set(["vnd","prs","x"]);pw={".jxn":"text/plain; charset=utf-8",".markdown":`${uw}; charset=utf-8`,".md":`${uw}; charset=utf-8`,".yaml":`${fw}; charset=utf-8`,".yml":`${fw}; charset=utf-8`};aD=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/});class gw{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 li(e){if(DN.test(e))return"unreadable";let t=new I$(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=LN.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var DN,LN;var Da=M(()=>{DN=/\0/u,LN=/^[^\s\\/(){};[\]"#=]+/u});function Va(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function ks(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function qc(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function tt(e){return!isNaN(e)&&!Va(e)&&!ks(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function D$(e){return e>=65&&e<91||e>=97&&e<123||!1}function Rp(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Tp(e){return Rp(e)||e===95}function es(e){return e>=48&&e<58}function So(e){return es(e)||e===95}function Np(e){return e>=48&&e<56}function L$(e){return Np(e)||e===95}function Jp(e){return e===48||e===49}function F$(e){return Jp(e)||e===95}function V$(e){return e===45||e===43}var Es=1,ci=2,xo=3,Rc=4,Tc=5,La=6,Nc=7,Jc=8,Fa=9,js=10,Xt=11,ui=12,fi=13,Mc=14,Qr=15,Ic=16,Dc=17,bo=18,Ps=19,Lc=20,Fc=21,Vc=22,di=23,$o=24,Er=28;function*VN(e){for(let t of(FN??=new Intl.Segmenter("en")).segment(e))yield t.segment}function qN(e){return e[Symbol.iterator]()}function q$(e,{flags:t,graphemeLocations:n=!1}){let r=n?VN(e):qN(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*H$(e){if(Re(e,65279))e.column=1,yield Ee(e,ci);if(qc(e.current))throw jr(e,`Invalid character \\u${e.current.toString(16)}`)}function vt(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(qc(n))if(n>=55296&&n<=57343||n>1114111)qa(e,`Invalid character \\u${n.toString(16)}`);else qa(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function ar(e,t){if(t(e.current)){let n=e.current;return vt(e),n}}function Re(e,t){if(e.current===t)return vt(e),t}function pi(e){if(!ks(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return vt(e),e.column=1,e.line++,!0}function Mp(e,t){while(e.current===t)vt(e)}function Be(e,t){while(t(e.current))vt(e)}function Ee(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},a=e.start;e.start=i;let l=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(a.offset,i.offset),start:a,end:i,errors:l};if(n){if(!c.errors)c.errors=[];c.errors.push(new Ne(n,{token:c}))}return c}function jr(e,t){if(t instanceof Ne)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(ks(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new Ne(`${t}`,{start:o,end:i})}function qa(e,t){(e.errorsInToken??=[]).push(jr(e,t))}var FN;var W$=M(()=>{wo()});function vo(e){return(t)=>(vt(t),Ee(t,e))}function Ha(e){return Be(e,Va),Ee(e,bo)}function Eo(e){return pi(e),Ee(e,Ps)}function HN(e){vt(e);let t=!1,n=!1;if(Re(e,34)){if(!Re(e,34))return Ee(e,Fa);if(n=!0,e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(Re(e,34)){if(Re(e,34)&&Re(e,34))t=!0}else Re(e,92),pi(e)||vt(e)}else while(!t&&e.offset<e.length)if(Re(e,34))t=!0;else Re(e,92),pi(e)||vt(e);if(!t)throw jr(e,"Unexpected EOF inside string");return Ee(e,n?di:Fa)}function B$(e){if(vt(e),e.current===35||e.current===34){let t=1;while(Re(e,35))t++;if(!Re(e,34))throw jr(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(Re(e,34))if(Re(e,34)){if(e.current===34)throw jr(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(Re(e,35))r++;if(r===t)return Ee(e,js)}while(!0){if(e.offset>=e.length)throw jr(e,"Unexpected EOF while parsing raw string");if(Re(e,34)){if(n){if(!Re(e,34)||!Re(e,34))continue}let r=0;while(r<t&&Re(e,35))r++;if(r===t)return Ee(e,n?$o:js)}else pi(e)||vt(e)}}else{let t;if(e.current<255){let n=_e[e.current];t=n(e)}else if(Va(e.current))t=Ha(e);else if(ks(e.current))t=Eo(e);else t=Dp(e);if(t.type!==Xt)(t.errors??=[]).push(new Ne("Expected a valid identifier",{token:t}));return t.type=fi,t}}function WN(e){if(vt(e),ar(e,es))return Be(e,tt),Ee(e,Xt,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return Be(e,tt),Ee(e,Xt)}function BN(e){if(vt(e),Re(e,45))return Ee(e,xo);else if(Re(e,47)){while(e.offset<e.length&&!ks(e.current))vt(e);return Ee(e,Fc)}else if(Re(e,42)){let t=1;while(e.offset<e.length)if(Re(e,42)){if(Re(e,47)){if(t--,t===0)return Ee(e,Vc)}}else if(Re(e,47)){if(Re(e,42))t++}else pi(e)||vt(e);throw jr(e,"Unexpected EOF in multiline comment")}else Wc(e)}function U$(e){return vt(e),UN(e)}function UN(e){if(es(e.current))return lr(e);else if(Re(e,46)){if(ar(e,es))return Be(e,tt),Ee(e,Xt,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Be(e,tt),Ee(e,Xt)}else return Be(e,tt),Ee(e,Xt)}function Ip(e,t,n,r){return(s)=>{let o=vt(s);if(ar(s,n))return Be(s,r),Ee(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(Re(s,95)){if(Be(s,r),!tt(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,tt),Ee(s,Xt,`Invalid ${e} number`)}else if(Re(s,95)){if(Mp(s,95),n(s.current)){if(Be(s,r),!tt(s.current))return Ee(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Be(s,tt),Ee(s,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(es(s.current))return Ee(s,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Be(s,tt),Ee(s,Er)}}function lr(e){if(Re(e,48)){let t=Hc[e.current];if(t)return t(e)}if(Be(e,So),Re(e,46)){if(!ar(e,es))if(e.current===95)qa(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else qa(e,"Invalid decimal number, a decimal point must be followed by a digit");Be(e,So)}if(Re(e,101)||Re(e,69))if(ar(e,V$),ar(e,es)){if(Be(e,So),tt(e.current))return Be(e,tt),Ee(e,Xt,"Invalid number with suffix, a number with an exponent cannot have a suffix");return Ee(e,Qr)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Be(e,So),Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Be(e,tt),Ee(e,Qr,"Invalid decimal number, missing a number after the exponent");else if(Re(e,95)){if(Mp(e,95),es(e.current)){if(Be(e,So),!tt(e.current))return Ee(e,Qr,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Be(e,tt),Ee(e,Xt,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Be(e,tt),Ee(e,Er);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){vt(e);let t=null;if(ar(e,Tp))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Be(e,tt),Ee(e,Er,t)}else if(ar(e,D$)){let t=null;if(ar(e,So))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Be(e,tt),Ee(e,Er,t)}else if(Re(e,44))return Be(e,tt),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a comma");else if(Re(e,46))return Be(e,tt),Ee(e,Er,"Invalid number with suffix, a suffix cannot start with a dot");else if(ar(e,tt))return Be(e,tt),Ee(e,Er);else return Ee(e,Qr);else return Ee(e,Qr)}function zN(e){if(vt(e),e.current!=35)return Be(e,tt),Ee(e,Xt);let t=B$(e);t.start.offset--,t.start.column--;let n;switch(t.type){case js:case $o:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new Ne(n,{token:t})),t}function Dp(e){return vt(e),Be(e,tt),Ee(e,Xt)}function Wc(e){throw jr(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Wa(e,t){let n=q$(e,t);yield*H$(n);while(!n.currentIter.done){if(n.current<255){let r=_e[n.current];yield r(n);continue}if(Va(n.current)){yield Ha(n);continue}if(ks(n.current)){yield Eo(n);continue}yield Dp(n)}yield Ee(n,Es)}var Hc,_e;var z$=M(()=>{wo();W$();Hc=Array(256).fill(null);Hc[98]=Ip("binary",Dc,Jp,F$);Hc[111]=Ip("octal",Ic,Np,L$);Hc[120]=Ip("hexadecimal",Mc,Rp,Tp);_e=Array(255);_e.fill(Dp);for(let e=0;e<32;e++)_e[e]=Wc;_e[9]=Ha;_e[10]=Eo;_e[11]=Eo;_e[12]=Eo;_e[13]=Eo;_e[32]=Ha;_e[34]=HN;_e[35]=B$;_e[40]=vo(Rc);_e[41]=vo(La);_e[43]=U$;_e[45]=U$;_e[46]=WN;_e[47]=BN;_e[48]=lr;_e[49]=lr;_e[50]=lr;_e[51]=lr;_e[52]=lr;_e[53]=lr;_e[54]=lr;_e[55]=lr;_e[56]=lr;_e[57]=lr;_e[59]=vo(Jc);_e[61]=vo(ui);_e[91]=Wc;_e[92]=vo(Lc);_e[93]=Wc;_e[114]=zN;_e[123]=vo(Tc);_e[125]=vo(Nc);_e[133]=Eo;_e[160]=Ha});var mi=M(()=>{z$()});var Ne;var wo=M(()=>{mi();Ne=class Ne extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===Es)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function hi(e){return K$.get(e)}function G$(e,{start:t},{end:n}){K$.set(e,{start:t,end:n})}var K$;var Lp=M(()=>{K$=new WeakMap});function X$({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class cr{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new cr(this.name);return e.representation=this.representation,e}}class Pr{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Pr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class ur{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new ur(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new Pr(e)}}var Fp=()=>{};class Cn{static createArgument(e){return new Cn(new ur(e),null)}static createProperty(e,t){return new Cn(new ur(t),new cr(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Cn(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new cr(e):null}getValue(){return this.value.value}setValue(e){this.value=new ur(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Vp=M(()=>{Fp()});function*gi(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function qp(e){return e.children??(e.children=new _s)}class yi{static create(e){return new yi(new cr(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new yi(this.name.clone(),e?[]:this.entries.map((n)=>n.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new Pr(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,n){let r=Cn.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of gi(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of gi(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=Cn.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){qp(this).appendNode(e)}insertNodeBefore(e,t){qp(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){qp(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var Y$=M(()=>{Hp();Vp()});function*xi(e){if(e instanceof _s)yield*e.nodes;else yield e}class _s{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new _s(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...xi(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...xi(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...xi(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...xi(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...xi(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...xi(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of gi(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of gi(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Hp=()=>{};var Z$=M(()=>{Hp();Vp();Y$();Fp()});function Q$(e,t,n){let r;while(r=GN.exec(t)){let s=Ba(n,t,r.index);e.push(new Ne("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function eS(e,t,n){if(!bi.test(t))return e.push(new Ne("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!bi.test(t[0]))return e.push(new Ne("Multi-line strings must start with a newline",{token:n})),t;let r=ZN.exec(t)?.[1];if(r==null)return e.push(new Ne("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(eJ,(s,o,i,a,l)=>{if(!a)return`
|
|
13
|
-
`;if(!i.startsWith(r)){let c=
|
|
12
|
+
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function Fi(e){if(lD.test(e))return"unreadable";let t=new gw(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]=cD.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 lD,cD;var wl=F(()=>{lD=/\0/u,cD=/^[^\s\\/(){};[\]"#=]+/u});function Pl(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 Qs(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function zu(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function rt(e){return!isNaN(e)&&!Pl(e)&&!Qs(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 yw(e){return e>=65&&e<91||e>=97&&e<123||!1}function Qm(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function eh(e){return Qm(e)||e===95}function js(e){return e>=48&&e<58}function zo(e){return js(e)||e===95}function th(e){return e>=48&&e<56}function xw(e){return th(e)||e===95}function nh(e){return e===48||e===49}function bw(e){return nh(e)||e===95}function $w(e){return e===45||e===43}var Xs=1,Vi=2,Wo=3,Du=4,Iu=5,vl=6,Lu=7,Fu=8,El=9,Ys=10,un=11,qi=12,Hi=13,Vu=14,Ps=15,qu=16,Hu=17,Bo=18,Zs=19,Wu=20,Bu=21,Uu=22,Wi=23,Uo=24,Dr=28;function*fD(e){for(let t of(uD??=new Intl.Segmenter("en")).segment(e))yield t.segment}function dD(e){return e[Symbol.iterator]()}function Sw(e,{flags:t,graphemeLocations:n=!1}){let r=n?fD(e):dD(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*ww(e){if(De(e,65279))e.column=1,yield _e(e,Vi);if(zu(e.current))throw Ir(e,`Invalid character \\u${e.current.toString(16)}`)}function Ct(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(zu(n))if(n>=55296&&n<=57343||n>1114111)jl(e,`Invalid character \\u${n.toString(16)}`);else jl(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 Er(e,t){if(t(e.current)){let n=e.current;return Ct(e),n}}function De(e,t){if(e.current===t)return Ct(e),t}function Bi(e){if(!Qs(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return Ct(e),e.column=1,e.line++,!0}function rh(e,t){while(e.current===t)Ct(e)}function Ye(e,t){while(t(e.current))Ct(e)}function _e(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 He(n,{token:c}))}return c}function Ir(e,t){if(t instanceof He)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(Qs(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new He(`${t}`,{start:o,end:i})}function jl(e,t){(e.errorsInToken??=[]).push(Ir(e,t))}var uD;var vw=F(()=>{Ko()});function Go(e){return(t)=>(Ct(t),_e(t,e))}function Ol(e){return Ye(e,Pl),_e(e,Bo)}function Xo(e){return Bi(e),_e(e,Zs)}function pD(e){Ct(e);let t=!1,n=!1;if(De(e,34)){if(!De(e,34))return _e(e,El);if(n=!0,e.current===34)throw Ir(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(De(e,34)){if(De(e,34)&&De(e,34))t=!0}else De(e,92),Bi(e)||Ct(e)}else while(!t&&e.offset<e.length)if(De(e,34))t=!0;else De(e,92),Bi(e)||Ct(e);if(!t)throw Ir(e,"Unexpected EOF inside string");return _e(e,n?Wi:El)}function Ew(e){if(Ct(e),e.current===35||e.current===34){let t=1;while(De(e,35))t++;if(!De(e,34))throw Ir(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(De(e,34))if(De(e,34)){if(e.current===34)throw Ir(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(De(e,35))r++;if(r===t)return _e(e,Ys)}while(!0){if(e.offset>=e.length)throw Ir(e,"Unexpected EOF while parsing raw string");if(De(e,34)){if(n){if(!De(e,34)||!De(e,34))continue}let r=0;while(r<t&&De(e,35))r++;if(r===t)return _e(e,n?Uo:Ys)}else Bi(e)||Ct(e)}}else{let t;if(e.current<255){let n=Te[e.current];t=n(e)}else if(Pl(e.current))t=Ol(e);else if(Qs(e.current))t=Xo(e);else t=oh(e);if(t.type!==un)(t.errors??=[]).push(new He("Expected a valid identifier",{token:t}));return t.type=Hi,t}}function mD(e){if(Ct(e),Er(e,js))return Ye(e,rt),_e(e,un,"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 Ye(e,rt),_e(e,un)}function hD(e){if(Ct(e),De(e,45))return _e(e,Wo);else if(De(e,47)){while(e.offset<e.length&&!Qs(e.current))Ct(e);return _e(e,Bu)}else if(De(e,42)){let t=1;while(e.offset<e.length)if(De(e,42)){if(De(e,47)){if(t--,t===0)return _e(e,Uu)}}else if(De(e,47)){if(De(e,42))t++}else Bi(e)||Ct(e);throw Ir(e,"Unexpected EOF in multiline comment")}else Gu(e)}function Pw(e){return Ct(e),gD(e)}function gD(e){if(js(e.current))return Pr(e);else if(De(e,46)){if(Er(e,js))return Ye(e,rt),_e(e,un,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return Ye(e,rt),_e(e,un)}else return Ye(e,rt),_e(e,un)}function sh(e,t,n,r){return(s)=>{let o=Ct(s);if(Er(s,n))return Ye(s,r),_e(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(De(s,95)){if(Ye(s,r),!rt(s.current))return _e(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Ye(s,rt),_e(s,un,`Invalid ${e} number`)}else if(De(s,95)){if(rh(s,95),n(s.current)){if(Ye(s,r),!rt(s.current))return _e(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return Ye(s,rt),_e(s,un,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(js(s.current))return _e(s,un,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return Ye(s,rt),_e(s,Dr)}}function Pr(e){if(De(e,48)){let t=Ku[e.current];if(t)return t(e)}if(Ye(e,zo),De(e,46)){if(!Er(e,js))if(e.current===95)jl(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else jl(e,"Invalid decimal number, a decimal point must be followed by a digit");Ye(e,zo)}if(De(e,101)||De(e,69))if(Er(e,$w),Er(e,js)){if(Ye(e,zo),rt(e.current))return Ye(e,rt),_e(e,un,"Invalid number with suffix, a number with an exponent cannot have a suffix");return _e(e,Ps)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return Ye(e,zo),_e(e,Ps,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return Ye(e,rt),_e(e,Ps,"Invalid decimal number, missing a number after the exponent");else if(De(e,95)){if(rh(e,95),js(e.current)){if(Ye(e,zo),!rt(e.current))return _e(e,Ps,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return Ye(e,rt),_e(e,un,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return Ye(e,rt),_e(e,Dr);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){Ct(e);let t=null;if(Er(e,eh))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return Ye(e,rt),_e(e,Dr,t)}else if(Er(e,yw)){let t=null;if(Er(e,zo))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return Ye(e,rt),_e(e,Dr,t)}else if(De(e,44))return Ye(e,rt),_e(e,Dr,"Invalid number with suffix, a suffix cannot start with a comma");else if(De(e,46))return Ye(e,rt),_e(e,Dr,"Invalid number with suffix, a suffix cannot start with a dot");else if(Er(e,rt))return Ye(e,rt),_e(e,Dr);else return _e(e,Ps);else return _e(e,Ps)}function yD(e){if(Ct(e),e.current!=35)return Ye(e,rt),_e(e,un);let t=Ew(e);t.start.offset--,t.start.column--;let n;switch(t.type){case Ys:case Uo: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 He(n,{token:t})),t}function oh(e){return Ct(e),Ye(e,rt),_e(e,un)}function Gu(e){throw Ir(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*kl(e,t){let n=Sw(e,t);yield*ww(n);while(!n.currentIter.done){if(n.current<255){let r=Te[n.current];yield r(n);continue}if(Pl(n.current)){yield Ol(n);continue}if(Qs(n.current)){yield Xo(n);continue}yield oh(n)}yield _e(n,Xs)}var Ku,Te;var jw=F(()=>{Ko();vw();Ku=Array(256).fill(null);Ku[98]=sh("binary",Hu,nh,bw);Ku[111]=sh("octal",qu,th,xw);Ku[120]=sh("hexadecimal",Vu,Qm,eh);Te=Array(255);Te.fill(oh);for(let e=0;e<32;e++)Te[e]=Gu;Te[9]=Ol;Te[10]=Xo;Te[11]=Xo;Te[12]=Xo;Te[13]=Xo;Te[32]=Ol;Te[34]=pD;Te[35]=Ew;Te[40]=Go(Du);Te[41]=Go(vl);Te[43]=Pw;Te[45]=Pw;Te[46]=mD;Te[47]=hD;Te[48]=Pr;Te[49]=Pr;Te[50]=Pr;Te[51]=Pr;Te[52]=Pr;Te[53]=Pr;Te[54]=Pr;Te[55]=Pr;Te[56]=Pr;Te[57]=Pr;Te[59]=Go(Fu);Te[61]=Go(qi);Te[91]=Gu;Te[92]=Go(Wu);Te[93]=Gu;Te[114]=yD;Te[123]=Go(Iu);Te[125]=Go(Lu);Te[133]=Xo;Te[160]=Ol});var Ui=F(()=>{jw()});var He;var Ko=F(()=>{Ui();He=class He 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===Xs)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 zi(e){return Ow.get(e)}function kw(e,{start:t},{end:n}){Ow.set(e,{start:t,end:n})}var Ow;var ih=F(()=>{Ow=new WeakMap});function _w({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class jr{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 jr(this.name);return e.representation=this.representation,e}}class Lr{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 Lr(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class Or{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new Or(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 Lr(e)}}var ah=()=>{};class Gn{static createArgument(e){return new Gn(new Or(e),null)}static createProperty(e,t){return new Gn(new Or(t),new jr(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Gn(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 jr(e):null}getValue(){return this.value.value}setValue(e){this.value=new Or(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var lh=F(()=>{ah()});function*Ki(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function ch(e){return e.children??(e.children=new eo)}class Gi{static create(e){return new Gi(new jr(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 Gi(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 Lr(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=Gn.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 Ki(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of Ki(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=Gn.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){ch(this).appendNode(e)}insertNodeBefore(e,t){ch(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){ch(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 Aw=F(()=>{uh();lh()});function*Xi(e){if(e instanceof eo)yield*e.nodes;else yield e}class eo{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new eo(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...Xi(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...Xi(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...Xi(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...Xi(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...Xi(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...Xi(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of Ki(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of Ki(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 uh=()=>{};var Cw=F(()=>{uh();lh();Aw();ah()});function Rw(e,t,n){let r;while(r=bD.exec(t)){let s=_l(n,t,r.index);e.push(new He("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 Tw(e,t,n){if(!Yi.test(t))return e.push(new He("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!Yi.test(t[0]))return e.push(new He("Multi-line strings must start with a newline",{token:n})),t;let r=wD.exec(t)?.[1];if(r==null)return e.push(new He("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(ED,(s,o,i,a,l)=>{if(!a)return`
|
|
13
|
+
`;if(!i.startsWith(r)){let c=_l(n,t,l+o.length);return e.push(new He("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 Jw(e,t,n){let r;while(r=SD.exec(t)){let s=_l(n,t,r.indices[1][0]);e.push(new He("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(jD,(s,o,i,a,l)=>Mw(e,t,n,s,o,i,a,l))}function Nw(e,t,n){if(!$D.test(t))return e.push(new He("Strings with three quotes must be multiline strings",{token:n})),t;if(!Yi.test(t[0]))return e.push(new He("Multi-line strings must start with a newline",{token:n})),t;let r=vD.exec(t)?.[1];if(r==null){let s=PD.exec(t),o=s?_l(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 He(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(OD,(s,o,i,a,l,c,u)=>{if(!o)return Mw(e,t,n,s,a,l,c,u);let d=t[u+o.length+(i?i.length:0)];if(Yi.test(d))return`
|
|
16
|
+
`;if(!i.startsWith(r)){let p=_l(n,t,u+o.length);return e.push(new He("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"," "]]),bi=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,GN=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,XN=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,YN=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;ZN=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,QN=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,eJ=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,tJ=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;nJ=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;rJ=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function ts(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function Ue(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ts(e),n}}function Oe(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new Ne(t,{token:n})}function mn(e,t,n,r=n){if(e.storeLocations)G$(t,n,r)}function Yt(e="",t="",n=""){return e+t+n||void 0}function zc(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return ts(o),o}function Bp(e,t){if(!t&&!e.current.done&&e.current.value.type!==Es)t=Oe(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof Ne)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new Ne(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new Ne("Encountered multiple errors",{errors:n})}function Bc(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function oS(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Up(e){let{value:t}=e.current,n,r,s,o,i,a=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case Er:{if(!e.flags.experimentalSuffixedNumbers)throw new Ne("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,d=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,d),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(d),oS(s))e.errors.push(Oe(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Dc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Ic:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Qr:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Mc:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case fi:if(n=Bc(t.text),n===void 0)if(n=null,Bc(t.text.toLowerCase())!==void 0)e.errors.push(Oe(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Oe(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Oe(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ts(e);let l=e.flags.experimentalSuffixedNumbers&&Ue(e,fi);if(l)if(a){if(o=l.text,Bc(o)!==void 0)e.errors.push(Oe(l,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(Oe(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(Oe(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Oe(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new ur(n);if(c.representation=r??t.text,mn(e,c,t),s){let u=new Pr(s);u.representation=o,u.suffix=!0,mn(e,u,e.lastToken),c.tag=u}return c}function Ua(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case Xt:if(ts(e),oS(t.text))e.errors.push(Oe(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case Fa:ts(e),n=[tS(e.errors,t.text.slice(1,-1),t),t.text,t];break;case di:ts(e),n=[nS(e.errors,t.text.slice(3,-3),t),t.text,t];break;case js:{ts(e);let r=t.text,s=r.indexOf('"');n=[Q$(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case $o:{ts(e);let r=t.text,s=r.indexOf('"');n=[eS(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Ue(e,fi))e.errors.push(Oe(e.lastToken,Bc(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return n}function zp(e){let t=Ua(e);if(!t)return;let n=new cr(t[0]);return n.representation=t[1],mn(e,n,t[2],e.lastToken),n}function Uc(e){let t=Up(e);if(t)return t;let n=Ua(e);if(!n)return;let r=new ur(n[0]);return r.representation=n[1],mn(e,r,n[2],e.lastToken),r}function za(e){let t=Ue(e,Fc);if(!t)return;let{value:n}=e.current;return ts(e),t.text+(n?.text??"")}function Kc(e){return Ue(e,Vc)?.text}function Kp(e){return Ue(e,bo)??Kc(e)}function Gc(e){let t=Ue(e,Lc);if(!t)return;while(Kp(e));if(!za(e)&&!Ue(e,Ps)&&!Ue(e,Es))e.errors.push(Oe(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function Os(e){let t=e.lastToken.end;while(Ue(e,Ps)?.text??za(e)??Kp(e)??Gc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Rt(e){let t=e.lastToken.end;while(Kp(e)??Gc(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Wp(e){let t=Ue(e,Rc);if(!t)return;let n=Rt(e),r=Ua(e);if(!r&&e.current.value){let a=e.current.value;if(Os(e))e.errors.push(Oe(a,"This type of whitespace is not allowed inside a tag"));r=Ua(e)}if(!r){if(Up(e))e.errors.push(Oe(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw Oe(e,"Invalid tag, did you forget to quote a string?");let s=Rt(e),o=Ue(e,La);if(!o&&e.current.value){let a=e.current.value;if(Os(e))e.errors.push(Oe(a,"This type of whitespace is not allowed inside a tag"));o=Ue(e,La)}if(!o)throw Oe(e,"Invalid tag, did you forget to quote a string?");let i=new Pr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,mn(e,i,t,e.lastToken),i}function Xc(e){return za(e)??Ue(e,Ps)?.text??Ue(e,Jc)?.text??Ue(e,Es)?.text}function Gp(e){if(!Ue(e,Tc))return;let t=cS(e);if(!Ue(e,Nc))throw Oe(e,"Invalid node children");return t}function $i(e){let t=e.current.value;{let d=Wp(e);if(d){let p=Rt(e),m=Uc(e);if(!m)throw Oe(e,"Invalid argument");if(m.tag)e.errors.push(Oe(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let g=new Cn(m,null);mn(e,m,t,e.lastToken),mn(e,g,t,e.lastToken);let b=Rt(e);if(Ue(e,ui))e.errors.push(Oe(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),b=Yt(b,Rt(e))||" ";return[g,b]}}{let d=Up(e);if(d){let p=new Cn(d,null);mn(e,p,t,e.lastToken);let m=Rt(e);if(Ue(e,ui))e.errors.push(Oe(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=Yt(m,Rt(e))||" ";return[p,m]}}let n=Ua(e);if(!n)return;let r=Rt(e),s=Ue(e,ui);if(!s){let d=new ur(n[0]);d.representation=n[1],mn(e,d,n[2]);let p=new Cn(d,null);return mn(e,p,t,e.lastToken),[p,r]}let o=new cr(n[0]);o.representation=n[1],mn(e,o,n[2]);let i=Rt(e),a=Wp(e),l=a&&Rt(e),c=Uc(e);if(!c)throw Oe(e,"Expected a value");if(a){if(c.tag)e.errors.push(Oe(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new Cn(c,o);return mn(e,u,t,e.lastToken),u.equals=Yt(r,s.text,i),[u,void 0]}function iS(e){let t=Rt(e)??"",n;while(n=jo(e)){let i=e.lastToken.end,a=$i(e);if(!a)throw Oe(e,"Expected a property or argument");if(!(a[1]??Rt(e)))throw Oe(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=$i(e);if(!r)return;let s=r[1]??Rt(e)??"";while(n=jo(e)){let i=e.lastToken.end,a=$i(e);if(!a)throw Oe(e,"Expected a property or argument");if(!(a[1]??Rt(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function jo(e){let t=Ue(e,xo)?.text;if(!t)return;return Yt(t,Os(e))}function Yc(e){let t=e.current.value,n=Wp(e),r=n&&Rt(e),s=zp(e);if(!s)if(n)throw Oe(e,"Couldn't find node name");else return;let o=Rt(e),i=o!=null,a=jo(e),l=[];while(i||a){let p=e.lastToken.end,m=$i(e);if(!m)break;if(a)i=(m[1]||Rt(e))!=null,o=Yt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=jo(e);else{let g=m[0];g.leading=o,l.push(g),o=m[1]||Rt(e),i=o!=null,a=jo(e)}}let c,u;while(!0){a??=jo(e);let p=e.lastToken.end,m=Gp(e);if(!m){if(a)throw Oe(e,"Unexpected slashdash");break}if(a)o=Yt(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(Oe(e,"A node can only have one children block"));c=m,u=o??"",o=void 0}o=Yt(o,Rt(e))}let d=new yi(s,l,c);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",mn(e,d,t,e.lastToken),d}function aS(e){let t=Os(e),n=Yc(e);if(!n)return;let r=Yt(Xc(e),Os(e));return n.leading=Yt(t,n.leading),n.trailing=Yt(n.trailing,r),n}function lS(e){let t=Ue(e,ci)?.text,n=cS(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Yt(t,n.nodes[0].leading);else n.trailing=Yt(t,n.trailing);return n}function cS(e){let t=e.current.value,n=[],r=!0,s=Os(e);while(r){let i=e.lastToken.end,a=jo(e),l=Yc(e);if(!l){if(a)throw Oe(e,"Unexpected slashdash");break}let c=Rt(e),u=Xc(e);if(a)s=Yt(s,e.text.slice(i.offset,e.lastToken.end.offset),Os(e));else l.trailing=Yt(l.trailing,c,u)??"",n.push(l),l.leading=s??"",s=Os(e);r=u!=null}let o=new _s(n);return mn(e,o,t,e.lastToken),o.trailing=s??"",o}var Xp=M(()=>{wo();Lp();Z$();sS();mi()});function uS(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function sJ(e){{let t=Ue(e,ci);if(t)return{type:"bom",text:t.text}}{let t=Ue(e,Ps);if(t)return{type:"newline",text:t.text}}{let t=Ue(e,bo);if(t)return{type:"space",text:t.text}}{let t=za(e);if(t)return{type:"singleline",text:t}}{let t=Kc(e);if(t)return{type:"multiline",text:t}}return}function Zc(e){{let t=Gc(e);if(t)return{type:"line-escape",text:t}}{let t=Ue(e,bo);if(t)return{type:"space",text:t.text}}{let t=Kc(e);if(t)return{type:"multiline",text:t}}return}function fS(e){let t=[];while(!0){{let n=sJ(e);if(n){t.push(n);continue}}if(Ue(e,xo)?.text){let r,s=uS(e,Zc)??[],o=Yc(e);if(!o)throw Oe(e,"Invalid slashdash, expected a commented node");o.trailing=Yt(o.trailing,uS(e,Zc)?.map((i)=>i.text).join(""),Xc(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function oJ(e){let t=Ue(e,xo);if(t==null)return;let n,r=[];while(n=Zc(e))r.push(n);let s,o,i="";if(o=$i(e)){if(s=o[0],o[1])i=o[1]}else if(o=Gp(e))s=o;else throw Oe(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Yp(e){let t=[];while(!0){let n=Zc(e);if(!n)break;let r=!0;t.push(n);while(r){let s=oJ(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Yp(zc(s[1][0],Wa(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var dS=M(()=>{mi();Xp()});function As(e,{as:t="document",flags:n,...r}={}){let s=iJ[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let o=X$(n),i=Wa(e,{...r,flags:o}),a=zc(e,i,{...r,flags:o}),l;try{l=s(a)}catch(c){Bp(a,c)}if(Bp(a),!l)throw new Ne(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var iJ;var pS=M(()=>{wo();mi();Xp();dS();iJ={value:Uc,identifier:zp,node:aS,entry:iS,document:lS,"whitespace in document":fS,"whitespace in node":Yp}});var Qc=M(()=>{wo();Lp();pS()});function Si(e,t){let n=e.slice(0,t),r=n.split(`
|
|
18
|
+
`+i.slice(r.length)}).slice(1,-1)}function Mw(e,t,n,r,s,o,i,a){if(i)return"";if(o){let l=n.text.startsWith('"""'),c=t.slice(0,a).split(Yi),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 He(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:d}));else e.push(new He(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 He(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=xD.get(r);if(l==null)return e.push(new He(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return l}}function _l(e,t,n){let r=1;switch(e.type){case Wi:r=3;break;case Ys:r=e.text.indexOf('"')+1;break;case Uo:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(Yi);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 LY,xD,Yi,bD,$D,SD,wD,vD,ED,PD,jD,OD;var Dw=F(()=>{Ko();Ui();LY=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"]]),xD=new Map([["\\n",`
|
|
19
|
+
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),Yi=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,bD=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,$D=/(?:^|[^\\\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,SD=/(?:^|[^\\\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;wD=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,vD=/(?:^|[^\\\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]*)*$/,ED=/(\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,PD=/([^\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]*$/;jD=/\\(?:$|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;OD=/(\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 Os(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 Ze(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return Os(e),n}}function Je(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new He(t,{token:n})}function Rn(e,t,n,r=n){if(e.storeLocations)kw(t,n,r)}function fn(e="",t="",n=""){return e+t+n||void 0}function Zu(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 Os(o),o}function dh(e,t){if(!t&&!e.current.done&&e.current.value.type!==Xs)t=Je(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof He)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new He(`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 He("Encountered multiple errors",{errors:n})}function Xu(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 Iw(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function ph(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 Dr:{if(!e.flags.experimentalSuffixedNumbers)throw new He("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),Iw(s))e.errors.push(Je(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Hu:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case qu:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case Ps:a=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Vu:a=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case Hi:if(n=Xu(t.text),n===void 0)if(n=null,Xu(t.text.toLowerCase())!==void 0)e.errors.push(Je(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(Je(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(Je(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(Je(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(Je(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(Je(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(Je(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}Os(e);let l=e.flags.experimentalSuffixedNumbers&&Ze(e,Hi);if(l)if(a){if(o=l.text,Xu(o)!==void 0)e.errors.push(Je(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(Je(l,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(Je(l,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(Je(l,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new Or(n);if(c.representation=r??t.text,Rn(e,c,t),s){let u=new Lr(s);u.representation=o,u.suffix=!0,Rn(e,u,e.lastToken),c.tag=u}return c}function Al(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case un:if(Os(e),Iw(t.text))e.errors.push(Je(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case El:Os(e),n=[Jw(e.errors,t.text.slice(1,-1),t),t.text,t];break;case Wi:Os(e),n=[Nw(e.errors,t.text.slice(3,-3),t),t.text,t];break;case Ys:{Os(e);let r=t.text,s=r.indexOf('"');n=[Rw(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case Uo:{Os(e);let r=t.text,s=r.indexOf('"');n=[Tw(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Ze(e,Hi))e.errors.push(Je(e.lastToken,Xu(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 mh(e){let t=Al(e);if(!t)return;let n=new jr(t[0]);return n.representation=t[1],Rn(e,n,t[2],e.lastToken),n}function Yu(e){let t=ph(e);if(t)return t;let n=Al(e);if(!n)return;let r=new Or(n[0]);return r.representation=n[1],Rn(e,r,n[2],e.lastToken),r}function Cl(e){let t=Ze(e,Bu);if(!t)return;let{value:n}=e.current;return Os(e),t.text+(n?.text??"")}function Qu(e){return Ze(e,Uu)?.text}function hh(e){return Ze(e,Bo)??Qu(e)}function ef(e){let t=Ze(e,Wu);if(!t)return;while(hh(e));if(!Cl(e)&&!Ze(e,Zs)&&!Ze(e,Xs))e.errors.push(Je(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function to(e){let t=e.lastToken.end;while(Ze(e,Zs)?.text??Cl(e)??hh(e)??ef(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Lt(e){let t=e.lastToken.end;while(hh(e)??ef(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function fh(e){let t=Ze(e,Du);if(!t)return;let n=Lt(e),r=Al(e);if(!r&&e.current.value){let a=e.current.value;if(to(e))e.errors.push(Je(a,"This type of whitespace is not allowed inside a tag"));r=Al(e)}if(!r){if(ph(e))e.errors.push(Je(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw Je(e,"Invalid tag, did you forget to quote a string?");let s=Lt(e),o=Ze(e,vl);if(!o&&e.current.value){let a=e.current.value;if(to(e))e.errors.push(Je(a,"This type of whitespace is not allowed inside a tag"));o=Ze(e,vl)}if(!o)throw Je(e,"Invalid tag, did you forget to quote a string?");let i=new Lr(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,Rn(e,i,t,e.lastToken),i}function tf(e){return Cl(e)??Ze(e,Zs)?.text??Ze(e,Fu)?.text??Ze(e,Xs)?.text}function gh(e){if(!Ze(e,Iu))return;let t=qw(e);if(!Ze(e,Lu))throw Je(e,"Invalid node children");return t}function Zi(e){let t=e.current.value;{let d=fh(e);if(d){let p=Lt(e),m=Yu(e);if(!m)throw Je(e,"Invalid argument");if(m.tag)e.errors.push(Je(e.lastToken,"A number suffix cannot be combined with a regular tag"));m.tag=d,m.betweenTagAndValue=p;let g=new Gn(m,null);Rn(e,m,t,e.lastToken),Rn(e,g,t,e.lastToken);let y=Lt(e);if(Ze(e,qi))e.errors.push(Je(e.lastToken,typeof m.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),y=fn(y,Lt(e))||" ";return[g,y]}}{let d=ph(e);if(d){let p=new Gn(d,null);Rn(e,p,t,e.lastToken);let m=Lt(e);if(Ze(e,qi))e.errors.push(Je(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),m=fn(m,Lt(e))||" ";return[p,m]}}let n=Al(e);if(!n)return;let r=Lt(e),s=Ze(e,qi);if(!s){let d=new Or(n[0]);d.representation=n[1],Rn(e,d,n[2]);let p=new Gn(d,null);return Rn(e,p,t,e.lastToken),[p,r]}let o=new jr(n[0]);o.representation=n[1],Rn(e,o,n[2]);let i=Lt(e),a=fh(e),l=a&&Lt(e),c=Yu(e);if(!c)throw Je(e,"Expected a value");if(a){if(c.tag)e.errors.push(Je(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=a,c.betweenTagAndValue=l}let u=new Gn(c,o);return Rn(e,u,t,e.lastToken),u.equals=fn(r,s.text,i),[u,void 0]}function Lw(e){let t=Lt(e)??"",n;while(n=Yo(e)){let i=e.lastToken.end,a=Zi(e);if(!a)throw Je(e,"Expected a property or argument");if(!(a[1]??Lt(e)))throw Je(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=Zi(e);if(!r)return;let s=r[1]??Lt(e)??"";while(n=Yo(e)){let i=e.lastToken.end,a=Zi(e);if(!a)throw Je(e,"Expected a property or argument");if(!(a[1]??Lt(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 Yo(e){let t=Ze(e,Wo)?.text;if(!t)return;return fn(t,to(e))}function nf(e){let t=e.current.value,n=fh(e),r=n&&Lt(e),s=mh(e);if(!s)if(n)throw Je(e,"Couldn't find node name");else return;let o=Lt(e),i=o!=null,a=Yo(e),l=[];while(i||a){let p=e.lastToken.end,m=Zi(e);if(!m)break;if(a)i=(m[1]||Lt(e))!=null,o=fn(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=Yo(e);else{let g=m[0];g.leading=o,l.push(g),o=m[1]||Lt(e),i=o!=null,a=Yo(e)}}let c,u;while(!0){a??=Yo(e);let p=e.lastToken.end,m=gh(e);if(!m){if(a)throw Je(e,"Unexpected slashdash");break}if(a)o=fn(o,a,e.text.slice(p.offset,e.lastToken.end.offset)),a=void 0;else{if(c)e.errors.push(Je(e,"A node can only have one children block"));c=m,u=o??"",o=void 0}o=fn(o,Lt(e))}let d=new Gi(s,l,c);return d.tag=n??null,d.betweenTagAndName=r,d.beforeChildren=u,d.trailing=o??"",Rn(e,d,t,e.lastToken),d}function Fw(e){let t=to(e),n=nf(e);if(!n)return;let r=fn(tf(e),to(e));return n.leading=fn(t,n.leading),n.trailing=fn(n.trailing,r),n}function Vw(e){let t=Ze(e,Vi)?.text,n=qw(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=fn(t,n.nodes[0].leading);else n.trailing=fn(t,n.trailing);return n}function qw(e){let t=e.current.value,n=[],r=!0,s=to(e);while(r){let i=e.lastToken.end,a=Yo(e),l=nf(e);if(!l){if(a)throw Je(e,"Unexpected slashdash");break}let c=Lt(e),u=tf(e);if(a)s=fn(s,e.text.slice(i.offset,e.lastToken.end.offset),to(e));else l.trailing=fn(l.trailing,c,u)??"",n.push(l),l.leading=s??"",s=to(e);r=u!=null}let o=new eo(n);return Rn(e,o,t,e.lastToken),o.trailing=s??"",o}var yh=F(()=>{Ko();ih();Cw();Dw();Ui()});function Hw(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function kD(e){{let t=Ze(e,Vi);if(t)return{type:"bom",text:t.text}}{let t=Ze(e,Zs);if(t)return{type:"newline",text:t.text}}{let t=Ze(e,Bo);if(t)return{type:"space",text:t.text}}{let t=Cl(e);if(t)return{type:"singleline",text:t}}{let t=Qu(e);if(t)return{type:"multiline",text:t}}return}function rf(e){{let t=ef(e);if(t)return{type:"line-escape",text:t}}{let t=Ze(e,Bo);if(t)return{type:"space",text:t.text}}{let t=Qu(e);if(t)return{type:"multiline",text:t}}return}function Ww(e){let t=[];while(!0){{let n=kD(e);if(n){t.push(n);continue}}if(Ze(e,Wo)?.text){let r,s=Hw(e,rf)??[],o=nf(e);if(!o)throw Je(e,"Invalid slashdash, expected a commented node");o.trailing=fn(o.trailing,Hw(e,rf)?.map((i)=>i.text).join(""),tf(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function _D(e){let t=Ze(e,Wo);if(t==null)return;let n,r=[];while(n=rf(e))r.push(n);let s,o,i="";if(o=Zi(e)){if(s=o[0],o[1])i=o[1]}else if(o=gh(e))s=o;else throw Je(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function xh(e){let t=[];while(!0){let n=rf(e);if(!n)break;let r=!0;t.push(n);while(r){let s=_D(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...xh(Zu(s[1][0],kl(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var Bw=F(()=>{Ui();yh()});function no(e,{as:t="document",flags:n,...r}={}){let s=AD[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=_w(n),i=kl(e,{...r,flags:o}),a=Zu(e,i,{...r,flags:o}),l;try{l=s(a)}catch(c){dh(a,c)}if(dh(a),!l)throw new He(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return l}var AD;var Uw=F(()=>{Ko();Ui();yh();Bw();AD={value:Yu,identifier:mh,node:Fw,entry:Lw,document:Vw,"whitespace in document":Ww,"whitespace in node":xh}});var sf=F(()=>{Ko();ih();Uw()});function Qi(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 qt;var wi=M(()=>{qt=class qt extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new qt(`${e}: ${this.reason}`,t)}}});var mS;var hS=M(()=>{mS=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncsrcchange","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","onicecandidatepairadd","onicecandidatepairnominate","onicecandidatepairremove","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onssrcchange","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function je(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw Ae(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw Ae(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function Ae(e,t,n){let r=tu(t)?.start;return new qt(n,r===void 0?null:Si(e.text,r))}function tu(e){let t=hi(e);return t?{end:t.end.offset,start:t.start.offset}:null}function Et(e,t,n){let r=e.spans?tu(n):null;if(r)e.spans?.set(t,r)}function gS(e,t,n){let r=e.tokens&&n?tu(n):null;if(r)e.tokens?.names.set(t,r)}function Mt(e,t,n){let r=e.tokens&&n?tu(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function Cs(e){return e.entries.filter((t)=>!t.name)}function it(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function vi(e,t){let n=t.getTag();if(n!==null&&!bS.has(n))throw Ae(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw Ae(e,t,"(ref) annotates a value, and this is a name");return n}function ns(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw Ae(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(De(r)){if(!Number.isFinite(r))throw Ae(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw Ae(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!_(r))throw Ae(e,t,"(ref) needs a string");return{$ref:r}}return r}function Hn(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ns(e,n))}function Wn(e){return e.entries.filter((t)=>t.name)}function Ht(e){return e.children?.nodes??[]}function kr(e){return e.getName()??""}function cJ(e,t,n){let r={$prototype:"Function"},s=Hn(e,t),o=Ht(t);for(let a of Wn(t))je(r,kr(a),ns(e,a),e,a),Mt(e,`${n}/${it(kr(a))}`,a);let i=e.tokens?Cs(t):[];if(o.length>0){if(s.length>0)je(r,"parameters",s,e,t);je(r,"body",Zp(e,o,`${n}/body`),e,t)}else if(s.length>0){let a=s.at(-1)??null,l=s.slice(0,-1);if(l.length>0)je(r,"parameters",l,e,t);je(r,"body",a,e,t),Mt(e,`${n}/body`,i.pop())}for(let[a,l]of i.entries())Mt(e,`${n}/parameters/${a}`,l);return Et(e,n,t),r}function uJ(e,t,n){let r={$prototype:"Function",$src:"#client"};if(Hn(e,t).length>0||Ht(t).length>0)throw Ae(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of Wn(t))je(r,kr(s),ns(e,s),e,s),Mt(e,`${n}/${it(kr(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return Et(e,n,t),r}function fJ(e,t,n){if(Hn(e,t).length>0||Ht(t).length>0)throw Ae(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=Wn(t);if(s.length>0){let o={};for(let i of s){let a=kr(i);je(o,a,ns(e,i),e,i),Et(e,`${n}/arguments/${it(a)}`,i),Mt(e,`${n}/arguments/${it(a)}`,i)}r.arguments=o}return Et(e,n,t),r}function dJ(e,t,n){let r={};for(let l of Wn(t)){let c=kr(l);if(je(r,c,ns(e,l),e,l),c!=="timing"||r[c]!=="server")throw Ae(e,l,"A script takes timing=server, and nothing else")}let s=Hn(e,t),[o]=s;if(s.length!==1||!_(o)||Ht(t).length>0)throw Ae(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",a=n.$script;if(!L(a)||!yS.has(a))a={},yS.add(a),je(n,"$script",a,e,t);je(a,i,o,e,t),Et(e,`/$script/${i}`,t),Mt(e,`/$script/${i}`,Cs(t)[0])}function xS(e,t,n){for(let[r,s]of(e.tokens?Cs(n):[]).entries())Mt(e,`${t}/${r}`,s)}function Zp(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw Ae(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return qn(e,s,`${n}/${r+o}`)})}function qn(e,t,n){let r=vi(e,t);if(Et(e,n,t),r==="fn")return cJ(e,t,n);if(r==="export")return uJ(e,t,n);if(r==="server")return fJ(e,t,n);let s=Hn(e,t),o=Wn(t),i=Ht(t);if(r==="array"){if(o.length>0)throw Ae(e,t,"(array) holds items, and these are named");return xS(e,n,t),[...s,...Zp(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw Ae(e,t,"A list of values cannot also have names or a block");return xS(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw Ae(e,t,"A value cannot also have names or a block");return Mt(e,n,Cs(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((l)=>l.getName()==="-"))return Zp(e,i,n)}else if(s.length>0)throw Ae(e,t,"(object) holds names, and this is a value");let a={};for(let l of o){let c=kr(l);je(a,c,ns(e,l),e,l),Et(e,`${n}/${it(c)}`,l),gS(e,`${n}/${it(c)}`,l.name),Mt(e,`${n}/${it(c)}`,l)}for(let l of i){let c=l.getName();je(a,c,qn(e,l,`${n}/${it(c)}`),e,l),gS(e,`${n}/${it(c)}`,l.name)}return a}function nu(e,t,n){let r={};if(Et(e,n,t),Hn(e,t).length>0)throw Ae(e,t,"A style block holds declarations, and this is a value");for(let s of Wn(t)){let o=kr(s);je(r,o,ns(e,s),e,s),Et(e,`${n}/${it(o)}`,s),Mt(e,`${n}/${it(o)}`,s)}for(let s of Ht(t)){let o=s.getName(),i=`${n}/${it(o)}`,a=Ht(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){je(r,o,qn(e,s,i),e,s);continue}let l=Hn(e,s);if(l.length>1)throw Ae(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(Wn(s).length>0||Ht(s).length>0)throw Ae(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);je(r,o,l[0]??null,e,s),Et(e,i,s),Mt(e,i,Cs(s)[0])}else je(r,o,nu(e,s,i),e,s)}return r}function eu(e,t,n){let r=Ht(t);if(r.length!==1||!r[0])throw Ae(e,t,`"${t.getName()}" holds one element`);return SS(e,r[0],n)}function $S(e,t,n){let r={$prototype:"Array"};if(Et(e,n,t),Hn(e,t).length>0)throw Ae(e,t,"$array holds names and one element, and this is a value");for(let s of Wn(t)){let o=kr(s),i=o.startsWith(".")?o.slice(1):o;je(r,i,ns(e,s),e,s),Mt(e,`${n}/${it(i)}`,s)}if(Ht(t).length>0)je(r,"map",eu(e,t,`${n}/map`),e,t);return r}function SS(e,t,n){let r=t.getName();if(r==="-"){let s=Hn(e,t);if(s.length!==1||Wn(t).length>0||Ht(t).length>0)throw Ae(e,t,'"-" is one piece of text or one (ref)');return Et(e,n,t),Mt(e,n,Cs(t)[0]),s[0]??null}if(r==="$array")return $S(e,t,n);return Qp(e,t,n)}function pJ(e,t,n,r){let s=vi(e,n);if(t==="map")return eu(e,n,r);if(t==="cases"){let o={};for(let i of Ht(n)){let a=i.getName();je(o,a,eu(e,i,`${r}/${it(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Ht(n).length>0)return eu(e,n,r);return qn(e,n,r)}function Qp(e,t,n){let r={},s=t.getName(),o=vi(e,t);if(Et(e,n,t),o!==null)throw Ae(e,t,`(${o}) cannot annotate an element`);let i=Hn(e,t);if(s==="$element"){let[l,c,...u]=i;if(u.length>0)throw Ae(e,t,"$element takes at most a tag and a text value");if(l!==void 0)je(r,"tagName",l,e,t);if(c!==void 0)je(r,"textContent",c,e,t),Mt(e,`${n}/textContent`,Cs(t)[1])}else{if(s.startsWith("$"))throw Ae(e,t,`"${s}" is not a kind of element`);if(je(r,"tagName",s,e,t),i.length>1)throw Ae(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)je(r,"textContent",i[0],e,t),Et(e,`${n}/textContent`,t),Mt(e,`${n}/textContent`,Cs(t)[0])}mJ(e,t,r,n);let a=[];for(let l of Ht(t))hJ(e,l,r,a,n);if(a.length>0)je(r,"children",a,e,t);return r}function wS(e){let{attributes:t}=e;if(L(t))return t;let n={};return e.attributes=n,n}function mJ(e,t,n,r){for(let s of Wn(t)){let o=kr(s),i=s.getTag();if(i==="fn")throw Ae(e,s,"A function has a block form: (fn)name, on a line of its own");let a=ns(e,s);if(o.startsWith(".")||o.startsWith("$")){let l=o.startsWith(".")?o.slice(1):o;je(n,l,a,e,s),Et(e,`${r}/${it(l)}`,s),Mt(e,`${r}/${it(l)}`,s)}else if(o.startsWith("on")&&i==="ref")je(n,o,a,e,s),Et(e,`${r}/${it(o)}`,s),Mt(e,`${r}/${it(o)}`,s);else if(o.startsWith("on")&&mS.has(o))throw Ae(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else je(wS(n),o,a,e,s),Et(e,`${r}/attributes/${it(o)}`,s),Mt(e,`${r}/attributes/${it(o)}`,s)}}function hJ(e,t,n,r,s){let o=t.getName(),i=vi(e,t),a=(l)=>`${s}/${it(l)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw Ae(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);je(n,o,qn(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw Ae(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw Ae(e,t,`(${i}) cannot annotate a script`);dJ(e,t,n)}else if(o==="state")je(n,"state",qn(e,t,a("state")),e,t);else if(o==="style")je(n,"style",nu(e,t,a("style")),e,t);else if(o==="attributes"){let l=qn(e,t,a("attributes"));if(L(l))for(let[c,u]of Object.entries(l))je(wS(n),c,u,e,t);else je(n,"attributes",l,e,t)}else if(o.startsWith(".")){let l=o.slice(1);je(n,l,pJ(e,l,t,a(l)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")je(n,o,qn(e,t,a(o)),e,t);else{if(lJ.has(o))throw Ae(e,t,`"${o}" is reserved here`);r.push(SS(e,t,`${s}/children/${r.length}`))}}function em(e,t){return Ht(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?qn(e,n,s):Qp(e,n,s)})}function tm(e){let t=aJ.exec(e);if(t)throw new qt(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,Si(e,t.index));try{return As(e,{storeLocations:!0})}catch(n){let s=(n instanceof Ne?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new qt(o.split(`
|
|
22
|
-
`)[0]??o,s?
|
|
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 en;var ea=F(()=>{en=class en 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 en(`${e}: ${this.reason}`,t)}}});var zw;var Kw=F(()=>{zw=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","onoverscrollcancel","onoverscrollchanging","onoverscrollend","onoverscrollstart","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 Ce(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw Ne(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw Ne(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function Ne(e,t,n){let r=af(t)?.start;return new en(n,r===void 0?null:Qi(e.text,r))}function af(e){let t=zi(e);return t?{end:t.end.offset,start:t.start.offset}:null}function Rt(e,t,n){let r=e.spans?af(n):null;if(r)e.spans?.set(t,r)}function Gw(e,t,n){let r=e.tokens&&n?af(n):null;if(r)e.tokens?.names.set(t,r)}function Ut(e,t,n){let r=e.tokens&&n?af(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 ro(e){return e.entries.filter((t)=>!t.name)}function at(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function ta(e,t){let n=t.getTag();if(n!==null&&!Zw.has(n))throw Ne(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw Ne(e,t,"(ref) annotates a value, and this is a name");return n}function ks(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw Ne(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(Ve(r)){if(!Number.isFinite(r))throw Ne(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw Ne(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!O(r))throw Ne(e,t,"(ref) needs a string");return{$ref:r}}return r}function cr(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ks(e,n))}function ur(e){return e.entries.filter((t)=>t.name)}function tn(e){return e.children?.nodes??[]}function Fr(e){return e.getName()??""}function TD(e,t,n){let r={$prototype:"Function"},s=cr(e,t),o=tn(t);for(let a of ur(t))Ce(r,Fr(a),ks(e,a),e,a),Ut(e,`${n}/${at(Fr(a))}`,a);let i=e.tokens?ro(t):[];if(o.length>0){if(s.length>0)Ce(r,"parameters",s,e,t);Ce(r,"body",bh(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)Ce(r,"parameters",l,e,t);Ce(r,"body",a,e,t),Ut(e,`${n}/body`,i.pop())}for(let[a,l]of i.entries())Ut(e,`${n}/parameters/${a}`,l);return Rt(e,n,t),r}function JD(e,t,n){let r={$prototype:"Function",$src:"#client"};if(cr(e,t).length>0||tn(t).length>0)throw Ne(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of ur(t))Ce(r,Fr(s),ks(e,s),e,s),Ut(e,`${n}/${at(Fr(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return Rt(e,n,t),r}function ND(e,t,n){if(cr(e,t).length>0||tn(t).length>0)throw Ne(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=ur(t);if(s.length>0){let o={};for(let i of s){let a=Fr(i);Ce(o,a,ks(e,i),e,i),Rt(e,`${n}/arguments/${at(a)}`,i),Ut(e,`${n}/arguments/${at(a)}`,i)}r.arguments=o}return Rt(e,n,t),r}function MD(e,t,n){let r={};for(let l of ur(t)){let c=Fr(l);if(Ce(r,c,ks(e,l),e,l),c!=="timing"||r[c]!=="server")throw Ne(e,l,"A script takes timing=server, and nothing else")}let s=cr(e,t),[o]=s;if(s.length!==1||!O(o)||tn(t).length>0)throw Ne(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(!M(a)||!Xw.has(a))a={},Xw.add(a),Ce(n,"$script",a,e,t);Ce(a,i,o,e,t),Rt(e,`/$script/${i}`,t),Ut(e,`/$script/${i}`,ro(t)[0])}function Yw(e,t,n){for(let[r,s]of(e.tokens?ro(n):[]).entries())Ut(e,`${t}/${r}`,s)}function bh(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw Ne(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return lr(e,s,`${n}/${r+o}`)})}function lr(e,t,n){let r=ta(e,t);if(Rt(e,n,t),r==="fn")return TD(e,t,n);if(r==="export")return JD(e,t,n);if(r==="server")return ND(e,t,n);let s=cr(e,t),o=ur(t),i=tn(t);if(r==="array"){if(o.length>0)throw Ne(e,t,"(array) holds items, and these are named");return Yw(e,n,t),[...s,...bh(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw Ne(e,t,"A list of values cannot also have names or a block");return Yw(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw Ne(e,t,"A value cannot also have names or a block");return Ut(e,n,ro(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((l)=>l.getName()==="-"))return bh(e,i,n)}else if(s.length>0)throw Ne(e,t,"(object) holds names, and this is a value");let a={};for(let l of o){let c=Fr(l);Ce(a,c,ks(e,l),e,l),Rt(e,`${n}/${at(c)}`,l),Gw(e,`${n}/${at(c)}`,l.name),Ut(e,`${n}/${at(c)}`,l)}for(let l of i){let c=l.getName();Ce(a,c,lr(e,l,`${n}/${at(c)}`),e,l),Gw(e,`${n}/${at(c)}`,l.name)}return a}function lf(e,t,n){let r={};if(Rt(e,n,t),cr(e,t).length>0)throw Ne(e,t,"A style block holds declarations, and this is a value");for(let s of ur(t)){let o=Fr(s);Ce(r,o,ks(e,s),e,s),Rt(e,`${n}/${at(o)}`,s),Ut(e,`${n}/${at(o)}`,s)}for(let s of tn(t)){let o=s.getName(),i=`${n}/${at(o)}`,a=tn(s);if(s.getTag()==="array"||a.length>0&&a.every((c)=>c.getName()==="-")){Ce(r,o,lr(e,s,i),e,s);continue}let l=cr(e,s);if(l.length>1)throw Ne(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(l.length===1){if(ur(s).length>0||tn(s).length>0)throw Ne(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);Ce(r,o,l[0]??null,e,s),Rt(e,i,s),Ut(e,i,ro(s)[0])}else Ce(r,o,lf(e,s,i),e,s)}return r}function of(e,t,n){let r=tn(t);if(r.length!==1||!r[0])throw Ne(e,t,`"${t.getName()}" holds one element`);return ev(e,r[0],n)}function Qw(e,t,n){let r={$prototype:"Array"};if(Rt(e,n,t),cr(e,t).length>0)throw Ne(e,t,"$array holds names and one element, and this is a value");for(let s of ur(t)){let o=Fr(s),i=o.startsWith(".")?o.slice(1):o;Ce(r,i,ks(e,s),e,s),Ut(e,`${n}/${at(i)}`,s)}if(tn(t).length>0)Ce(r,"map",of(e,t,`${n}/map`),e,t);return r}function ev(e,t,n){let r=t.getName();if(r==="-"){let s=cr(e,t);if(s.length!==1||ur(t).length>0||tn(t).length>0)throw Ne(e,t,'"-" is one piece of text or one (ref)');return Rt(e,n,t),Ut(e,n,ro(t)[0]),s[0]??null}if(r==="$array")return Qw(e,t,n);return $h(e,t,n)}function DD(e,t,n,r){let s=ta(e,n);if(t==="map")return of(e,n,r);if(t==="cases"){let o={};for(let i of tn(n)){let a=i.getName();Ce(o,a,of(e,i,`${r}/${at(a)}`),e,i)}return o}if(t==="children"&&s!=="array"&&tn(n).length>0)return of(e,n,r);return lr(e,n,r)}function $h(e,t,n){let r={},s=t.getName(),o=ta(e,t);if(Rt(e,n,t),o!==null)throw Ne(e,t,`(${o}) cannot annotate an element`);let i=cr(e,t);if(s==="$element"){let[l,c,...u]=i;if(u.length>0)throw Ne(e,t,"$element takes at most a tag and a text value");if(l!==void 0)Ce(r,"tagName",l,e,t);if(c!==void 0)Ce(r,"textContent",c,e,t),Ut(e,`${n}/textContent`,ro(t)[1])}else{if(s.startsWith("$"))throw Ne(e,t,`"${s}" is not a kind of element`);if(Ce(r,"tagName",s,e,t),i.length>1)throw Ne(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)Ce(r,"textContent",i[0],e,t),Rt(e,`${n}/textContent`,t),Ut(e,`${n}/textContent`,ro(t)[0])}ID(e,t,r,n);let a=[];for(let l of tn(t))LD(e,l,r,a,n);if(a.length>0)Ce(r,"children",a,e,t);return r}function tv(e){let{attributes:t}=e;if(M(t))return t;let n={};return e.attributes=n,n}function ID(e,t,n,r){for(let s of ur(t)){let o=Fr(s),i=s.getTag();if(i==="fn")throw Ne(e,s,"A function has a block form: (fn)name, on a line of its own");let a=ks(e,s);if(o.startsWith(".")||o.startsWith("$")){let l=o.startsWith(".")?o.slice(1):o;Ce(n,l,a,e,s),Rt(e,`${r}/${at(l)}`,s),Ut(e,`${r}/${at(l)}`,s)}else if(o.startsWith("on")&&i==="ref")Ce(n,o,a,e,s),Rt(e,`${r}/${at(o)}`,s),Ut(e,`${r}/${at(o)}`,s);else if(o.startsWith("on")&&zw.has(o))throw Ne(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else Ce(tv(n),o,a,e,s),Rt(e,`${r}/attributes/${at(o)}`,s),Ut(e,`${r}/attributes/${at(o)}`,s)}}function LD(e,t,n,r,s){let o=t.getName(),i=ta(e,t),a=(l)=>`${s}/${at(l)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw Ne(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);Ce(n,o,lr(e,t,a(o)),e,t)}else if(o==="script"){if(s!=="")throw Ne(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 Ne(e,t,`(${i}) cannot annotate a script`);MD(e,t,n)}else if(o==="state")Ce(n,"state",lr(e,t,a("state")),e,t);else if(o==="style")Ce(n,"style",lf(e,t,a("style")),e,t);else if(o==="attributes"){let l=lr(e,t,a("attributes"));if(M(l))for(let[c,u]of Object.entries(l))Ce(tv(n),c,u,e,t);else Ce(n,"attributes",l,e,t)}else if(o.startsWith(".")){let l=o.slice(1);Ce(n,l,DD(e,l,t,a(l)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")Ce(n,o,lr(e,t,a(o)),e,t);else{if(RD.has(o))throw Ne(e,t,`"${o}" is reserved here`);r.push(ev(e,t,`${s}/children/${r.length}`))}}function Sh(e,t){return tn(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?lr(e,n,s):$h(e,n,s)})}function wh(e){let t=CD.exec(e);if(t)throw new en(`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}`,Qi(e,t.index));try{return no(e,{storeLocations:!0})}catch(n){let s=(n instanceof He?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new en(o.split(`
|
|
22
|
+
`)[0]??o,s?Qi(e,s.offset):null)}}function nv(e){if(Fi(e.text)==="project")throw new en('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=wh(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)Ce(r,i,Sh(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")Ce(r,i,lr(e,o,`/${at(i)}`),e,o),Rt(e,`/${at(i)}`,o);else if(s)throw Ne(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?Qw(e,s,""):$h(e,s,"");for(let[i,a]of Object.entries(o))Ce(r,i,a,e,s)}return Ju(r)}function Zo(e,t){try{return nv({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof en?n.inFile(t):n}}function vh(e){let t=new Map;return{document:nv({spans:t,text:e}),spans:t}}var CD,Zw,RD,Xw;var Rl=F(()=>{sf();ae();St();wl();ea();Kw();CD=/(?![\t\n\v\f\r])\p{Cc}/u,Zw=new Set(["array","export","fn","object","on","ref","server"]),RD=new Set(["attributes","script","state","style"]);Xw=new WeakSet});function Vr(e){return e.toLowerCase().endsWith(".jxn")}function fr(e){return e.endsWith(".json")||Vr(e)}function Xn(e,t){return Vr(t)?Zo(e,t):$l(e,t)}var cf=F(()=>{St();Rl()});function qD(e){let t={comments:0,escapes:[]},n=VD.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 Eh(e){return qD(e).escapes.flatMap((t)=>{let n=FD.get(e.charAt(t+1));return n?[{...Qi(e,t),message:n}]:[]})}var FD,VD;var rv=F(()=>{ea();FD=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.`]]),VD=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function na(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>na(s,t)).join(",")}]`;if(!M(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${na(e[s],t||s==="style")}`).join(",")}}`}function HD(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=M(n)?n[s]:void 0}return n}function WD({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 sv(e,t){let n=WD(e),r=new Map;for(let[s,o]of n)r.set(s,na(HD(e.document,o)));return{meanings:r,pointers:n,text:t}}function _s(e){let t=zi(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function ff(e,t){let{end:n,start:r}=_s(e);return t.slice(r,n).trimEnd()}function uf(e,t){let{end:n,start:r}=_s(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function kh(e){return e.children?.nodes??[]}function Ph(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=kh(e).map((o)=>Ph(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function jh(e,t,n){if(Ph(t)===Ph(n))return!0;let r=e.previous.meanings.get(_s(t).start);return r!==void 0&&r===e.next.meanings.get(_s(n).start)}function ov(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 iv(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 BD(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=iv(t,n,(c,u)=>jh(e,c,u)),a=0,l=0;for(let[c,u]of[...i,[t.length,n.length]]){let d=iv(t.slice(a,c),n.slice(l,u),(p,m)=>ov(p)===ov(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)&&jh(e,p,u));if(d!==-1)o(d,c)}return r}function _h(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
|
|
24
|
+
`)+1)}function UD(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 zD(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?uf(i,e.previous.text):`${i.leading??" "}${uf(a,e.next.text).trimStart()}`}}for(let i of r)o+=` ${uf(i,e.next.text).trimStart()}`;return o}function KD(e,t,n){let r=new Map;for(let o of kh(t)){let i=e.previous.pointers.get(_s(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(_s(o).start),a=i===void 0?void 0:r.get(i);if(a&&o.getName()!==null)s.set(a,o)}return s}function GD(e,t,n){let{text:r}=e.previous,s=uf(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 ff(t,r);return`${Oh(t,r)}${o.leading??" "}${s}`}return`${Oh(t,r)} ${s}`}function Oh(e,t){let{start:n}=_s(e),[r]=e.entries;if(r)return t.slice(n,_s(r).start-(r.leading??"").length);let s=e.children&&zi(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return ff(e,t)}function XD(e,t,n,r){let s=KD(e,t,n),o=new Set(s.values()),i=n.entries.filter((m)=>!o.has(m)),a=`${Oh(t,e.previous.text)}${zD(e,t,i)}`,l=kh(n);if(l.length===0&&s.size===0)return a;let c=l[0]?_h(l[0]):`${r} `,u=t.children,d=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&ZD(u,e.previous.text,t)){let m=`${r}${YD(u,r)}`;return`${a}${d}{${lv(e,u,l,m,c,s)}}`}let p=l.map((m)=>av(e,m,c,`${r} `));return`${a}${d}{
|
|
27
|
+
${p.join("")}${r}}`}function YD(e,t){let[n]=e.nodes,r=n?_h(n):"";return r.startsWith(t)?r.slice(t.length):" "}function ZD(e,t,n){let{end:r,start:s}=_s(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
|
|
28
28
|
`)&&t.slice(s,r).includes(`
|
|
29
|
-
`)}function
|
|
30
|
-
`}function
|
|
29
|
+
`)}function av(e,t,n,r){return`${r}${UD(ff(t,e.next.text),n,r)}
|
|
30
|
+
`}function lv(e,t,n,r,s,o){let i=t.nodes.filter((h)=>!o.has(h)),a=BD(e,i,n),l=t.nodes[0]?.leading??"",c=l.indexOf(`
|
|
31
31
|
`),u=c===-1?"":l.slice(0,c+1),d=u,p=-1,m=()=>{if(d!==""&&!d.endsWith(`
|
|
32
32
|
`)&&!d.endsWith(";"))d+=`
|
|
33
|
-
`},g=(h,x)=>{let
|
|
33
|
+
`},g=(h,x)=>{let P=t.nodes.indexOf(h),S=P===p+1||P>p;p=Math.max(p,P);let v=h===t.nodes[0]?l.slice(u.length):h.leading??"";if(S&&(v.includes(`
|
|
34
34
|
`)||d===u||d.endsWith(";"))){d+=`${v}${x}${h.trailing??""}`;return}if(!d.endsWith(`
|
|
35
35
|
`))d+=`
|
|
36
36
|
`;let E=(h.trailing??"").replace(/^;/u,"");d+=`${v.includes(`
|
|
37
|
-
`)?v:r}${x}${E}`},
|
|
38
|
-
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(
|
|
37
|
+
`)?v:r}${x}${E}`},y=(h)=>{for(let[x,P]of t.nodes.entries()){let S=o.get(P);if(S&&x<h&&x>p)m(),g(P,GD(e,P,S))}};for(let[h,x]of n.entries()){let P=a.get(h);if(P){y(t.nodes.indexOf(P)),m();let S=jh(e,P,x)?ff(P,e.previous.text):XD(e,P,x,_h(P));g(P,S)}else m(),d+=av(e,x,s,r)}return y(t.nodes.length),`${d}${t.trailing??""}`}function df(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=na(s.document);if(na(r.document)===o)return e;let i={next:sv(s,t),previous:sv(r,e)},a=lv(i,no(e,{storeLocations:!0}),no(t,{storeLocations:!0}).nodes,"","",new Map);try{return na(n(a).document)===o?a:t}catch{return t}}var pf=F(()=>{sf();ae()});function dv(e){return!/\p{Cs}/u.test(e)}function pv(e,t){try{return no(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function hf(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(fv.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function mv(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function tI(e,t){if(QD.test(e))return null;let n=mv(e,'"""'),r=`${t}${nn}`,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 pv(o,e)?o:null}function mf(e,t,n){if(!dv(e))throw new en(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(uv.test(e))return e;if(e.includes(`
|
|
43
|
+
`)){let r=tI(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!fv.test(e)){let r=mv(e,'"'),s=`${r}"${e}"${r}`;if(pv(s,e))return s}return hf(e)}function zt(e,t){if(!dv(e))throw new en(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return uv.test(e)?e:hf(e)}function gt(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Ve(e))return Object.is(e,-0)?"-0":String(e);if(O(e))return mf(e,t,n);return Jl(e)?`(ref)${hf(e.$ref)}`:null}function hv(e){if(!rn(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((c)=>gt(c,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((c)=>O(c))&&n!==void 0,a=n===void 0||O(n)||Array.isArray(n),l=Array.isArray(n)&&n.length===0;return o&&i&&a&&!l}function gv(e,t,n,r){let{$prototype:s,body:o,parameters:i,...a}=t,l=[`${n}(fn)${zt(e,r)}`];for(let[c,u]of Object.entries(a))l.push(`${zt(c,r)}=${gt(u,n,st(r,c))}`);if(Array.isArray(i))for(let c of i)l.push(mf(String(c),n,st(r,"parameters")));if(O(o))l.push(mf(o,n,st(r,"body")));else if(Array.isArray(o))return[`${l.join(" ")} {`,...o.flatMap((c,u)=>Yn("-",c,n+nn,st(st(r,"body"),u))),`${n}}`];return[l.join(" ")]}function nI(e){if(!rn(e)||e.$prototype!=="Function"||e.$src!=="#client"||!O(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>gt(t,"","")!==null)}function rI(e,t,n,r){let{$export:s,$prototype:o,$src:i,...a}=t,l=[`${n}(export)${zt(e,r)}`];if(s!==e)l.push(`$export=${gt(s,n,st(r,"$export"))}`);for(let[c,u]of Object.entries(a))l.push(`${zt(c,r)}=${gt(u,n,st(r,c))}`);return[l.join(" ")]}function oI(e,t){if(!rn(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>sI.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=rn(n)?Object.values(n):[];return r.length>0&&r.every((s)=>gt(s,"","")!==null)}function iI(e,t,n,r){let s=[`${n}(server)${zt(e,r)}`],o=st(r,"arguments"),i=rn(t.arguments)?t.arguments:{};for(let[a,l]of Object.entries(i))s.push(`${zt(a,o)}=${gt(l,n,st(o,a))}`);return[s.join(" ")]}function Yn(e,t,n,r){let s=zt(e,r),o=n+s,i=gt(t,n,r);if(i!==null)return[`${o} ${i}`];if(nI(t))return rI(e,t,n,r);if(oI(e,t))return iI(e,t,n,r);if(hv(t))return gv(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,m)=>gt(p,n,st(r,m)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
|
|
44
|
+
`))){let p=`${o} ${u.join(" ")}`;if(p.length<=Ah)return[p]}return[`${o} {`,...t.flatMap((p,m)=>Yn("-",p,n+nn,st(r,m))),`${n}}`]}let a=rn(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=gt(d,n,st(r,u));return p===null||p.includes(`
|
|
45
|
+
`)?null:`${zt(u,r)}=${p}`});if(c.every((u)=>u!==null)){let u=`${l} ${c.join(" ")}`;if(u.length<=Ah)return[u]}return[`${l} {`,...a.flatMap(([u,d])=>Yn(u,d,n+nn,st(r,u))),`${n}}`]}function yv(e,t,n,r){let s=Object.entries(t),o=n+zt(e,r);if(s.length===0)return[`${o} {}`];let i=[],a=0;for(let[p,m]of s){let g=gt(m,n,st(r,p));if(g===null||g.includes(`
|
|
46
|
+
`))break;i.push(`${zt(p,r)}=${g}`),a+=1}let l=`${o} ${i.join(" ")}`,c=i.length>0&&l.length<=Ah,u=c?a:0,d=s.slice(u).flatMap(([p,m])=>{if(rn(m)&&!Jl(m))return yv(p,m,n+nn,st(r,p));return Yn(p,m,n+nn,st(r,p))});if(c&&d.length===0)return[l];return[`${c?l:o} {`,...d,`${n}}`]}function aI(e){if(!rn(e)||e.$prototype!=="Array"||!rn(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=gt(s,"","");return o!==null&&!o.includes(`
|
|
47
|
+
`)})}function lI(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[a,l]of Object.entries(o))i.push(`${zt(a,n)}=${gt(l,t,st(n,a))}`);return[`${i.join(" ")} {`,...Tl(s??null,t+nn,st(n,"map")),`${t}}`]}function Tl(e,t,n){let r=gt(e,t,n);if(r!==null)return[`${t}- ${r}`];if(aI(e))return lI(e,t,n);if(rn(e))return Ch(e,t,n);throw new en(`${n} is a list inside a list of children, which has no spelling`)}function cI(e,t,n){let{tagName:r}=e;if(!O(r))return`${t}$element`;if(eI.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${hf(r)}`;return t+zt(r,n)}function uI(e,t){return t!==null&&!t.includes(`
|
|
48
|
+
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function fI(e,t){let n=rn(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!O(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${mf(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function Ch(e,t,n,r=[]){let s=[cI(e,t,n)],o=t+nn,i=[...r],a={},l=null;for(let[c,u]of Object.entries(e)){let d=st(n,c);if(c==="tagName"&&O(u))continue;if(c==="children")continue;if(c==="textContent"){let p=gt(u,t,d);if(p===null||!O(e.tagName))cv(s,i,c,u,o,t,d);else l=p}else if(c==="attributes"&&rn(u))for(let[p,m]of Object.entries(u)){let g=gt(m,t,st(d,p));if(uI(p,g))s.push(`${zt(p,d)}=${g}`);else a[p]=m}else if(c==="state")i.push(...Yn("state",u,o,d));else if(c==="style"&&rn(u))i.push(...yv("style",u,o,d));else if(c.startsWith("on")&&Jl(u))s.push(`${zt(c,d)}=${gt(u,t,d)}`);else if(c.startsWith("on"))i.push(...hv(u)?gv(c,u,o,d):Yn(c,u,o,d).map((p,m)=>m===0?p.replace(o,`${o}(on)`):p));else if(c.startsWith("$")){let p=gt(u,t,d);if(p===null||p.includes(`
|
|
49
|
+
`))i.push(...Yn(c,u,o,d));else s.push(`${zt(c,d)}=${p}`)}else cv(s,i,c,u,o,t,d)}if(Object.keys(a).length>0)i.push(...Yn("attributes",a,o,st(n,"attributes")));if(i.push(...dI(e.children,o,st(n,"children"))),l!==null)s.push(l);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function dI(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)=>Tl(s,t,st(n,o)))}let r=gt(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Tl(e,t+nn,n),`${t}}`]}function cv(e,t,n,r,s,o,i){let a=zt(`.${n}`,i);if(n==="map"&&rn(r)){t.push(`${s}${a} {`,...Tl(r,s+nn,i),`${s}}`);return}if(n==="cases"&&rn(r)){t.push(`${s}${a} {`);for(let[c,u]of Object.entries(r))t.push(`${s}${nn}${zt(c,i)} {`,...Tl(u,s+nn+nn,st(i,c)),`${s}${nn}}`);t.push(`${s}}`);return}let l=gt(r,o,i);if(l===null||l.includes(`
|
|
50
|
+
`))t.push(...Yn(`.${n}`,r,s,i));else e.push(`${a}=${l}`)}function xv(e,t){return["$head {",...e.flatMap((n,r)=>rn(n)&&!Jl(n)&&O(n.tagName)&&!n.$ref?Ch(n,t,`/$head/${r}`):Yn("-",n,t,`/$head/${r}`)),"}"]}function pI(e){let{document:t,spans:n}=vh(e);return{document:M(t)?t:null,spans:n}}function Rh(e,t){let n=mI(e);return t===void 0?n:df(t,n,pI)}function mI(e){if(!M(e))throw new en("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?fI(a,nn):null;if(l)o=l;else if(i==="$head"&&Array.isArray(a))n.push(...xv(a,nn));else if(i==="$head")n.push(`(object)${Yn(i,a,"","/$head").join(`
|
|
51
|
+
`)}`);else if(i.startsWith("$"))n.push(...Yn(i,a,"",st("",i)));else r[i]=a}if(Object.keys(r).length>0)n.push("",...Ch(r,"","",o));return`${n.join(`
|
|
52
52
|
`)}
|
|
53
|
-
`}var Wt=" ",cm=100,CS,RS,OJ,AJ,Bt=(e)=>L(e),Xa=(e)=>Bt(e)&&_(e.$ref)&&Object.keys(e).length===1,nt=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,NJ;var uu=M(()=>{Qc();ae();wi();Ka();au();CS=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,RS=/[\p{Cc}\p{Zl}\p{Zp}--]/u,OJ=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,AJ=new Set(["-","attributes","script","state","style"]);NJ=new Set(["$export","$src","arguments","timing"])});function zJ(e,t,n){if(vi(e,t)!==null)throw Ae(e,t,`"project" names the file's kind, and takes no annotation`);let r=Hn(e,t);if(r.length>1||Wn(t).length>0||Ht(t).length>0)throw Ae(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)je(n,"name",r[0],e,t),Et(e,"/name",t)}function KJ(e,t,n){let r=t.getName(),s=`/${it(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=em(e,t),Et(e,s,t);else if(UJ.has(r)&&o)i=nu(e,t,s);else i=qn(e,t,s);je(n,r,i,e,t)}function GJ(e){if(li(e.text)==="document")throw new qt('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=tm(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===BJ){if(r)throw Ae(e,s,'"project" is written twice, and a file declares one project');zJ(e,s,n),r=!0}else KJ(e,s,n);return ii(n)}function dm(e,t){try{return GJ({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof qt?n.inFile(t):n}}var BJ="project",UJ;var pm=M(()=>{ae();Ft();Da();wi();Ka();au();uu();UJ=new Set(["$media","style"])});var os=M(()=>{Da();ru();wi();ES();Ka();au();uu();pm()});function HS(e){if(e===null)throw TypeError("A class descriptor cannot be null");return L(e)?e:{}}class Ya{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=J$(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=ZJ(n)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!Ot(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class fu{#t;get#e(){return[...this.#t,nM]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let n=N$(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of VS){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=FS(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=FS(e);return this.#e.some((n)=>n.extensions.includes(t))}}function ZJ(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!eM(o))continue;let i={identifier:s.identifier??r,timing:s.timing??YJ};if(_(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function eM(e){return e!==void 0&&QJ.has(e)}function FS(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var VS,qS,YJ,QJ,tM,nM;var mm=M(()=>{ae();Cp();VS=["parse","serialize","rewrite","discover","load"],qS=[...VS,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];YJ=["compiler","server"];QJ=new Set(qS);tM={importModule:async()=>{await Promise.resolve().then(() => os());return{JxNotation:{parse:(n)=>Po(n),serialize:(n)=>fm(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},nM=new Ya("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},tM)});class WS{#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new fu(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function BS(e,t,n){let r=[];for(let s of e??[])r.push(await rM(s,t,n));return new WS(r)}async function rM(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(n,e);r=t.resolvePath(`${l}/package.json`,`./${Za}`)}else try{r=t.resolvePath(n,`${e}/${Za}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Za} (is the package installed, and does its exports map include it?): ${hm(l)}`,{cause:l})}let s;try{s=await t.loadJson(r)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${r}: ${hm(l)}`,{cause:l})}if(!L(s)||!_(s.name))throw Error(`Extension "${e}": ${Za} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[l,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),d;try{d=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${hm(p)}`,{cause:p})}i.push(new Ya(l,u,HS(d),t))}let a={};if(o.schemas?.project)a.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)a.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)a.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:a}}function hm(e){return e instanceof Error?e.message:String(e)}var Za="jx-extension.json";var US=M(()=>{mm();ae();mm()});var zS=M(()=>{ae()});function oM(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function GS(e){let t=sM.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function du(e,t){return rs(t)?dm(e,t):$$(e,t)}var sM,KS="project.jxn",gm;var pu=M(()=>{ae();zS();Da();ru();pm();Ft();sM=["project.jxn","project.json"];gm=class gm extends Error{constructor(e){super(oM(e));this.name="ProjectFileConflictError"}}});import{accessSync as uX,closeSync as fX,constants as dX,existsSync as iM,fstatSync as pX,lstatSync as mX,openSync as hX,readFileSync as gX,statSync as yX}from"node:fs";import{dirname as bX,join as XS}from"node:path";function aM(e){return GS((t)=>iM(XS(e,t)))}function Un(e){let t=aM(e);if(t==="conflict")throw new gm(e);return XS(e,t??KS)}var ko=M(()=>{pu()});import{existsSync as lM,readFileSync as cM}from"node:fs";import{dirname as hu,isAbsolute as uM,resolve as YS,sep as mu}from"node:path";import{pathToFileURL as fM}from"node:url";import{createRequire as dM}from"node:module";function ZS(e){let t=[e],n=`${mu}src${mu}`,r=`${mu}dist${mu}`;if(e.includes(n)){let s=e.replace(n,r);if(t.push(s),s.endsWith(".ts"))t.push(`${s.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);return t}function QS(e){let t=ZS(e),n=hu(e),r=[...t.filter((o)=>hu(o)===n),...t.filter((o)=>hu(o)!==n)],s=r.find((o)=>lM(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function ym(e){let t=ZS(e),n;for(let r of t)try{return await import(fM(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function xm(e,t){return dM(YS(e,"package.json")).resolve(t)}function bm(e){return{importModule:(t)=>ym(t),loadJson:async(t)=>JSON.parse(cM(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return YS(hu(t),n);if(uM(n))return n;return xm(e,n)}}}async function Rs(e,t){return BS(t?.extensions,bm(e),Un(e))}function gu(e,t){return Error(`No format class registered for "${t}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`)}var is=M(()=>{US();ae();ko()});var $m,Sm;var wm=M(()=>{$m={anyOf:[{additionalProperties:!1,description:"Two-way: `target` is the test, `value` the tag when it is truthy, `initial` the tag when it is not.",properties:{initial:{$ref:"#/$defs/TagName"},operator:{const:"?:",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/TagName"}},required:["operator","target","value","initial"],title:"?: — the tag when the test holds, and the tag when it does not"},{additionalProperties:!1,description:"Multiway: `target` is the discriminant, matched against case keys by its string form. "+"`default` is required — an element with no tag cannot exist.",properties:{cases:{additionalProperties:{$ref:"#/$defs/TagName"},type:"object"},default:{$ref:"#/$defs/TagName"},operator:{const:"switch",type:"string"},target:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target","cases","default"],title:"switch — one tag per discriminant value, with a required fallback"}],description:"A tag name chosen at element creation. Every branch resolves to a `TagName`, so the candidate set is enumerable without evaluating anything."},Sm={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var vm;var Em=M(()=>{vm={description:"HTML element tag name or custom element name (must contain a hyphen per Web Components spec). "+"A NAME, never an expression: no `${…}` position in the pipeline evaluates a tagName. Use "+"`$switch`/`cases` to vary the element.",minLength:1,pattern:"^[a-zA-Z][a-zA-Z0-9._-]*$",type:"string"}});var jm,Pm,km;var _m=M(()=>{jm={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Pm={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},km={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var Om;var Am=M(()=>{Om={additionalProperties:!0,description:"A page-level <head> entry. Defines meta tags, link tags, script tags, etc.",properties:{attributes:{additionalProperties:{oneOf:[{type:"string"},{type:"boolean"}]},type:"object"},children:{items:{$ref:"#/$defs/HeadEntry"},type:"array"},tagName:{type:"string"},textContent:{description:"Element content. An object is serialized to JSON inside the tag — that is how a "+'JSON-LD block (`<script type="application/ld+json">`) is authored.',oneOf:[{type:"string"},{type:"object"}]}},required:["tagName"],type:"object"}});var Cm,Rm;var Tm=M(()=>{Cm={description:"A CEM-compatible parameter definition for a function. Follows the Custom Elements Manifest Parameter shape.",properties:{default:{description:"Default value for the parameter."},description:{description:"Parameter documentation.",type:"string"},name:{description:"Parameter name.",type:"string"},optional:{description:"Whether the parameter is optional.",type:"boolean"},type:{description:"Parameter type (JSON Schema or CEM { text } format)."}},required:["name"],type:"object"},Rm={description:"A CEM-compatible event definition. Describes a CustomEvent the function dispatches.",properties:{deprecated:{description:"Deprecation notice.",oneOf:[{type:"boolean"},{type:"string"}]},description:{description:"Event documentation.",type:"string"},name:{description:"Event name (e.g. 'task-toggled').",type:"string"},type:{description:"Event type (e.g. { text: 'CustomEvent' })."}},required:["name"],type:"object"}});var Qa;var Nm=M(()=>{Qa={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" encodes variants at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var Jm;var Mm=M(()=>{Jm={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Im,Dm,Lm,Fm,Vm,qm,Hm,Wm,Bm;var Um=M(()=>{Im={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Dm={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Lm={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Fm={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Vm={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},qm={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done","#/$map/item/text"],pattern:String.raw`^(#/)?\$map/(item|index)(/.*)?$`,type:"string"},Hm={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Wm={additionalProperties:!1,description:"A $ref binding. Resolves to a state entry (reactive) or plain value (static).",properties:{$ref:{$ref:"#/$defs/AnyRef"}},required:["$ref"],type:"object"},Bm={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var el;var zm=M(()=>{el={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var Km,Gm;var Xm=M(()=>{Km={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item, in either spelling ($map/item/id or #/$map/item/id). A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^(#/)?\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Gm={description:"Array of child definitions — elements, text, or Array namespaces (dynamic lists) mixed "+"freely. A bare Array namespace (the whole children slot is one dynamic list) is also "+"accepted for backward compatibility, as is a ${…} template string that resolves at build "+"time to an array of child definitions.",oneOf:[{items:{anyOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/SwitchNode"},{$ref:"#/$defs/ArrayNamespace"},{type:"string"},{type:"number"}]},type:"array"},{$ref:"#/$defs/ArrayNamespace"},{description:"Computed children — a ${…} template that resolves at build time to an array of child "+'definitions (e.g. "${state.entry.$children}" for parsed content). A bare plain-text string is NOT a valid children value; text children must be array items.',pattern:String.raw`\$\{`,type:"string"}]}});var Ym,Zm,Qm,eh,th,yu;var nh=M(()=>{Ym={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Zm={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object"},{$ref:"#/$defs/RefObject"}]},description:"Explicit prop passing at a component boundary.",type:"object"},Qm={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},eh={additionalProperties:!1,description:"Reactive $ref that drives which case to render: a state entry, or inside a mapped array's template the row's $map/item or $map/index (spec §14.1).",properties:{$ref:{oneOf:[{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/MapRef"}],type:"string"}},required:["$ref"],type:"object"},th={properties:{$switch:{$ref:"#/$defs/SwitchDef"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},type:"object"},tagName:{$ref:"#/$defs/TagName"}},required:["$switch","cases"],type:"object"},yu={additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"A Jx element definition. Maps directly to a DOM element.",properties:{"$map/index":{$ref:"#/$defs/RefObject"},"$map/item":{$ref:"#/$defs/RefObject"},$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"},$switch:{$ref:"#/$defs/SwitchDef"},alt:{$ref:"#/$defs/StringOrRef"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases for this element. Maps case values to element definitions or external component refs, rendered according to the reactive $switch discriminant.",type:"object"},checked:{$ref:"#/$defs/BoolOrRef"},children:{$ref:"#/$defs/ChildrenValue"},className:{$ref:"#/$defs/StringOrRef"},dir:{enum:["ltr","rtl","auto"],type:"string"},disabled:{$ref:"#/$defs/BoolOrRef"},hidden:{$ref:"#/$defs/BoolOrRef"},href:{$ref:"#/$defs/StringOrRef"},id:{type:"string"},innerHTML:{$ref:"#/$defs/StringOrRef"},innerText:{$ref:"#/$defs/StringOrRef"},lang:{$ref:"#/$defs/StringOrRef"},name:{$ref:"#/$defs/StringOrRef"},placeholder:{$ref:"#/$defs/StringOrRef"},selected:{$ref:"#/$defs/BoolOrRef"},src:{$ref:"#/$defs/StringOrRef"},style:{$ref:"#/$defs/StyleObject"},tabIndex:{$ref:"#/$defs/NumberOrRef"},tagName:{$ref:"#/$defs/ElementTagName"},textContent:{$ref:"#/$defs/StringOrRef"},title:{$ref:"#/$defs/StringOrRef"},type:{$ref:"#/$defs/StringOrRef"},value:{$ref:"#/$defs/StringOrRef"}},required:["tagName"],type:"object"}});var rh;var sh=M(()=>{rh={description:"A typed reactive state variable with explicit type and default value. The type property is a JSON Schema or $ref to a $defs type definition. The default property is the initial runtime value.",not:{required:["$prototype"]},properties:{$ref:{description:"Reference to a shared type definition.",type:"string"},attribute:{description:"Linked HTML attribute name for CEM extraction.",type:"string"},default:{description:"Initial state value."},deprecated:{description:"Deprecation notice for CEM extraction.",oneOf:[{type:"boolean"},{type:"string"}]},description:{type:"string"},examples:{type:"array"},reflects:{description:"Whether property changes reflect back to the HTML attribute.",type:"boolean"},type:{description:"JSON Schema type definition, $ref to a $defs type, or JSON Schema type string.",oneOf:[{type:"string"},{type:"object"}]}},required:["default"],type:"object"}});var oh;var ih=M(()=>{oh={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var ah,lh;var ch=M(()=>{ah={description:"One statement of a structured function body. Either a bare expression node in statement position (a mutation like =/push, or a call — its result discarded unless captured by an assignment), an if/then/else branch (JSON Schema conditional keywords; if holds a pure expression, then/else hold statement lists), a $switch multiway branch (discriminant matched by string form against cases keys, like element-level $switch), a dispatchEvent statement (WHATWG DOM: dispatches a CustomEvent from the handler's current target, with CustomEventInit members detail/bubbles/composed), or the two WHATWG event verbs stopPropagation and preventDefault, each spelled as the member set to true.",oneOf:[{$ref:"#/$defs/ExpressionNode"},{additionalProperties:!1,properties:{else:{items:{$ref:"#/$defs/Statement"},type:"array"},if:{$ref:"#/$defs/ExpressionOperand"},then:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["if","then"],title:"if / then / else — conditional branch (JSON Schema keyword triple)",type:"object"},{additionalProperties:!1,properties:{$switch:{$ref:"#/$defs/ExpressionOperand"},cases:{additionalProperties:{items:{$ref:"#/$defs/Statement"},type:"array"},type:"object"},default:{items:{$ref:"#/$defs/Statement"},type:"array"}},required:["$switch","cases"],title:"$switch / cases — multiway branch (element-level convention, ECMA switch semantics)",type:"object"},{additionalProperties:!1,properties:{bubbles:{type:"boolean"},composed:{type:"boolean"},detail:{$ref:"#/$defs/ExpressionOperand"},dispatchEvent:{description:"The CustomEvent type to dispatch (WHATWG DOM dispatchEvent).",type:"string"}},required:["dispatchEvent"],title:"dispatchEvent — emit a CustomEvent (WHATWG naming, CustomEventInit members)",type:"object"},{additionalProperties:!1,properties:{stopPropagation:{const:!0,description:"Stop the handler's event at the current target (WHATWG DOM stopPropagation), so an ancestor's handler for the same event does not run. A body run without an event has nothing to stop."}},required:["stopPropagation"],title:"stopPropagation — stop the event here (WHATWG DOM)",type:"object"},{additionalProperties:!1,properties:{preventDefault:{const:!0,description:"Cancel the handler's event's default action (WHATWG DOM preventDefault): a link's navigation, a form's submission, a key's scroll."}},required:["preventDefault"],title:"preventDefault — cancel the event's default action (WHATWG DOM)",type:"object"}]},lh={description:"A structured function body: statements executed sequentially (one yielding a promise is awaited before the next, per ECMA async/await semantics).",items:{$ref:"#/$defs/Statement"},type:"array"}});var uh,fh;var dh=M(()=>{uh=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],fh={description:'An external class / data source. $prototype is a constructor name (not "Function"). When $prototype is not in the built-in registry, $src is required. All state entries are reactive by default.',properties:{$export:{description:"Named export in $src module. Defaults to the $prototype value.",type:"string"},$prototype:{description:"Constructor name — built-in Web API class or external class name.",examples:["Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream","MarkdownCollection","MyParser"],not:{const:"Function"},type:"string"},$src:{description:"External module specifier. Required when $prototype is not a built-in.",examples:["@jxsuite/md","./lib/my-parser.js","npm:@myorg/data"],type:"string"},autoIncrement:{type:"boolean"},body:{},database:{type:"string"},debounce:{minimum:0,type:"integer"},default:{},description:{type:"string"},domain:{type:"string"},filter:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single filter object, e.g. an equality shorthand.",type:"object"},{description:'Ordered filter rules, e.g. [{ field: "Slug", op: "not empty" }].',items:{type:"object"},type:"array"}],description:"Filter configuration: a reactive $ref binding, a single filter object, or an ordered array of rules."},headers:{additionalProperties:{type:"string"},type:"object"},indexes:{items:{properties:{keyPath:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},name:{type:"string"},unique:{type:"boolean"}},required:["name","keyPath"],type:"object"},type:"array"},items:{},key:{type:"string"},keyPath:{type:"string"},manual:{type:"boolean"},map:{$ref:"#/$defs/ElementDef"},maxAge:{type:"integer"},method:{enum:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],type:"string"},name:{type:"string"},path:{type:"string"},responseType:{enum:["json","text","blob","arraybuffer","document",""],type:"string"},sameSite:{enum:["strict","lax","none"],type:"string"},secure:{type:"boolean"},sort:{anyOf:[{$ref:"#/$defs/RefObject"},{description:"A single sort rule, e.g. { field, order }.",type:"object"},{description:'Ordered sort rules, e.g. [{ field: "date", order: "desc" }].',items:{type:"object"},type:"array"}],description:"Sort configuration: a reactive $ref binding, a single { field, order } rule, or an ordered array of rules."},src:{description:"Configuration property passed to external class constructor.",type:"string"},store:{type:"string"},timing:{enum:["compiler","server","client"],type:"string"},url:{$ref:"#/$defs/StringOrRef"},version:{minimum:1,type:"integer"}},required:["$prototype"],type:"object"}});var ph;var mh=M(()=>{ph={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});function nw(){return`the Intl helpers ${gh.join(", ")}`}var _r="en-US",hh="UTC",ew,gh,tw;var yh=M(()=>{ew=[{api:"Intl.NumberFormat",params:["value","locale","options"],path:"Intl/formatNumber",summary:"Format a number for a locale — grouping, decimals, currency, percent, units."},{api:"Intl.DateTimeFormat",params:["value","locale","options"],path:"Intl/formatDate",summary:"Format a date or timestamp for a locale. Pass `timeZone` in options."},{api:"Intl.RelativeTimeFormat",params:["value","unit","locale","options"],path:"Intl/formatRelativeTime",summary:'Format a relative time — `-3, "day"` becomes "3 days ago".'},{api:"Intl.ListFormat",params:["values","locale","options"],path:"Intl/formatList",summary:'Join a list the way a locale does — "a, b, and c", not a hand-written comma join.'},{api:"Intl.PluralRules",params:["value","locale","options"],path:"Intl/plural",summary:'Which plural category a number falls in ("one", "few", "other") — many languages have '+"more than two, so a ternary on `n === 1` is wrong outside English."},{api:"Intl.Collator",params:["a","b","locale","options"],path:"Intl/compare",summary:'Compare two strings for sorting. `<` and `sort()` order by UTF-16 code unit, which puts "Zebra" before "apple" and sorts every accented word into the wrong place.'},{api:"Intl.DisplayNames",params:["code","type","locale","options"],path:"Intl/displayName",summary:'The name of a language, region, script or currency in a locale — "de" as "German" or '+'"Deutsch", from CLDR rather than a hand-kept table.'},{api:"Intl.Segmenter",params:["value","granularity","locale"],path:"Intl/segment",summary:"Split text into graphemes, words or sentences (UAX #29). `[...str]` splits code points, so it cuts an emoji with a skin-tone modifier in half."}],gh=ew.map((e)=>e.path),tw=Object.fromEntries(ew.map((e)=>[e.path,e.params.indexOf("locale")]))});var xh,bh,$h,Sh,wh,vh,Eh,jh,Ph,kh,_h,Oh,Ah,Ch,Rh,Th,Nh;var Jh=M(()=>{yh();xh={additionalProperties:!1,description:"A JSON Pointer $ref operand within an expression node. $args/<name> resolves a named formula's parameter (callable entries only).",properties:{$ref:{pattern:String.raw`^(\$map/|\$reduce/|\$args/|event#/|#/|parent#/|window#/|document#/)`,type:"string"}},required:["$ref"],type:"object"},bh={anyOf:[{not:{pattern:String.raw`\$\{`},type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"},{description:"Plain-object literal (e.g. an Intl options bag). Objects carrying $ref or operator keys are pointers/nodes, never literals.",not:{anyOf:[{required:["$ref"]},{required:["operator"]}]},type:"object"}],description:"A non-reactive operand: scalar, plain-object literal, or array of operands."},$h={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},Sh={enum:["!","-"]},wh={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},vh={const:"?:"},Eh={const:"switch"},jh={const:"call"},Ph={description:"A genuine pure String.prototype / Array.prototype / Number.prototype method (spec §19.4d). The ES2023 change-by-copy family (toSorted, toReversed, toSpliced, with) stands in where mutation would otherwise occur. Receiver in target; value carries the argument (bare scalar) or argument list (array).",enum:["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]},kh={enum:["=","+=","-=","*=","/="]},_h={enum:["pop","shift"]},Oh={enum:["push","unshift"]},Ah={const:"splice"},Ch={const:"reduce"},Rh={enum:["map","filter"]},Th={additionalProperties:!1,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},{not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/SpliceMethod"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},minItems:1,type:"array"}},required:["operator","value"],title:"splice — array receiver, [start, deleteCount, ...items]"},{properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},{not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/ExpressionNode"}]},value:{$ref:"#/$defs/ExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},{description:"The ECMAScript conditional (ternary) operator, pure: target is the test, value the consequent, initial the alternate (the reduce precedent for repurposing initial). Chain else-if by nesting another ?: node in initial.",properties:{operator:{$ref:"#/$defs/ConditionalOperator"}},required:["operator","value","initial"],title:"?: — pure conditional; test in target, consequent in value, alternate in initial"},{description:"Value-keyed multiway selection, pure: target is the discriminant (matched against case keys by its string form, like element-level $switch), cases maps matched values to result operands, default is the operand when no case matches (result is undefined without it). Condition-chain branching composes from nested ?: nodes instead.",not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},type:"object"},default:{$ref:"#/$defs/ExpressionOperand"},operator:{$ref:"#/$defs/SwitchOperator"}},required:["operator","cases"],title:"switch — pure value-keyed selection; discriminant in target, results in cases/default"},{description:"A pure standard-library method call: target is the receiver (any operand — never mutated; change-by-copy names replace the mutating originals), value the optional argument (bare scalar) or argument list (array). A missing receiver or method yields undefined, matching null-safe path reads.",not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/PureMethod"}},required:["operator"],title:"Pure method — genuine prototype methods; receiver in target, args in value"},{description:"Invoke a callable, pure in formula position: target is the callee pointer — a named formula entry (#/state/…) or a blessed pure global via window#/ (Math.*, JSON.*, Object.keys/values/entries, and "+`${nw()}) — and value is the positional argument list (the splice args-in-value precedent). Argument order follows the callee's declared parameters.`,not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/CallOperator"},target:{$ref:"#/$defs/ExpressionPointer"},value:{items:{$ref:"#/$defs/ExpressionOperand"},type:"array"}},required:["operator"],title:"call — invoke a named formula or blessed global; callee in target, args in value"}],properties:{cases:{additionalProperties:{$ref:"#/$defs/ExpressionOperand"},description:"switch only: matched discriminant value (string form) → result operand.",type:"object"},default:{$ref:"#/$defs/ExpressionOperand",description:"switch only: result operand when no case key matches."},initial:{$ref:"#/$defs/ExpressionOperand"},operator:{type:"string"},target:{$ref:"#/$defs/ExpressionOperand"},value:{$ref:"#/$defs/ExpressionOperand"}},required:["operator","target"],type:"object"},Nh={additionalProperties:!1,description:"A declarative expression entry (Shape 5). Used as a state entry or inline event handler. With parameters it is a named formula: a pure, reusable computation invoked via the call operator, its parameters resolved through $args/<name> refs in the body.",properties:{$description:{type:"string"},$expression:{$ref:"#/$defs/ExpressionNode"},$title:{type:"string"},parameters:{description:"Named-formula parameters (CEM convention, as on Function entries): bare names or CEM parameter objects. Present ⇒ the entry is callable, not a computed value.",items:{anyOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"}},required:["$expression"],type:"object"}});var Mh,Ih,Dh,Lh;var Fh=M(()=>{Mh={description:"A single state entry. Shape is determined by value type: "+"scalar/array → naked reactive property, string with ${} → computed, "+'object with $prototype: "Function" → function, '+"object with $prototype: <other> → data source, "+"object with type and default → typed reactive property, "+"plain object → naked object reactive property.",oneOf:[{type:"number"},{type:"boolean"},{type:"null"},{type:"string"},{type:"array"},{$ref:"#/$defs/TypedStateDef"},{$ref:"#/$defs/FunctionDef"},{$ref:"#/$defs/ExternalClassDef"},{$ref:"#/$defs/ExpressionEntry"},{not:{anyOf:[{required:["$prototype"]},{required:["default"]},{required:["type"]},{required:["$expression"]}]},type:"object"}]},Ih={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Dh={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Lh={description:"A $defs type definition entry. Must be a pure JSON Schema type definition or a class definition (.class.json format).",oneOf:[{$ref:"#/$defs/PureTypeDef"},{$ref:"#/$defs/ClassDef"}]}});var rw,xu,bu,$u,Su,wu,vu,Eu,ju,Pu,Vh;var qh=M(()=>{rw=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],xu={description:"A typed parameter definition for a class.",properties:{default:{},description:{type:"string"},examples:{type:"array"},format:{description:`When "json-schema", this parameter's value is itself a JSON Schema.`,type:"string"},identifier:{type:"string"},type:{}},required:["identifier"],type:"object"},bu={description:"A class field definition with access control and scope.",properties:{$prototype:{description:'Data source prototype for this field (e.g., "Request").',type:"string"},access:{enum:["public","private","protected"],type:"string"},default:{},description:{type:"string"},examples:{type:"array"},identifier:{type:"string"},initializer:{},role:{const:"field",type:"string"},scope:{enum:["instance","static"],type:"string"},type:{}},type:"object"},$u={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},Su={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:rw,type:"string"},scope:{enum:["instance","static"],type:"string"},setter:{properties:{body:{type:"string"},parameters:{type:"array"}},type:"object"},timing:{description:"Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",items:{enum:["compiler","server","client"],type:"string"},type:"array"}},type:"object"},wu={description:"Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",properties:{documentKinds:{description:'"page"/"component" allow the extension in pages/components discovery; "content" allows it as a content-type source.',items:{enum:["page","component","content"],type:"string"},type:"array"},exportTarget:{description:"When true, site builds emit a serialized sidecar per page in this format.",type:"boolean"},extensions:{description:'File extensions this format claims, with leading dot (e.g. [".md"]).',items:{pattern:String.raw`^\.`,type:"string"},minItems:1,type:"array"},mediaType:{description:"MIME type for the format (icons, labels, HTTP).",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},vu={additionalProperties:!1,description:"Project-section admission block (specs/extensions.md §9). A class carrying this block owns "+"the project.json section named by `key`; hosts dispatch that section's data through the class's projectData/resolvePaths capabilities.",properties:{description:{type:"string"},key:{description:"The project.json top-level section this class owns (exclusive per project).",type:"string"},referenceable:{description:"Whether section entries can be referenced from documents (e.g. content types).",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},Eu={additionalProperties:!1,description:"Server-mount admission block (specs/extensions.md §11). A class carrying this block mounts "+"routes under its /_jx/ basePath in the site worker and dev server.",properties:{basePath:{description:"Route subtree this class mounts — must be under /_jx/ (exclusive per project).",examples:["/_jx/data","/_jx/auth"],type:"string"},module:{description:"Module specifier exporting the mount handler.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},ju={description:"Connection-provider admission block (specs/extensions.md §12). A class carrying this block "+"provides database connections of the given provider/kind.",properties:{kind:{description:"SQL dialect family the provider speaks.",enum:["sqlite","postgres"],type:"string"},local:{description:"Local-development substitute provider (e.g. sqlite for D1).",type:"string"},module:{description:"Module specifier exporting the provider implementation.",type:"string"},provider:{description:"Provider identifier (e.g. d1, supabase, sqlite).",type:"string"},serve:{description:"Module specifier exporting the serve-time worker binding.",type:"string"}},required:["provider","kind"],type:"object"},Pu={description:"Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",properties:{documentMode:{properties:{componentWhen:{description:"Treat the document as a component when this top-level/frontmatter key matches the regex.",properties:{frontmatterKey:{type:"string"},matches:{type:"string"}},type:"object"},default:{enum:["content","component"],type:"string"}},type:"object"},elements:{description:"Element allowlist and nesting constraints for structural editing.",properties:{block:{items:{type:"string"},type:"array"},inline:{items:{type:"string"},type:"array"},nesting:{additionalProperties:{properties:{block:{type:"boolean"},directive:{type:"boolean"},inline:{type:"boolean"},only:{items:{type:"string"},type:"array"}},type:"object"},description:'Per-parent child rules keyed by tag (or "_root"): { block, inline, directive } booleans or { only: [tags] }.',type:"object"},textOnly:{items:{type:"string"},type:"array"},void:{items:{type:"string"},type:"array"}},type:"object"},icon:{type:"string"},modes:{description:"Editor modes the studio offers for documents of this format.",items:{type:"string"},type:"array"},newFileTemplate:{description:"Initial source text for newly created files of this format.",type:"string"}},type:"object"},Vh={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});function zn(e){if(!_(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function tl(e){let t=zn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&pM.has(r)?"rtl":"ltr"}function sw(e){let t=zn(e);if(t===null)return _(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Hh(e){let t=e.i18n,n=[];if(!F(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let l of r){let c=zn(l);if(c===null){n.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(c))s.push(c)}let o=zn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&zn(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};let i=[o,...s.filter((l)=>l!==o)],a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:mM;return{errors:n,i18n:{defaultLocale:o,locales:i,routing:a}}}function fr(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=zn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var pM,ku="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",mM="prefix-except-default";var _o=M(()=>{ae();pM=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});var ow,Ts="utf-8",_u;var Wh=M(()=>{_o();ow=[301,302,303,307,308],_u={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"JSON Schema type definitions, tooling only. A document's #/$defs/Name reference resolves here when the document does not define Name itself.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"},sources:{additionalProperties:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:"Add sources to a computed directive without restating it. Each entry is appended after the derived sources (the script hashes and collected origins stay), skipped if already present. A directive the policy does not carry is created from the one a browser falls back to, `default-src` for the fetch directives. For origins that arrive only at runtime. A directive named here and in `directives` is a build error.",propertyNames:{pattern:"^[A-Za-z][A-Za-z0-9-]*$"},type:"object"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:Ts,description:"The <meta charset> every page declares. The HTML Standard allows only utf-8, which is the default.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},format:{default:"jxn",description:"The native notation Studio writes new documents in: `jxn` (Jx Notation) or `json`. Both are read everywhere; this decides only what is created.",enum:["jxn","json"],type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:ku,type:"string"},type:"array"}},type:"object"},i18n:{description:"Internationalization configuration.",properties:{defaultLocale:{description:"Default locale, as a BCP 47 language tag. The pattern catches shape errors (`en_US`, `en--US`); the build is the authority on well-formedness.",examples:["en"],pattern:ku,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:ku,type:"string"},type:"array"},routing:{description:"Locale routing strategy.",enum:["prefix-except-default","prefix-always"],type:"string"}},type:"object"},images:{$ref:"#/$defs/ImageConfig"},imports:{additionalProperties:{type:"string"},description:"Global import map: $prototype names to .class.json file paths. Makes external classes available by name in all pages.",examples:[{Markdown:"@jxsuite/parser/Markdown.class.json",MarkdownCollection:"@jxsuite/parser/MarkdownCollection.class.json"}],type:"object"},name:{default:"Jx Site",description:"Human-readable project name.",examples:["My Portfolio","Jx Example Site"],type:"string"},redirects:{additionalProperties:{oneOf:[{description:"Destination path or URL; implies a 301.",type:"string"},{additionalProperties:!1,description:"A redirect with an explicit RFC 9110 §15.4 status.",properties:{destination:{type:"string"},status:{default:301,description:"RFC 9110 §15.4 redirection status. 307 and 308 preserve the request method; "+"301 and 302 historically do not.",enum:[...ow],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});var Bh;var Uh=M(()=>{Bh={additionalProperties:!1,description:"Schema for jx-extension.json manifests. Located at the extension package root and exported so hosts can resolve <package>/jx-extension.json through the exports map.",properties:{$schema:{type:"string"},classes:{additionalProperties:{type:"string"},description:"$prototype-visible class name → class descriptor path, relative to the manifest.",type:"object"},description:{description:"One-line description.",type:"string"},name:{description:"Package name; must match package.json.",type:"string"},schemas:{additionalProperties:!1,description:"Schema fragments this package contributes, relative to the manifest.",properties:{document:{description:"Document-schema fragment (positions like $paths values).",type:"string"},fields:{description:"Field-union fragment: its $defs members are unioned into the per-project "+"field-schema resource as extension field extras (specs/extensions.md §5.3).",type:"string"},project:{description:"Project-schema fragment (top-level project.json sections).",type:"string"}},type:"object"},title:{description:"Human-readable name for studio surfaces.",type:"string"}},required:["name"],type:"object"}});var nl="https://jxsuite.com/schema/project/fields/v2",Oo="https://jxsuite.com/schema/document/paths/v2",zh,Kh,rl,Gh;var sl=M(()=>{zh={description:"A single field definition inside a section entry schema — a small, recursive subset of "+"JSON Schema. Recursive positions reference the effective field union via the well-known fields resource $id.",properties:{default:{},description:{type:"string"},enum:{type:"array"},format:{type:"string"},items:{$ref:"https://jxsuite.com/schema/project/fields/v2"},properties:{additionalProperties:{$ref:"https://jxsuite.com/schema/project/fields/v2"},type:"object"},required:{items:{type:"string"},type:"array"},type:{enum:["string","number","integer","boolean","array","object"],type:"string"}},required:["type"],type:"object"},Kh={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},rl=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],Gh={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});var ol=M(()=>{wm();Em();_m();Am();Tm();Nm();Mm();Um();zm();Xm();nh();sh();ih();ch();dh();mh();Jh();Fh();qh();Wh();Uh();sl()});import{existsSync as hM,readFileSync as gM}from"node:fs";import{basename as yM,resolve as xM}from"node:path";function as(e){let t=Un(e);if(!hM(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=du(gM(t,"utf8"),t)}catch(i){throw Error(`Invalid ${yM(t)}: ${ye(i)}`,{cause:i})}let r={...il,...n,build:{...il.build,...n.build},defaults:{...il.defaults,...n.defaults},images:{...il.images,...n.images},url:n.url??il.url};if(n.$head)r.$head=n.$head;if(n.$media)r.$media=n.$media;if(n.style)r.style=n.style;if(n.state)r.state=n.state;if(n.redirects)r.redirects=n.redirects;if(n.imports)r.imports=n.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(r.build.adapter==="static")delete r.build.adapter;if(r.build.adapter&&!s.includes(r.build.adapter))throw Error(`Unknown build adapter "${r.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let o=["build","cloudflare"];if(!o.includes(r.images.service))throw Error(`Unknown images.service "${r.images.service}" in project.json. Valid services: ${o.join(", ")}`);return{config:r,configPath:t,projectRoot:xM(e)}}function iw(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var il;var ji=M(()=>{ol();Ft();pu();ko();il={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:Ts,lang:"en",layout:null},images:{formats:["avif","jpeg"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as Xh,readFileSync as aw,writeFileSync as bM}from"node:fs";import{resolve as lw}from"node:path";async function cw(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=as(e),o=await Rs(e,s),i=L(s.connections)?s.connections:{},a=L(s.data)?s.data:{},l=Object.keys(i).filter((g)=>!r||g===r);if(r&&l.length===0)throw Error(`Unknown connection "${r}" (no such connections entry in project.json)`);if(l.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let c={...process.env,...SM(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let g of l){let b=i[g],h=L(b)?{...b,$name:g}:{$name:g},x=String(h.provider??""),k=$M(o.connectors(),x);if(!k)throw Error(`Connection "${g}" names provider "${x}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let w={};for(let[E,O]of Object.entries(a))if(L(O)&&O.connection===g)w[E]=O;let v=await k.call("deploySchema",w,h,{dryRun:n,env:c});if(u.push({applied:v.applied??!n,connection:g,provider:x,statements:v.statements??[],tables:Object.keys(w),warnings:v.warnings??[]}),k.capabilities.bindings){let E=await k.call("bindings",h);if(L(E)&&Object.keys(E).length>0)d.push(E)}}let p=lw(e,"wrangler.jsonc"),m=!1;if(!n&&d.length>0&&Xh(p)){let g=aw(p,"utf8"),{content:b,patched:h}=k$(g,d);if(h&&b!==g)bM(p,b,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:Xh(p)?p:null}}function $M(e,t){return e.find((n)=>n.connector?.provider===t)}function SM(e){let t=lw(e,".dev.vars");if(!Xh(t))return{};let n=new Map;for(let r of aw(t,"utf8").split(`
|
|
54
|
-
`)){let s=r.trim();if(s===""||s.startsWith("#"))continue;let o=s.indexOf("=");if(o===-1)continue;let i=s.slice(0,o).trim(),a=s.slice(o+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(i!=="")n.set(i,a)}return Object.fromEntries(n)}var
|
|
55
|
-
`}var
|
|
53
|
+
`}var nn=" ",Ah=100,uv,fv,QD,eI,rn=(e)=>M(e),Jl=(e)=>rn(e)&&O(e.$ref)&&Object.keys(e).length===1,st=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,sI;var gf=F(()=>{sf();ae();ea();Rl();pf();uv=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,fv=/[\p{Cc}\p{Zl}\p{Zp}--]/u,QD=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,eI=new Set(["-","attributes","script","state","style"]);sI=new Set(["$export","$src","arguments","timing"])});function yI(e,t,n){if(ta(e,t)!==null)throw Ne(e,t,`"project" names the file's kind, and takes no annotation`);let r=cr(e,t);if(r.length>1||ur(t).length>0||tn(t).length>0)throw Ne(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)Ce(n,"name",r[0],e,t),Rt(e,"/name",t)}function xI(e,t,n){let r=t.getName(),s=`/${at(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=Sh(e,t),Rt(e,s,t);else if(gI.has(r)&&o)i=lf(e,t,s);else i=lr(e,t,s);Ce(n,r,i,e,t)}function bI(e){if(Fi(e.text)==="document")throw new en('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=wh(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===hI){if(r)throw Ne(e,s,'"project" is written twice, and a file declares one project');yI(e,s,n),r=!0}else xI(e,s,n);return Ju(n)}function Th(e,t){try{return bI({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof en?n.inFile(t):n}}var hI="project",gI;var Jh=F(()=>{ae();St();wl();ea();Rl();pf();gf();gI=new Set(["$media","style"])});var As=F(()=>{wl();cf();ea();rv();Rl();pf();gf();Jh()});function Sv(e){if(e===null)throw TypeError("A class descriptor cannot be null");return M(e)?e:{}}class Nl{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=Mu(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=wI(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 yf{#t;#e=new Map;get#n(){return[...this.#t,OI]}constructor(e){this.#t=e;for(let n of e)if(n.extensions.includes(".jxn"))throw Error(`Format "${n.name}" claims ".jxn", which is built in`);for(let n of e){if(n.mediaType===null)continue;let r=dw(n.mediaType);if(r!==null)throw Error(`Format "${n.name}" declares an invalid mediaType: ${r}`)}let t=new Map;for(let n of e){let r=mw(n.mediaType??void 0);if(r===null)continue;for(let s of n.extensions){if(s===".json")continue;let o=t.get(s);if(o===void 0)t.set(s,{entry:n,served:r}),this.#e.set(s,r);else if(!PI(o.served,r))throw Error(`Format conflict: "${o.entry.name}" and "${n.name}" both claim "${s}" with different media types ("${o.served}" and "${r}")`)}}for(let n of bv){let r=new Map;for(let s of e){if(!s.capabilities[n])continue;for(let o of s.extensions){let i=r.get(o);if(i)throw Error(`Format conflict: "${i.name}" and "${s.name}" both claim "${o}" with the "${n}" capability`);r.set(o,s)}}}}get entries(){return this.#t}byExtension(e,t){let n=Nh(e);return this.#n.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}mediaTypeFor(e){return this.#e.get(Nh(e))??null}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#n.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#n){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=Nh(e);return this.#n.some((n)=>n.extensions.includes(t))}}function wI(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!EI(o))continue;let i={identifier:s.identifier??r,timing:s.timing??SI};if(O(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function EI(e){return e!==void 0&&vI.has(e)}function PI(e,t){let n=Li(e),r=Li(t);if(n===null||r===null||Mu(e)!==Mu(t))return!1;let s=Object.keys(n.parameters);return s.length===Object.keys(r.parameters).length&&s.every((o)=>{let i=r.parameters[o],a=n.parameters[o];return o==="charset"?i?.toLowerCase()===a?.toLowerCase():i!==void 0&&i===a})}function Nh(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var bv,$v,SI,vI,jI,OI;var Mh=F(()=>{ae();Zm();bv=["parse","serialize","rewrite","discover","load"],$v=[...bv,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];SI=["compiler","server"];vI=new Set($v);jI={importModule:async()=>{await Promise.resolve().then(() => As());return{JxNotation:{parse:(n)=>Zo(n),serialize:(n)=>Rh(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},OI=new Nl("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},jI)});function kI(e){return e?.referenceable===!0}class wv{#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 yf(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)}referenceableSections(){return this.projectContributions().filter((e)=>kI(e.project))}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 vv(e,t,n){let r=[];for(let s of e??[])r.push(await _I(s,t,n));return new wv(r)}async function _I(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(n,e);r=t.resolvePath(`${l}/package.json`,`./${Ml}`)}else try{r=t.resolvePath(n,`${e}/${Ml}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Ml} (is the package installed, and does its exports map include it?): ${Dh(l)}`,{cause:l})}let s;try{s=await t.loadJson(r)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${r}: ${Dh(l)}`,{cause:l})}if(!M(s)||!O(s.name))throw Error(`Extension "${e}": ${Ml} 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}: ${Dh(p)}`,{cause:p})}i.push(new Nl(l,u,Sv(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 Dh(e){return e instanceof Error?e.message:String(e)}var Ml="jx-extension.json";var Ev=F(()=>{Mh();ae();Mh()});var Pv=F(()=>{ae();St()});function CI(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 Ov(e){let t=AI.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function ra(e,t){return Vr(t)?Th(e,t):ew(e,t)}var AI,jv="project.jxn",Ih;var Dl=F(()=>{ae();Pv();wl();cf();Jh();St();AI=["project.jxn","project.json"];Ih=class Ih extends Error{constructor(e){super(CI(e));this.name="ProjectFileConflictError"}}});import{accessSync as A7,closeSync as C7,constants as R7,existsSync as RI,fstatSync as T7,lstatSync as J7,openSync as N7,readFileSync as M7,statSync as TI}from"node:fs";import{dirname as I7,join as Lh}from"node:path";function kv(e){return Ov((t)=>RI(Lh(e,t)))}function dr(e){let t=kv(e);if(t==="conflict")throw new Ih(e);return Lh(e,t??jv)}function _v(e){let t=kv(e);if(t===null||t==="conflict")return null;let n=Lh(e,t),r=TI(n,{throwIfNoEntry:!1})?.mtimeMs;return r===void 0?null:{mtime:r,path:n}}var so=F(()=>{Dl()});import{existsSync as JI,readFileSync as NI}from"node:fs";import{dirname as bf,isAbsolute as MI,resolve as Av,sep as xf}from"node:path";import{pathToFileURL as DI}from"node:url";import{createRequire as II}from"node:module";function Cv(e){let t=[e],n=`${xf}src${xf}`,r=`${xf}dist${xf}`;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 Rv(e){let t=Cv(e),n=bf(e),r=[...t.filter((o)=>bf(o)===n),...t.filter((o)=>bf(o)!==n)],s=r.find((o)=>JI(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function Fh(e){let t=Cv(e),n;for(let r of t)try{return await import(DI(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function Vh(e,t){return II(Av(e,"package.json")).resolve(t)}function qh(e){return{importModule:(t)=>Fh(t),loadJson:async(t)=>Di(NI(t,"utf8"),t),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return Av(bf(t),n);if(MI(n))return n;return Vh(e,n)}}}async function qr(e,t){return vv(t?.extensions,qh(e),dr(e))}function $f(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 Hr=F(()=>{Ev();ae();St();so()});function oo(e,t){if(e.project==null)return!0;let n=t?.[e.project.key];if(n===void 0||n===null)return!1;return V(n)?Object.keys(n).length>0:!0}async function Tv(e,t,n,r={}){let s={},o=qh(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 Sf=F(()=>{Hr();ae()});async function LI(e,t){let n=e.connectors(),r={};for(let s of n){let o=String(s.connector.provider),{local:i}=s.connector,a=t.standins&&O(i)?n.find((l)=>l.connector.provider===i)??s:s;r[o]=await a.implementationExport()}return r}async function Jv(e,t,n){let{dryRun:r,env:s,standins:o}=n,i=e.projectContributions().filter((c)=>c.connector===null&&c.capabilities.deploySchema),a,l=[];for(let c of i){let{key:u}=c.project,d=t[u];if(d===void 0||d===null||!oo(c,t))continue;try{a??=LI(e,{standins:o});let m={connectors:await a,dryRun:r,env:s};if(n.connection!==void 0)m.connection=n.connection;let g=await c.call("deploySchema",d,t,m),y=g.steps.map((h)=>(h.kind||=u,h));l.push({applied:!r,section:u,steps:y,warnings:g.warnings})}catch(p){l.push({applied:!1,error:ye(p),section:u,steps:[],warnings:[]})}}return l}var Nv=F(()=>{St();Sf();ae()});var Hh,Wh;var Bh=F(()=>{Hh={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."},Wh={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var Uh;var zh=F(()=>{Uh={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 Kh,Gh,Xh;var Yh=F(()=>{Kh={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Gh={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},Xh={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var Zh;var Qh=F(()=>{Zh={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 eg,tg;var ng=F(()=>{eg={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"},tg={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 Il;var rg=F(()=>{Il={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 sg;var og=F(()=>{sg={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var ig,ag,lg,cg,ug,fg,dg,pg,mg;var hg=F(()=>{ig={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},ag={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},lg={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},cg={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},ug={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},fg={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"},dg={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},pg={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"},mg={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Ll;var gg=F(()=>{Ll={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 yg,xg;var bg=F(()=>{yg={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"},xg={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 $g,Sg,wg,vg,Eg,wf;var Pg=F(()=>{$g={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Sg={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"},wg={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},vg={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"},Eg={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"},wf={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 jg;var Og=F(()=>{jg={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"},$type:{description:"TypeScript type the checker reads for this entry, such as `Task[]`. No other tier reads it.",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 kg;var _g=F(()=>{kg={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 Ag,Cg;var Rg=F(()=>{Ag={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"}]},Cg={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,Jg;var Ng=F(()=>{Tg=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],Jg={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 that one built-in alone reads are declared for that prototype only (allOf).',allOf:[{if:{properties:{$prototype:{const:"FormData"}},required:["$prototype"]},then:{properties:{fields:{additionalProperties:{type:["boolean","number","string"]},description:"Initial fields, appended in key order. A number or boolean is sent as its text.",type:"object"}}}},{if:{properties:{$prototype:{const:"Blob"}},required:["$prototype"]},then:{properties:{parts:{description:"The Blob's text parts, concatenated in order.",items:{type:"string"},type:"array"},type:{description:'The MIME type. Defaults to "text/plain".',type:"string"}}}}],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 Mg;var Dg=F(()=>{Mg={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});function Iv(){return`the Intl helpers ${Lg.join(", ")}`}var Wr="en-US",Ig="UTC",Mv,Lg,Dv;var Fg=F(()=>{Mv=[{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."}],Lg=Mv.map((e)=>e.path),Dv=Object.fromEntries(Mv.map((e)=>[e.path,e.params.indexOf("locale")]))});var Vg,qg,Hg,Fl,Vl,ql,Hl,Wl,Bl,Qo,ei,ti,ni,Ul,zl,Lv,Fv,FI,VI,qI,HI,Vv,qv,Hv,Wv,Bv,Uv,zv,Wg,Bg,Ug;var Kl=F(()=>{Fg();Vg={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"},qg={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."},Hg={anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/PureExpressionNode"},{$ref:"#/$defs/ExpressionLiteral"}],description:"Anything that may appear in target or value: a pointer, a literal, or a nested expression node."},Fl={enum:["!","-"]},Vl={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},ql={const:"?:"},Hl={const:"switch"},Wl={const:"call"},Bl={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"]},Qo={enum:["=","+=","-=","*=","/="]},ei={enum:["pop","shift"]},ti={enum:["push","unshift"]},ni={const:"splice"},Ul={const:"reduce"},zl={enum:["map","filter"]},Lv={not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/UnaryOperator"}},required:["operator"],title:"Unary — target only, no value"},Fv={not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/BinaryOperator"}},required:["operator","value"],title:"Binary — left in target, right in value"},FI={not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/AssignmentOperator"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"Assignment — writable target, value required"},VI={not:{anyOf:[{required:["value"]},{required:["initial"]}]},properties:{operator:{$ref:"#/$defs/NoArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator"],title:"pop / shift — array receiver, no value"},qI={not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/OneArgMethod"},target:{$ref:"#/$defs/ExpressionPointer"}},required:["operator","value"],title:"push / unshift — array receiver, single value argument"},HI={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]"},Vv={properties:{operator:{$ref:"#/$defs/ReduceMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/PureExpressionNode"}]},value:{$ref:"#/$defs/PureExpressionNode"}},required:["operator","value","initial"],title:"reduce — pure fold over a pointer or derived array; seed in initial"},qv={not:{required:["initial"]},properties:{operator:{$ref:"#/$defs/MapFilterMethod"},target:{anyOf:[{$ref:"#/$defs/ExpressionPointer"},{$ref:"#/$defs/PureExpressionNode"}]},value:{$ref:"#/$defs/PureExpressionNode"}},required:["operator","value"],title:"map / filter — pure over a pointer or derived array; per-item expression in value"},Hv={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"},Wv={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"},Bv={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"},Uv={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 "+`${Iv()}) — 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"},zv={additionalProperties:!1,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={...zv,description:"The core expression node. operator + target, with value gated by arity.",oneOf:[Lv,Fv,FI,VI,qI,HI,Vv,qv,Hv,Wv,Bv,Uv]},Bg={...zv,description:"An expression node that computes a value and mutates nothing: the only node an operand may hold (spec §19.3).",oneOf:[Lv,Fv,Hv,Wv,Bv,Uv,Vv,qv]},Ug={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. A named formula is pure, so its root is a PureExpressionNode.",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"}},if:{properties:{parameters:{minItems:1,type:"array"}},required:["parameters"]},required:["$expression"],then:{properties:{$expression:{$ref:"#/$defs/PureExpressionNode"}}},type:"object"}});var zg,Kg,Gg,Xg;var Yg=F(()=>{zg={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"}]},Kg={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},Gg={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Xg={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 Kv,vf,Ef,Pf,jf,Of,kf,_f,Af,Cf,Zg;var Qg=F(()=>{Kv=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],vf={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"},Ef={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"},Pf={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"},jf={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:Kv,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"},Of={description:'Format participation marker. A class carrying this block is a format class: once an extension the project enables in project.json "extensions" lists it in its manifest, the compiler, server and studio dispatch file-extension work to it. Declaring the class in "imports" registers no format.',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:"Media type (RFC 6838) of the claimed files: every Jx server sends it as their Content-Type, and its essence keys Studio's file pickers and editor language id.",type:"string"},remote:{description:"When true, the load capability accepts http(s) URLs as sources.",type:"boolean"}},required:["extensions"],type:"object"},kf={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 relationship pointers (#/<key>/<name>, specs/relationships.md §1) may target this section's entries. Default false.",type:"boolean"},title:{type:"string"}},required:["key"],type:"object"},_f={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:"Import specifier the generated site worker imports this class from, by its title, resolved from the project root (e.g. @jxsuite/auth/worker). Required for a deployable build; the dev server imports $implementation instead.",type:"string"},order:{description:"Mount order (ascending; default 100).",type:"number"}},required:["basePath"],type:"object"},Af={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"}},required:["provider","kind"],type:"object"},Cf={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"},Zg={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});function Zn(e){if(!O(e))return null;try{return new Intl.Locale(e).toString()}catch{return null}}function Rf(e,t){if(O(t)&&t.trim()!==t&&Zn(t.trim())!==null)return`${e}: ${JSON.stringify(t)} has whitespace around it, which is not part of a language tag. Write ${JSON.stringify(t.trim())}.`;return`${e}: "${String(t)}" is not a well-formed BCP 47 language tag.`}function Gl(e){let t=Zn(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&WI.has(r)?"rtl":"ltr"}function Gv(e){let t=Zn(e);if(t===null)return O(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Xl(e){let t=e.i18n,n=[];if(!V(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let l of r){let c=Zn(l);if(c===null){n.push(Rf("i18n.locales",l));continue}if(!s.includes(c))s.push(c)}let o=Zn(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&Zn(t.defaultLocale)===null)n.push(Rf("i18n.defaultLocale",t.defaultLocale));if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};let i=[o,...s.filter((l)=>l!==o)],a=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:BI;return{errors:n,i18n:{defaultLocale:o,locales:i,routing:a}}}function Br(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=Zn(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}function Xv(e,t){let n=e.split("/").filter(Boolean),r=Zn(n[0]);if(t!==null&&r!==null&&t.locales.includes(r))return n.slice(1).join("/");return n.join("/")}function Yl(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?Xv(i.urlPattern,t):i.translationKey.replaceAll(/^\/+|\/+$/g,"");if(i.translationKey!==void 0)o.add(i.urlPattern);let l=Br(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}}var WI,Tf="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",BI="prefix-except-default";var Cs=F(()=>{ae();WI=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});var Zl,io="utf-8",Jf;var ey=F(()=>{Cs();Zl=[301,302,303,307,308],Jf={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"JSON Schema type definitions, tooling only. A document's #/$defs/Name reference resolves here when the document does not define Name itself.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"},sources:{additionalProperties:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:"Add sources to a computed directive without restating it. Each entry is appended after the derived sources (the script hashes and collected origins stay), skipped if already present. A directive the policy does not carry is created from the one a browser falls back to, `default-src` for the fetch directives. For origins that arrive only at runtime. A directive named here and in `directives` is a build error.",propertyNames:{pattern:"^[A-Za-z][A-Za-z0-9-]*$"},type:"object"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:io,description:"The <meta charset> every page declares. The HTML Standard allows only utf-8, which is the default.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},format:{default:"jxn",description:"The native notation Studio writes new documents in: `jxn` (Jx Notation) or `json`. Both are read everywhere; this decides only what is created.",enum:["jxn","json"],type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:Tf,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:Tf,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Tf,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:[{GeoLocation:"./lib/GeoLocation.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:[...Zl],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 ty;var ny=F(()=>{ty={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 Ql="https://jxsuite.com/schema/project/fields/v2",ri="https://jxsuite.com/schema/document/paths/v2",ry,sy="[A-Za-z][A-Za-z0-9_-]*",oy="[A-Za-z0-9._-]+",ec,tc,iy;var sa=F(()=>{ry={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"},ec={description:`Relationship reference field: points at a named entry of a referenceable section via "#/<sectionKey>/<name>" (specs/relationships.md). A bare reference is to-one; wrap in an array field's items for to-many.`,properties:{$ref:{pattern:"^#/[A-Za-z][A-Za-z0-9_-]*/[A-Za-z0-9._-]+$",type:"string"},description:{type:"string"}},required:["$ref"],type:"object"},tc=[{additionalProperties:!1,description:'Explicit value list: generates one page per value, bound to `param` (default "value").',properties:{param:{description:'Route parameter to fill (default "value").',type:"string"},values:{description:"The values to expand.",type:"array"}},required:["values"],type:"object"},{additionalProperties:!1,description:"JSON data-file source: loads a project-relative file that must contain an array, and generates one page per item.",properties:{$ref:{description:"Project-relative path to a .json file containing an array.",type:"string"},field:{description:'Item field providing the parameter value (default "id").',type:"string"},param:{description:'Route parameter to fill (default "id").',type:"string"}},required:["$ref"],type:"object"},{additionalProperties:!1,description:"Paged list: one route per `pageSize` items of an entry of this page's own state, which must resolve to an array at build time. The page number fills the route's one parameter that `each` does not.",properties:{each:{description:"Another `$paths` source for the route's other parameter: the list is paged once per value of it, as a paged archive per tag is.",type:["object","array"]},pageSize:{description:"Items on each page.",minimum:1,type:"integer"},paginate:{additionalProperties:!1,description:"The state entry to page.",properties:{$ref:{description:"A pointer to an entry of this page's state: `#/state/<key>`.",pattern:"^#/state/[^/]+$",type:"string"}},required:["$ref"],type:"object"}},required:["paginate","pageSize"],type:"object"},{description:"Legacy explicit form: an array of ready-made parameter objects, used as-is with no expansion. Prefer one of the source shapes above.",items:{additionalProperties:{type:"string"},type:"object"},type:"array"}],iy={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 nc=F(()=>{Bh();zh();Yh();Qh();ng();rg();og();hg();gg();bg();Pg();Og();_g();Rg();Ng();Dg();Kl();Yg();Qg();ey();ny();sa()});import{existsSync as UI,readFileSync as zI}from"node:fs";import{basename as KI,resolve as GI}from"node:path";function Ur(e){let t=dr(e);if(!UI(t))throw Error(`No project.jxn or project.json in ${e}`);let n;try{n=ra(zI(t,"utf8"),t)}catch(i){throw Error(`Invalid ${KI(t)}: ${ye(i)}`,{cause:i})}let r={...rc,...n,build:{...rc.build,...n.build},defaults:{...rc.defaults,...n.defaults},images:{...rc.images,...n.images},url:n.url??rc.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:GI(e)}}function Yv(e){return["0","false","no","off"].includes((e??"").trim().toLowerCase())}var rc;var oa=F(()=>{nc();St();Dl();so();rc={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:io,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 ay,readFileSync as Zv,writeFileSync as XI}from"node:fs";import{resolve as Qv}from"node:path";async function eE(e,t={}){let{dryRun:n=!1,connection:r}=t,{config:s}=Ur(e),o=await qr(e,s),i=M(s.connections)?s.connections:{},a=M(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,...ZI(e),JX_PROJECT_ROOT:e},u=[],d=[];for(let y of l){let h=i[y],x=M(h)?{...h,$name:y}:{$name:y},P=String(x.provider??""),S=YI(o.connectors(),P);if(!S)throw Error(`Connection "${y}" names provider "${P}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let v={};for(let[w,R]of Object.entries(a))if(M(R)&&R.connection===y)v[w]=R;let E=await S.call("deploySchema",v,x,{dryRun:n,env:c});if(u.push({applied:E.applied??!n,connection:y,provider:P,statements:E.statements??[],tables:Object.keys(v),warnings:E.warnings??[]}),S.capabilities.bindings){let w=await S.call("bindings",x);if(M(w)&&Object.keys(w).length>0)d.push(w)}}let p=await Jv(o,s,{dryRun:n,env:c,connection:r,standins:!1}),m=Qv(e,"wrangler.jsonc"),g=!1;if(!n&&d.length>0&&ay(m)){let y=Zv(m,"utf8"),{content:h,patched:x}=iw(y,d);if(x&&h!==y)XI(m,h,"utf8"),g=!0}return{bindingsPatched:g,results:u,sections:p,wranglerPath:ay(m)?m:null}}function YI(e,t){return e.find((n)=>n.connector?.provider===t)}function ZI(e){let t=Qv(e,".dev.vars");if(!ay(t))return{};let n=new Map;for(let r of Zv(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 tE=F(()=>{lw();Hr();Nv();oa();ae()});function ly(e,t=[]){if(!M(e))return t;let{children:n}=e;if(e.tagName==="slot"){let r=e.attributes,s=M(r)?r.name:void 0,o={name:O(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)ly(r,t);return t}var nE=F(()=>{ae()});function QI(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(O(o)){if(!o.includes("state."))return;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(!M(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&de(o.target))r(o.target.$ref);if(o.$prototype==="Array"){for(let i of[o.filter,o.sort])if(de(i))r(i.$ref)}for(let i in o){if(i==="$defs")continue;let a=o[i];if(i.startsWith("on")&&de(a))r(a.$ref);s(a)}};s(e);for(let o of si)if(M(e.state)&&o in e.state)t.add(o);return t}function cy(e){return"body"in e&&"$src"in e}function sc(e){return Tu(e.parameters??e.arguments).length>0}function zr(e){let t=["state"];for(let n of Tu(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function e1(e,t,n){if(cn(t))return"callable";if(Tu(t.parameters??t.arguments).length>0)return"callable";if(O(t.body))return Ru(t.body)&&!n().has(e)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function sn(e){let t=new Map,n=null,r=()=>n??=QI(e);for(let[s,o]of Object.entries(e.state??{}))if(Dt(o))t.set(s,e1(s,o,r));return t}var si;var Rs=F(()=>{ae();si=new Set(["onMount","onUnmount","onAdopted"])});function rE(e){if(e===null||e===void 0)return"null";if(Array.isArray(e))return"array";if(O(e))return"string";if(Ve(e))return"number";return tt(e)?"boolean":"object"}function t1(e){if(O(e))return e;if(!M(e))return;if(O(e.text))return e.text;if(O(e.type))return e.type;if(Array.isArray(e.type))return e.type.filter((t)=>O(t)).join(" | ");return O(e.$ref)?e.$ref.slice(e.$ref.lastIndexOf("/")+1):void 0}function oc(e){let t=t1(e);return t===void 0||t===""?void 0:{text:t}}function oE(e){if(O(e)&&e!=="")return e;return e===!0?!0:void 0}function n1(e,t){let n={kind:"field",name:e};if(Cu(t)){let r=oc(t.type)??oc(O(t.$ref)?{$ref:t.$ref}:void 0);if(n.type=r??{text:rE(t.default)},n.default=JSON.stringify(t.default),O(t.description))n.description=t.description;let s=oE(t.deprecated);if(s!==void 0)n.deprecated=s;return n}if(M(t)){if(Object.keys(t).some((s)=>s.startsWith("$"))||ar(t))return null}else if(ce(t))return null;return n.type={text:rE(t)},n.default=JSON.stringify(t),n}function r1(e){if(O(e))return{name:e};if(!M(e)||!O(e.name))return null;let t={name:e.name},n=oc(e.type);if(n)t.type=n;if(O(e.description))t.description=e.description;if(tt(e.optional))t.optional=e.optional;if(e.default!==void 0)t.default=JSON.stringify(e.default);return t}function s1(e,t){let n={kind:"method",name:e};if(O(t.description))n.description=t.description;let s=(t.parameters??t.arguments??[]).map((i)=>r1(i)).filter((i)=>i!==null&&i.name!=="state");if(s.length>0)n.parameters=s;let o=oc(t.type);if(o)n.return={type:o};return n}function sE(e,t){if(!Array.isArray(e))return;for(let n of e){if(!M(n)||!O(n.name)||t.has(n.name))continue;let r={name:n.name,type:oc(n.type)??{text:"Event"}};if(O(n.description))r.description=n.description;let s=oE(n.deprecated);if(s!==void 0)r.deprecated=s;t.set(n.name,r)}}function o1(e){let t=[],n=(s,o)=>{if(!M(s))return;let i=M(s.attributes)?s.attributes.part:void 0;if(O(i)){let a=US(s.tagName)||"div";for(let l of i.split(/\s+/u))if(l!=="")t.push({name:l,tagName:a,path:o})}r(s,o)},r=(s,o)=>{if(Array.isArray(s.children))for(let[i,a]of s.children.entries())n(a,[...o,"children",i])};if(M(e))r(e,[]);return t}function i1(e){return[...new Set(o1(e).map((t)=>t.name))]}function a1(e){let t=e.doc,n=M(t.state)?t.state:{},r=sn(e.doc),s=[],o=[],i=new Map,a=new Map;sE(t.emits,a);for(let[x,P]of Object.entries(n)){if(Ni(x))continue;if(Dt(P)){if(sE(P.emits,a),!si.has(x)&&r.get(x)!=="computed")o.push(s1(x,P));continue}let S=n1(x,P);if(S)o.push(S),i.set(x,S)}let l=[],c=new Set,u=Array.isArray(t.observedAttributes)?t.observedAttributes:[];for(let x of new Set(u.filter((P)=>O(P)))){let P={name:x},S=Mi(x),v=i.get(S);if(v){P.fieldName=S;for(let E of["type","default","description","deprecated"])if(v[E]!==void 0)Object.assign(P,{[E]:v[E]});if(!c.has(S)){c.add(S),v.attribute=x;let E=n[S];if(M(E)&&E.reflects===!0)v.reflects=!0}}l.push(P)}for(let[x,P]of Object.entries(n)){if(Ni(x)||!M(P)||!O(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=O(t.description)?t.description:t.$description;if(O(p))d.description=p;if(l.length>0)d.attributes=l;if(a.size>0)d.events=[...a.values()];let m=ly(t).map((x)=>({name:x.name}));if(m.length>0)d.slots=m;let g=M(t.style)?t.style:{},y=Object.entries(g).filter(([x])=>x.startsWith("--")).map(([x,P])=>({default:String(P),name:x}));if(y.length>0)d.cssProperties=y;let h=e.shadow?i1(e.doc).map((x)=>({name:x})):[];if(h.length>0)d.cssParts=h;return{module:{declarations:[d],exports:[{declaration:{name:e.className},kind:"custom-element-definition",name:e.tagName}],kind:"javascript-module",path:e.modulePath},warnings:s}}function Nf(e){let n=e.toSorted((r,s)=>r.tagName<s.tagName?-1:1).map((r)=>a1(r));return{manifest:{modules:n.map((r)=>r.module),schemaVersion:"2.1.0"},warnings:n.flatMap((r)=>r.warnings)}}function Mf(e){return`${JSON.stringify(e,null,2)}
|
|
55
|
+
`}var uy=F(()=>{nE();Rs();ae()});function c1(e){if(!O(e)||!l1.test(e))return null;let[t="",n=""]=e.slice(2).split("/");return{name:n,section:t}}function iE(e){let t=new Map,n=(r)=>{if(Array.isArray(r)){for(let s of r)n(s);return}if(!M(r))return;for(let[s,o]of Object.entries(r)){let i=s==="$ref"?c1(o):null;if(i)t.set(`${i.section}/${i.name}`,i);else n(o)}};return n(e),[...t.values()]}function fy(e){return M(e)&&O(e.id)&&M(e.data)}function u1(e,t){let r=(e instanceof Map?e.get(t):void 0)??(M(e)?e[t]:void 0);return Array.isArray(r)&&r.every((s)=>fy(s))?r:void 0}function f1(e){if(fy(e))return e.id;return Array.isArray(e)?e.map((t)=>fy(t)?t.id:t):e}function aE(e,t,n){let r=Xl(n?.i18n?{i18n:n.i18n}:{}).i18n?.defaultLocale,s={};for(let{section:o,name:i}of e){let a=u1(t[o],i);if(!a)continue;let l=new Map;for(let c of a){let u=l.get(c.id),d=c._meta?.locale===r&&u?._meta?.locale!==r;if(!u||d)l.set(c.id,c)}(s[o]??={})[i]=[...l.values()].map((c)=>({data:Object.fromEntries(Object.entries(c.data).map(([u,d])=>[u,f1(d)])),id:c.id}))}return s}var l1;var lE=F(()=>{sa();ae();Cs();l1=new RegExp(ec.properties.$ref.pattern)});function oi(e){return e.startsWith(Df)}function If(e){let t=e;if(oi(t))t=t.slice(Df.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${dy}${t}.js`}function cE(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${dy}${n}`:`${dy}${n}.${t}`}function uE(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function Lf(e){let t=uE(e);return t.startsWith("/")?t:`/${t}`}function d1(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function Ff(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 d1(e,"urlPrefix")){let o=Lf(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`${uE(s.dir)}/${a.join("/")}`}return null}function fE(e,t){let n=new Set;for(let r of t){let s=Lf(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${p1}]+`,"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 py(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 my(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function ii(e){if(!O(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 Le(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function ao(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var Df="npm:",dy="/assets/",p1;var Tn=F(()=>{ae();p1=String.raw`"'\s<>()\\`});function dE(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function hy(e,t=()=>new Date){let n=e.SOURCE_DATE_EPOCH;if(n===void 0||n==="")return dE(t());let r=new Date(Number(n)*1000);if(!m1.test(n)||Number.isNaN(r.getTime()))throw RangeError(`SOURCE_DATE_EPOCH must be a non-negative integer number of seconds, got "${n}"`);return dE(r)}var m1;var pE=F(()=>{m1=/^\d+$/});function ac(e,t){return e.replaceAll(y1,(n,r,s)=>{let o=s.trim(),i=w1.exec(o),a=i?i[2]:o,l=Le(t,a);if(l===a)return n;return`url(${r}${i?`${i[1]}${l}${i[1]}`:l}${r})`})}function gy(e,t,n,r,s){let o=n.toLowerCase();if(mE.has(o))return Le(s,r);if(hE.has(o)){let i=py(r);return i.length===0?r:my(i.map((a)=>({descriptor:a.descriptor,url:Le(s,a.url)})))}if(o==="style")return ac(r,s);if(o==="content"&&e==="meta"&&S1.test(t))return Le(s,r);return r}function yy(e,t){if(t==="")return e;let n=e.replaceAll(b1,(r,s,o,i)=>{let a=o.replaceAll(x1,(l,c)=>`"${Le(t,c)}"`);return s+a+i});return n=n.replaceAll($1,(r,s,o,i)=>s+ac(o,t)+i),n.replaceAll(h1,(r,s,o)=>{if(o==="")return r;let i=s.toLowerCase(),a=o.replaceAll(g1,(l,c,u,d,p)=>{let m=d===void 0?"'":'"',g=d??p??"",y=gy(i,o,c,g,t);return y===g?l:`${c}=${m}${y}${m}`});return a===o?r:`<${s}${a}>`})}function v1(e,t){let n=O(e.tagName)?e.tagName.toLowerCase():"",{attributes:r}=e;if(V(r)){for(let[s,o]of Object.entries(r))if(O(o))r[s]=gy(n,"",s,o,t)}for(let s of Object.keys(e)){let o=s.toLowerCase(),i=e[s];if(O(i)&&(mE.has(o)||hE.has(o)))e[s]=gy(n,"",o,i,t)}if(O(e.innerHTML))e.innerHTML=yy(e.innerHTML,t)}function ic(e,t){if(!V(e)||Array.isArray(e))return;if(qe(e)){ic(e.map,t);return}let n=e;v1(n,t);let{cases:r,children:s}=n;if(Array.isArray(s))for(let o of s)ic(o,t);else ic(s,t);if(V(r))for(let o of Object.values(r))ic(o,t)}function gE(e,t){if(t!=="")ic(e,t)}var mE,hE,h1,g1,y1,x1,b1,$1,S1,w1;var yE=F(()=>{Tn();ae();mE=new Set(["href","src","poster","action","formaction","data"]),hE=new Set(["srcset","imagesrcset"]),h1=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,g1=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,y1=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,x1=/"(\/[^"/][^"]*)"/g,b1=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,$1=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,S1=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,w1=/^("|"|'|')([\s\S]*)\1$/});var pc=G(function(Ree,qE){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:wy,getOwnPropertyDescriptor:E1,getOwnPropertyNames:P1}=Object,j1=Object.prototype.hasOwnProperty,O1=(e,t)=>{for(var n in t)wy(e,n,{get:t[n],enumerable:!0})},k1=(e,t,n,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of P1(t))if(!j1.call(e,s)&&s!==n)wy(e,s,{get:()=>t[s],enumerable:!(r=E1(t,s))||r.enumerable})}return e},_1=(e)=>k1(wy({},"__esModule",{value:!0}),e),fc={};O1(fc,{analyzeMetafile:()=>iL,analyzeMetafileSync:()=>uL,build:()=>nL,buildSync:()=>aL,context:()=>rL,default:()=>mL,formatMessages:()=>oL,formatMessagesSync:()=>cL,initialize:()=>dL,stop:()=>fL,transform:()=>sL,transformSync:()=>lL,version:()=>tL});qE.exports=_1(fc);function xE(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(kr(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(kr(o)),t(r[o])}},n=new kE;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),by(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function A1(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return fi(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[fi(n.read())]=t();return a}default:throw Error("Invalid packet")}},n=new kE(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 kE=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);by(this.buf,e,t)}write(e){let t=this._write(4+e.length);by(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 _E(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}},kr,fi,xy;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;kr=(n)=>e.encode(n),fi=(n)=>t.decode(n),xy='new TextEncoder().encode("")'}else if(typeof Buffer<"u")kr=(e)=>Buffer.from(e),fi=(e)=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},xy='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!(kr("")instanceof Uint8Array))throw Error(`Invariant violation: "${xy} instanceof Uint8Array" is incorrectly false
|
|
56
56
|
|
|
57
57
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
58
58
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
59
59
|
is not a problem with esbuild. You need to fix your environment instead.
|
|
60
|
-
`);function
|
|
61
|
-
`;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let d=0;for(let p=0;p<4;p++)if(c=e[l++],d<<=4,c>=48&&c<=57)d|=c-48;else if(c>=97&&c<=102)d|=c+-87;else if(c>=65&&c<=70)d|=c+-55;else Kn(e,--l);u+=ls(d);break}default:Kn(e,--l);break}else if(c<=127)u+=ls(c);else if((c&224)===192)u+=ls((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=ls((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let d=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(d>65535)d-=65536,u+=ls(d>>10&1023|55296),d=56320|d&1023;u+=ls(d)}}u[0];break}case 91:{u=[],t.push(o),n.push(a),r.push(i),o=null,a=u,i=1;continue}case 123:{u={},t.push(o),n.push(a),r.push(i),o=null,a=u,i=2;continue}case 93:{if(i!==1)Kn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)Kn(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:Kn(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(i){case 0:{if(l===s)return u;break}case 1:{if(a.push(u),c===44){l++;continue}if(c===93)continue;break}case 2:{if(o===null){if(o=u,c===58){l++;continue}}else{if(a[o]=u,o=null,c===44){l++;continue}if(c===125)continue}break}}break}Kn(e,l)}var Tt=JSON.stringify,jw="warning",Pw="silent";function _i(e,t){let n=[];for(let r of e){if(gn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Iu=()=>null,ct=(e)=>typeof e==="boolean"?null:"a boolean",oe=(e)=>typeof e==="string"?null:"a string",Du=(e)=>e instanceof RegExp?null:"a RegExp object",To=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",XM=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Mw=(e)=>typeof e==="function"?null:"a function",cs=(e)=>Array.isArray(e)?null:"an array",yn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Nn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",YM=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",ZM=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",kw=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Iw=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",QM=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Dw=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",Lw=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",eI=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function T(e,t,n,r){let s=e[n];if(t[n+""]=!0,s===void 0)return;let o=r(s);if(o!==null)throw Error(`${Tt(n)} must be ${o}`);return s}function jt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${Tt(r)}`)}function tI(e){let t=Object.create(null),n=T(e,t,"wasmURL",eI),r=T(e,t,"wasmModule",ZM),s=T(e,t,"worker",ct);return jt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function Fw(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let r=e[n];if(typeof r==="string"||r===!1)t[n]=r;else throw Error(`Expected ${Tt(n)} in mangle cache to map to either a string or false`)}}return t}function Hu(e,t,n,r,s){let o=T(t,n,"color",ct),i=T(t,n,"logLevel",oe),a=T(t,n,"logLimit",To),l=T(t,n,"logStyle",oe);if(o!==void 0)e.push(`--color=${o}`);else if(r)e.push("--color=true");if(e.push(`--log-level=${i||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function gn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+Tt(n):""} to be a string, got ${typeof e} instead`);return e}function Vw(e,t,n){let r=T(t,n,"legalComments",oe),s=T(t,n,"sourceRoot",oe),o=T(t,n,"sourcesContent",ct),i=T(t,n,"target",Dw),a=T(t,n,"format",oe),l=T(t,n,"globalName",oe),c=T(t,n,"mangleProps",Du),u=T(t,n,"reserveProps",Du),d=T(t,n,"mangleQuoted",ct),p=T(t,n,"minify",ct),m=T(t,n,"minifySyntax",ct),g=T(t,n,"minifyWhitespace",ct),b=T(t,n,"minifyIdentifiers",ct),h=T(t,n,"lineLimit",To),x=T(t,n,"drop",yn),k=T(t,n,"dropLabels",yn),w=T(t,n,"charset",oe),v=T(t,n,"treeShaking",ct),E=T(t,n,"ignoreAnnotations",ct),O=T(t,n,"jsx",oe),I=T(t,n,"jsxFactory",oe),D=T(t,n,"jsxFragment",oe),V=T(t,n,"jsxImportSource",oe),W=T(t,n,"jsxDev",ct),A=T(t,n,"jsxSideEffects",ct),J=T(t,n,"define",Nn),G=T(t,n,"logOverride",Nn),se=T(t,n,"supported",Nn),ie=T(t,n,"pure",yn),le=T(t,n,"keepNames",ct),te=T(t,n,"platform",oe),de=T(t,n,"tsconfigRaw",QM),xe=T(t,n,"absPaths",yn);if(r)e.push(`--legal-comments=${r}`);if(s!==void 0)e.push(`--source-root=${s}`);if(o!==void 0)e.push(`--sources-content=${o}`);if(i)e.push(`--target=${_i(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(te)e.push(`--platform=${te}`);if(de)e.push(`--tsconfig-raw=${typeof de==="string"?de:JSON.stringify(de)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(g)e.push("--minify-whitespace");if(b)e.push("--minify-identifiers");if(h)e.push(`--line-limit=${h}`);if(w)e.push(`--charset=${w}`);if(v!==void 0)e.push(`--tree-shaking=${v}`);if(E)e.push("--ignore-annotations");if(x)for(let X of x)e.push(`--drop:${gn(X,"drop")}`);if(k)e.push(`--drop-labels=${_i(k,"drop label")}`);if(xe)e.push(`--abs-paths=${_i(xe,"abs paths")}`);if(c)e.push(`--mangle-props=${Lu(c)}`);if(u)e.push(`--reserve-props=${Lu(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(O)e.push(`--jsx=${O}`);if(I)e.push(`--jsx-factory=${I}`);if(D)e.push(`--jsx-fragment=${D}`);if(V)e.push(`--jsx-import-source=${V}`);if(W)e.push("--jsx-dev");if(A)e.push("--jsx-side-effects");if(J)for(let X in J){if(X.indexOf("=")>=0)throw Error(`Invalid define: ${X}`);e.push(`--define:${X}=${gn(J[X],"define",X)}`)}if(G)for(let X in G){if(X.indexOf("=")>=0)throw Error(`Invalid log override: ${X}`);e.push(`--log-override:${X}=${gn(G[X],"log override",X)}`)}if(se)for(let X in se){if(X.indexOf("=")>=0)throw Error(`Invalid supported: ${X}`);let U=se[X];if(typeof U!=="boolean")throw Error(`Expected value for supported ${Tt(X)} to be a boolean, got ${typeof U} instead`);e.push(`--supported:${X}=${U}`)}if(ie)for(let X of ie)e.push(`--pure:${gn(X,"pure")}`);if(le)e.push("--keep-names")}function nI(e,t,n,r,s){var o;let i=[],a=[],l=Object.create(null),c=null,u=null;Hu(i,t,l,n,r),Vw(i,t,l);let d=T(t,l,"sourcemap",Iw),p=T(t,l,"bundle",ct),m=T(t,l,"splitting",ct),g=T(t,l,"preserveSymlinks",ct),b=T(t,l,"metafile",ct),h=T(t,l,"outfile",oe),x=T(t,l,"outdir",oe),k=T(t,l,"outbase",oe),w=T(t,l,"tsconfig",oe),v=T(t,l,"resolveExtensions",yn),E=T(t,l,"nodePaths",yn),O=T(t,l,"mainFields",yn),I=T(t,l,"conditions",yn),D=T(t,l,"external",yn),V=T(t,l,"packages",oe),W=T(t,l,"alias",Nn),A=T(t,l,"loader",Nn),J=T(t,l,"outExtension",Nn),G=T(t,l,"publicPath",oe),se=T(t,l,"entryNames",oe),ie=T(t,l,"chunkNames",oe),le=T(t,l,"assetNames",oe),te=T(t,l,"inject",yn),de=T(t,l,"banner",Nn),xe=T(t,l,"footer",Nn),X=T(t,l,"entryPoints",YM),U=T(t,l,"absWorkingDir",oe),H=T(t,l,"stdin",Nn),K=(o=T(t,l,"write",ct))!=null?o:s,He=T(t,l,"allowOverwrite",ct),Ve=T(t,l,"mangleCache",Nn);if(l.plugins=!0,jt(t,l,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(He)i.push("--allow-overwrite");if(m)i.push("--splitting");if(g)i.push("--preserve-symlinks");if(b)i.push("--metafile");if(h)i.push(`--outfile=${h}`);if(x)i.push(`--outdir=${x}`);if(k)i.push(`--outbase=${k}`);if(w)i.push(`--tsconfig=${w}`);if(V)i.push(`--packages=${V}`);if(v)i.push(`--resolve-extensions=${_i(v,"resolve extension")}`);if(G)i.push(`--public-path=${G}`);if(se)i.push(`--entry-names=${se}`);if(ie)i.push(`--chunk-names=${ie}`);if(le)i.push(`--asset-names=${le}`);if(O)i.push(`--main-fields=${_i(O,"main field")}`);if(I)i.push(`--conditions=${_i(I,"condition")}`);if(D)for(let re of D)i.push(`--external:${gn(re,"external")}`);if(W)for(let re in W){if(re.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${re}`);i.push(`--alias:${re}=${gn(W[re],"alias",re)}`)}if(de)for(let re in de){if(re.indexOf("=")>=0)throw Error(`Invalid banner file type: ${re}`);i.push(`--banner:${re}=${gn(de[re],"banner",re)}`)}if(xe)for(let re in xe){if(re.indexOf("=")>=0)throw Error(`Invalid footer file type: ${re}`);i.push(`--footer:${re}=${gn(xe[re],"footer",re)}`)}if(te)for(let re of te)i.push(`--inject:${gn(re,"inject")}`);if(A)for(let re in A){if(re.indexOf("=")>=0)throw Error(`Invalid loader extension: ${re}`);i.push(`--loader:${re}=${gn(A[re],"loader",re)}`)}if(J)for(let re in J){if(re.indexOf("=")>=0)throw Error(`Invalid out extension: ${re}`);i.push(`--out-extension:${re}=${gn(J[re],"out extension",re)}`)}if(X)if(Array.isArray(X))for(let re=0,Gt=X.length;re<Gt;re++){let Qe=X[re];if(typeof Qe==="object"&&Qe!==null){let ht=Object.create(null),kt=T(Qe,ht,"in",oe),_t=T(Qe,ht,"out",oe);if(jt(Qe,ht,"in entry point at index "+re),kt===void 0)throw Error('Missing property "in" for entry point at index '+re);if(_t===void 0)throw Error('Missing property "out" for entry point at index '+re);a.push([_t,kt])}else a.push(["",gn(Qe,"entry point at index "+re)])}else for(let re in X)a.push([re,gn(X[re],"entry point",re)]);if(H){let re=Object.create(null),Gt=T(H,re,"contents",Lw),Qe=T(H,re,"resolveDir",oe),ht=T(H,re,"sourcefile",oe),kt=T(H,re,"loader",oe);if(jt(H,re,'in "stdin" object'),ht)i.push(`--sourcefile=${ht}`);if(kt)i.push(`--loader=${kt}`);if(Qe)u=Qe;if(typeof Gt==="string")c=dr(Gt);else if(Gt instanceof Uint8Array)c=Gt}let Ze=[];if(E)for(let re of E)re+="",Ze.push(re);return{entries:a,flags:i,write:K,stdinContents:c,stdinResolveDir:u,absWorkingDir:U,nodePaths:Ze,mangleCache:Fw(Ve)}}function rI(e,t,n,r){let s=[],o=Object.create(null);Hu(s,t,o,n,r),Vw(s,t,o);let i=T(t,o,"sourcemap",Iw),a=T(t,o,"sourcefile",oe),l=T(t,o,"loader",oe),c=T(t,o,"banner",oe),u=T(t,o,"footer",oe),d=T(t,o,"mangleCache",Nn);if(jt(t,o,`in ${e}() call`),i)s.push(`--sourcemap=${i===!0?"external":i}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:Fw(d)}}function qw(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,l=(w)=>{let v=a+w.length;if(v>i.length){let O=new Uint8Array(v*2);O.set(i),i=O}i.set(w,a),a+=w.length;let E=0;while(E+4<=a){let O=Jw(i,E);if(E+4+O>a)break;E+=4,g(i.subarray(E,E+O)),E+=O}if(E>0)i.copyWithin(0,E,a),a-=E},c=(w)=>{if(n.didClose=!0,w)n.reason=": "+(w.message||w);let v="The service was stopped"+n.reason;for(let E in r)r[E](v,null);r={}},u=(w,v,E)=>{if(n.didClose)return E("The service is no longer running"+n.reason,null);let O=s++;if(r[O]=(I,D)=>{try{E(I,D)}finally{if(w)w.unref()}},w)w.ref();e.writeToStdin(Ew({id:O,isRequest:!0,value:v}))},d=(w,v)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(Ew({id:w,isRequest:!1,value:v}))},p=async(w,v)=>{try{if(v.command==="ping"){d(w,{});return}if(typeof v.key==="number"){let E=t[v.key];if(!E)return;let O=E[v.command];if(O){await O(w,v);return}}throw Error("Invalid command: "+v.command)}catch(E){let O=[Ro(E,e,null,void 0,"")];try{d(w,{errors:O})}catch{}}},m=!0,g=(w)=>{if(m){m=!1;let E=String.fromCharCode(...w);if(E!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${Tt(E)}`);return}let v=KM(w);if(v.isRequest)p(v.id,v.value);else{let E=r[v.id];if(delete r[v.id],v.value.error)E(v.value.error,{});else E(null,v.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:w,refs:v,options:E,isTTY:O,defaultWD:I,callback:D})=>{let V=0,W=o++,A={},J={ref(){if(++V===1){if(v)v.ref()}},unref(){if(--V===0){if(delete t[W],v)v.unref()}}};t[W]=A,J.ref(),sI(w,W,u,d,J,e,A,E,O,I,(G,se)=>{try{D(G,se)}finally{J.unref()}})},transform:({callName:w,refs:v,input:E,options:O,isTTY:I,fs:D,callback:V})=>{let W=Hw(),A=(J)=>{try{if(typeof E!=="string"&&!(E instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:G,mangleCache:se}=rI(w,O,I,Pw),ie={command:"transform",flags:G,inputFS:J!==null,input:J!==null?dr(J):typeof E==="string"?dr(E):E};if(se)ie.mangleCache=se;u(v,ie,(le,te)=>{if(le)return V(Error(le),null);let de=Oi(te.errors,W),xe=Oi(te.warnings,W),X=1,U=()=>{if(--X===0){let H={warnings:xe,code:te.code,map:te.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in te)H.legalComments=te==null?void 0:te.legalComments;if(te.mangleCache)H.mangleCache=te==null?void 0:te.mangleCache;V(null,H)}};if(de.length>0)return V(dl("Transform failed",de,xe),null);if(te.codeFS)X++,D.readFile(te.code,(H,K)=>{if(H!==null)V(H,null);else te.code=K,U()});if(te.mapFS)X++,D.readFile(te.map,(H,K)=>{if(H!==null)V(H,null);else te.map=K,U()});U()})}catch(G){let se=[];try{Hu(se,O,{},I,Pw)}catch{}let ie=Ro(G,e,W,void 0,"");u(v,{command:"error",flags:se,error:ie},()=>{ie.detail=W.load(ie.detail),V(dl("Transform failed",[ie],[]),null)})}};if((typeof E==="string"||E instanceof Uint8Array)&&E.length>1048576){let J=A;A=()=>D.writeFile(E,J)}A(null)},formatMessages:({callName:w,refs:v,messages:E,options:O,callback:I})=>{if(!O)throw Error(`Missing second argument in ${w}() call`);let D={},V=T(O,D,"kind",oe),W=T(O,D,"color",ct),A=T(O,D,"terminalWidth",To),J=T(O,D,"logStyle",oe);if(jt(O,D,`in ${w}() call`),V===void 0)throw Error(`Missing "kind" in ${w}() call`);if(V!=="error"&&V!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${w}() call`);let G={command:"format-msgs",messages:us(E,"messages",null,"",A),isWarning:V==="warning"};if(W!==void 0)G.color=W;if(A!==void 0)G.terminalWidth=A;if(J!==void 0)G.logStyle=J;u(v,G,(se,ie)=>{if(se)return I(Error(se),null);I(null,ie.messages)})},analyzeMetafile:({callName:w,refs:v,metafile:E,options:O,callback:I})=>{if(O===void 0)O={};let D={},V=T(O,D,"color",ct),W=T(O,D,"verbose",ct);jt(O,D,`in ${w}() call`);let A={command:"analyze-metafile",metafile:E};if(V!==void 0)A.color=V;if(W!==void 0)A.verbose=W;u(v,A,(J,G)=>{if(J)return I(Error(J),null);I(null,G.result)})}}}}function sI(e,t,n,r,s,o,i,a,l,c,u){let d=Hw(),p=e==="context",m=(h,x)=>{let k=[];try{Hu(k,a,{},l,jw)}catch{}let w=Ro(h,o,d,void 0,x);n(s,{command:"error",flags:k,error:w},()=>{w.detail=d.load(w.detail),u(dl(p?"Context failed":"Build failed",[w],[]),null)})},g;if(typeof a==="object"){let h=a.plugins;if(h!==void 0){if(!Array.isArray(h))return m(Error('"plugins" must be an array'),"");g=h}}if(g&&g.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");oI(t,n,r,s,o,i,a,g,d).then((h)=>{if(!h.ok)return m(h.error,h.pluginName);try{b(h.requestPlugins,h.runOnEndCallbacks,h.scheduleOnDisposeCallbacks)}catch(x){m(x,"")}},(h)=>m(h,""));return}try{b(null,(h,x)=>x([],[]),()=>{})}catch(h){m(h,"")}function b(h,x,k){let w=o.hasFS,{entries:v,flags:E,write:O,stdinContents:I,stdinResolveDir:D,absWorkingDir:V,nodePaths:W,mangleCache:A}=nI(e,a,l,jw,w);if(O&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let J={command:"build",key:t,entries:v,flags:E,write:O,stdinContents:I,stdinResolveDir:D,absWorkingDir:V||c,nodePaths:W,context:p};if(h)J.plugins=h;if(A)J.mangleCache=A;let G=(le,te)=>{let de={errors:Oi(le.errors,d),warnings:Oi(le.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},xe=de.errors.slice(),X=de.warnings.slice();if(le.outputFiles)de.outputFiles=le.outputFiles.map(aI);if(le.metafile&&le.metafile.length)de.metafile=lI(le.metafile);if(le.mangleCache)de.mangleCache=le.mangleCache;if(le.writeToStdout!==void 0)console.log(Mo(le.writeToStdout).replace(/\n$/,""));x(de,(U,H)=>{if(xe.length>0||U.length>0){let K=dl("Build failed",xe.concat(U),X.concat(H));return te(K,null,U,H)}te(null,de,U,H)})},se,ie;if(p)i["on-end"]=(le,te)=>new Promise((de)=>{G(te,(xe,X,U,H)=>{let K={errors:U,warnings:H};if(ie)ie(xe,X);se=void 0,ie=void 0,r(le,K),de()})});n(s,J,(le,te)=>{if(le)return u(Error(le),null);if(!p)return G(te,(X,U)=>(k(),u(X,U)));if(te.errors.length>0)return u(dl("Context failed",te.errors,te.warnings),null);let de=!1,xe={rebuild:()=>{if(!se)se=new Promise((X,U)=>{let H;ie=(He,Ve)=>{if(!H)H=()=>He?U(He):X(Ve)};let K=()=>{n(s,{command:"rebuild",key:t},(Ve,Ze)=>{if(Ve)U(Error(Ve));else if(H)H();else K()})};K()});return se},watch:(X={})=>new Promise((U,H)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let K={},He=T(X,K,"delay",To);jt(X,K,"in watch() call");let Ve={command:"watch",key:t};if(He)Ve.delay=He;n(s,Ve,(Ze)=>{if(Ze)H(Error(Ze));else U(void 0)})}),serve:(X={})=>new Promise((U,H)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let K={},He=T(X,K,"port",XM),Ve=T(X,K,"host",oe),Ze=T(X,K,"servedir",oe),re=T(X,K,"keyfile",oe),Gt=T(X,K,"certfile",oe),Qe=T(X,K,"fallback",oe),ht=T(X,K,"cors",Nn),kt=T(X,K,"onRequest",Mw);jt(X,K,"in serve() call");let _t={command:"serve",key:t,onRequest:!!kt};if(He!==void 0)_t.port=He;if(Ve!==void 0)_t.host=Ve;if(Ze!==void 0)_t.servedir=Ze;if(re!==void 0)_t.keyfile=re;if(Gt!==void 0)_t.certfile=Gt;if(Qe!==void 0)_t.fallback=Qe;if(ht){let We={},Pe=T(ht,We,"origin",Dw);if(jt(ht,We,'on "cors" object'),Array.isArray(Pe))_t.corsOrigin=Pe;else if(Pe!==void 0)_t.corsOrigin=[Pe]}n(s,_t,(We,Pe)=>{if(We)return H(Error(We));if(kt)i["serve-request"]=(Ln,me)=>{kt(me.args),r(Ln,{})};U(Pe)})}),cancel:()=>new Promise((X)=>{if(de)return X();n(s,{command:"cancel",key:t},()=>{X()})}),dispose:()=>new Promise((X)=>{if(de)return X();de=!0,n(s,{command:"dispose",key:t},()=>{X(),k(),s.unref()})})};s.ref(),u(null,xe)})}}var oI=async(e,t,n,r,s,o,i,a,l)=>{let c=[],u=[],d={},p={},m=[],g=0,b=0,h=[],x=!1;a=[...a];for(let v of a){let E={};if(typeof v!=="object")throw Error(`Plugin at index ${b} must be an object`);let O=T(v,E,"name",oe);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${b} is missing a name`);try{let I=T(v,E,"setup",Mw);if(typeof I!=="function")throw Error("Plugin is missing a setup function");jt(v,E,`on plugin ${Tt(O)}`);let D={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};b++;let W=I({initialOptions:i,resolve:(A,J={})=>{if(!x)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof A!=="string")throw Error("The path to resolve must be a string");let G=Object.create(null),se=T(J,G,"pluginName",oe),ie=T(J,G,"importer",oe),le=T(J,G,"namespace",oe),te=T(J,G,"resolveDir",oe),de=T(J,G,"kind",oe),xe=T(J,G,"pluginData",Iu),X=T(J,G,"with",Nn);return jt(J,G,"in resolve() call"),new Promise((U,H)=>{let K={command:"resolve",path:A,key:e,pluginName:O};if(se!=null)K.pluginName=se;if(ie!=null)K.importer=ie;if(le!=null)K.namespace=le;if(te!=null)K.resolveDir=te;if(de!=null)K.kind=de;else throw Error('Must specify "kind" when calling "resolve"');if(xe!=null)K.pluginData=l.store(xe);if(X!=null)K.with=iI(X,"with");t(r,K,(He,Ve)=>{if(He!==null)H(Error(He));else U({errors:Oi(Ve.errors,l),warnings:Oi(Ve.warnings,l),path:Ve.path,external:Ve.external,sideEffects:Ve.sideEffects,namespace:Ve.namespace,suffix:Ve.suffix,pluginData:l.load(Ve.pluginData)})})})},onStart(A){let G=Ju(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:O,callback:A,note:G}),D.onStart=!0},onEnd(A){let G=Ju(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:O,callback:A,note:G}),D.onEnd=!0},onResolve(A,J){let se=Ju(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),ie={},le=T(A,ie,"filter",Du),te=T(A,ie,"namespace",oe);if(jt(A,ie,`in onResolve() call for plugin ${Tt(O)}`),le==null)throw Error("onResolve() call is missing a filter");let de=g++;d[de]={name:O,callback:J,note:se},D.onResolve.push({id:de,filter:Lu(le),namespace:te||""})},onLoad(A,J){let se=Ju(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),ie={},le=T(A,ie,"filter",Du),te=T(A,ie,"namespace",oe);if(jt(A,ie,`in onLoad() call for plugin ${Tt(O)}`),le==null)throw Error("onLoad() call is missing a filter");let de=g++;p[de]={name:O,callback:J,note:se},D.onLoad.push({id:de,filter:Lu(le),namespace:te||""})},onDispose(A){m.push(A)},esbuild:s.esbuild});if(W)await W;h.push(D)}catch(I){return{ok:!1,error:I,pluginName:O}}}o["on-start"]=async(v,E)=>{l.clear();let O={errors:[],warnings:[]};await Promise.all(c.map(async({name:I,callback:D,note:V})=>{try{let W=await D();if(W!=null){if(typeof W!=="object")throw Error(`Expected onStart() callback in plugin ${Tt(I)} to return an object`);let A={},J=T(W,A,"errors",cs),G=T(W,A,"warnings",cs);if(jt(W,A,`from onStart() callback in plugin ${Tt(I)}`),J!=null)O.errors.push(...us(J,"errors",l,I,void 0));if(G!=null)O.warnings.push(...us(G,"warnings",l,I,void 0))}}catch(W){O.errors.push(Ro(W,s,l,V&&V(),I))}})),n(v,O)},o["on-resolve"]=async(v,E)=>{let O={},I="",D,V;for(let W of E.ids)try{({name:I,callback:D,note:V}=d[W]);let A=await D({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:l.load(E.pluginData),with:E.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onResolve() callback in plugin ${Tt(I)} to return an object`);let J={},G=T(A,J,"pluginName",oe),se=T(A,J,"path",oe),ie=T(A,J,"namespace",oe),le=T(A,J,"suffix",oe),te=T(A,J,"external",ct),de=T(A,J,"sideEffects",ct),xe=T(A,J,"pluginData",Iu),X=T(A,J,"errors",cs),U=T(A,J,"warnings",cs),H=T(A,J,"watchFiles",yn),K=T(A,J,"watchDirs",yn);if(jt(A,J,`from onResolve() callback in plugin ${Tt(I)}`),O.id=W,G!=null)O.pluginName=G;if(se!=null)O.path=se;if(ie!=null)O.namespace=ie;if(le!=null)O.suffix=le;if(te!=null)O.external=te;if(de!=null)O.sideEffects=de;if(xe!=null)O.pluginData=l.store(xe);if(X!=null)O.errors=us(X,"errors",l,I,void 0);if(U!=null)O.warnings=us(U,"warnings",l,I,void 0);if(H!=null)O.watchFiles=Mu(H,"watchFiles");if(K!=null)O.watchDirs=Mu(K,"watchDirs");break}}catch(A){O={id:W,errors:[Ro(A,s,l,V&&V(),I)]};break}n(v,O)},o["on-load"]=async(v,E)=>{let O={},I="",D,V;for(let W of E.ids)try{({name:I,callback:D,note:V}=p[W]);let A=await D({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:l.load(E.pluginData),with:E.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onLoad() callback in plugin ${Tt(I)} to return an object`);let J={},G=T(A,J,"pluginName",oe),se=T(A,J,"contents",Lw),ie=T(A,J,"resolveDir",oe),le=T(A,J,"pluginData",Iu),te=T(A,J,"loader",oe),de=T(A,J,"errors",cs),xe=T(A,J,"warnings",cs),X=T(A,J,"watchFiles",yn),U=T(A,J,"watchDirs",yn);if(jt(A,J,`from onLoad() callback in plugin ${Tt(I)}`),O.id=W,G!=null)O.pluginName=G;if(se instanceof Uint8Array)O.contents=se;else if(se!=null)O.contents=dr(se);if(ie!=null)O.resolveDir=ie;if(le!=null)O.pluginData=l.store(le);if(te!=null)O.loader=te;if(de!=null)O.errors=us(de,"errors",l,I,void 0);if(xe!=null)O.warnings=us(xe,"warnings",l,I,void 0);if(X!=null)O.watchFiles=Mu(X,"watchFiles");if(U!=null)O.watchDirs=Mu(U,"watchDirs");break}}catch(A){O={id:W,errors:[Ro(A,s,l,V&&V(),I)]};break}n(v,O)};let k=(v,E)=>E([],[]);if(u.length>0)k=(v,E)=>{(async()=>{let O=[],I=[];for(let{name:D,callback:V,note:W}of u){let A,J;try{let G=await V(v);if(G!=null){if(typeof G!=="object")throw Error(`Expected onEnd() callback in plugin ${Tt(D)} to return an object`);let se={},ie=T(G,se,"errors",cs),le=T(G,se,"warnings",cs);if(jt(G,se,`from onEnd() callback in plugin ${Tt(D)}`),ie!=null)A=us(ie,"errors",l,D,void 0);if(le!=null)J=us(le,"warnings",l,D,void 0)}}catch(G){A=[Ro(G,s,l,W&&W(),D)]}if(A){O.push(...A);try{v.errors.push(...A)}catch{}}if(J){I.push(...J);try{v.warnings.push(...J)}catch{}}}E(O,I)})()};let w=()=>{for(let v of m)setTimeout(()=>v(),0)};return x=!0,{ok:!0,requestPlugins:h,runOnEndCallbacks:k,scheduleOnDisposeCallbacks:w}};function Hw(){let e=new Map,t=0;return{clear(){e.clear()},load(n){return e.get(n)},store(n){if(n===void 0)return-1;let r=t++;return e.set(r,n),r}}}function Ju(e,t,n){let r,s=!1;return()=>{if(s)return r;s=!0;try{let o=(e.stack+"").split(`
|
|
62
|
-
`);o.splice(1,1);let i=
|
|
63
|
-
`),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function
|
|
60
|
+
`);function _E(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function by(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var Ts=String.fromCharCode;function pr(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 ${Ts(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 C1(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)pr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)pr(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)pr(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)pr(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=Ts(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+=Ts(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))pr(e,--d,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)pr(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 pr(e,--l);u+=Ts(d);break}default:pr(e,--l);break}else if(c<=127)u+=Ts(c);else if((c&224)===192)u+=Ts((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=Ts((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+=Ts(d>>10&1023|55296),d=56320|d&1023;u+=Ts(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)pr(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}case 125:{if(i!==2)pr(e,--l);u=a,o=t.pop(),a=n.pop(),i=r.pop();break}default:pr(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}pr(e,l)}var Ft=JSON.stringify,bE="warning",$E="silent";function aa(e,t){let n=[];for(let r of e){if(Jn(r,t),r.indexOf(",")>=0)throw Error(`Invalid ${t}: ${r}`);n.push(r)}return n.join(",")}var Hf=()=>null,pt=(e)=>typeof e==="boolean"?null:"a boolean",ue=(e)=>typeof e==="string"?null:"a string",Wf=(e)=>e instanceof RegExp?null:"a RegExp object",li=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",R1=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",AE=(e)=>typeof e==="function"?null:"a function",Js=(e)=>Array.isArray(e)?null:"an array",Nn=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",Qn=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",T1=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",J1=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",SE=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",CE=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",N1=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",RE=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",TE=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",M1=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function I(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(`${Ft(n)} must be ${o}`);return s}function Tt(e,t,n){for(let r in e)if(!(r in t))throw Error(`Invalid option ${n}: ${Ft(r)}`)}function D1(e){let t=Object.create(null),n=I(e,t,"wasmURL",M1),r=I(e,t,"wasmModule",J1),s=I(e,t,"worker",pt);return Tt(e,t,"in initialize() call"),{wasmURL:n,wasmModule:r,worker:s}}function JE(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 ${Ft(n)} in mangle cache to map to either a string or false`)}}return t}function Gf(e,t,n,r,s){let o=I(t,n,"color",pt),i=I(t,n,"logLevel",ue),a=I(t,n,"logLimit",li),l=I(t,n,"logStyle",ue);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 Jn(e,t,n){if(typeof e!=="string")throw Error(`Expected value for ${t}${n!==void 0?" "+Ft(n):""} to be a string, got ${typeof e} instead`);return e}function NE(e,t,n){let r=I(t,n,"legalComments",ue),s=I(t,n,"sourceRoot",ue),o=I(t,n,"sourcesContent",pt),i=I(t,n,"target",RE),a=I(t,n,"format",ue),l=I(t,n,"globalName",ue),c=I(t,n,"mangleProps",Wf),u=I(t,n,"reserveProps",Wf),d=I(t,n,"mangleQuoted",pt),p=I(t,n,"minify",pt),m=I(t,n,"minifySyntax",pt),g=I(t,n,"minifyWhitespace",pt),y=I(t,n,"minifyIdentifiers",pt),h=I(t,n,"lineLimit",li),x=I(t,n,"drop",Nn),P=I(t,n,"dropLabels",Nn),S=I(t,n,"charset",ue),v=I(t,n,"treeShaking",pt),E=I(t,n,"ignoreAnnotations",pt),w=I(t,n,"jsx",ue),R=I(t,n,"jsxFactory",ue),C=I(t,n,"jsxFragment",ue),J=I(t,n,"jsxImportSource",ue),D=I(t,n,"jsxDev",pt),A=I(t,n,"jsxSideEffects",pt),L=I(t,n,"define",Qn),K=I(t,n,"logOverride",Qn),ne=I(t,n,"supported",Qn),B=I(t,n,"pure",Nn),U=I(t,n,"keepNames",pt),Z=I(t,n,"platform",ue),le=I(t,n,"tsconfigRaw",N1),we=I(t,n,"absPaths",Nn);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=${aa(Array.isArray(i)?i:[i],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(Z)e.push(`--platform=${Z}`);if(le)e.push(`--tsconfig-raw=${typeof le==="string"?le:JSON.stringify(le)}`);if(p)e.push("--minify");if(m)e.push("--minify-syntax");if(g)e.push("--minify-whitespace");if(y)e.push("--minify-identifiers");if(h)e.push(`--line-limit=${h}`);if(S)e.push(`--charset=${S}`);if(v!==void 0)e.push(`--tree-shaking=${v}`);if(E)e.push("--ignore-annotations");if(x)for(let Y of x)e.push(`--drop:${Jn(Y,"drop")}`);if(P)e.push(`--drop-labels=${aa(P,"drop label")}`);if(we)e.push(`--abs-paths=${aa(we,"abs paths")}`);if(c)e.push(`--mangle-props=${Bf(c)}`);if(u)e.push(`--reserve-props=${Bf(u)}`);if(d!==void 0)e.push(`--mangle-quoted=${d}`);if(w)e.push(`--jsx=${w}`);if(R)e.push(`--jsx-factory=${R}`);if(C)e.push(`--jsx-fragment=${C}`);if(J)e.push(`--jsx-import-source=${J}`);if(D)e.push("--jsx-dev");if(A)e.push("--jsx-side-effects");if(L)for(let Y in L){if(Y.indexOf("=")>=0)throw Error(`Invalid define: ${Y}`);e.push(`--define:${Y}=${Jn(L[Y],"define",Y)}`)}if(K)for(let Y in K){if(Y.indexOf("=")>=0)throw Error(`Invalid log override: ${Y}`);e.push(`--log-override:${Y}=${Jn(K[Y],"log override",Y)}`)}if(ne)for(let Y in ne){if(Y.indexOf("=")>=0)throw Error(`Invalid supported: ${Y}`);let $e=ne[Y];if(typeof $e!=="boolean")throw Error(`Expected value for supported ${Ft(Y)} to be a boolean, got ${typeof $e} instead`);e.push(`--supported:${Y}=${$e}`)}if(B)for(let Y of B)e.push(`--pure:${Jn(Y,"pure")}`);if(U)e.push("--keep-names")}function I1(e,t,n,r,s){var o;let i=[],a=[],l=Object.create(null),c=null,u=null;Gf(i,t,l,n,r),NE(i,t,l);let d=I(t,l,"sourcemap",CE),p=I(t,l,"bundle",pt),m=I(t,l,"splitting",pt),g=I(t,l,"preserveSymlinks",pt),y=I(t,l,"metafile",pt),h=I(t,l,"outfile",ue),x=I(t,l,"outdir",ue),P=I(t,l,"outbase",ue),S=I(t,l,"tsconfig",ue),v=I(t,l,"resolveExtensions",Nn),E=I(t,l,"nodePaths",Nn),w=I(t,l,"mainFields",Nn),R=I(t,l,"conditions",Nn),C=I(t,l,"external",Nn),J=I(t,l,"packages",ue),D=I(t,l,"alias",Qn),A=I(t,l,"loader",Qn),L=I(t,l,"outExtension",Qn),K=I(t,l,"publicPath",ue),ne=I(t,l,"entryNames",ue),B=I(t,l,"chunkNames",ue),U=I(t,l,"assetNames",ue),Z=I(t,l,"inject",Nn),le=I(t,l,"banner",Qn),we=I(t,l,"footer",Qn),Y=I(t,l,"entryPoints",T1),$e=I(t,l,"absWorkingDir",ue),me=I(t,l,"stdin",Qn),q=(o=I(t,l,"write",pt))!=null?o:s,Q=I(t,l,"allowOverwrite",pt),pe=I(t,l,"mangleCache",Qn);if(l.plugins=!0,Tt(t,l,`in ${e}() call`),d)i.push(`--sourcemap${d===!0?"":`=${d}`}`);if(p)i.push("--bundle");if(Q)i.push("--allow-overwrite");if(m)i.push("--splitting");if(g)i.push("--preserve-symlinks");if(y)i.push("--metafile");if(h)i.push(`--outfile=${h}`);if(x)i.push(`--outdir=${x}`);if(P)i.push(`--outbase=${P}`);if(S)i.push(`--tsconfig=${S}`);if(J)i.push(`--packages=${J}`);if(v)i.push(`--resolve-extensions=${aa(v,"resolve extension")}`);if(K)i.push(`--public-path=${K}`);if(ne)i.push(`--entry-names=${ne}`);if(B)i.push(`--chunk-names=${B}`);if(U)i.push(`--asset-names=${U}`);if(w)i.push(`--main-fields=${aa(w,"main field")}`);if(R)i.push(`--conditions=${aa(R,"condition")}`);if(C)for(let re of C)i.push(`--external:${Jn(re,"external")}`);if(D)for(let re in D){if(re.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${re}`);i.push(`--alias:${re}=${Jn(D[re],"alias",re)}`)}if(le)for(let re in le){if(re.indexOf("=")>=0)throw Error(`Invalid banner file type: ${re}`);i.push(`--banner:${re}=${Jn(le[re],"banner",re)}`)}if(we)for(let re in we){if(re.indexOf("=")>=0)throw Error(`Invalid footer file type: ${re}`);i.push(`--footer:${re}=${Jn(we[re],"footer",re)}`)}if(Z)for(let re of Z)i.push(`--inject:${Jn(re,"inject")}`);if(A)for(let re in A){if(re.indexOf("=")>=0)throw Error(`Invalid loader extension: ${re}`);i.push(`--loader:${re}=${Jn(A[re],"loader",re)}`)}if(L)for(let re in L){if(re.indexOf("=")>=0)throw Error(`Invalid out extension: ${re}`);i.push(`--out-extension:${re}=${Jn(L[re],"out extension",re)}`)}if(Y)if(Array.isArray(Y))for(let re=0,Mt=Y.length;re<Mt;re++){let Ot=Y[re];if(typeof Ot==="object"&&Ot!==null){let ft=Object.create(null),dt=I(Ot,ft,"in",ue),kt=I(Ot,ft,"out",ue);if(Tt(Ot,ft,"in entry point at index "+re),dt===void 0)throw Error('Missing property "in" for entry point at index '+re);if(kt===void 0)throw Error('Missing property "out" for entry point at index '+re);a.push([kt,dt])}else a.push(["",Jn(Ot,"entry point at index "+re)])}else for(let re in Y)a.push([re,Jn(Y[re],"entry point",re)]);if(me){let re=Object.create(null),Mt=I(me,re,"contents",TE),Ot=I(me,re,"resolveDir",ue),ft=I(me,re,"sourcefile",ue),dt=I(me,re,"loader",ue);if(Tt(me,re,'in "stdin" object'),ft)i.push(`--sourcefile=${ft}`);if(dt)i.push(`--loader=${dt}`);if(Ot)u=Ot;if(typeof Mt==="string")c=kr(Mt);else if(Mt instanceof Uint8Array)c=Mt}let Ke=[];if(E)for(let re of E)re+="",Ke.push(re);return{entries:a,flags:i,write:q,stdinContents:c,stdinResolveDir:u,absWorkingDir:$e,nodePaths:Ke,mangleCache:JE(pe)}}function L1(e,t,n,r){let s=[],o=Object.create(null);Gf(s,t,o,n,r),NE(s,t,o);let i=I(t,o,"sourcemap",CE),a=I(t,o,"sourcefile",ue),l=I(t,o,"loader",ue),c=I(t,o,"banner",ue),u=I(t,o,"footer",ue),d=I(t,o,"mangleCache",Qn);if(Tt(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:JE(d)}}function ME(e){let t={},n={didClose:!1,reason:""},r={},s=0,o=0,i=new Uint8Array(16384),a=0,l=(S)=>{let v=a+S.length;if(v>i.length){let w=new Uint8Array(v*2);w.set(i),i=w}i.set(S,a),a+=S.length;let E=0;while(E+4<=a){let w=_E(i,E);if(E+4+w>a)break;E+=4,g(i.subarray(E,E+w)),E+=w}if(E>0)i.copyWithin(0,E,a),a-=E},c=(S)=>{if(n.didClose=!0,S)n.reason=": "+(S.message||S);let v="The service was stopped"+n.reason;for(let E in r)r[E](v,null);r={}},u=(S,v,E)=>{if(n.didClose)return E("The service is no longer running"+n.reason,null);let w=s++;if(r[w]=(R,C)=>{try{E(R,C)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(xE({id:w,isRequest:!0,value:v}))},d=(S,v)=>{if(n.didClose)throw Error("The service is no longer running"+n.reason);e.writeToStdin(xE({id:S,isRequest:!1,value:v}))},p=async(S,v)=>{try{if(v.command==="ping"){d(S,{});return}if(typeof v.key==="number"){let E=t[v.key];if(!E)return;let w=E[v.command];if(w){await w(S,v);return}}throw Error("Invalid command: "+v.command)}catch(E){let w=[ai(E,e,null,void 0,"")];try{d(S,{errors:w})}catch{}}},m=!0,g=(S)=>{if(m){m=!1;let E=String.fromCharCode(...S);if(E!=="0.28.2")throw Error(`Cannot start service: Host version "0.28.2" does not match binary version ${Ft(E)}`);return}let v=A1(S);if(v.isRequest)p(v.id,v.value);else{let E=r[v.id];if(delete r[v.id],v.value.error)E(v.value.error,{});else E(null,v.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:v,options:E,isTTY:w,defaultWD:R,callback:C})=>{let J=0,D=o++,A={},L={ref(){if(++J===1){if(v)v.ref()}},unref(){if(--J===0){if(delete t[D],v)v.unref()}}};t[D]=A,L.ref(),F1(S,D,u,d,L,e,A,E,w,R,(K,ne)=>{try{C(K,ne)}finally{L.unref()}})},transform:({callName:S,refs:v,input:E,options:w,isTTY:R,fs:C,callback:J})=>{let D=DE(),A=(L)=>{try{if(typeof E!=="string"&&!(E instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:K,mangleCache:ne}=L1(S,w,R,$E),B={command:"transform",flags:K,inputFS:L!==null,input:L!==null?kr(L):typeof E==="string"?kr(E):E};if(ne)B.mangleCache=ne;u(v,B,(U,Z)=>{if(U)return J(Error(U),null);let le=la(Z.errors,D),we=la(Z.warnings,D),Y=1,$e=()=>{if(--Y===0){let me={warnings:we,code:Z.code,map:Z.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in Z)me.legalComments=Z==null?void 0:Z.legalComments;if(Z.mangleCache)me.mangleCache=Z==null?void 0:Z.mangleCache;J(null,me)}};if(le.length>0)return J(cc("Transform failed",le,we),null);if(Z.codeFS)Y++,C.readFile(Z.code,(me,q)=>{if(me!==null)J(me,null);else Z.code=q,$e()});if(Z.mapFS)Y++,C.readFile(Z.map,(me,q)=>{if(me!==null)J(me,null);else Z.map=q,$e()});$e()})}catch(K){let ne=[];try{Gf(ne,w,{},R,$E)}catch{}let B=ai(K,e,D,void 0,"");u(v,{command:"error",flags:ne,error:B},()=>{B.detail=D.load(B.detail),J(cc("Transform failed",[B],[]),null)})}};if((typeof E==="string"||E instanceof Uint8Array)&&E.length>1048576){let L=A;A=()=>C.writeFile(E,L)}A(null)},formatMessages:({callName:S,refs:v,messages:E,options:w,callback:R})=>{if(!w)throw Error(`Missing second argument in ${S}() call`);let C={},J=I(w,C,"kind",ue),D=I(w,C,"color",pt),A=I(w,C,"terminalWidth",li),L=I(w,C,"logStyle",ue);if(Tt(w,C,`in ${S}() call`),J===void 0)throw Error(`Missing "kind" in ${S}() call`);if(J!=="error"&&J!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${S}() call`);let K={command:"format-msgs",messages:Ns(E,"messages",null,"",A),isWarning:J==="warning"};if(D!==void 0)K.color=D;if(A!==void 0)K.terminalWidth=A;if(L!==void 0)K.logStyle=L;u(v,K,(ne,B)=>{if(ne)return R(Error(ne),null);R(null,B.messages)})},analyzeMetafile:({callName:S,refs:v,metafile:E,options:w,callback:R})=>{if(w===void 0)w={};let C={},J=I(w,C,"color",pt),D=I(w,C,"verbose",pt);Tt(w,C,`in ${S}() call`);let A={command:"analyze-metafile",metafile:E};if(J!==void 0)A.color=J;if(D!==void 0)A.verbose=D;u(v,A,(L,K)=>{if(L)return R(Error(L),null);R(null,K.result)})}}}}function F1(e,t,n,r,s,o,i,a,l,c,u){let d=DE(),p=e==="context",m=(h,x)=>{let P=[];try{Gf(P,a,{},l,bE)}catch{}let S=ai(h,o,d,void 0,x);n(s,{command:"error",flags:P,error:S},()=>{S.detail=d.load(S.detail),u(cc(p?"Context failed":"Build failed",[S],[]),null)})},g;if(typeof a==="object"){let h=a.plugins;if(h!==void 0){if(!Array.isArray(h))return m(Error('"plugins" must be an array'),"");g=h}}if(g&&g.length>0){if(o.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");V1(t,n,r,s,o,i,a,g,d).then((h)=>{if(!h.ok)return m(h.error,h.pluginName);try{y(h.requestPlugins,h.runOnEndCallbacks,h.scheduleOnDisposeCallbacks)}catch(x){m(x,"")}},(h)=>m(h,""));return}try{y(null,(h,x)=>x([],[]),()=>{})}catch(h){m(h,"")}function y(h,x,P){let S=o.hasFS,{entries:v,flags:E,write:w,stdinContents:R,stdinResolveDir:C,absWorkingDir:J,nodePaths:D,mangleCache:A}=I1(e,a,l,bE,S);if(w&&!o.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:v,flags:E,write:w,stdinContents:R,stdinResolveDir:C,absWorkingDir:J||c,nodePaths:D,context:p};if(h)L.plugins=h;if(A)L.mangleCache=A;let K=(U,Z)=>{let le={errors:la(U.errors,d),warnings:la(U.warnings,d),outputFiles:void 0,metafile:void 0,mangleCache:void 0},we=le.errors.slice(),Y=le.warnings.slice();if(U.outputFiles)le.outputFiles=U.outputFiles.map(H1);if(U.metafile&&U.metafile.length)le.metafile=W1(U.metafile);if(U.mangleCache)le.mangleCache=U.mangleCache;if(U.writeToStdout!==void 0)console.log(fi(U.writeToStdout).replace(/\n$/,""));x(le,($e,me)=>{if(we.length>0||$e.length>0){let q=cc("Build failed",we.concat($e),Y.concat(me));return Z(q,null,$e,me)}Z(null,le,$e,me)})},ne,B;if(p)i["on-end"]=(U,Z)=>new Promise((le)=>{K(Z,(we,Y,$e,me)=>{let q={errors:$e,warnings:me};if(B)B(we,Y);ne=void 0,B=void 0,r(U,q),le()})});n(s,L,(U,Z)=>{if(U)return u(Error(U),null);if(!p)return K(Z,(Y,$e)=>(P(),u(Y,$e)));if(Z.errors.length>0)return u(cc("Context failed",Z.errors,Z.warnings),null);let le=!1,we={rebuild:()=>{if(!ne)ne=new Promise((Y,$e)=>{let me;B=(Q,pe)=>{if(!me)me=()=>Q?$e(Q):Y(pe)};let q=()=>{n(s,{command:"rebuild",key:t},(pe,Ke)=>{if(pe)$e(Error(pe));else if(me)me();else q()})};q()});return ne},watch:(Y={})=>new Promise(($e,me)=>{if(!o.hasFS)throw Error('Cannot use the "watch" API in this environment');let q={},Q=I(Y,q,"delay",li);Tt(Y,q,"in watch() call");let pe={command:"watch",key:t};if(Q)pe.delay=Q;n(s,pe,(Ke)=>{if(Ke)me(Error(Ke));else $e(void 0)})}),serve:(Y={})=>new Promise(($e,me)=>{if(!o.hasFS)throw Error('Cannot use the "serve" API in this environment');let q={},Q=I(Y,q,"port",R1),pe=I(Y,q,"host",ue),Ke=I(Y,q,"servedir",ue),re=I(Y,q,"keyfile",ue),Mt=I(Y,q,"certfile",ue),Ot=I(Y,q,"fallback",ue),ft=I(Y,q,"cors",Qn),dt=I(Y,q,"onRequest",AE);Tt(Y,q,"in serve() call");let kt={command:"serve",key:t,onRequest:!!dt};if(Q!==void 0)kt.port=Q;if(pe!==void 0)kt.host=pe;if(Ke!==void 0)kt.servedir=Ke;if(re!==void 0)kt.keyfile=re;if(Mt!==void 0)kt.certfile=Mt;if(Ot!==void 0)kt.fallback=Ot;if(ft){let Xt={},kn=I(ft,Xt,"origin",RE);if(Tt(ft,Xt,'on "cors" object'),Array.isArray(kn))kt.corsOrigin=kn;else if(kn!==void 0)kt.corsOrigin=[kn]}n(s,kt,(Xt,kn)=>{if(Xt)return me(Error(Xt));if(dt)i["serve-request"]=($s,it)=>{dt(it.args),r($s,{})};$e(kn)})}),cancel:()=>new Promise((Y)=>{if(le)return Y();n(s,{command:"cancel",key:t},()=>{Y()})}),dispose:()=>new Promise((Y)=>{if(le)return Y();le=!0,n(s,{command:"dispose",key:t},()=>{Y(),P(),s.unref()})})};s.ref(),u(null,we)})}}var V1=async(e,t,n,r,s,o,i,a,l)=>{let c=[],u=[],d={},p={},m=[],g=0,y=0,h=[],x=!1;a=[...a];for(let v of a){let E={};if(typeof v!=="object")throw Error(`Plugin at index ${y} must be an object`);let w=I(v,E,"name",ue);if(typeof w!=="string"||w==="")throw Error(`Plugin at index ${y} is missing a name`);try{let R=I(v,E,"setup",AE);if(typeof R!=="function")throw Error("Plugin is missing a setup function");Tt(v,E,`on plugin ${Ft(w)}`);let C={name:w,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};y++;let D=R({initialOptions:i,resolve:(A,L={})=>{if(!x)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof A!=="string")throw Error("The path to resolve must be a string");let K=Object.create(null),ne=I(L,K,"pluginName",ue),B=I(L,K,"importer",ue),U=I(L,K,"namespace",ue),Z=I(L,K,"resolveDir",ue),le=I(L,K,"kind",ue),we=I(L,K,"pluginData",Hf),Y=I(L,K,"with",Qn);return Tt(L,K,"in resolve() call"),new Promise(($e,me)=>{let q={command:"resolve",path:A,key:e,pluginName:w};if(ne!=null)q.pluginName=ne;if(B!=null)q.importer=B;if(U!=null)q.namespace=U;if(Z!=null)q.resolveDir=Z;if(le!=null)q.kind=le;else throw Error('Must specify "kind" when calling "resolve"');if(we!=null)q.pluginData=l.store(we);if(Y!=null)q.with=q1(Y,"with");t(r,q,(Q,pe)=>{if(Q!==null)me(Error(Q));else $e({errors:la(pe.errors,l),warnings:la(pe.warnings,l),path:pe.path,external:pe.external,sideEffects:pe.sideEffects,namespace:pe.namespace,suffix:pe.suffix,pluginData:l.load(pe.pluginData)})})})},onStart(A){let K=Vf(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:w,callback:A,note:K}),C.onStart=!0},onEnd(A){let K=Vf(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:w,callback:A,note:K}),C.onEnd=!0},onResolve(A,L){let ne=Vf(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),B={},U=I(A,B,"filter",Wf),Z=I(A,B,"namespace",ue);if(Tt(A,B,`in onResolve() call for plugin ${Ft(w)}`),U==null)throw Error("onResolve() call is missing a filter");let le=g++;d[le]={name:w,callback:L,note:ne},C.onResolve.push({id:le,filter:Bf(U),namespace:Z||""})},onLoad(A,L){let ne=Vf(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),B={},U=I(A,B,"filter",Wf),Z=I(A,B,"namespace",ue);if(Tt(A,B,`in onLoad() call for plugin ${Ft(w)}`),U==null)throw Error("onLoad() call is missing a filter");let le=g++;p[le]={name:w,callback:L,note:ne},C.onLoad.push({id:le,filter:Bf(U),namespace:Z||""})},onDispose(A){m.push(A)},esbuild:s.esbuild});if(D)await D;h.push(C)}catch(R){return{ok:!1,error:R,pluginName:w}}}o["on-start"]=async(v,E)=>{l.clear();let w={errors:[],warnings:[]};await Promise.all(c.map(async({name:R,callback:C,note:J})=>{try{let D=await C();if(D!=null){if(typeof D!=="object")throw Error(`Expected onStart() callback in plugin ${Ft(R)} to return an object`);let A={},L=I(D,A,"errors",Js),K=I(D,A,"warnings",Js);if(Tt(D,A,`from onStart() callback in plugin ${Ft(R)}`),L!=null)w.errors.push(...Ns(L,"errors",l,R,void 0));if(K!=null)w.warnings.push(...Ns(K,"warnings",l,R,void 0))}}catch(D){w.errors.push(ai(D,s,l,J&&J(),R))}})),n(v,w)},o["on-resolve"]=async(v,E)=>{let w={},R="",C,J;for(let D of E.ids)try{({name:R,callback:C,note:J}=d[D]);let A=await C({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:l.load(E.pluginData),with:E.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onResolve() callback in plugin ${Ft(R)} to return an object`);let L={},K=I(A,L,"pluginName",ue),ne=I(A,L,"path",ue),B=I(A,L,"namespace",ue),U=I(A,L,"suffix",ue),Z=I(A,L,"external",pt),le=I(A,L,"sideEffects",pt),we=I(A,L,"pluginData",Hf),Y=I(A,L,"errors",Js),$e=I(A,L,"warnings",Js),me=I(A,L,"watchFiles",Nn),q=I(A,L,"watchDirs",Nn);if(Tt(A,L,`from onResolve() callback in plugin ${Ft(R)}`),w.id=D,K!=null)w.pluginName=K;if(ne!=null)w.path=ne;if(B!=null)w.namespace=B;if(U!=null)w.suffix=U;if(Z!=null)w.external=Z;if(le!=null)w.sideEffects=le;if(we!=null)w.pluginData=l.store(we);if(Y!=null)w.errors=Ns(Y,"errors",l,R,void 0);if($e!=null)w.warnings=Ns($e,"warnings",l,R,void 0);if(me!=null)w.watchFiles=qf(me,"watchFiles");if(q!=null)w.watchDirs=qf(q,"watchDirs");break}}catch(A){w={id:D,errors:[ai(A,s,l,J&&J(),R)]};break}n(v,w)},o["on-load"]=async(v,E)=>{let w={},R="",C,J;for(let D of E.ids)try{({name:R,callback:C,note:J}=p[D]);let A=await C({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:l.load(E.pluginData),with:E.with});if(A!=null){if(typeof A!=="object")throw Error(`Expected onLoad() callback in plugin ${Ft(R)} to return an object`);let L={},K=I(A,L,"pluginName",ue),ne=I(A,L,"contents",TE),B=I(A,L,"resolveDir",ue),U=I(A,L,"pluginData",Hf),Z=I(A,L,"loader",ue),le=I(A,L,"errors",Js),we=I(A,L,"warnings",Js),Y=I(A,L,"watchFiles",Nn),$e=I(A,L,"watchDirs",Nn);if(Tt(A,L,`from onLoad() callback in plugin ${Ft(R)}`),w.id=D,K!=null)w.pluginName=K;if(ne instanceof Uint8Array)w.contents=ne;else if(ne!=null)w.contents=kr(ne);if(B!=null)w.resolveDir=B;if(U!=null)w.pluginData=l.store(U);if(Z!=null)w.loader=Z;if(le!=null)w.errors=Ns(le,"errors",l,R,void 0);if(we!=null)w.warnings=Ns(we,"warnings",l,R,void 0);if(Y!=null)w.watchFiles=qf(Y,"watchFiles");if($e!=null)w.watchDirs=qf($e,"watchDirs");break}}catch(A){w={id:D,errors:[ai(A,s,l,J&&J(),R)]};break}n(v,w)};let P=(v,E)=>E([],[]);if(u.length>0)P=(v,E)=>{(async()=>{let w=[],R=[];for(let{name:C,callback:J,note:D}of u){let A,L;try{let K=await J(v);if(K!=null){if(typeof K!=="object")throw Error(`Expected onEnd() callback in plugin ${Ft(C)} to return an object`);let ne={},B=I(K,ne,"errors",Js),U=I(K,ne,"warnings",Js);if(Tt(K,ne,`from onEnd() callback in plugin ${Ft(C)}`),B!=null)A=Ns(B,"errors",l,C,void 0);if(U!=null)L=Ns(U,"warnings",l,C,void 0)}}catch(K){A=[ai(K,s,l,D&&D(),C)]}if(A){w.push(...A);try{v.errors.push(...A)}catch{}}if(L){R.push(...L);try{v.warnings.push(...L)}catch{}}}E(w,R)})()};let S=()=>{for(let v of m)setTimeout(()=>v(),0)};return x=!0,{ok:!0,requestPlugins:h,runOnEndCallbacks:P,scheduleOnDisposeCallbacks:S}};function DE(){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 Vf(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=IE(t,o,n);if(i)return r={text:e.message,location:i},r}catch{}}}function ai(e,t,n,r,s){let o="Internal error",i=null;try{o=(e&&e.message||e)+""}catch{}try{i=IE(t,(e.stack+"").split(`
|
|
63
|
+
`),"")}catch{}return{id:"",pluginName:s,text:o,location:i,notes:r?[r]:[],detail:n?n.store(e):-1}}function IE(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:kr(l.slice(0,c)).length,length:kr(l.slice(c,c+u)).length,lineText:l+`
|
|
64
64
|
`+t.slice(1).join(`
|
|
65
|
-
`),suggestion:""}}break}}return null}function
|
|
65
|
+
`),suggestion:""}}break}}return null}function cc(e,t,n){let r=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,r+1).map((o,i)=>{if(i===r)return`
|
|
66
66
|
...`;if(!o.location)return`
|
|
67
67
|
error: ${o.text}`;let{file:a,line:l,column:c}=o.location,u=o.pluginName?`[plugin: ${o.pluginName}] `:"";return`
|
|
68
|
-
${a}:${l}:${c}: ERROR: ${u}${o.text}`}).join("");let s=Error(e);for(let[o,i]of[["errors",t],["warnings",n]])Object.defineProperty(s,o,{configurable:!0,enumerable:!0,get:()=>i,set:(a)=>Object.defineProperty(s,o,{configurable:!0,enumerable:!0,value:a})});return s}function
|
|
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 la(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function wE(e,t,n){if(e==null)return null;let r={},s=I(e,r,"file",ue),o=I(e,r,"namespace",ue),i=I(e,r,"line",li),a=I(e,r,"column",li),l=I(e,r,"length",li),c=I(e,r,"lineText",ue),u=I(e,r,"suggestion",ue);if(Tt(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 Ns(e,t,n,r,s){let o=[],i=0;for(let a of e){let l={},c=I(a,l,"id",ue),u=I(a,l,"pluginName",ue),d=I(a,l,"text",ue),p=I(a,l,"location",SE),m=I(a,l,"notes",Js),g=I(a,l,"detail",Hf),y=`in element ${i} of "${t}"`;Tt(a,l,y);let h=[];if(m)for(let x of m){let P={},S=I(x,P,"text",ue),v=I(x,P,"location",SE);Tt(x,P,y),h.push({text:S||"",location:wE(v,y,s)})}o.push({id:c||"",pluginName:u||r,text:d||"",location:wE(p,y,s),notes:h,detail:n?n.store(g):-1}),i++}return o}function qf(e,t){let n=[];for(let r of e){if(typeof r!=="string")throw Error(`${Ft(t)} must be an array of strings`);n.push(r)}return n}function q1(e,t){let n=Object.create(null);for(let r in e){let s=e[r];if(typeof s!=="string")throw Error(`key ${Ft(r)} in object ${Ft(t)} must be a string`);n[r]=s}return n}function H1({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=fi(s);return r}}}function Bf(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function W1(e){let t;try{t=fi(e)}catch{return C1(e)}return JSON.parse(t)}var lo=bt("fs"),vE=bt("os"),mr=bt("path"),ia=process.env.ESBUILD_BINARY_PATH||ia,B1=(e)=>!!e&&e!=="/usr/bin/esbuild",EE="@esbuild/darwin-arm64",PE="@esbuild/darwin-x64",Uf={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},zf={"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"},jE={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function U1(){let e,t,n=!1,r=`${process.platform} ${vE.arch()} ${vE.endianness()}`;if(r in Uf)e=Uf[r],t="esbuild.exe";else if(r in zf)e=zf[r],t="bin/esbuild";else if(r in jE)e=jE[r],t="bin/esbuild",n=!0;else throw Error(`Unsupported platform: ${r}`);return{pkg:e,subpath:t,isWASM:n}}function z1(){let e=bt.resolve("esbuild"),t=mr.dirname(mr.dirname(mr.dirname(e)));if(mr.basename(t)==="node_modules"){for(let n in zf)try{let r=zf[n];if(lo.existsSync(mr.join(t,r)))return r}catch{}for(let n in Uf)try{let r=Uf[n];if(lo.existsSync(mr.join(t,r)))return r}catch{}}return null}function K1(e,t){let n=mr.dirname(bt.resolve("esbuild"));return mr.join(n,`downloaded-${e.replace("/","-")}-${mr.basename(t)}`)}function G1(){if(B1(ia))if(!lo.existsSync(ia))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ia}`);else return{binPath:ia,isWASM:!1};let{pkg:e,subpath:t,isWASM:n}=U1(),r;try{r=bt.resolve(`${e}/${t}`)}catch(s){if(r=K1(e,t),!lo.existsSync(r)){try{bt.resolve(e)}catch{let o=z1();if(o){let i=`
|
|
69
69
|
Specifically the "${o}" package is present but this platform
|
|
70
70
|
needs the "${e}" package instead. People often get into this
|
|
71
71
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
@@ -82,7 +82,7 @@ If you are installing with yarn, you can try listing both this platform and the
|
|
|
82
82
|
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
|
83
83
|
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
84
84
|
Keep in mind that this means multiple copies of esbuild will be present.
|
|
85
|
-
`;if(e===
|
|
85
|
+
`;if(e===PE&&o===EE||e===EE&&o===PE)i=`
|
|
86
86
|
Specifically the "${o}" package is present but this platform
|
|
87
87
|
needs the "${e}" package instead. People often get into this
|
|
88
88
|
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
|
@@ -114,11 +114,11 @@ want to do that.
|
|
|
114
114
|
If you are installing esbuild with npm, make sure that you don't specify the
|
|
115
115
|
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
|
116
116
|
of "package.json" is used by esbuild to install the correct binary executable
|
|
117
|
-
for your current platform.`)}throw s}}if(/\.zip\//.test(r)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(o){}if(s){let o=s.getPackageInformation(s.topLevel).packageLocation,i=
|
|
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=mr.join(o,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${mr.basename(t)}`);if(!lo.existsSync(i))lo.mkdirSync(mr.dirname(i),{recursive:!0}),lo.copyFileSync(r,i),lo.chmodSync(i,493);return{binPath:i,isWASM:n}}}return{binPath:r,isWASM:n}}var LE=bt("child_process"),X1=bt("crypto"),$y=bt("path"),ci=bt("fs"),Y1=bt("os"),Z1=bt("tty"),Sn;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{Sn=bt("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)Sn=void 0}var OE,dc=((OE=Sn==null?void 0:Sn.workerData)==null?void 0:OE.esbuildVersion)==="0.28.2",FE=()=>{if((!ia||!1)&&($y.basename(__filename)!=="main.js"||$y.basename(__dirname)!=="lib"))throw Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
|
|
118
118
|
|
|
119
|
-
More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=
|
|
120
|
-
error: ${c}`),d=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let d in u)c[d]=u[d]},l=(c,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),g={sharedBuffer:p,id:d,command:c,args:u};r.postMessage(g);let
|
|
121
|
-
`,{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}=G1();if(t)return["node",[e]];else return[e,[]]}},uc=()=>Z1.isatty(2),Q1={readFile(e,t){try{let n=ci.readFileSync(e,"utf8");try{ci.unlinkSync(e)}catch{}t(null,n)}catch(n){t(n,null)}},writeFile(e,t){try{let n=VE();ci.writeFileSync(n,e),t(n)}catch{t(null)}}},eL={readFile(e,t){try{ci.readFile(e,"utf8",(n,r)=>{try{ci.unlink(e,()=>t(n,r))}catch{t(n,r)}})}catch(n){t(n,null)}},writeFile(e,t){try{let n=VE();ci.writeFile(n,e,(r)=>r!==null?t(null):t(n))}catch{t(null)}}},tL="0.28.2",nL=(e)=>di().build(e),rL=(e)=>di().context(e),sL=(e,t)=>di().transform(e,t),oL=(e,t)=>di().formatMessages(e,t),iL=(e,t)=>di().analyzeMetafile(e,t),aL=(e)=>{if(Sn&&!dc){if(!wn)wn=Yf(Sn);return wn.buildSync(e)}let t;return Xf((n)=>n.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:uc(),defaultWD:ui,callback:(r,s)=>{if(r)throw r;t=s}})),t},lL=(e,t)=>{if(Sn&&!dc){if(!wn)wn=Yf(Sn);return wn.transformSync(e,t)}let n;return Xf((r)=>r.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:uc(),fs:Q1,callback:(s,o)=>{if(s)throw s;n=o}})),n},cL=(e,t)=>{if(Sn&&!dc){if(!wn)wn=Yf(Sn);return wn.formatMessagesSync(e,t)}let n;return Xf((r)=>r.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,o)=>{if(s)throw s;n=o}})),n},uL=(e,t)=>{if(Sn&&!dc){if(!wn)wn=Yf(Sn);return wn.analyzeMetafileSync(e,t)}let n;return Xf((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},fL=()=>{if(Kf)Kf();if(wn)wn.stop();return Promise.resolve()},Sy=!1,dL=(e)=>{if(e=D1(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(Sy)throw Error('Cannot call "initialize" more than once');return di(),Sy=!0,Promise.resolve()},ui=process.cwd(),lc,Kf,di=()=>{if(lc)return lc;let[e,t]=FE(),n=LE.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:ui}),{readFromStdout:r,afterClose:s,service:o}=ME({writeToStdin(u){n.stdin.write(u,(d)=>{if(d)s(d)})},readFileSync:ci.readFileSync,isSync:!1,hasFS:!0,esbuild:fc});n.stdin.on("error",s),n.on("error",s);let{stdin:i,stdout:a}=n;a.on("data",r),a.on("end",s),Kf=()=>{i.destroy(),a.destroy(),n.kill(),Sy=!1,lc=void 0,Kf=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 lc={build:(u)=>new Promise((d,p)=>{o.buildOrContext({callName:"build",refs:c,options:u,isTTY:uc(),defaultWD:ui,callback:(m,g)=>m?p(m):d(g)})}),context:(u)=>new Promise((d,p)=>o.buildOrContext({callName:"context",refs:c,options:u,isTTY:uc(),defaultWD:ui,callback:(m,g)=>m?p(m):d(g)})),transform:(u,d)=>new Promise((p,m)=>o.transform({callName:"transform",refs:c,input:u,options:d||{},isTTY:uc(),fs:eL,callback:(g,y)=>g?m(g):p(y)})),formatMessages:(u,d)=>new Promise((p,m)=>o.formatMessages({callName:"formatMessages",refs:c,messages:u,options:d,callback:(g,y)=>g?m(g):p(y)})),analyzeMetafile:(u,d)=>new Promise((p,m)=>o.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:d,callback:(g,y)=>g?m(g):p(y)}))},lc},Xf=(e)=>{let[t,n]=FE(),r=new Uint8Array,{readFromStdout:s,afterClose:o,service:i}=ME({writeToStdin(l){if(r.length!==0)throw Error("Must run at most one command");r=l},isSync:!0,hasFS:!0,esbuild:fc});e(i);let a=LE.execFileSync(t,n.concat("--service=0.28.2"),{cwd:ui,windowsHide:!0,input:r,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),o(null)},VE=()=>$y.join(Y1.tmpdir(),`esbuild-${X1.randomBytes(32).toString("hex")}`),wn=null,Yf=(e)=>{let{port1:t,port2:n}=new e.MessageChannel,r=new e.Worker(__filename,{workerData:{workerPort:n,defaultWD:ui,esbuildVersion:"0.28.2"},transferList:[n],execArgv:[]}),s=0,o=(c)=>{let u=Error(`Build failed with 1 error:
|
|
120
|
+
error: ${c}`),d=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=d,u.warnings=[],u},i=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw o("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let d in u)c[d]=u[d]},l=(c,u)=>{let d=s++,p=new SharedArrayBuffer(8),m=new Int32Array(p),g={sharedBuffer:p,id:d,command:c,args:u};r.postMessage(g);let y=Atomics.wait(m,0,0);if(y!=="ok"&&y!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+y);let{message:{id:h,resolve:x,reject:P,properties:S}}=e.receiveMessageOnPort(t);if(d!==h)throw Error(`Internal error: Expected id ${d} but got id ${h}`);if(P)throw a(P,S),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(),wn=null}}},pL=()=>{let e=Sn.workerData.workerPort,t=Sn.parentPort,n=(r)=>{let s={};if(r&&typeof r==="object")for(let o in r)s[o]=r[o];return s};try{let r=di();ui=Sn.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:o,id:i,command:a,args:l}=s,c=new Int32Array(o);try{switch(a){case"build":e.postMessage({id:i,resolve:await r.build(l[0])});break;case"transform":e.postMessage({id:i,resolve:await r.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:i,resolve:await r.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:i,resolve:await r.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:i,reject:u,properties:n(u)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(r){t.on("message",(s)=>{let{sharedBuffer:o,id:i}=s,a=new Int32Array(o);e.postMessage({id:i,reject:r,properties:n(r)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(dc)pL();var mL=fc});import{createRequire as hL}from"node:module";import{mkdirSync as gL,writeFileSync as yL}from"node:fs";import{dirname as xL,join as bL}from"node:path";function vy(e,t){return hL(bL(t,"package.json")).resolve(e)}function HE(e){return e==="node"||e==="bun"?"node":"browser"}function $L(e){return new RegExp(`^${e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}$`)}function SL(e,t){let n=$L(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 Ey(e){let t=await Promise.resolve().then(() => Mr(pc(),1)),{entry:n}=e,r={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:HE(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=[SL(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 WE(e){let t=await Promise.resolve().then(() => Mr(pc(),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:HE(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)=>(gL(xL(s.path),{recursive:!0}),yL(s.path,s.contents),s.path))}var BE=()=>{};var UE=".jx-entry-";import{rmSync as vL,writeFileSync as zE}from"node:fs";import{builtinModules as EL}from"node:module";import{tmpdir as PL}from"node:os";import{basename as jL,join as OL,resolve as kL}from"node:path";function KE(e){return oi(e)||e.startsWith("./")||e.startsWith("../")}function jy(e,t,n){if(oi(e))return vy(e.slice(Df.length),n);return kL(t,e)}function GE(e,t){return vy(e,t)}function _L(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 CL(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],plugins:[AL],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function TL(e){return e.minify??e.target==="browser"}function JL(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...RL};return t}function Oy(e){return{...JL(e),external:e.external??[],minify:TL(e),plugins:_L(e),target:e.target}}async function XE(e,t){let n={path:e.entryPath};if(e.contents!==void 0)n.contents=e.contents;let r=await Ey({entry:n,...Oy(t)});zE(e.outfile,r,"utf8")}async function YE(e,t,n){return WE({entries:e,outdir:t,...Oy(n)})}function ky(e){return e==="<stdin>"||jL(e).startsWith(UE)}async function ZE(e,t,n){let r=[],s=OL(PL(),`jx-resolve-${process.pid}.js`);try{await pi(`export * from ${JSON.stringify(e)};
|
|
121
|
+
`,{outfile:s,resolveDir:t},{...n,minify:!1,onFileLoaded:(o)=>r.push(o)})}catch{return}finally{vL(s,{force:!0})}return r.find((o)=>!ky(o))}async function pi(e,{resolveDir:t,outfile:n},r){let s=await Ey({entry:{resolveDir:t,source:e},...Oy(r)});zE(n,s,"utf8")}async function QE(e,{projectRoot:t,outfile:n,adapter:r,plugins:s}){let o=CL(r);if(s!==void 0)o.plugins=[...o.plugins??[],...s];await pi(e,{outfile:n,resolveDir:t},o)}var Py,AL,RL;var _y=F(()=>{Tn();BE();Py=["@vue/reactivity","lit-html"];AL={name:"jx-bare-node-builtins",setup(e){let t=EL.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}`}))}};RL={"process.env.NODE_ENV":'"production"'}});function Zf(e){return e!==null&&(e.locales.length>1||e.routing==="prefix-always")}function NL(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function e0(e,t=""){if(e===null||!Zf(e))return"";let n=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),s=JSON.stringify(Object.fromEntries(e.locales.map((i)=>[i,Le(t,NL(i,e))]))),o=JSON.stringify(Le(t,"/"));return`
|
|
122
122
|
// ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
|
|
123
123
|
const JX_LOCALES = ${n}
|
|
124
124
|
const JX_DEFAULT_LOCALE = ${r}
|
|
@@ -188,39 +188,83 @@ app.use(JX_ROOT, async (c, next) => {
|
|
|
188
188
|
res.headers.set('Content-Language', locale)
|
|
189
189
|
c.res = res
|
|
190
190
|
})
|
|
191
|
-
`}var
|
|
191
|
+
`}var Ay=F(()=>{Tn()});function mi(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function Qf(e){let t=r0(e),n=[],r=!1,s=!1,o=t.replaceAll(ML,(i,a,l)=>{if(r=!0,a)return s=!0,n.push(a),"*";return n.push(l),`:${l}`});return{isCatchAll:s,isDynamic:r,params:n,urlPattern:o}}function r0(e){let t=mi(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}`;return t}function s0(e){let t=r0(e).split("/").filter(Boolean),n=new Set;for(let[r,s]of t.entries()){let o=DL.exec(s);if(o){let a=o[2];if(!IL.test(a))return`\`${s}\` is not a parameter: a parameter name is letters, digits and _, and does not start with a digit`;if(n.has(a))return`\`[${a}]\` is declared twice in one path`;if(o[1]&&r!==t.length-1)return`\`${s}\` is a catch-all, so it must be the last segment`;n.add(a);continue}if(s.includes("[")||s.includes("]"))return`\`${s}\` has a bracket inside a segment: a parameter is a whole segment, like [id]`;let i=LL.exec(s);if(i)return`\`${s}\` contains "${i[0]}", which URL pattern syntax reads as an operator`}return null}function t0(e){if(e==="*")return 2;return e.startsWith(":")?1:0}function Cy(e,t){let n=n0(e.urlPattern).map((o)=>t0(o)),r=n0(t.urlPattern).map((o)=>t0(o)),s=Math.min(n.length,r.length);for(let o=0;o<s;o+=1)if(n[o]!==r[o])return n[o]-r[o];return n.length-r.length}function o0(e,t){return Cy(e,t)||e.urlPattern.localeCompare(t.urlPattern)}function n0(e){return e.split("/").filter((t)=>t!=="")}var ML,DL,IL,LL;var Ry=F(()=>{ML=/\[\.\.\.(\w+)\]|\[(\w+)\]/g;DL=/^\[(\.\.\.)?([^\]]*)\]$/,IL=/^[A-Za-z_]\w*$/,LL=/[:*?+(){}]/});function FL(e,t){let n=e.slice(0,t),r=n.split(`
|
|
192
192
|
`).length;return{column:t-n.lastIndexOf(`
|
|
193
|
-
`),line:r}}function
|
|
193
|
+
`),line:r}}function Jy(e,t,n,r){return{...FL(e,t),kind:n,message:r,offset:t}}function VL(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function c0(e){for(let t of[e,`return async function () {
|
|
194
194
|
${e}
|
|
195
|
-
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function
|
|
195
|
+
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function u0(e){Ny=e,ed=null}function HL(e,t){if(!ed){if(!Ny)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");ed=Ny()}return ed(e,t)}function f0(e,t,n){return HL(e,(r)=>{let s=VL(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(Jy(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 WL(e){return Es(e).includes("<")||!c0(e)}function BL(e){let t=Ty.get(e);if(t)return t;if(!WL(e)){let i={code:e,problems:[]};return Ty.set(e,i),i}let n=[],r=f0(e,"A function body",n),s=Es(r);for(let i of s.matchAll(qL)){let a=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(Jy(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&&c0(e)){let i=[...e].findIndex((a,l)=>a!==r[l]);n.push(Jy(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 Ty.set(e,o),o}function d0(e){let t=i0.get(e);if(t)return t;let n=[],s={code:f0(e,"A script",n),problems:n};return i0.set(e,s),s}function UL(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function a0(e,t,n){if(O(e))return l0(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>O(r)))return l0(e.join(`
|
|
196
196
|
`),t,n).split(`
|
|
197
|
-
`);return e}function
|
|
198
|
-
${e.text}`}function bD(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function $D(e){let t=Object.keys(e).filter((r)=>bl(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function Og(e){let n=Yu(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function Ri(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(w)=>w,transposeSelector:o=(w)=>w,resolveValue:i,host:a,shadowTree:l=!1}=t,c=[],u=(w)=>w!==null&&typeof w==="object"&&!Array.isArray(w)&&!pe(w),d=(w,v)=>{if(u(v))return[v];if(!xl(w)||!Array.isArray(v)||v.length===0)return[];return v.every((E)=>u(E))?v:[]},p=(w,v,E,O)=>{if(v===void 0||v===null)return null;if(pe(v))return E?i?.(w,v,O)??null:null;if(F(v))return null;let I=String(v);if(ce(I))return E?i?.(w,I,O)??null:null;return s(I)},m=(w,v,E=!0,O="self")=>{let I=[];for(let[D,V]of Object.entries(w)){if(d(D,V).length>0)continue;if(v&&(D.startsWith("@")||$l(D)))continue;if(D.startsWith("$"))continue;let W=p(D,V,E,O);if(W!==null)I.push([_g(D),W])}return I},g=(w)=>_(w)&&w!==""?{description:w}:{},b=(w,v,E,O,I)=>{if(E.length===0)return;let D=v;if(D!==null){let A=o(D);if(A===null)return;D=A}let V=Nv(w,D,E),W={text:V,conditions:[...w],selector:D,declarations:E,target:O,key:Xu(V)};c.push({...W,...g(I)})},h=(w,v,E)=>{let O=w.slice(10).trim();if(O==="")return;let I=[];for(let[V,W]of Object.entries(v)){if(!u(W))continue;let A=m(W,!0,!1,"unscoped");if(A.length>0)I.push({declarations:A,selector:V.trim()})}if(I.length===0)return;let D=bD(E,O,I);c.push({blocks:I,conditions:[...E],declarations:[],key:Xu(D),selector:null,target:"unscoped",text:D,...g(v.$description)})},x=(w,v,E,O,I,D)=>{if(w==="@--")return;if(xl(w)){b([...O,w],null,m(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(bl(w)){h(w,v,O);return}let V=Pv(w,r),W=V===null?w:`@media ${V}`,A=V===null?null:mr(V);if(A!==null&&E!==null&&!l){let{auto:J,forced:G}=kg(E,A);k(v,J,[...O,W],I,D),k($D(v),G,O,I,D);return}k(v,E,[...O,W],I,D)};function k(w,v,E,O,I){b(E,v,m(w,!0,!0,O),O,w.$description);for(let[D,V]of Object.entries(w))for(let W of d(D,V))if(D.startsWith("@"))x(D,W,v,E,O,I);else if(v!==null&&I&&a!==void 0)k(W,Rv(D,v,a),E,yD(D)?O:"descendant",!1);else if(v!==null)k(W,kv(v,D),E,Og(D)?O:"descendant",!1)}return k(e,n,[],"self",!0),c}function jv(e){return e===!1||e==="open"||e==="closed"}function Jn(e,t){let n=e?.$shadow;if(jv(n))return n===!1?null:n;let r=t?.shadow;return jv(r)&&r!==!1?r:null}var dD,pD,hD,pr="data-color-scheme",Zu="jx-color-scheme";var wl=M(()=>{ae();dD=new Set(["all","print","screen","speech"]);pD=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;hD=/^::(?:slotted|part)\(/u});function SD(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ut(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function an(e){return e.startsWith("#/$map/")?e.slice(2):e}function Xn(e){if(e==="")return[];return e.split("/").map((t)=>SD(t))}function zt(e,t){let n=e;for(let r of Xn(t))n=n?.[r];return n}function Je(e,t){let n=e;for(let r of Xn(t))n+=Ag.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function Jv(e,t){let n=e;for(let[r,s]of Xn(t).entries()){let o=r===0?"":"?.";n+=Ag.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function fs(e){return Ag.test(e)?e:JSON.stringify(e)}function Mv(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Ag;var Ti=M(()=>{Ag=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Cg(e){let t=e.$map;return F(t)?t:void 0}function tf(e){return F(e)&&!Array.isArray(e)&&"operator"in e}function Ni(e){return F(e)&&!Array.isArray(e)&&"$ref"in e}function jD(e,t,n){let r=tw[e];if(r===void 0||r<0||t[r]!=null)return t;let s=zt(n.$page,"locale");if(!_(s)||s==="")return t;let o=[...t];return o[r]=s,o}function Hv(){return globalThis.window??globalThis}function Wv(e){return e.startsWith("window#/")&&vD.has(e.slice(8))}function hr(e){return Fv.has(e)}function Qu(e){if(Array.isArray(e))return e.some((t)=>Qu(t));if(e===void 0||!tf(e))return!1;return hr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>Qu(t))||Object.values(e.cases??{}).some((t)=>Qu(t))}function Fo(e){return wr(e)&&!Qu(e.$expression)}function Rg(e,t){if(Array.isArray(e)){for(let n of e)Rg(n,t);return}if(e===void 0||!F(e))return;if(Ni(e)){if(!PD.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Xn(n)[0]??"")}return}if(tf(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Rg(r,t)}}function Dg(e){let t=new Set;return Rg(e.$expression,t),[...t]}function Lg(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Fo(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Dg(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function ut(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>kD)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function at(e,t,n,r,s){if(e===null||e===void 0)return e;if(tf(e))return Mn(e,t,n,r,s);if(Ni(e)){let o=ef(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return Bv(e,t,n,r,s);return s?.report(s.path??[],e),e}function Bv(e,t,n,r,s){return e.map((o,i)=>at(o,t,n,r,ut(s,i)))}function _D(e,t,n,r){let s=an(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return ef(s.slice(0,s.lastIndexOf("/")),t,n,r)};if(s.startsWith("#/state/"))return o("#/state/");if(s.startsWith("parent#/"))return o("parent#/");if(s.startsWith("$map/")||s.startsWith("$args/"))return s.split("/").length>2?ef(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function ef(e,t,n,r){let s=an(e);if(s==="$reduce/acc")return r?.acc;if(s.startsWith("$reduce/"))return r?.acc;if(s.startsWith("$args/")){let o=s.slice(6).split("/"),i=r?.args?.[o[0]];return o.length>1?zt(i,o.slice(1).join("/")):i}if(s.startsWith("event#/")){let o=s.slice(7);return zt(n,o)}if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Cg(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];return o.length>2?zt(a,o.slice(2).join("/")):a}if(s.startsWith("#/state/"))return zt(t,s.slice(8));if(s.startsWith("parent#/"))return zt(t,s.slice(8));if(s.startsWith("window#/"))return zt(Hv(),s.slice(8));if(s.startsWith("document#/"))return zt(globalThis.document,s.slice(10));return zt(t,s)??null}function OD(e,t,n,r){let s=an(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=Cg(t);if(i==="item")a=r?.item??l?.item??t["$map/item"];else if(i==="index")a=r?.index??l?.index??t["$map/index"];else a=l?.[i]??t[`$map/${i}`];if(o.length>2){let c=o.slice(2),u=c.pop(),d=c.length>0?zt(a,c.join("/")):a;return{key:u,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:Cg(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let a=Xn(o),l=a.pop(),c=t;for(let u of a)c=c[u];return{key:l,obj:c}}return{key:s,obj:t}}function Mn(e,t,n,r,s){let o=AD(e,t,n,r,s);return s?.report(s.path??[],o),o}function Dv(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function AD(e,t,n,r,s){let{operator:o,target:i,value:a,initial:l}=e;if(!wD.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Tg.has(o)&&!("value"in e)){let c=at(i,t,n,r,ut(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=Ni(i)?i.$ref:void 0;if(!_(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>Iv)throw Error(`$expression: call depth exceeded (${Iv})`);let d=Array.isArray(a)?a.map((m,g)=>at(m,t,n,r,ut(s,["value",g]))):[];if(c.startsWith("window#/")){if(!Wv(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),g=ED.get(m);if(g)return g(...jD(m,d,t));let b=Hv(),h=zt(b,m),x=m.lastIndexOf("/"),k=x===-1?b:zt(b,m.slice(0,x));return h.apply(k,d)}let p=ef(c,t,n,r);if(Ot(p))return p.apply(_D(c,t,n,r),d);if(F(p)&&"$expression"in p){let m=p,g={};for(let[b,h]of(m.parameters??[]).entries()){let x=_(h)?h:h?.name??"";if(!x)continue;g[x]=d[b]===void 0&&F(h)&&"default"in h?h.default:d[b]}return Mn(m.$expression,t,n,{args:g,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Mg.has(o)){if(o==="?:"){let m=at(i,t,n,r,ut(s,"target"));if(s){let g=at(a,t,n,r,ut(s,"value")),b=at(l,t,n,r,ut(s,"initial"));return m?g:b}return m?at(a,t,n,r):at(l,t,n,r)}let c=at(i,t,n,r,ut(s,"target")),u=String(c),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[b,h]of Object.entries(d)){let x=at(h,t,n,r,ut(s,["cases",b]));if(b===u)m=x}let g=at(e.default,t,n,r,ut(s,"default"));return p?m:g}return p?at(d[u],t,n,r):at(e.default,t,n,r)}if(Ng.has(o)){let c=at(i,t,n,r,ut(s,"target")),u=at(a,t,n,r,ut(s,"value"));switch(o){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return Dv(o,c,u)}}if(Vv.has(o)){let c=at(a,t,n,r,ut(s,"value")),{obj:u,key:d}=OD(i.$ref,t,n,r);u[d]=o==="="?c:Dv(o.slice(0,-1),u[d],c);return}if(qv.has(o)){let c=at(i,t,n,r,ut(s,"target"));switch(o){case"push":return c.push(at(a,t,n,r,ut(s,"value")));case"unshift":return c.unshift(at(a,t,n,r,ut(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=at(a,t,n,r,ut(s,"value"));return c.splice(...u)}default:break}}if(Ig.has(o)){let c=at(i,t,n,r,ut(s,"target")),u=a===void 0?[]:Array.isArray(a)?Bv(a,t,n,r,ut(s,"value")):[at(a,t,n,r,ut(s,"value"))],d=zt(c,o);if(!Ot(d))return;return d.apply(c,u)}if(Jg.has(o)){let c=at(i,t,n,r,ut(s,"target")),u=a;if(o==="reduce"){let d=at(l,t,n,r,ut(s,"initial"));for(let[p,m]of c.entries())d=Mn(u,t,n,{acc:d,index:p,item:m},p===0?ut(s,"value"):void 0);return d}if(o==="map")return c.map((d,p)=>Mn(u,t,n,{...r,index:p,item:d},p===0?ut(s,"value"):void 0));if(o==="filter")return c.filter((d,p)=>Mn(u,t,n,{...r,index:p,item:d},p===0?ut(s,"value"):void 0))}return}function mt(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(tf(e))return bn(e,t);if(Ni(e))return Fg(e.$ref,t);if(Array.isArray(e))return e.map((n)=>mt(n,t)).join(", ");return JSON.stringify(e)}function CD(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Fg(e,t){let n=an(e),r=t.statePrefix??"state",s=t.eventParam??"event";if(n==="$reduce/acc")return"_acc";if(n.startsWith("$reduce/"))return"_acc";if(n.startsWith("$args/"))return Je("_args",n.slice(6));if(n.startsWith("event#/"))return Je(s,n.slice(7));if(n.startsWith("$map/")){let o=n.split("/"),[,i]=o;if(i==="item")return o.length>2?Je("_item",o.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(n.startsWith("#/state/"))return Je(r,n.slice(8));if(n.startsWith("parent#/"))return Je(r,n.slice(8));if(n.startsWith("window#/"))return Je("window",n.slice(8));if(n.startsWith("document#/"))return Je("document",n.slice(10));return Je(r,n)}function Lv(e,t){if(Ni(e))return Fg(e.$ref,t);return mt(e,t)}function RD(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(_r)})`,o=JSON.stringify(hh);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function bn(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(Tg.has(n)&&!("value"in e)){let i=mt(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(Ni(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>mt(l,t)):[];if(i.startsWith("window#/")){if(!Wv(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let l=RD(i.slice(8),a,t);if(l)return l;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(i.startsWith("#/state/")){let l=i.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((d,p)=>`${JSON.stringify(d)}: ${a[p]??"undefined"}`).join(", ");return`${CD(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Fg(i,t)}(${a.join(", ")})`}if(Mg.has(n)){if(n==="?:"){let c=mt(r,t),u=mt(s,t),d=mt(o,t);return`(${c} ? ${u} : ${d})`}let i=mt(r,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${mt(u,t)} : `).join(""),l="default"in e?mt(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${i}))`}if(Ng.has(n)){let i=mt(r,t),a=mt(s,t);return`(${i} ${n} ${a})`}if(Vv.has(n)){let i=Lv(r,t),a=mt(s,t);return`${i} ${n} ${a}`}if(qv.has(n)){let i=Lv(r,t);switch(n){case"push":return`${i}.push(${mt(s,t)})`;case"unshift":return`${i}.unshift(${mt(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>mt(l,t)).join(", "):mt(s,t);return`${i}.splice(${a})`}default:break}}if(Ig.has(n)){let i=mt(r,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>mt(l,t)).join(", "):mt(s,t);return`(${i})?.${n}?.(${a})`}if(Jg.has(n)){let i=mt(r,t),a=bn(s,t);if(n==="reduce"){let l=mt(o,t);return`${i}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(n==="map")return`${i}.map((_item, _index) => ${a})`;if(n==="filter")return`${i}.filter((_item, _index) => ${a})`}return"undefined"}function Ji(e,t,n,r){return at(e,t,n,r)}function ds(e,t={}){return mt(e,t)}var Fv,Tg,Ng,Vv,qv,Jg,Mg,Ig,wD,vD,ED,PD,Iv=64,kD=64;var Mi=M(()=>{yh();ae();Ti();Fv=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Tg=new Set(["!","-"]),Ng=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Vv=new Set(["=","+=","-=","*=","/="]),qv=new Set(["push","pop","shift","unshift","splice"]),Jg=new Set(["reduce","map","filter"]),Mg=new Set(["?:","switch"]),Ig=new Set(["includes","indexOf","lastIndexOf","join","slice","concat","at","flat","toSorted","toReversed","toSpliced","with","toUpperCase","toLowerCase","trim","trimStart","trimEnd","split","startsWith","endsWith","padStart","padEnd","replaceAll","repeat","charAt","normalize","toLocaleUpperCase","toLocaleLowerCase","toFixed","toPrecision","toLocaleString"]),wD=new Set([...Fv,...Tg,...Ng,...Jg,...Mg,...Ig,"call"]),vD=new Set(["isNaN","isFinite","parseFloat","parseInt","encodeURIComponent","decodeURIComponent","structuredClone","Math/abs","Math/ceil","Math/floor","Math/round","Math/trunc","Math/sign","Math/sqrt","Math/cbrt","Math/pow","Math/exp","Math/log","Math/log2","Math/log10","Math/min","Math/max","Math/hypot","Number/isInteger","Number/isFinite","Number/isNaN","Number/parseFloat","Number/parseInt","JSON/parse","JSON/stringify","Object/keys","Object/values","Object/entries","Object/fromEntries","Array/from","Array/isArray","Array/of","String/fromCharCode","String/fromCodePoint",...gh]),ED=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??_r,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??_r,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??_r,{timeZone:hh,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??_r,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??_r,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??_r,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??_r,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??_r,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);PD=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function Uv(e){if("operator"in e)return{kind:"expression",node:e};if("if"in e)return{kind:"if",node:e};if("$switch"in e)return{kind:"switch",node:e};if("stopPropagation"in e)return{kind:"stopPropagation"};if("preventDefault"in e)return{kind:"preventDefault"};return{kind:"dispatch",node:e}}function TD(e){return(F(e)||Ot(e))&&"then"in e&&Ot(e.then)}async function Ii(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=Uv(o);switch(i.kind){case"expression":{let a=Mn(i.node,t,n,s);if(TD(a))await a;break}case"if":{let a=i.node,l=Ji(a.if,t,n,s)?a.then:a.else;if(Array.isArray(l))await Ii(l,t,n,r);break}case"switch":{let a=i.node,l=String(Ji(a.$switch,t,n,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Ii(u,t,n,r);break}case"dispatch":{let a=i.node,l=Ot(r.target)?r.target():r.target,c=n?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Ji(a.detail,t,n,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function Yn(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=Uv(s);switch(o.kind){case"expression":{r.push(`${n}${bn(o.node,t)};`);break}case"if":{let i=o.node,a=ds(i.if,t),l={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,Yn(i.then??[],l)),i.else)r.push(`${n}} else {`,Yn(i.else,l));r.push(`${n}}`);break}case"switch":{let i=o.node,a=ds(i.$switch,t),l={...t,indent:`${n} `};r.push(`${n}switch (String(${a})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,Yn(u,l),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Yn(i.default,l),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${ds(i.detail,t)}`);if(i.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)c.push(`composed: ${JSON.stringify(i.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";r.push(`${n}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
|
|
199
|
-
`)}var nf=M(()=>{ae();Mi()});var Vg=M(()=>{ae()});function Di(e){if(e===ND)return"client";if(e===JD)return"server";return null}function MD(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function Kv(e,t){return`${Wg}${MD(e)}#${t}`}function rf(e){return e.startsWith(Wg)}function Li(e){if(!rf(e))return null;let t=e.slice(Wg.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function qg(e,t){if(Array.isArray(e)){let r=e.map((s)=>qg(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!L(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&_(s)){let i=Di(s);o=i===null?s:Kv(t,i)}else if(r!=="$script")o=qg(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function vl(e,t){return qg(e,t)}function LD(e){return ID.test(e)&&!DD.test(e)}function zv(e){return Di(e)==="client"||Li(e)?.side==="client"}function Hg(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())Hg(s,[...t,r],n);return n}if(!L(e))return n;if(_(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")Hg(s,[...t,r],n);return n}function FD(e){let t=e.at(-1);return _(t)?`"${t}"`:"this entry"}function Gv(e){let t=Hg(e,[],[]),n=t.some((s)=>!s.lazy&&zv(s.src)),r=[];for(let s of t){let o=FD(s.path);if(!s.lazy&&LD(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&zv(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var Wg="jx-script:",ND="#client",JD="#server",ID,DD;var Fi=M(()=>{ae();ID=/^\.{1,2}\//u,DD=/\.json$/iu});function BD(e){for(let t of Object.keys(e))if(WD.has(t))return!0;return!1}function Vi(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=f$(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function Zv(){return[...Yv].toSorted()}function Rr(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||Yv.has(n))return String(t);return t?"":null}function Qv(e,t,n){if(!Array.isArray(e))return[];let r=e;if(Ot(t))r=r.filter(t);if(Ot(n))r=[...r].toSorted(n);return r}function e0(e,t,n,r){let s=oi(t);if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(Xe(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?De(o)?0:"":i;return}e[s]=De(o)?Number(n):n}function Bg(e){let t=Xv.get(e);if(t)return t;let n=new Set,r=Ar(e);for(let[s,o]of Object.entries(e.state??{}))if(_(o)?ce(o):pn(o)?!wr(o)&&!hr(o.$expression.operator):r.get(s)==="computed")n.add(s);return Xv.set(e,n),n}function t0(e){let t=e.state??{},n=Bg(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function Ug(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(_(r)&&ce(r)){t.set(n,void 0);continue}if(F(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(UD.some((s)=>(s in r))){t.set(n,void 0);continue}if(BD(r))continue}t.set(n,r)}return t}var WD,gr,Yv,d7,Xv,UD,zg=32,sf,of="jx-slot",El="data-jx-slots",Kg="jx.slot.group",p7;var qi=M(()=>{wl();Mi();Ti();ae();Pi();hn();nf();Vg();Fi();Vg();wl();WD=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);gr=new Set(["$schema","$shadow","formAssociated","formValue","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Yv=new Set(["contenteditable","draggable","spellcheck"]);d7=Object.freeze({emptyRow:!0});Xv=new WeakMap;UD=["$expression","$prototype","$ref","$src"],sf=/^[\t\n\f\r ]+$/u,p7=(()=>{let e=Symbol.for(Kg),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function GD(){if(!jl){jl=new Map;for(let[e,t,n]of KD){let r=jl.get(e);if(!r)r=new Map,jl.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return jl}function lf(e,t){return n0??=new Map(zD),n0.get(t)??GD().get(t)?.get(e.toLowerCase())??null}function Gg(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return XD.has(e.toLowerCase());return t==="text"&&YD.has(e.toLowerCase())}var C=(e,t={})=>({attribute:e,kind:"text",...t}),we=(e,t={})=>({attribute:e,kind:"boolean",...t}),af,zD,KD,n0,jl,XD,YD;var Xg=M(()=>{af={live:!0},zD=[["accessKey",C("accesskey")],["ariaAtomic",C("aria-atomic")],["ariaAutoComplete",C("aria-autocomplete")],["ariaBrailleLabel",C("aria-braillelabel")],["ariaBrailleRoleDescription",C("aria-brailleroledescription")],["ariaBusy",C("aria-busy")],["ariaChecked",C("aria-checked")],["ariaColCount",C("aria-colcount")],["ariaColIndex",C("aria-colindex")],["ariaColIndexText",C("aria-colindextext")],["ariaColSpan",C("aria-colspan")],["ariaCurrent",C("aria-current")],["ariaDescription",C("aria-description")],["ariaDisabled",C("aria-disabled")],["ariaExpanded",C("aria-expanded")],["ariaHasPopup",C("aria-haspopup")],["ariaHidden",C("aria-hidden")],["ariaInvalid",C("aria-invalid")],["ariaKeyShortcuts",C("aria-keyshortcuts")],["ariaLabel",C("aria-label")],["ariaLevel",C("aria-level")],["ariaLive",C("aria-live")],["ariaModal",C("aria-modal")],["ariaMultiLine",C("aria-multiline")],["ariaMultiSelectable",C("aria-multiselectable")],["ariaOrientation",C("aria-orientation")],["ariaPlaceholder",C("aria-placeholder")],["ariaPosInSet",C("aria-posinset")],["ariaPressed",C("aria-pressed")],["ariaReadOnly",C("aria-readonly")],["ariaRelevant",C("aria-relevant")],["ariaRequired",C("aria-required")],["ariaRoleDescription",C("aria-roledescription")],["ariaRowCount",C("aria-rowcount")],["ariaRowIndex",C("aria-rowindex")],["ariaRowIndexText",C("aria-rowindextext")],["ariaRowSpan",C("aria-rowspan")],["ariaSelected",C("aria-selected")],["ariaSetSize",C("aria-setsize")],["ariaSort",C("aria-sort")],["ariaValueMax",C("aria-valuemax")],["ariaValueMin",C("aria-valuemin")],["ariaValueNow",C("aria-valuenow")],["ariaValueText",C("aria-valuetext")],["autocapitalize",C("autocapitalize")],["autocorrect",we("autocorrect",{keywords:["on","off"]})],["autofocus",we("autofocus")],["className",C("class")],["contentEditable",C("contenteditable")],["dir",C("dir")],["draggable",we("draggable")],["enterKeyHint",C("enterkeyhint")],["headingOffset",C("headingoffset")],["headingReset",we("headingreset")],["hidden",{attribute:"hidden",kind:"hidden"}],["id",C("id")],["inert",we("inert")],["inputMode",C("inputmode")],["lang",C("lang")],["popover",C("popover")],["role",C("role")],["slot",C("slot")],["spellcheck",we("spellcheck")],["tabIndex",C("tabindex")],["title",C("title")],["translate",we("translate",{keywords:["yes","no"]})],["writingSuggestions",C("writingsuggestions")]],KD=[["aLink","body",C("alink")],["abbr","td th",C("abbr")],["accept","input",C("accept")],["acceptCharset","form",C("accept-charset")],["action","form",C("action")],["align","caption col colgroup div embed h1 h2 h3 h4 h5 h6 hr iframe img input legend object p table tbody td tfoot th thead tr",C("align")],["allow","iframe",C("allow")],["allowFullscreen","iframe",we("allowfullscreen")],["alpha","input",we("alpha")],["alt","area img input",C("alt")],["archive","object",C("archive")],["as","link",C("as")],["async","script",we("async")],["autocomplete","form input select textarea",C("autocomplete")],["autoplay","audio video",we("autoplay")],["axis","td th",C("axis")],["background","body",C("background")],["behavior","marquee",C("behavior")],["bgColor","body marquee table td th tr",C("bgcolor")],["border","img object table",C("border")],["cellPadding","table",C("cellpadding")],["cellSpacing","table",C("cellspacing")],["ch","col colgroup tbody td tfoot th thead tr",C("char")],["chOff","col colgroup tbody td tfoot th thead tr",C("charoff")],["charset","a link script",C("charset")],["checked","input",we("checked",af)],["cite","blockquote del ins q",C("cite")],["clear","br",C("clear")],["closedBy","dialog",C("closedby")],["code","object",C("code")],["codeBase","object",C("codebase")],["codeType","object",C("codetype")],["colSpan","td th",C("colspan")],["color","font hr",C("color")],["colorSpace","input",C("colorspace")],["cols","frameset textarea",C("cols")],["command","button",C("command")],["compact","dir dl menu ol ul",we("compact")],["content","meta",C("content")],["controls","audio img video",we("controls")],["coords","a area",C("coords")],["crossOrigin","audio img link script video",C("crossorigin")],["data","object",C("data")],["dateTime","del ins time",C("datetime")],["declare","object",we("declare")],["decoding","img",C("decoding")],["default","track",we("default")],["defaultChecked","input",we("checked")],["defaultMuted","audio video",we("muted")],["defaultSelected","option",we("selected")],["defaultValue","input",C("value")],["defer","script",we("defer")],["dirName","input textarea",C("dirname")],["direction","marquee",C("direction")],["disabled","button fieldset input link optgroup option select textarea",we("disabled")],["download","a area",C("download")],["encoding","form",C("enctype")],["enctype","form",C("enctype")],["event","script",C("event")],["face","font",C("face")],["fetchPriority","img link script",C("fetchpriority")],["formAction","button input",C("formaction")],["formEnctype","button input",C("formenctype")],["formMethod","button input",C("formmethod")],["formNoValidate","button input",we("formnovalidate")],["formTarget","button input",C("formtarget")],["frame","table",C("frame")],["frameBorder","frame iframe",C("frameborder")],["headers","td th",C("headers")],["height","canvas embed iframe img input marquee object source td th video",C("height")],["high","meter",C("high")],["href","a area base link",C("href")],["hreflang","a area link",C("hreflang")],["hspace","embed img input marquee object",C("hspace")],["htmlFor","label script template",C("for")],["httpEquiv","meta",C("http-equiv")],["imageSizes","link",C("imagesizes")],["imageSrcset","link",C("imagesrcset")],["integrity","link script",C("integrity")],["isMap","img",we("ismap")],["kind","track",C("kind")],["label","optgroup option track",C("label")],["link","body",C("link")],["loading","audio iframe img video",C("loading")],["longDesc","frame iframe img",C("longdesc")],["loop","audio video",we("loop")],["low","meter",C("low")],["lowsrc","img",C("lowsrc")],["marginHeight","frame iframe",C("marginheight")],["marginWidth","frame iframe",C("marginwidth")],["max","input meter progress",C("max")],["maxLength","input textarea",C("maxlength")],["media","link meta source style",C("media")],["method","form",C("method")],["min","input meter",C("min")],["minLength","input textarea",C("minlength")],["multiple","input select",we("multiple")],["muted","audio video",we("muted",af)],["name","a button details embed fieldset form frame iframe img input map meta object output param select slot textarea",C("name")],["noHref","area",we("nohref")],["noModule","script",we("nomodule")],["noResize","frame",we("noresize")],["noShade","hr",we("noshade")],["noValidate","form",we("novalidate")],["noWrap","td th",we("nowrap")],["open","details dialog",we("open")],["optimum","meter",C("optimum")],["pattern","input",C("pattern")],["ping","a area",C("ping")],["placeholder","input textarea",C("placeholder")],["playsInline","video",we("playsinline")],["popoverTargetAction","button input",C("popovertargetaction")],["poster","video",C("poster")],["preload","audio video",C("preload")],["readOnly","input textarea",we("readonly")],["referrerPolicy","a area iframe img link script",C("referrerpolicy")],["rel","a area form link",C("rel")],["required","input select textarea",we("required")],["rev","a link",C("rev")],["reversed","ol",we("reversed")],["rowSpan","td th",C("rowspan")],["rows","frameset textarea",C("rows")],["rules","table",C("rules")],["scheme","meta",C("scheme")],["scope","td th",C("scope")],["scrollAmount","marquee",C("scrollamount")],["scrollDelay","marquee",C("scrolldelay")],["scrolling","frame iframe",C("scrolling")],["selected","option",we("selected",af)],["shadowRootClonable","template",we("shadowrootclonable")],["shadowRootCustomElementRegistry","template",C("shadowrootcustomelementregistry")],["shadowRootDelegatesFocus","template",we("shadowrootdelegatesfocus")],["shadowRootMode","template",C("shadowrootmode")],["shadowRootSerializable","template",we("shadowrootserializable")],["shadowRootSlotAssignment","template",C("shadowrootslotassignment")],["shape","a area",C("shape")],["size","font hr input select",C("size")],["sizes","img source",C("sizes")],["span","col colgroup",C("span")],["src","audio embed frame iframe img input source track video",C("src")],["srcdoc","iframe",C("srcdoc")],["srclang","track",C("srclang")],["srcset","img source",C("srcset")],["standby","object",C("standby")],["start","ol",C("start")],["step","input",C("step")],["summary","table",C("summary")],["target","a area base form link",C("target")],["text","body",C("text")],["trueSpeed","marquee",we("truespeed")],["type","a area button embed input li link object ol param script source style ul",C("type")],["useMap","img input object",C("usemap")],["vAlign","col colgroup tbody td tfoot th thead tr",C("valign")],["vLink","body",C("vlink")],["value","button data li meter option param progress",C("value")],["value","input",C("value",af)],["valueType","param",C("valuetype")],["version","html",C("version")],["vspace","embed img input marquee object",C("vspace")],["width","canvas col colgroup embed hr iframe img input listing marquee object pre source table td th video xmp",C("width")],["wrap","textarea",C("wrap")]];XD=new Set(["output","textarea"]),YD=new Set(["a","option","title"])});function r0(e,t,n){let r=e.$description;if(_(r))(Object.keys(t).length>0?t:n).$description=r}function s0(e,t,n,r,s=ZD,o={}){let i=[],a=(p,m)=>{let g={mediaQueries:t,scope:m,transposeValue:n};if(r)g.resolveValue=(b,h)=>r(b,h,m);for(let b of Ri(p,g))i.push(o.comments===!0?Sl(b):b.text)},l={},c={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(F(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if($l(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")l[p]=m;else c[p]=m}r0(e,l,c),a(l,s.root),a(c,s.body);for(let[p,m]of d)if(p.startsWith("&"))a({[p]:m},s.root);else a(m,p);for(let[p,m]of u){if(xl(p)||bl(p)){a({[p]:m},null);continue}let g={},b={},h=[];for(let[x,k]of Object.entries(m)){if(F(k)&&!Array.isArray(k)){if(!x.startsWith("@"))h.push([x,k]);continue}if(x.startsWith("$"))continue;if(x.startsWith("--"))g[x]=k;else b[x]=k}r0(m,g,b),a({[p]:g},s.root),a({[p]:b},s.body);for(let[x,k]of h)a({[p]:k},x)}if(Object.values(t).some((p)=>mr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${pr}="light"]) { color-scheme: light }`,`${s.root}:where([${pr}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
200
|
-
`)}var ZD;var o0=M(()=>{wl();ae();ZD={body:"body",root:":root"}});function a0(e){return QD.has(e.toLowerCase())?"block":"inline"}function l0(e){let t=e;for(let r=i0.exec(t);r;r=i0.exec(t))t=t.slice(r[0].length);if(t==="")return null;let n=e1.exec(t);return n?a0(n[1]):"text"}function c0(e){let t=e;while(t.endsWith("-->")){let r=t.lastIndexOf("<!--");if(r===-1)break;t=t.slice(0,r)}if(t==="")return null;let n=t1.exec(t)??n1.exec(t);return n?a0(n[1]):"text"}function r1(e,t){let n=c0(e),r=l0(t);if(n===null||r===null)return!1;return n!=="text"&&r!=="text"&&(n==="block"||r==="block")}function Kt(e,t={}){let{lead:n="",preformatted:r=!1,separator:s=`
|
|
201
|
-
|
|
202
|
-
`)
|
|
203
|
-
|
|
197
|
+
`);return e}function l0(e,t,n){let{code:r,problems:s}=BL(e),[o,...i]=s.filter((a)=>a.kind==="unsupported");if(o)throw new td(t,[o,...i]);for(let a of s)n.push({...t,problem:a});return r}function My(e,t,n){if(Array.isArray(e))return e.map((i,a)=>My(i,{...t,pointer:`${t.pointer}/${a}`},n));if(!M(e))return e;let r=Km(e),s=[],o={set:(i,a)=>{s.push([i,a])}};for(let[i,a]of Object.entries(e)){let l={...t,pointer:`${t.pointer}/${UL(i)}`};if(r&&i==="body")o.set(i,a0(a,l,n));else if(r&&(i==="getter"||i==="setter")&&M(a)){let c={...a};if(a.body!==void 0)c.body=a0(a.body,{...l,pointer:`${l.pointer}/body`},n);o.set(i,c)}else o.set(i,My(a,l,n))}return Object.fromEntries(s)}function mc(e,t,n=[]){return My(e,{path:t,pointer:""},n)}function p0(e,t,n=[]){return mc(e,t,n)}var qL,Ty,ed=null,Ny=null,i0,td;var Dy=F(()=>{ae();qL=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;Ty=new Map;i0=new Map;td=class td 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 zL}from"node:module";var nd=F(()=>{Dy();Dy();u0(()=>zL(import.meta.url)("ts-blank-space").default)});function h0(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!m0.has(s))m0.add(s),console.warn(`Warning: ${s}`)}}function Kr(e,t){let n=[],r=mc(e,t,n);return h0(n),r}function g0(e,t){let n=[],r=p0(e,t,n);return h0(n),r}var m0;var ca=F(()=>{nd();m0=new Set});function GL(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function y0(e){if(!M(e)||!("paginate"in e))return null;let{each:t,pageSize:n,paginate:r}=e,s=M(r)?r.$ref:void 0,o=O(s)?KL.exec(s)?.[1]:void 0;if(o===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Ve(n)||!Number.isInteger(n)||n<1)throw TypeError("$paths.pageSize must be a positive integer");let i={key:GL(o),pageSize:n};if(t!==void 0){if(!M(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(M(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");i.each=t}return i}function Iy(e,t){return Math.max(1,Math.ceil(e/t))}function x0(e,t,n){let r=(t-1)*n;return e.slice(r,r+n)}function hi(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 b0(e,t,n,r){let s=Iy(r,n),o=[];for(let i=1;i<=s;i++)o.push({current:i===t,number:i,url:hi(e,i)});return{first:hi(e,1),itemCount:r,last:hi(e,s),next:t<s?hi(e,t+1):null,number:t,pageCount:s,pageSize:n,pages:o,prev:t>1?hi(e,t-1):null}}var KL;var $0=F(()=>{ae();KL=/^#\/state\/([^/]+)$/});function Mn(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function w0(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return XL.has(n.toLowerCase())?n:e.slice(1)}return null}function hc(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function gc(e){return e.startsWith("@keyframes")}function v0(e,t){let n=[];for(let r of ua(e))for(let s of ua(t))n.push(Ly(r,s));return n.join(", ")}function Ly(e,t){let n=ZL(e,t);if(n!==null)return n;let r=_0(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function E0(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 P0(e){if(e.endsWith(":host"))return{inner:"",prefix:e.slice(0,-5)};let t=e.lastIndexOf(":host(");if(t===-1||E0(e,t+5)!==e.length)return null;return{inner:e.slice(t+6,-1),prefix:e.slice(0,t)}}function j0(e){if(!e.startsWith(":host"))return null;let t=e.slice(5);if(t.startsWith("(")){let n=E0(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 O0(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===":"&&YL.test(e.slice(r)))return r}}return e.length}function ZL(e,t){let n=P0(e);if(n===null||!qy(t))return null;let r=sd(t);if(r.length>1||r.length===1&&r[0]!==0)return null;let s=r.length===1?t.slice(1):t,o=O0(s);if(o===0)return`${e}${s}`;return`${n.prefix}:host(${n.inner}${s.slice(0,o)})${s.slice(o)}`}function eF(e,t,n){let r=j0(e);if(r===null)return n==="shadow"&&QL.test(e)?e:Ly(t,e);let{inner:s,rest:o}=r;if(n==="light")return`${t}${s??""}${o}`;let a=`${P0(t)?.prefix??""}:host${s===null?"":`(${s})`}`;if(o==="")return a;return/^[\s>+~]/u.test(o)?`${a}${o}`:Ly(a,o)}function k0(e,t,n){let r=[];for(let s of ua(t))for(let o of ua(e))r.push(eF(o,s,n));return r.join(", ")}function tF(e){return ua(e).every((t)=>{let n=j0(t);if(n===null)return qy(t);let r=O0(n.rest);return n.rest.slice(r).replace(/^::?[\w-]+(?:\([^)]*\))?/u,"")===""})}function sd(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 _0(e,t){return sd(e).length>0?nF(e,t):null}function nF(e,t){let n="",r=0;for(let s of sd(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function ua(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 Ar(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Fy(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${_r}]))`,forced:`${e}:where([${_r}="${t}"])`};return{auto:`:where(:root:not([${_r}])) ${e}`,forced:`:where(:root[${_r}="${t}"]) ${e}`}}function yc(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Vy(e){return e.startsWith("--")?e:Mn(e)}function rd(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 A0(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 xc(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
|
|
198
|
+
${e.text}`}function rF(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 sF(e){let t=Object.keys(e).filter((r)=>gc(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function qy(e){let n=sd(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function fa(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(S)=>S,transposeSelector:o=(S)=>S,resolveValue:i,host:a,shadowTree:l=!1}=t,c=[],u=(S)=>S!==null&&typeof S==="object"&&!Array.isArray(S)&&!de(S),d=(S,v)=>{if(u(v))return[v];if(!hc(S)||!Array.isArray(v)||v.length===0)return[];return v.every((E)=>u(E))?v:[]},p=(S,v,E,w)=>{if(v===void 0||v===null)return null;if(de(v))return E?i?.(S,v,w)??null:null;if(V(v))return null;let R=String(v);if(ce(R))return E?i?.(S,R,w)??null:null;return s(R)},m=(S,v,E=!0,w="self")=>{let R=[];for(let[C,J]of Object.entries(S)){if(d(C,J).length>0)continue;if(v&&(C.startsWith("@")||yc(C)))continue;if(C.startsWith("$"))continue;let D=p(C,J,E,w);if(D!==null)R.push([Vy(C),D])}return R},g=(S)=>O(S)&&S!==""?{description:S}:{},y=(S,v,E,w,R)=>{if(E.length===0)return;let C=v;if(C!==null){let A=o(C);if(A===null)return;C=A}let J=A0(S,C,E),D={text:J,conditions:[...S],selector:C,declarations:E,target:w,key:rd(J)};c.push({...D,...g(R)})},h=(S,v,E)=>{let w=S.slice(10).trim();if(w==="")return;let R=[];for(let[J,D]of Object.entries(v)){if(!u(D))continue;let A=m(D,!0,!1,"unscoped");if(A.length>0)R.push({declarations:A,selector:J.trim()})}if(R.length===0)return;let C=rF(E,w,R);c.push({blocks:R,conditions:[...E],declarations:[],key:rd(C),selector:null,target:"unscoped",text:C,...g(v.$description)})},x=(S,v,E,w,R,C)=>{if(S==="@--")return;if(hc(S)){y([...w,S],null,m(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(gc(S)){h(S,v,w);return}let J=w0(S,r),D=J===null?S:`@media ${J}`,A=J===null?null:Ar(J);if(A!==null&&E!==null&&!l){let{auto:L,forced:K}=Fy(E,A);P(v,L,[...w,D],R,C),P(sF(v),K,w,R,C);return}P(v,E,[...w,D],R,C)};function P(S,v,E,w,R){y(E,v,m(S,!0,!0,w),w,S.$description);for(let[C,J]of Object.entries(S))for(let D of d(C,J))if(C.startsWith("@"))x(C,D,v,E,w,R);else if(v!==null&&R&&a!==void 0)P(D,k0(C,v,a),E,tF(C)?w:"descendant",!1);else if(v!==null)P(D,v0(v,C),E,qy(C)?w:"descendant",!1)}return P(e,n,[],"self",!0),c}function S0(e){return e===!1||e==="open"||e==="closed"}function er(e,t){let n=e?.$shadow;if(S0(n))return n===!1?null:n;let r=t?.shadow;return S0(r)&&r!==!1?r:null}var XL,YL,QL,_r="data-color-scheme",od="jx-color-scheme";var bc=F(()=>{ae();XL=new Set(["all","print","screen","speech"]);YL=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;QL=/^::(?:slotted|part)\(/u});function oF(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Jt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function dn(e){return e.startsWith("#/$map/")?e.slice(2):e}function vn(e){if(e==="")return[];return e.split("/").map((t)=>oF(t))}function on(e,t){let n=e;for(let r of vn(t))n=n?.[r];return n}function Ae(e,t){let n=e;for(let r of vn(t))n+=Hy.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function C0(e,t){let n=e;for(let[r,s]of vn(t).entries()){let o=r===0?"":"?.";n+=Hy.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function Gr(e){return Hy.test(e)?e:JSON.stringify(e)}function R0(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Hy;var da=F(()=>{Hy=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function By(e){let t=e.$map;return V(t)?t:void 0}function ld(e){return V(e)&&!Array.isArray(e)&&"operator"in e}function pa(e){return V(e)&&!Array.isArray(e)&&"$ref"in e}function lF(e,t,n){let r=Dv[e];if(r===void 0||r<0||t[r]!=null)return t;let s=on(n.$page,"locale");if(!O(s)||s==="")return t;let o=[...t];return o[r]=s,o}function I0(){return globalThis.window??globalThis}function L0(e){return e.startsWith("window#/")&&iF.has(e.slice(8))}function F0(e){return Error(`$expression: unknown operator "${e}"`)}function Cr(e){return N0.has(e)}function id(e){if(Array.isArray(e))return e.some((t)=>id(t));if(e===void 0||!ld(e))return!1;return Cr(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>id(t))||Object.values(e.cases??{}).some((t)=>id(t))}function gi(e){return An(e)&&!id(e.$expression)}function Uy(e,t){if(Array.isArray(e)){for(let n of e)Uy(n,t);return}if(e===void 0||!V(e))return;if(pa(e)){if(!cF.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(vn(n)[0]??"")}return}if(ld(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Uy(r,t)}}function ex(e){let t=new Set;return Uy(e.$expression,t),[...t]}function tx(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&gi(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(ex(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function rx(e){if(Wy>=cd)throw Error(nx);Wy+=1;try{return e()}finally{Wy-=1}}function $c(e,t){let n={};for(let[r,s]of e.entries()){let o=O(s)?s:s?.name??"";if(!o)continue;n[o]=t[r]===void 0&&s!==null&&!O(s)&&"default"in s?s.default:t[r]}return n}function sx(e,t,n){return(...r)=>rx(()=>Dn(e,n,null,{args:$c(t,r)}))}function ox(e){return An(e)||cn(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function zy(e,t){if(Array.isArray(e)){for(let n of e)zy(n,t);return}if(!V(e))return;for(let[n,r]of Object.entries(e))if(n==="$ref"&&O(r)&&r.startsWith(T0)){let[s]=vn(r.slice(T0.length));if(s!==void 0)t.add(s)}else zy(r,t)}function ma(e){let t=Object.entries(e).filter(([,m])=>ox(m));if(t.length===0)return[];let n=t.map(([m])=>m),r=new Map;for(let[m,g]of t){let y=new Set,h;if(An(g))h=g.$expression;else if(cn(g))h=g.body;zy(h,y),r.set(m,n.filter((x)=>y.has(x)))}let s=new Map,o=new Map,i=new Set,a=[],l=[],c=0,u=(m)=>{s.set(m,c),o.set(m,c),c+=1,a.push(m),i.add(m);for(let g of r.get(m)??[])if(!s.has(g))u(g),o.set(m,Math.min(o.get(m)??0,o.get(g)??0));else if(i.has(g))o.set(m,Math.min(o.get(m)??0,s.get(g)??0));if(o.get(m)===s.get(m)){let g=a.splice(a.lastIndexOf(m));for(let y of g)i.delete(y);l.push(g)}};for(let m of n)if(!s.has(m))u(m);let d=[];for(let m of l){let g=new Set(m),y=n.find((E)=>g.has(E)),h=(r.get(y)??[]).includes(y);if(m.length===1&&!h)continue;let x=new Map,P=[y],S;for(let E of P){for(let w of r.get(E)??[]){if(S!==void 0||!g.has(w))continue;if(w===y)S=E;else if(!x.has(w))x.set(w,E),P.push(w)}if(S!==void 0)break}let v=[y];for(let E=S;E!==void 0&&E!==y;E=x.get(E))v.splice(1,0,E);v.push(y),d.push(v)}let p=new Map(n.map((m,g)=>[m,g]));return d.toSorted((m,g)=>(p.get(m[0]??"")??0)-(p.get(g[0]??"")??0))}function mt(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>uF)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function lt(e,t,n,r,s){if(e===null||e===void 0)return e;if(ld(e))return Dn(e,t,n,r,s);if(pa(e)){let o=ad(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return V0(e,t,n,r,s);return s?.report(s.path??[],e),e}function V0(e,t,n,r,s){return e.map((o,i)=>lt(o,t,n,r,mt(s,i)))}function fF(e,t,n,r){let s=dn(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return ad(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?ad(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function ad(e,t,n,r){let s=dn(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?on(i,o.slice(1).join("/")):i}if(s.startsWith("event#/")){let o=s.slice(7);return on(n,o)}if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=By(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?on(a,o.slice(2).join("/")):a}if(s.startsWith("#/state/"))return on(t,s.slice(8));if(s.startsWith("parent#/"))return on(t,s.slice(8));if(s.startsWith("window#/"))return on(I0(),s.slice(8));if(s.startsWith("document#/"))return on(globalThis.document,s.slice(10));return on(t,s)??null}function dF(e,t,n,r){let s=dn(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,a,l=By(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?on(a,c.join("/")):a;return{key:u,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:By(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let a=vn(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 Dn(e,t,n,r,s){let o=pF(e,t,n,r,s);return s?.report(s.path??[],o),o}function q0(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 H0(e){return Xy.has(e)}function ud(e,t,n,r,s){let{obj:o,key:i}=dF(e.target.$ref,n,r,s);o[i]=e.operator==="="?t:q0(e.operator.slice(0,-1),o[i],t)}function pF(e,t,n,r,s){let{operator:o,target:i,value:a,initial:l}=e;if(!D0.has(o))throw F0(o);if(Ky.has(o)&&!("value"in e)){let c=lt(i,t,n,r,mt(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=pa(i)?i.$ref:void 0;if(!O(c))throw TypeError("$expression: call target must be a $ref pointer");let u=Array.isArray(a)?a.map((p,m)=>lt(p,t,n,r,mt(s,["value",m]))):[];if(c.startsWith("window#/")){if(!L0(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let p=c.slice(8),m=aF.get(p);if(m)return m(...lF(p,u,t));let g=I0(),y=on(g,p),h=p.lastIndexOf("/"),x=h===-1?g:on(g,p.slice(0,h));return y.apply(x,u)}let d=ad(c,t,n,r);if($t(d))return d.apply(fF(c,t,n,r),u);if(V(d)&&"$expression"in d){let p=d;return rx(()=>Dn(p.$expression,t,n,{args:$c(p.parameters??[],u)}))}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Zy.has(o)){if(o==="?:"){let m=lt(i,t,n,r,mt(s,"target"));if(s){let g=lt(a,t,n,r,mt(s,"value")),y=lt(l,t,n,r,mt(s,"initial"));return m?g:y}return m?lt(a,t,n,r):lt(l,t,n,r)}let c=lt(i,t,n,r,mt(s,"target")),u=String(c),d=e.cases??{},p=Object.hasOwn(d,u);if(s){let m;for(let[y,h]of Object.entries(d)){let x=lt(h,t,n,r,mt(s,["cases",y]));if(y===u)m=x}let g=lt(e.default,t,n,r,mt(s,"default"));return p?m:g}return p?lt(d[u],t,n,r):lt(e.default,t,n,r)}if(Gy.has(o)){let c=lt(i,t,n,r,mt(s,"target")),u=lt(a,t,n,r,mt(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 q0(o,c,u)}}if(Xy.has(o)){let c=lt(a,t,n,r,mt(s,"value"));ud(e,c,t,n,r);return}if(M0.has(o)){let c=lt(i,t,n,r,mt(s,"target"));switch(o){case"push":return c.push(lt(a,t,n,r,mt(s,"value")));case"unshift":return c.unshift(lt(a,t,n,r,mt(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=lt(a,t,n,r,mt(s,"value"));return c.splice(...u)}default:break}}if(Qy.has(o)){let c=lt(i,t,n,r,mt(s,"target")),u=a===void 0?[]:Array.isArray(a)?V0(a,t,n,r,mt(s,"value")):[lt(a,t,n,r,mt(s,"value"))],d=on(c,o);if(!$t(d))return;return d.apply(c,u)}if(Yy.has(o)){let c=lt(i,t,n,r,mt(s,"target")),u=a;if(o==="reduce"){let d=lt(l,t,n,r,mt(s,"initial"));for(let[p,m]of c.entries())d=Dn(u,t,n,{...r,acc:d,index:p,item:m},p===0?mt(s,"value"):void 0);return d}if(o==="map")return c.map((d,p)=>Dn(u,t,n,{...r,index:p,item:d},p===0?mt(s,"value"):void 0));if(o==="filter")return c.filter((d,p)=>Dn(u,t,n,{...r,index:p,item:d},p===0?mt(s,"value"):void 0))}return}function yt(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(ld(e))return pn(e,t);if(pa(e))return ix(e.$ref,t);if(Array.isArray(e))return e.map((n)=>yt(n,t)).join(", ");return JSON.stringify(e)}function ix(e,t){let n=dn(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 Ae("_args",n.slice(6));if(n.startsWith("event#/"))return Ae(s,n.slice(7));if(n.startsWith("$map/")){let o=n.split("/"),[,i]=o;if(i==="item")return o.length>2?Ae("_item",o.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(n.startsWith("#/state/"))return Ae(r,n.slice(8));if(n.startsWith("parent#/"))return Ae(r,n.slice(8));if(n.startsWith("window#/"))return Ae("window",n.slice(8));if(n.startsWith("document#/"))return Ae("document",n.slice(10));return Ae(r,n)}function J0(e,t){if(pa(e))return ix(e.$ref,t);return yt(e,t)}function mF(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Wr)})`,o=JSON.stringify(Ig);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 pn(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(!D0.has(n))throw F0(n);if(Ky.has(n)&&!("value"in e)){let i=yt(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(pa(r)?r.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>yt(l,t)):[];if(i.startsWith("window#/")){if(!L0(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let l=mF(i.slice(8),a,t);if(l)return l;return`window.${i.slice(8).replaceAll("/",".")}(${a.join(", ")})`}return`${ix(i,t)}(${a.join(", ")})`}if(Zy.has(n)){if(n==="?:"){let c=yt(r,t),u=yt(s,t),d=yt(o,t);return`(${c} ? ${u} : ${d})`}let i=yt(r,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${yt(u,t)} : `).join(""),l="default"in e?yt(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${i}))`}if(Gy.has(n)){let i=yt(r,t),a=yt(s,t);return`(${i} ${n} ${a})`}if(Xy.has(n)){let i=J0(r,t),a=yt(s,t);return`${i} ${n} ${a}`}if(M0.has(n)){let i=J0(r,t);switch(n){case"push":return`${i}.push(${yt(s,t)})`;case"unshift":return`${i}.unshift(${yt(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>yt(l,t)).join(", "):yt(s,t);return`${i}.splice(${a})`}default:break}}if(Qy.has(n)){let i=yt(r,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>yt(l,t)).join(", "):yt(s,t);return`(${i})?.${n}?.(${a})`}if(Yy.has(n)){let i=yt(r,t),a=pn(s,t);if(n==="reduce"){let l=yt(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})`}throw Error(`$expression: "${n}" cannot take the operands given (spec §19.3)`)}function ha(e,t,n,r){return lt(e,t,n,r)}function Xr(e,t={}){return yt(e,t)}var N0,Ky,Gy,Xy,M0,Yy,Zy,Qy,D0,iF,aF,cF,cd=64,nx,Wy=0,T0="#/state/",uF=64;var yi=F(()=>{Fg();ae();da();N0=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Ky=new Set(["!","-"]),Gy=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Xy=new Set(["=","+=","-=","*=","/="]),M0=new Set(["push","pop","shift","unshift","splice"]),Yy=new Set(["reduce","map","filter"]),Zy=new Set(["?:","switch"]),Qy=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"]),D0=new Set([...N0,...Ky,...Gy,...Yy,...Zy,...Qy,"call"]),iF=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",...Lg]),aF=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??Wr,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??Wr,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??Wr,{timeZone:Ig,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??Wr,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??Wr,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??Wr,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??Wr,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??Wr,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);cF=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/;nx=`$expression: call depth exceeded (${cd})`});function dd(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 W0(e){return(V(e)||$t(e))&&"then"in e&&$t(e.then)}function hF(e){return V(e)&&!Array.isArray(e)&&"operator"in e&&e.operator==="call"}function ax(e){if(e.operator==="call")return{kind:"call"};let{value:t}=e;if(H0(e.operator)&&hF(t))return{call:t,kind:"capture"};return null}function Sc(e){return e.some((t)=>{let n=dd(t);switch(n.kind){case"expression":return ax(n.node)!==null;case"if":return Sc(n.node.then??[])||Sc(n.node.else??[]);case"switch":return Object.values(n.node.cases??{}).some((r)=>Sc(r))||Sc(n.node.default??[]);default:return!1}})}function wc(e){return e.some((t)=>{let n=dd(t);switch(n.kind){case"dispatch":return!0;case"if":return wc(n.node.then??[])||wc(n.node.else??[]);case"switch":return Object.values(n.node.cases??{}).some((r)=>wc(r))||wc(n.node.default??[]);default:return!1}})}function gF(e,t,n,r,s,o){return Promise.resolve(e).then(()=>fd(t,n,r,s,o+1))}function yF(e,t,n,r){let{iterCtx:s,opts:o}=r,i=dd(e);switch(i.kind){case"expression":{let{node:a}=i,l=ax(a);if(l?.kind==="capture"){let u=Dn(l.call,t,n,s);if(!W0(u)){ud(a,u,t,n,s);return}return Promise.resolve(u).then((d)=>{ud(a,d,t,n,s)})}let c=Dn(a,t,n,s);return l&&W0(c)?Promise.resolve(c).then(()=>{}):void 0}case"if":{let a=i.node,l=ha(a.if,t,n,s)?a.then:a.else;return Array.isArray(l)?fd(l,t,n,r):void 0}case"switch":{let a=i.node,l=String(ha(a.$switch,t,n,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;return Array.isArray(u)?fd(u,t,n,r):void 0}case"dispatch":{let a=i.node,l=$t(o.target)?o.target():o.target,c=r.eventTarget??l;if(!c)return;let u={};if("detail"in a)u.detail=ha(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));return}case"stopPropagation":{if($t(n?.stopPropagation))n.stopPropagation();return}default:{if($t(n?.preventDefault))n.preventDefault();return}}}function fd(e,t,n,r,s=0){for(let o=s;o<e.length;o++){let i=yF(e[o],t,n,r);if(i!==void 0)return gF(i,e,t,n,r,o)}return}async function vc(e,t,n,r={}){let s={opts:r,iterCtx:r.args?{args:r.args}:void 0,eventTarget:n?.currentTarget??null};await fd(e,t,n,s)}function Ms(e,t={}){if(Sc(e)&&wc(e)){let n=t.indent??"",r=t.eventParam??"event",s=t.dispatchTarget??`(${r} && ${r}.currentTarget)`;return`${n}const $jxt = ${s};
|
|
199
|
+
${ga(e,{...t,dispatchTarget:"$jxt"})}`}return ga(e,t)}function ga(e,t){let n=t.indent??"",r=[];for(let s of e){let o=dd(s);switch(o.kind){case"expression":{let{node:i}=o,a=ax(i);if(a?.kind==="call")r.push(`${n}{ const $jxr = ${pn(i,t)}; if (typeof $jxr?.then === "function") await $jxr; }`);else if(a?.kind==="capture")r.push(`${n}{ let $jxr = ${pn(a.call,t)}; if (typeof $jxr?.then === "function") $jxr = await $jxr; ${Xr(i.target,t)} ${i.operator} $jxr; }`);else r.push(`${n}${pn(i,t)};`);break}case"if":{let i=o.node,a=Xr(i.if,t),l={...t,indent:`${n} `};if(r.push(`${n}if (${a}) {`,ga(i.then??[],l)),i.else)r.push(`${n}} else {`,ga(i.else,l));r.push(`${n}}`);break}case"switch":{let i=o.node,a=Xr(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)}: {`,ga(u,l),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,ga(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: ${Xr(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(`
|
|
200
|
+
`)}var pd=F(()=>{ae();yi()});var lx=F(()=>{ae()});function ya(e){if(e===xF)return"client";if(e===bF)return"server";return null}function $F(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function U0(e,t){return`${fx}${$F(e)}#${t}`}function md(e){return e.startsWith(fx)}function xa(e){if(!md(e))return null;let t=e.slice(fx.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 cx(e,t){if(Array.isArray(e)){let r=e.map((s)=>cx(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!M(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&O(s)){let i=ya(s);o=i===null?s:U0(t,i)}else if(r!=="$script")o=cx(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function Ec(e,t){return cx(e,t)}function vF(e){return SF.test(e)&&!wF.test(e)}function B0(e){return ya(e)==="client"||xa(e)?.side==="client"}function ux(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())ux(s,[...t,r],n);return n}if(!M(e))return n;if(O(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")ux(s,[...t,r],n);return n}function EF(e){let t=e.at(-1);return O(t)?`"${t}"`:"this entry"}function z0(e){let t=ux(e,[],[]),n=t.some((s)=>!s.lazy&&B0(s.src)),r=[];for(let s of t){let o=EF(s.path);if(!s.lazy&&vF(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&&B0(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 fx="jx-script:",xF="#client",bF="#server",SF,wF;var ba=F(()=>{ae();SF=/^\.{1,2}\//u,wF=/\.json$/iu});var dx="__Host-",px="__Secure-";function $a(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=HS(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function X0(){return[...G0].toSorted()}function Yr(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||G0.has(n))return String(t);return t?"":null}function Y0(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 Z0(e,t,n,r){let s=Mi(t);if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(tt(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?Ve(o)?0:"":i;return}e[s]=Ve(o)?Number(n):n}function mx(e,t){let n=K0.get(e);if(n)return n;let r=new Set,s=t??sn(e);for(let[o,i]of Object.entries(e.state??{}))if(O(i)?ce(i):ln(i)?!An(i)&&!Cr(i.$expression.operator):s.get(o)==="computed")r.add(o);return K0.set(e,r),r}function Q0(e){let t=e.state??{},n=mx(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function hx(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(O(r)&&ce(r)){t.set(n,void 0);continue}if(V(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(AF.some((s)=>(s in r))){t.set(n,void 0);continue}if(ar(r))continue}t.set(n,r)}return t}var Rr,G0,Wte,K0,AF,gx=32,hd,gd="jx-slot",Pc="data-jx-slots",yx="jx.slot.group",Bte;var Sa=F(()=>{bc();yi();da();ae();Rs();Tn();St();pd();lx();ba();lx();bc();Rr=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"]),G0=new Set(["contenteditable","draggable","spellcheck"]);Wte=Object.freeze({emptyRow:!0});K0=new WeakMap;AF=["$expression","$prototype","$ref","$src"],hd=/^[\t\n\f\r ]+$/u,Bte=(()=>{let e=Symbol.for(yx),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function TF(){if(!jc){jc=new Map;for(let[e,t,n]of RF){let r=jc.get(e);if(!r)r=new Map,jc.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return jc}function xd(e,t){return eP??=new Map(CF),eP.get(t)??TF().get(t)?.get(e.toLowerCase())??null}function xx(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return JF.has(e.toLowerCase());return t==="text"&&NF.has(e.toLowerCase())}var T=(e,t={})=>({attribute:e,kind:"text",...t}),Oe=(e,t={})=>({attribute:e,kind:"boolean",...t}),yd,CF,RF,eP,jc,JF,NF;var bx=F(()=>{yd={live:!0},CF=[["accessKey",T("accesskey")],["ariaAtomic",T("aria-atomic")],["ariaAutoComplete",T("aria-autocomplete")],["ariaBrailleLabel",T("aria-braillelabel")],["ariaBrailleRoleDescription",T("aria-brailleroledescription")],["ariaBusy",T("aria-busy")],["ariaChecked",T("aria-checked")],["ariaColCount",T("aria-colcount")],["ariaColIndex",T("aria-colindex")],["ariaColIndexText",T("aria-colindextext")],["ariaColSpan",T("aria-colspan")],["ariaCurrent",T("aria-current")],["ariaDescription",T("aria-description")],["ariaDisabled",T("aria-disabled")],["ariaExpanded",T("aria-expanded")],["ariaHasPopup",T("aria-haspopup")],["ariaHidden",T("aria-hidden")],["ariaInvalid",T("aria-invalid")],["ariaKeyShortcuts",T("aria-keyshortcuts")],["ariaLabel",T("aria-label")],["ariaLevel",T("aria-level")],["ariaLive",T("aria-live")],["ariaModal",T("aria-modal")],["ariaMultiLine",T("aria-multiline")],["ariaMultiSelectable",T("aria-multiselectable")],["ariaOrientation",T("aria-orientation")],["ariaPlaceholder",T("aria-placeholder")],["ariaPosInSet",T("aria-posinset")],["ariaPressed",T("aria-pressed")],["ariaReadOnly",T("aria-readonly")],["ariaRelevant",T("aria-relevant")],["ariaRequired",T("aria-required")],["ariaRoleDescription",T("aria-roledescription")],["ariaRowCount",T("aria-rowcount")],["ariaRowIndex",T("aria-rowindex")],["ariaRowIndexText",T("aria-rowindextext")],["ariaRowSpan",T("aria-rowspan")],["ariaSelected",T("aria-selected")],["ariaSetSize",T("aria-setsize")],["ariaSort",T("aria-sort")],["ariaValueMax",T("aria-valuemax")],["ariaValueMin",T("aria-valuemin")],["ariaValueNow",T("aria-valuenow")],["ariaValueText",T("aria-valuetext")],["autocapitalize",T("autocapitalize")],["autocorrect",Oe("autocorrect",{keywords:["on","off"]})],["autofocus",Oe("autofocus")],["className",T("class")],["contentEditable",T("contenteditable")],["dir",T("dir")],["draggable",Oe("draggable")],["enterKeyHint",T("enterkeyhint")],["headingOffset",T("headingoffset")],["headingReset",Oe("headingreset")],["hidden",{attribute:"hidden",kind:"hidden"}],["id",T("id")],["inert",Oe("inert")],["inputMode",T("inputmode")],["lang",T("lang")],["popover",T("popover")],["role",T("role")],["slot",T("slot")],["spellcheck",Oe("spellcheck")],["tabIndex",T("tabindex")],["title",T("title")],["translate",Oe("translate",{keywords:["yes","no"]})],["writingSuggestions",T("writingsuggestions")]],RF=[["aLink","body",T("alink")],["abbr","td th",T("abbr")],["accept","input",T("accept")],["acceptCharset","form",T("accept-charset")],["action","form",T("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",T("align")],["allow","iframe",T("allow")],["allowFullscreen","iframe",Oe("allowfullscreen")],["alpha","input",Oe("alpha")],["alt","area img input",T("alt")],["archive","object",T("archive")],["as","link",T("as")],["async","script",Oe("async")],["autocomplete","form input select textarea",T("autocomplete")],["autoplay","audio video",Oe("autoplay")],["axis","td th",T("axis")],["background","body",T("background")],["behavior","marquee",T("behavior")],["bgColor","body marquee table td th tr",T("bgcolor")],["border","img object table",T("border")],["cellPadding","table",T("cellpadding")],["cellSpacing","table",T("cellspacing")],["ch","col colgroup tbody td tfoot th thead tr",T("char")],["chOff","col colgroup tbody td tfoot th thead tr",T("charoff")],["charset","a link script",T("charset")],["checked","input",Oe("checked",yd)],["cite","blockquote del ins q",T("cite")],["clear","br",T("clear")],["closedBy","dialog",T("closedby")],["code","object",T("code")],["codeBase","object",T("codebase")],["codeType","object",T("codetype")],["colSpan","td th",T("colspan")],["color","font hr",T("color")],["colorSpace","input",T("colorspace")],["cols","frameset textarea",T("cols")],["command","button",T("command")],["compact","dir dl menu ol ul",Oe("compact")],["content","meta",T("content")],["controls","audio img video",Oe("controls")],["coords","a area",T("coords")],["crossOrigin","audio img link script video",T("crossorigin")],["data","object",T("data")],["dateTime","del ins time",T("datetime")],["declare","object",Oe("declare")],["decoding","img",T("decoding")],["default","track",Oe("default")],["defaultChecked","input",Oe("checked")],["defaultMuted","audio video",Oe("muted")],["defaultSelected","option",Oe("selected")],["defaultValue","input",T("value")],["defer","script",Oe("defer")],["dirName","input textarea",T("dirname")],["direction","marquee",T("direction")],["disabled","button fieldset input link optgroup option select textarea",Oe("disabled")],["download","a area",T("download")],["encoding","form",T("enctype")],["enctype","form",T("enctype")],["event","script",T("event")],["face","font",T("face")],["fetchPriority","img link script",T("fetchpriority")],["formAction","button input",T("formaction")],["formEnctype","button input",T("formenctype")],["formMethod","button input",T("formmethod")],["formNoValidate","button input",Oe("formnovalidate")],["formTarget","button input",T("formtarget")],["frame","table",T("frame")],["frameBorder","frame iframe",T("frameborder")],["headers","td th",T("headers")],["height","canvas embed iframe img input marquee object source td th video",T("height")],["high","meter",T("high")],["href","a area base link",T("href")],["hreflang","a area link",T("hreflang")],["hspace","embed img input marquee object",T("hspace")],["htmlFor","label script template",T("for")],["httpEquiv","meta",T("http-equiv")],["imageSizes","link",T("imagesizes")],["imageSrcset","link",T("imagesrcset")],["integrity","link script",T("integrity")],["isMap","img",Oe("ismap")],["kind","track",T("kind")],["label","optgroup option track",T("label")],["link","body",T("link")],["loading","audio iframe img video",T("loading")],["longDesc","frame iframe img",T("longdesc")],["loop","audio video",Oe("loop")],["low","meter",T("low")],["lowsrc","img",T("lowsrc")],["marginHeight","frame iframe",T("marginheight")],["marginWidth","frame iframe",T("marginwidth")],["max","input meter progress",T("max")],["maxLength","input textarea",T("maxlength")],["media","link meta source style",T("media")],["method","form",T("method")],["min","input meter",T("min")],["minLength","input textarea",T("minlength")],["multiple","input select",Oe("multiple")],["muted","audio video",Oe("muted",yd)],["name","a button details embed fieldset form frame iframe img input map meta object output param select slot textarea",T("name")],["noHref","area",Oe("nohref")],["noModule","script",Oe("nomodule")],["noResize","frame",Oe("noresize")],["noShade","hr",Oe("noshade")],["noValidate","form",Oe("novalidate")],["noWrap","td th",Oe("nowrap")],["open","details dialog",Oe("open")],["optimum","meter",T("optimum")],["pattern","input",T("pattern")],["ping","a area",T("ping")],["placeholder","input textarea",T("placeholder")],["playsInline","video",Oe("playsinline")],["popoverTargetAction","button input",T("popovertargetaction")],["poster","video",T("poster")],["preload","audio video",T("preload")],["readOnly","input textarea",Oe("readonly")],["referrerPolicy","a area iframe img link script",T("referrerpolicy")],["rel","a area form link",T("rel")],["required","input select textarea",Oe("required")],["rev","a link",T("rev")],["reversed","ol",Oe("reversed")],["rowSpan","td th",T("rowspan")],["rows","frameset textarea",T("rows")],["rules","table",T("rules")],["scheme","meta",T("scheme")],["scope","td th",T("scope")],["scrollAmount","marquee",T("scrollamount")],["scrollDelay","marquee",T("scrolldelay")],["scrolling","frame iframe",T("scrolling")],["selected","option",Oe("selected",yd)],["shadowRootClonable","template",Oe("shadowrootclonable")],["shadowRootCustomElementRegistry","template",T("shadowrootcustomelementregistry")],["shadowRootDelegatesFocus","template",Oe("shadowrootdelegatesfocus")],["shadowRootMode","template",T("shadowrootmode")],["shadowRootSerializable","template",Oe("shadowrootserializable")],["shadowRootSlotAssignment","template",T("shadowrootslotassignment")],["shape","a area",T("shape")],["size","font hr input select",T("size")],["sizes","img source",T("sizes")],["span","col colgroup",T("span")],["src","audio embed frame iframe img input source track video",T("src")],["srcdoc","iframe",T("srcdoc")],["srclang","track",T("srclang")],["srcset","img source",T("srcset")],["standby","object",T("standby")],["start","ol",T("start")],["step","input",T("step")],["summary","table",T("summary")],["target","a area base form link",T("target")],["text","body",T("text")],["trueSpeed","marquee",Oe("truespeed")],["type","a area button embed input li link object ol param script source style ul",T("type")],["useMap","img input object",T("usemap")],["vAlign","col colgroup tbody td tfoot th thead tr",T("valign")],["vLink","body",T("vlink")],["value","button data li meter option param progress",T("value")],["value","input",T("value",yd)],["valueType","param",T("valuetype")],["version","html",T("version")],["vspace","embed img input marquee object",T("vspace")],["width","canvas col colgroup embed hr iframe img input listing marquee object pre source table td th video xmp",T("width")],["wrap","textarea",T("wrap")]];JF=new Set(["output","textarea"]),NF=new Set(["a","option","title"])});function Zr(e){return M(e.attributes)?e.attributes:{}}function mn(e,t){let n=Zr(e)[t];return O(n)?n:null}function Nt(e){return O(e.tagName)?e.tagName.toLowerCase():""}function Pn(e,t="the popover"){let n=O(e.id)?e.id:mn(e,"id");if(n)return`#${n}`;let r=Nt(e);return r===""?t:`the <${r}>`}function IF(e){let t=Zr(e).popover;return O(t)?t:null}function nP(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&O(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if($x(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&LF.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function $x(e){return"popover"in Zr(e)||"popover"in e}function Oc(e,t){return $x(e)||(t?.popoverTags?.has(Nt(e))??!1)}function co(e){if(O(e.id)&&e.id!=="")return e.id;let t=mn(e,"id");return t===""?null:t}function*hr(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=Oc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[l,c]of o.entries())if(V(c))yield*hr(c,[...t,"children",l],s,r)}else if(M(o)&&It(o.map))yield*hr(o.map,[...t,"children","map"],s,r);let i=It(e.map)?e.map:null;if(i)yield*hr(i,[...t,"map"],s,r);let a=M(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(V(c))yield*hr(c,[...t,"cases",l],s,r)}function Sx(e,t){let n=[];for(let{node:r}of hr(e,[],null,t)){if(!Oc(r,t))continue;let s=co(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function bd(e){return e.startsWith("@")}function rP(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function En(e,t){let n=e?.[t];if(n===void 0||qo(n)||Array.isArray(n))return null;return String(n)}function sP(e){for(let[t,n]of Object.entries(e??{})){if(!qo(n))continue;if(rP(t)&&t.includes(":popover-open")&&En(n,"display")!==null)return!0;if(bd(t)&&sP(n))return!0}return!1}function oP(e){for(let[t,n]of Object.entries(e??{})){if(!qo(n))continue;if(rP(t)&&t.includes(":popover-open"))return!0;if(bd(t)&&oP(n))return!0}return!1}function VF(e){return FF.some((t)=>En(e,t)!==null)}function qF(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(bd(n)&&qo(r)&&En(r,"display")!==null)t.push(n);return t}function iP(e){if(!e)return[];let t=[],n=En(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(bd(r)&&qo(s))t.push(...iP(s));return t}function HF(e){if(!e)return!1;if(En(e,"positionAnchor")!==null||En(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(En(e,t)??"").includes("anchor("))}function WF(e){if(!e)return!1;if(En(e,"positionArea")!==null||En(e,"position-area")!==null||En(e,"positionTryFallbacks")!==null||En(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function aP(e,t){let n=[...hr(e,[],null,t)],r=Sx(e,t),s=n.some(({node:a})=>Oc(a,t)),o=new Set;for(let{node:a}of n)if(tP.has(Nt(a))){let l=mn(a,"popovertarget");if(l!==null)o.add(l)}let i=[];for(let{enclosing:a,node:l,path:c}of n)if(i.push(...BF(l,c,a,r,s,t)),$x(l))i.push(...UF(l,c,o));return i}function BF(e,t,n,r,s,o){let i=[],a=Nt(e),l=mn(e,"popovertarget"),c=tP.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. ${ct}`,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. ${ct}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&co(n)!==null&&co(n)!==l)i.push({detail:`This control is inside ${Pn(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. ${ct}`,message:`A control inside ${Pn(n)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&l===null){let u=mn(e,"href")??(O(e.href)?e.href:null),d=mn(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. ${ct}`,message:`A link inside ${Pn(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function UF(e,t,n){let r=[],{style:s}=e,o=Pn(e),i=IF(e);if(i!==null&&i!==""&&!DF.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". ${ct}`,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(tt(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". ${ct}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=En(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. ${ct}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of qF(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. ${ct}`,fix:"display",message:`${o} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(En(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. ${ct}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!oP(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. ${ct}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!sP(s)&&a===null&&VF(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\`. ${ct}`,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 iP(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. ${ct}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(HF(s)&&!WF(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. ${ct}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=co(e);if(l!==null&&!n.has(l))r.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${ct}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var DF,tP,LF,FF,ct="See docs/framework/concepts/overlays.";var kc=F(()=>{ae();DF=["auto","manual","hint"],tP=new Set(["button","input"]);LF=["popovertarget","popovertargetaction","command","commandfor"];FF=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function*Ds(e,t,n,r){if(Array.isArray(e)){for(let[s,o]of e.entries())yield*Ds(o,[...t,s],n,r);return}if(!M(e))return;if("$ref"in e){yield{handlerBoundary:!1,kind:"ref",path:t,position:n.position,value:e};return}if(cP(e))yield*xi(e,t,n,r)}function*xi(e,t,n,r){if(yield{handlerBoundary:r,kind:"node",path:t,position:n.position,value:e},yield*Ds(e.target,[...t,"target"],n,!1),yield*Ds(e.value,[...t,"value"],n,!1),yield*Ds(e.initial,[...t,"initial"],n,!1),M(e.cases))for(let[s,o]of Object.entries(e.cases))yield*Ds(o,[...t,"cases",s],n,!1);yield*Ds(e.default,[...t,"default"],n,!1)}function*_c(e,t,n){if(!Array.isArray(e))return;for(let[r,s]of e.entries()){if(!M(s))continue;let o=[...t,r];if(cP(s)){yield*xi(s,o,n,!0);continue}if(yield*Ds(s.if,[...o,"if"],n,!1),yield*Ds(s.$switch,[...o,"$switch"],n,!1),yield*Ds(s.detail,[...o,"detail"],n,!1),yield*_c(s.then,[...o,"then"],n),yield*_c(s.else,[...o,"else"],n),M(s.cases))for(let[i,a]of Object.entries(s.cases))yield*_c(a,[...o,"cases",i],n);yield*_c(s.default,[...o,"default"],n)}}function*lP(e,t,n){let r=n!==null&&si.has(n)?"lifecycle":"handler";if(ln(e)){let s=e.$expression;if(!M(s))return;let o=[...t,"$expression"];if(n===null)yield*xi(s,o,{position:"handler"},!0);else if(An(e))yield*xi(s,o,{position:"formula"},!1);else if(O(s.operator)&&wx.has(s.operator))yield*xi(s,o,{position:r},!0);else yield*xi(s,o,{position:"computed"},!1)}else if(cn(e)){let s=n!==null&&Array.isArray(e.parameters)&&e.parameters.length>0;yield*_c(e.body,[...t,"body"],{position:s?"callable":r})}}function*GF(e){if(!M(e))return;for(let{node:t,path:n}of hr(e)){if(M(t.state))for(let[s,o]of Object.entries(t.state))yield*lP(o,[...n,"state",s],s);for(let[s,o]of Object.entries(t))if(s.startsWith("on"))yield*lP(o,[...n,s],null);let{tagName:r}=t;if(M(r)&&M(r.$expression))yield*xi(r.$expression,[...n,"tagName","$expression"],{position:"tag"},!1)}}function $d(e){let t=[],n=(r,s,o)=>{t.push({message:o,path:s,pointer:YF(s),rule:r})};for(let r of GF(e)){if(r.kind==="ref"){let{$ref:o}=r.value;if(O(o)&&o.startsWith("event#/")&&r.position!=="handler")n("event-outside-handler",r.path,`${o} reads the handler's event, but ${ZF[r.position]} runs with no event (spec §19.5)`);continue}let{operator:s}=r.value;if(!O(s))continue;if(!KF.has(s))n("unknown-operator",r.path,`unknown operator "${s}": the operator set is closed (spec §19.4), so this logic belongs in a Function body`);else if(wx.has(s)&&!r.handlerBoundary){let o="an operand";if(r.position==="tag")o="part of a tagName expression";else if(r.position==="formula"&&r.path.at(-1)==="$expression")o="the root of a named formula";n("mutating-outside-handler",r.path,`"${s}" writes to its target, so it may only be a handler's root or a statement (spec §19.3), not ${o}`)}}return t}var wx,zF,KF,cP=(e)=>O(e.operator),XF=(e)=>String(e).replaceAll("~","~0").replaceAll("/","~1"),YF=(e)=>e.map((t)=>`/${XF(t)}`).join(""),ZF;var vx=F(()=>{Kl();Rs();ae();kc();wx=new Set([...Qo.enum,...ei.enum,...ti.enum,ni.const]),zF=new Set([...Fl.enum,...Vl.enum,ql.const,Hl.const,Wl.const,...Bl.enum,Ul.const,...zl.enum]),KF=new Set([...wx,...zF]);ZF={callable:"a structured body with parameters",computed:"a computed entry",formula:"a named formula",lifecycle:"a lifecycle hook",tag:"a tagName expression"}});function uP(e,t,n){let r=e.$description;if(O(r))(Object.keys(t).length>0?t:n).$description=r}function fP(e,t,n,r,s=QF,o={}){let i=[],a=(p,m)=>{let g={mediaQueries:t,scope:m,transposeValue:n};if(r)g.resolveValue=(y,h)=>r(y,h,m);for(let y of fa(p,g))i.push(o.comments===!0?xc(y):y.text)},l={},c={},u=[],d=[];for(let[p,m]of Object.entries(e)){if(V(m)&&!Array.isArray(m)){if(p.startsWith("@"))u.push([p,m]);else if(!p.startsWith("--"))d.push([p,m]);continue}if(yc(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")l[p]=m;else c[p]=m}uP(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(hc(p)||gc(p)){a({[p]:m},null);continue}let g={},y={},h=[];for(let[x,P]of Object.entries(m)){if(V(P)&&!Array.isArray(P)){if(!x.startsWith("@"))h.push([x,P]);continue}if(x.startsWith("$"))continue;if(x.startsWith("--"))g[x]=P;else y[x]=P}uP(m,g,y),a({[p]:g},s.root),a({[p]:y},s.body);for(let[x,P]of h)a({[p]:P},x)}if(Object.values(t).some((p)=>Ar(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${_r}="light"]) { color-scheme: light }`,`${s.root}:where([${_r}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
201
|
+
`)}var QF;var dP=F(()=>{bc();ae();QF={body:"body",root:":root"}});function mP(e){return e2.has(e.toLowerCase())?"block":"inline"}function hP(e){let t=e;for(let r=pP.exec(t);r;r=pP.exec(t))t=t.slice(r[0].length);if(t==="")return null;let n=t2.exec(t);return n?mP(n[1]):"text"}function gP(e){let t=e;while(t.endsWith("-->")){let r=t.lastIndexOf("<!--");if(r===-1)break;t=t.slice(0,r)}if(t==="")return null;let n=n2.exec(t)??r2.exec(t);return n?mP(n[1]):"text"}function s2(e,t){let n=gP(e),r=hP(t);if(n===null||r===null)return!1;return n!=="text"&&r!=="text"&&(n==="block"||r==="block")}function an(e,t={}){let{lead:n="",preformatted:r=!1,separator:s=`
|
|
202
|
+
`}=t;if(r)return e.join("");let o=e.filter((a)=>a!==""&&a!==n),i="";for(let[a,l]of o.entries()){if(a===0){i=l;continue}let c=o[a-1],u=Ex(l,n);i+=s2(c,u)?`${s}${l}`:u}return i}function Sd(e,t){let{close:n,lead:r="",open:s}=t;if(e==="")return e;let o=hP(Ex(e,r)),i=gP(e),a=o==="block"?s:"",l=i==="block"?n:"";return`${a}${a===""?Ex(e,r):e}${l}`}function Px(e,t){let{close:n,open:r,...s}=t,o=an(e,s);return s.preformatted?o:Sd(o,{close:n,lead:s.lead,open:r})}function Ex(e,t){return e.startsWith(t)?e.slice(t.length):e}var e2,pP,t2,n2,r2;var wa=F(()=>{e2=new Set(["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","search","section","summary","table","tbody","td","tfoot","th","thead","tr","ul","xmp"]);pP=/^<!--[\s\S]*?-->/u,t2=/^<([a-zA-Z][^\s/>]*)/u,n2=/<\/([a-zA-Z][^\s>]*)\s*>$/u,r2=/<([a-zA-Z][^\s/<>]*)(?:\s[^<]*)?>$/u});function yP(e,t){return t===null?e:":host"}var Ac=F(()=>{bc()});function jd(e,t){return`(..._a) => ${_x}(() => { const _args = ${xP(e.parameters)}; return ${t}; })`}function xP(e){let t=[];for(let[n,r]of(e??[]).entries()){let s=o2(r);if(!s)continue;let o=i2(r)?`_a[${n}] === undefined ? ${JSON.stringify(r.default)} : _a[${n}]`:`_a[${n}]`;t.push(`${JSON.stringify(s)}: ${o}`)}return`{ ${t.join(", ")} }`}function Od(){return`let __jxFormulaDepth = 0;
|
|
203
|
+
function ${_x}(run) {
|
|
204
|
+
if (__jxFormulaDepth >= ${cd}) throw new Error(${JSON.stringify(nx)});
|
|
205
|
+
__jxFormulaDepth++;
|
|
206
|
+
try { return run(); } finally { __jxFormulaDepth--; }
|
|
207
|
+
}`}function kd(e){return`$expression: call cycle ${e.join(" → ")}: a named formula may not reach itself (spec.md §19.4c)`}function Ax(e){let t=ma(e);if(t.length>0)throw Error(t.map((n)=>kd(n)).join(`
|
|
208
|
+
`))}function va(e){let t=$d(e);if(t.length>0)throw Error(`expression rules (spec.md §19):
|
|
209
|
+
${t.map((n)=>` ${n.pointer}: ${n.message}`).join(`
|
|
210
|
+
`)}`)}function _d(e){return Object.values(e).some((t)=>ox(t))}function Ad(e,t,n="e"){return`async (..._a) => ${_x}(async () => {
|
|
211
|
+
const _args = ${xP(e.parameters)};
|
|
212
|
+
const ${n} = null;
|
|
213
|
+
${t}
|
|
214
|
+
})`}function o2(e){return O(e)?e:e?.name??""}function i2(e){return V(e)&&"default"in e}function a2(e,t){let n=bP(e,t);return n===e?e:`${n} as ${e}`}function bP(e,t){let n=t?.$export;return O(n)&&n!==""?n:e}function Cd(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,a=ce(i),l=t.method??"GET",c=Ve(t.debounce)&&Number.isFinite(t.debounce)&&t.debounce>0?t.debounce:0;if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let u=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(a)u.push(` const url = \`${c2(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else u.push(` const url = ${JSON.stringify(i)};`);u.push(" const _ac = new AbortController();");let d=[];if(l!=="GET")d.push(`method: ${JSON.stringify(l)}`);if(t.headers)d.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let m=V(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);d.push(`body: ${m}`)}d.push("signal: _ac.signal");let p=[`fetch(url, { ${d.join(", ")} })`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { if (e?.name !== "AbortError") ${r}.${e} = { error: String(e) }; });`];if(c>0)u.push(" const _t = setTimeout(() => {",...p.map((m)=>` ${m}`),` }, ${c});`," onEffectCleanup(() => { _ac.abort(); clearTimeout(_t); });");else u.push(" onEffectCleanup(() => _ac.abort());",...p.map((m)=>` ${m}`));return u.push(o?"}));":"});"),u.map((m)=>`${s}${m}`).join(`
|
|
215
|
+
`)}function Rd(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(([y,h])=>{if(!de(h))return`${Gr(y)}: ${JSON.stringify(h)}`;if(l2.some((x)=>h.$ref.startsWith(x)))throw Error(`Server function "${e}": argument "${y}" references "${h.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${Gr(y)}: ${Xr({$ref:h.$ref},{statePrefix:r})}`}),u=l.some(([,y])=>de(y)),d=`${qP}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,p=Ae(r,Jt(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((y)=>`${s}${y}`).join(`
|
|
216
|
+
`)}function c2(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Nc(e){return`<script type="importmap">
|
|
204
217
|
{
|
|
205
218
|
"imports": {
|
|
206
219
|
${Object.entries(e).map(([n,r])=>` ${JSON.stringify(n)}: ${JSON.stringify(r)}`).join(`,
|
|
207
220
|
`)}
|
|
208
221
|
}
|
|
209
222
|
}
|
|
210
|
-
</script>`}function Wi(e){if(e.runtimeImports!==void 0)return Cl(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return Cl(e.litHtmlSrc===Tr?{...t,"lit-html/":`${Tr}/`}:t)}function yf(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${_l}\??\.${_l}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${_l}(?:\?\.)?\[${_l}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||a1.test(e)}function xf(e,t){let n=Lg(t),r=e.state??{},s=Object.keys(n).filter((c)=>!(c in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((c)=>F(c)&&!Array.isArray(c)&&_(c.$src)),a=new Set(s.filter((c)=>i||yf(o,c)));for(let c of a)for(let u of Dg(n[c]))if(!(u in r))a.add(u);if(a.size===0)return e;let l=Object.fromEntries(s.filter((c)=>a.has(c)).map((c)=>[c,n[c]]));return{...e,state:{...l,...r}}}function l1(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Fo(n)));return JSON.stringify({...e,state:t})}function bf(e){if(_(e))return ce(e);if(!F(e))return!1;if(e.state){let n;for(let[r,s]of Object.entries(e.state)){if(r==="$site"||r==="$page")continue;if(!F(s)||Array.isArray(s))return!0;if(s.timing==="compiler")continue;if(Fo(s)){if(n??=l1(e),yf(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if(vs(s))continue;return!0}}if(e.$switch)return!0;if(Le(e)||a$(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>bf(n)))return!0;let t=Bi(e);for(let[n,r]of Object.entries(e)){if(gr.has(n)||t&&n==="innerHTML")continue;if(pe(r))return!0;if(ce(r))return!0}if(F(e.style)){for(let n of Object.values(e.style))if(ce(n))return!0}if(F(e.attributes)){for(let n of Object.values(e.attributes))if(ce(n))return!0}return!1}function Bi(e){return e.$static===!0||e.$prerendered===!0}function Ui(e,t=null,n={},r={}){let s=e?.state?Vo(e.state,t):t??df();return{media:r,scope:s,scopeDefs:n}}function df(e=null){return Object.create(e)}function ny(e){return e[m0]}function ry(e,t){return ny(e)?.has(t)??!1}function Nl(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return ry(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function ty(e,t,n){if(t>0&&f1.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!d1.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function h0(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(ty(e,t,!0)&&!ty(e,t,!1))return!0;return!1}function zi(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:go(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(ty(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function pf(e,t){if(_(e)){if(!e.includes("state."))return;let o=go(e);for(let i of o.matchAll(c1))t.add(i[1]);for(let i of o.matchAll(u1))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)pf(o,t);return}if(!F(e))return;let n=e,{operator:r,target:s}=n;if(_(r)&&hr(r)&&pe(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))pf(o,t)}function ff(e,t){for(let n of Zi(e)){if(Le(n)){ff(n.map?[n.map]:[],t);continue}if(!Ct(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(At(s)||pn(s)))pf(s.body??s.$expression,t);ff(Object.values(n.cases??{}).filter((r)=>Ct(r)&&!Ye(r)),t),ff(n.children,t)}}function ms(e,t){if(At(t)&&Qh(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function $f(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(ms(`state entry "${r}"`,s),!At(s)||!s.$src)continue;if(s.$lazy===!0){if(t.get(r)==="computed")throw Error(`"${r}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${r}() from a handler instead of binding its value.`);let i=n.lazy.get(s.$src);if(!i)i=[],n.lazy.set(s.$src,i);i.push({binding:r,exportName:p0(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(s1(r,s))}return n}function Sf(e,t){let n=[];for(let[o,i]of e.eager)n.push(`import { ${[...i].join(", ")} } from '${t?t(o):o}';`);let r=[],s=0;for(let[o,i]of e.lazy){let a=`_jxLazy${s}`;s+=1,r.push(`let ${a};`,`const ${a}Load = () => (${a} ??= import('${t?t(o):o}'));`,...i.map(({binding:l,exportName:c})=>`const ${l} = (...args) => ${a}Load().then((m) => m.${c}(...args));`))}return{imports:n,loaders:r}}function Vo(e={},t=null,n={}){let r=df(t),s=t?ny(t):void 0,o=new Set(s);if(Object.defineProperty(r,m0,{configurable:!0,enumerable:!1,value:o,writable:!0}),n.holdMutable===!0){let d=new Set;for(let p of Object.values(e))if(At(p)||pn(p))pf(p.body??p.$expression,d);if(n.document)ff([n.document],d);for(let p of d)if(p in e)o.add(p)}let i=Ar({state:e});for(let[d,p]of Object.entries(e)){if(!F(p)||Array.isArray(p)){ps(r,d,uf(p));continue}if("default"in p){ps(r,d,uf(p.default));continue}if(Zr(p)){o.add(d);continue}if(!p.$prototype&&!("$expression"in p)&&!vs(p))ps(r,d,uf(p))}let a=[],l=[],c=[];for(let[d,p]of Object.entries(e)){if(ce(p)){a.push([d,p]);continue}if(!F(p))continue;if(pn(p)){let m=p.$expression;if(c.push([d,JSON.stringify(m)]),wr(p)){let g=p.parameters;ps(r,d,(...b)=>{let h={};for(let[x,k]of g.entries()){let w=f0(k);if(!w)continue;h[w]=b[x]===void 0&&d0(k)?k.default:b[x]}return Mn(m,r,null,{args:h})})}else if(hr(m.operator))ps(r,d,(g,b)=>Mn(m,g,b));else Qg(r,d,()=>Mn(m,r,null));continue}if(At(p)){if(ms(`state entry "${d}"`,p),vr(p)){let{body:m}=p;c.push([d,JSON.stringify(m)]),ps(r,d,(g,b)=>{Ii(m,g??r,b??null)})}else if(_(p.body)){let{body:m}=p,g=Function(...Or(p),m);if(i.get(d)==="computed")Qg(r,d,()=>g(r)),l.push([d,m]);else ps(r,d,g),c.push([d,m])}else ps(r,d,()=>{}),o.add(d);continue}if(An(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){ps(r,d,uf(p.default??null));continue}if(An(p)&&p.$prototype==="Request")o.add(d);if(Xi(p))o.add(d)}let u=!0;while(u){u=!1;for(let[d,p]of[...l,...a])if(!o.has(d)&&y0(p,r))o.add(d),u=!0;for(let[d,p]of c)if(!o.has(d)&&p1(p,o))o.add(d),u=!0}for(let[d,p]of a)Qg(r,d,()=>Zt(p,r));return r}function ps(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function Qg(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function rt(e,t){if(pe(e))return g0(e.$ref,t);if(ce(e))return Zt(e,t);return e}function Ye(e){return pe(e)}function g0(e,t){if(!_(e))return e;let n=an(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?ey(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return ey(t,e.slice(8));return ey(t,e)??null}function y0(e,t){if(!t)return!1;let n=ny(t);for(let r of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(r[2])continue;let s=r[1];if(n?.has(s))return!0;let o;try{o=t[s]}catch{continue}if(Ot(o))return!0}return!1}function p1(e,t){for(let n of e.matchAll(/#\/state\/([^"/\\]+)|\bstate\.([A-Za-z_$][\w$]*)/g)){let[,r,s]=n,o=r===void 0?s:r.replaceAll("~1","/").replaceAll("~0","~");if(o!==void 0&&t.has(o))return!0}return!1}function wf(e){return Vi(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Zt(e,t){if(y0(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page],s=t?.$map;if(F(s)&&!Array.isArray(s)){n.push("item","index");let o=s;r.push(o.item,o.index)}try{let o=Vi(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function ey(e,t){return zt(e,t)}function uf(e){if(!F(e))return e;return structuredClone(e)}function m1(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&ce(r)).map(([n,r])=>{let s=rt(r,t);return s==null?null:`${xn(n)}: ${s}`}).filter(Boolean).join("; ")}function sy(e,t){if(!_(t)&&!De(t)&&!Xe(t))return null;if(e.kind==="text")return String(t);if(e.kind==="hidden"){if(_(t)&&t.toLowerCase()==="until-found")return"until-found";return t?"":null}let n=Boolean(t);if(e.keywords)return e.keywords[n?0:1];return Rr(e.attribute,n)}function b0(e,t){if(pe(e)&&(t===null||Nl(e.$ref,t)))return;try{return rt(e,t)}catch{return}}function kl(e,t,n){return n&&t===""?` ${e}`:` ${e}="${Me(t)}"`}function qo(e,t,n=""){let r=Vl(e.tagName,t),s=new Map,o,i=rt(e.id,t);if(i)s.set("id",kl("id",String(i),!1));let a=Ll(e),l=a?rt(Fl(e),t):null,c=[_(l)||De(l)?String(l):"",Ds(e)??""].filter((b)=>b!=="").join(" ");if(c)s.set("class",kl("class",c,!1));let u=(b,h)=>{if(h===void 0)return;let x=lf(r,b);if(!x)return;let k=b0(h,t);if(x.live&&k!==void 0)o??=new Set,o.add(x.attribute);let w=sy(x,k);if(w!==null)s.set(x.attribute,kl(x.attribute,w,x.kind!=="text"))};for(let b of x0)u(b,e[b]);let d=e;for(let b of Object.keys(d)){if(g1.has(b)||b.startsWith("$")||b.startsWith("on")||Gg(r,b))continue;u(b,d[b])}let p="";if(e.attributes)for(let[b,h]of Object.entries(e.attributes)){if(a&&b==="class")continue;let x=rt(h,t),k=null;if(Xe(x)){let v=Rr(b,x);k=v===null?null:kl(b,v,!0)}else if(_(x)||De(x))k=kl(b,String(x),!1);let w=b.toLowerCase();if(o?.has(w))continue;if(s.has(w)){if(k===null&&(x===null||x===void 0||Xe(x)))s.delete(w);else if(k!==null)s.set(w,k);continue}p+=k??""}let m="";for(let b of s.values())m+=b;let g=[m1(e.style,t),n].filter(Boolean).join("; ");if(g)m+=` style="${Me(g)}"`;if(m+=p,e.$static)m+=" data-jx-static";else if(e.$prerendered)m+=" data-jx-prerendered";return m}function Jl(e,t,n){if(Bi(e))return;if(!(("innerText"in e)||("value"in e)||("defaultValue"in e)||("text"in e)))return;for(let[r,s]of Object.entries(e)){if(s===void 0||!Gg(t,r))continue;let o=b0(s,n),i=o===null||o===void 0?"":Me(String(o));return r==="innerText"?i.replaceAll(/\r\n|\r|\n/gu,"<br>"):i}return}function Ki(){let e=JSON.stringify(Zu),t=JSON.stringify(pr);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function $0(e,t,n,r,s={}){for(let o of Ri(t,{...s,mediaQueries:r,resolveValue:(i,a)=>S0(i,a,n),scope:n}))e.push(Sl(o))}function S0(e,t,n){let r=_(t)?t:t.$ref;return y1.push({property:e,selector:n,source:r}),null}function vf(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Zv())});
|
|
211
|
-
function ${
|
|
223
|
+
</script>`}function Ea(e){if(e.runtimeImports!==void 0)return Nc(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return Nc(e.litHtmlSrc===es?{...t,"lit-html/":`${es}/`}:t)}function Td(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${Rc}\??\.${Rc}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${Rc}(?:\?\.)?\[${Rc}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||u2.test(e)}function Jd(e,t){let n=tx(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)=>V(c)&&!Array.isArray(c)&&O(c.$src)),a=new Set(s.filter((c)=>i||Td(o,c)));for(let c of a)for(let u of ex(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 f2(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!gi(n)));return JSON.stringify({...e,state:t})}function ns(e){return V(e)&&!Array.isArray(e)&&SP in e&&e.$literal===!0}function Nd(e){return e.flatMap((t)=>{if(O(t)){let r=[],s=t;for(let o=s.indexOf("${");o>=0;o=s.indexOf("${"))r.push(s.slice(0,o+1)),s=s.slice(o+1);return r.push(s),r}if(!V(t)||Array.isArray(t))return[t];let n={...t,[SP]:!0};if(Array.isArray(n.children))n.children=Nd(n.children);return[n]})}function Mc(e){if(O(e))return ce(e);if(!V(e)||ns(e))return!1;if(e.state){let n;for(let[r,s]of Object.entries(e.state)){if(r==="$site"||r==="$page")continue;if(!V(s)||Array.isArray(s))return!0;if(s.timing==="compiler")continue;if(gi(s)){if(n??=f2(e),Td(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if(ar(s))continue;return!0}}if(e.$switch)return!0;if(qe(e)||FS(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>Mc(n)))return!0;if(Pa(e)?.some((n)=>Mc(n)))return!0;let t=ja(e);for(let[n,r]of Object.entries(e)){if(Rr.has(n)||t&&n==="innerHTML")continue;if(de(r))return!0;if(ce(r))return!0}if(V(e.$props)){for(let[n,r]of Object.entries(e.$props))if(!n.startsWith("#")&&(de(r)||ce(r)))return!0}if(V(e.style)){for(let n of Object.values(e.style))if(ce(n))return!0}if(V(e.attributes)){for(let n of Object.values(e.attributes))if(ce(n))return!0}return!1}function Pa(e){let t=e[wP];return Array.isArray(t)?t:void 0}function vP(e,t){e[wP]=t}function EP(e,t){return e.push(t),`<!--jx-slotted ${e.length-1}-->`}function Ic(e,t,n){return e.replaceAll(d2,(r,s)=>{let o=Number(s);if(o>=t.length)throw Error(`A slotted placeholder (${o}) names no child of its component instance: a pass rewrote the markup.`);return n(t[o])})}function ja(e){return e.$static===!0||e.$prerendered===!0}function Oa(e,t=null,n={},r={},s){let o=e?.state?fo(e.state,t,{roles:s??sn(e)}):t??vd();return{media:r,scope:o,scopeDefs:n}}function vd(e=null){return Object.create(e)}function Cx(e){return e[$P]}function Rx(e,t){return Cx(e)?.has(t)??!1}function Lc(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return Rx(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function kx(e,t,n){if(t>0&&h2.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!g2.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function PP(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(kx(e,t,!0)&&!kx(e,t,!1))return!0;return!1}function ka(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:Es(e),o="",i=0;for(let a=s.indexOf("state");a!==-1;a=s.indexOf("state",a+1))if(kx(s,a,r))o+=e.slice(i,a)+t,i=a+5;return o+e.slice(i)}function Ed(e,t){if(O(e)){if(!e.includes("state."))return;let o=Es(e);for(let i of o.matchAll(p2))t.add(i[1]);for(let i of o.matchAll(m2))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)Ed(o,t);return}if(!V(e))return;let n=e,{operator:r,target:s}=n;if(O(r)&&Cr(r)&&de(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))Ed(o,t)}function wd(e,t){for(let n of Ta(e)){if(qe(n)){wd(n.map?[n.map]:[],t);continue}if(!It(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(Dt(s)||ln(s)))Ed(s.body??s.$expression,t);wd(Object.values(n.cases??{}).filter((r)=>It(r)&&!Ge(r)),t),wd(n.children,t)}}function Is(e,t){if(Dt(t)&&cy(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function Md(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(Is(`state entry "${r}"`,s),!Dt(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:bP(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(a2(r,s))}return n}function Dd(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 fo(e={},t=null,n={}){Ax(e);let r=vd(t),s=t?Cx(t):void 0,o=new Set(s);if(Object.defineProperty(r,$P,{configurable:!0,enumerable:!1,value:o,writable:!0}),n.holdMutable===!0){let d=new Set;for(let p of Object.values(e))if(Dt(p)||ln(p))Ed(p.body??p.$expression,d);if(n.document)wd([n.document],d);for(let p of d)if(p in e)o.add(p)}let i=n.roles??sn({state:e});for(let[d,p]of Object.entries(e)){if(!V(p)||Array.isArray(p)){Qr(r,d,bi(p));continue}if("default"in p){Qr(r,d,bi(p.default));continue}if(vs(p)){o.add(d);continue}if(!p.$prototype&&!("$expression"in p)&&!ar(p))Qr(r,d,bi(p))}let a=[],l=[],c=[];for(let[d,p]of Object.entries(e)){if(ce(p)){a.push([d,p]);continue}if(!V(p))continue;if(ln(p)){let m=p.$expression;if(c.push([d,JSON.stringify(m)]),An(p))Qr(r,d,sx(m,p.parameters,r));else if(Cr(m.operator))Qr(r,d,(g,y)=>Dn(m,g,y));else jx(r,d,()=>Dn(m,r,null));continue}if(Dt(p)){if(Is(`state entry "${d}"`,p),cn(p)){let{body:m}=p;if(c.push([d,JSON.stringify(m)]),Array.isArray(p.parameters)&&p.parameters.length>0){let g=p.parameters;Qr(r,d,(...y)=>vc(m,r,null,{args:$c(g,y)}))}else Qr(r,d,(g,y)=>vc(m,g??r,y??null))}else if(O(p.body)){let{body:m}=p,g=Function(...zr(p),m);if(i.get(d)==="computed")jx(r,d,()=>g(r)),l.push([d,m]);else Qr(r,d,g),c.push([d,m])}else Qr(r,d,()=>{}),o.add(d);continue}if(Cn(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){Qr(r,d,bi(p.default??null));continue}if(Cn(p)&&p.$prototype==="Request")o.add(d);if(Ca(p))o.add(d)}let u=!0;while(u){u=!1;for(let[d,p]of[...l,...a])if(!o.has(d)&&jP(p,r))o.add(d),u=!0;for(let[d,p]of c)if(!o.has(d)&&y2(p,o))o.add(d),u=!0}for(let[d,p]of a)jx(r,d,()=>Kt(p,r));return r}function Qr(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function jx(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function ot(e,t){if(de(e))return Id(e.$ref,t);if(ce(e))return Kt(e,t);return e}function Ge(e){return de(e)}function Id(e,t){if(!O(e))return e;let n=dn(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?Ox(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return Ox(t,e.slice(8));return Ox(t,e)??null}function jP(e,t){if(!t)return!1;for(let n of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(n[2])continue;let r=n[1];if(OP(t,r))return!0}return!1}function OP(e,t){if(Cx(e)?.has(t))return!0;let n;try{n=e[t]}catch{return!1}return $t(n)}function kP(e,t){if(e.startsWith("window#/")||e.startsWith("document#/"))return!0;if(e.startsWith("$map/")||!t)return!1;let n=e;if(e.startsWith("#/state/"))n=e.slice(8);else if(e.startsWith("parent#/"))n=e.slice(8);else if(e.includes("#/"))return!1;let[r]=vn(n);return r!==void 0&&r!==""&&OP(t,r)}function y2(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 Ld(e){return $a(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function Kt(e,t){if(jP(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page],s=t?.$map;if(V(s)&&!Array.isArray(s)){n.push("item","index");let o=s;r.push(o.item,o.index)}try{let o=$a(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function Ox(e,t){return on(e,t)}function bi(e){if(!V(e))return e;return structuredClone(e)}function x2(e,t,n=!1){if(!e||!t)return"";return Object.entries(e).filter(([r,s])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&ce(s)).map(([r,s])=>{let o=n?s:ot(s,t);return o==null?null:`${Mn(r)}: ${o}`}).filter(Boolean).join("; ")}function Tx(e,t){if(!O(t)&&!Ve(t)&&!tt(t))return null;if(e.kind==="text")return String(t);if(e.kind==="hidden"){if(O(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 Yr(e.attribute,n)}function AP(e,t){if(de(e)&&(t===null||Lc(e.$ref,t)))return;try{return ot(e,t)}catch{return}}function Cc(e,t,n){return n&&t===""?` ${e}`:` ${e}="${Fe(t)}"`}function $i(e,t,n=""){let r=Uc(e.tagName,t),s=new Map,o,i=ns(e),a=(x)=>i?x:ot(x,t),l=a(e.id);if(l)s.set("id",Cc("id",String(l),!1));let c=Wc(e),u=c?a(Bc(e)):null,d=[O(u)||Ve(u)?String(u):"",mo(e)??""].filter((x)=>x!=="").join(" ");if(d)s.set("class",Cc("class",d,!1));let p=(x,P)=>{if(P===void 0)return;let S=xd(r,x);if(!S)return;let v=i?P:AP(P,t);if(S.live&&v!==void 0)o??=new Set,o.add(S.attribute);let E=Tx(S,v);if(E!==null)s.set(S.attribute,Cc(S.attribute,E,S.kind!=="text"))};for(let x of _P)p(x,e[x]);let m=e;for(let x of Object.keys(m)){if($2.has(x)||x.startsWith("$")||x.startsWith("on")||xx(r,x))continue;p(x,m[x])}let g="";if(e.attributes)for(let[x,P]of Object.entries(e.attributes)){if(c&&x==="class")continue;let S=a(P),v=null;if(tt(S)){let w=Yr(x,S);v=w===null?null:Cc(x,w,!0)}else if(O(S)||Ve(S))v=Cc(x,String(S),!1);let E=x.toLowerCase();if(o?.has(E))continue;if(s.has(E)){if(v===null&&(S===null||S===void 0||tt(S)))s.delete(E);else if(v!==null)s.set(E,v);continue}g+=v??""}let y="";for(let x of s.values())y+=x;let h=[x2(e.style,t,i),n].filter(Boolean).join("; ");if(h)y+=` style="${Fe(h)}"`;if(y+=g,e.$static)y+=" data-jx-static";else if(e.$prerendered)y+=" data-jx-prerendered";return y}function Fc(e,t,n){if(ja(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||!xx(t,r))continue;let o=AP(s,n),i=o===null||o===void 0?"":Fe(String(o));return r==="innerText"?i.replaceAll(/\r\n|\r|\n/gu,"<br>"):i}return}function _a(){let e=JSON.stringify(od),t=JSON.stringify(_r);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function CP(e,t,n,r,s={}){for(let o of fa(t,{...s,mediaQueries:r,resolveValue:(i,a)=>RP(i,a,n),scope:n}))e.push(xc(o))}function RP(e,t,n){let r=O(t)?t:t.$ref;return S2.push({property:e,selector:n,source:r}),null}function Fd(){return`const __jxEnumAttrs = new Set(${JSON.stringify(X0())});
|
|
224
|
+
function ${Si}(n, v) {
|
|
212
225
|
if (typeof v !== 'boolean') return v;
|
|
213
226
|
const l = n.toLowerCase();
|
|
214
227
|
if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
|
|
215
228
|
return v ? '' : null;
|
|
216
|
-
}`}function
|
|
229
|
+
}`}function Vd(){return`const _jxCaseLoads = new Set();
|
|
230
|
+
function _jxSwitch(templates, modules, key) {
|
|
231
|
+
const spec = Object.hasOwn(modules, key) ? modules[key] : undefined;
|
|
232
|
+
if (spec !== undefined && !_jxCaseLoads.has(spec)) {
|
|
233
|
+
_jxCaseLoads.add(spec);
|
|
234
|
+
import(spec).catch((e) => {
|
|
235
|
+
_jxCaseLoads.delete(spec);
|
|
236
|
+
console.error("Jx $switch: failed to load external case", spec, e);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
return templates[key];
|
|
240
|
+
}`}function NP(){let e=JSON.stringify(dx),t=JSON.stringify(px);return`function ${TP}(h, n) {
|
|
241
|
+
for (const p of h.split(";")) {
|
|
242
|
+
const i = p.indexOf("=");
|
|
243
|
+
if (i === -1 || p.slice(0, i).trim() !== n) continue;
|
|
244
|
+
const r = p.slice(i + 1);
|
|
245
|
+
try { return JSON.parse(decodeURIComponent(r)); } catch { return r; }
|
|
246
|
+
}
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
function ${JP}(n, v, o) {
|
|
250
|
+
const host = n.startsWith(${e});
|
|
251
|
+
const parts = [n + "=" + encodeURIComponent(JSON.stringify(v))];
|
|
252
|
+
if (o.maxAge !== undefined) parts.push("Max-Age=" + o.maxAge);
|
|
253
|
+
const path = host ? "/" : o.path;
|
|
254
|
+
if (path) parts.push("Path=" + path);
|
|
255
|
+
if (o.domain && !host) parts.push("Domain=" + o.domain);
|
|
256
|
+
if (o.secure === true || host || n.startsWith(${t}) || o.sameSite?.toLowerCase() === "none") parts.push("Secure");
|
|
257
|
+
if (o.sameSite) parts.push("SameSite=" + o.sameSite);
|
|
258
|
+
return parts.join("; ");
|
|
259
|
+
}`}function MP(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,i=Ae(r,Jt(e)),a={};for(let u of["domain","maxAge","path","sameSite","secure"]){let d=t[u];if(d!==void 0)a[u]=d}let l=`document.cookie = ${JP}(_n, ${i}, _o);`;return["// Cookie entry","{",` const _n = ${JSON.stringify(t.name??e)};`,` const _o = ${JSON.stringify(a)};`,` ${i} = ${TP}(document.cookie, _n) ?? ${JSON.stringify(t.default??null)};`,o?` ${o}.push(effect(() => { ${l} }));`:` effect(() => { ${l} });`,"}"].map((u)=>`${s}${u}`).join(`
|
|
260
|
+
`)}function qd(e){let t={keyed:!1,arranged:!1},n=(r)=>{for(let s of Ta(r)){if(qe(s)){t.arranged||=de(s.filter)||de(s.sort),t.keyed||=de(s.key),n(s.map?[s.map]:[]);continue}if(!It(s))continue;n(Object.values(s.cases??{}).filter((o)=>It(o)&&!Ge(o))),n(s.children)}};return n([e]),t}function Jx(e,t){for(let r of[e.items,e.filter,e.sort])if(de(r)&&Lc(r.$ref,t))return!1;let n=(r)=>{for(let s of Ta(r)){if(qe(s)){if(!Jx(s,t))return!1;continue}if(!It(s))continue;let o=Object.values(s.cases??{}).filter((i)=>It(i)&&!Ge(i));if(!n(o)||!n(s.children))return!1}return!0};return n(e.map?[e.map]:[])}function wi(e){let{items:t}=e;if(ce(t))throw Error(`A repeater's items must be a $ref or a literal array, not the template string ${JSON.stringify(t)}. A template is not read as a list: bind items to a state entry by $ref, and compute the list in that entry.`)}function Hd(e){let t=dn(e);if(t==="$map/item")return[];return t.startsWith("$map/item/")?vn(t.slice(10)):null}function Wd(){return`function ${Aa}(items, filter, sort) {
|
|
217
261
|
if (!Array.isArray(items)) return [];
|
|
218
262
|
let list = items;
|
|
219
263
|
if (typeof filter === 'function') list = list.filter(filter);
|
|
220
264
|
if (typeof sort === 'function') list = [...list].sort(sort);
|
|
221
265
|
return list;
|
|
222
266
|
}
|
|
223
|
-
function ${
|
|
267
|
+
function ${DP}(list, path, pointer, warn) {
|
|
224
268
|
const keys = list.map((item, index) => {
|
|
225
269
|
if (pointer === null) return index;
|
|
226
270
|
if (path === null) {
|
|
@@ -243,135 +287,139 @@ function ${w0}(list, path, pointer, warn) {
|
|
|
243
287
|
}
|
|
244
288
|
}
|
|
245
289
|
return keys;
|
|
246
|
-
}`}function
|
|
247
|
-
`)}function
|
|
248
|
-
`)}function
|
|
249
|
-
`)}function
|
|
250
|
-
`)}function
|
|
251
|
-
`)}function
|
|
252
|
-
`)}function
|
|
253
|
-
`)}function
|
|
254
|
-
`)}function
|
|
255
|
-
${
|
|
290
|
+
}`}function Ud(){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(${Aa}(items, filter, sort));`,` this.#snap.value = { list, keys: ${DP}(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 ${qc} = directive(__JxKeyedList);`,"const __jxLiterals = new Map();",`function ${Vc}(text) {`," if (!__jxLiterals.has(text)) __jxLiterals.set(text, JSON.parse(text));"," return __jxLiterals.get(text);","}"].join(`
|
|
291
|
+
`)}function IP(){return[`function ${Nx}(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 ${Mx}(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(`
|
|
292
|
+
`)}function LP(){return[`function ${zd}(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(`
|
|
293
|
+
`)}function FP(e){return Mi(e)}function Hc(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>O(n)):[]}function VP(e){let t=hx(e),n=new Set(Hc(e).map((s)=>FP(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Kd(){return[`async function ${qP}(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(`
|
|
294
|
+
`)}function Dx(e){let t={};for(let[n,r]of Object.entries(e))if(!w2.has(n)&&r!==void 0)t[n]=r;return t}function Gd(e){return Cn(e)&&!HP.has(e.$prototype)}function Ca(e){return Gd(e)&&e.timing==="client"}function Xd(e,t){if(!Cn(t)||t.timing!=="compiler"||!HP.has(t.$prototype))return;throw Error(t.$prototype==="Request"?`state entry "${e}": a timing "compiler" Request resolves only in a site build`:`state entry "${e}" ($prototype "${t.$prototype}"): has no build-time value; remove "timing" or use "client"`)}function Yd(){return[`async function ${WP}(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(`
|
|
295
|
+
`)}function Zd(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!Ca(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:Dx(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function Qd(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=Ae(s,Jt(l)),d=JSON.stringify(l);o.push(`${n} ${WP}(${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(`
|
|
296
|
+
`)}function BP(){return[`function ${Ix}(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(`
|
|
297
|
+
`)}function UP(){let e=`new RegExp(${JSON.stringify(hd.source)}, ${JSON.stringify(hd.flags)})`,t=`Symbol.for(${JSON.stringify(yx)})`,n=JSON.stringify(Pc),r=JSON.stringify(gd);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${Lx}(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 ${Fx}(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(`
|
|
298
|
+
`)}function uo(e){for(let t of Ta(e)){if(qe(t)){if(t.map&&uo([t.map]))return!0;continue}if(!It(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>It(r)&&!Ge(r));if(uo(n)||uo(t.children))return!0}return!1}function Ta(e){if(qe(e))return[e];if(!Array.isArray(e))return[];return e}function Ja(e,t={},n=null){let r=[],s=fP(V(n)?n:{},t,(i)=>i,RP,void 0,{comments:!0});if(s!=="")r.push(s);if(np(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
|
|
299
|
+
${ep(r.join(`
|
|
256
300
|
`))}
|
|
257
|
-
</style>`}function
|
|
258
|
-
`}),c.content||=a;else s.set(i,{content:a,html:l})}return{groups:s,id:r,taken:new Set}}function
|
|
259
|
-
`});return""}function
|
|
260
|
-
`})}function
|
|
261
|
-
`});if(!
|
|
262
|
-
`})}let i=r?.componentDefs.get(o);if(i&&r)return
|
|
263
|
-
`}):"";
|
|
301
|
+
</style>`}function ep(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function mo(e){return e[zP]}function KP(e,t,n){let r=mo(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[zP]=s,s}function tp(e){let{children:t}=e;if(Array.isArray(t))return t;return qe(t)?[t]:[]}function Jc(e,t){if(!V(e))return;if(qe(e)){if(e.map)Jc(e.map,t);return}t(e);for(let n of tp(e))Jc(n,t);if(V(e.cases))for(let n of Object.values(e.cases))Jc(n,t)}function GP(e,t,n){Jc(e,(r)=>{if(r.style)KP(r,t,n)})}function Wc(e){return mo(e)!==void 0||Boolean(e.className)}function Bc(e){let{attributes:t}=e;return V(t)&&Object.hasOwn(t,"class")?t.class:e.className}function np(e,t,n,r="",s,o="jx",i={}){let a=s??{n:0};Jc(e,(l)=>{if(l.style)CP(t,l.style,`.${KP(l,a,o)}`,n,i)})}function Fe(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function ho(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function XP(e){let t=new Set;return YP(e,t),[...t]}function YP(e,t){if(!V(e))return;if(e.state){for(let n of Object.values(e.state))if(Dt(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)YP(n,t)}function ZP(e){let t=[];return QP(e,t),t}function QP(e,t){if(!V(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(vs(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)QP(n,t)}function Uc(e,t){if(O(e))return e;let n=Ho(e);if(n.length===0)return"div";if(!Kn(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return ot(s,t)?r.value:r.initial;let o=ot(s,t);return r.cases[String(o)]??r.default}function qx(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Hx(e,t,n,r=null){let s=new Map;for(let o of Ta(e)){let i="",a=!0,l;if(O(o)||Ve(o)||tt(o)){if(l=n(o),hd.test(l))continue;a=l!==""}else if(qe(o))l=n(o);else if(!It(o))l=n(o),a=l!=="";else{let u=ot(o.attributes?.slot,t),d=O(o.slot)?ot(o.slot,t):null;if(O(u)&&u!=="")i=u,l=n(o);else if(O(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=an([c.html,l],{separator:`
|
|
302
|
+
`}),c.content||=a;else s.set(i,{content:a,html:l})}return{groups:s,id:r,taken:new Set}}function ej(e,t,n){for(let r of Ta(e)){if(qe(r)||!It(r))continue;if(r.tagName==="slot"){let s=ot(r.attributes?.name,t);n.taken.add(O(s)?s:"")}ej(r.children,t,n)}}function Wx(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 zc(e,t){if(!t)return fo(e.state??{},null,{roles:sn(e)});let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=V(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return fo(n,null,{roles:sn({...e,state:n})})}function Bx(e,t,n){let r=Hc(e).filter((a)=>Object.hasOwn(t??{},a));if(!t||r.length===0)return null;let s=hx(e),o=zc(e,null),i=null;for(let a of r){let l=ot(t[a],n),c=null;if(tt(l))c=Yr(a,l);else if(O(l)||Ve(l))c=String(l);let u=FP(a);if(c===null||s.has(u)&&s.get(u)===void 0)continue;Z0(o,a,c,s),i??={},i[u]=o[u]}return i}function Ux(e,t){let n={};for(let[r,s]of Object.entries(e??{})){if(de(s)&&Lc(s.$ref,t))continue;let o;try{o=ot(s,t)}catch{continue}if(O(o)||Ve(o)||tt(o))n[r]=o}return n}function zx(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!ce(r))return[];let s=ot(r,t);return s==null?[]:[[n,s]]}))}function Dc(e,t,n,r,s=!1){let o=ns(e);if(e.textContent!==void 0){let a=o?e.textContent:ot(e.textContent,t);return a!=null?Fe(String(a)):""}if(e.innerHTML){let a=o?e.innerHTML:ot(e.innerHTML,t),l=a!=null?String(a):e.innerHTML,c=Pa(e);return c?Ic(l,c,(u)=>ts(u,t,null,r,s)):l}let i=o?void 0:Fc(e,Uc(e.tagName,t),t);if(i!==void 0)return i;if(qe(e.children))return tj(e.children,t,n,r,s);if(Array.isArray(e.children))return an(e.children.map((a)=>ts(a,t,n,r,s)),{preformatted:s,separator:`
|
|
303
|
+
`});return""}function tj(e,t,n=null,r=null,s=!1){let o=e.map;if(!o)return"";wi(e);let i=t??vd(),a=Kx(e,i);if(a===null)return"";return an(a.map((l,c)=>{let u=vd(i);return u.$map={index:c,item:l},u["$map/item"]=l,u["$map/index"]=c,ts(o,u,n,r,s)}),{preformatted:s,separator:`
|
|
304
|
+
`})}function Kx(e,t){let n=(r)=>de(r)?Id(r.$ref,t):void 0;for(let r of[e.items,e.filter,e.sort])if(de(r)&&Lc(r.$ref,t))return null;try{let r=de(e.items)?n(e.items):e.items;if(!Array.isArray(r))return null;return Y0(r,n(e.filter),n(e.sort))}catch{return null}}function ts(e,t,n=null,r=null,s=!1){if(O(e)){if(ce(e)&&t){let c=Kt(e,t);if(c!=null)return Fe(String(c));return r?"":Fe(e)}return Fe(e)}if(Ve(e)||tt(e))return Fe(String(e));if(Array.isArray(e))return an(e.map((c)=>ts(c,t,n,r,s)),{preformatted:s,separator:`
|
|
305
|
+
`});if(!V(e))return"";if(qe(e))return tj(e,t,n,r,s);if(e.$switch){let c=e.tagName??"div",u=$i(e,t),p=de(e.$switch)&&t!==null&&Lc(e.$switch.$ref,t)?null:ot(e.$switch,t),m=p==null?void 0:e.cases?.[String(p)],g=m!==void 0&&!Ge(m)?ts(m,t,n,r,s):"";return`<${c}${u}>${g}</${c}>`}let o=Uc(e.tagName,t);if(o==="slot"&&n){let c=ot(e.attributes?.name,t),u=O(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=`<!--${gd} ${n.id} ${encodeURIComponent(u)}-->${p}<!--/${gd} ${n.id}-->`;if(d?.content)return ej(e.children,t,n),p;let m=Dc(e,t,n,r,s);return an([p,m],{preformatted:s,separator:`
|
|
306
|
+
`})}let i=r?.componentDefs.get(o);if(i&&r)return v2(e,i,t,n,r);let a=$i(e,t);if(Vx.has(o))return`<${o}${a}>`;let l=Dc(e,t,n,r,s||Ls.has(o));return`<${o}${a}>${l}</${o}>`}function v2(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:a}=Wx(e.attributes),l={...i,...e.$props},c={};for(let[A,L]of Object.entries(l))c[A]=ot(L,n)??L;let u=Object.keys(c).length>0,d={...Bx(t,a,n),...c},p=Object.keys(d).length>0,m=s.path??[],g={key:JSON.stringify(d),tag:o},y=[...m.map((A)=>A.tag),o].join(" → ");if(m.some((A)=>A.tag===g.tag&&A.key===g.key))throw Error(`Component <${o}> renders itself: ${y}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(m.length>=gx)throw Error(`Component nesting exceeds ${gx} levels: ${y}. A component that renders itself with changing props needs a case that stops.`);let h={...s,path:[...m,g]},{children:x}=e,P=(A)=>ts(A,n,r,s),S=er(t,s.defaults),v=!Gx(o,t,s.liveTags),E=zc(t,p?d:null),w,R=null;if(S){let A=Array.isArray(x)?an(x.map((L)=>P(L)),{separator:`
|
|
307
|
+
`}):"";w=`<template shadowrootmode="${S}"><link rel="stylesheet" href="${sp(o)}">${Dc(t,E,null,h)}</template>${A}`}else{R=!v&&uo(t.children)?qx(s):null;let A=Hx(x,n,P,R);w=Dc(t,E,A,h)}let C=Object.entries(zx(t.style,E)).map(([A,L])=>`${Mn(A)}: ${L}`).join("; "),J={...e};delete J.$props,delete J.children;let D={...a,...Ux(t.attributes,E)};if(J.attributes=!v&&u?{...D,"data-jx-props":JSON.stringify(c)}:D,R!==null)J.attributes={...J.attributes,[Pc]:String(R)};if(v)J.$static=!0;else J.$prerendered=!0;return`<${o}${$i(J,n,C)}>${w}</${o}>`}function nj(e,t=null,n=null,r=null){return Dc(e,zc(e,t),n,r)}function Gx(e,t,n){return n?n.has(e):!sj(t)}function Pd(e,t){let n=new Set,r=(s,o)=>{if(Array.isArray(s)){for(let i of s)r(i,!1);return}if(!V(s))return;if(qe(s)){r(s.map,!1);return}if(!o){for(let i of Ho(s.tagName))if(t.has(i))n.add(i)}r(s.children,!1);for(let i of Object.values(s.cases??{}))if(!Ge(i))r(i,!1)};return r(e,!0),n}function rj(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 Pd(e.get(c),e))if(!a.has(u))a.add(u),l.push(u);return a},r=t?n(Pd(t,e)):void 0,s=new Set,o=[];for(let[i,a]of e)if(!sj(a)){if(s.add(i),!r||r.has(i))o.push(i)}for(let i of n(o))s.add(i);return s}function rp(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[...Pd(a,t)].toSorted())o(l);if(n.has(i))s.push(i)};for(let i of[...e].toSorted())o(i);return s}function sj(e){if(Hc(e).length>0)return!1;return Tc(e)}function Tc(e){if(!V(e))return!0;if(Array.isArray(e))return e.every((t)=>Tc(t));if(qe(e))return Array.isArray(e.items)&&e.filter===void 0&&e.sort===void 0&&e.key===void 0&&(e.map===void 0||Tc(e.map));if(e.$prototype)return!1;if(e.$switch!==void 0||Kn(e.tagName))return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!V(t)||Array.isArray(t))continue;if(t.$prototype)return!1;if(t.$ref)return!1}for(let t of Object.keys(e))if(t.startsWith("on")&&t!=="observedAttributes")return!1;if(Array.isArray(e.children))return e.children.every((t)=>Tc(t));if(qe(e.children))return Tc(e.children);return!0}function sp(e){return`/components/${e}.css`}function oj(e,t,n,r){let s=new Set([e]),o=[n.get(e)??""],i=(a)=>{for(let l of Pd(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 op(e,t,n=null,r={},s=null){let o=[],i=yP(e,s),a={host:s===null?"light":"shadow"};if(s!==null)a.shadowTree=!0;let l=V(t)?t:{};if(CP(o,"display"in l?l:{display:"block",...l},i,r,a),n){let c={n:0};for(let u of tp(n))np(u,o,r,"",c,e,{shadowTree:s!==null})}return o.length>0?`${o.join(`
|
|
264
308
|
`)}
|
|
265
|
-
`:""}var
|
|
266
|
-
${e.slice(n)}`}function
|
|
267
|
-
`)}function
|
|
268
|
-
`)}function
|
|
269
|
-
`):e.body??"").includes("await ")}var
|
|
270
|
-
`)}var dE;var Ry=M(()=>{ae();Ft();Cy();is();dE=new Map});import{dirname as bE}from"node:path";async function Bl(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?bE(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry};for(let[l,c]of Object.entries(o)){if(!An(c))continue;if(Z1.has(c.$prototype))continue;let u=`"${l}" ($prototype "${c.$prototype}")`;if(c.timing&&c.timing!=="compiler"){let d=r.registry?.byName(c.$prototype);if(d?.capabilities.lower)try{let p=await d.call("lower",c,{projectConfig:r.config,root:n,route:t});if(L(p)){let m=p.$bundle;if(Array.isArray(m)){for(let g of m)if(_(g))r.registerBundle?.(g)}delete p.$bundle}o[l]=p,s[l]=p}catch(p){i.push(`${u}: its class could not lower it: ${ye(p)}`)}continue}try{let d=Wf(c,a);if(d===void 0){if(c.timing==="compiler"&&cy(c))i.push(`${u} names no class: give it a $src or an imports entry, or enable the extension that provides "${c.$prototype}"`);continue}let p=await hE(d),{value:m}=await gE(p,Q1(c,t,n,o,r));if(r.asInitialValues)o[l]={default:m??null};else{if(c.timing&&L(m))m.timing=c.timing;o[l]=m}s[l]=o[l]}catch(d){let p=c.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${u}: ${ye(d)}${p}`)}}if(i.length>0)throw Error(i.length===1?`state entry ${i[0]}`:`${i.length} state entries could not be resolved: ${i.join("; ")}`);return s}function Q1(e,t,n,r,s){let o={...ly(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=bE(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var Z1;var Ty=M(()=>{ae();Ft();$n();Ry();Z1=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as Ny,readdirSync as eL,statSync as tL}from"node:fs";import{extname as SE,join as nL,relative as rL,resolve as sL}from"node:path";async function gs(e,t){let n=Ny(e,"utf8");if(Bn(e))return Cr(Rn(n,e),e);let r=SE(e).toLowerCase(),s=t?.byExtension(r,"parse");if(!s)throw Error(`No format class registered for "${r}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return Cr(await s.parseDocument(n),e)}async function wE(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await iL(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,oL(o,s._pathParams))}return n}function oL(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function iL(e,t){if(!Ny(e,"utf8").includes("$translationKey"))return null;let n;try{n=await gs(e,t)}catch{return null}return _(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function vE(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await EE(e,e,n,r,t),n.sort(bv),n}async function EE(e,t,n,r,s){let o=eL(e,{withFileTypes:!0});for(let i of o){let a=nL(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await EE(a,t,n,r,s);continue}let l=SE(i.name).toLowerCase();if(!r.has(l))continue;if(i.name.startsWith("_"))continue;let c=rL(t,a);n.push(await aL(c,a,s))}}async function aL(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=xv(e),a=null;try{let c=(await gs(t,n)).$layout;if(_(c))a=c}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function lL(e){let t=e[Bf];if(!L(t))return null;let{mtime:n}=t;return _(n)&&n!==""?n:null}function jE(e){if(e.includes("\x00"))return"has a NUL character";for(let t of e.split("/")){if(t==="."||t==="..")return'has a "." or ".." segment';if(t.includes("\\"))return"has a backslash"}return null}async function PE(e,t,n={},r,s,o,i={}){let a=[],l=(u,d)=>{let p=`Dynamic route ${u.urlPattern}: ${d}`;if(i.errors===void 0)throw Error(p);i.errors.push(p)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let d;try{d=await gs(u.sourcePath,r?.formats)}catch{a.push(u);continue}if(!d.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let p;try{p=Sv(d.$paths)}catch(g){l(u,ye(g));continue}if(p!==null){let g=fr(u.urlPattern,o??null),b=p.each===void 0?[{}]:await $E(p.each,t,n,r,s,g,u,c);for(let h of b){let x=await cL(u,d,p,h,{locale:g,projectConfig:s,projectRoot:t,registry:r,report:l,sections:n});a.push(...x)}continue}let m=await $E(d.$paths,t,n,r,s,fr(u.urlPattern,o??null),u,c);for(let g of m){let b=u.urlPattern,h={};for(let[v,E]of Object.entries(g)){if(v===Bf)continue;h[v]=String(E),b=b.replace(`:${v}`,h[v]),b=b.replace("*",h[v])}let x=jE(b);if(x!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${b}", which ${x}; skipping it`);continue}let k=lL(g),w={...u,_pathParams:h,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:b};if(k!==null)w.sourceMtime=k;a.push(w)}}return a}function kE(e,t){let n=e;for(let[r,s]of Object.entries(t)){let o=new RegExp(`:${r.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);n=o.test(n)?n.replace(o,()=>s):n.replace("*",()=>s)}return n}async function cL(e,t,n,r,s){let o={};for(let[g,b]of Object.entries(r))if(g!==Bf)o[g]=String(b);let i=e.params.filter((g)=>!(g in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let l=kE(e.urlPattern,o),c=jE(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u;try{u=await fL(t,n.key,e,o,s)}catch(g){return s.report(e,ye(g)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=uL(u,e.sourcePath),p=jg(u.length,n.pageSize),m=[];for(let g=1;g<=p;g++){let b={...e,_pathParams:{...o,[a]:String(g)},isCatchAll:!1,isDynamic:!1,pagedState:{items:wv(u,g,n.pageSize),key:n.key},pagination:vv(l,g,n.pageSize,u.length),params:[],urlPattern:Lo(l,g)};if(d!==null)b.sourceMtime=d;m.push(b)}return m}function uL(e,t){let n=null,r=tL(t).mtime.getTime();for(let s of e){let o=L(s)?s[Bf]:void 0,i=L(o)?o.mtime:void 0;if(_(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function fL(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=Oy(s.projectRoot);for(let[u,d]of Object.entries(s.projectConfig?.imports??{}))i[u]=d.startsWith("./")||d.startsWith("../")?a(d,n):d;Object.assign(i,e.imports);let l={imports:i,state:{[t]:structuredClone(o)}},c={_pathParams:r,locale:s.locale,sourcePath:n.sourcePath,urlPattern:kE(n.urlPattern,r)};return await Bl(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function $E(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=_(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&_(e.$ref)&&e.$ref){let l=e.$ref,c=sL(t,l),u;try{u=JSON.parse(Ny(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${ye(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let d=_(e.param)?e.param:"id",p=_(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[d]:(L(m)?m[p]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=r?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:n[c.project.key],locale:o,projectConfig:s,root:t};if(i!==void 0)u.params=i.params,u.urlPattern=i.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var Bf="_meta";var Jy=M(()=>{Ai();ae();os();Ft();$v();Ev();Ey();Ay();Ty()});import{createHash as dL}from"node:crypto";function _E(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function Uo(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function My(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function $L(e){return`'sha256-${dL("sha256").update(e,"utf8").digest("base64")}'`}function OE(e,t){for(let n of e.matchAll(mL)){let r=n[1]??"",s=Uo(r,"src"),o=(Uo(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=My(s);if(i)t.scriptOrigins.add(i);continue}if(pL.has(o))t.scriptHashes.add($L(n[2]??""))}for(let n of e.matchAll(hL)){let r=n[1]??"",s=(Uo(r,"rel")??"").toLowerCase(),o=Uo(r,"href"),i=My(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(bL.test(o??"")||(Uo(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[gL,t.imgOrigins],[yL,t.imgOrigins],[xL,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[Uo(o,"src"),...SL(Uo(o,"srcset"))]){let a=My(i);if(a)r.add(a)}}}function SL(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function wL(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function AE(e){let t=e?.csp;if(t===void 0||t===!1)return null;if(t===!0)return{};if(t==="report-only")return{mode:"report-only"};return t}function CE(e){return(Array.isArray(e)?e:[e]).flatMap((t)=>t.split(/\s+/)).filter(Boolean)}function RE(e){let t=[],n=new Set(Object.keys(e.directives??{}).map((r)=>r.toLowerCase()));for(let[r,s]of Object.entries(e.sources??{})){let o=`build.headers.security.csp.sources["${r}"]`;if(!/^[A-Za-z][A-Za-z0-9-]*$/.test(r))t.push(`${o}: not a CSP directive name.`);if(n.has(r.toLowerCase()))t.push(`${o}: csp.directives also sets "${r}" and replaces it wholesale, so put the sources in that string, or remove one of the two.`);for(let i of CE(s))if(/[;,]/.test(i))t.push(`${o}: "${i}" contains ";" or "," and would split the directive.`)}return t}function EL(e,t){let n=new Set(Object.keys(t.directives??{}).map((r)=>r.toLowerCase()));for(let[r,s]of Object.entries(t.sources??{})){let o=r.toLowerCase(),i=CE(s);if(n.has(o)||i.length===0)continue;let a=e[o];if(a===void 0||a===!1){a="";for(let c of vL.get(o)??[]){let u=e[c];if(u!==void 0&&u!==!1){a=u;break}}}let l=a.split(/\s+/).filter(Boolean);for(let c of i)if(!l.includes(c))l.push(c);e[o]=l.filter((c)=>c!=="'none'").join(" ")}}function TE(e,t,n="SAMEORIGIN"){let r=(a,l)=>[...a,...l].join(" "),s={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":wL(n),"frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")s["report-to"]="csp-endpoint",s["report-uri"]=t.reportUri;for(let[a,l]of Object.entries(t.directives??{}))s[a]=l;EL(s,t);let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[l])=>a<l?-1:1).map(([a,l])=>`${a} ${String(l)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var pL,mL,hL,gL,yL,xL,bL,vL;var Iy=M(()=>{pL=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),mL=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,hL=/<link\b([^>]*)>/gi,gL=/<img\b([^>]*)>/gi,yL=/<source\b([^>]*)>/gi,xL=/<iframe\b([^>]*)>/gi,bL=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i;vL=new Map([["child-src",["default-src"]],["connect-src",["default-src"]],["font-src",["default-src"]],["frame-src",["child-src","default-src"]],["img-src",["default-src"]],["manifest-src",["default-src"]],["media-src",["default-src"]],["object-src",["default-src"]],["prefetch-src",["default-src"]],["script-src",["default-src"]],["script-src-attr",["script-src","default-src"]],["script-src-elem",["script-src","default-src"]],["style-src",["default-src"]],["style-src-attr",["style-src","default-src"]],["style-src-elem",["style-src","default-src"]],["worker-src",["child-src","script-src","default-src"]]])});import{existsSync as Uf,readFileSync as jL,writeFileSync as JE}from"node:fs";import{join as zf}from"node:path";function ME(e,t){let n=e?.headers??{},r=[];if(n.enabled===!1)return{errors:r,rules:[]};let s=n.security??{},o={};if(s.contentTypeOptions!==!1)o["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)o["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)o["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)o["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:i}=s;if(i){let u=i===!0?{}:i,d=u.maxAge??NE,p=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!p)r.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else o["Strict-Transport-Security"]=[`max-age=${d}`,p?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=AE(s);if(a)if(t===void 0)r.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else r.push(...RE(a)),Object.assign(o,TE(t,a,s.frameOptions));let l=n.cache??"auto";if(l==="auto")o["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(o).length>0)c.push({headers:o,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${NE}, immutable`},pattern:PL});for(let[u,d]of Object.entries(n.rules??{}))c.push({headers:d,pattern:u});return{errors:r,rules:c}}function IE(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],n=[];for(let[r,s]of t)if(Uf(zf(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(Uf(zf(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function DE(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Te(t,n.pattern)}))}function OL(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
|
|
271
|
-
`)});return`${[
|
|
309
|
+
`:""}var _x="__jxFormula",l2,$P,po="https://esm.sh/@vue/reactivity@3.5.40",es="https://esm.sh/lit-html@3.3.0",Rc,u2,SP="$literal",wP="$slotted",d2,p2,m2,h2,g2,_P,b2,$2,Ls,S2,Si="__jxAttrText",TP="__jxCookieRead",JP="__jxCookieText",Aa="__jxListItems",DP="__jxRowKeys",Vc="__jxLiteral",qc="__jxKeyed",Bd,Nx="__jxSupplies",Mx="__jxNativeSetter",zd="__jxAbsorbAttr",qP="__jxServerCall",w2,HP,WP="__jxInstantiate",Ix="__jxAssociateForm",Lx="__jxCaptureSlotted",Fx="__jxDistributeSlots",Ra="<!---->",zP,Vx;var hn=F(()=>{Rs();Sa();bx();yi();pd();vx();nc();dP();ae();wa();Ac();da();Sa();yi();pd();ae();yi();l2=["$map/","event#/","$args/","$reduce/"];$P=Symbol("jx.runtimeOnlyStateKeys");Rc=String.raw`(?:\s|\\[nrt])*`,u2=new RegExp(String.raw`(?:=|\.\.\.)${Rc}state[ \t]*(?:[;,)}\]"]|\\[nr])`);d2=/<!--jx-slotted (\d+)-->/g;p2=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,m2=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,h2=/[\w$.]/u,g2=/[\w$]/u;_P=["hidden","tabIndex","title","lang","dir"],b2=new Set([..._P,"id","className"]),$2=new Set([...Rr,...b2,"textContent","innerHTML"]);Ls=new Set(["pre","textarea","listing","plaintext","xmp"]);S2=[];Bd=["import { AsyncDirective, directive } from 'lit-html/async-directive.js';","import { repeat } from 'lit-html/directives/repeat.js';"];w2=new Set(["$prototype","$src","$export","timing","default","description"]);HP=new Set(Tg);zP=Symbol("jx.styleHandle");Vx=new Set(["input","br","hr","img","meta","link","area","col","source"])});import{relative as E2,sep as P2}from"node:path";function Kc(e){return e===j2}function Na(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function ip(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 ij(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(ip(r,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((ip(r,"content")??"").toLowerCase().split(",").map((o)=>o.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function aj(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function O2(e,t){let n=t.trim().toLowerCase();for(let[r]of aj(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(ip(r,"rel")??"").toLowerCase().split(/\s+/),o=(ip(r,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&o===n)return!0}return!1}function lj(e,t){let{end:n}=aj(e);if(n===-1||O2(e,t.type))return e;let r=`<link href="${Fe(t.href)}" rel="alternate" type="${Fe(t.type)}">`;return`${e.slice(0,n)}${r}
|
|
310
|
+
${e.slice(n)}`}function cj(e,t){return new URL(`/${E2(e,t).split(P2).join("/")}`,"http://localhost").pathname}var j2="/404";var Xx=F(()=>{hn()});function uj(e,t){if(t===null||t.routing!=="prefix-always")return[];let n=[];for(let r of e){if(r.urlPattern==="/")continue;let s=r.urlPattern.split("/").find(Boolean),o=Zn(s);if(o===null||!t.locales.includes(o))n.push(r.urlPattern)}return n}function fj(e,t){if(t===null)return null;let n=e.split("/").find(Boolean),r=Zn(n);if(n===void 0||r===null||t.locales.includes(r))return null;let s=t.locales.find((o)=>o!==r&&o.split("-")[0]===r.split("-")[0]);return s===void 0?null:{meant:s,segment:n}}function dj(e,t,n,r){let s=new Map;if(t===null||n==="")return s;let o=new Map;for(let[i,a]of Yl(e,t).sets){if(a.length<2)continue;let l=o.get(a);if(l===void 0){l=a.map((u)=>({href:ao(Na(u.urlPattern,r),n),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:ao(Na(c.urlPattern,r),n),hreflang:"x-default"});o.set(a,l)}s.set(i,l)}return s}function pj({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 Gl(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var Yx=F(()=>{Tn();Cs();Xx();Cs();Cs();Cs()});function mj(e,t){if(!O(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function hj(e=[],t=[],n=[],r={}){let s=[{attributes:{charset:r.charset??io},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=Zx(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=ao(r.pageUrl,r.siteUrl);if(![...o.values()].some((c)=>V(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};o.set(Zx(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=Zx(l);if(!o.has(c))o.set(c,l)}return[...o.values()]}function Zx(e){if(!V(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=V(r)?JSON.stringify(r):r??"";return`style:${k2(s)}`}return`${t}:${JSON.stringify(e)}`}function k2(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 gj(e){return e.map((t)=>A2(t)).join(`
|
|
311
|
+
`)}function yj(e){let t=new Set;for(let n of e){if(!M(n))continue;let r=n.tagName;if(r==="title"){t.add(`$head: a <title> entry is discarded. The page title is the document's "title" property (site-architecture.md §8.1).`);continue}for(let s of Object.keys(n))if(!_2.has(s)&&!s.startsWith("$"))t.add(`$head: <${String(r)}> has a top-level "${s}", which is not rendered. A head element's HTML attributes go under "attributes" (site-architecture.md §8.1).`)}return[...t]}function A2(e){if(O(e))return e;if(!V(e))return"";let t=e.tagName,n=e.attributes??{},r=Object.entries(n).map(([l,c])=>c===!0?l:`${l}="${C2(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=V(i)?JSON.stringify(i,null,2):i??"";return`${s}${a}</${t}>`}function C2(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}var _2;var Qx=F(()=>{Tn();nc();ae();_2=new Set(["tagName","attributes","textContent","children"])});async function R2(e,t){let n=[],r=[],s=e;while(O(s)&&s!==""){if(n.includes(s))throw new $j([...n,s]);n.push(s);let o=await t(s);r.unshift({doc:o,ref:s}),s=V(o)?o.$layout:void 0}return r}function ap(e){let t={};if(O(e.title))t.title=e.title;let n=mj(Array.isArray(e.$head)?e.$head:[],e.description);if(n.length>0)t.head=n;if(O(e.$lang))t.lang=e.$lang;return t}async function Sj(e,t,n){let r=e.$layout??t.defaults?.layout??null;if(!r)return e;let[s,...o]=await R2(r,n),i=bj(s.doc);for(let a of o){let l=bj(a.doc);if(xj(i,l),l.$head)i.$head=[...i.$head??[],...l.$head]}return xj(i,e),delete i.$layout,i}function xj(e,t){let n=t.children??[],r=O(n)?[n]:Array.isArray(n)?n:[];if(T2(e,r),t.state)e.state={...e.state,...t.state};if(t.$media)e.$media={...e.$media,...t.$media};if(t.style)e.style={...e.style,...t.style};if(t.attributes)e.attributes={...e.attributes,...t.attributes}}function T2(e,t){let n=new Map,r=[];for(let s of t){let o=V(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)}wj(e,n,r)}function wj(e,t,n){if(!V(e))return;if(!Array.isArray(e.children))return;let r=[];for(let s of e.children)if(V(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 wj(s,t,n),r.push(s);e.children=r}function bj(e){return structuredClone(e)}var $j;var lp=F(()=>{ae();Qx();$j=class $j extends Error{name;constructor(e){super(`Layout cycle: ${e.join(" → ")}`);this.name="LayoutCycleError"}}});function eb(e){let t;for(let n of e)if(V(n)&&n.tagName==="meta"&&n.attributes?.name==="description"&&O(n.attributes.content))t=n.attributes.content;return t}function N2(e,t,n=null,r=null){if(!e.state)e.state={};let s={};if(n!==null)s.defaultLocale=n.defaultLocale,s.locales=n.locales;if(e.state.$site={...Object.fromEntries(Object.entries(t.state??{}).filter(([o])=>!J2.has(o))),name:t.name??"Jx Site",url:t.url??"",...s},t.state){for(let[o,i]of Object.entries(t.state))if(o!=="$site"&&o!=="$page"&&!(o in e.state))e.state[o]=i}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[o,i]of Object.entries(t.imports))if(!(o in e.imports))e.imports[o]=r&&(i.startsWith("./")||i.startsWith("../"))?r(i):i}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let o=new Set,i=[];for(let a of[...t.$elements,...e.$elements]){let l=O(a)?a:V(a)?a.$ref:void 0;if(l&&!o.has(l))o.add(l),i.push(a)}e.$elements=i}return e}function vj(e,t,n,r=null,s=null,o=[],i=ap(e)){N2(e,t,s,r===null?null:(d)=>r(d,n));let a=i.lang??Br(n.urlPattern,s)??t.defaults?.lang,l=o.map((d)=>({code:d.locale,current:d.urlPattern===n.urlPattern,dir:Gl(d.locale),label:Gv(d.locale),url:d.urlPattern})),c={params:n._pathParams??{},title:i.title??t.name??"Jx Site",url:n.urlPattern},u=eb(i.head??[]);if(u!==void 0)c.description=u;if(l.length>0)c.alternates=l;if(n.pagination){let{first:d,itemCount:p,last:m,next:g,number:y,pageCount:h,pageSize:x,pages:P,prev:S}=n.pagination;c.pagination={first:d,itemCount:p,last:m,next:g,number:y,pageCount:h,pageSize:x,pages:P.map(({current:v,number:E,url:w})=>({current:v,number:E,url:w})),prev:S}}if(a!==void 0)c.dir=Gl(a),c.locale=a;return e.state??={},e.state.$page=c,e}var J2;var tb=F(()=>{ae();Cs();lp();J2=new Set(["defaultLocale","locales","name","url"])});import{dirname as M2,relative as D2,resolve as I2}from"node:path";function nb(e){return(t,n)=>{if(!n.sourcePath)return t;return`./${D2(M2(n.sourcePath),I2(e,t))}`}}function Ej(e,t,n,r=null,s=null,o=[],i){return vj(e,t,n,r===null?null:nb(r),s,o,i)}var rb=F(()=>{tb()});function F2(e,t){let{body:n,headers:r,manual:s,method:o="GET",url:i}=e;if(s)throw Error("a manual Request has no build-time value");let a=V2(i,t),l;try{({protocol:l}=new URL(a))}catch{l=""}if(l!=="http:"&&l!=="https:")throw Error(`a build-time Request needs an absolute http(s) URL, got ${JSON.stringify(a)}`);let c=n?O(n)?n:JSON.stringify(n):void 0;return{init:{method:o,...r&&{headers:r},...c!==void 0&&{body:c}},key:JSON.stringify([o,a,r??null,c??null]),url:a}}function V2(e,t){let n=e!==void 0&&ce(e)?Kt(e,t):e;if(!O(n)||n===""||n.includes("undefined"))throw Error(`Request url ${JSON.stringify(e??null)} does not resolve at build time`);return n}async function Pj(e,t,n={}){let{init:r,key:s,url:o}=F2(e,t),i=n.timeoutMs??L2,a=n.cache?.get(s),l=a??q2(o,r,i);if(a===void 0)n.cache?.set(s,l);return structuredClone(await l)}async function q2(e,t,n){let r=Error(`no response within ${n/1000} s`),s;try{s=await fetch(e,{...t,signal:AbortSignal.timeout(n)})}catch(i){throw i instanceof DOMException&&i.name==="TimeoutError"?r:i}if(!s.ok)throw Error(`HTTP ${s.status} ${s.statusText}`.trimEnd());let o;try{o=await s.text()}catch(i){throw i instanceof DOMException&&i.name==="TimeoutError"?r:i}try{return JSON.parse(o)}catch{throw Error("response is not JSON")}}var L2=30000;var jj=F(()=>{ae();hn()});function Gc(e){let t=g0(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=W2(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,a=H2(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=B2(t.extends);if(u!==null)c.push(u,"");let d=r!=="Object"?` extends ${r}`:"";c.push(`class ${n}${d} {`);for(let[p,m]of Object.entries(o)){if(m.scope!=="static")continue;let g=m.identifier??p,y=m.access==="private"?"#":"",h=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` static ${y}${g} = ${h};`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;if(m.access!=="private")continue;let g=m.identifier??p;c.push(` #${g};`)}if(Object.keys(o).length>0)c.push("");if(c.push(" constructor(config = {}) {"),a?.superCall||r!=="Object"){let p=a?.superCall?.arguments?a.superCall.arguments.join(", "):"";c.push(` super(${p});`)}for(let[p,m]of Object.entries(o)){if(m.scope==="static")continue;let g=m.identifier??p,y=m.access==="private"?"#":"",h=m.initializer!==void 0?JSON.stringify(m.initializer):m.default!==void 0?JSON.stringify(m.default):"null";c.push(` this.${y}${g} = config.${g} !== undefined ? config.${g} : ${h};`)}if(a?.body){let p=Array.isArray(a.body)?a.body:[a.body];for(let m of p)c.push(` ${m}`)}c.push(" }");for(let[p,m]of Object.entries(l)){let g=m.identifier??p,y=m.scope==="static",x=m.access==="private"?"#":"",P=y?"static ":"",S=m.returnType?.$ref?.includes("Promise")||z2(m)?"async ":"",v=Oj(m.parameters??[]),E=U2(m.body);if(c.push(""),m.role==="accessor"){if(m.getter)c.push(` ${P}get ${x}${g}() {`,` ${m.getter.body}`," }");if(m.setter){let w=Oj(m.setter.parameters??[])||"v";c.push(` ${P}set ${x}${g}(${w}) {`,` ${m.setter.body}`," }")}}else{c.push(` ${P}${S}${x}${g}(${v}) {`);for(let w of E)c.push(` ${w}`);c.push(" }")}}return c.push("}","",`export { ${n} };`,`export default ${n};`,""),c.join(`
|
|
312
|
+
`)}function H2(e){return typeof e==="object"}function W2(e){if(!e)return"Object";if(O(e))return e;if(e.$ref){let t=e.$ref.match(kj);return t?t[1]:"Object"}return"Object"}function B2(e){if(!e||O(e)||!e.$ref)return null;let t=e.$ref.match(kj);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 Oj(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return O(n)?n:"arg"}).join(", ")}function U2(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function z2(e){return(Array.isArray(e.body)?e.body.join(`
|
|
313
|
+
`):e.body??"").includes("await ")}var kj;var sb=F(()=>{ca();ae();kj=/([A-Za-z0-9_]+)\.class\.json/});import{createHash as K2}from"node:crypto";import{mkdirSync as G2,readFileSync as X2,rmSync as Y2,writeFileSync as Z2}from"node:fs";import{createRequire as Q2}from"node:module";import{tmpdir as eV}from"node:os";import{dirname as Cj,join as _j,resolve as cp}from"node:path";import{pathToFileURL as tV}from"node:url";function up(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=cp(t.docDir??t.projectRoot,n);else r=Q2(cp(t.projectRoot,"package.json")).resolve(n);let s=Sl(X2(r,"utf8"),r);return{classDef:s,classJsonPath:r,exportName:e.$export??s.title??e.$prototype}}function Rj(e){let t=e.classDef.extends;if(t!==void 0&&!O(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 nV(e){Rj(e);let t=Gc(e.classDef),n=K2("sha256").update(t).digest("hex").slice(0,16),r=Aj.get(n);if(r===void 0){let s=_j(eV(),`jx-class-${process.pid}`);G2(s,{recursive:!0});let o=_j(s,`${e.classDef.title}-${n}.mjs`);Z2(o,t,"utf8"),r=import(tV(o).href).then((i)=>i.default).finally(()=>{Y2(o,{force:!0})}),Aj.set(n,r)}return r}async function Tj(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return nV(e);let s=await Fh(cp(Cj(n),t.$implementation)),o=s[r]??s.default?.[r];if(!$t(o))throw Error(`Module ${t.$implementation} does not export "${r}"`);return o}function rV(e){return"resolve"in e&&$t(e.resolve)}function sV(e){return"value"in e}async function Jj(e,t){let n=new e(t);if(rV(n))return{instance:n,value:await n.resolve()};if(sV(n))return{instance:n,value:n.value};return{instance:n,value:n}}function Nj(e){return JSON.stringify(e).includes('"#/$context/')}function Mj(e){let{classDef:t,classJsonPath:n,exportName:r}=e;if(!t.$implementation)return Rj(e),Gc(t);let s=Rv(cp(Cj(n),t.$implementation)),o=JSON.stringify(r);return[`import * as m from ${JSON.stringify(s)};`,`export default m[${o}] ?? m.default?.[${o}];`,""].join(`
|
|
314
|
+
`)}var Aj;var ob=F(()=>{ae();St();sb();Hr();Aj=new Map});import{dirname as Dj}from"node:path";async function Xc(e,t,n,r={}){let s={},{state:o}=e;if(!o)return s;let i=[],a={docDir:t.sourcePath?Dj(t.sourcePath):null,imports:e.imports,projectRoot:n,registry:r.registry},l=[],c=(u,d,p)=>{if(r.asInitialValues)o[u]={default:p??null};else{if(d.timing&&M(p))p.timing=d.timing;o[u]=p}s[u]=o[u]};for(let[u,d]of Object.entries(o)){if(!Cn(d))continue;let p=`"${u}" ($prototype "${d.$prototype}")`;if(iV(d)){if(d.$prototype==="Request")l.push([u,d]);else i.push(`${p}: has no build-time value; remove "timing" or use "client"`);continue}if(oV.has(d.$prototype))continue;if(d.timing&&d.timing!=="compiler"){let m=r.registry?.byName(d.$prototype);if(m?.capabilities.lower)try{let g=await m.call("lower",d,{projectConfig:r.config,root:n,route:t});if(M(g)){let y=g.$bundle;if(Array.isArray(y)){for(let h of y)if(O(h))r.registerBundle?.(h)}delete g.$bundle}o[u]=g,s[u]=g}catch(g){i.push(`${p}: its class could not lower it: ${ye(g)}`)}continue}try{let m=up(d,a);if(m===void 0){if(Gd(d))i.push(`${p} names no class: give it a $src or an imports entry, or enable the extension that provides "${d.$prototype}"`);continue}let g=await Tj(m),{value:y}=await Jj(g,aV(d,t,n,o,r));c(u,d,y)}catch(m){let g=d.timing?"":' (set "timing": "client" if it must run in the browser)';i.push(`${p}: ${ye(m)}${g}`)}}if(l.length>0){let u=fo(o);await Promise.all(l.map(async([d,p])=>{try{let m=await Pj(p,u,{cache:r.requestCache});c(d,p,m)}catch(m){i.push(`"${d}" ($prototype "Request"): ${ye(m)}`)}}))}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 iV(e){return e.timing==="compiler"&&!Gd(e)}function aV(e,t,n,r,s){let o={...Dx(e)};if(o.src&&!o.basePath&&t.sourcePath)o.basePath=Dj(t.sourcePath);return o._project={config:s.config??null,root:n,...s.sections},o._document={route:t,state:r},o}var oV;var ib=F(()=>{ae();St();hn();jj();ob();oV=new Set(["Function","LocalStorage","SessionStorage","Array"])});import{readFileSync as ab,readdirSync as lV,statSync as cV}from"node:fs";import{extname as Fj,join as uV,relative as fV,resolve as dV}from"node:path";async function rs(e,t){let n=ab(e,"utf8");if(fr(e))return Kr(Xn(n,e),e);let r=Fj(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 Kr(await s.parseDocument(n),e)}async function Vj(e,t){let n=new Map,r=new Map;for(let s of e){if(!r.has(s.sourcePath))r.set(s.sourcePath,await mV(s.sourcePath,t));let o=r.get(s.sourcePath);if(o!==null&&o!==void 0)n.set(s.urlPattern,pV(o,s._pathParams))}return n}function pV(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(n,r)=>t?.[r]??n)}async function mV(e,t){if(!ab(e,"utf8").includes("$translationKey"))return null;let n;try{n=await rs(e,t)}catch{return null}return O(n.$translationKey)&&n.$translationKey!==""?n.$translationKey:null}async function qj(e,t){let n=[],r=new Set([".json",".jxn",...t?.documentExtensions("page")??[]]);return await Wj(e,e,n,r,t),n.sort((s,o)=>o0(s,o)||mi(s.relativePath).localeCompare(mi(o.relativePath))),n}function Ij(e){return`pages/${mi(e.relativePath)}`}function Hj(e){let t=new Map,n=[],r=[];for(let s of e){let o=s.urlPattern.length>1?s.urlPattern.replace(/\/+$/,""):s.urlPattern,i=t.get(o);if(i===void 0){t.set(o,s),n.push(s);continue}let a=Ij(i),l=Ij(s),c="outranked",u=`${a} and ${l} both generate ${o}. ${a} is the more specific route, so it builds ${o} and ${l} does not.`;if(i.sourcePath===s.sourcePath)c="repeat",u=`The $paths of ${a} yields ${o} more than once; it is built once.`;else if(Cy(Qf(i.relativePath),Qf(s.relativePath))===0)c="tie",u=`${a} and ${l} both generate ${o}, and neither route is more specific than the other. Rename or remove one of them.`;r.push({dropped:l,kept:a,kind:c,message:u,url:o})}return{collisions:r,routes:n}}async function Wj(e,t,n,r,s){let o=lV(e,{withFileTypes:!0});for(let i of o){let a=uV(e,i.name);if(i.isDirectory()){if(i.name.startsWith("_"))continue;await Wj(a,t,n,r,s);continue}let l=Fj(i.name).toLowerCase();if(!r.has(l))continue;if(i.name.startsWith("_"))continue;let c=fV(t,a);n.push(await hV(c,a,s))}}async function hV(e,t,n){let{isCatchAll:r,isDynamic:s,params:o,urlPattern:i}=Qf(e),a=null;try{let c=(await rs(t,n)).$layout;if(O(c))a=c}catch{}return{$layout:a,isCatchAll:r,isDynamic:s,params:o,relativePath:e,sourcePath:t,urlPattern:i}}function gV(e){let t=e[fp];if(!M(t))return null;let{mtime:n}=t;return O(n)&&n!==""?n:null}function Bj(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 Uj(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 rs(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=y0(d.$paths)}catch(g){l(u,ye(g));continue}if(p!==null){let g=Br(u.urlPattern,o??null),y=p.each===void 0?[{}]:await Lj(p.each,t,n,r,s,g,u,c);for(let h of y){let x=await yV(u,d,p,h,{locale:g,projectConfig:s,projectRoot:t,registry:r,report:l,requestCache:i.requestCache,sections:n});a.push(...x)}continue}let m=await Lj(d.$paths,t,n,r,s,Br(u.urlPattern,o??null),u,c);for(let g of m){let y=u.urlPattern,h={};for(let[v,E]of Object.entries(g)){if(v===fp)continue;h[v]=String(E),y=y.replace(`:${v}`,h[v]),y=y.replace("*",h[v])}let x=Bj(y);if(x!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${y}", which ${x}; skipping it`);continue}let P=gV(g),S={...u,_pathParams:h,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:y};if(P!==null)S.sourceMtime=P;a.push(S)}}return a}function zj(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 yV(e,t,n,r,s){let o={};for(let[g,y]of Object.entries(r))if(g!==fp)o[g]=String(y);let i=e.params.filter((g)=>!(g in o));if(i.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${i.length}`),[];let a=i[0];if(t.state?.[n.key]===void 0)return s.report(e,`$paths.paginate names state entry "${n.key}", which this page does not declare`),[];let l=zj(e.urlPattern,o),c=Bj(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u;try{u=await bV(t,n.key,e,o,s)}catch(g){return s.report(e,ye(g)),[]}if(!Array.isArray(u))return s.report(e,`state entry "${n.key}" did not resolve to an array at build time`),[];let d=xV(u,e.sourcePath),p=Iy(u.length,n.pageSize),m=[];for(let g=1;g<=p;g++){let y={...e,_pathParams:{...o,[a]:String(g)},isCatchAll:!1,isDynamic:!1,pagedState:{items:x0(u,g,n.pageSize),key:n.key},pagination:b0(l,g,n.pageSize,u.length),params:[],urlPattern:hi(l,g)};if(d!==null)y.sourceMtime=d;m.push(y)}return m}function xV(e,t){let n=null,r=cV(t).mtime.getTime();for(let s of e){let o=M(s)?s[fp]:void 0,i=M(o)?o.mtime:void 0;if(O(i)&&Date.parse(i)>r)r=Date.parse(i),n=i}return n}async function bV(e,t,n,r,s){let o=e.state?.[t];if(o===void 0||Array.isArray(o))return o;let i={},a=nb(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:zj(n.urlPattern,r)};return await Xc(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},...s.requestCache&&{requestCache:s.requestCache},sections:s.sections}),l.state?.[t]}async function Lj(e,t,n,r,s,o,i,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=O(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&O(e.$ref)&&e.$ref){let l=e.$ref,c=dV(t,l),u;try{u=JSON.parse(ab(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${ye(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let d=O(e.param)?e.param:"id",p=O(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[d]:(M(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 fp="_meta";var lb=F(()=>{ca();ae();As();St();Ry();$0();Yx();rb();ib()});import{createHash as $V}from"node:crypto";function Kj(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function vi(e,t){let n=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return n?.[2]??n?.[3]}function cb(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function kV(e){return`'sha256-${$V("sha256").update(e,"utf8").digest("base64")}'`}function Gj(e,t){for(let n of e.matchAll(wV)){let r=n[1]??"",s=vi(r,"src"),o=(vi(r,"type")??"").trim().toLowerCase();if(s!==void 0){let i=cb(s);if(i)t.scriptOrigins.add(i);continue}if(SV.has(o))t.scriptHashes.add(kV(n[2]??""))}for(let n of e.matchAll(vV)){let r=n[1]??"",s=(vi(r,"rel")??"").toLowerCase(),o=vi(r,"href"),i=cb(o);if(!i)continue;if(s.includes("stylesheet"))t.styleOrigins.add(i);if(OV.test(o??"")||(vi(r,"as")??"")==="font")t.fontOrigins.add(i)}for(let[n,r]of[[EV,t.imgOrigins],[PV,t.imgOrigins],[jV,t.frameOrigins]])for(let s of e.matchAll(n)){let o=s[1]??"";for(let i of[vi(o,"src"),..._V(vi(o,"srcset"))]){let a=cb(i);if(a)r.add(a)}}}function _V(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function AV(e){if(e===!1)return!1;return e==="DENY"?"'none'":"'self'"}function Xj(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 Yj(e){return(Array.isArray(e)?e:[e]).flatMap((t)=>t.split(/\s+/)).filter(Boolean)}function Zj(e){let t=[],n=new Set(Object.keys(e.directives??{}).map((r)=>r.toLowerCase()));for(let[r,s]of Object.entries(e.sources??{})){let o=`build.headers.security.csp.sources["${r}"]`;if(!/^[A-Za-z][A-Za-z0-9-]*$/.test(r))t.push(`${o}: not a CSP directive name.`);if(n.has(r.toLowerCase()))t.push(`${o}: csp.directives also sets "${r}" and replaces it wholesale, so put the sources in that string, or remove one of the two.`);for(let i of Yj(s))if(/[;,]/.test(i))t.push(`${o}: "${i}" contains ";" or "," and would split the directive.`)}return t}function RV(e,t){let n=new Set(Object.keys(t.directives??{}).map((r)=>r.toLowerCase()));for(let[r,s]of Object.entries(t.sources??{})){let o=r.toLowerCase(),i=Yj(s);if(n.has(o)||i.length===0)continue;let a=e[o];if(a===void 0||a===!1){a="";for(let c of CV.get(o)??[]){let u=e[c];if(u!==void 0&&u!==!1){a=u;break}}}let l=a.split(/\s+/).filter(Boolean);for(let c of i)if(!l.includes(c))l.push(c);e[o]=l.filter((c)=>c!=="'none'").join(" ")}}function Qj(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":AV(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;RV(s,t);let o=Object.entries(s).filter(([,a])=>a!==!1&&a!=="").toSorted(([a],[l])=>a<l?-1:1).map(([a,l])=>`${a} ${String(l)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":o}:{"Content-Security-Policy":o};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var SV,wV,vV,EV,PV,jV,OV,CV;var ub=F(()=>{SV=new Set(["","module","importmap","text/javascript","module-shim","speculationrules"]),wV=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,vV=/<link\b([^>]*)>/gi,EV=/<img\b([^>]*)>/gi,PV=/<source\b([^>]*)>/gi,jV=/<iframe\b([^>]*)>/gi,OV=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i;CV=new Map([["child-src",["default-src"]],["connect-src",["default-src"]],["font-src",["default-src"]],["frame-src",["child-src","default-src"]],["img-src",["default-src"]],["manifest-src",["default-src"]],["media-src",["default-src"]],["object-src",["default-src"]],["prefetch-src",["default-src"]],["script-src",["default-src"]],["script-src-attr",["script-src","default-src"]],["script-src-elem",["script-src","default-src"]],["style-src",["default-src"]],["style-src-attr",["style-src","default-src"]],["style-src-elem",["style-src","default-src"]],["worker-src",["child-src","script-src","default-src"]]])});import{existsSync as dp,readFileSync as TV,writeFileSync as tO}from"node:fs";import{join as pp}from"node:path";function nO(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??eO,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=Xj(s);if(a)if(t===void 0)r.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else r.push(...Zj(a)),Object.assign(o,Qj(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=${eO}, immutable`},pattern:JV});for(let[u,d]of Object.entries(n.rules??{}))c.push({headers:d,pattern:u});return{errors:r,rules:c}}function rO(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(dp(pp(e,r)))n.push({headers:{"Content-Type":s},pattern:`/${r}`});if(dp(pp(e,"feed","archive")))n.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return n}function sO(e,t){if(t==="")return[...e];return e.map((n)=>({headers:n.headers,pattern:Le(t,n.pattern)}))}function DV(e){let t=e.map((n)=>{let r=Object.entries(n.headers).map(([s,o])=>` ${s}: ${o}`);return[n.pattern,...r].join(`
|
|
315
|
+
`)});return`${[NV,"",...t].join(`
|
|
272
316
|
`)}
|
|
273
|
-
`}function
|
|
274
|
-
${
|
|
317
|
+
`}function oO(e,t){if(t.length===0)return 0;let n=pp(e,"_headers"),r=dp(n)?TV(n,"utf8").trim():"",s=DV(t),o=r===""?s:`${s}
|
|
318
|
+
${MV}
|
|
275
319
|
${r}
|
|
276
|
-
`;return JE(n,o,"utf8"),1}function FE(e){let t=zf(e,".nojekyll");if(Uf(t))return 0;return JE(t,"","utf8"),1}var PL="/images/_optimized/*",NE=31536000,kL="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",_L="# ─── public/_headers (hand-authored; these rules override the block above) ───";var VE=M(()=>{hn();Iy()});async function qE(e,t,n,r={}){let s={},o=bm(e);for(let i of n.projectContributions()){let a=i.project?.key;if(!a||!i.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await i.call("projectData",t[a],{io:o,projectConfig:t,registry:n,root:e,...r.lazy===!0&&{lazy:!0},...r.includeHeld===!0&&{includeHeld:!0}})}return s}var HE=M(()=>{is()});import{cpSync as AL,existsSync as CL,mkdirSync as RL}from"node:fs";import{dirname as TL,resolve as NL}from"node:path";async function WE(e,t,n){let r=[],s=[],o=new Map;for(let i of e.assetProviders()){let a=i.project?.key,l=a?t[a]:void 0;if(a&&(l==null||F(l)&&Object.keys(l).length===0))continue;try{let c=await i.call("assets",l??null,{projectConfig:t,root:n});for(let u of c??[]){if(!F(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:Tu(u.urlPrefix)};if(Ot(u.filter))d.filter=u.filter;let p=o.get(d.urlPrefix);if(p){if(p.dir!==d.dir)s.push(`Asset mount conflict: "${d.urlPrefix}" is claimed by both "${p.dir}" and "${d.dir}"`);continue}o.set(d.urlPrefix,d),r.push(d)}}catch(c){s.push(`Error in ${i.name}.assets: ${ye(c)}`)}}return{errors:s,mounts:r}}function Kf(e,t,n){if(t.length===0||!e)return;for(let r of yw(e,t))n.add(r)}function BE(e,t,n){let r=0,s=[];for(let o of e){let i=Nu(t,o);if(!i||!CL(i)){s.push(o);continue}let a=NL(n,decodeURIComponent(o).replace(/^\//,""));RL(TL(a),{recursive:!0}),AL(i,a),r+=1}return{copied:r,missing:s}}var UE=M(()=>{hn();ae();Ft()});import{readFileSync as JL}from"node:fs";import{dirname as ML,isAbsolute as IL,relative as DL,resolve as zE,sep as LL}from"node:path";function Gf(e,t){return`${e}${t==="client"?Dy:Ly}`}function HL(e){if(e.endsWith(Dy))return{documentPath:e.slice(0,-Dy.length),side:"client"};if(e.endsWith(Ly))return{documentPath:e.slice(0,-Ly.length),side:"server"};return null}function ta(e,t,n){return vl(e,KE(t,n))}function KE(e,t){return DL(t,e).split(LL).join("/")}function WL(e){return Rn(JL(e,"utf8"),e)}function GE(e,t=WL){let n=new Map,r=(c)=>KE(c,e),s=(c)=>{let u=n.get(c);if(u===void 0)u=(async()=>t(c))(),n.set(c,u);return u},o=async(c,u)=>{let d;try{d=await s(c)}catch(b){throw Error(`Cannot read ${r(c)} for its ${u} script`,{cause:b})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(c)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...g]=pv(p).problems;if(m!==void 0)throw new Ku({path:r(c),pointer:`/$script/${u}`},[m,...g]);return p},i=(c)=>{let u=Li(c);if(u===null)return null;return{documentPath:zE(e,u.path),side:u.side}},a=(c)=>({name:`jx-document-scripts-${c}`,setup:(u)=>{u.onResolve({filter:VL},({path:d})=>{let p=i(d);if(p===null)return;if(p.side==="server"&&c==="client")throw Error(`${r(p.documentPath)}: its server script cannot be imported by code a browser runs`);return{path:Gf(p.documentPath,p.side)}}),u.onResolve({filter:qL},({importer:d,path:p})=>{if(IL(p))return{path:Gf(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:Gf(zE(ML(d),p),"client")}:void 0}),u.onLoad({filter:FL},async({path:d})=>{let p=HL(d);return{contents:await o(p.documentPath,p.side),loader:"ts"}})}}),l=async(c)=>{let u=i(c);if(u===null)throw Error(`"${c}" does not name a document's script`);return{contents:await o(u.documentPath,u.side),path:Gf(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:l,serverPlugin:a("server")}}var Dy=".jx-client.ts",Ly=".jx-server.ts",FL,VL,qL;var Xf=M(()=>{Gu();Fi();os();FL=/\.jx-(?:client|server)\.ts$/,VL=/^jx-script:/,qL=/\.jxn$/});import{existsSync as BL,readFileSync as UL}from"node:fs";import{resolve as XE}from"node:path";function YE(e){return(t)=>{let n=XE(e,t);if(!BL(n))throw Error(`Layout not found: ${t} (resolved to ${n})`);try{let r=Rn(UL(n,"utf8"),n);return ta(Cr(r,n),n,e)}catch(r){throw Error(`Invalid layout at ${n}: ${ye(r)}`,{cause:r})}}}function ZE(e,t,n){return oE(e,t,YE(n))}function Yf(e,t,n){let r=YE(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=XE(n,o);if(s.some((l)=>l.path===i))break;let a=r(o);s.push({doc:a,path:i}),o=a.$layout}return s}var Fy=M(()=>{Ai();Xf();os();Ft();qf()});import{existsSync as QE,readdirSync as zL}from"node:fs";import{dirname as KL,isAbsolute as GL,relative as XL,resolve as Vy}from"node:path";function YL(e){let{$elements:t}=e;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(L(r)&&_(r.$ref)&&r.$ref!=="")n.push(r.$ref);return n}async function ej(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,l=new Map,c=(m)=>XL(s,m).replaceAll("\\","/"),u=async(m,g)=>{if(a.has(m))return;let b=c(m),h=g?`${g.declarer}: $elements entry "${g.ref}" names`:"";if(g){if(b.startsWith("..")||GL(b)){a.add(m),i.push(`${h} ${b}, outside the project`);return}if(!QE(m)){a.add(m),i.push(`${h} no file (${b})`);return}}a.add(m);let x;try{x=ta(await gs(m,t),m,s)}catch(v){i.push(`Error compiling component ${b}: ${ye(v)}`);return}let k=_(x.tagName)?x.tagName:"";if(!k.includes("-")){i.push(g?`${h} ${b}, which is not a component (no hyphenated tagName)`:`Error compiling component ${b}: tagName "${k}" must contain a hyphen`);return}let w=l.get(k);if(w!==void 0){i.push(`${c(w)} and ${b} both declare tagName "${k}"; rename one`);return}l.set(k,m),o.push({doc:x,path:m,tagName:k}),await d(x,m)},d=async(m,g,b=KL(g))=>{for(let h of YL(m))await u(Vy(b,h),{declarer:c(g),ref:h})},p=Vy(s,"components");if(QE(p)){let m=[".json",...t.documentExtensions("component")],g=zL(p).filter((b)=>m.some((h)=>b.endsWith(h))).toSorted();for(let b of g)await u(Vy(p,b),null)}await d(r,Un(s),s);for(let m of new Set(n))try{let g=await gs(m,t),b=Yf(g,r,s);await d(g,m);for(let h of b)await d(h.doc,h.path)}catch{}return{components:o,errors:i}}var tj=M(()=>{ae();Ft();ko();Xf();Fy();Jy()});import{dirname as ZL,relative as QL,resolve as eF,sep as tF}from"node:path";function nj(e,t){return QL(t,e).split(tF).join("/")}function nF(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${nj(eF(t,e),n)}`}function Ul(e,t,n){let r=ZL(t),s=nj(t,n);return M0(e).map((o)=>({exportName:o.exportName,src:nF(o.src,r,n),declaredIn:s}))}function rj(e){let t=new Map;for(let{exportName:s,src:o,declaredIn:i}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(o))a.set(o,i)}let n=[],r=[];for(let[s,o]of t){let i=[...o];if(n.push({exportName:s,src:i[0][0]}),i.length>1){let a=i.map(([l,c])=>`${l} (declared in ${c})`);r.push(`Server function "${s}" is exported by ${i.length} different modules: ${a.join(", ")}. The site worker serves one function per export name, at /_jx/server/${s}, so a call meant for any but the first would get the first's answer. Rename the export in all but one module, and the $export that names it.`)}}return{entries:n,errors:r}}var sj=M(()=>{$n()});function oF(e){let t=e.indexOf(":");if(t===-1)return!1;if(t===e.length-1)return!1;try{return new URL(e).protocol!==""}catch{return!1}}function iF(e){if(!_(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!rF.has(n)&&!sF.has(n)&&!oF(t)})}function oj(e){let t=new Set;for(let n of e){if(!F(n)||n.tagName!=="link")continue;for(let r of iF(n.attributes?.rel))t.add(r)}return[...t]}var rF,sF;var ij=M(()=>{ae();rF=new Set(["about","acl","alternate","amphtml","api-catalog","appendix","apple-touch-icon","apple-touch-startup-image","archives","author","blocked-by","bookmark","c2pa-manifest","canonical","chapter","cite-as","collection","compression-dictionary","contents","convertedfrom","copyright","create-form","current","deprecation","describedby","describes","disclosure","dns-prefetch","dpp","duplicate","edit","edit-form","edit-media","enclosure","external","first","geofeed","glossary","help","hosts","hub","ice-server","icon","index","intervalafter","intervalbefore","intervalcontains","intervaldisjoint","intervalduring","intervalequals","intervalfinishedby","intervalfinishes","intervalin","intervalmeets","intervalmetby","intervaloverlappedby","intervaloverlaps","intervalstartedby","intervalstarts","item","last","latest-version","license","linkset","lrdd","manifest","mask-icon","me","media-feed","memento","micropub","modulepreload","monitor","monitor-group","next","next-archive","nofollow","noopener","noreferrer","opener","openid2.local_id","openid2.provider","original","p3pv1","payment","pingback","preconnect","predecessor-version","prefetch","preload","prerender","prev","prev-archive","preview","previous","privacy-policy","profile","publication","rdap-active","rdap-bottom","rdap-down","rdap-top","rdap-up","related","replies","restconf","ruleinput","search","section","self","service","service-desc","service-doc","service-meta","sip-trunking-capability","sponsored","start","status","stylesheet","subsection","successor-version","sunset","tag","terms-of-service","timegate","timemap","type","ugc","up","version-history","via","webmention","working-copy","working-copy-of"]),sF=new Set(["shortcut"])});function lF(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function na(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function a(l,c){let u,d;if(_(l)){let{readFileSync:I}=await import("node:fs"),{resolve:D}=await import("node:path");if(d=c?D(c,l):D(l),i.has(d))return;if(i.add(d),Bn(d))u=Rn(I(d,"utf8"),d);else{let{extname:V}=await import("node:path"),W=V(d).toLowerCase(),A=s?.byExtension(W,"parse");if(!A){await Promise.resolve().then(() => is());throw gu(d,W)}u=await A.parseDocument(I(d,"utf8"))}if(u=Cr(u,d),t.projectRoot!==void 0){let{relative:V}=await import("node:path");u=vl(u,V(t.projectRoot,d))}}else{if(u=Cr(l,l.tagName??"a component"),d=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}await t.prepareDocument?.(u,d);let p=u.state??{};u=xf(u,t.projectState);let{tagName:m}=u;if(!m||!m.includes("-"))throw Error(`compileElement: tagName "${m}" must contain a hyphen`);let{dirname:g}=await import("node:path"),b=d?g(d):null,h=[];if(Array.isArray(u.$elements))for(let I of u.$elements){let D=pe(I)?I.$ref:I;if(!_(D))continue;if(b)await a(D,b);let V=n?n(D,b):D.replace(/\.(?:json|jxn)$/i,".js");h.push(V)}let x=Ls(m);if(r)u.$media={...r,...u.$media};let{resolveClass:k,rewriteSrc:w}=t,v=u.imports??{},E=qy(u,x,h,w?(I)=>w(I,b):void 0,Jn(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((I)=>!(I in p)),k?(I)=>k(I,b,v):void 0,t.stylesheetHref?.(m)??null),O=d?d.replace(/\.(?:json|jxn)$/i,".js"):`${m}.js`;o.push({content:E,path:O,tagName:m})}return await a(e,t.basePath??null),{files:o}}async function cF(e,t={}){let{title:n="Jx App",reactivitySrc:r=Is,litHtmlSrc:s=Tr}=t,o=await na(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(i.path),c=`<!DOCTYPE html>
|
|
320
|
+
`;return tO(n,o,"utf8"),1}function iO(e){let t=pp(e,".nojekyll");if(dp(t))return 0;return tO(t,"","utf8"),1}var JV="/images/_optimized/*",eO=31536000,NV="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",MV="# ─── public/_headers (hand-authored; these rules override the block above) ───";var aO=F(()=>{Tn();ub()});import{cpSync as IV,existsSync as LV,mkdirSync as FV}from"node:fs";import{dirname as VV,resolve as qV}from"node:path";async function lO(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(!oo(i,t))continue;try{let c=await i.call("assets",l??null,{projectConfig:t,root:n});for(let u of c??[]){if(!V(u)||!u.urlPrefix||!u.dir)continue;let d={dir:u.dir,urlPrefix:Lf(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: ${ye(c)}`)}}return{errors:s,mounts:r}}function mp(e,t,n){if(t.length===0||!e)return;for(let r of fE(e,t))n.add(r)}function cO(e,t,n){let r=0,s=[];for(let o of e){let i=Ff(t,o);if(!i||!LV(i)){s.push(o);continue}let a=qV(n,decodeURIComponent(o).replace(/^\//,""));FV(VV(a),{recursive:!0}),IV(i,a),r+=1}return{copied:r,missing:s}}var uO=F(()=>{Tn();ae();St();Sf()});import{readFileSync as HV}from"node:fs";import{dirname as WV,isAbsolute as BV,relative as UV,resolve as fO,sep as zV}from"node:path";function hp(e,t){return`${e}${t==="client"?fb:db}`}function YV(e){if(e.endsWith(fb))return{documentPath:e.slice(0,-fb.length),side:"client"};if(e.endsWith(db))return{documentPath:e.slice(0,-db.length),side:"server"};return null}function Ei(e,t,n){return Ec(e,dO(t,n))}function dO(e,t){return UV(t,e).split(zV).join("/")}function ZV(e){return Xn(HV(e,"utf8"),e)}function pO(e,t=ZV){let n=new Map,r=(c)=>dO(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(y){throw Error(`Cannot read ${r(c)} for its ${u} script`,{cause:y})}let p=d.$script?.[u];if(p===void 0)throw Error(`${r(c)} has no ${u} script: nothing in it is $script.${u}, but something names its ${u} module`);let[m,...g]=d0(p).problems;if(m!==void 0)throw new td({path:r(c),pointer:`/$script/${u}`},[m,...g]);return p},i=(c)=>{let u=xa(c);if(u===null)return null;return{documentPath:fO(e,u.path),side:u.side}},a=(c)=>({name:`jx-document-scripts-${c}`,setup:(u)=>{u.onResolve({filter:GV},({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:hp(p.documentPath,p.side)}}),u.onResolve({filter:XV},({importer:d,path:p})=>{if(BV(p))return{path:hp(p,"client")};return p.startsWith("./")||p.startsWith("../")?{path:hp(fO(WV(d),p),"client")}:void 0}),u.onLoad({filter:KV},async({path:d})=>{let p=YV(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:hp(u.documentPath,u.side)}};return{clientPlugin:a("client"),module:l,serverPlugin:a("server")}}var fb=".jx-client.ts",db=".jx-server.ts",KV,GV,XV;var gp=F(()=>{nd();ba();As();KV=/\.jx-(?:client|server)\.ts$/,GV=/^jx-script:/,XV=/\.jxn$/});import{existsSync as QV,readFileSync as eq}from"node:fs";import{resolve as mO}from"node:path";function hO(e,t){return(n)=>{let r=mO(e,n);if(!QV(r))throw Error(`Layout not found: ${n} (resolved to ${r})`);try{let s=Xn(eq(r,"utf8"),r),o=Ei(Kr(s,r),r,e);return t?t(o,r):o}catch(s){throw Error(`Invalid layout at ${r}: ${ye(s)}`,{cause:s})}}}function gO(e,t,n,r){return Sj(e,t,hO(n,r))}function yp(e,t,n){let r=hO(n),s=[],o=e.$layout??t.defaults?.layout;while(o){let i=mO(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 pb=F(()=>{ca();gp();As();St();lp()});import{createHash as tq}from"node:crypto";import{relative as nq,resolve as rq}from"node:path";function yO(e,t){let n=nq(e,t).replaceAll("\\","/"),s=n.slice(n.lastIndexOf("/")+1).replace(/\.[^.]*$/u,"").toLowerCase().replaceAll(/[^a-z0-9]+/gu,"-").replaceAll(/^-+|-+$/gu,"")||"doc",o=tq("sha256").update(n,"utf8").digest("hex").slice(0,8);return`jx-case-${s}-${o}`}function Pi(e,t){if(Array.isArray(e)){for(let r of e)Pi(r,t);return}if(!M(e))return;let{cases:n}=e;if(M(n)&&e.$switch!==void 0)t(n);Pi(e.children,t),Pi(e.map,t)}function mb(e,t){let n=(r)=>{for(let[s,o]of Object.entries(r))if(de(o))t(s,o.$ref);else Pi(o,n)};Pi(e,n)}function xO(e,t,n){let r=[];if(mb(e,(i,a)=>{r.push(a)}),r.length===0)return e;let s=structuredClone(e),o=(i)=>{for(let[a,l]of Object.entries(i))if(de(l)){let c=n(rq(t,l.$ref));if(c===void 0)delete i[a];else i[a]={tagName:c}}else Pi(l,o)};return Pi(s,o),s}function xp(e,t){let n={...e};delete n.state,delete n.$defs,delete n.imports,delete n.$elements,delete n.$media,delete n.$id,delete n.$schema,delete n.$head,delete n.$layout;let r={$shadow:!1,children:[n],style:{display:"contents"},tagName:t};if(e.state!==void 0)r.state=e.state;if(e.$defs!==void 0)r.$defs=e.$defs;if(e.imports!==void 0)r.imports=e.imports;if(e.$elements!==void 0)r.$elements=e.$elements;if(e.$media!==void 0)r.$media=e.$media;if(e.$id!==void 0)r.$id=e.$id;return r}var bp=F(()=>{ae()});import{existsSync as hb,readdirSync as sq,statSync as oq}from"node:fs";import{dirname as gb,isAbsolute as bO,relative as iq,resolve as Yc}from"node:path";function $O(e){let{$elements:t}=e;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(M(r)&&O(r.$ref)&&r.$ref!=="")n.push(r.$ref);return n}async function SO(e){let{formatRegistry:t,pageSources:n,projectConfig:r,projectRoot:s}=e,o=[],i=[],a=new Set,l=new Map,c=[],u=new Map,d=new Map,p=new Map,m=new Set,g=(w)=>iq(s,w).replaceAll("\\","/"),y=async(w,R)=>{if(a.has(w))return;let C=g(w),J=R?`${R.declarer}: $elements entry "${R.ref}" names`:"";if(R){if(C.startsWith("..")||bO(C)){a.add(w),i.push(`${J} ${C}, outside the project`);return}if(!hb(w)){a.add(w),i.push(`${J} no file (${C})`);return}}a.add(w);let D;try{D=Ei(await rs(w,t),w,s)}catch(ne){i.push(`Error compiling component ${C}: ${ye(ne)}`);return}let A=O(D.tagName)?D.tagName:"";if(!A.includes("-")){i.push(R?`${J} ${C}, which is not a component (no hyphenated tagName)`:`Error compiling component ${C}: tagName "${A}" must contain a hyphen`);return}let L=l.get(A);if(L!==void 0){i.push(`${g(L)} and ${C} both declare tagName "${A}"; rename one`);return}l.set(A,w);let K={doc:D,path:w,tagName:A};o.push(K),p.set(w,K),await v(D,w),await S(w,D,A)},h=(w,R)=>{let C=d.get(w)??[];if(!C.includes(R)&&w!==R)C.push(R);d.set(w,C)},x=(w,R,C)=>{for(let J of $O(w)){let D=p.get(Yc(gb(R),J));if(D&&!C.has(D.tagName))C.add(D.tagName),x(D.doc,D.path,C)}return C},P=(w,R,C,J)=>{let D=`${g(w)}: $switch case "${R}" names ${C}, ${J}`;if(!m.has(D))m.add(D),i.push(D)},S=async(w,R,C)=>{let J=[];mb(R,(D,A)=>{J.push([D,A])});for(let[D,A]of J){if(/^[a-z][a-z0-9+.-]*:/iu.test(A)){P(w,D,A,"a URL, which a build cannot compile");continue}let L=Yc(gb(w),A),K=g(L);if(K.startsWith("..")||bO(K)){P(w,D,A,`outside the project (${K})`);continue}if(!hb(L)||!oq(L).isFile()){P(w,D,A,`which is not a file (${K})`);continue}let ne=u.get(L);if(ne===void 0){let B;try{B=Ei(await rs(L,t),L,s)}catch(U){P(w,D,A,`which does not read (${K}): ${ye(U)}`);continue}ne=yO(s,L),u.set(L,ne),c.push({doc:B,path:L,tagName:ne}),await v(B,L);for(let U of x(B,L,new Set))h(ne,U);await S(L,B,ne)}if(C!==null)h(C,ne)}},v=async(w,R,C=gb(R))=>{for(let J of $O(w))await y(Yc(C,J),{declarer:g(R),ref:J})},E=Yc(s,"components");if(hb(E)){let w=[".json",...t.documentExtensions("component")],R=sq(E).filter((C)=>w.some((J)=>C.endsWith(J))).toSorted();for(let C of R)await y(Yc(E,C),null)}await v(r,dr(s),s);for(let w of new Set(n))try{let R=await rs(w,t),C=yp(R,r,s);await v(R,w),await S(w,R,null);for(let J of C)await v(J.doc,J.path),await S(J.path,J.doc,null)}catch{}return{caseReach:d,cases:c,components:o,errors:i}}var wO=F(()=>{ae();St();so();gp();pb();lb();bp()});import{dirname as aq,relative as lq,resolve as cq,sep as uq}from"node:path";function vO(e,t){return lq(t,e).split(uq).join("/")}function fq(e,t,n){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${vO(cq(t,e),n)}`}function Zc(e,t,n){let r=aq(t),s=vO(t,n);return ZP(e).map((o)=>({exportName:o.exportName,src:fq(o.src,r,n),declaredIn:s}))}function EO(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 PO=F(()=>{hn()});function mq(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 hq(e){if(!O(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let n=t.toLowerCase();return!dq.has(n)&&!pq.has(n)&&!mq(t)})}function jO(e){let t=new Set;for(let n of e){if(!V(n)||n.tagName!=="link")continue;for(let r of hq(n.attributes?.rel))t.add(r)}return[...t]}var dq,pq;var OO=F(()=>{ae();dq=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"]),pq=new Set(["shortcut"])});function yq(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function Ma(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set,a=!0;async function l(c,u){let d=a;a=!1;let p,m;if(O(c)){let{readFileSync:D}=await import("node:fs"),{resolve:A}=await import("node:path");if(m=u?A(u,c):A(c),i.has(m))return;if(i.add(m),fr(m))p=Xn(D(m,"utf8"),m);else{let{extname:L}=await import("node:path"),K=L(m).toLowerCase(),ne=s?.byExtension(K,"parse");if(!ne){await Promise.resolve().then(() => Hr());throw $f(m,K)}p=await ne.parseDocument(D(m,"utf8"))}if(p=Kr(p,m),t.projectRoot!==void 0){let{relative:L}=await import("node:path");p=Ec(p,L(t.projectRoot,m))}if(t.transformDocument)p=t.transformDocument(p,m)}else{if(p=Kr(c,c.tagName??"a component"),m=null,p.tagName&&i.has(p.tagName))return;if(p.tagName)i.add(p.tagName)}let g=d&&t.caseTag!==void 0;if(g)p=xp(p,t.caseTag);await t.prepareDocument?.(p,m);let y=p.state??{};p=Jd(p,t.projectState);let{tagName:h}=p;if(!h||!h.includes("-"))throw Error(`compileElement: tagName "${h}" must contain a hyphen`);va(p);let{dirname:x}=await import("node:path"),P=m?x(m):null,S=[];if(Array.isArray(p.$elements))for(let D of p.$elements){let A=de(D)?D.$ref:D;if(!O(A))continue;if(P)await l(A,P);let L=n?n(A,P):A.replace(/\.(?:json|jxn)$/i,".js");S.push(L)}let v=ho(h);if(r)p.$media={...r,...p.$media};let{resolveClass:E,rewriteSrc:w}=t,R=p.imports??{},C=yb(p,v,S,w?(D)=>w(D,P):void 0,er(p,t.defaults),t.serverBaseUrl,Object.keys(p.state??{}).filter((D)=>!(D in y)),E?(D)=>E(D,P,R):void 0,t.stylesheetHref?.(h)??null,t.caseModules,g),J=m?m.replace(/\.(?:json|jxn)$/i,".js"):`${h}.js`;o.push({content:C,path:J,tagName:h})}return await l(e,t.basePath??null),{files:o}}async function xq(e,t={}){let{title:n="Jx App",reactivitySrc:r=po,litHtmlSrc:s=es}=t,o=await Ma(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>
|
|
277
321
|
<html lang="en">
|
|
278
322
|
<head>
|
|
279
323
|
<meta charset="utf-8">
|
|
280
324
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
281
|
-
<title>${
|
|
282
|
-
${
|
|
325
|
+
<title>${Fe(n)}</title>
|
|
326
|
+
${Ea({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
283
327
|
</head>
|
|
284
328
|
<body>
|
|
285
329
|
<${i.tagName}></${i.tagName}>
|
|
286
330
|
<script type="module" src="./${l}"></script>
|
|
287
331
|
</body>
|
|
288
|
-
</html>`;return{files:o.files,html:c}}function uF(e){if(!F(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(vs(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Xi(e))return"null";if(Zr(e))return"null";return JSON.stringify(e)}function qy(e,t,n,r,s=null,o="/_jx/server",i=[],a,l=null){let c=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)c.push(`// Source: ${e.$id}`);for(let U of n)c.push(`import '${U}';`);let u=e.state??{},d=Ar(e),p=Sf($f(u,d),r);c.push(...p.imports);let m=Rf(u,a),g=m.entries.length>0;c.push(...m.imports);let b=Object.entries(u).flatMap(([U,H])=>An(H)&&H.$prototype==="Request"?[[U,H]]:[]),h=Object.entries(u).flatMap(([U,H])=>Zr(H)?[[U,H]]:[]),x=Ef(e);if(c.push(x.keyed?"import { reactive, computed, effect, stop, shallowRef } from '@vue/reactivity';":"import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",...x.keyed?kf:[],vf()),x.arranged||x.keyed)c.push(Pf());if(x.keyed)c.push(_f());let k=Object.keys(u).filter((U)=>!si(U)),w=k.filter((U)=>!aF.has(U)),v=w.filter((U)=>i.includes(U)),E=v.length>0;c.push(`const __jxProps = ${JSON.stringify(k)};`);let O=Bg(e),I=w.filter((U)=>O.has(U));if(w.length>0)c.push(`const __jxBridged = ${JSON.stringify(w)};`,v0());if(I.length>0)c.push(`const __jxDerived = new Set(${JSON.stringify(I)});`);if(E)c.push(`const __jxInherited = new Set(${JSON.stringify(v)});`);let D=Dl(e);if(D.length>0)c.push(E0(),`const __jxObserved = ${JSON.stringify(D)};`,`const __jxObservedDefaults = () => ${P0(e)};`);if(h.length>0)c.push(Af());if(g)c.push(Cf());let V=s===null&&Ms(e.children);if(V)c.push(A0());let W=e.formAssociated===!0;if(W)c.push(O0());c.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...x.keyed?[" #part = null;"]:[],...s===null?[]:[" #root = null;"],...W?[" #internals;"," #form = null;"]:[],...g?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...D.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[],...W?[" static formAssociated = true;",""," #attach() {"," if (this.#internals === undefined) {"," this.#internals = typeof this.attachInternals === 'function' ? this.attachInternals() : null;"," }"," return this.#internals;"," }",""]:[]," constructor() {"," super();");let A=[],J=[],G=[],se=[],ie=[];for(let[U,H]of Object.entries(u))if(pn(H))if(wr(H))se.push([U,H]);else if(hr(H.$expression.operator))G.push([U,H]);else J.push([U,H]);else if(At(H))(d.get(U)==="computed"?J:G).push([U,H]);else if(_(H)&&H.includes("${"))ie.push([U,H]);else{let K=uF(H);if(K!==void 0)A.push([U,K])}c.push(" this.state = reactive({");for(let[U,H]of A)c.push(` ${fs(U)}: ${H},`);c.push(" });");for(let[U,H]of G)if(c.push(""),pn(H)){let K=bn(H.$expression,{eventParam:"e",statePrefix:"s"});c.push(` ${Je("this.state",Ut(U))} = (s, e) => { ${K}; };`)}else if(vr(H)){let K=Yn(H.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});c.push(` ${Je("this.state",Ut(U))} = (s, e) => {`,K," };")}else{let K=Je("this.state",Ut(U));if(H.$src)c.push(` ${K} = ${U};`);else{let He=_(H.body)?H.body:"";c.push(` ${K} = (${Or(H).join(", ")}) => {`,` ${He}`," };")}}for(let[U,H]of se){c.push("");let K=bn(H.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Je("this.state",Ut(U))} = ${Tl(H,K)};`)}for(let[U,H]of ie){let K=zi(H,"this.state",{code:!1}),He=wf(K);c.push("",td(K)?` ${Je("this.state",Ut(U))} = computed(() => { const state = this.state; return ${He}; });`:` ${Je("this.state",Ut(U))} = computed(() => ${He});`)}for(let[U,H]of J)if(c.push(""),pn(H)){let K=bn(H.$expression,{eventParam:"e",statePrefix:"this.state"});c.push(` ${Je("this.state",Ut(U))} = computed(() => ${K});`)}else if(H.$src)c.push(` ${Je("this.state",Ut(U))} = computed(() => ${U}(this.state));`);else{c.push(` ${Je("this.state",Ut(U))} = computed(() => {`);let K=zi(_(H.body)?H.body:"","this.state");c.push(` ${K}`," });")}let le=fF(e);if(le.length>0){c.push(""," {"," const s = this.state;");for(let{type:U,source:H}of le)c.push(` this.addEventListener(${JSON.stringify(U)}, ${H});`);c.push(" }")}c.push(" }","");let te={n:0};for(let U of Jf(e))T0(U,te,e.tagName??"jx");let de=cj(),xe=!Array.isArray(e.children)&&e.textContent!==void 0?` ${nd(e.textContent)}`:Qf(e.children,e.style," ",!1,!1,de),X=[xe,...de.decls].some((U)=>td(U));if(c.push(" template() {"," const s = this.state;",...X?[" const state = s;"]:[],...de.decls," return html`",xe," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?W?" const _a = this.#attach()?.shadowRoot ?? null;":" const _a = this.attachInternals().shadowRoot;":" const _a = this.shadowRoot;",` this.#root = _a ?? this.attachShadow({ mode: '${s}' });`,...l===null?[]:[` if (!_a) this.#root.append(Object.assign(document.createElement('link'), { rel: 'stylesheet', href: ${lF(l)} }));`]," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...x.keyed?[" this.#part?.setConnected(true);"]:[],...E?[" const _given = new Set();"]:[],...D.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${Of}(this.state, _a, this.getAttribute(_a), _d);`," }"," }"]:[]," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;",E?" if (__jxProps.includes(k)) { this.state[k] = v; _given.add(k); }":" if (__jxProps.includes(k)) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (__jxProps.includes(_k)) {"," this.state[_k] = this.getAttribute(_n);",...E?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),w.length>0)c.push(" if (_first) {"," for (const _k of __jxBridged) {",...I.length>0?[" if (__jxDerived.has(_k)) continue;"]:[],` if (_k in this && this[_k] !== undefined && ${iy}(this, _k)) {`," this.state[_k] = this[_k];",...E?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...E?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],...I.length>0?[" if (__jxDerived.has(_k)) {"," Object.defineProperty(this, _k, { configurable: true, get: () => this.state[_k] });"," continue;"," }"]:[],` const _set = ${ay}(this, _k);`," Object.defineProperty(this, _k, {"," configurable: true,"," get: () => this.state[_k],"," set: (v) => { if (_set) _set.call(this, v); this.state[_k] = v; },"," });"," }"," }");if(g)c.push(` this.#jxReady ??= ${Tf(m.entries,{indent:" ",instances:"this.#jxInstances",statePrefix:"this.state"})};`," const _c = ++this.#jxConnection;"," this.#jxReady.then(() => {"," if (_c === this.#jxConnection && this.isConnected) this.#jxRender();"," });"," }",""," #jxRender() {"," const _first = !this.#jxDrawn;"," this.#jxDrawn = true;");for(let[U,H]of b)c.push(hf(U,H,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[U,H]of h)c.push(gf(U,H,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(c.push(...dF(e)),F(e.style)){let U=[];for(let[H,K]of Object.entries(e.style)){if(H.startsWith(":")||H.startsWith(".")||H.startsWith("&")||H.startsWith("[")||H.startsWith("@"))continue;if(_(K)&&K.includes("${"))U.push([xn(H),K])}if(U.length>0){c.push(" this.#effects.push(effect(() => {");for(let[H,K]of U){let He=K.replaceAll(/\$\{([^}]+)\}/g,(Ve,Ze)=>`\${${zi(Ze,"this.state")}}`);c.push(` this.style['${H}'] = \`${He}\`;`)}c.push(" }));")}}if(V)c.push(` const _slotted = _first ? ${fy}(this) : null;`);if(c.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)c.push(" if (_first) this.replaceChildren();",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), this); }));":" this.#effects.push(effect(() => render(this.template(), this)));");else c.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }",x.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), _root); }));":" this.#effects.push(effect(() => render(this.template(), _root)));");if(V)c.push(` if (_first) ${dy}(this, _slotted);`);if(W)c.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${uy}(this, _i, this.state, ${JSON.stringify(t0(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${pF(e.formValue)}, (fn) => { this.#effects.push(effect(fn)); });`," }"," }"," if (this.#form) this.#form.start();");if(c.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {",...x.keyed?[" this.#part?.setConnected(false);"]:[]," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }"),"onAdopted"in u)c.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(W)c.push(""," formResetCallback() { if (this.#form) this.#form.reset(); }",""," formDisabledCallback(disabled) { if (this.#form) this.#form.disabled(disabled); }");if(D.length>0)c.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${Of}(this.state, name, newVal, __jxObservedDefaults());`," }");return c.push("}","",`customElements.define('${e.tagName}', ${t});`,""),c.join(`
|
|
289
|
-
`)}function cj(){return{byText:new Map,decls:[]}}function uj(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
|
|
332
|
+
</html>`;return{files:o.files,html:c}}function bq(e){if(!V(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(ar(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Ca(e))return"null";if(vs(e))return"null";return JSON.stringify(e)}function yb(e,t,n,r,s=null,o="/_jx/server",i=[],a,l=null,c,u=!1){let d=ss;ss={modules:c??new Map,needsLoader:!1,warned:new Set};try{return $q(e,t,n,r,s,o,i,a,l,u).replace(AO,ss.needsLoader?`
|
|
333
|
+
${Vd()}`:"")}finally{ss=d}}function $q(e,t,n,r,s,o,i,a,l,c){let u=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)u.push(`// Source: ${e.$id}`);for(let q of n)u.push(`import '${q}';`);let d=e.state??{};for(let[q,Q]of Object.entries(d))Xd(q,Q);Ax(d);let p=sn(e),m=Dd(Md(d,p),r);u.push(...m.imports);let g=Zd(d,a),y=g.entries.length>0;u.push(...g.imports);let h=Object.entries(d).flatMap(([q,Q])=>Cn(Q)&&Q.$prototype==="Request"?[[q,Q]]:[]),x=Object.entries(d).flatMap(([q,Q])=>vs(Q)?[[q,Q]]:[]),P=qd(e),S=["reactive","computed","effect","stop"];if(P.keyed)S.push("shallowRef");if(h.some(([,q])=>!q.manual))S.push("onEffectCleanup");if(u.push(`import { ${S.join(", ")} } from '@vue/reactivity';`,"import { render, html, nothing } from 'lit-html';",...P.keyed?Bd:[],Fd(),AO.slice(1)),_d(d))u.push(Od());if(P.arranged||P.keyed)u.push(Wd());if(P.keyed)u.push(Ud());let v=Object.keys(d).filter((q)=>!Ni(q)),E=v.filter((q)=>!gq.has(q)),w=E.filter((q)=>i.includes(q)),R=w.length>0;u.push(`const __jxProps = ${JSON.stringify(v)};`);let C=mx(e,p),J=E.filter((q)=>C.has(q));if(E.length>0)u.push(`const __jxBridged = ${JSON.stringify(E)};`,IP());if(J.length>0)u.push(`const __jxDerived = new Set(${JSON.stringify(J)});`);if(R)u.push(`const __jxInherited = new Set(${JSON.stringify(w)});`);let D=Hc(e);if(D.length>0)u.push(LP(),`const __jxObserved = ${JSON.stringify(D)};`,`const __jxObservedDefaults = () => ${VP(e)};`);if(x.length>0)u.push(Kd());if(y)u.push(Yd());let A=s===null&&uo(e.children);if(A)u.push(UP());let L=e.formAssociated===!0;if(L)u.push(BP());u.push(...m.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...P.keyed?[" #part = null;"]:[],...s===null?[]:[" #root = null;"],...L?[" #internals;"," #form = null;"]:[],...y?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...D.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[],...L?[" static formAssociated = true;",""," #attach() {"," if (this.#internals === undefined) {"," this.#internals = typeof this.attachInternals === 'function' ? this.attachInternals() : null;"," }"," return this.#internals;"," }",""]:[]," constructor() {"," super();");let K=[],ne=[],B=[],U=[],Z=[];for(let[q,Q]of Object.entries(d))if(ln(Q))if(An(Q))U.push([q,Q]);else if(Cr(Q.$expression.operator))B.push([q,Q]);else ne.push([q,Q]);else if(Dt(Q))(p.get(q)==="computed"?ne:B).push([q,Q]);else if(O(Q)&&Q.includes("${"))Z.push([q,Q]);else{let pe=bq(Q);if(pe!==void 0)K.push([q,pe])}u.push(" this.state = reactive({");for(let[q,Q]of K)u.push(` ${Gr(q)}: ${Q},`);u.push(" });");for(let[q,Q]of B)if(u.push(""),ln(Q)){let pe=pn(Q.$expression,{eventParam:"e",statePrefix:"s"});u.push(` ${Ae("this.state",Jt(q))} = (s, e) => { ${pe}; };`)}else if(cn(Q)){let pe=Ms(Q.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});if(Array.isArray(Q.parameters)&&Q.parameters.length>0)u.push(` ${Ae("this.state",Jt(q))} = ${Ad(Q,pe)};`);else{let Ke=si.has(q);u.push(` ${Ae("this.state",Jt(q))} = ${Ke?"async (s)":"async (s, e)"} => {`,...Ke?[" const e = null;"]:[],pe," };")}}else{let pe=Ae("this.state",Jt(q));if(Q.$src)u.push(` ${pe} = ${q};`);else{let Ke=O(Q.body)?Q.body:"";u.push(` ${pe} = (${zr(Q).join(", ")}) => {`,` ${Ke}`," };")}}for(let[q,Q]of U){u.push("");let pe=pn(Q.$expression,{eventParam:"e",statePrefix:"this.state"});u.push(` ${Ae("this.state",Jt(q))} = ${jd(Q,pe)};`)}for(let[q,Q]of Z){let pe=ka(Q,"this.state",{code:!1}),Ke=Ld(pe);u.push("",vp(pe)?` ${Ae("this.state",Jt(q))} = computed(() => { const state = this.state; return ${Ke}; });`:` ${Ae("this.state",Jt(q))} = computed(() => ${Ke});`)}for(let[q,Q]of ne)if(u.push(""),ln(Q)){let pe=pn(Q.$expression,{eventParam:"e",statePrefix:"this.state"});u.push(` ${Ae("this.state",Jt(q))} = computed(() => ${pe});`)}else if(Q.$src)u.push(` ${Ae("this.state",Jt(q))} = computed(() => ${q}(this.state));`);else{u.push(` ${Ae("this.state",Jt(q))} = computed(() => {`);let pe=ka(O(Q.body)?Q.body:"","this.state");u.push(` ${pe}`," });")}let le=wq(e);if(le.length>0){u.push(""," {"," const s = this.state;");for(let{type:q,source:Q}of le)u.push(` this.addEventListener(${JSON.stringify(q)}, ${Q});`);u.push(" }")}u.push(" }","");let we={n:0};for(let q of tp(e))GP(q,we,e.tagName??"jx");let Y=CO(),$e=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Ep(e.textContent)}`:Sp(e.children,e.style," ",!1,!1,Y),me=[$e,...Y.decls].some((q)=>vp(q));if(u.push(" template() {"," const s = this.state;",...me?[" const state = s;"]:[],...Y.decls," return html`",$e," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?L?" 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: ${yq(l)} }));`]," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...P.keyed?[" this.#part?.setConnected(true);"]:[],...R?[" const _given = new Set();"]:[],...D.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${zd}(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;",R?" 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);",...R?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),E.length>0)u.push(" if (_first) {"," for (const _k of __jxBridged) {",...J.length>0?[" if (__jxDerived.has(_k)) continue;"]:[],` if (_k in this && this[_k] !== undefined && ${Nx}(this, _k)) {`," this.state[_k] = this[_k];",...R?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...R?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],...J.length>0?[" if (__jxDerived.has(_k)) {"," Object.defineProperty(this, _k, { configurable: true, get: () => this.state[_k] });"," continue;"," }"]:[],` const _set = ${Mx}(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)u.push(` this.#jxReady ??= ${Qd(g.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[q,Q]of h)u.push(Cd(q,Q,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[q,Q]of x)u.push(Rd(q,Q,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(u.push(...vq(e)),V(e.style)){let q=[];for(let[Q,pe]of Object.entries(e.style)){if(Q.startsWith(":")||Q.startsWith(".")||Q.startsWith("&")||Q.startsWith("[")||Q.startsWith("@"))continue;if(O(pe)&&pe.includes("${"))q.push([Mn(Q),pe])}if(q.length>0){u.push(" this.#effects.push(effect(() => {");for(let[Q,pe]of q){let Ke=pe.replaceAll(/\$\{([^}]+)\}/g,(re,Mt)=>`\${${ka(Mt,"this.state")}}`);u.push(` this.style['${Q}'] = \`${Ke}\`;`)}u.push(" }));")}}if(A)u.push(` const _slotted = _first ? ${Lx}(this) : null;`);if(u.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)u.push(" if (_first) this.replaceChildren();",P.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), this); }));":" this.#effects.push(effect(() => render(this.template(), this)));");else u.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }",P.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), _root); }));":" this.#effects.push(effect(() => render(this.template(), _root)));");if(A)u.push(` if (_first) ${Fx}(this, _slotted);`);if(L)u.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${Ix}(this, _i, this.state, ${JSON.stringify(Q0(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${Eq(e.formValue)}, (fn) => { this.#effects.push(effect(fn)); });`," }"," }"," if (this.#form) this.#form.start();");if(u.push(" if (_first && typeof this.state.onMount === 'function') {",c?" queueMicrotask(() => this.state.onMount(this.state));":" queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {",...P.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 d)u.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(L)u.push(""," formResetCallback() { if (this.#form) this.#form.reset(); }",""," formDisabledCallback(disabled) { if (this.#form) this.#form.disabled(disabled); }");if(D.length>0)u.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${zd}(this.state, name, newVal, __jxObservedDefaults());`," }");return u.push("}","",`customElements.define('${e.tagName}', ${t});`,""),u.join(`
|
|
334
|
+
`)}function CO(){return{byText:new Map,decls:[]}}function RO(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
|
|
290
335
|
${t}
|
|
291
|
-
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function
|
|
292
|
-
`})}function
|
|
336
|
+
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function Sp(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let a=i?Ra:"";if(qe(e))return`${_O(e,n)}${a}`;if(!Array.isArray(e))return"";return an(e.map((l)=>{if(qe(l))return`${_O(l,n)}${a}`;let c=xb(l,r?"":n,r,s,o);return O(l)&&l.includes("${")||V(l)&&Kn(l.tagName)?`${c}${a}`:c}),{lead:n,preformatted:r,separator:`
|
|
337
|
+
`})}function xb(e,t,n=!1,r=!1,s=null,o=null){if(O(e)){if(e.includes("${"))return`${t}${Ep(e)}`;return`${t}${Fe(e)}`}if(Ve(e)||tt(e))return`${t}${Fe(String(e))}`;if(!V(e))return"";if(Kn(e.tagName)){let h=e.tagName.$expression,x=Xr(h.target,{eventParam:"e",statePrefix:"s"}),P=h.operator==="?:"?[[!0,h.value],[!1,h.initial]]:[...Object.entries(h.cases),["__default__",h.default]],S=P.map(([,J])=>J),v=S.map((J)=>n||Ls.has(J)),E=null;if(s&&v.every((J)=>J===v[0])){let J=kO(e,`${t} `,v[0]===!0,r,s,S.some((D)=>D.includes("-")));if(J.trim()!=="")E=RO(s,J)}let w=P.map(([J,D])=>{let A={...e,tagName:D};return[J,xb(A,`${t} `,n,r,s,E)]});if(h.operator==="?:"){let[,J]=w[0],[,D]=w[1];return`${t}\${${x}
|
|
293
338
|
? html\`
|
|
294
|
-
${
|
|
339
|
+
${J}
|
|
295
340
|
\`
|
|
296
341
|
: html\`
|
|
297
|
-
${
|
|
298
|
-
\`}`}let
|
|
299
|
-
${
|
|
300
|
-
\``]),[,
|
|
301
|
-
${
|
|
342
|
+
${D}
|
|
343
|
+
\`}`}let R=w.flatMap(([J,D])=>J==="__default__"?[]:[` ${JSON.stringify(J)}: html\`
|
|
344
|
+
${D}
|
|
345
|
+
\``]),[,C]=w.at(-1);return`${t}\${{
|
|
346
|
+
${R.join(`,
|
|
302
347
|
`)}
|
|
303
348
|
}[String(${x})] ?? html\`
|
|
304
|
-
${
|
|
305
|
-
\`}`}let i=e.tagName??"div",a=n||
|
|
349
|
+
${C}
|
|
350
|
+
\`}`}let i=e.tagName??"div",a=n||Ls.has(i),l=[],c=TO(e,gn,In);if(e.attributes)for(let[h,x]of Object.entries(e.attributes)){if(h==="class"&&c!==null)continue;if(de(x))l.push(`${h}="\${${Si}('${h}', ${In(x.$ref)}) ?? nothing}"`);else if(O(x)&&bb(x))l.push(`${h}="\${${Si}('${h}', ${gn(x).slice(2,-1)}) ?? nothing}"`);else if(O(x)&&x.includes("${"))l.push(`${h}="${gn(x)}"`);else if(tt(x)){let P=Yr(h,x);if(P!==null)l.push(P===""?h:`${h}="${P}"`)}else l.push(`${h}="${x}"`)}if(e.id)l.push(`id="${gn(String(e.id))}"`);if(c!==null)l.push(c);for(let[h,x]of Object.entries(e)){if(Rr.has(h)||h.startsWith("$")||h.startsWith("on")||h==="tagName"||h==="id"||h==="className"||h==="style"||h==="children"||h==="textContent"||h==="innerHTML"||h==="attributes")continue;if(wp(x))l.push(`.${h}="\${${In(x.$ref)}}"`);else if(O(x)&&x.includes("${"))l.push(`.${h}="${gn(x)}"`);else l.push(`.${h}="\${${JSON.stringify(x)}}"`)}if(e.$props)for(let[h,x]of Object.entries(e.$props))if(wp(x))l.push(`.${h}="\${${In(x.$ref)}}"`);else if(O(x)&&x.includes("${"))l.push(`.${h}="${gn(x)}"`);else l.push(`.${h}="\${${JSON.stringify(x)}}"`);let u=r?"s.$map = $map; ":"";for(let[h,x]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;Is(`inline "${h}" handler`,x);let P=h.slice(2).toLowerCase(),S=$b(x,u);if(S!==null)l.push(`@${P}="\${${S}}"`)}let d=NO(e.style);if(d)l.push(`style="${d}"`);let p=l.length>0?`
|
|
306
351
|
${t} ${l.join(`
|
|
307
352
|
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${p}
|
|
308
|
-
${t}>`;let g=o??
|
|
309
|
-
${t}>${g}${
|
|
310
|
-
${
|
|
311
|
-
|
|
312
|
-
|
|
353
|
+
${t}>`;let g=o??kO(e,t,a,r,s,i.includes("-")),y=i==="slot"?Ra:"";return a?`${y}<${i}${p}>${g}${y}</${i}>`:`${t}${y}<${i}${p}
|
|
354
|
+
${t}>${g}${y}</${i}>`}function Sq(e,t){let n=`${e}\x00${t}`;if(ss&&!ss.warned.has(n))ss.warned.add(n),console.warn(`Jx $switch: case "${e}" (${t}) is an external document, which only a site build compiles; it renders an empty container.`)}function kO(e,t,n,r,s,o=!1){if(e.$switch){let i=de(e.$switch)?e.$switch.$ref:e.$switch,a=In(i),l=[],c=[];for(let[m,g]of Object.entries(e.cases??{})){if(!g)continue;if(de(g)){Sq(m,g.$ref);continue}l.push([m,xb(g,`${t} `,!1,r,s)]);let y=V(g)&&O(g.tagName)?ss?.modules.get(g.tagName):void 0;if(y!==void 0)c.push(`${JSON.stringify(m)}: ${JSON.stringify(y)}`)}let u=l.map(([,m])=>m),d=new Set(u.filter((m,g)=>u.indexOf(m)!==g&&m.trim()!=="")),p=l.map(([m,g])=>{let y=s&&d.has(g)?RO(s,g):g;return` ${JSON.stringify(m)}: html\`
|
|
355
|
+
${y}
|
|
356
|
+
\``});if(c.length>0&&ss)return ss.needsLoader=!0,`\${_jxSwitch({
|
|
357
|
+
${p.join(`,
|
|
358
|
+
`)}
|
|
359
|
+
}, {${c.join(", ")}}, String(${a}))}`;return`\${{
|
|
360
|
+
${p.join(`,
|
|
313
361
|
`)}
|
|
314
|
-
}[${a}]}`}if(e.textContent!==void 0){let i=
|
|
362
|
+
}[${a}]}`}if(e.textContent!==void 0){let i=Ep(e.textContent),a=de(e.textContent)||O(e.textContent)&&e.textContent.includes("${");return o&&a?`${i}${Ra}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?Sp(e.children,e.style,"",!0,r,s,o):Sd(Sp(e.children,e.style,`${t} `,!1,r,s,o),{close:`
|
|
315
363
|
${t}`,lead:`${t} `,open:`
|
|
316
|
-
`});return""}function
|
|
364
|
+
`});return""}function _O(e,t){wi(e);let n=de(e.key),r=JSON.stringify(Array.isArray(e.items)?e.items:[]),s=n?`${Vc}(${JSON.stringify(r)})`:r;if(de(e.items))s=`(${In(e.items.$ref)} ?? [])`;let o=de(e.filter)?In(e.filter.$ref):"undefined",i=de(e.sort)?In(e.sort.$ref):"undefined",a=de(e.filter)||de(e.sort),l=e.map;if(!l)return"";let c=l.tagName??"div",u=[],d=TO(l,gn,$p);if(l.attributes)for(let[v,E]of Object.entries(l.attributes)){if(v==="class"&&d!==null)continue;if(de(E))u.push(`${v}="\${${$p(E.$ref)}}"`);else if(O(E)&&E.includes("${"))u.push(`${v}="${gn(E)}"`);else u.push(`${v}="${E}"`)}if(l.id)u.push(`id="${gn(String(l.id))}"`);if(d!==null)u.push(d);for(let[v,E]of Object.entries(l)){if(Rr.has(v)||v.startsWith("$")||v.startsWith("on")||v==="tagName"||v==="id"||v==="className"||v==="style"||v==="children"||v==="textContent"||v==="innerHTML"||v==="attributes")continue;if(wp(E))u.push(`.${v}="\${${$p(E.$ref)}}"`);else if(O(E)&&E.includes("${"))u.push(`.${v}="${gn(E)}"`);else u.push(`.${v}="\${${JSON.stringify(E)}}"`)}if(l.$props)for(let[v,E]of Object.entries(l.$props))if(de(E))u.push(`.${v}="\${${$p(E.$ref)}}"`);else if(O(E)&&E.includes("${"))u.push(`.${v}="${gn(E)}"`);else u.push(`.${v}="\${${JSON.stringify(E)}}"`);let p=NO(l.style);if(p)u.push(`style="${p}"`);for(let[v,E]of Object.entries(l)){if(!v.startsWith("on"))continue;Is(`inline "${v}" handler`,E);let w=v.slice(2).toLowerCase(),R=$b(E,"s.$map = $map; ");if(R!==null)u.push(`@${w}="\${${R}}"`)}let m=u.length>0?`
|
|
317
365
|
${t} ${u.join(`
|
|
318
|
-
${t} `)}`:"",g=
|
|
366
|
+
${t} `)}`:"",g=CO(),y="";if(l.textContent!==void 0)y=Ep(l.textContent);else if(l.children)y=Sd(Sp(l.children,null,`${t} `,!1,!0,g),{close:`
|
|
319
367
|
${t} `,lead:`${t} `,open:`
|
|
320
368
|
`});let h=`html\`
|
|
321
369
|
${t} <${c}${m}
|
|
322
|
-
${t} >${
|
|
323
|
-
${t}\``,x=(h.includes("$map")?"const $map = { item, index }; ":"")+g.decls.map((v)=>`${v.trim()} `).join(""),
|
|
324
|
-
})(s, e);`;return`${
|
|
325
|
-
`}function
|
|
326
|
-
|
|
370
|
+
${t} >${y}</${c}>
|
|
371
|
+
${t}\``,x=(h.includes("$map")?"const $map = { item, index }; ":"")+g.decls.map((v)=>`${v.trim()} `).join(""),P=x?`(item, index) => { ${x}return ${h}; }`:`(item, index) => ${h}`;if(de(e.key)){let v=e.key.$ref,E=[s,o,i,JSON.stringify(Hd(v)),JSON.stringify(v),P];return`${t}\${${qc}(${E.join(", ")})}`}let S=a?`${Aa}(${s}, ${o}, ${i})`:s;return`${t}\${${S}.map(${P})}`}function TO(e,t,n){if(!Wc(e))return null;let r=Bc(e),s="";if(de(r))s=`\${${n(r.$ref)} ?? ""}`;else if(O(r))s=t(r);else if(Ve(r))s=String(r);let o=mo(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function wp(e){return de(e)&&e.$ref!==""}function In(e){let t=dn(e);if(t.startsWith("#/state/"))return Ae("s",t.slice(8));if(t.startsWith("$map/"))return JO(t.slice(5));if(t.startsWith("parent#/"))return Ae("s",t.slice(8));if(t.startsWith("window#/"))return Ae("window",t.slice(8));if(t.startsWith("document#/"))return Ae("document",t.slice(10));return Ae("s",t)}function JO(e){let[t,...n]=vn(e);return Ae(t??"",n.map((r)=>Jt(r)).join("/"))}function $p(e){let t=dn(e);if(t.startsWith("$map/"))return JO(t.slice(5));return In(t)}function gn(e){return ka(e,"s",{code:!1})}function bb(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Ep(e){if(de(e))return`\${${In(e.$ref)}}`;if(O(e)&&e.includes("${"))return gn(e);return String(e)}function vp(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(PP(n))return!0;continue}}n+=s}return!1}function $b(e,t){if(wp(e))return t?`(e) => { ${t}${In(e.$ref)}(s, e); }`:`(e) => ${In(e.$ref)}(s, e)`;if(V(e)&&"$expression"in e){let n=pn(e.$expression,{eventParam:"e",statePrefix:"s"});return`(e) => { ${t}${n}; }`}if(Dt(e))return`${cn(e)?"async ":""}(e) => { ${t}${Pq(e)} }`;return null}function wq(e){let t=[];for(let[n,r]of Object.entries(e)){if(!n.startsWith("on")||Rr.has(n))continue;Is(`root "${n}" handler`,r);let s=$b(r,"");if(s!==null)t.push({source:s,type:n.slice(2).toLowerCase()})}return t}function vq(e){let t=[],n=(r,s,o)=>[" this.#effects.push(effect(() => {",o?" const s = this.state, state = s;":" const s = this.state;",` const _v = ${Si}(${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(de(s))t.push(...n(o,In(s.$ref),!1));else if(O(s)&&bb(s)){let i=gn(s);t.push(...n(o,i.slice(2,-1),vp(i)))}else if(O(s)&&s.includes("${")){let i=gn(s);t.push(...n(o,`\`${i}\``,vp(i)))}else if(tt(s)){let i=Yr(r,s);if(i!==null)t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(i)});`)}else if(O(s)||Ve(s))t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(String(s))});`)}return t}function Eq(e){if(e===void 0)return"null";if(de(e))return`() => { const s = this.state; return ${In(e.$ref)}; }`;if(O(e)&&e.includes("${")){let t=gn(e);return`() => { const s = this.state, state = s; try { return ${bb(e)?t.slice(2,-1):`\`${t}\``}; } catch { return null; } }`}return`() => ${JSON.stringify(e)}`}function Pq(e){if(cn(e))return Ms(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=O(e.body)?e.body:"";if(sc(e))return`((${zr(e).join(", ")}) => { ${t}
|
|
372
|
+
})(s, e);`;return`${ka(t,"s",{bare:!0})}
|
|
373
|
+
`}function NO(e){if(!V(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(O(r)&&r.includes("${")){let s=Mn(n);t.push(`${s}: ${gn(r)}`)}}return t.join("; ")}var gq,AO=`
|
|
374
|
+
// @jx-case-loader`,ss=null;var Qc=F(()=>{wa();ca();bp();ba();Rs();Sa();hn();ae();As();Ac();da();gq=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formResetCallback","formDisabledCallback"])});function MO(e,t){let{title:n="Jx App"}=t,r=e.state?sn(e):void 0,s=Oa(e,null,e.state??{},e.$media??{},r),o=Ja(e,e.$media??{},t.projectStyle??null),i=Sb(e,s,r),a=[],l=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((u)=>Ar(String(u))!==null)?`<script>${_a()}</script>
|
|
375
|
+
`:"",c=`<!DOCTYPE html>
|
|
327
376
|
<html lang="en">
|
|
328
377
|
<head>
|
|
329
378
|
<meta charset="utf-8">
|
|
330
379
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
331
|
-
<title>${
|
|
332
|
-
${
|
|
333
|
-
${
|
|
380
|
+
<title>${Fe(n)}</title>
|
|
381
|
+
${l}
|
|
382
|
+
${o}
|
|
334
383
|
</head>
|
|
335
384
|
<body>
|
|
336
|
-
${
|
|
385
|
+
${i}
|
|
337
386
|
</body>
|
|
338
|
-
</html>`;return{files:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
`:"",W=`<!DOCTYPE html>
|
|
387
|
+
</html>`;return{files:a,html:c}}function Sb(e,t,n){if(O(e))return Fe(e);if(Ve(e)||tt(e))return Fe(String(e));if(!V(e))return"";if(ns(e))return ts(e,t.scope,null,null,t.preformatted===!0);let r=Oa(e,t.scope,e.state??t.scopeDefs,e.$media??t.media,n),s=Uc(e.tagName,r.scope),o=$i(e,r.scope);if(Vx.has(s))return`<${s}${o}>`;let i=t.preformatted===!0||Ls.has(s),a=jq(e,s,{...r,preformatted:i});return`<${s}${o}>${a}</${s}>`}function jq(e,t,n){if(e.textContent!==void 0){let s=ot(e.textContent,n.scope);return s==null?"":Fe(String(s))}if(e.innerHTML){if(ja(e)){let o=Pa(e);return o?Ic(e.innerHTML,o,(i)=>Sb(i,n)):e.innerHTML}let s=ot(e.innerHTML,n.scope);return s==null?e.innerHTML:String(s)}let r=Fc(e,t,n.scope);if(r!==void 0)return r;if(Array.isArray(e.children))return an(e.children.map((s)=>Sb(s,n)),{preformatted:n.preformatted});return""}var DO=F(()=>{wa();hn();Rs();ae()});function jb(e,t={}){let n=os;os={modules:t.caseModules??new Map,needsLoader:!1,warned:new Set};try{return kq(e,t)}finally{os=n}}function kq(e,t){let{title:n="Jx App",reactivitySrc:r=po,litHtmlSrc:s=es,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,a=Oa(e,null,e.state??{},e.$media??{}),l=sn(e),c=Ja(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsFormulaGuard:_d(e.state??{}),needsLit:!1,p:0,s:0,sw:0,t:0,textParts:!1},d=new Map,p=new Map,m=!1,g=[],y=[],h=[],x=[],P=[],S=new Set,v=!1,E=[],w=e.state??{},R=Zd(w,t.resolveClass);for(let[B,U]of Object.entries(w)){if(!V(U)||Array.isArray(U)){if(ce(U))y.push([B,`() => ${Ld(U)}`]);else g.push([B,U]);continue}if(ln(U)){let Z=U.$expression,le=pn(Z,{eventParam:"e",statePrefix:"state"});if(An(U))P.push(`state[${JSON.stringify(B)}] = ${jd(U,le)};`);else if(Cr(Z.operator))x.push([B,{args:["state","e"],body:le}]);else y.push([B,`() => ${le}`]);continue}if(Dt(U)){let{body:Z}=U;if(Array.isArray(Z))if(Array.isArray(U.parameters)&&U.parameters.length>0){let le=Ms(Z,{dispatchTarget:"document.body.firstElementChild",eventParam:"e",statePrefix:"state"});P.push(`state[${JSON.stringify(B)}] = ${Ad(U,le)};`)}else{let le=Ms(Z,{eventParam:"e",statePrefix:"state"});x.push([B,{args:["state","e"],async:!0,body:le}])}else if(U.$src)if(l.get(B)==="computed")y.push([B,`() => { return ${B}(state); }`]);else P.push(`state[${JSON.stringify(B)}] = ${B};`),x.push([B,{args:["state","event"],body:`return ${B}(state, event);`}]);else if(O(Z)&&l.get(B)==="computed")y.push([B,`() => { ${Z} }`]);else S.add(B),x.push([B,{args:zr(U),body:Z}]);continue}if(ar(U))continue;if(Cu(U)){g.push([B,U.default]);continue}if(Cn(U)){if(Xd(B,U),U.$prototype==="LocalStorage"||U.$prototype==="SessionStorage"){let Z=U.$prototype==="LocalStorage"?"localStorage":"sessionStorage",le=U.key??B,we=U.default??null;g.push([B,null]),P.push(Rq(B,Z,le,we));continue}if(U.$prototype==="Request"){if(g.push([B,null]),P.push(Cd(B,U)),!U.manual)m=!0;continue}if(U.$prototype==="Cookie"){g.push([B,null]),P.push(MP(B,U)),v=!0;continue}if(Ca(U)){g.push([B,null]);continue}}if(vs(U)){g.push([B,null]),E.push(Rd(B,U,{serverBaseUrl:i}));continue}g.push([B,U])}let C=Eb(e,a,d,p,u);for(let[B,U]of d)if(!h.some(([Z])=>Z===B))h.push([B,U]);for(let[B,U]of p)if(!x.some(([Z])=>Z===B))x.push([B,U]);let J=Tq(e);for(let[B,U]of x){let Z=`state[${JSON.stringify(B)}] =`;if(J.has(B)&&!P.some((le)=>le.startsWith(Z)))P.push(`${Z} (state, e) => { const fn = ${U.async?"async ":""}(${U.args.join(", ")}) => { ${U.body??""}
|
|
388
|
+
}; return fn(state, e); };`)}let D=Md(w,l),A=Cq(g,y,h,x,S,P,E,D,u,r,t.rewriteSrc,R,qd(e),m,{needsCookie:v}),L=Ea({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports}),K=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((B)=>Ar(String(B))!==null)?`<script>${_a()}</script>
|
|
389
|
+
`:"",ne=`<!DOCTYPE html>
|
|
342
390
|
<html lang="en">
|
|
343
391
|
<head>
|
|
344
392
|
<meta charset="utf-8">
|
|
345
393
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
346
|
-
<title>${
|
|
347
|
-
${
|
|
394
|
+
<title>${Fe(n)}</title>
|
|
395
|
+
${K}${L}
|
|
348
396
|
${c}
|
|
349
397
|
<script type="module" src="./${o}"></script>
|
|
350
398
|
</head>
|
|
351
399
|
<body>
|
|
352
|
-
${
|
|
400
|
+
${C}
|
|
353
401
|
</body>
|
|
354
|
-
</html>`;return{files:[{content:
|
|
402
|
+
</html>`;return{files:[{content:A,path:o}],html:ne}}function Eb(e,t,n,r,s){if(O(e)){if(!ce(e))return Fe(e);let h=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(h,`() => \`${e}\``);let x=ot(e,t.scope),P=x==null?"":Fe(String(x));return`<!--jx-text:${h}-->${P}<!--/jx-text-->`}if(Ve(e)||tt(e))return Fe(String(e));if(!V(e))return"";if(ns(e))return ts(e,t.scope,null,null,t.preformatted===!0);let o=Oa(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Kn(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Ho(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let i=e.tagName??"div";o.preformatted=t.preformatted===!0||Ls.has(i);let a=[],l=!1;if(e.textContent!==void 0){let h=e.textContent;if(Ge(h)){let x=eu(h.$ref);a.push(`:text-content="${x}"`),vb(n,x,h.$ref),l=!0}else if(ce(h)){let x=`_t${s.t}`;s.t+=1,a.push(`:text-content="${x}"`),n.set(x,`() => \`${h}\``),l=!0}}for(let[h,x]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;Is(`inline "${h}" handler`,x);let P=h.slice(2).toLowerCase();if(Ge(x)){let S=eu(x.$ref);a.push(`@${P}="${S}"`),l=!0}else if(Dt(x)){let S=`_h${s.h}`;s.h+=1,a.push(`@${P}="${S}"`);let{body:v}=x;r.set(S,Array.isArray(v)?{args:["state","e"],async:!0,body:Ms(v,{eventParam:"e",statePrefix:"state"})}:{args:sc(x)?zr(x):["state","event"],body:v}),l=!0}else if(ln(x)){let S=`_h${s.h}`;s.h+=1,a.push(`@${P}="${S}"`);let v=pn(x.$expression,{eventParam:"e",statePrefix:"state"});r.set(S,{args:["state","e"],body:v}),l=!0}}if(V(e.style))for(let[h,x]of Object.entries(e.style)){if(h.startsWith(":")||h.startsWith(".")||h.startsWith("&")||h.startsWith("[")||h.startsWith("@"))continue;if(qO(x))continue;if(ce(x)){let P=`_s${s.s}`;s.s+=1,a.push(`:style.${Mn(h)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}if(V(e.attributes))for(let[h,x]of Object.entries(e.attributes)){let P=h==="class"?mo(e):void 0;if(P!==void 0&&(Ge(x)||ce(x))){let S=`_t${s.t}`;s.t+=1;let v=Ge(x)?Pb(x.$ref):`\`${x}\``;a.push(`:attr.class="${S}"`),n.set(S,`() => [${v}, ${JSON.stringify(P)}].filter((c) => c != null && c !== "").join(" ")`),l=!0;continue}if(Ge(x)){let S=eu(x.$ref);a.push(`:attr.${h}="${S}"`),vb(n,S,x.$ref),l=!0}else if(ce(x)){let S=`_t${s.t}`;s.t+=1,a.push(`:attr.${h}="${S}"`),n.set(S,`() => \`${x}\``),l=!0}}for(let[h,x]of Object.entries(e)){if(Rr.has(h)||h.startsWith("on")||h.startsWith("$")||h==="tagName"||h==="id"||h==="className"||h==="style"||h==="children"||h==="textContent"||h==="innerHTML"||h==="attributes")continue;if(Ge(x)){let P=eu(x.$ref);a.push(`:${Mn(h)}="${P}"`),vb(n,P,x.$ref),l=!0}else if(ce(x)){let P=`_t${s.t}`;s.t+=1,a.push(`:${Mn(h)}="${P}"`),n.set(P,`() => \`${x}\``),l=!0}}if(O(e.tagName)&&e.tagName.includes("-")&&V(e.$props))for(let[h,x]of Object.entries(e.$props)){if(h.startsWith("#"))continue;let P=`_p${s.p}`;if(s.p+=1,Ge(x))n.set(P,`() => ${go(x.$ref)}`);else if(ce(x))n.set(P,`() => \`${x}\``);else n.set(P,`() => (${JSON.stringify(x)})`);a.push(`:prop.${P}="${Fe(h)}"`),l=!0}let c=$i(e,o.scope),u=l?" data-bind":"",d=a.length>0?` ${a.join(" ")}`:"",p="",m=e;if(m.$switch){s.needsLit=!0;let h=`_sw${s.sw}`;s.sw+=1;let x=Ge(m.$switch)?Pb(m.$switch.$ref):`\`${String(m.$switch)}\``;n.set(h,`() => ${IO(m,x,o.preformatted)}`),a.push(`:render="${h}"`);let P=` ${a.join(" ")}`;return`<${i}${c} data-bind${P}></${i}>`}let g=Fc(m,i,o.scope);if(m.textContent!==void 0&&!l){let h=ot(m.textContent,o.scope);p=h==null?"":Fe(String(h))}else if(m.textContent!==void 0&&l){let h=ot(m.textContent,o.scope);p=h==null?"":Fe(String(h))}else if(m.innerHTML){let h=ja(m)?m.innerHTML:ot(m.innerHTML,o.scope);p=h==null?m.innerHTML:String(h);let x=Pa(m);if(x)p=Ic(p,x,(P)=>Eb(P,o,n,r,s))}else if(g!==void 0)p=g;else if(qe(m.children)){s.needsLit=!0;let h=`_list${s.l}`;s.l+=1;let x=m.children;n.set(h,`() => ${VO(x)}`),a.push(`:render="${h}"`),l=!0;let P=" data-bind",S=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${P}${S}>`;return`<${i}${c}${P}${S}></${i}>`}else if(Array.isArray(m.children)&&m.children.some((h)=>qe(h))){s.needsLit=!0;let h=`_children${s.l}`;s.l+=1;let x=an(m.children.map((S)=>Ob(S,o.preformatted)),{preformatted:o.preformatted,separator:`
|
|
355
403
|
`});n.set(h,o.preformatted?`() => html\`${x}\``:`() => html\`
|
|
356
404
|
${x}
|
|
357
|
-
\``),a.push(`:render="${h}"`),l=!0;let
|
|
405
|
+
\``),a.push(`:render="${h}"`),l=!0;let P=` ${a.join(" ")}`;return`<${i}${c} data-bind${P}></${i}>`}else if(Array.isArray(m.children)){if(Oq.has(i)&&m.children.some((h)=>ce(h)))throw Error(`A template text child of <${i}> cannot be bound: HTML reads its content as text. Write it as the element's textContent.`);p=an(m.children.map((h)=>Eb(h,o,n,r,s)),{preformatted:o.preformatted})}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${c}${u}${d}>`;return`<${i}${c}${u}${d}>${p}</${i}>`}function IO(e,t,n){let r=[],s=[];for(let[i,a]of Object.entries(e.cases??{})){if(!a)continue;if(Ge(a)){_q(i,a.$ref);continue}r.push(`${JSON.stringify(i)}: html\`${Ob(a,n)}\``);let l=V(a)&&O(a.tagName)?os?.modules.get(a.tagName):void 0;if(l!==void 0)s.push(`${JSON.stringify(i)}: ${JSON.stringify(l)}`)}let o=`({${r.join(", ")}})`;if(s.length>0&&os)return os.needsLoader=!0,`_jxSwitch(${o}, {${s.join(", ")}}, String(${t})) ?? html\`\``;return`${o}[String(${t})] ?? html\`\``}function _q(e,t){let n=`${e}\x00${t}`;if(os&&!os.warned.has(n))os.warned.add(n),console.warn(`Jx $switch: case "${e}" (${t}) is an external document, which only a site build compiles; it renders an empty container.`)}function LO(e,t=!1){if(!e)return"";if(Kn(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Ho(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||Ls.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=Wc(e);if(o){let c=Bc(e),u="";if(Ge(c))u=`\${${go(c.$ref)} ?? ""}`;else if(O(c))u=Fs(c);else if(Ve(c))u=String(c);let d=[u,mo(e)??""].filter((p)=>p!=="").join(" ");s+=` class="${d}"`}if(V(e.$props))for(let[c,u]of Object.entries(e.$props))if(Ge(u))s+=` .${c}="\${${go(u.$ref)}}"`;else if(ce(u))s+=` .${c}="${Fs(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`;if(V(e.attributes))for(let[c,u]of Object.entries(e.attributes)){if(o&&c==="class")continue;if(ce(u)){s+=` ${c}="${Fs(u)}"`;continue}if(Ge(u)){s+=` ${c}="\${${go(u.$ref)}}"`;continue}if(tt(u)){let d=Yr(c,u);if(d!==null)s+=d===""?` ${c}`:` ${c}="${Fe(d)}"`;continue}s+=` ${c}="${Fe(String(u))}"`}if(V(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(qO(d))continue;if(ce(String(d)))c.push(`${Mn(u)}: ${Fs(String(d))}`)}if(c.length>0)s+=` style="${c.join("; ")}"`}for(let[c,u]of Object.entries(e)){if(!c.startsWith("on")||c==="observedAttributes")continue;Is(`inline "${c}" handler`,u);let d=c.slice(2).toLowerCase();if(Ge(u)){let p=eu(u.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(cn(u)){let p=Ms(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${async (e) => { state.$map = { item, index }; ${p} }}`}else if(Dt(u)){let p=Aq(u.body),m=sc(u)?`((${zr(u).join(", ")}) => { ${p}
|
|
358
406
|
})(state, e);`:`${p}
|
|
359
|
-
`;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(
|
|
407
|
+
`;s+=` @${d}=\${(e) => { state.$map = { item, index }; ${m}}}`}else if(V(u)&&"$expression"in u){let p=pn(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}for(let[c,u]of Object.entries(e)){if(Rr.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(Ge(u))s+=` .${c}="\${${go(u.$ref)}}"`;else if(ce(u))s+=` .${c}="${Fs(u)}"`;else s+=` .${c}="\${${JSON.stringify(u)}}"`}let i=n.includes("-")?Ra:"",a="";if(e.$switch){let c=Ge(e.$switch)?go(e.$switch.$ref):`\`${Fs(String(e.$switch))}\``;a=`\${${IO(e,c,r)}}`}else if(e.textContent!==void 0){let c=String(e.textContent);if(ce(c))a=`${Fs(c)}${i}`;else if(Ge(e.textContent))a=`\${${go(e.textContent.$ref)}}${i}`;else a=Fe(c)}else if(e.innerHTML)a=Fs(String(e.innerHTML));else if(qe(e.children))a=Px([`${FO(e.children)}${i}`],{close:`
|
|
360
408
|
`,open:`
|
|
361
409
|
`,separator:`
|
|
362
|
-
`});else if(Array.isArray(e.children)){let c=e.children.map((u)=>{let d=
|
|
410
|
+
`});else if(Array.isArray(e.children)){let c=e.children.map((u)=>{let d=Ob(u,r);return qe(u)||O(u)&&ce(u)?`${d}${i}`:d});a=Px(c,{close:`
|
|
363
411
|
`,open:`
|
|
364
412
|
`,preformatted:r,separator:`
|
|
365
|
-
`})}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
`)}function
|
|
369
|
-
`)}function
|
|
370
|
-
`),c=
|
|
413
|
+
`})}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${a}</${n}>`}function Ob(e,t=!1){if(O(e))return ce(e)?Fs(e):Fe(e);if(Ve(e)||tt(e))return Fe(String(e));if(qe(e))return FO(e);return LO(e,t)}function FO(e){return`\${${VO(e)}}`}function wb(e){return dn(e).startsWith("$map/")?go(e):Pb(e)}function VO(e){wi(e);let{items:t,filter:n,sort:r,key:s}=e,o=Ge(s),i=JSON.stringify(t??[]),a=o?`${Vc}(${JSON.stringify(i)})`:i;if(Ge(t))a=wb(t.$ref);let l=Ge(n)?wb(n.$ref):"undefined",c=Ge(r)?wb(r.$ref):"undefined",u=`(item, index) => html\`${LO(e.map)}\``;if(o){let d=s.$ref,p=[`(${a} ?? [])`,l,c,JSON.stringify(Hd(d)),JSON.stringify(d),u];return`${qc}(${p.join(", ")})`}if(Ge(n)||Ge(r))return`${Aa}(${a}, ${l}, ${c}).map(${u})`;return`(${a} ?? []).map(${u})`}function Fs(e){return e.replaceAll("$map.","")}function Aq(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function Cq(e,t,n,r,s,o,i,a,l,c,u,d,p,m,g={}){let y=[],{needsLit:h,textParts:x}=l,P=t.length>0;y.push("// Generated by @jxsuite/compiler — do not edit manually");let S=["reactive","effect"];if(P)S.push("computed");if(p.keyed)S.push("stop","shallowRef");if(m)S.push("onEffectCleanup");if(y.push(`import { ${S.join(", ")} } from '@vue/reactivity';`),h)y.push("import { html, render } from 'lit-html';");if(p.keyed)y.push(...Bd);let v=Dd(a,u);if(y.push(...v.imports,...d.imports,...v.loaders,"",Fd()),os?.needsLoader)y.push(Vd());if(l.needsFormulaGuard)y.push(Od());if(g.needsCookie)y.push(NP());if(p.arranged||p.keyed)y.push(Wd());if(p.keyed)y.push(Ud());if(i.length>0)y.push("",Kd());let E=d.entries.length>0;if(E)y.push("",Yd(),"const _jxInstances = new Map();");y.push("","const state = reactive({");for(let[w,R]of e)y.push(` ${Gr(w)}: ${JSON.stringify(R)},`);y.push("});","");for(let[w,R]of r)if(s.has(w))y.push(`${Ae("state",Jt(w))} = (${R.args.join(", ")}) => { ${R.body}
|
|
414
|
+
};`);if(o.length>0){for(let w of o)y.push(w);y.push("")}if(t.length>0){for(let[w,R]of t)y.push(`${Ae("state",Jt(w))} = computed(${R});`);y.push("")}if(i.length>0){for(let w of i)y.push(w);y.push("")}if(n.length>0){y.push("const bind = {");for(let[w,R]of n)y.push(` ${Gr(w)}: ${R},`);y.push("};")}else y.push("const bind = {};");if(y.push(""),r.length>0){y.push("const on = {");for(let[w,R]of r){if(s.has(w)){y.push(` ${Gr(w)}: (e) => ${Ae("state",Jt(w))}(state, e),`);continue}y.push(` ${Gr(w)}: (e) => { const fn = ${R.async?"async ":""}(${R.args.join(", ")}) => { ${R.body}
|
|
415
|
+
}; fn(state, e); },`)}y.push("};")}else y.push("const on = {};");if(y.push("","function hydrate(root) {"),x)y.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(y.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;"),h)y.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else y.push(" if (parts[0] === 'style' && parts.length > 1) {");if(y.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'prop' && parts.length > 1) {"," const name = key;"," const k = parts[1];"," effect(() => { el[name] = bind[k](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Si}(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]);"," }"," });"," });"),x)y.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(y.push("}",""),E)y.push(`await ${Qd(d.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return y.push("hydrate(document);",""),y.join(`
|
|
416
|
+
`)}function Rq(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(`
|
|
417
|
+
`)}function qO(e){return e===null||V(e)}function go(e){let t=dn(e);if(t.startsWith("$map/")){let[n,...r]=vn(t.slice(5));return Ae(n??"",r.map((s)=>Jt(s)).join("/"))}if(t.startsWith("#/state/"))return Ae("state",t.slice(8));if(t.startsWith("parent#/"))return Ae("state",t.slice(8));if(t.startsWith("window#/"))return Ae("window",t.slice(8));if(t.startsWith("document#/"))return Ae("document",t.slice(10));return Ae("state",t)}function Tq(e){let t=new Set,n=[e];while(n.length>0){let r=n.pop();if(Array.isArray(r)){let s=r;n.push(...s)}else if(V(r)){let{$props:s,cases:o,children:i,map:a}=r;if(V(s)&&!Array.isArray(s))for(let l of Object.values(s)){let c=Ge(l)?Jq(l.$ref):void 0;if(c)t.add(c)}if(n.push(i,a),V(o)&&!Array.isArray(o)){let l=Object.values(o);n.push(...l)}}}return t}function Jq(e){let t=dn(e),n=t;if(t.startsWith("#/state/"))n=t.slice(8);else if(t.startsWith("parent#/"))n=t.slice(8);else if(t.includes("#/")||t.startsWith("$map/"))return;return vn(n)[0]}function Pb(e){return C0("state",e.startsWith("#/state/")?e.slice(8):e)}function eu(e){return R0(e.startsWith("#/state/")?e.slice(8):e)}function vb(e,t,n){if(e.has(t))return;e.set(t,`() => ${Ae("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var Oq,os=null;var kb=F(()=>{Rs();Sa();hn();ae();wa();da();Oq=new Set(["script","style","textarea","title"])});function Pp(e,t="/_jx/server"){return Le(e,t)}function _b(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,a=Pp(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let l=e.map(({exportName:g,src:y})=>`import { ${g} } from '${y}'`).join(`
|
|
418
|
+
`),c=Nq(r,s),u=e.map(({exportName:g})=>Iq(g,a)).join(`
|
|
371
419
|
`),d=n==="cloudflare-workers"||n==="cloudflare-pages"?`
|
|
372
420
|
app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
|
|
373
421
|
`:`
|
|
374
|
-
`,p=
|
|
422
|
+
`,p=e0(o,i),m=e.length===0&&r.length===0?"":Dq(i,a);return`// Generated by @jxsuite/compiler — do not edit manually
|
|
375
423
|
import { Hono } from 'hono'
|
|
376
424
|
${l}${c.imports}
|
|
377
425
|
|
|
@@ -379,11 +427,11 @@ const app = new Hono()
|
|
|
379
427
|
${p}${m}${c.routes}${u}
|
|
380
428
|
${d}
|
|
381
429
|
export default app
|
|
382
|
-
`}function
|
|
430
|
+
`}function Nq(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:`
|
|
383
431
|
${r.join(`
|
|
384
432
|
`)}`,routes:`${s.join(`
|
|
385
433
|
`)}
|
|
386
|
-
`}}function
|
|
434
|
+
`}}function Dq(e,t){let n=Le(e,Mq);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
|
|
387
435
|
const jxGate = async (c, next) => {
|
|
388
436
|
const site = c.req.header('sec-fetch-site')
|
|
389
437
|
const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
|
|
@@ -400,7 +448,7 @@ const jxGate = async (c, next) => {
|
|
|
400
448
|
}
|
|
401
449
|
${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
|
|
402
450
|
`)}
|
|
403
|
-
`}function
|
|
451
|
+
`}function Iq(e,t){return`
|
|
404
452
|
app.post('${t}/${e}', async (c) => {
|
|
405
453
|
if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
|
|
406
454
|
return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
|
|
@@ -412,26 +460,26 @@ app.post('${t}/${e}', async (c) => {
|
|
|
412
460
|
console.error('jx: server function ${e} threw:', e)
|
|
413
461
|
return c.json({ ok: false, error: 'Server error' }, 500)
|
|
414
462
|
}
|
|
415
|
-
})`}var
|
|
463
|
+
})`}var Mq="/_jx";var Ab=F(()=>{Tn();Ay()});async function qq(e){let{readdirSync:t}=await import("node:fs"),{resolve:n}=await import("node:path");if(!O(e))return e.map((r)=>n(r));return t(e).filter((r)=>fr(r)).toSorted().map((r)=>n(e,r))}async function Hq(e){let{readFileSync:t}=await import("node:fs");if(!fr(e))throw Error(`compileElementPack: ${e} is not a .json or .jxn document, the two a pack compiles`);return Xn(t(e,"utf8"),e)}async function Wq(e){let{resolve:t}=await import("node:path"),n=(e.packDir??"dist").replaceAll(/^\.?\/+|\/+$/gu,""),r=await qq(e.components),s=new Map,o=new Map;for(let g of r){let y=await Hq(g),{tagName:h}=y;if(!O(h)||!h.includes("-"))throw Error(`compileElementPack: ${g} is not a component: its tagName must contain a hyphen`);let x=[...o].find(([,P])=>P===h);if(x)throw Error(`compileElementPack: ${x[0]} and ${g} both declare the tagName "${h}"`);s.set(h,y),o.set(g,h)}let i={stylesheetHref:(g)=>`./${g}.css`,resolveElementPath:(g,y)=>{let h=y===null?t(g):t(y,g),x=o.get(h);if(x===void 0)throw Error(`compileElementPack: "${g}" names a component outside the pack (${h})`);return`./${x}.js`}};if(e.rewriteSrc)i.rewriteSrc=e.rewriteSrc;if(e.$media)i.$media=e.$media;if(e.defaults)i.defaults=e.defaults;let a=new Map;for(let g of r){let{files:y}=await Ma(g,i);for(let h of y)if(!a.has(h.tagName))a.set(h.tagName,h.content)}let l=rp([...s.keys()],s),c=[],u=[],d=[];for(let g of l){let y=s.get(g),h=a.get(g);if(!y||h===void 0)continue;c.push({content:h,path:`${g}.js`});let x=er(y,e.defaults),P=op(g,y.style,y,e.$media??y.$media??{},x);if(P!==""){if(c.push({content:P,path:`${g}.css`}),x===null)u.push(P)}d.push({className:ho(g),doc:y,modulePath:n===""?`${g}.js`:`${n}/${g}.js`,shadow:x!==null,tagName:g})}let{manifest:p,warnings:m}=Nf(d);return c.push({content:`// Generated by @jxsuite/compiler — do not edit manually
|
|
416
464
|
${l.map((g)=>`import './${g}.js';`).join(`
|
|
417
465
|
`)}
|
|
418
|
-
`,path:
|
|
466
|
+
`,path:Lq},{content:u.join(""),path:Fq},{content:Mf(p),path:Vq}),{files:c,manifest:p,tags:l,warnings:m}}async function Bq(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 Lq="index.js",Fq="elements.css",Vq="custom-elements.json";var HO=F(()=>{uy();ae();As();Ac();hn();Qc()});import{readFileSync as Uq}from"node:fs";async function Cb(e,t={}){let{title:n="Jx App",reactivitySrc:r=po,litHtmlSrc:s=es,projectStyle:o=null}=t,i;if(O(e)){let l=Uq(e,"utf8");if(fr(e))i=Xn(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(() => Hr());throw $f(e,u)}i=await d.parseDocument(l)}}else i=e;if(i=Kr(i,O(e)?e:"the document"),VS(i)){await Promise.resolve().then(() => sb());let c=Gc(i),u=O(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:c,path:u}],html:""}}if(va(i),!Mc(i)){let l={projectStyle:o,title:n};if(t.prePaintScheme===!1)l.prePaintScheme=!1;return MO(i,l)}if(i.tagName&&i.tagName.includes("-")){let{tagName:l}=i,c=ho(l),d={content:yb(i,c,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass,null,t.caseModules),path:`${l}.js`,tagName:l},p=Ja(i,i.$media??{},o),m=`<!DOCTYPE html>
|
|
419
467
|
<html lang="en">
|
|
420
468
|
<head>
|
|
421
469
|
<meta charset="utf-8">
|
|
422
470
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
423
|
-
<title>${
|
|
424
|
-
${
|
|
471
|
+
<title>${Fe(n)}</title>
|
|
472
|
+
${Ea({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
425
473
|
${p}
|
|
426
474
|
</head>
|
|
427
475
|
<body>
|
|
428
476
|
<${l}></${l}>
|
|
429
477
|
<script type="module" src="./${l}.js"></script>
|
|
430
478
|
</body>
|
|
431
|
-
</html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...
|
|
479
|
+
</html>`;return{files:[d],html:m}}let a={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...zq(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;if(t.caseModules!==void 0)a.caseModules=t.caseModules;return jb(i,a)}function zq(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function yoe(e,t){let n=await Cb(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 WO=F(()=>{ca();hn();Qc();DO();kb();ae();As();hn();Ab();Qc();HO();kb()});function BO(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 UO(e){return`jx-compiler.${e}.node`}function zO(e){return`@jxsuite/compiler-binding-${e}`}var KO=()=>{};import{createRequire as Kq}from"node:module";import{existsSync as Gq}from"node:fs";import{dirname as YO,join as Xq}from"node:path";function Yq(e,t){return e==="linux"&&t!==void 0&&!t.header?.glibcVersionRuntime}function Zq(e){try{return[YO(e("@jxsuite/compiler-binding/package.json"))]}catch{return[]}}function Qq(){return{arch:process.arch,exists:Gq,load:(e)=>{let t=GO(e);return eH(t)?t:void 0},localDirs:[...new Set([YO(import.meta.dirname),import.meta.dirname,...Zq((e)=>GO.resolve(e))])],musl:Yq(process.platform,process.report.getReport()),platform:process.platform}}function eH(e){return typeof e==="object"&&e!==null&&"processImage"in e&&typeof e.processImage==="function"}function tH(e){let t=BO(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)=>Xq(i,UO(s))).filter((i)=>e.exists(i)),zO(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(`
|
|
432
480
|
`);throw Error(`The Jx compiler's native addon could not be loaded.
|
|
433
481
|
${r}
|
|
434
|
-
In a checkout of the Jx repository, build it with \`bun run build:addon\` (needs Rust). In a project, reinstall dependencies without --no-optional so the package for this platform is installed.`)}function Rj(){return Oj??=VF(LF()),Oj}async function Tj(e){return Rj().imageMetadata(e)}async function Nj(e){return Rj().processImage(e)}var Cj,_j,Oj;var Jj=M(()=>{kj();Cj={avif:65,jpeg:80},_j=NF(import.meta.url)});import{createHash as tx}from"node:crypto";import{readFileSync as qF}from"node:fs";import{basename as HF,extname as WF,resolve as Mj}from"node:path";async function sd(e){return Tj(e)}function sa(e){let t=qF(e);return tx("md5").update(t).digest("hex").slice(0,8)}function zF(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(Cj)).get(t)??UF}function KF(e,t,n){return tx("md5").update(`${sa(e)}:${Ij}:${t}:${n}`).digest("hex").slice(0,8)}function Dj(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:Ij,widths:e.widths});return tx("md5").update(t).digest("hex").slice(0,8)}async function Lj(e,t,n){let r=Mj(t,"_optimized"),s={};if(n.quality.avif!==void 0)s.avif=n.quality.avif;if(n.quality.jpeg!==void 0)s.jpeg=n.quality.jpeg;let o=await Nj({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,KF(e,i,zF(n.quality,i))])),outDir:r,quality:s,source:e,stem:HF(e,WF(e)),widths:n.widths});return{contentHash:sa(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:Mj(r,i.fileName),format:i.format,outputPath:`/${BF}/${i.fileName}`,width:i.width}))}}function Fj(e,t){return e.flatMap((n)=>n.format===t?[`${nx(n.outputPath)} ${n.width}w`]:[]).join(", ")}function nx(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var BF="images/_optimized",Ij=4,UF=100;var od=M(()=>{Jj()});import{existsSync as GF,mkdirSync as XF,readFileSync as YF,rmSync as ZF,writeFileSync as QF}from"node:fs";import{basename as Vj,extname as e2,resolve as Gl}from"node:path";import{execSync as t2}from"node:child_process";import{createHash as n2}from"node:crypto";import{tmpdir as r2}from"node:os";function o2(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=t2("npm config get cache",{cwd:r2(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:s2}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function ad(e){if(id===void 0)id=o2();if(id){let t=Gl(e),n=n2("md5").update(t).digest("hex").slice(0,8);return Gl(id,"jxsuite-images",`${Vj(t)}-${n}`)}return Gl(e,".cache/images")}function qj(e,t){return`${sa(e)}:${Dj(t)}:${Vj(e,e2(e))}`}function Hj(e){let t=Gl(ad(e),"manifest.json");if(!GF(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(YF(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function Wj(e,t,n={}){if(n.prune&&t.touched)i2(t,t.touched);let r=ad(e);XF(r,{recursive:!0}),QF(Gl(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function i2(e,t){let n=new Set,r=Object.entries(e.entries);for(let[s,o]of r)if(t.has(s))for(let i of o.manifest.variants??[])n.add(i.absolutePath);for(let[s,o]of r){if(t.has(s))continue;for(let i of o.manifest.variants??[])if(!n.has(i.absolutePath))ZF(i.absolutePath,{force:!0});delete e.entries[s]}}function Bj(e){let t=new Set,n=new Map(Object.entries(e.entries));for(let r of e.touched??[])for(let s of n.get(r)?.manifest.variants??[])t.add(s.absolutePath);return[...t]}function Uj(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function zj(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var id,s2=3000;var rx=M(()=>{od()});function sx(e,t){if(!t||Kj(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return Kj(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var Kj=(e)=>e!==void 0&&e!==null&&e!=="";function Xj(e){let t=e.lastIndexOf(".");return a2.get(t>0?e.slice(t).toLowerCase():"")??null}function cd(e){try{return c2.decode(e)}catch{throw new In("The metadata is not valid UTF-8.")}}function ld(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Xl(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function Yj(e,t){switch(t){case"jpeg":return d2(e).packet;case"png":return g2(e).packet;case"webp":return x2(e).packet;default:return w2(cd(e)).packet}}function u2(e){if(e[0]!==255||e[1]!==216)throw new In("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new In("The JPEG's markers are damaged.");let r=e[n+1]??0;if(r===255){n+=1;continue}if(r===218||r===217)break;let s=ld(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new In("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function f2(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=ox.length&&ox.every((r,s)=>e[n+s]===r)}function d2(e){let t=u2(e),n=t.find((s)=>f2(e,s));return{packet:n===void 0?null:cd(e.subarray(n.start+4+ox.length,n.end)),parts:t}}function m2(e){if(!Gj.every((r,s)=>e[s]===r))throw new In("Not a PNG file.");let t=[],n=Gj.length;while(n+12<=e.length){let r=ld(e).getUint32(n),s=n+12+r;if(s>e.length)throw new In("The PNG's chunks are damaged.");let o=Xl(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function h2(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||Xl(n,0,r)!==p2)return null;if(n[r+1]!==0)throw new In("The PNG's metadata is compressed, which Studio does not rewrite.");let s=n.indexOf(0,r+3),o=s===-1?-1:n.indexOf(0,s+1);if(o===-1)throw new In("The PNG's metadata chunk is damaged.");return cd(n.subarray(o+1))}function g2(e){let t=m2(e);return{packet:t.map((r)=>h2(e,r)).find((r)=>r!==null)??null,parts:t}}function y2(e){if(Xl(e,0,4)!=="RIFF"||Xl(e,8,4)!=="WEBP")throw new In("Not a WebP file.");let t=Math.min(e.length,8+ld(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=ld(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new In("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:Xl(e,r,4),size:s,start:r}),r=i}return n}function x2(e){let t=y2(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:cd(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function $2(e,t){let n=null;for(let r=t+1;r<e.length;r++){let s=e[r];if(n!==null){if(s===n)n=null}else if(s==='"'||s==="'")n=s;else if(s===">")return r}return-1}function S2(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new In("Not an SVG file.");let n=$2(e,t.index);if(n===-1)throw new In("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function w2(e){S2(e);let t=b2.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var In,a2,l2,c2,ox,Gj,p2="XML:com.adobe.xmp",b2;var Zj=M(()=>{In=class In extends Error{name="XmpContainerError"};a2=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);l2=new TextEncoder,c2=new TextDecoder("utf-8",{fatal:!0});ox=l2.encode("http://ns.adobe.com/xap/1.0/\x00");Gj=Uint8Array.of(137,80,78,71,13,10,26,10);b2=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function Qj(){return{alt:"",focus:null,tags:[]}}function E2(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function ix(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=E2(n),s=r===null?v2.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new Dn(`Unknown entity ${t}`);return s})}function j2(e){let t={attrs:[],children:[],name:"#root",type:"element"},n=[t],r=0,s=()=>n.at(-1)??t;while(r<e.length){let o=e.indexOf("<",r);if(o===-1){s().children.push({type:"text",value:ix(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:ix(e.slice(r,o))});let i=e.slice(o,o+9),a;if(i.startsWith("<!--"))a=e.indexOf("-->",o),a=a===-1?-1:a+3;else if(i.startsWith("<![CDATA["))a=e.indexOf("]]>",o),a=a===-1?-1:a+3;else if(i.startsWith("<?"))a=e.indexOf("?>",o),a=a===-1?-1:a+2;else if(i.startsWith("<!"))throw new Dn("A packet may not declare a document type.");else if(i.startsWith("</")){let l=e.indexOf(">",o);if(l===-1)throw new Dn("Unclosed end tag.");let c=e.slice(o+2,l).trim(),u=n.pop();if(u===void 0||u===t||u.name!==c)throw new Dn(`Unexpected </${c}>.`);r=l+1;continue}else{r=P2(e,o,n);continue}if(a===-1)throw new Dn("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new Dn(`<${s().name}> is never closed.`);return t.children}function P2(e,t,n){let r=t+1,s=eP.exec(e.slice(r));if(s===null)throw new Dn("A tag has no name.");let o={attrs:[],children:[],name:s[0],type:"element"};r+=s[0].length;for(;;){while(/\s/.test(e[r]??""))r+=1;let i=e[r];if(i===void 0)throw new Dn(`<${o.name}> is never finished.`);if(i===">"||e.startsWith("/>",r)){if(n.at(-1)?.children.push(o),i===">")return n.push(o),r+1;return r+2}let a=eP.exec(e.slice(r));if(a===null)throw new Dn(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new Dn(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let l=e[r];if(l!=='"'&&l!=="'")throw new Dn(`${a[0]} is not quoted.`);let c=e.indexOf(l,r+1);if(c===-1)throw new Dn(`${a[0]} is never closed.`);o.attrs.push([a[0],ix(e.slice(r+1,c))]),r=c+1}}function oa(e,t){let n=e.attrs.filter(([s])=>s==="xmlns"||s.startsWith("xmlns:"));if(n.length===0)return t;let r=new Map(t);for(let[s,o]of n)r.set(s==="xmlns"?"":s.slice(6),o);return r}function k2(e,t,n=!1){let r=e.indexOf(":");if(r===-1)return n?["",e]:[t.get("")??"",e];let s=e.slice(0,r),o=s==="xml"?"http://www.w3.org/XML/1998/namespace":t.get(s);return o===void 0?null:[o,e.slice(r+1)]}function yr(e,t,n,r,s=!1){let o=k2(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function ia(e){return e.filter((t)=>t.type==="element")}function aa(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?aa(t):"").join("")}function nP(e,t=new Map){let n=[];for(let r of ia(e)){let s=oa(r,t);if(yr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...nP(r.children,s))}return n}function la(e,t){let n=[];for(let r of ia(e.children)){let s=oa(r,t);for(let o of ia(r.children)){let i=oa(o,s);if(yr(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function _2(e,t){let n=e.attrs.find(([r])=>yr(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function O2(e,t){let n=la(e,t),r=n.find(([s,o])=>_2(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?aa(e).trim():aa(r[0])}function ud(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&yr(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of ia(e.children)){let s=oa(r,t);if(yr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function Zl(e,t,n,r){for(let s of ia(e.children)){let o=oa(s,t);if(yr(s.name,o,n,r))return[s,o]}return null}function Yl(e,t,n,r){let s=e.attrs.find(([i])=>yr(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=Zl(e,t,n,r);return o===null?null:aa(o[0]).trim()}function tP(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function A2(e,t){let n=Zl(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return la(...n).some(([r,s])=>{let[o,i]=ud(r,s),a=Zl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[Yl(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:la(...a).map(([c])=>aa(c).trim())).some((c)=>c.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function C2(e,t){let[n,r]=ud(e,t),s=Zl(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!A2(n,r))return null;let[o,i]=ud(...s),a=Zl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(Yl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||Yl(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let l=la(...a);if(l.length!==1)return null;let[c,u]=ud(...l[0]),d=tP(Yl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=tP(Yl(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function R2(e){let t=new Set,n=[];for(let r of e){let s=r.trim(),o=s.toLowerCase();if(s!==""&&!t.has(o))t.add(o),n.push(s)}return n}function rP(e){if(e===null)return Qj();let t=Qj(),n=!1;for(let[r,s]of nP(j2(e))){for(let[o,i]of r.attrs)if(!n&&yr(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of ia(r.children)){let i=oa(o,s);if(!n&&yr(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=O2(o,i),n=!0;else if(yr(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...la(o,i).map(([a])=>aa(a)));else if(t.focus===null&&yr(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,l]of la(o,i))t.focus??=C2(a,l)}}return t.tags=R2(t.tags),t.alt=t.alt.trim(),t}var Dn,v2,eP;var sP=M(()=>{Dn=class Dn extends Error{name="XmpParseError"};v2=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);eP=/^[A-Za-z_][\w.:-]*/});import{existsSync as dP,readFileSync as T2,statSync as N2}from"node:fs";import{basename as J2,extname as cx,resolve as oP}from"node:path";async function D2(e,t){let n=t.get(e);if(!n){let r=sa(e);try{let s=await sd(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!iP)iP=!0,console.warn(`Could not read image dimensions (${ye(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function aP(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=L2(e);return t.widths.filter((l)=>l<=n).toSorted((l,c)=>l-c).map((l)=>`/cdn-cgi/image/width=${l},quality=${s},fit=scale-down,format=auto${o}${a}${i} ${l}w`).join(", ")}function L2(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function F2(e,t,n,r,s){let o=qj(e,n),i=Uj(s,o);if(i){if(i.variants.every((c)=>dP(c.absolutePath)))return i}if(!i)console.log(` Optimizing ${J2(e)}...`);let a=await Lj(e,ad(r),n);return zj(s,o,t,a),a}function V2(e){if(!e)return!0;if(e.includes("${"))return!0;if(mP.some((n)=>e.startsWith(n)))return!0;let t=cx(e).toLowerCase();return!M2.has(t)&&!pP.has(t)}function q2(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let n=new URL(e);if(I2.has(cx(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function fd(e,t,n){let r=n?.length?Nu(n,e):null;if(r)return r;if(e.startsWith("/"))return oP(t,"public",e.slice(1));return oP(t,e)}function cP(e){return`${Math.round(e*1000)/10}%`}function H2(e){let t=Xj(e);if(t===null)return null;let n;try{let o=N2(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=lP.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(T2(e)),{focus:i}=rP(Yj(o,t));s=i===null?null:`${cP(i.x)} ${cP(i.y)}`}catch{s=null}return lP.set(n,s),s}function W2(e,t,n,r){if(!_(t)||t===""||t.includes("${"))return;if(mP.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!F(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=H2(fd(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}function ys(e){return e.replaceAll("$","$$$$")}async function ux(e,t,n,r,s,o=[]){let i=new Map;return await hP(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function hP(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await Z2(e,t,n,r,s,o,i,a))return}if(_(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await sV(e.innerHTML,t,n,r,s,o,i,lx(e,a));let l=lx(e,a);for(let c of B2(e))await hP(c,t,n,r,s,o,i,l)}function B2(e){let t=[],n=(s)=>{if(!Ct(s))return;if(s.$prototype==="Array"){n(s.map);return}t.push(s)};if(Array.isArray(e.children))for(let s of e.children)n(s);else n(e.children);let r=e.cases??{};for(let s of Object.values(r))n(s);return t}async function gP(e,t,n,r,s,o,i,a){if(!_(e)||t)return null;let l=q2(e,n);if(!l&&V2(e))return null;if(l)return{dims:null,sources:[],srcset:aP(e,n,1/0,null)};let c=fd(e,r,a);if(!dP(c))return null;if(n.service==="cloudflare"){let h=await D2(c,o),x=aP(e,n,h.width??1/0,h.hash);return{dims:h.width&&h.height?{height:h.height,width:h.width}:null,sources:[],srcset:x}}if(pP.has(cx(c).toLowerCase()))return null;let u=i.get(c);if(!u)u=await F2(c,e,n,r,s),i.set(c,u);let d=z2(n.formats,u.variants),m=[...uP.filter((h)=>d.includes(h)),...d.filter((h)=>!uP.includes(h))].flatMap((h)=>{let x=Fj(u.variants,h);return x===""?[]:[{srcset:x,type:U2.get(h)??`image/${h}`}]}),g=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,b=n.picture!==!1&&m.length>1;return{dims:g,fallbackSrc:G2(u.variants,d),sources:b?m:[],srcset:m[0]?.srcset??""}}function z2(e,t){return e.includes("jpeg")&&!e.includes("png")&&t.some((r)=>r.format==="png")&&!t.some((r)=>r.format==="jpeg")?[...e,"png"]:e}function G2(e,t){let n=K2.find((s)=>t.includes(s)&&e.some((o)=>o.format===s));if(n===void 0)return;let r;for(let s of e)if(s.format===n&&(r===void 0||s.width>r.width))r=s;return r&&nx(r.outputPath)}function fP(e){if(!_(e))return null;let t=X2.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function lx(e,t){let{style:n}=e;if(!F(n))return t;let r=t;for(let s of[fP(n.maxWidth),fP(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function yP(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}function Y2(e,t){for(let[n,r]of Object.entries(e)){if(n==="id"||n==="className")continue;let s=lf("img",n);if(!s)continue;if(delete e[n],t[s.attribute]!==void 0)continue;if(pe(r)||ce(r)){t[s.attribute]=r;continue}let o=sy(s,r);if(o===null)continue;t[s.attribute]=o===""&&s.kind!=="text"?!0:o}}async function Z2(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;Y2(e,l),W2(e,l.src,n,i);let c=t.optimize?await gP(l.src,l["data-no-optimize"]!==void 0||l.srcset!==void 0,t,n,r,s,o,i):null,u=lx(e,a),d=l.sizes??yP(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,d!==void 0)l.sizes=d;if(c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,sx(l,t.lazyLoad)),c&&c.sources.length>0)return Q2(e,c.sources,d),!0;return!1}function Q2(e,t,n){let r={...e.attributes},s=r.sizes??n;delete r.srcset,delete r.sizes;let o={attributes:r,tagName:"img"};if(e.style!==void 0)o.style=e.style,delete e.style;let i=t.map((a)=>{let l={};if(s!==void 0&&s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});i.push(o),e.tagName="picture",e.attributes={},e.children=i}async function sV(e,t,n,r,s,o,i,a){let l=[];for(let u of e.matchAll(eV)){let d=u[0],p=u[1],m=(Ql(p,"src")??"").replaceAll("&","&"),g=t.optimize&&m!==""?await gP(m,tV.test(p)||ax(p,"srcset")||oV(e,u.index),t,n,r,s,o,i):null,b=Ql(p,"sizes"),h=b??yP(a)??t.sizes,x=p,k="";if(g&&g.srcset!==""){if(k+=` srcset="${g.srcset}"`,b===void 0&&h!==void 0&&h!=="")k+=` sizes="${h}"`;let{fallbackSrc:E}=g;if(E!==void 0)x=p.replace(nV,(O,I)=>`${I}src="${E}"`)}if(g?.dims&&!ax(p,"width")&&!ax(p,"height"))k+=` width="${g.dims.width}" height="${g.dims.height}"`;let w=sx({decoding:Ql(p,"decoding"),fetchpriority:Ql(p,"fetchpriority"),loading:Ql(p,"loading")},t.lazyLoad);for(let[E,O]of Object.entries(w))k+=` ${E}="${O}"`;if(k==="")continue;let v=g&&g.sources.length>0?iV(x,g.sources,h,k):`<img${x}${k}>`;l.push({match:d,replacement:v})}let c=e;for(let{match:u,replacement:d}of l)c=c.replace(u,ys(d));return c}function oV(e,t){let n=e.slice(0,t).toLowerCase();return n.lastIndexOf("<picture")>n.lastIndexOf("</picture>")}function iV(e,t,n,r){let s=e.replace(rV,""),o=r.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,""),i=n===void 0||n===""?"":` sizes="${n}"`;return`<picture>${t.map((l)=>`<source type="${l.type}" srcset="${l.srcset}"${i}>`).join("")}<img${s}${o}></picture>`}function Ql(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function ax(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var M2,pP,I2,mP,iP=!1,lP,uP,U2,K2,X2,eV,tV,nV,rV;var fx=M(()=>{od();rx();hn();Xg();ae();$n();Ft();Zj();sP();M2=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),pP=new Set([".avif"]),I2=new Set([".svg",".gif"]),mP=["http://","https://","data:","//"];lP=new Map;uP=["avif","webp","jpeg","png"],U2=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);K2=["jpeg","png"];X2=/^(\d+(?:\.\d+)?)(px|rem)$/;eV=/<img\b([^>]*)>/gi,tV=/\bdata-no-optimize\b/,nV=/(^|\s)src="[^"]*"/i,rV=/(?:^|\s)sizes="[^"]*"/i});import{closeSync as aV,existsSync as lV,openSync as cV,readSync as uV,statSync as xP}from"node:fs";function fV(e){let t=new Uint8Array(10),n=cV(e,"r");try{if(uV(n,t,0,10,0)<10)return null}finally{aV(n)}let r=String.fromCodePoint(...t.subarray(0,6));if(r!=="GIF87a"&&r!=="GIF89a")return null;let s=new DataView(t.buffer),o=s.getUint16(6,!0),i=s.getUint16(8,!0);return o>0&&i>0?{height:i,width:o}:null}async function dV(e){let t=xP(e),n=`${e}:${t.mtimeMs}:${t.size}`;if(dx.has(n))return dx.get(n)??null;let r=null;try{if(r=fV(e),r===null){let{height:s,width:o}=await sd(e);r=o>0&&s>0?{height:s,width:o}:null}}catch{r=null}return dx.set(n,r),r}function pV(e,t){let n=e.trim(),r=t?.replace(/\/+$/,"");if(r&&n.startsWith(`${r}/`))n=n.slice(r.length);if(!n.startsWith("/")||n.startsWith("//"))return null;n=n.split("#")[0].split("?")[0];try{n=decodeURIComponent(n)}catch{return null}return n.split("/").includes("..")?null:n}async function bP(e,t){let n=(c,u)=>F(c)&&c.tagName==="meta"&&c.attributes?.property===u,r=e.findLastIndex((c)=>n(c,"og:image"));if(r===-1||e.some((c)=>n(c,"og:image:width")||n(c,"og:image:height")))return e;let s=e[r].attributes?.content,o=_(s)?pV(s,t.siteUrl):null;if(o===null)return e;let i=fd(o,t.projectRoot,t.mounts);if(!lV(i)||!xP(i).isFile())return e;let a=await dV(i);if(a===null)return e;let l=(c,u)=>({attributes:{content:String(u),property:c},tagName:"meta"});return[...e.slice(0,r+1),l("og:image:width",a.width),l("og:image:height",a.height),...e.slice(r+1)]}var dx;var $P=M(()=>{od();fx();ae();dx=new Map});import{createHash as mV}from"node:crypto";import{existsSync as hV}from"node:fs";import{join as SP}from"node:path";function xV(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?SP(t,n,"index.html"):SP(t,n)}function mx(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function bV(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return mV("sha256").update(t,"utf8").digest("hex").slice(0,8)}function wP(e,t,n=""){let r=[],s=[],o=[...e.precache??[]],i=e.offlineFallback;if(i!==void 0&&!o.includes(i))o.push(i),r.push(`serviceWorker: "${i}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let m of o)if(!m.startsWith("/"))s.push(`serviceWorker.precache: "${m}" must be a site-absolute URL starting with /.`);else if(!hV(xV(m,t)))s.push(`serviceWorker.precache: "${m}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=o.map((m)=>Te(n,m)),l=Te(n,gV),c=i===void 0?null:Te(n,i),u=`${Te(n,yV)}/`,d=`jx-${bV(e)}`,p=`/*
|
|
482
|
+
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 QO(){return XO??=tH(Qq()),XO}async function ek(e){return QO().imageMetadata(e)}async function tk(e){return QO().processImage(e)}var ZO,GO,XO;var nk=F(()=>{KO();ZO={avif:65,jpeg:80},GO=Kq(import.meta.url)});import{createHash as Rb}from"node:crypto";import{readFileSync as nH}from"node:fs";import{basename as rH,extname as sH,resolve as rk}from"node:path";async function jp(e){return ek(e)}function Da(e){let t=nH(e);return Rb("md5").update(t).digest("hex").slice(0,8)}function aH(e,t){let n=new Map(Object.entries(e)).get(t);if(n!==void 0)return n;return new Map(Object.entries(ZO)).get(t)??iH}function lH(e,t,n){return Rb("md5").update(`${Da(e)}:${sk}:${t}:${n}`).digest("hex").slice(0,8)}function ok(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:sk,widths:e.widths});return Rb("md5").update(t).digest("hex").slice(0,8)}async function ik(e,t,n){let r=rk(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 tk({formats:n.formats,hashes:Object.fromEntries(n.formats.map((i)=>[i,lH(e,i,aH(n.quality,i))])),outDir:r,quality:s,source:e,stem:rH(e,sH(e)),widths:n.widths});return{contentHash:Da(e),original:o.original,variants:o.variants.map((i)=>({absolutePath:rk(r,i.fileName),format:i.format,outputPath:`/${oH}/${i.fileName}`,width:i.width}))}}function ak(e,t){return e.flatMap((n)=>n.format===t?[`${Tb(n.outputPath)} ${n.width}w`]:[]).join(", ")}function Tb(e){return e.split("/").map((t)=>encodeURIComponent(t)).join("/")}var oH="images/_optimized",sk=4,iH=100;var Op=F(()=>{nk()});import{existsSync as cH,mkdirSync as uH,readFileSync as fH,rmSync as dH,writeFileSync as pH}from"node:fs";import{basename as lk,extname as mH,resolve as tu}from"node:path";import{execSync as hH}from"node:child_process";import{createHash as gH}from"node:crypto";import{tmpdir as yH}from"node:os";function bH(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=hH("npm config get cache",{cwd:yH(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:xH}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function _p(e){if(kp===void 0)kp=bH();if(kp){let t=tu(e),n=gH("md5").update(t).digest("hex").slice(0,8);return tu(kp,"jxsuite-images",`${lk(t)}-${n}`)}return tu(e,".cache/images")}function ck(e,t){return`${Da(e)}:${ok(t)}:${lk(e,mH(e))}`}function uk(e){let t=tu(_p(e),"manifest.json");if(!cH(t))return{entries:{},touched:new Set,version:1};try{let n=JSON.parse(fH(t,"utf8"));return n.touched=new Set,n}catch{return{entries:{},touched:new Set,version:1}}}function fk(e,t,n={}){if(n.prune&&t.touched)$H(t,t.touched);let r=_p(e);uH(r,{recursive:!0}),pH(tu(r,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function $H(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))dH(i.absolutePath,{force:!0});delete e.entries[s]}}function dk(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 pk(e,t){e.touched?.add(t);let n=e.entries[t];if(!n)return null;return n.manifest}function mk(e,t,n,r){e.touched?.add(t),e.entries[t]={manifest:r,source:n,timestamp:Date.now()}}var kp,xH=3000;var Jb=F(()=>{Op()});function Nb(e,t){if(!t||hk(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return hk(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var hk=(e)=>e!==void 0&&e!==null&&e!=="";function yk(e){let t=e.lastIndexOf(".");return SH.get(t>0?e.slice(t).toLowerCase():"")??null}function Cp(e){try{return vH.decode(e)}catch{throw new tr("The metadata is not valid UTF-8.")}}function Ap(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function nu(e,t,n){return String.fromCodePoint(...e.subarray(t,t+n))}function xk(e,t){switch(t){case"jpeg":return jH(e).packet;case"png":return AH(e).packet;case"webp":return RH(e).packet;default:return MH(Cp(e)).packet}}function EH(e){if(e[0]!==255||e[1]!==216)throw new tr("Not a JPEG file.");let t=[],n=2;while(n+4<=e.length){if(e[n]!==255)throw new tr("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=Ap(e).getUint16(n+2),o=n+2+s;if(s<2||o>e.length)throw new tr("The JPEG's markers are damaged.");t.push({end:o,marker:r,start:n}),n=o}return t}function PH(e,t){let n=t.start+4;return t.marker===225&&t.end-n>=Mb.length&&Mb.every((r,s)=>e[n+s]===r)}function jH(e){let t=EH(e),n=t.find((s)=>PH(e,s));return{packet:n===void 0?null:Cp(e.subarray(n.start+4+Mb.length,n.end)),parts:t}}function kH(e){if(!gk.every((r,s)=>e[s]===r))throw new tr("Not a PNG file.");let t=[],n=gk.length;while(n+12<=e.length){let r=Ap(e).getUint32(n),s=n+12+r;if(s>e.length)throw new tr("The PNG's chunks are damaged.");let o=nu(e,n+4,4);if(t.push({dataStart:n+8,end:s,start:n,type:o}),n=s,o==="IEND")break}return t}function _H(e,t){if(t.type!=="iTXt")return null;let n=e.subarray(t.dataStart,t.end-4),r=n.indexOf(0);if(r===-1||nu(n,0,r)!==OH)return null;if(n[r+1]!==0)throw new tr("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 tr("The PNG's metadata chunk is damaged.");return Cp(n.subarray(o+1))}function AH(e){let t=kH(e);return{packet:t.map((r)=>_H(e,r)).find((r)=>r!==null)??null,parts:t}}function CH(e){if(nu(e,0,4)!=="RIFF"||nu(e,8,4)!=="WEBP")throw new tr("Not a WebP file.");let t=Math.min(e.length,8+Ap(e).getUint32(4,!0)),n=[],r=12;while(r+8<=t){let s=Ap(e).getUint32(r+4,!0),o=r+8,i=o+s+s%2;if(o+s>t)throw new tr("The WebP's chunks are damaged.");n.push({dataStart:o,end:Math.min(i,t),fourcc:nu(e,r,4),size:s,start:r}),r=i}return n}function RH(e){let t=CH(e),n=t.find((s)=>s.fourcc==="XMP ");return{packet:n===void 0?null:Cp(e.subarray(n.dataStart,n.dataStart+n.size)),parts:t}}function JH(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 NH(e){let t=/<svg[\s>/]/.exec(e);if(t===null)throw new tr("Not an SVG file.");let n=JH(e,t.index);if(n===-1)throw new tr("The SVG's root element is damaged.");return{end:n,selfClosing:e[n-1]==="/",start:t.index}}function MH(e){NH(e);let t=TH.exec(e);return t===null?{end:-1,packet:null,start:-1}:{end:t.index+t[0].length,packet:t[0],start:t.index}}var tr,SH,wH,vH,Mb,gk,OH="XML:com.adobe.xmp",TH;var bk=F(()=>{tr=class tr extends Error{name="XmpContainerError"};SH=new Map([[".jpeg","jpeg"],[".jpg","jpeg"],[".png","png"],[".svg","svg"],[".webp","webp"]]);wH=new TextEncoder,vH=new TextDecoder("utf-8",{fatal:!0});Mb=wH.encode("http://ns.adobe.com/xap/1.0/\x00");gk=Uint8Array.of(137,80,78,71,13,10,26,10);TH=/<([\w.-]+:)?xmpmeta\b[\s\S]*?<\/\1?xmpmeta\s*>/});function $k(){return{alt:"",focus:null,tags:[]}}function IH(e){if(e.startsWith("#x")||e.startsWith("#X"))return Number.parseInt(e.slice(2),16);return e.startsWith("#")?Number(e.slice(1)):null}function Db(e){return e.replaceAll(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,n)=>{let r=IH(n),s=r===null?DH.get(n):r<=1114111?String.fromCodePoint(r):void 0;if(s===void 0)throw new nr(`Unknown entity ${t}`);return s})}function LH(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:Db(e.slice(r))});break}if(o>r)s().children.push({type:"text",value:Db(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 nr("A packet may not declare a document type.");else if(i.startsWith("</")){let l=e.indexOf(">",o);if(l===-1)throw new nr("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 nr(`Unexpected </${c}>.`);r=l+1;continue}else{r=FH(e,o,n);continue}if(a===-1)throw new nr("Unterminated markup.");s().children.push({source:e.slice(o,a),type:"raw"}),r=a}if(n.length!==1)throw new nr(`<${s().name}> is never closed.`);return t.children}function FH(e,t,n){let r=t+1,s=Sk.exec(e.slice(r));if(s===null)throw new nr("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 nr(`<${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=Sk.exec(e.slice(r));if(a===null)throw new nr(`<${o.name}> has a malformed attribute.`);r+=a[0].length;while(/\s/.test(e[r]??""))r+=1;if(e[r]!=="=")throw new nr(`${a[0]} has no value.`);r+=1;while(/\s/.test(e[r]??""))r+=1;let l=e[r];if(l!=='"'&&l!=="'")throw new nr(`${a[0]} is not quoted.`);let c=e.indexOf(l,r+1);if(c===-1)throw new nr(`${a[0]} is never closed.`);o.attrs.push([a[0],Db(e.slice(r+1,c))]),r=c+1}}function Ia(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 VH(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 Tr(e,t,n,r,s=!1){let o=VH(e,t,s);return o!==null&&o[0]===n&&o[1]===r}function La(e){return e.filter((t)=>t.type==="element")}function Fa(e){return e.children.map((t)=>t.type==="text"?t.value:t.type==="element"?Fa(t):"").join("")}function vk(e,t=new Map){let n=[];for(let r of La(e)){let s=Ia(r,t);if(Tr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))n.push([r,s]);else n.push(...vk(r.children,s))}return n}function Va(e,t){let n=[];for(let r of La(e.children)){let s=Ia(r,t);for(let o of La(r.children)){let i=Ia(o,s);if(Tr(o.name,i,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","li"))n.push([o,i])}}return n}function qH(e,t){let n=e.attrs.find(([r])=>Tr(r,t,"http://www.w3.org/XML/1998/namespace","lang",!0));return n===void 0?null:n[1]}function HH(e,t){let n=Va(e,t),r=n.find(([s,o])=>qH(s,o)?.toLowerCase()==="x-default")??n[0];return r===void 0?Fa(e).trim():Fa(r[0])}function Rp(e,t){if(!e.attrs.some(([r,s])=>s==="Resource"&&Tr(r,t,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","parseType",!0)))for(let r of La(e.children)){let s=Ia(r,t);if(Tr(r.name,s,"http://www.w3.org/1999/02/22-rdf-syntax-ns#","Description"))return[r,s]}return[e,t]}function su(e,t,n,r){for(let s of La(e.children)){let o=Ia(s,t);if(Tr(s.name,o,n,r))return[s,o]}return null}function ru(e,t,n,r){let s=e.attrs.find(([i])=>Tr(i,t,n,r,!0));if(s!==void 0)return s[1].trim();let o=su(e,t,n,r);return o===null?null:Fa(o[0]).trim()}function wk(e){if(e===null||e==="")return null;let t=Number(e);return Number.isFinite(t)&&t>=0&&t<=1?t:null}function WH(e,t){let n=su(e,t,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rRole");if(n===null)return!1;return Va(...n).some(([r,s])=>{let[o,i]=Rp(r,s),a=su(o,i,"http://ns.adobe.com/xap/1.0/","Identifier");return(a===null?[ru(o,i,"http://ns.adobe.com/xap/1.0/","Identifier")??""]:Va(...a).map(([c])=>Fa(c).trim())).some((c)=>c.replace(/^https:/,"http:")==="http://cv.iptc.org/newscodes/imageregionrole/areaOfInterest")})}function BH(e,t){let[n,r]=Rp(e,t),s=su(n,r,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","RegionBoundary");if(s===null||!WH(n,r))return null;let[o,i]=Rp(...s),a=su(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbVertices");if(ru(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbShape")!=="polygon"||ru(o,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbUnit")!=="relative"||a===null)return null;let l=Va(...a);if(l.length!==1)return null;let[c,u]=Rp(...l[0]),d=wk(ru(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbX")),p=wk(ru(c,u,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","rbY"));return d===null||p===null?null:{x:d,y:p}}function UH(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 Ek(e){if(e===null)return $k();let t=$k(),n=!1;for(let[r,s]of vk(LH(e))){for(let[o,i]of r.attrs)if(!n&&Tr(o,s,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility",!0))t.alt=i,n=!0;for(let o of La(r.children)){let i=Ia(o,s);if(!n&&Tr(o.name,i,"http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/","AltTextAccessibility"))t.alt=HH(o,i),n=!0;else if(Tr(o.name,i,"http://purl.org/dc/elements/1.1/","subject"))t.tags.push(...Va(o,i).map(([a])=>Fa(a)));else if(t.focus===null&&Tr(o.name,i,"http://iptc.org/std/Iptc4xmpExt/2008-02-29/","ImageRegion"))for(let[a,l]of Va(o,i))t.focus??=BH(a,l)}}return t.tags=UH(t.tags),t.alt=t.alt.trim(),t}var nr,DH,Sk;var Pk=F(()=>{nr=class nr extends Error{name="XmpParseError"};DH=new Map([["amp","&"],["apos","'"],["gt",">"],["lt","<"],["quot",'"']]);Sk=/^[A-Za-z_][\w.:-]*/});import{existsSync as Tk,readFileSync as zH,statSync as KH}from"node:fs";import{basename as GH,extname as Fb,resolve as jk}from"node:path";async function ZH(e,t){let n=t.get(e);if(!n){let r=Da(e);try{let s=await jp(e);n={width:s.width,height:s.height,hash:r}}catch(s){if(!Ok)Ok=!0,console.warn(`Could not read image dimensions (${ye(s)}) — `+"emitting srcsets without width/height attributes.");n={width:null,height:null,hash:r}}t.set(e,n)}return n}function kk(e,t,n,r){let s=t.quality.webp??80,o=e.startsWith("/")?"":"/",i=r?`?v=${r}`:"",a=QH(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 QH(e){return e.replaceAll(/[\s,]/g,(t)=>encodeURIComponent(t))}async function eW(e,t,n,r,s){let o=ck(e,n),i=pk(s,o);if(i){if(i.variants.every((c)=>Tk(c.absolutePath)))return i}if(!i)console.log(` Optimizing ${GH(e)}...`);let a=await ik(e,_p(r),n);return mk(s,o,t,a),a}function tW(e){if(!e)return!0;if(e.includes("${"))return!0;if(Nk.some((n)=>e.startsWith(n)))return!0;let t=Fb(e).toLowerCase();return!XH.has(t)&&!Jk.has(t)}function nW(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(YH.has(Fb(n.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(n.hostname)}catch{return!1}}function Tp(e,t,n){let r=n?.length?Ff(n,e):null;if(r)return r;if(e.startsWith("/"))return jk(t,"public",e.slice(1));return jk(t,e)}function Ak(e){return`${Math.round(e*1000)/10}%`}function rW(e){let t=yk(e);if(t===null)return null;let n;try{let o=KH(e);n=`${e}|${o.mtimeMs}|${o.size}`}catch{return null}let r=_k.get(n);if(r!==void 0)return r;let s=null;try{let o=new Uint8Array(zH(e)),{focus:i}=Ek(xk(o,t));s=i===null?null:`${Ak(i.x)} ${Ak(i.y)}`}catch{s=null}return _k.set(n,s),s}function sW(e,t,n,r){if(!O(t)||t===""||t.includes("${"))return;if(Nk.some((a)=>t.startsWith(a)))return;let{style:s}=e;if(s!==void 0&&!V(s))return;if(s?.objectPosition!==void 0)return;let[o=""]=t.split(/[?#]/),i=rW(Tp(o,n,r));if(i!==null)e.style={...s,objectPosition:i}}function Vs(e){return e.replaceAll("$","$$$$")}async function Vb(e,t,n,r,s,o=[]){let i=new Map;return await Mk(e,t,n,r,s??new Map,i,o),{imageRefs:i}}async function Mk(e,t,n,r,s,o,i,a=null){if(e.tagName==="img"){if(await dW(e,t,n,r,s,o,i,a))return}if(O(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await xW(e.innerHTML,t,n,r,s,o,i,Lb(e,a));let l=Lb(e,a);for(let c of oW(e))await Mk(c,t,n,r,s,o,i,l)}function oW(e){let t=[],n=(s)=>{if(!It(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 Dk(e,t,n,r,s,o,i,a){if(!O(e)||t)return null;let l=nW(e,n);if(!l&&tW(e))return null;if(l)return{dims:null,sources:[],srcset:kk(e,n,1/0,null)};let c=Tp(e,r,a);if(!Tk(c))return null;if(n.service==="cloudflare"){let h=await ZH(c,o),x=kk(e,n,h.width??1/0,h.hash);return{dims:h.width&&h.height?{height:h.height,width:h.width}:null,sources:[],srcset:x}}if(Jk.has(Fb(c).toLowerCase()))return null;let u=i.get(c);if(!u)u=await eW(c,e,n,r,s),i.set(c,u);let d=aW(n.formats,u.variants),m=[...Ck.filter((h)=>d.includes(h)),...d.filter((h)=>!Ck.includes(h))].flatMap((h)=>{let x=ak(u.variants,h);return x===""?[]:[{srcset:x,type:iW.get(h)??`image/${h}`}]}),g=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,y=n.picture!==!1&&m.length>1;return{dims:g,fallbackSrc:cW(u.variants,d),sources:y?m:[],srcset:m[0]?.srcset??""}}function aW(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 cW(e,t){let n=lW.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&&Tb(r.outputPath)}function Rk(e){if(!O(e))return null;let t=uW.exec(e.trim());if(!t)return null;let n=Number(t[1]);return t[2]==="rem"?n*16:n}function Lb(e,t){let{style:n}=e;if(!V(n))return t;let r=t;for(let s of[Rk(n.maxWidth),Rk(n.width)])if(s!==null&&(r===null||s<r))r=s;return r}function Ik(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}function fW(e,t){for(let[n,r]of Object.entries(e)){if(n==="id"||n==="className")continue;let s=xd("img",n);if(!s)continue;if(delete e[n],t[s.attribute]!==void 0)continue;if(de(r)||ce(r)){t[s.attribute]=r;continue}let o=Tx(s,r);if(o===null)continue;t[s.attribute]=o===""&&s.kind!=="text"?!0:o}}async function dW(e,t,n,r,s,o,i,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;fW(e,l),sW(e,l.src,n,i);let c=t.optimize?await Dk(l.src,l["data-no-optimize"]!==void 0||l.srcset!==void 0,t,n,r,s,o,i):null,u=Lb(e,a),d=l.sizes??Ik(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,Nb(l,t.lazyLoad)),c&&c.sources.length>0)return pW(e,c.sources,d),!0;return!1}function pW(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 xW(e,t,n,r,s,o,i,a){let l=[];for(let u of e.matchAll(mW)){let d=u[0],p=u[1],m=(ou(p,"src")??"").replaceAll("&","&"),g=t.optimize&&m!==""?await Dk(m,hW.test(p)||Ib(p,"srcset")||bW(e,u.index),t,n,r,s,o,i):null,y=ou(p,"sizes"),h=y??Ik(a)??t.sizes,x=p,P="";if(g&&g.srcset!==""){if(P+=` srcset="${g.srcset}"`,y===void 0&&h!==void 0&&h!=="")P+=` sizes="${h}"`;let{fallbackSrc:E}=g;if(E!==void 0)x=p.replace(gW,(w,R)=>`${R}src="${E}"`)}if(g?.dims&&!Ib(p,"width")&&!Ib(p,"height"))P+=` width="${g.dims.width}" height="${g.dims.height}"`;let S=Nb({decoding:ou(p,"decoding"),fetchpriority:ou(p,"fetchpriority"),loading:ou(p,"loading")},t.lazyLoad);for(let[E,w]of Object.entries(S))P+=` ${E}="${w}"`;if(P==="")continue;let v=g&&g.sources.length>0?$W(x,g.sources,h,P):`<img${x}${P}>`;l.push({match:d,replacement:v})}let c=e;for(let{match:u,replacement:d}of l)c=c.replace(u,Vs(d));return c}function bW(e,t){let n=e.slice(0,t).toLowerCase();return n.lastIndexOf("<picture")>n.lastIndexOf("</picture>")}function $W(e,t,n,r){let s=e.replace(yW,""),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 ou(e,t){return new RegExp(`(?:^|\\s)${t}="([^"]*)"`,"i").exec(e)?.[1]}function Ib(e,t){return new RegExp(`(?:^|\\s)${t}=`,"i").test(e)}var XH,Jk,YH,Nk,Ok=!1,_k,Ck,iW,lW,uW,mW,hW,gW,yW;var qb=F(()=>{Op();Jb();Tn();bx();ae();hn();St();bk();Pk();XH=new Set([".jpg",".jpeg",".png",".webp",".tif",".tiff",".bmp"]),Jk=new Set([".avif"]),YH=new Set([".svg",".gif"]),Nk=["http://","https://","data:","//"];_k=new Map;Ck=["avif","webp","jpeg","png"],iW=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);lW=["jpeg","png"];uW=/^(\d+(?:\.\d+)?)(px|rem)$/;mW=/<img\b([^>]*)>/gi,hW=/\bdata-no-optimize\b/,gW=/(^|\s)src="[^"]*"/i,yW=/(?:^|\s)sizes="[^"]*"/i});import{closeSync as SW,existsSync as wW,openSync as vW,readSync as EW,statSync as Lk}from"node:fs";function PW(e){let t=new Uint8Array(10),n=vW(e,"r");try{if(EW(n,t,0,10,0)<10)return null}finally{SW(n)}let r=String.fromCodePoint(...t.subarray(0,6));if(r!=="GIF87a"&&r!=="GIF89a")return null;let s=new DataView(t.buffer),o=s.getUint16(6,!0),i=s.getUint16(8,!0);return o>0&&i>0?{height:i,width:o}:null}async function jW(e){let t=Lk(e),n=`${e}:${t.mtimeMs}:${t.size}`;if(Hb.has(n))return Hb.get(n)??null;let r=null;try{if(r=PW(e),r===null){let{height:s,width:o}=await jp(e);r=o>0&&s>0?{height:s,width:o}:null}}catch{r=null}return Hb.set(n,r),r}function OW(e,t){let n=e.trim(),r=t?.replace(/\/+$/,"");if(r&&n.startsWith(`${r}/`))n=n.slice(r.length);if(!n.startsWith("/")||n.startsWith("//"))return null;n=n.split("#")[0].split("?")[0];try{n=decodeURIComponent(n)}catch{return null}return n.split("/").includes("..")?null:n}async function Fk(e,t){let n=(c,u)=>V(c)&&c.tagName==="meta"&&c.attributes?.property===u,r=e.findLastIndex((c)=>n(c,"og:image"));if(r===-1||e.some((c)=>n(c,"og:image:width")||n(c,"og:image:height")))return e;let s=e[r].attributes?.content,o=O(s)?OW(s,t.siteUrl):null;if(o===null)return e;let i=Tp(o,t.projectRoot,t.mounts);if(!wW(i)||!Lk(i).isFile())return e;let a=await jW(i);if(a===null)return e;let l=(c,u)=>({attributes:{content:String(u),property:c},tagName:"meta"});return[...e.slice(0,r+1),l("og:image:width",a.width),l("og:image:height",a.height),...e.slice(r+1)]}var Hb;var Vk=F(()=>{Op();qb();ae();Hb=new Map});import{createHash as kW}from"node:crypto";import{existsSync as _W}from"node:fs";import{join as qk}from"node:path";function RW(e,t){let n=e.replace(/^\//,"");return e.endsWith("/")||n===""?qk(t,n,"index.html"):qk(t,n)}function Bb(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function TW(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return kW("sha256").update(t,"utf8").digest("hex").slice(0,8)}function Hk(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(!_W(RW(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)=>Le(n,m)),l=Le(n,AW),c=i===void 0?null:Le(n,i),u=`${Le(n,CW)}/`,d=`jx-${TW(e)}`,p=`/*
|
|
435
483
|
* Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
|
|
436
484
|
* Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
|
|
437
485
|
*/
|
|
@@ -532,7 +580,7 @@ self.addEventListener("fetch", (event) => {
|
|
|
532
580
|
})(),
|
|
533
581
|
);
|
|
534
582
|
});
|
|
535
|
-
`;return{errors:s,path:
|
|
583
|
+
`;return{errors:s,path:Wb,source:p,warnings:r}}function Wk(){return{errors:[],path:Wb,source:`/*
|
|
536
584
|
* Generated by @jxsuite/compiler. This site had a service worker and no longer does.
|
|
537
585
|
*
|
|
538
586
|
* A worker is sticky: removing the file would leave every previous visitor running the old one
|
|
@@ -555,89 +603,89 @@ self.addEventListener("activate", (event) => {
|
|
|
555
603
|
})(),
|
|
556
604
|
);
|
|
557
605
|
});
|
|
558
|
-
`,warnings:[]}}function
|
|
559
|
-
`,path:"manifest.webmanifest"}],warnings:r}}function
|
|
606
|
+
`,warnings:[]}}function Bk(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Le(t,`/${Wb}`)}',{scope:${JSON.stringify(Le(t,e))}}).catch(function(){})})}`}var Wb="sw.js",AW="/images/_optimized/",CW="/_jx";var Uk=F(()=>{Tn()});import{mkdirSync as JW,writeFileSync as NW}from"node:fs";import{dirname as MW,join as DW}from"node:path";function yo(e,t,n){if(n!==void 0)e[t]=n}function zk(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=ii(e.url),i=[];for(let u of t.icons??[])i.push(O(u.src)?{...u,src:Le(o,u.src)}:u);let a={display:t.display??"standalone",icons:i,name:s,short_name:t.shortName??s,start_url:Le(o,t.startUrl??"/")};yo(a,"description",t.description),yo(a,"theme_color",t.themeColor),yo(a,"background_color",t.backgroundColor),yo(a,"scope",t.scope===void 0?void 0:Le(o,t.scope)),yo(a,"orientation",t.orientation),yo(a,"lang",t.lang),yo(a,"dir",t.dir),yo(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=IW.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)}
|
|
607
|
+
`,path:"manifest.webmanifest"}],warnings:r}}function Kk(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 Gk(e,t){let n=e.securityTxt,r=[],s=[];if(n===void 0||n.enabled===!1)return{errors:r,files:[],warnings:s};let o=n.contact??[];if(o.length===0)r.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(n.expires===void 0)r.push("securityTxt: `expires` is required (RFC 9116 §2.5.5) — a security.txt with no expiry "+"never goes stale visibly, which is how they end up pointing at people who left.");else{let l=new Date(n.expires);if(Number.isNaN(l.getTime()))r.push(`securityTxt: \`expires\` is not a valid date: "${n.expires}".`);else if(l.getTime()<=t.getTime())r.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let i=[];for(let l of n.preferredLanguages??[]){let c=Zn(l);if(c===null)r.push(Rf("securityTxt.preferredLanguages",l));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(`
|
|
560
608
|
`)}
|
|
561
|
-
`,path:".well-known/security.txt"}],warnings:s}}function
|
|
562
|
-
`,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(l){s.push(`Bundling client runtime "${i.specifier}": ${ye(l)}`)}}return{errors:s,written:o}}function
|
|
563
|
-
`,{outfile:
|
|
564
|
-
`,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${AV(e,o)}: ${ye(a)}`)}}return{errors:n,written:s}}var pd,yx,CP=10;var MP=M(()=>{xg();$n();ae();Ft();$n();pd=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Is,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Tr,specifier:"lit-html"}];yx=import.meta.dirname});import{copyFileSync as NV,cpSync as bx,existsSync as qs,mkdirSync as xr,mkdtempSync as JV,readFileSync as MV,rmSync as IP,statSync as IV,writeFileSync as ln}from"node:fs";import{createHash as DV}from"node:crypto";import{tmpdir as LV}from"node:os";import{basename as $x,dirname as br,join as Nr,relative as Sx,resolve as ft,sep as DP}from"node:path";async function qP(e,t={}){let{clean:n=!0,includeHeld:r=!1,optimizeImages:s=!0,verbose:o=!1}=t,i=[],a=o?console.log.bind(console):()=>{},l={bundles:0,components:0,content:0,outputs:0,routes:0,setup:0,total:0},c=performance.now(),u=c,d=(y)=>{let P=performance.now();l[y]=P-u,u=P};a("Loading project.json...");let{config:p}=as(e);if(!s&&p.images.optimize)p.images={...p.images,optimize:!1},console.log("Image optimization is off for this build: images are published as they are.");if("contentTypes"in p)throw Error('project.json declares "contentTypes", which is no longer supported. Run `bun scripts/migrate-project-extensions.ts <project>` to migrate to "extensions" + "content", then `jx schema`.');let m=ft(e,p.build.outDir),g=ft(e,"pages"),b=ft(e,"public"),h=p.build.trailingSlash??"always",x=p.build.minify!==!1,k=new Map,w=new Map,v=new Map,E=(y)=>{let P=y.toSorted(),N=`/assets/elements-${DV("sha1").update(P.join("\x00")).digest("hex").slice(0,12)}.js`;return v.set(N,P),N},O=RP(),I=O.imports,D=new Set,V=_E(),{errors:W,i18n:A}=Hh(p);for(let y of W)i.push(y),console.error(y);for(let y of O.warnings)console.warn(y);let J=new Map,G=(y,P,R)=>{let N=J.get(y);if(N!==void 0&&N.entryPath!==P)throw Error(`"${R}" and "${N.specifier}" both map to ${y} — rename one`);J.set(y,{entryPath:P,specifier:R})},se=new Set,ie=(y)=>{if(!se.has(y))se.add(y),i.push(y),console.error(y)},le=(y)=>{let P=Li(y);if(P===null)return ie(`$src "${y}" is not a document script specifier`),y;if(P.side==="server")return ie(`${P.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),y;try{let R=Ru(`./${P.path}`);return G(R,y,y),k.set(R,{entryPath:y,script:!0,specifier:y}),R}catch(R){return ie(`Script of ${P.path}: ${ye(R)}`),y}},te=(y,P)=>{if(rf(y))return le(y);if(Di(y)!==null)return ie(`$src "${y}" names its own document's script, but it is not in a document: project.json has no $script. Move the entry into the page, layout or component that carries the script`),y;if(!ev(y))return y;try{let R=hg(y,P??e,e);if(!Ao(y)&&!qs(R))return console.warn(`Sidecar "${y}" not found at ${R} — emitting unbundled`),y;let N=Ao(y)?y:`./${Sx(e,R)}`,z=Ru(N);return G(z,R,y),k.set(z,{entryPath:R,specifier:y}),z}catch(R){return i.push(`Sidecar "${y}": ${ye(R)}`),y}},de=(y)=>{let P=hw(y);try{let R=hg(`npm:${y}`,e,e);return G(P,R,y),w.set(P,R),P}catch(R){return i.push(`$head specifier "${y}": ${ye(R)}`),y}},xe=await Rs(e,p),X=new Map,U=(y,P,R)=>{let N=Wf(y,{docDir:P,imports:R,projectRoot:e,registry:xe});if(N===void 0)throw Error(`external class "${y.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${y.$prototype}"`);if(yE(N.classDef))throw Error(`external class "${y.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let z=xE(N),Q=Ru(`class:${N.exportName}`);return G(Q,N.classJsonPath,y.$prototype),X.set(Q,z),Q},H=xe.formats,K=GE(e,(y)=>gs(y,H));if(H.entries.length>0)a(` Registered ${H.entries.length} format(s): ${H.entries.map((y)=>y.name).join(", ")}`);let He=xe.serverMounts().filter((y)=>{if(!y.project)return!0;let P=p[y.project.key];return F(P)&&Object.keys(P).length>0});if(He.length>0&&!p.build.adapter){let y=He.map((P)=>P.project?`"${P.project.key}"`:`"${P.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${y} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${LP}`)}if(d("setup"),n&&qs(m))IP(m,{force:!0,recursive:!0});if(xr(m,{recursive:!0}),!qs(g))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let Ve=await vE(g,H);a(` Found ${Ve.length} page(s)`),a("Loading project sections...");let Ze=await qE(e,p,xe,{includeHeld:r}),re=Object.keys(Ze);if(re.length>0)a(` Loaded ${re.length} section(s): ${re.join(", ")}`);let{errors:Gt,mounts:Qe}=await WE(xe,p,e);i.push(...Gt);for(let y of Gt)console.error(y);if(Qe.length>0)a(` Mounted ${Qe.length} asset dir(s): ${Qe.map((y)=>y.urlPrefix).join(", ")}`);let ht=new Set,kt=await qV(xe,p,e),We=(await PE(Ve,e,Ze,xe,p,A,{errors:i})).map((y)=>Object.assign(y,{locale:fr(y.urlPattern,A)}));a(` ${We.length} route(s) after expansion`);let Pe=0;d("content");let Ln=p.images.optimize&&p.images.service==="cloudflare",me=p.images.optimize&&!Ln?Hj(e):null,Xr=Ln?new Map:null;if(me&&p.images.formats?.includes("webp"))console.warn('images.formats lists "webp", which this compiler writes losslessly: its files are several times the size of AVIF or JPEG. Keep it only for pixel-exact output; ["avif", "jpeg"] is the default.');if(Ln)console.log('images.service is "cloudflare" — srcsets use /cdn-cgi/image transform URLs. '+"Ensure Image Transformations are enabled for your zone (Cloudflare dashboard → "+"Images → Transformations); these URLs do not work on *.pages.dev / *.workers.dev previews.");let st=[],et=new Map,Jt=new Map,$s=new Map,{components:ei,errors:po}=await ej({formatRegistry:H,pageSources:We.map((y)=>y.sourcePath),projectConfig:p,projectRoot:e});for(let y of po)i.push(y),console.error(y);if(ei.length>0){a("Compiling components...");let y=ft(m,"components");xr(y,{recursive:!0});let P=new Map(ei.map((ke)=>[ke.path,ke.tagName])),R=new Set(P.values()),N=new Map,z=new Set,Q=Co(p.url),ue=rd(Q),Y=new Map,ge=async(ke,ze)=>{await ux(ke,p.images,e,me,Xr??void 0,Qe);let gt=ze??"",Vn=Y.get(gt);if(Vn===void 0){let Se=Bl(ke,ze===null?{}:{sourcePath:ze},e,{asInitialValues:!0,config:p,registerBundle:(ot)=>{te(ot,null)},registry:xe,sections:Ze});Y.set(gt,Se),await Se;return}let Yr=await Vn;if(ke.state)Object.assign(ke.state,Yr)};for(let{doc:ke,path:ze}of ei){let gt=xf(ke,p.state);try{await ge(gt,ze);let Vn={formats:H,prepareDocument:async(Se,ot)=>{await ge(Se,ot),ww(Se,Q)},resolveClass:(Se,ot,On)=>Te(Q,U(Se,ot,On)),resolveElementPath:(Se,ot)=>{let On=ot?ft(ot,Se):ft(Se),ws=P.get(On);return ws?`./${ws}.js`:Se.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(Se,ot)=>Te(Q,te(Se,ot)),serverBaseUrl:ue,stylesheetHref:(Se)=>R.has(Se)?Te(Q,Df(Se)):null};if(p.$media)Vn.$media=p.$media;Vn.defaults=p.defaults;let Yr=await na(ze,Vn);for(let Se of Yr.files){let ot=Se.tagName?`${Se.tagName}.js`:$x(Se.path);if(!st.includes(Se.tagName))ln(ft(y,ot),Se.content,"utf8"),st.push(Se.tagName),Pe+=1}if(gt.tagName){Jt.set(gt.tagName,gt),$s.set(gt.tagName,ze);let Se=Jn(gt,p.defaults),ot=Lf(gt.tagName,gt.style,gt,p.$media??{},Se);if(N.set(gt.tagName,ot),Se===null)et.set(gt.tagName,ot),Kf(ot,Qe,ht),ln(ft(y,`${gt.tagName}.css`),ul(ot,Q),"utf8"),Pe+=1;else z.add(gt.tagName)}}catch(Vn){let Yr=ye(Vn),Se=Sx(e,ze).replaceAll("\\","/");i.push(`Error compiling component ${Se}: ${Yr}`),console.error(`Error compiling component ${Se}: ${Yr}`)}}for(let ke of z){let ze=H0(ke,Jt,N,z);Kf(ze,Qe,ht),ln(ft(y,`${ke}.css`),ul(ze,Q),"utf8"),Pe+=1}a(` Compiled ${st.length} component(s): ${st.join(", ")}`)}if(Jt.size>0){let y=[...Jt].map(([N,z])=>({className:Ls(N),doc:z,modulePath:Sx(e,ft(m,"components",`${N}.js`)).split(DP).join("/"),shadow:Jn(z,p.defaults)!==null,tagName:N})),{manifest:P,warnings:R}=Ou(y);for(let N of R)console.warn(N);ln(ft(m,"custom-elements.json"),Au(P),"utf8"),Pe+=1,a(` Wrote custom-elements.json (${y.length} element(s))`)}let ti=If(st,Jt),Fn=[];for(let[y,P]of Jt)Fn.push(...Ul(P,$s.get(y),e));if(p.state){let y=Ul({state:p.state},Un(e),e);for(let P of y)if(Di(P.src)===null)Fn.push(P);else ie(`Server function "${P.exportName}" in ${P.declaredIn} names "${P.src}", its own document's script, but project.json has no $script. Move the entry into the page, layout or component that carries the script`)}d("components");let Lt=p.url,or=Co(Lt),Ss=Boolean(Lt)&&p.build.sitemap!==!1,mo=[],vc=We.filter((y)=>!y.urlPattern.includes(":")&&!y.urlPattern.includes("*")),jp=A===null?new Map:await wE(vc,H),dn=vc.map((y)=>({translationKey:jp.get(y.urlPattern),urlPattern:y.urlPattern})),ni=X0(dn,A,Lt,h),{conflicts:Ec,sets:Pp}=vy(dn,A);for(let y of Ec){let[P,R]=y.urlPatterns,N=y.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",z=`${R} and ${P} are both the "${y.locale}" version of "${y.key}". A translation set names one URL per language, so ${R} is `+`dropped from it — it carries no alternates and no switcher. ${N}`;if(y.declared)i.push(z),console.error(z);else console.warn(z)}let ho=K0(We,A);if(ho.length>0)console.warn(`i18n.routing is "prefix-always", but ${ho.length} route(s) sit outside the locale tree and are served as "${A?.defaultLocale}": ${ho.slice(0,10).join(", ")}${ho.length>10?`, and ${ho.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(A!==null&&A.routing==="prefix-always"&&!p.build.adapter&&!We.some((y)=>y.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${A.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let jc=new Set,Pc=new Set,f=new Set;for(let y of We){let P=G0(y.urlPattern,A);if(P&&!jc.has(P.segment))jc.add(P.segment),console.warn(`Routes under /${P.segment}/ are served as "${A?.defaultLocale}" — `+`i18n.locales declares "${P.meant}", not "${P.segment}". Rename the directory to "${P.meant.toLowerCase()}" or declare the shorter tag.`);try{a(` Compiling ${y.urlPattern} ...`);let R=await FV(y,p,e,Ze,me,Jt,Xr,H,xe,te,Qe,kt,de,{alternates:ni.get(y.urlPattern)??[],i18n:A,translations:Pp.get(y.urlPattern)??[]},I,E,U);Fn.push(...R.serverEntries);for(let Y of R.unregisteredRelations)if(!Pc.has(Y))Pc.add(Y),console.warn(`<link rel="${Y}"> — "${Y}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");for(let Y of R.unrenderedHeadMaterial)if(!f.has(Y))f.add(Y),console.warn(Y);if(st.length>0)R.html=UV(R.html,st,et,new Set(st.filter((Y)=>!R.liveTags.has(Y))),R.files.map((Y)=>Y.content).join(`
|
|
565
|
-
`),
|
|
566
|
-
`,"utf8"),
|
|
609
|
+
`,path:".well-known/security.txt"}],warnings:s}}function Xk(e,t,n){let r=0,s=[];for(let o of e){let i=DW(t,o.path);if(n(i)){s.push(o.path);continue}JW(MW(i),{recursive:!0}),NW(i,o.content,"utf8"),r+=1}return{skipped:s,written:r}}var IW;var Yk=F(()=>{Tn();Cs();ae();IW=[192,512]});import{existsSync as LW,mkdirSync as zb,readFileSync as FW,readdirSync as VW,writeFileSync as qW}from"node:fs";import{dirname as iu,join as HW,relative as WW,resolve as Jp}from"node:path";function BW(e){return e.endsWith("/")}function Qk(e=Kb){let t={},n=[],r=[];for(let s of Np)if(UW(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 e_(e,t,n=Kb,r=!0){let s=[],o=0;for(let i of Np){if(!e.assetPaths.includes(i.assetPath))continue;let a=Jp(t,i.assetPath.replace(/^\//,""));zb(iu(a),{recursive:!0});try{await pi(`export * from ${JSON.stringify(i.specifier)};
|
|
610
|
+
`,{outfile:a,resolveDir:n},{minify:r,target:"browser"}),o+=1}catch(l){s.push(`Bundling client runtime "${i.specifier}": ${ye(l)}`)}}return{errors:s,written:o}}function Gb(e){return Object.entries(e).filter(([t,n])=>!BW(t)&&n.startsWith("/")).map(([,t])=>t)}function t_(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=M(r)?r.imports:void 0;if(!V(s))continue;let o=Object.entries(s).flatMap(([i,a])=>O(a)?[[i,a]]:[]);t.push(...Gb(Object.fromEntries(o)))}return t}function UW(e,t){try{return GE(e,t),!0}catch{return!1}}async function n_(e,t=Kb,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 ZE(u.specifier,t,{target:"browser"}));return i.get(u.specifier)},c=async(u)=>[...FW(u,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((p)=>p[1]);for(let u=0;u<Zk;u++){let d=0,p=[];try{p=VW(e,{recursive:!0}).map(String).filter((m)=>m.endsWith(".js")).map((m)=>HW(e,m))}catch{return Ub(e,o,r,a)}for(let m of p){let g=[];try{g=await c(m)}catch{continue}for(let y of g){let h=Np.find((S)=>y.startsWith(`${S.specifier}/`));if(!h||s.has(y))continue;s.add(y);let x=y.slice(h.specifier.length+1),P=Jp(e,`${h.assetDir.replace(/^\//,"")}${x}`);zb(iu(P),{recursive:!0});try{await pi(`export * from ${JSON.stringify(y)};
|
|
611
|
+
`,{outfile:P,resolveDir:t},{minify:n,resolver:zW(h,P,await l(h),o),target:"browser"}),a+=1,d+=1}catch(S){r.push(`Bundling runtime subpath "${y}": ${ye(S)}`)}}}if(d===0)return Ub(e,o,r,a)}return r.push(`Runtime subpath resolution did not settle in ${Zk} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Ub(e,o,r,a)}function zW(e,t,n,r){return{filter:/.*/,resolve:({importer:s,path:o})=>{if(ky(s))return;if(Np.find((a)=>o===a.specifier||o.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:o};if(n===void 0||!o.startsWith("."))return;if(Jp(iu(s),o)!==n)return;return r.set(Jp(iu(t),o),e.specifier),{external:!0,path:o}}}}function Ub(e,t,n,r){let s=r;for(let[o,i]of t){if(LW(o))continue;try{zb(iu(o),{recursive:!0}),qW(o,`export * from ${JSON.stringify(i)};
|
|
612
|
+
`,"utf8"),s+=1}catch(a){n.push(`Writing shared core stub ${WW(e,o)}: ${ye(a)}`)}}return{errors:n,written:s}}var Np,Kb,Zk=10;var r_=F(()=>{_y();hn();ae();St();hn();Np=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:po,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:es,specifier:"lit-html"}];Kb=import.meta.dirname});import{copyFileSync as KW,cpSync as Xb,existsSync as xo,mkdirSync as Jr,mkdtempSync as GW,readFileSync as XW,rmSync as s_,statSync as YW,writeFileSync as jn}from"node:fs";import{createHash as ZW}from"node:crypto";import{tmpdir as QW}from"node:os";import{basename as Yb,dirname as rr,join as is,relative as Mp,resolve as ut,sep as Zb}from"node:path";async function l_(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=(_)=>{let W=performance.now();l[_]=W-u,u=W};a("Loading project.json...");let{config:p}=Ur(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=ut(e,p.build.outDir),g=ut(e,"pages"),y=ut(e,"public"),h=p.build.trailingSlash??"always",x=p.build.minify!==!1,P=new Map,S=new Map,v=new Map,E=(_)=>{let W=_.toSorted(),X=`/assets/elements-${ZW("sha1").update(W.join("\x00")).digest("hex").slice(0,12)}.js`;return v.set(X,W),X},w=Qk(),R=w.imports,C=new Set,J=Kj(),{errors:D,i18n:A}=Xl(p);for(let _ of D)i.push(_),console.error(_);for(let _ of w.warnings)console.warn(_);let L=new Map,K=(_,W,z)=>{let X=L.get(_);if(X!==void 0&&X.entryPath!==W)throw Error(`"${z}" and "${X.specifier}" both map to ${_} — rename one`);L.set(_,{entryPath:W,specifier:z})},ne=new Set,B=(_)=>{if(!ne.has(_))ne.add(_),i.push(_),console.error(_)},U=(_)=>{let W=xa(_);if(W===null)return B(`$src "${_}" is not a document script specifier`),_;if(W.side==="server")return B(`${W.path}: a client function names "#server". A server module is called by a timing: "server" entry and never imported by a page`),_;try{let z=If(`./${W.path}`);return K(z,_,_),P.set(z,{entryPath:_,script:!0,specifier:_}),z}catch(z){return B(`Script of ${W.path}: ${ye(z)}`),_}},Z=(_,W)=>{if(md(_))return U(_);if(ya(_)!==null)return B(`$src "${_}" 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`),_;if(!KE(_))return _;try{let z=jy(_,W??e,e);if(!oi(_)&&!xo(z))return console.warn(`Sidecar "${_}" not found at ${z} — emitting unbundled`),_;let X=oi(_)?_:`./${Mp(e,z)}`,fe=If(X);return K(fe,z,_),P.set(fe,{entryPath:z,specifier:_}),fe}catch(z){return i.push(`Sidecar "${_}": ${ye(z)}`),_}},le=(_)=>{let W=cE(_);try{let z=jy(`npm:${_}`,e,e);return K(W,z,_),S.set(W,z),W}catch(z){return i.push(`$head specifier "${_}": ${ye(z)}`),_}},we=await qr(e,p),Y=new Map,$e=(_,W,z)=>{let X=up(_,{docDir:W,imports:z,projectRoot:e,registry:we});if(X===void 0)throw Error(`external class "${_.$prototype}" names no class: give it a $src or an imports entry, or enable the extension that provides "${_.$prototype}"`);if(Nj(X.classDef))throw Error(`external class "${_.$prototype}" reads the build's context (#/$context/) and cannot run in a browser: use "timing": "compiler"`);let fe=Mj(X),ze=If(`class:${X.exportName}`);return K(ze,X.classJsonPath,_.$prototype),Y.set(ze,fe),ze},me=we.formats,q=pO(e,(_)=>rs(_,me));if(me.entries.length>0)a(` Registered ${me.entries.length} format(s): ${me.entries.map((_)=>_.name).join(", ")}`);let Q=we.serverMounts().filter((_)=>oo(_,p));if(Q.length>0&&!p.build.adapter){let _=Q.map((W)=>W.project?`"${W.project.key}"`:`"${W.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${_} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${o_}`)}let pe=tB(Q,we,p);if(d("setup"),n&&xo(m))s_(m,{force:!0,recursive:!0});if(Jr(m,{recursive:!0}),!xo(g))throw Error(`pages/ directory not found in ${e}`);a("Discovering pages...");let Ke=await qj(g,me);a(` Found ${Ke.length} page(s)`);for(let _ of Ke){let W=s0(_.relativePath);if(W){let z=`pages/${mi(_.relativePath)}: ${W}. Rename the file.`;i.push(z),console.error(z)}}a("Loading project sections...");let re=await Tv(e,p,we,{includeHeld:r}),Mt=Object.keys(re);if(Mt.length>0)a(` Loaded ${Mt.length} section(s): ${Mt.join(", ")}`);let{errors:Ot,mounts:ft}=await lO(we,p,e);i.push(...Ot);for(let _ of Ot)console.error(_);if(ft.length>0)a(` Mounted ${ft.length} asset dir(s): ${ft.map((_)=>_.urlPrefix).join(", ")}`);let dt=new Set,kt=await rB(we,p,e),Xt=new Map,{collisions:kn,routes:$s}=Hj(await Uj(Ke,e,re,we,p,A,{errors:i,requestCache:Xt}));for(let _ of kn)if(_.kind==="tie")i.push(_.message),console.error(_.message);else console.warn(_.message);let it=$s.map((_)=>Object.assign(_,{locale:Br(_.urlPattern,A)}));a(` ${it.length} route(s) after expansion`);let Be=0;d("content");let qt=p.images.optimize&&p.images.service==="cloudflare",he=p.images.optimize&&!qt?uk(e):null,Ss=qt?new Map:null;if(he&&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(qt)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 Ht=[],xt=new Map,Yt=new Map,gl=new Map,{components:Ws,errors:Vo,cases:sr,caseReach:Bs}=await SO({formatRegistry:me,pageSources:it.map((_)=>_.sourcePath),projectConfig:p,projectRoot:e});for(let _ of Vo)i.push(_),console.error(_);let Un=new Map(sr.map((_)=>[_.path,_.tagName])),yl=(_,W)=>xO(_,rr(W),(z)=>Un.get(z)),Ri=new Set(Un.values()),zn=new Map([...Ri].map((_)=>[_,`./${_}.js`]));if(Ws.length>0||sr.length>0){a("Compiling components...");let _=ut(m,"components");Jr(_,{recursive:!0});let W=new Map([...Ws,...sr].map((At)=>[At.path,At.tagName])),z=new Set(W.values()),X=new Map,fe=new Set,ze=ii(p.url),_n=Pp(ze),Se=new Map,Zt=async(At,ir)=>{await Vb(At,p.images,e,he,Ss??void 0,ft);let Gs=ir??"",bl=Se.get(Gs);if(bl===void 0){let ws=Xc(At,ir===null?{}:{sourcePath:ir},e,{asInitialValues:!0,config:p,registerBundle:(Ji)=>{Z(Ji,null)},registry:we,requestCache:Xt,sections:re});Se.set(Gs,ws),await ws;return}let $n=await bl;if(At.state)Object.assign(At.state,$n)},or=[...Ws.map((At)=>({doc:At.doc,path:At.path})),...sr.map((At)=>({caseTag:At.tagName,doc:At.doc,path:At.path}))];for(let{doc:At,path:ir,caseTag:Gs}of or){let bl=yl(At,ir),$n=Jd(Gs===void 0?bl:xp(bl,Gs),p.state);try{await Zt($n,ir);let ws={caseModules:zn,formats:me,prepareDocument:async(nt,Bt)=>{await Zt(nt,Bt),gE(nt,ze)},resolveClass:(nt,Bt,zm)=>Le(ze,$e(nt,Bt,zm)),resolveElementPath:(nt,Bt)=>{let zm=Bt?ut(Bt,nt):ut(nt),JS=W.get(zm);return JS?`./${JS}.js`:nt.replace(/\.(?:json|jxn)$/i,".js")},projectRoot:e,projectState:p.state,rewriteSrc:(nt,Bt)=>Le(ze,Z(nt,Bt)),serverBaseUrl:_n,transformDocument:yl,stylesheetHref:(nt)=>z.has(nt)?Le(ze,sp(nt)):null};if(p.$media)ws.$media=p.$media;if(ws.defaults=p.defaults,Gs!==void 0)ws.caseTag=Gs;let Ji=await Ma(ir,ws);for(let nt of Ji.files){let Bt=nt.tagName?`${nt.tagName}.js`:Yb(nt.path);if(!Ht.includes(nt.tagName))jn(ut(_,Bt),nt.content,"utf8"),Ht.push(nt.tagName),Be+=1}if($n.tagName){Yt.set($n.tagName,$n),gl.set($n.tagName,ir);let nt=er($n,p.defaults),Bt=op($n.tagName,$n.style,$n,p.$media??{},nt);if(X.set($n.tagName,Bt),nt===null)xt.set($n.tagName,Bt),mp(Bt,ft,dt),jn(ut(_,`${$n.tagName}.css`),ac(Bt,ze),"utf8"),Be+=1;else fe.add($n.tagName)}}catch(ws){let Ji=ye(ws),nt=Mp(e,ir).replaceAll("\\","/"),Bt=Gs===void 0?"component":"case";i.push(`Error compiling ${Bt} ${nt}: ${Ji}`),console.error(`Error compiling ${Bt} ${nt}: ${Ji}`)}}for(let At of fe){let ir=oj(At,Yt,X,fe);mp(ir,ft,dt),jn(ut(_,`${At}.css`),ac(ir,ze),"utf8"),Be+=1}a(` Compiled ${Ht.length} component(s): ${Ht.join(", ")}`)}let Ti=[...Yt].filter(([_])=>!Ri.has(_));if(Ti.length>0){let _=Ti.map(([X,fe])=>({className:ho(X),doc:fe,modulePath:Mp(e,ut(m,"components",`${X}.js`)).split(Zb).join("/"),shadow:er(fe,p.defaults)!==null,tagName:X})),{manifest:W,warnings:z}=Nf(_);for(let X of z)console.warn(X);jn(ut(m,"custom-elements.json"),Mf(W),"utf8"),Be+=1,a(` Wrote custom-elements.json (${_.length} element(s))`)}let ku=rp(Ht,Yt),Us=[];for(let[_,W]of Yt)Us.push(...Zc(W,gl.get(_),e));if(p.state){let _=Zc({state:p.state},dr(e),e);for(let W of _)if(ya(W.src)===null)Us.push(W);else B(`Server function "${W.exportName}" in ${W.declaredIn} names "${W.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 zs=p.url,Ks=ii(zs),xl=Boolean(zs)&&p.build.sitemap!==!1,f=[],b=it.filter((_)=>!_.urlPattern.includes(":")&&!_.urlPattern.includes("*")),j=A===null?new Map:await Vj(b,me),k=b.map((_)=>({translationKey:j.get(_.urlPattern),urlPattern:_.urlPattern})),N=dj(k,A,zs,h),{conflicts:ee,sets:se}=Yl(k,A);for(let _ of ee){let[W,z]=_.urlPatterns,X=_.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",fe=`${z} and ${W} are both the "${_.locale}" version of "${_.key}". A translation set names one URL per language, so ${z} is `+`dropped from it — it carries no alternates and no switcher. ${X}`;if(_.declared)i.push(fe),console.error(fe);else console.warn(fe)}let ge=uj(it,A);if(ge.length>0)console.warn(`i18n.routing is "prefix-always", but ${ge.length} route(s) sit outside the locale tree and are served as "${A?.defaultLocale}": ${ge.slice(0,10).join(", ")}${ge.length>10?`, and ${ge.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(A!==null&&A.routing==="prefix-always"&&!p.build.adapter&&!it.some((_)=>_.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${A.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let xe=new Set,Ee=new Set,Re=(_)=>{let W=rr(s$(_.urlPattern,m,h));return new Map([...Ri].map((z)=>{let fe=Mp(W,ut(m,"components",`${z}.js`)).split(Zb).join("/");return[z,fe.startsWith(".")?fe:`./${fe}`]}))},Ie=new Set;for(let _ of it){let W=fj(_.urlPattern,A);if(W&&!xe.has(W.segment))xe.add(W.segment),console.warn(`Routes under /${W.segment}/ are served as "${A?.defaultLocale}" — `+`i18n.locales declares "${W.meant}", not "${W.segment}". Rename the directory to "${W.meant.toLowerCase()}" or declare the shorter tag.`);try{a(` Compiling ${_.urlPattern} ...`);let z=await eB(_,p,e,re,he,Yt,Ss,me,we,Z,ft,kt,le,{alternates:N.get(_.urlPattern)??[],i18n:A,translations:se.get(_.urlPattern)??[]},R,E,$e,yl,Re(_),Xt);Us.push(...z.serverEntries);for(let Se of z.unregisteredRelations)if(!Ee.has(Se))Ee.add(Se),console.warn(`<link rel="${Se}"> — "${Se}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");for(let Se of z.unrenderedHeadMaterial)if(!Ie.has(Se))Ie.add(Se),console.warn(Se);if(Ht.length>0)z.html=aB(z.html,Ht,xt,new Set(Ht.filter((Se)=>!z.liveTags.has(Se)&&!z.liveInstanceTags.includes(Se))),z.files.map((Se)=>Se.content).join(`
|
|
613
|
+
`),R,ku,{reach:Bs,tags:Ri});for(let Se of t_(z.html))C.add(Se);mp(z.html,ft,dt),Gj(z.html,J);let X=s$(_.urlPattern,m,h);Jr(rr(X),{recursive:!0});let fe=!_.urlPattern.includes(":")&&!_.urlPattern.includes("*"),ze=!Kc(_.urlPattern)&&!ij(z.html);if(xl&&!z.excludeFromSitemap&&ze&&fe){let Se=N.get(_.urlPattern)??[];f.push({lastmod:O(_.sourceMtime)&&_.sourceMtime!==""?_.sourceMtime:pB(YW(_.sourcePath).mtime),loc:ao(Na(_.urlPattern,h),zs),...Se.length>0&&{alternates:Se}})}let _n=[];for(let Se of me.withCapability("serialize")){if(!Se.exportTarget||Kc(_.urlPattern))continue;try{let Zt=await Se.call("serialize",z.doc,{buildScope:(or)=>fo(or,null),componentDefs:Yt,evaluateTemplate:(or,At)=>{if(!ce(or))return;return Kt(or,At)??or},mode:"export"});if(Zt){let or=X.replace(/\.html$/,Se.extensions[0]);_n.push({content:Zt,path:or,type:Se.mediaTypeEssence})}}catch(Zt){i.push(`Error exporting ${Se.name} for ${_.urlPattern}: ${ye(Zt)}`)}}for(let Se of _n)if(Se.type!==null)z.html=lj(z.html,{href:cj(m,Se.path),type:Se.type});jn(X,yy(z.html,Ks),"utf8"),Be+=1;for(let Se of _n)jn(Se.path,Se.content,"utf8"),Be+=1;for(let Se of z.files){let Zt=ut(rr(X),Se.path);Jr(rr(Zt),{recursive:!0}),jn(Zt,Se.content,"utf8"),Be+=1}}catch(z){let X=`Error compiling ${_.urlPattern}: ${ye(z)}`;i.push(X),console.error(X)}}if(d("routes"),he&&p.images.optimize){fk(e,he,{prune:i.length===0});let _=dk(he).filter((z)=>xo(z));if(_.length>0){let z=ut(m,"images/_optimized");Jr(z,{recursive:!0});for(let X of _)KW(X,ut(z,Yb(X)))}let W=Object.keys(he.entries).length;if(W>0)a(` Optimized ${W} image(s)`)}let _t=[];if(!p.build.adapter&&Us.length>0){let W=`timing: "server" entries ${[...new Set(Us.map(({exportName:z,declaredIn:X})=>`${z} (${X})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${o_}`;i.push(W),console.error(W)}if(p.build.adapter){let{adapter:_}=p.build;a("Generating site-wide server worker...");let{entries:W,errors:z}=EO(Us);_t=W;for(let Se of z)i.push(Se),console.error(Se);let{connectors:X}=pe,fe=nB(pe.mounts,Q,p,re,a);if(fe.length>0)a(` Mounting ${fe.length} extension route(s): ${fe.map((Se)=>Se.basePath).join(", ")}`);let _n=_==="cloudflare-pages"&&_t.length===0&&fe.length===0&&!Zf(A)?null:_b(_t,{adapter:_,base:Ks,connectors:X,i18n:A,mounts:fe});if(_n){let Se=_==="cloudflare-pages"?"_worker.js":"worker.js";try{await QE(_n,{adapter:_,outfile:ut(m,Se),plugins:[q.serverPlugin],projectRoot:e}),Be+=1,a(` Generated dist/${Se} (bundled, ${_t.length} server function(s))`)}catch(Zt){let or=`Error bundling dist/${Se}: ${ye(Zt)}`;i.push(or),console.error(or)}if(_==="cloudflare-pages")jn(ut(m,"_routes.json"),`${JSON.stringify({exclude:[],include:(Zf(A)?["/","/_jx/*"]:["/_jx/*"]).map((Zt)=>Le(Ks,Zt)),version:1},null,2)}
|
|
614
|
+
`,"utf8"),Be+=1}}if(C.size>0){a(`Bundling ${C.size} client runtime module(s)...`);let _=await e_({...w,assetPaths:[...C]},m,void 0,x);Be+=_.written;for(let W of _.errors)i.push(W),console.error(W)}if(S.size>0){a(`Copying ${S.size} package asset(s)...`);for(let[_,W]of S){let z=ut(m,_.replace(/^\//,""));Jr(rr(z),{recursive:!0}),Xb(W,z),Be+=1,a(` ${W} → ${_}`)}}if(P.size>0){a(`Bundling ${P.size} client sidecar module(s)...`);for(let[_,W]of P)try{let z=ut(m,_.replace(/^\//,""));Jr(rr(z),{recursive:!0});let X={entryPath:W.entryPath,outfile:z};if(W.script){let fe=await q.module(W.specifier);X.entryPath=fe.path,X.contents=fe.contents}await XE(X,{external:Py,minify:x,plugins:[q.clientPlugin],target:"browser"}),Be+=1,a(` ${W.specifier} → ${_}`)}catch(z){let X=`Error bundling sidecar "${W.specifier}": ${ye(z)}`;i.push(X),console.error(X)}}if(Y.size>0){a(`Bundling ${Y.size} external class module(s)...`);let _=GW(is(QW(),"jx-class-entries-"));try{let W=[...Y].map(([X,fe])=>{let ze=is(_,Yb(X));return jn(ze,fe,"utf8"),ze}),z=await YE(W,ut(m,"assets"),{external:Py,minify:x,target:"browser"});Be+=z.length;for(let X of Y.keys())a(` ${X}`)}catch(W){let z=`Error bundling external classes: ${ye(W)}`;i.push(z),console.error(z)}finally{s_(_,{force:!0,recursive:!0})}}if(v.size>0){a(`Bundling ${v.size} npm element set(s)...`);for(let[_,W]of v){let z=ut(m,_.replace(/^\//,""));Jr(rr(z),{recursive:!0});try{await pi(`${W.map((X)=>`import ${JSON.stringify(X)};`).join(`
|
|
567
615
|
`)}
|
|
568
|
-
`,{outfile:
|
|
569
|
-
Build complete: ${
|
|
570
|
-
${
|
|
616
|
+
`,{outfile:z,resolveDir:e},{minify:x,target:"browser"}),Be+=1,a(` ${W.length} element(s) → ${_}`)}catch(X){let fe=`Error bundling npm $elements [${W.join(", ")}]: ${ye(X)}`;i.push(fe),console.error(fe)}}}if(C.size>0){let _=await n_(m,void 0,x);if(_.written>0)a(`Bundling ${_.written} runtime subpath module(s)...`);Be+=_.written;for(let W of _.errors)i.push(W),console.error(W)}let Wt;try{Wt=hy(process.env)}catch(_){i.push(ye(_)),console.error(ye(_)),Wt=hy({})}for(let _ of we.emitters()){let W=_.project?.key,z=W?p[W]:void 0;if(!oo(_,p))continue;try{let X=await _.call("emit",z??null,{buildTime:Wt,projectConfig:p,root:e,routes:it,sections:re});for(let fe of X??[]){let ze=ut(m,fe.path.replace(/^\//,""));if(!ze.startsWith(m+Zb))throw Error(`emit path escapes outDir: ${fe.path}`);Jr(rr(ze),{recursive:!0}),jn(ze,fe.content),Be+=1,a(` ${_.name} emitted ${fe.path}`)}}catch(X){let fe=`Error in ${_.name}.emit: ${ye(X)}`;i.push(fe),console.error(fe)}}if(d("bundles"),p.redirects&&Object.keys(p.redirects).length>0){a("Generating redirects...");let _=new Set(it.map((z)=>z.urlPattern)),W=dB(p.redirects,m,{basePath:Ks,compiledUrls:_,trailingSlash:p.build.trailingSlash});Be+=W.files,i.push(...W.errors)}if(xl)a(`Generating sitemap (${f.length} URL(s))...`),Be+=hB(f,m);else if(!zs&&p.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(dt.size>0){let{copied:_,missing:W}=cO(dt,ft,m);Be+=_,a(`Copying ${_} mounted asset(s)...`);for(let z of W)console.warn(`Referenced asset not found: ${z}`)}if(xo(y))a("Copying public/ assets..."),Xb(y,m,{recursive:!0});if(xl)Be+=gB(m,zs);{let _=[zk(p),Gk(p,new Date)];for(let X of _){for(let fe of X.errors)i.push(fe),console.error(fe);for(let fe of X.warnings)console.warn(fe)}let{skipped:W,written:z}=Xk(_.flatMap((X)=>X.files),m,xo);Be+=z;for(let X of W)a(` ${X} — kept the copy from public/`)}{let _=Bb(p.serviceWorker);if(_!==null){let W=_===!1?Wk():Hk(_,m,Ks);for(let z of W.warnings)console.warn(z);for(let z of W.errors)i.push(z),console.error(z);if(W.path!==null)jn(is(m,W.path),W.source,"utf8"),Be+=1,a(_===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:_,rules:W}=nO(p.build,J);i.push(..._);let z=sO([...W,...rO(m)],Ks);if(z.length>0){a("Writing response headers..."),Be+=oO(m,z);let{adapter:X,deploy:fe}=p.build;if(X==="node"||X==="bun")console.warn(`The "${X}" 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(X===void 0&&fe===void 0)if(xo(ut(y,"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.")}Be+=iO(m)}if(p.copy){a("Copying mapped files...");for(let[_,W]of Object.entries(p.copy)){if(!O(W))throw TypeError(`project.json copy["${_}"] must be a destination path string`);let z=ut(e,_),X=ut(m,W);Jr(rr(X),{recursive:!0}),Xb(z,X)}}if(a(`
|
|
617
|
+
Build complete: ${it.length} routes, ${Be} files`),i.length>0)a(` ${i.length} error(s)`);return d("outputs"),l.total=performance.now()-c,{errors:i,files:Be,routes:it.length,serverEntries:_t,timings:l}}async function eB(e,t,n,r,s,o,i,a,l,c,u,d,p,m,g,y,h,x,P,S){let v=ii(t.url),E=x(Ei(await rs(e.sourcePath,a),e.sourcePath,n),e.sourcePath),w=await gO(E,t,n,x),R=yp(E,t,n),C=[...Zc(E,e.sourcePath,n),...R.flatMap((he)=>Zc(he.doc,he.path,n))],J=ap(E),D=[...J.head??[]],A=w.$head??[],L=J.title??null,K=new Set(Object.keys(w.state??{}));Ej(w,t,e,n,m.i18n,m.translations,J),va(w),delete w.title;let ne=Object.keys(t.state??{}).filter((he)=>he!=="$site"&&he!=="$page"&&!K.has(he)),B=pj({defaults:t.defaults,pageDir:O(E.$dir)?E.$dir:void 0,pageLang:J.lang,routeLocale:Br(e.urlPattern,m.i18n)}),U={...w.state};if(e.pagedState&&w.state&&e.pagedState.key in w.state)w.state[e.pagedState.key]=e.pagedState.items;let Z=new Set(Object.entries(w.state??{}).filter(([,he])=>M(he)&&he.timing==="compiler").map(([he])=>he));await Xc(w,e,n,{config:t,registerBundle:(he)=>{c(he,null)},registry:l,requestCache:S,sections:r});let le=oB(U,w.state??{},e.pagedState?.key),we=fo(w.state??{},null,{document:w,holdMutable:!0,roles:sn(w)}),Y=(he)=>{Object.assign(w.state.$page,he),Object.assign(we.$page,he)},$e=L??t.name;if(ce($e))$e=Kt($e,we)??$e;Y({title:$e});let me=Qb(i_(D,we),p),q=eb(me);if(q!==void 0)Y({description:q});let Q=Qb(i_(A,we),p);o$(w,we,le);let pe={counter:{n:0},media:{...t.$media,...w.$media},rules:[]},Ke={n:0},re=rj(o,w),Mt=new Set;if(r$(w,o,{defaults:t.defaults,liveInstanceTags:Mt,liveTags:re,scope:we,slotCss:pe,slotIds:Ke}),w.state){let he=new Set,Ss=new Set(ne);for(let[xt,Yt]of Object.entries(w.state)){if(xt==="$site"||xt==="$page")continue;if(Z.has(xt)||M(Yt)&&Yt.timing==="compiler")delete w.state[xt];else if(Array.isArray(Yt))he.add(xt);else if(gi(Yt))he.add(xt),Ss.add(xt)}for(let xt of ne)if(xt in w.state)he.add(xt);let Ht=!0;while(Ht){Ht=!1;let xt={...w.state};delete xt.$site,delete xt.$page;for(let Un of he)delete xt[Un];let{$head:Yt,$paths:gl,title:Ws,...Vo}=w,sr={...Vo,state:xt};if(XP(sr).length>0){for(let Un of Ss)if(he.delete(Un))Ht=!0}let Bs=JSON.stringify(sr);for(let Un of he)if(Td(Bs,Un))he.delete(Un),Ht=!0}for(let xt of he)delete w.state[xt]}let Ot=Bb(t.serviceWorker),ft=Ot===null||Ot===!1?[]:[{tagName:"script",textContent:Bk(Ot.scope??"/",v)}],dt=[...Kk(t),...ft,...d,...Qb(t.$head??[],p)],kt=hj(dt,Q,me,{title:$e,charset:t.defaults.charset??io,siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!Kc(e.urlPattern)&&{pageUrl:Na(e.urlPattern,t.build.trailingSlash)}}),Xt=await Fk(kt,{mounts:u,projectRoot:n,siteUrl:t.url});if(t.$media)w.$media={...t.$media,...w.$media};if(Object.values(w.$media??{}).some((he)=>Ar(String(he))!==null))Xt.splice(2,0,{tagName:"script",textContent:_a()});let kn=t.images;await Vb(w,kn,n,s,i??void 0,u);let $s={caseModules:P,lang:B.lang,prePaintScheme:!1,projectStyle:t.style??null,resolveClass:(he)=>Le(v,h(he,rr(e.sourcePath),w.imports??{})),rewriteSrc:(he)=>Le(v,c(he,rr(e.sourcePath))),runtimeImports:g,serverBaseUrl:Pp(v),title:$e},it=await Cb(w,$s);if(pe.rules.length>0){let he=`<style>
|
|
618
|
+
${ep(pe.rules.join(`
|
|
571
619
|
`))}
|
|
572
620
|
</style>
|
|
573
|
-
</head>`;
|
|
574
|
-
`}):null,
|
|
575
|
-
`),
|
|
576
|
-
${
|
|
577
|
-
</style>`,
|
|
578
|
-
`);return
|
|
579
|
-
</head>`))},
|
|
580
|
-
`),
|
|
581
|
-
`);return w.replace("</body>",
|
|
582
|
-
</body>`))}function
|
|
583
|
-
</body>`))}function
|
|
621
|
+
</head>`;it.html=it.html.replace("</head>",Vs(he))}it.html=cB(it.html,Xt,B);let Be=(he)=>typeof he==="string"&&!he.startsWith("./")&&!he.startsWith("../"),qt=[...new Set([...w.$elements??[],...R.flatMap((he)=>he.doc.$elements??[]),...E.$elements??[]].filter((he)=>Be(he)))];if(qt.length>0)it.html=lB(it.html,y(qt));return{doc:w,excludeFromSitemap:E.$sitemap===!1,files:it.files,html:it.html,liveInstanceTags:[...Mt],liveTags:re,unregisteredRelations:jO(Xt),unrenderedHeadMaterial:yj([...t.$head??[],...A,...D]),serverEntries:C}}function tB(e,t,n){if(e.length===0)return{connectors:[],mounts:[]};let r=ii(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,d=l.classDef.title??l.name;if(!O(u)||u==="")throw Error(`Extension class "${l.name}" mounts ${c.basePath} but declares no server.module, the import specifier (resolved from the project root) a deployable worker imports "${d}" from. The dev server's $implementation is not used for a build.`);let p=Le(r,c.basePath);return{basePath:p,className:d,module:u,options:{basePath:p,sections:s},order:c.order??100}}),i=new Set;for(let l of Object.values(s)){if(!M(l))continue;for(let c of Object.values(l)){let u=M(c)?c.provider:void 0;if(O(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(!O(u)||u==="")throw Error(`Connector class "${l.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:l.classDef.title??l.name,module:u,provider:c})}return{connectors:a,mounts:o}}function nB(e,t,n,r,s){return e.map((o)=>{let i=t.find((u)=>(u.classDef.title??u.name)===o.className)?.project?.key,a=i===void 0?[]:iE(n[i]),l=aE(a,r,n),c=a.filter(({name:u,section:d})=>l[d]?.[u]!==void 0);if(c.length===0)return o;return s(` Inlined referenced entries: ${c.map(({name:u,section:d})=>`${d}/${u} (${l[d][u].length})`).join(", ")}`),{...o,options:{...o.options,references:l}}})}async function rB(e,t,n){let r=[];for(let s of e.headProviders()){let o=s.project?.key,i=o===void 0?null:t[o];if(!oo(s,t))continue;try{let a=await s.call("head",i??null,{projectConfig:t,root:n});r.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${ye(a)}`)}}return r}function n$(e,t){if(Array.isArray(e))return e.map((n)=>n$(n,t));if(M(e))return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,n$(r,t)]));if(ce(e))return Kt(e,t)??e;return e}function i_(e,t){return e.map((n)=>{if(!V(n))return n;let r={...n};if(r.attributes){r.attributes={...r.attributes};for(let[s,o]of Object.entries(r.attributes))if(ce(o))r.attributes[s]=Kt(o,t)??o}if(ce(r.textContent))r.textContent=Kt(r.textContent,t)??r.textContent;else if(V(r.textContent))r.textContent=n$(r.textContent,t);return r})}function Qb(e,t){return e.map((n)=>{if(!V(n)||!n.attributes)return n;let r={...n,attributes:{...n.attributes}};for(let s of["href","src"]){let o=r.attributes[s];if(O(o)&&sB(o))r.attributes[s]=t(o)}return r})}function sB(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function c_(e){return p_(e).replaceAll("${","${")}function u_(e){return e.replaceAll("${","${")}function f_(e){return O(e)||Ve(e)||tt(e)?String(e):null}function d_(e,t){if(!V(e)||ns(e))return e;let n={};for(let[r,s]of Object.entries(e))if(r==="children"&&Array.isArray(e.children))n.children=e.children.map((o)=>{if(O(o))return ce(o)?f_(au(o,t))??o:o;return d_(o,t)});else if(r==="style"&&V(e.style)){let o={...e.style};for(let[i,a]of Object.entries(o))if(ce(a))o[i]=au(a,t)??a;n.style=o}else if(r==="attributes"&&V(e.attributes)){let o={...e.attributes};for(let[i,a]of Object.entries(o))if(ce(a)){let l=au(a,t);o[i]=O(l)&&l.includes("${")?u_(l):l??a}n.attributes=o}else if(r==="$props"&&V(e.$props)){let o={...e.$props};for(let[i,a]of Object.entries(o))if(de(a)&&a.$ref.startsWith("$map/"))o[i]=bi(Id(a.$ref,t))??null;else if(ce(a)){let l=au(a,t);o[i]=l!==null?l??null:a}n.$props=o}else if(ce(s)){let o=au(s,t);if(r==="textContent"&&O(o)&&o.includes("${"))n.innerHTML=c_(o);else n[r]=o??s}else n[r]=s;return n}function au(e,t){try{let n=t.$map,r=V(n)&&"item"in n?n.item:void 0,s=V(n)&&"index"in n?n.index:void 0,o=$a(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",o)(t,n,r,s)}catch{return null}}function o$(e,t,n){if(!V(e)||ns(e))return;if(ce(e.innerHTML)){let o=Kt(e.innerHTML,t);if(o!=null)e.innerHTML=String(o).replaceAll("${","${")}let r=e.textContent;if(ce(r)){let o=Kt(r,t);if(O(o)&&o.includes("${"))e.innerHTML=c_(o),delete e.textContent;else e.textContent=o??r}if(V(e.style)){for(let[o,i]of Object.entries(e.style))if(ce(i))e.style[o]=Kt(i,t)??i}if(V(e.attributes)){for(let[o,i]of Object.entries(e.attributes))if(ce(i)){let a=Kt(i,t);e.attributes[o]=O(a)&&a.includes("${")?u_(a):a??i}}if(V(e.$props)){let o=e.$props;for(let[i,a]of Object.entries(o))if(ce(a))o[i]=Kt(a,t)??a}let s=e.children;if(qe(s)){let o=a_(s,t,n);if(o){e.children=o;return}}if(ce(s)){let o=Kt(s,t);if(Array.isArray(o))e.children=Nd(o)}else if(Array.isArray(e.children)){let o=0;while(o<e.children.length){let i=e.children[o];if(ce(i)){let a=Kt(i,t);if(Array.isArray(a)){let c=Nd(a);e.children.splice(o,1,...c),o+=c.length;continue}let l=f_(a);if(l!==null){e.children[o]=l,o+=1;continue}}if(qe(i)){let a=a_(i,t,n);if(a){e.children.splice(o,1,...a),o+=a.length;continue}}o$(i,t,n),o+=1}}}function oB(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(Cn(o)&&(o.timing===void 0||o.timing==="compiler")&&t[s]!==o)r.add(s);return r}function iB(e,t,n){if(!de(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)&&!Rx(t,o)}function a_(e,t,n){wi(e);let{items:r,map:s}=e;if(!s||!Jx(e,t))return null;let o=Kx(e,t);if(o===null)return null;if(o.length===0&&!iB(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=d_(s,l);return o$(c,l,n),c})}function r$(e,t,n={}){let{defaults:r,liveTags:s,slotCss:o,slotIds:i,scope:a,liveInstanceTags:l}=n;if(!V(e))return;if(Array.isArray(e)){for(let d of e)r$(d,t,n);return}if(Array.isArray(e.children))for(let d of e.children)r$(d,t,n);let{tagName:c}=e;if(!O(c))return;let u=t.get(c);if(u){if(e.attributes){let{lifted:L,rest:K}=Wx(e.attributes);if(L)e.attributes=K,e.$props={...L,...e.$props}}let d=[],p=(L)=>{if(o&&V(L)&&!Array.isArray(L))np(L,o.rules,o.media,"",o.counter,"jxs");return EP(d,L)},m=er(u,r),g=Bx(u,e.attributes,{}),y={},h={};for(let[L,K]of Object.entries(e.$props??{})){if(L.startsWith("#"))continue;if(ce(K)||de(K)&&kP(K.$ref,a??null))y[L]=K;else if(de(K)){let ne=bi(ot(K,a??null));if(ne!==void 0)h[L]=ne}else h[L]=K}let x=Object.keys(y).length>0,P=g||e.$props?{...g,...h}:null,S={componentDefs:t,defaults:r,liveTags:s,path:[{key:JSON.stringify(P??{}),tag:c}],slotIds:i},v=!x&&!Gx(c,u,s),{children:E}=e,w=!m&&!v&&uo(u.children)?qx(S):null,R=m?an((Array.isArray(E)?E:[]).map((L)=>p(L)),{separator:`
|
|
622
|
+
`}):null,C=nj(u,P,m?null:Hx(E,a??null,p,w),S);if(w!==null)e.attributes={...e.attributes,[Pc]:String(w)};if(e.innerHTML=m?`<template shadowrootmode="${m}"><link rel="stylesheet" href="${sp(c)}">${C}</template>${R??""}`:C,delete e.children,d.length>0)vP(e,d);let J=zc(u,P),D=zx(u.style,J);if(Object.keys(D).length>0)e.style={...e.style,...D};let A=Ux(u.attributes,J);if(Object.keys(A).length>0)e.attributes={...e.attributes,...A};if(!v&&Object.keys(h).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(h).replaceAll("${",String.raw`\u0024{`)};if(x)e.$props=y,l?.add(c);else delete e.$props;if(v)e.$static=!0;else e.$prerendered=!0}}function aB(e,t,n,r,s,o,i,a){let l=(C)=>e.includes(`<${C}`),c=(C)=>s.includes(`<${C}`),u=new Set(t.filter((C)=>l(C)||c(C))),d=new Set(u);for(let C of d)for(let J of a.reach.get(C)??[])d.add(J);let p=t.filter((C)=>d.has(C));if(p.length===0)return e;let m=p.flatMap((C)=>{let J=n.get(C);return J===void 0||J===""?[]:[J]}).join(`
|
|
623
|
+
`),g=m===""?"":`<style>
|
|
624
|
+
${ep(m)}
|
|
625
|
+
</style>`,y=(C)=>{let J=C.filter(Boolean).join(`
|
|
626
|
+
`);return J===""?e:e.replace("</head>",Vs(` ${J}
|
|
627
|
+
</head>`))},h=i.filter((C)=>u.has(C)&&!a.tags.has(C)&&(c(C)||!r.has(C)));if(h.length===0)return y([g]);let x=Nc(o),P=Gb(o),S=[...a.tags].filter((C)=>l(C)),v=[...P,...h.map((C)=>`/components/${C}.js`),...S.map((C)=>`/components/${C}.js`)].map((C)=>`<link rel="modulepreload" href="${C}">`).join(`
|
|
628
|
+
`),E=e.includes('<script type="importmap">'),w=y([E?"":x,v,g]),R=h.map((C)=>`<script type="module" src="/components/${C}.js"></script>`).join(`
|
|
629
|
+
`);return w.replace("</body>",Vs(` ${R}
|
|
630
|
+
</body>`))}function lB(e,t){return e.replace("</body>",Vs(` <script type="module" src="${t}"></script>
|
|
631
|
+
</body>`))}function cB(e,t,n){let r=gj(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+=`
|
|
584
632
|
${l.join(`
|
|
585
633
|
`)}`;let c=o[1].match(/<script[\s\S]*?<\/script>/gi);if(c)i+=`
|
|
586
634
|
${c.join(`
|
|
587
|
-
`)}`}let a=e;if(s.test(a))a=a.replace(s,
|
|
635
|
+
`)}`}let a=e;if(s.test(a))a=a.replace(s,Vs(`<head>
|
|
588
636
|
${r}${i}
|
|
589
|
-
</head>`));return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,
|
|
590
|
-
<link rel="canonical" href="${
|
|
591
|
-
<meta name="robots" content="noindex">`,
|
|
637
|
+
</head>`));return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,Vs(`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",Vs(`<html dir="${n.dir}"`));return c}),a}function s$(e,t,n){if(e==="/")return is(t,"index.html");if(Kc(e))return is(t,"404.html");let r=e.replace(/^\//,"");if(n==="always")return is(t,r,"index.html");return is(t,`${r}.html`)}function fB(e){return Zl.includes(e)}function dB(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=O(u)?u:u.destination,p=!O(u)&&"rewrite"in u&&u.rewrite,m=p?200:!O(u)&&("status"in u)?u.status??301:301,g=Number(m),y=p?null:fB(g)?uB[g]:void 0;if(y===void 0){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${Zl.join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let h=n.basePath??"";if(o.push(`${Le(h,c)} ${Le(h,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(y===null||!y.html)continue;let x=s$(c,t,l),P=y.canonical?`
|
|
638
|
+
<link rel="canonical" href="${e$(d)}">`:`
|
|
639
|
+
<meta name="robots" content="noindex">`,S=`<!DOCTYPE html>
|
|
592
640
|
<html>
|
|
593
641
|
<head>
|
|
594
642
|
<meta charset="utf-8">
|
|
595
|
-
<meta http-equiv="refresh" content="0;url=${
|
|
643
|
+
<meta http-equiv="refresh" content="0;url=${e$(d)}">${P}
|
|
596
644
|
<title>Redirecting...</title>
|
|
597
645
|
</head>
|
|
598
646
|
<body>
|
|
599
|
-
<p>Redirecting to <a href="${
|
|
647
|
+
<p>Redirecting to <a href="${e$(d)}">${p_(d)}</a>...</p>
|
|
600
648
|
</body>
|
|
601
|
-
</html>`;
|
|
649
|
+
</html>`;Jr(rr(x),{recursive:!0}),jn(x,S,"utf8"),r+=1}if(o.length>0)jn(is(t,"_redirects"),`${o.join(`
|
|
602
650
|
`)}
|
|
603
|
-
`,"utf8"),r+=1;return{errors:s,files:r}}function
|
|
651
|
+
`,"utf8"),r+=1;return{errors:s,files:r}}function p_(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function e$(e){return String(e).replaceAll("&","&").replaceAll('"',""").replaceAll("<","<")}function t$(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function pB(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function hB(e,t){if(e.length===0)return 0;let n=e.map((o)=>{let i=(o.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${t$(a.hreflang)}" href="${t$(a.href)}"/>`).join(`
|
|
604
652
|
`);return` <url>
|
|
605
|
-
<loc>${
|
|
653
|
+
<loc>${t$(o.loc)}</loc>
|
|
606
654
|
<lastmod>${o.lastmod}</lastmod>
|
|
607
655
|
${i===""?"":`${i}
|
|
608
656
|
`} </url>`}).join(`
|
|
609
657
|
`),s=`<?xml version="1.0" encoding="UTF-8"?>
|
|
610
|
-
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${
|
|
658
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((o)=>(o.alternates?.length??0)>0)?` xmlns:xhtml="${mB}"`:""}>
|
|
611
659
|
${n}
|
|
612
660
|
</urlset>
|
|
613
|
-
`;return
|
|
661
|
+
`;return jn(is(t,"sitemap.xml"),s,"utf8"),1}function gB(e,t){let n=is(e,"robots.txt"),r=xo(n),s=r?XW(n,"utf8"):`User-agent: *
|
|
614
662
|
Allow: /
|
|
615
663
|
`;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
|
|
616
664
|
`))s+=`
|
|
617
665
|
`;return s+=`
|
|
618
|
-
Sitemap: ${
|
|
619
|
-
`,
|
|
620
|
-
`,"utf8"),
|
|
621
|
-
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function
|
|
622
|
-
`,"utf8"),
|
|
623
|
-
`,"utf8");let u=
|
|
624
|
-
`);return
|
|
666
|
+
Sitemap: ${ao("/sitemap.xml",t)}
|
|
667
|
+
`,jn(n,s,"utf8"),r?0:1}var o_='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',uB,mB="http://www.w3.org/1999/xhtml";var m_=F(()=>{ae();uy();nc();Rs();St();lE();Tn();pE();yE();_y();Ay();Ry();oa();lb();aO();Hr();Sf();uO();wO();gp();ba();pb();bp();PO();Qx();tb();lp();OO();rb();wa();WO();Qc();Ab();hn();Sa();ib();ob();qb();Vk();ub();Ac();Uk();Xx();Yk();Yx();r_();Jb();so();uB={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 yB}from"node:module";import{join as xB}from"node:path";import{spawn as bB}from"node:child_process";function $B(e){try{return yB(xB(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 h_(e,t,n=bB,r=process){let o=[$B(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 g_=()=>{};import{createServer as SB}from"node:http";import{existsSync as Dp,readFileSync as i$,statSync as wB}from"node:fs";import{extname as vB,join as a$,normalize as EB,resolve as y_,sep as PB}from"node:path";function OB(e,t){let n=EB(t).replaceAll("\\","/"),r=y_(e,`.${n.startsWith("/")?n:`/${n}`}`);if(r!==e&&!r.startsWith(e+PB))return null;if(Dp(r)){if(wB(r).isDirectory()){let o=a$(r,"index.html");return Dp(o)?o:null}return r}let s=a$(r,"index.html");return Dp(s)?s:null}async function kB(e){let t=_v(e);if(!t)return null;try{let n=ra(i$(t.path,"utf8"),t.path);return(await qr(e,n)).formats}catch(n){let r=n instanceof Error?n.message:String(n);return console.warn(`jx preview: ${r}; files are typed by the core table`),null}}function x_(e,t,n){let r=y_(e),s=n===void 0?Promise.resolve(null):kB(n),o=SB(async(i,a)=>{let l=new URL(i.url??"/","http://localhost"),c=OB(r,decodeURIComponent(l.pathname));if(c){a.writeHead(200,{"Content-Type":hw(c,await s)??jB.get(vB(c).toLowerCase())??"application/octet-stream"}),a.end(i$(c));return}let u=a$(r,"404.html");if(Dp(u)){a.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),a.end(i$(u));return}a.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),a.end("Not found")});return o.listen(t),o}var jB;var b_=F(()=>{Zm();Dl();so();Hr();jB=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"}))});function _B(e){let t=new RegExp(`^${sy}$`),n=e.filter((r)=>t.test(r));if(n.length===0)return!1;return{description:`A relationship pointer into one of this project's referenceable sections: ${n.join(", ")} (specs/extensions.md §9).`,pattern:`^#/(?:${n.join("|")})/${oy}$`}}function AB(e){let{corePath:t,fragments:n,fieldSchemaRefs:r=[],referenceableSections:s}=e;return{$comment:v_,$defs:{Fields:{$id:Ql,anyOf:[{$ref:`${$_}#/$defs/JxFieldSchema`},{$ref:`${$_}#/$defs/RelationshipRef`},...r.map((o)=>({$ref:o}))],...s&&{properties:{$ref:_B(s)}}}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...n.map((o)=>({$ref:o}))],type:"object",unevaluatedProperties:!1}}async function cu(e,t,n,r=[]){let s=structuredClone(e),o=new Map,i=new Set;l$(s,i);let a=0,l=async(u)=>{let d=lu(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}": ${DB(x)}`,{cause:x})}let g=O(m.$id)&&bo(m.$id)?m.$id:null;a+=g===null?1:0;let y=g??`urn:jx:bundled:${a}`;if(o.set(d,y),i.has(y))return y;i.add(y),m.$id=y,await c(m,MB(d),!0);let h=s.$defs??={};return h[y]=m,y},c=async(u,d,p=!1)=>{if(Array.isArray(u)){for(let h of u)await c(h,d);return}if(!M(u))return;let m=u,g=d;if(!p&&O(m.$id)&&bo(m.$id))g=null;let y=m.$ref;if(O(y)&&g!==null&&!y.startsWith("#")&&!bo(y)){let h=y.indexOf("#"),x=h===-1?y:y.slice(0,h),P=h===-1?"":y.slice(h);if(x){let S=await l(`${g}/${x}`);m.$ref=`${S}${P}`}}for(let h of Object.values(m))await c(h,g)};await c(s,lu(n),!0);for(let u of r)await l(`${lu(n)}/${u}`);return s}function JB(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*S_(e,t){for(let n of CB){let r=e[n];if(Array.isArray(r)){for(let[s,o]of r.entries())if(M(o))yield[o,`${t}/${n}/${s}`]}else if(M(r))yield[r,`${t}/${n}`]}for(let n of RB){let r=e[n];if(!M(r))continue;for(let[s,o]of Object.entries(r))if(M(o))yield[o,`${t}/${n}/${JB(s)}`]}for(let n of TB){let r=e[n];if(!Array.isArray(r))continue;for(let[s,o]of r.entries())if(M(o))yield[o,`${t}/${n}/${s}`]}}function NB(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 uu(e){let t=structuredClone(e);if(M(t.$defs)){let o=new Set(Object.keys(t.$defs).filter((a)=>!bo(a))),i={};for(let[a,l]of Object.entries(t.$defs)){let c=M(l)&&O(l.$id)?l.$id:a;i[bo(a)?NB(c,o):a]=l}t.$defs=i}let n=new Map,r=(o,i)=>{let{$id:a}=o;if(O(a)&&bo(a)&&!n.has(a))n.set(a,i);for(let[l,c]of S_(o,i))r(l,c)};r(t,"#");let s=(o,i)=>{let a=i,{$id:l}=o;if(O(l)&&bo(l)){if(a=n.get(l)??i,a!=="#")delete o.$id}let c=o.$ref;if(O(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 S_(o,a))s(u,a)};return s(t,"#"),t}function l$(e,t){if(Array.isArray(e)){for(let r of e)l$(r,t);return}if(!M(e))return;let n=e;if(O(n.$id)&&bo(n.$id))t.add(n.$id);for(let r of Object.values(n))l$(r,t)}function bo(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function lu(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 MB(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function DB(e){return e instanceof Error?e.message:String(e)}function IB(e){let{corePath:t,pathsValueRefs:n}=e;return{$comment:v_,$defs:{PathsValue:{$id:ri,anyOf:[...tc,...n.map((r)=>({$ref:r}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function E_(e){let{baseDir:t,coreDocumentRef:n,coreProjectRef:r,extensions:s,loadJson:o,referenceableSections:i}=e,a=[],l=[],c=[],u=[];for(let m of s){if(m.project)a.push(m.project);if(m.document){let g=await w_(m.document,o,t);if(l.push(...g),g.length>0)c.push(m.document)}if(m.fields)u.push(...await w_(m.fields,o,t)),a.push(m.fields)}let d=AB({corePath:r,fieldSchemaRefs:u,fragments:a,referenceableSections:i}),p=IB({corePath:n,pathsValueRefs:l});return{document:uu(await cu(p,o,t,c)),project:uu(await cu(d,o,t))}}async function w_(e,t,n){let r;try{r=await t(lu(`${lu(n)}/${e}`))}catch{return[]}let{$id:s}=r;if(!O(s)||!r.$defs)return[];return Object.keys(r.$defs).map((o)=>`${s}#/$defs/${o}`)}var $_="https://jxsuite.com/schema/project/core/v2",v_="Generated by `jx schema` from project.json#/extensions — do not edit.",CB,RB,TB;var P_=F(()=>{sa();ae();sa();CB=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],RB=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],TB=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as k_,readFileSync as LB,statSync as j_,writeFileSync as Ip}from"node:fs";import{createRequire as u$}from"node:module";import{dirname as FB,isAbsolute as VB,relative as f$,resolve as $o,sep as d$}from"node:path";async function __(e){let{config:t}=Ur(e),n=await qr(e,t),r=$o(e),{document:s,project:o}=await E_({baseDir:r,coreDocumentRef:O_(e,HB),coreProjectRef:O_(e,qB),extensions:n.extensions.map((i)=>({document:i.schemas.document&&c$(e,i,i.schemas.document),fields:i.schemas.fields&&c$(e,i,i.schemas.fields),project:i.schemas.project&&c$(e,i,i.schemas.project)})),loadJson:R_(r),referenceableSections:n.referenceableSections().flatMap((i)=>i.project?[i.project.key]:[])});return{documentSchema:s,projectSchema:o}}async function A_(e){let{documentSchema:t,projectSchema:n}=await __(e),r=$o(e,"project.schema.json"),s=$o(e,"document.schema.json");return Ip(r,`${JSON.stringify(n,null,2)}
|
|
668
|
+
`,"utf8"),Ip(s,`${JSON.stringify(t,null,2)}
|
|
669
|
+
`,"utf8"),{documentSchemaPath:s,projectSchemaPath:r}}async function C_(e,t={}){let{write:n=!0}=t,r=$o(e),s=dr(r),o=$o(r,"project.schema.json"),i=$o(r,"document.schema.json"),a=(y)=>{if(!k_(y))return!0;try{return j_(s).mtimeMs>j_(y).mtimeMs}catch{return!1}},c=a(o)||a(i)?await __(r):null;if(c&&n)Ip(o,`${JSON.stringify(c.projectSchema,null,2)}
|
|
670
|
+
`,"utf8"),Ip(i,`${JSON.stringify(c.documentSchema,null,2)}
|
|
671
|
+
`,"utf8");let u=R_(r),d=c?.projectSchema??fu(o),p=c?.documentSchema??fu(i),m=uu(await cu(d,u,r));return{document:uu(await cu(p,u,r)),project:m}}function fu(e){let t=JSON.parse(LB(e,"utf8"));if(!M(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function BB(e){return e.startsWith(WB)&&e.endsWith(".json")}function UB(e,t){try{return u$(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 R_(e){return async(t)=>{let n=$o(t),r=f$(e,n);if(r.startsWith("..")||VB(r))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=r.split(d$).join("/"),o="node_modules/",i=s.lastIndexOf(o),a=i===-1?null:s.slice(i+o.length);if(a!==null&&BB(a))return fu(UB(a,t));if(k_(n))return fu(n);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=Vh(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 fu(l)}}function O_(e,t){let n=null;try{n=u$($o(e,"package.json")).resolve(t)}catch{try{n=u$(import.meta.url).resolve(t)}catch{n=null}}let r=`./node_modules/${t}`;return n?T_(e,n,r):r}function c$(e,t,n){let r=f$(FB(t.manifestPath),n).split(d$).join("/"),s=`./node_modules/${t.specifier}/${r}`;return T_(e,n,s)}function T_(e,t,n){let r=f$(e,t).split(d$).join("/");if(r.startsWith(".."))return n;return r.startsWith("./")?r:`./${r}`}var qB="@jxsuite/schema/schemas/project.core.schema.json",HB="@jxsuite/schema/schema.json",WB="@jxsuite/schema/";var p$=F(()=>{P_();ae();Hr();oa();so()});var M_=G(function(Zae,N_){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",J_=bt("fs").promises,Lp=bt("path");async function zB({folder:e=__dirname}={}){let t={},n=await J_.readdir(e);for(let r of n)if(r.endsWith(".json")&&r!=="package.json"){let s=await J_.readFile(Lp.join(e,r),"utf8");t[Lp.basename(r,".json")]=JSON.parse(s)}return t}N_.exports={listAll:zB}});var F_=G(function(Qae,L_){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",KB=bt("fs").promises,D_=bt("path");async function I_({folder:e=__dirname}={}){let t=await KB.readFile(D_.join(e,"css.json"),"utf8");return JSON.parse(t)}async function GB({folder:e=__dirname}={}){let t=await I_(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}L_.exports={listAll:I_,index:GB}});var V_=G(function(Fp,m$){(function(e,t){typeof Fp=="object"&&typeof m$=="object"?m$.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Fp=="object"?Fp.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,b)=>{for(var j in b)e.o(b,j)&&!e.o(f,j)&&Object.defineProperty(f,j,{enumerable:!0,get:b[j]})},o:(f,b)=>Object.prototype.hasOwnProperty.call(f,b),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function n(f,b,j,k,N,{level:ee="error",autofix:se,ruleName:ge}={}){function xe(X){return X>0?f.slice(b,b+X):f.slice(Math.max(b+X,0),b)}function Ee(X,{precedes:fe}={}){let ze=X.map((Se)=>Se.trivia+Se.value).join(""),_n=f[b];return _n.type==="eof"?ze:fe?ze+_n.trivia:ze.slice(_n.trivia.length)}let Re=f[b].type!=="eof"?f[b].line:f.length>1?f[b-1].line:1,Ie=function(X){let fe=X.split(`
|
|
672
|
+
`);return fe[fe.length-1]}(Ee(xe(-5),{precedes:!0})),_t=xe(5),Wt=Ee(_t),_=Ie+Wt.split(`
|
|
625
673
|
`)[0]+`
|
|
626
|
-
`+(" ".repeat(
|
|
627
|
-
${gt}`;return{message:`${Yr} ${y}`,bareMessage:y,context:Yr,line:Y,sourceName:f.name,level:R,ruleName:z,autofix:N,input:ze,tokens:ke}}function r(f,S,j,y){return n(f,S,j,y,"Syntax")}function s(f,S,j,y,P={}){return P.ruleName=j,n(S.source,f.index,S,y,"Validation",P)}e.r(t),e.d(t,{WebIDLParseError:()=>_t,parse:()=>jp,validate:()=>Pc,write:()=>Pp});class o{constructor({source:f,tokens:S}){Object.defineProperties(this,{source:{value:f},tokens:{value:S,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},S=this;for(;S!==Object.prototype;){let j=Object.getOwnPropertyDescriptors(S);for(let[y,P]of Object.entries(j))(P.enumerable||P.get)&&(f[y]=this[y]);S=Object.getPrototypeOf(S)}return f}}function i(f,S,{useNullableInner:j}={}){if(!f.union){let y=S.unique.get(f.idlType);if(!y)return;if(y.type==="typedef"){let{typedefIncludesDictionary:P}=S.cache;if(P.has(y))return P.get(y);S.cache.typedefIncludesDictionary.set(y,void 0);let R=i(y.idlType,S);if(S.cache.typedefIncludesDictionary.set(y,R),R)return{reference:f,dictionary:R.dictionary}}if(y.type==="dictionary"&&(j||!f.nullable))return{reference:f,dictionary:y}}for(let y of f.subtype){let P=i(y,S);if(P)return y.union?P:{reference:y,dictionary:P.dictionary}}}function a(f,S){if(S.cache.dictionaryIncludesRequiredField.has(f))return S.cache.dictionaryIncludesRequiredField.get(f);S.cache.dictionaryIncludesRequiredField.set(f,void 0);let j=f.members.some((y)=>y.required);if(!j&&f.inheritance){let y=S.unique.get(f.inheritance);y?a(y,S)&&(j=!0):j=!0}return S.cache.dictionaryIncludesRequiredField.set(f,j),j}class l extends Array{constructor({source:f,tokens:S}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:S},parent:{value:null,writable:!0}})}}class c extends o{static parser(f,S){return()=>{let j=f.consumeKind(S);if(j)return new c({source:f.source,tokens:{value:j}})}}get value(){return A(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends c{static parse(f){let S=f.consumeKind("eof");if(S)return new u({source:f.source,tokens:{value:S}})}get type(){return"eof"}}function d(f,S){return J(f,{parser:c.parser(f,S),listName:S+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function g(f){for(let S of p){let j=d(f,S);if(j.length)return j}f.error("Expected identifiers, strings, decimals, or integers but none found")}class b extends o{static parse(f){let S={assign:f.consume("=")},j=K(new b({source:f.source,tokens:S}));if(j.list=[],S.assign){if(S.asterisk=f.consume("*"),S.asterisk)return j.this;S.secondaryName=f.consumeKind(...p)}return S.open=f.consume("("),S.open?(j.list=j.rhsIsList?g(f):le(f),S.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):S.assign&&!S.secondaryName&&f.error("No right hand side to extended attribute assignment"),j.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:S}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((j)=>S==="identifier-list"?f.identifier(j,this.parent):j.write(f)),f.token(this.tokens.close)])}}class h extends o{static parse(f){let S=f.consumeKind("identifier");if(S)return new h({source:f.source,tokens:{name:S},params:b.parse(f)})}constructor({source:f,tokens:S,params:j}){super({source:f,tokens:S}),j.parent=this,Object.defineProperty(this,"params",{value:j})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:S,list:j}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?j:this.params.tokens.secondaryName?A(S.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:S}=this.params;return!S||f?[]:S}*validate(f){let{name:S}=this;if(S==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(S)){let y=`\`[${S}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(S)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",y,{level:"warning",autofix:(j=this,()=>{let{name:P}=j;j.tokens.name.value=m.get(P),P==="TreatNullAs"&&(j.params.tokens={})})})}var j;for(let y of this.arguments)yield*y.validate(f)}write(f){return f.ts.wrap([f.ts.trivia(this.tokens.name.trivia),f.ts.extendedAttribute(f.ts.wrap([f.ts.extendedAttributeReference(this.name),this.params.write(f)])),f.token(this.tokens.separator)])}}class x extends l{static parse(f){let S={};S.open=f.consume("[");let j=new x({source:f.source,tokens:S});return S.open?(j.push(...J(f,{parser:h.parse,listName:"extended attribute"})),S.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),j.length||(f.unconsume(S.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),j):j}*validate(f){for(let S of this)yield*S.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((S)=>S.write(f)),f.token(this.tokens.close)]):""}}function k(f,S){let j=f.consume("?");j&&(S.tokens.nullable=j),f.probe("?")&&f.error("Can't nullable more than once")}function w(f,S){let j=function(y,P){let R=y.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!R)return;let N=K(new v({source:y.source,tokens:{base:R}}));switch(N.tokens.open=y.consume("<")||y.error(`No opening bracket after ${R.value}`),R.value){case"Promise":{y.probe("[")&&y.error("Promise type cannot have extended attribute");let z=de(y,P)||y.error("Missing Promise subtype");N.subtype.push(z);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let z=te(y,P)||y.error(`Missing ${R.value} subtype`);N.subtype.push(z);break}case"record":{y.probe("[")&&y.error("Record key cannot have extended attribute");let z=y.consume(...Ze)||y.error(`Record key must be one of: ${Ze.join(", ")}`),Q=new v({source:y.source,tokens:{base:z}});Q.tokens.separator=y.consume(",")||y.error("Missing comma after record key type"),Q.type=P;let ue=te(y,P)||y.error("Error parsing generic type record");N.subtype.push(Q,ue);break}}return N.idlType||y.error(`Error parsing generic type ${R.value}`),N.tokens.close=y.consume(">")||y.error(`Missing closing bracket after ${R.value}`),N.this}(f,S)||ie(f);if(!j){let y=f.consumeKind("identifier")||f.consume(...Ze,...Ve);if(!y)return;j=new v({source:f.source,tokens:{base:y}}),f.probe("<")&&f.error(`Unsupported generic type ${y.value}`)}return j.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),j.type=S||null,k(f,j),j.nullable&&j.idlType==="any"&&f.error("Type `any` cannot be made nullable"),j}class v extends o{static parse(f,S){return w(f,S)||function(j,y){let P={};if(P.open=j.consume("("),!P.open)return;let R=K(new v({source:j.source,tokens:P}));for(R.type=y||null;;){let N=te(j,y)||j.error("No type after open parenthesis or 'or' in union type");N.idlType==="any"&&j.error("Type `any` cannot be included in a union type"),N.generic==="Promise"&&j.error("Type `Promise` cannot be included in a union type"),R.subtype.push(N);let z=j.consume("or");if(!z)break;N.tokens.separator=z}return R.idlType.length<2&&j.error("At least two types are expected in a union type but found less"),P.close=j.consume(")")||j.error("Unterminated union type"),k(j,R),R.this}(f,S)}constructor({source:f,tokens:S}){super({source:f,tokens:S}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new x({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return A([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let P of[this.extAttrs,this.parent?.extAttrs])for(let R of P){if(R.name!=="AllowShared")continue;let N="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",N,{autofix:E(this,R,P)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(S=this,()=>{S.tokens.base.value="undefined"})});var S;let j=!this.union&&f.unique.get(this.idlType),y=this.union?this:j&&j.type==="typedef"?j.idlType:void 0;if(y&&this.nullable){let{reference:P}=i(y,f)||{};if(P){let R=(this.union?P:this).tokens.base;yield s(R,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let P of this.subtype)yield*P.validate(f)}write(f){return f.ts.wrap([this.extAttrs.write(f),(()=>{if(this.union||this.generic)return f.ts.wrap([f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),...this.subtype.map((P)=>P.write(f)),f.token(this.tokens.close)]);let S=this.tokens.prefix||this.tokens.base,j=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],y=f.reference(f.ts.wrap([...j,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(S.trivia),y])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function E(f,S,j){return()=>{let y=j.indexOf(S);j.splice(y,1),!j.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends o{static parse(f){let S=f.consume("=");if(!S)return null;let j=G(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),y=[j];if(j.value==="["){let P=f.consume("]")||f.error("Default sequence value must be empty");y.push(P)}else if(j.value==="{"){let P=f.consume("}")||f.error("Default dictionary value must be empty");y.push(P)}return new O({source:f.source,tokens:{assign:S},expression:y})}constructor({source:f,tokens:S,expression:j}){super({source:f,tokens:S}),j.parent=this,Object.defineProperty(this,"expression",{value:j})}get type(){return se(this.expression[0]).type}get value(){return se(this.expression[0]).value}get negative(){return se(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((S)=>f.token(S))])}}class I extends o{static parse(f){let S=f.position,j={},y=K(new I({source:f.source,tokens:j}));return y.extAttrs=x.parse(f),j.optional=f.consume("optional"),y.idlType=te(f,"argument-type"),y.idlType?(j.optional||(j.variadic=f.consume("...")),j.name=f.consumeKind("identifier")||f.consume(...re),j.name?(y.default=j.optional?O.parse(f):null,y.this):f.unconsume(S)):f.unconsume(S)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let S=i(this.idlType,f,{useNullableInner:!0});if(S){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:D(this)})}else if(this.parent&&!a(S.dictionary,f)&&function(y){let P=y.parent.arguments||y.parent.list,R=P.indexOf(y);return!P.slice(R+1).some((z)=>!z.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(j=this,()=>{let P=H(j.idlType);j.tokens.optional={...P,type:"optional",value:"optional"},P.trivia=" ",D(j)()})})}var j}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function D(f){return()=>{f.default=O.parse(new kt(" = {}"))}}class V extends o{static parse(f,{special:S,regular:j}={}){let y={special:S},P=K(new V({source:f.source,tokens:y}));return S&&S.value==="stringifier"&&(y.termination=f.consume(";"),y.termination)?(P.arguments=[],P):(S||j||(y.special=f.consume("getter","setter","deleter")),P.idlType=de(f)||f.error("Missing return type"),y.name=f.consumeKind("identifier")||f.consume("includes"),y.open=f.consume("(")||f.error("Invalid operation"),P.arguments=le(f),y.close=f.consume(")")||f.error("Unterminated operation"),y.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),P.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?A(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let S of this.arguments)yield*S.validate(f)}write(f){let{parent:S}=this,j=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:S}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((y)=>y.write(f))),f.token(this.tokens.close)]:[];return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),this.tokens.name?f.token(this.tokens.special):f.token(this.tokens.special,f.ts.nameless,{data:this,parent:S}),...j,f.token(this.tokens.termination)]),{data:this,parent:S})}}class W extends o{static parse(f,{special:S,noInherit:j=!1,readonly:y=!1}={}){let P=f.position,R={special:S},N=K(new W({source:f.source,tokens:R}));if(S||j||(R.special=f.consume("inherit")),N.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),R.readonly=f.consume("readonly"),y&&!R.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),R.base=f.consume("attribute"),R.base)return N.idlType=te(f,"attribute-type")||f.error("Attribute lacks a type"),R.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),R.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),N.this;f.unconsume(P)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return A(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let S=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",S)}{let{reference:S}=i(this.idlType,f)||{};if(S){let j=(this.idlType.union?S:this.idlType).tokens.base;yield s(j,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(S,j){if(S.union)return!1;if(S.extAttrs.some((P)=>P.name==="EnforceRange"))return!0;let y=j.unique.get(S.idlType);return y?.type==="typedef"&&y.idlType.extAttrs.some((P)=>P.name==="EnforceRange")}(this.idlType,f)){let S=this.idlType.tokens.base;yield s(S,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:S}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.special),f.token(this.tokens.readonly),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:S}),f.token(this.tokens.termination)]),{data:this,parent:S})}}function A(f){return f.startsWith("_")?f.slice(1):f}function J(f,{parser:S,allowDangler:j,listName:y="list"}){let P=S(f);if(!P)return[];P.tokens.separator=f.consume(",");let R=[P];for(;P.tokens.separator;){let N=S(f);if(!N){j||f.error(`Trailing comma in ${y}`);break}if(N.tokens.separator=f.consume(","),R.push(N),!N.tokens.separator)break}return R}function G(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function se({type:f,value:S}){switch(f){case"decimal":case"integer":return{type:"number",value:S};case"string":return{type:"string",value:S.slice(1,-1)}}switch(S){case"true":case"false":return{type:"boolean",value:S==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:S.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:S}}}function ie(f){let{source:S}=f,j=function(){let P=f.consume("unsigned"),R=f.consume("short","long");if(R){let N=f.consume("long");return new v({source:S,tokens:{prefix:P,base:R,postfix:N}})}P&&f.error("Failed to parse integer type")}()||function(){let P=f.consume("unrestricted"),R=f.consume("float","double");if(R)return new v({source:S,tokens:{prefix:P,base:R}});P&&f.error("Failed to parse float type")}();if(j)return j;let y=f.consume("bigint","boolean","byte","octet","undefined");return y?new v({source:S,tokens:{base:y}}):void 0}function le(f){return J(f,{parser:I.parse,listName:"arguments list"})}function te(f,S){let j=x.parse(f),y=v.parse(f,S);return y&&(K(y).extAttrs=j),y}function de(f,S){let j=v.parse(f,S||"return-type");if(j)return j;let y=f.consume("void");if(y){let P=new v({source:f.source,tokens:{base:y}});return P.type="return-type",P}}function xe(f){let S=f.consume("stringifier");if(!S)return;return W.parse(f,{special:S})||V.parse(f,{special:S})||f.error("Unterminated stringifier")}function X(f){let S=f.split(`
|
|
628
|
-
`);if(
|
|
629
|
-
${X(S)}`}}}function H(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return H(f.idlType);return Object.values(f.tokens).sort((S,j)=>S.index-j.index)[0]}function K(f,S){if(S||(S=f),!f)return f;return new Proxy(f,{get(j,y){let P=j[y];return Array.isArray(P)&&y!=="source"?K(P,j):P},set(j,y,P){if(j[y]=P,!P)return!0;if(Array.isArray(P))for(let R of P)R.parent!==void 0&&(R.parent=S);else P.parent!==void 0&&(P.parent=S);return!0}})}let He={decimal:/-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y,integer:/-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y,identifier:/[_-]?[A-Za-z][0-9A-Z_a-z-]*/y,string:/"[^"]*"/y,whitespace:/[\t\n\r ]+/y,comment:/\/\/.*|\/\*[\s\S]*?\*\//y,other:/[^\t\n\r 0-9A-Za-z]/y},Ve=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ze=["ByteString","DOMString","USVString"],re=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Gt=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(re,Ze,Ve),Qe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],ht=["_constructor","toString","_toString"];class kt{constructor(f){this.source=function(S){let j=[],y=0,P="",R=1,N=0;for(;y<S.length;){let Q=S.charAt(y),ue=-1;if(/[\t\n\r ]/.test(Q)?ue=z("whitespace",{noFlushTrivia:!0}):Q==="/"&&(ue=z("comment",{noFlushTrivia:!0})),ue!==-1){let Y=j.pop().value;R+=(Y.match(/\n/g)||[]).length,P+=Y,N-=1}else if(/[-0-9.A-Z_a-z]/.test(Q)){if(ue=z("decimal"),ue===-1&&(ue=z("integer")),ue===-1){ue=z("identifier");let Y=j.length-1,ge=j[Y];if(ue!==-1){if(ht.includes(ge.value)){let ke=`${A(ge.value)} is a reserved identifier and must not be used.`;throw new _t(r(j,Y,null,ke))}Gt.includes(ge.value)&&(ge.type="inline")}}}else Q==='"'&&(ue=z("string"));for(let Y of Qe)if(S.startsWith(Y,y)){j.push({type:"inline",value:Y,trivia:P,line:R,index:N}),P="",y+=Y.length,ue=y;break}if(ue===-1&&(ue=z("other")),ue===-1)throw Error("Token stream not progressing");y=ue,N+=1}return j.push({type:"eof",value:"",trivia:P,line:R,index:N}),j;function z(Q,{noFlushTrivia:ue}={}){let Y=He[Q];Y.lastIndex=y;let ge=Y.exec(S);return ge?(j.push({type:Q,value:ge[0],trivia:P,line:R,index:N}),ue||(P=""),Y.lastIndex):-1}}(f),this.position=0}error(f){throw new _t(r(this.source,this.position,this.current,f))}probeKind(f){return this.source.length>this.position&&this.source[this.position].type===f}probe(f){return this.probeKind("inline")&&this.source[this.position].value===f}consumeKind(...f){for(let S of f){if(!this.probeKind(S))continue;let j=this.source[this.position];return this.position++,j}}consume(...f){if(!this.probeKind("inline"))return;let S=this.source[this.position];for(let j of f)if(S.value===j)return this.position++,S}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class _t extends Error{constructor({message:f,bareMessage:S,context:j,line:y,sourceName:P,input:R,tokens:N}){super(f),this.name="WebIDLParseError",this.bareMessage=S,this.context=j,this.line=y,this.sourceName=P,this.input=R,this.tokens=N}}class We extends c{static parse(f){let S=f.consumeKind("string");if(S)return new We({source:f.source,tokens:{value:S}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:S}=this;return f.ts.wrap([f.ts.trivia(this.tokens.value.trivia),f.ts.definition(f.ts.wrap(['"',f.ts.name(this.value,{data:this,parent:S}),'"']),{data:this,parent:S}),f.token(this.tokens.separator)])}}class Pe extends o{static parse(f){let S={};if(S.base=f.consume("enum"),!S.base)return;S.name=f.consumeKind("identifier")||f.error("No name for enum");let j=K(new Pe({source:f.source,tokens:S}));return f.current=j.this,S.open=f.consume("{")||f.error("Bodyless enum"),j.values=J(f,{parser:We.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),S.close=f.consume("}")||f.error("Unexpected value in enum"),j.values.length||f.error("No value in enum"),S.termination=f.consume(";")||f.error("No semicolon after enum"),j.this}get type(){return"enum"}get name(){return A(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((S)=>S.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Ln extends o{static parse(f){let S=f.consumeKind("identifier");if(!S)return;let j={target:S};if(j.includes=f.consume("includes"),j.includes)return j.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),j.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Ln({source:f.source,tokens:j});f.unconsume(S.index)}get type(){return"includes"}get target(){return A(this.tokens.target.value)}get includes(){return A(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class me extends o{static parse(f){let S={},j=K(new me({source:f.source,tokens:S}));if(S.base=f.consume("typedef"),S.base)return j.idlType=te(f,"typedef-type")||f.error("Typedef lacks a type"),S.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=j.this,S.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),j.this}get type(){return"typedef"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class Xr extends o{static parse(f,S){let j={base:S},y=K(new Xr({source:f.source,tokens:j}));return j.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=y.this,j.assign=f.consume("=")||f.error("Callback lacks an assignment"),y.idlType=de(f)||f.error("Callback lacks a return type"),j.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),y.arguments=le(f),j.close=f.consume(")")||f.error("Unterminated callback"),j.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),y.this}get type(){return"callback"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let S of this.arguments)if(yield*S.validate(f),S.idlType.generic==="async_sequence")yield s(S.tokens.name,S,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.assign),f.ts.type(this.idlType.write(f)),f.token(this.tokens.open),...this.arguments.map((S)=>S.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class st extends o{static parse(f,S,{inheritable:j,allowedMembers:y}){let{tokens:P,type:R}=S;for(P.name=f.consumeKind("identifier")||f.error(`Missing name in ${R}`),f.current=S,S=K(S),j&&Object.assign(P,function(N){let z=N.consume(":");return z?{colon:z,inheritance:N.consumeKind("identifier")||N.error("Inheritance lacks a type")}:{}}(f)),P.open=f.consume("{")||f.error(`Bodyless ${R}`),S.members=[];;){if(P.close=f.consume("}"),P.close)return P.termination=f.consume(";")||f.error(`Missing semicolon after ${R}`),S.this;let N=x.parse(f),z;for(let[Q,...ue]of y)if(z=K(Q(f,...ue)),z)break;z||f.error("Unknown member"),z.extAttrs=N,S.members.push(z.this)}}get partial(){return!!this.tokens.partial}get name(){return A(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?A(this.tokens.inheritance.value):null}*validate(f){for(let S of this.members)S.validate&&(yield*S.validate(f))}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.callback),f.token(this.tokens.partial),f.token(this.tokens.base),f.token(this.tokens.mixin),f.name_token(this.tokens.name,{data:this}),(()=>this.tokens.inheritance?f.ts.wrap([f.token(this.tokens.colon),f.ts.trivia(this.tokens.inheritance.trivia),f.ts.inheritance(f.reference(this.tokens.inheritance.value,{context:this}))]):"")(),f.token(this.tokens.open),f.ts.wrap(this.members.map((S)=>S.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class et extends o{static parse(f){let S={};if(S.base=f.consume("const"),!S.base)return;let j=ie(f);if(!j){let P=f.consumeKind("identifier")||f.error("Const lacks a type");j=new v({source:f.source,tokens:{base:P}})}f.probe("?")&&f.error("Unexpected nullable constant type"),j.type="const-type",S.name=f.consumeKind("identifier")||f.error("Const lacks a name"),S.assign=f.consume("=")||f.error("Const lacks value assignment"),S.value=G(f)||f.error("Const lacks a value"),S.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let y=new et({source:f.source,tokens:S});return K(y).idlType=j,y}get type(){return"const"}get name(){return A(this.tokens.name.value)}get value(){return se(this.tokens.value)}write(f){let{parent:S}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:S}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:S})}}class Jt extends o{static parse(f){let S=f.position,j=K(new Jt({source:f.source,tokens:{}})),{tokens:y}=j;if(y.readonly=f.consume("readonly"),y.readonly||(y.async=f.consume("async")),y.base=y.readonly?f.consume("maplike","setlike"):y.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!y.base)return void f.unconsume(S);let{type:P}=j,R=P==="maplike",N=R||P==="iterable"||P==="async_iterable",z=P==="async_iterable"||j.async&&P==="iterable";y.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${P} declaration`);let Q=te(f)||f.error(`Missing a type argument in ${P} declaration`);return j.idlType=[Q],j.arguments=[],N&&(Q.tokens.separator=f.consume(","),Q.tokens.separator?j.idlType.push(te(f)):R&&f.error(`Missing second type argument in ${P} declaration`)),y.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${P} declaration`),f.probe("(")&&(z?(y.argsOpen=f.consume("("),j.arguments.push(...le(f)),y.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),y.termination=f.consume(";")||f.error(`Missing semicolon after ${P} declaration`),j.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(S=this,()=>{let y=S.tokens.async;S.tokens.base={...y,type:"async_iterable",value:"async_iterable"},delete S.tokens.async})});var S;for(let j of this.idlType)yield*j.validate(f);for(let j of this.arguments)yield*j.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((S)=>S.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((S)=>S.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class $s extends o{static parse(f){let S=f.consume("constructor");if(!S)return;let j={base:S};j.open=f.consume("(")||f.error("No argument list in constructor");let y=le(f);j.close=f.consume(")")||f.error("Unterminated constructor"),j.termination=f.consume(";")||f.error("No semicolon after constructor");let P=new $s({source:f.source,tokens:j});return K(P).arguments=y,P}get type(){return"constructor"}*validate(f){for(let S of this.arguments)yield*S.validate(f)}write(f){let{parent:S}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:S}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((j)=>j.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:S})}}function ei(f){let S=f.consume("static");if(!S)return;return W.parse(f,{special:S})||V.parse(f,{special:S})||f.error("No body in static member")}class po extends st{static parse(f,S,{extMembers:j=[],partial:y=null}={}){let P={partial:y,base:S};return st.parse(f,new po({source:f.source,tokens:P}),{inheritable:!y,allowedMembers:[...j,[et.parse],[$s.parse],[ei],[xe],[Jt.parse],[W.parse],[V.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((j)=>j.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:U(this)});let S=this.extAttrs.filter((j)=>j.name==="Constructor");for(let j of S)yield s(j.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:ti(this,j)});if(this.extAttrs.some((j)=>j.name==="Global")){let j=this.extAttrs.filter((P)=>P.name==="LegacyFactoryFunction");for(let P of j)yield s(P.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let y=this.members.filter((P)=>P.type==="constructor");for(let P of y)yield s(P.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(j,y){let P=function(ue){let Y=Q(ue);return{statics:new Set(Y.filter((ge)=>ge.special==="static").map((ge)=>ge.name)),nonstatics:new Set(Y.filter((ge)=>ge.special!=="static").map((ge)=>ge.name))}}(y),R=j.partials.get(y.name)||[],N=j.mixinMap.get(y.name)||[];for(let ue of[...R,...N]){let Y=Q(ue),ge=Y.filter((ze)=>ze.special==="static"),ke=Y.filter((ze)=>ze.special!=="static");yield*z(ge,P.statics,ue,y),yield*z(ke,P.nonstatics,ue,y),ge.forEach((ze)=>P.statics.add(ze.name)),ke.forEach((ze)=>P.nonstatics.add(ze.name))}function*z(ue,Y,ge,ke){for(let ze of ue){let{name:gt}=ze;if(gt&&Y.has(gt)){let Vn=`The ${ze.special==="static"?"static ":""}operation "${gt}" has already been defined for the base interface "${ke.name}" either in itself or in a mixin`;yield s(ze.tokens.name,ge,"no-cross-overload",Vn)}}}function Q(ue){return ue.members.filter(({type:Y})=>Y==="operation")}}(f,this))}}function ti(f,S){return f=K(f),()=>{let j=X(f.extAttrs.tokens.open.trivia),y=f.members.length?X(H(f.members[0]).trivia):function(Y){let ge=X(Y),ke=ge.includes("\t")?"\t":" ";return ge+ke}(j),P=$s.parse(new kt(`
|
|
630
|
-
${
|
|
631
|
-
`)||(
|
|
632
|
-
${j}`);let{extAttrs:z}=f,Q=z.indexOf(S),ue=z.splice(Q,1);z.length?z.length===Q?z[Q-1].tokens.separator=void 0:z[Q].tokens.name.trivia.trim()||(z[Q].tokens.name.trivia=ue[0].tokens.name.trivia):z.tokens.open=z.tokens.close=void 0}}class Fn extends st{static parse(f,S,{extMembers:j=[],partial:y}={}){let P={partial:y,base:S};if(P.mixin=f.consume("mixin"),P.mixin)return st.parse(f,new Fn({source:f.source,tokens:P}),{allowedMembers:[...j,[et.parse],[xe],[W.parse,{noInherit:!0}],[V.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class Lt extends o{static parse(f){let S={},j=K(new Lt({source:f.source,tokens:S}));return j.extAttrs=x.parse(f),S.required=f.consume("required"),j.idlType=te(f,"dictionary-type")||f.error("Dictionary member lacks a type"),S.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),j.default=O.parse(f),S.required&&j.default&&f.error("Required member must not have a default"),S.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),j.this}get type(){return"field"}get name(){return A(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:S}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.required),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:S}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:S})}}class or extends st{static parse(f,{extMembers:S=[],partial:j}={}){let y={partial:j};if(y.base=f.consume("dictionary"),y.base)return st.parse(f,new or({source:f.source,tokens:y}),{inheritable:!j,allowedMembers:[...S,[Lt.parse]]})}get type(){return"dictionary"}}class Ss extends st{static parse(f,{extMembers:S=[],partial:j}={}){let y={partial:j};if(y.base=f.consume("namespace"),y.base)return st.parse(f,new Ss({source:f.source,tokens:y}),{allowedMembers:[...S,[W.parse,{noInherit:!0,readonly:!0}],[et.parse],[V.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((S)=>S.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:U(this)});yield*super.validate(f)}}class mo extends st{static parse(f,S,{extMembers:j=[]}={}){let y={callback:S};if(y.base=f.consume("interface"),y.base)return st.parse(f,new mo({source:f.source,tokens:y}),{allowedMembers:[...j,[et.parse],[V.parse,{regular:!0}]]})}get type(){return"callback interface"}}function vc(f,S){let j=f.source;function y(Q){f.error(Q)}function P(...Q){return f.consume(...Q)}function R(Q){let ue=P("interface");if(ue)return Fn.parse(f,ue,{...Q,...S?.extensions?.mixin})||po.parse(f,ue,{...Q,...S?.extensions?.interface})||y("Interface has no proper body")}function N(){if(S.productions)for(let Q of S.productions){let ue=Q(f);if(ue)return ue}return function(){let Q=P("callback");if(Q)return f.probe("interface")?mo.parse(f,Q,{...S?.extensions?.callbackInterface}):Xr.parse(f,Q)}()||R()||function(){let Q=P("partial");if(Q)return or.parse(f,{partial:Q,...S?.extensions?.dictionary})||R({partial:Q})||Ss.parse(f,{partial:Q,...S?.extensions?.namespace})||y("Partial doesn't apply to anything")}()||or.parse(f,S?.extensions?.dictionary)||Pe.parse(f)||me.parse(f)||Ln.parse(f)||Ss.parse(f,S?.extensions?.namespace)}let z=function(){if(!j.length)return[];let Q=[];for(;;){let Y=x.parse(f),ge=N();if(!ge){Y.length&&y("Stray extended attributes");break}K(ge).extAttrs=Y,Q.push(ge)}let ue=u.parse(f);return S.concrete&&Q.push(ue),Q}();return f.position<j.length&&y("Unrecognised tokens"),z}function jp(f,S={}){let j=new kt(f);return S.sourceName!==void 0&&(j.source.name=S.sourceName),vc(j,S)}function dn(f){return f}let ni={wrap:(f)=>f.join(""),trivia:dn,name:dn,reference:dn,type:dn,generic:dn,nameless:dn,inheritance:dn,definition:dn,extendedAttribute:dn,extendedAttributeReference:dn};class Ec{constructor(f){this.ts=Object.assign({},ni,f)}reference(f,{unescaped:S,context:j}){return S||(S=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,S,j)}token(f,S=dn,...j){if(!f)return"";let y=S(f.value,...j);return this.ts.wrap([this.ts.trivia(f.trivia),y])}reference_token(f,S){return this.token(f,this.reference.bind(this),{context:S})}name_token(f,S){return this.token(f,this.ts.name,S)}identifier(f,S){return this.ts.wrap([this.reference_token(f.tokens.value,S),this.token(f.tokens.separator)])}}function Pp(f,{templates:S=ni}={}){S=Object.assign({},ni,S);let j=new Ec(S);return S.wrap(f.map((y)=>y.write(j)))}function ho(f,S){let j=new Map,y=f.filter((P)=>P.type==="includes");for(let P of y){let R=S.get(P.includes);if(!R)continue;let N=j.get(P.target);N?N.push(R):j.set(P.target,[R])}return j}function*jc(f){let S=function(j){let y=new Map,P=new Set,R=new Map;for(let N of j)if(N.partial){let z=R.get(N.name);z?z.push(N):R.set(N.name,[N])}else N.name&&(y.has(N.name)?P.add(N):y.set(N.name,N));return{all:j,unique:y,partials:R,duplicates:P,mixinMap:ho(j,y),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let j of S.all)j.validate&&(yield*j.validate(S));yield*function*({unique:j,duplicates:y}){for(let P of y){let{name:R}=P,N=`The name "${R}" of type "${j.get(R).type}" was already seen`;yield s(P.tokens.name,P,"no-duplicate",N)}}(S)}function Pc(f){return[...jc((S=f,S.flat?S.flat():[].concat(...S)))];var S}return t})())});var Ok=B(function(Gre,_k){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",Ek=yt("fs").promises,xd=yt("path"),jk=vk();class Pk{constructor(e,t){this.filename=t,this.shortname=xd.basename(t,".idl"),this.path=xd.join(e,t)}async text(){return await Ek.readFile(this.path,"utf8")}async parse(){let e=await this.text();return jk.parse(e)}}async function kk({folder:e=__dirname}={}){let t={},n=await Ek.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new Pk(e,r);t[s.shortname]=s}return t}async function Cq(e){let t=await kk(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}_k.exports={listAll:kk,parseAll:Cq}});function Rq(){return Ak??=Tq(),Ak}async function Tq(){let[e,t,n]=await Promise.all([Rk.listAll(),Tk.default.listAll(),Nk.default.parseAll()]),r=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)r.add(u.name);let s=[...r].toSorted(),o=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])o.add(u);let i=[...o].toSorted(),a=new Set;for(let c of Object.values(n))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let d of u.members)if(d.type==="attribute"&&d.name?.startsWith("on")&&d.idlType?.idlType==="EventHandler")a.add(d.name)}let l=[...a].toSorted();return{cssProps:i,eventHandlers:l,tagExamples:s}}function Nq(e){let t={};for(let n of e)t[n]={description:`Event handler for the "${n.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function Jq(e){let t={...el.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function Mq(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await Rq();return{$defs:{DefsMap:Dh,TypeDefEntry:Lh,StateMap:Ih,StateEntry:Mh,TypedStateDef:rh,PureTypeDef:ph,FunctionDef:oh,ClassDef:Vh,ClassParameterDef:xu,ClassFieldDef:bu,ClassConstructorDef:$u,ClassMethodDef:Su,FormatDef:wu,ProjectBlockDef:vu,ServerBlockDef:Eu,ConnectorBlockDef:ju,StudioHints:Pu,ExternalClassDef:fh,ExpressionPointer:xh,ExpressionLiteral:bh,ExpressionOperand:$h,UnaryOperator:Sh,BinaryOperator:wh,ConditionalOperator:vh,SwitchOperator:Eh,CallOperator:jh,PureMethod:Ph,AssignmentOperator:kh,NoArgMethod:_h,OneArgMethod:Oh,SpliceMethod:Ah,ReduceMethod:Ch,MapFilterMethod:Rh,ExpressionNode:Th,ExpressionEntry:Nh,Statement:ah,StatementList:lh,ElementDef:{...yu,properties:{...yu.properties,...Nq(n)}},ChildrenValue:Gm,ArrayNamespace:Km,SwitchDef:eh,SwitchNode:th,StyleObject:{...el,properties:Jq(t)},AttributesObject:Ym,PropsObject:Zm,RefObject:Wm,AnyRef:Hm,InternalRef:Im,StateRef:Dm,ExternalRef:Lm,ExternalComponentRef:Bm,GlobalRef:Fm,ParentRef:Vm,MapRef:qm,ElementPropertyValue:Qm,StringOrRef:jm,BoolOrRef:Pm,NumberOrRef:km,CemParameter:Cm,CemEvent:Rm,TagName:{...vm,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:$m,ElementTagName:Sm,JsonSchemaType:Jm,HeadEntry:Om,ImageConfig:Qa,PathsValue:{$id:Oo,anyOf:[...rl,Gh],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$script:{additionalProperties:!1,description:"This document's own modules, as TypeScript module text (spec.md §23.2). "+'A state entry names an export of one with `$src: "#client"` or `$src: "#server"`. `client` runs in the browser; `server` runs only on the server and is never sent to one.',properties:{client:{description:'The module the browser runs. A Function entry with `$src: "#client"` is one of its exports.',type:"string"},server:{description:'The module the server runs. A `timing: "server"` entry with `$src: "#server"` is one of its exports, called with `(args, env)`.',type:"string"}},type:"object"},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Oo,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},formAssociated:{description:"Makes the custom element a form-associated one (the Web Components formAssociated static): it attaches ElementInternals, a form's reset and a disabled fieldset reach its `value`, `checked` and `disabled` state, `required` with an empty value is reported as a missing value, and a label naming it reaches its control.",type:"boolean"},formValue:{description:"The value a form-associated custom element submits under its `name`, through ElementInternals.setFormValue: a `$ref`, a `${}` template or a literal. Omit it when a named native control inside the element already submits the value."},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function Iq(){return{$defs:{ImageConfig:Qa,StyleObject:Jk},$id:"https://jxsuite.com/schema/project/v1",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:_u.properties,title:"Jx Project",type:"object"}}function Dq(){return{$defs:{ImageConfig:Qa,JxFieldSchema:zh,RelationshipRef:Kh,StyleObject:Jk},$id:"https://jxsuite.com/schema/project/core/v2",$schema:"https://json-schema.org/draft/2020-12/schema",description:"Core fragment of the Jx project.json schema. Open by design: extension fragments contribute their own top-level sections and the generated per-project entry document "+"(project.schema.json) closes the composition. See specs/extensions.md §5.",properties:_u.properties,title:"Jx Project Core",type:"object"}}function Lq(){return{$id:nl,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/JxFieldSchema"},{$ref:"https://jxsuite.com/schema/project/core/v2#/$defs/RelationshipRef"}],description:"Default field-schema union for section entry schemas: the core field shape plus relationship references. Per-project entry documents override this resource with the "+"effective union. See specs/extensions.md §5.3.",title:"Jx Project Field Union"}}function Fq(){return{$id:Oo,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...rl,Gh],description:"Default $paths-value union for documents: the core source shapes. Per-project entry documents override this resource with those members PLUS every extension-contributed paths shape.",title:"Jx Document Paths Union"}}function Vq(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...Bh}}function Mx(){return{$defs:{ClassConstructorDef:$u,ClassFieldDef:bu,ClassMethodDef:Su,ClassParameterDef:xu,ConnectorBlockDef:ju,FormatDef:wu,ProjectBlockDef:vu,ServerBlockDef:Eu,StudioHints:Pu},$id:"https://jxsuite.com/schema/class/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:!1,description:"Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",examples:["./md.js","./lib/calculator.js"],type:"string"},$prototype:{const:"Class",description:'Must be "Class" for class definition files.',type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",examples:["MarkdownFile","DataSource","Calculator"],type:"string"}},required:["$prototype","title"],title:"Jx Class Definition",type:"object"}}async function qq(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await Mq(),a=Iq(),l=Mx(),c=Dq(),u=Vq(),d=Lq(),p=Fq(),m=JSON.stringify(i,null,2),g=JSON.stringify(a,null,2),b=JSON.stringify(l,null,2),h=JSON.stringify(c,null,2),x=JSON.stringify(u,null,2),k=JSON.stringify(d,null,2),w=JSON.stringify(p,null,2),[v]=process.argv.slice(2);if(v)n(v,m,"utf8"),console.error(`Jx component schema written to ${v}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),g,"utf8"),n(r(o,"class-schema.json"),b,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),h,"utf8"),n(r(o,"schemas","project.fields.schema.json"),k,"utf8"),n(r(o,"schemas","document.paths.schema.json"),w,"utf8"),n(r(o,"extension-manifest.schema.json"),x,"utf8");let E=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(E.exitCode!==0){let O=E.stderr.toString()||E.stdout.toString()||`exit ${E.exitCode}${E.signalCode?`, signal ${E.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${O})`)}console.error("Generated:"),console.error(" schema.json (component)"),console.error(" project-schema.json"),console.error(" class-schema.json"),console.error(" schemas/project.core.schema.json"),console.error(" schemas/project.fields.schema.json"),console.error(" schemas/document.paths.schema.json"),console.error(" extension-manifest.schema.json")}}var Rk,Tk,Nk,Ak=null,Jk,Ck,xse;var Mk=M(()=>{wm();Em();_m();Am();Tm();Mm();Um();zm();Xm();nh();sh();ih();ch();dh();mh();Jh();Fh();qh();Uh();sl();Nm();Wh();Rk=Sr(xk(),1),Tk=Sr(wk(),1),Nk=Sr(Ok(),1);Jk={...el,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,Ck]=process.argv,xse=Ck?.endsWith("schema.ts")?qq(Ck):void 0});function bd(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Wq(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Ik(e,t){return e!==void 0&&Object.hasOwn(e,t)}function Bq(e,t,n){if(!e.startsWith(Ix))return null;let[r="",...s]=e.slice(Ix.length).split("/").map((l)=>Wq(l));if(r==="")return null;let o,i;if(Ik(t,r))o="document",i=t;else if(Ik(n,r))o="project",i=n;else return null;let a=i[r]??null;for(let l of s)if(Array.isArray(a)){if(!Hq.test(l)||Number(l)>=a.length)return null;a=a[Number(l)]??null}else if(L(a)&&Object.hasOwn(a,l))a=a[l]??null;else return null;return{name:r,schema:a,scope:o}}function Dk(e,t=""){let n=[],r=(s,o)=>{if(!L(s))return;let i=s.$ref;if(_(i)&&i.startsWith(Ix))n.push({at:`${o}/$ref`,ref:i});for(let[a,l]of Object.entries(s)){if(!Dx.has(a))continue;let c=`${o}/${bd(a)}`;if(Array.isArray(l))for(let[u,d]of l.entries())r(d,`${c}/${u}`);else if($d.has(a)){if(L(l))for(let[u,d]of Object.entries(l))r(d,`${c}/${bd(u)}`)}else r(l,c)}};return r(e,t),n}function Lx(e,t){let n=[];if(L(e.state)){for(let[r,s]of Object.entries(e.state))if(L(s)&&L(s.type))n.push(...Dk(s.type,`/state/${bd(r)}/type`))}if(L(e.$defs)){for(let[r,s]of Object.entries(e.$defs))if(L(s)&&!Object.hasOwn(s,"$prototype"))n.push(...Dk(s,`/$defs/${bd(r)}`))}return n.filter(({ref:r})=>Bq(r,L(e.$defs)?e.$defs:void 0,t)===null)}var Ix="#/$defs/",$d,Dx,Hq;var Lk=M(()=>{ae();$d=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),Dx=new Set([...$d,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"]),Hq=/^(?:0|[1-9]\d*)$/});var lc=B(function(qk){Object.defineProperty(qk,"__esModule",{value:!0});qk.regexpCode=qk.getEsmExportName=qk.getProperty=qk.safeStringify=qk.stringify=qk.strConcat=qk.addCodeArg=qk.str=qk._=qk.nil=qk._Code=qk.Name=qk.IDENTIFIER=qk._CodeOrName=void 0;class Sd{}qk._CodeOrName=Sd;qk.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class ca extends Sd{constructor(e){super();if(!qk.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}qk.Name=ca;class $r extends Sd{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,n)=>`${t}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,n)=>{if(n instanceof ca)t[n.str]=(t[n.str]||0)+1;return t},{})}}qk._Code=$r;qk.nil=new $r("");function Fk(e,...t){let n=[e[0]],r=0;while(r<t.length)Vx(n,t[r]),n.push(e[++r]);return new $r(n)}qk._=Fk;var Fx=new $r("+");function Vk(e,...t){let n=[ac(e[0])],r=0;while(r<t.length)n.push(Fx),Vx(n,t[r]),n.push(Fx,ac(e[++r]));return Uq(n),new $r(n)}qk.str=Vk;function Vx(e,t){if(t instanceof $r)e.push(...t._items);else if(t instanceof ca)e.push(t);else e.push(Gq(t))}qk.addCodeArg=Vx;function Uq(e){let t=1;while(t<e.length-1){if(e[t]===Fx){let n=zq(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function zq(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ca||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof ca))return`"${e}${t.slice(1)}`;return}function Kq(e,t){return t.emptyStr()?e:e.emptyStr()?t:Vk`${e}${t}`}qk.strConcat=Kq;function Gq(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:ac(Array.isArray(e)?e.join(","):e)}function Xq(e){return new $r(ac(e))}qk.stringify=Xq;function ac(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}qk.safeStringify=ac;function Yq(e){return typeof e=="string"&&qk.IDENTIFIER.test(e)?new $r(`.${e}`):Fk`[${e}]`}qk.getProperty=Yq;function Zq(e){if(typeof e=="string"&&qk.IDENTIFIER.test(e))return new $r(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}qk.getEsmExportName=Zq;function Qq(e){return new $r(e.toString())}qk.regexpCode=Qq});var Bx=B(function(Uk){Object.defineProperty(Uk,"__esModule",{value:!0});Uk.ValueScope=Uk.ValueScopeName=Uk.Scope=Uk.varKinds=Uk.UsedValueState=void 0;var Ke=lc();class Wk extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var vd;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(vd||(Uk.UsedValueState=vd={}));Uk.varKinds={const:new Ke.Name("const"),let:new Ke.Name("let"),var:new Ke.Name("var")};class Hx{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ke.Name?e:this.name(e)}name(e){return new Ke.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,n;if(((n=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||n===void 0?void 0:n.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Uk.Scope=Hx;class Wx extends Ke.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=Ke._`.${new Ke.Name(t)}[${n}]`}}Uk.ValueScopeName=Wx;var dH=Ke._`\n`;class Bk extends Hx{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?dH:Ke.nil}}get(){return this._scope}name(e){return new Wx(e,this._newName(e))}value(e,t){var n;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let r=this.toName(e),{prefix:s}=r,o=(n=t.key)!==null&&n!==void 0?n:t.ref,i=this._values[s];if(i){let c=i.get(o);if(c)return c}else i=this._values[s]=new Map;i.set(o,r);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,r.setValue(t,{property:s,itemIndex:l}),r}getValue(e,t){let n=this._values[e];if(!n)return;return n.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(n)=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return Ke._`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,(r)=>{if(r.value===void 0)throw Error(`CodeGen: name "${r}" has no value`);return r.value.code},t,n)}_reduceValues(e,t,n={},r){let s=Ke.nil;for(let o in e){let i=e[o];if(!i)continue;let a=n[o]=n[o]||new Map;i.forEach((l)=>{if(a.has(l))return;a.set(l,vd.Started);let c=t(l);if(c){let u=this.opts.es5?Uk.varKinds.var:Uk.varKinds.const;s=Ke._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=r===null||r===void 0?void 0:r(l))s=Ke._`${s}${c}${this.opts._n}`;else throw new Wk(l);a.set(l,vd.Completed)})}return s}}Uk.ValueScope=Bk});var $e=B(function(wn){Object.defineProperty(wn,"__esModule",{value:!0});wn.or=wn.and=wn.not=wn.CodeGen=wn.operators=wn.varKinds=wn.ValueScopeName=wn.ValueScope=wn.Scope=wn.Name=wn.regexpCode=wn.stringify=wn.getProperty=wn.nil=wn.strConcat=wn.str=wn._=void 0;var ee=lc(),xt=Bx(),Bs=lc();Object.defineProperty(wn,"_",{enumerable:!0,get:function(){return Bs._}});Object.defineProperty(wn,"str",{enumerable:!0,get:function(){return Bs.str}});Object.defineProperty(wn,"strConcat",{enumerable:!0,get:function(){return Bs.strConcat}});Object.defineProperty(wn,"nil",{enumerable:!0,get:function(){return Bs.nil}});Object.defineProperty(wn,"getProperty",{enumerable:!0,get:function(){return Bs.getProperty}});Object.defineProperty(wn,"stringify",{enumerable:!0,get:function(){return Bs.stringify}});Object.defineProperty(wn,"regexpCode",{enumerable:!0,get:function(){return Bs.regexpCode}});Object.defineProperty(wn,"Name",{enumerable:!0,get:function(){return Bs.Name}});var Od=Bx();Object.defineProperty(wn,"Scope",{enumerable:!0,get:function(){return Od.Scope}});Object.defineProperty(wn,"ValueScope",{enumerable:!0,get:function(){return Od.ValueScope}});Object.defineProperty(wn,"ValueScopeName",{enumerable:!0,get:function(){return Od.ValueScopeName}});Object.defineProperty(wn,"varKinds",{enumerable:!0,get:function(){return Od.varKinds}});wn.operators={GT:new ee._Code(">"),GTE:new ee._Code(">="),LT:new ee._Code("<"),LTE:new ee._Code("<="),EQ:new ee._Code("==="),NEQ:new ee._Code("!=="),NOT:new ee._Code("!"),OR:new ee._Code("||"),AND:new ee._Code("&&"),ADD:new ee._Code("+")};class Us{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Kk extends Us{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?xt.varKinds.var:this.varKind,r=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${r};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=fa(this.rhs,e,t);return this}get names(){return this.rhs instanceof ee._CodeOrName?this.rhs.names:{}}}class Kx extends Us{constructor(e,t,n){super();this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof ee.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=fa(this.rhs,e,t),this}get names(){let e=this.lhs instanceof ee.Name?{}:{...this.lhs.names};return _d(e,this.rhs)}}class Gk extends Kx{constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Xk extends Us{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Yk extends Us{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Zk extends Us{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Qk extends Us{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=fa(this.code,e,t),this}get names(){return this.code instanceof ee._CodeOrName?this.code.names:{}}}class Ad extends Us{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let n=e[t].optimizeNodes();if(Array.isArray(n))e.splice(t,1,...n);else if(n)e[t]=n;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;while(r--){let s=n[r];if(s.optimizeNames(e,t))continue;gH(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>zo(e,t.names),{})}}class zs extends Ad{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class e_ extends Ad{}class cc extends zs{}cc.kind="else";class xs extends zs{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let n=t.optimizeNodes();t=this.else=Array.isArray(n)?new cc(n):n}if(t){if(e===!1)return t instanceof xs?t:t.nodes;if(this.nodes.length)return this;return new xs(o_(e),t instanceof xs?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=fa(this.condition,e,t),this}get names(){let e=super.names;if(_d(e,this.condition),this.else)zo(e,this.else.names);return e}}xs.kind="if";class ua extends zs{}ua.kind="for";class t_ extends ua{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=fa(this.iteration,e,t),this}get names(){return zo(super.names,this.iteration.names)}}class n_ extends ua{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?xt.varKinds.var:this.varKind,{name:n,from:r,to:s}=this;return`for(${t} ${n}=${r}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=_d(super.names,this.from);return _d(e,this.to)}}class Ux extends ua{constructor(e,t,n,r){super();this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=fa(this.iterable,e,t),this}get names(){return zo(super.names,this.iterable.names)}}class Ed extends zs{constructor(e,t,n){super();this.name=e,this.args=t,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Ed.kind="func";class jd extends Ad{render(e){return"return "+super.render(e)}}jd.kind="return";class r_ extends zs{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)===null||n===void 0||n.optimizeNames(e,t),(r=this.finally)===null||r===void 0||r.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)zo(e,this.catch.names);if(this.finally)zo(e,this.finally.names);return e}}class Pd extends zs{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Pd.kind="catch";class kd extends zs{render(e){return"finally"+super.render(e)}}kd.kind="finally";class s_{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
633
|
-
`:""},this._extScope=e,this._scope=new xt.Scope({parent:e}),this._nodes=[new e_]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let s=this._scope.toName(t);if(n!==void 0&&r)this._constants[s.str]=n;return this._leafNode(new Kk(e,s,n)),s}const(e,t,n){return this._def(xt.varKinds.const,e,t,n)}let(e,t,n){return this._def(xt.varKinds.let,e,t,n)}var(e,t,n){return this._def(xt.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new Kx(e,t,n))}add(e,t){return this._leafNode(new Gk(e,wn.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==ee.nil)this._leafNode(new Qk(e));return this}object(...e){let t=["{"];for(let[n,r]of e){if(t.length>1)t.push(",");if(t.push(n),n!==r||this.opts.es5)t.push(":"),ee.addCodeArg(t,r)}return t.push("}"),new ee._Code(t)}if(e,t,n){if(this._blockNode(new xs(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new xs(e))}else(){return this._elseNode(new cc)}endIf(){return this._endBlockNode(xs,cc)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new t_(e),t)}forRange(e,t,n,r,s=this.opts.es5?xt.varKinds.var:xt.varKinds.let){let o=this._scope.toName(e);return this._for(new n_(s,o,t,n),()=>r(o))}forOf(e,t,n,r=xt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof ee.Name?t:this.var("_arr",t);return this.forRange("_i",0,ee._`${o}.length`,(i)=>{this.var(s,ee._`${o}[${i}]`),n(s)})}return this._for(new Ux("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?xt.varKinds.var:xt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,ee._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new Ux("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(ua)}label(e){return this._leafNode(new Xk(e))}break(e){return this._leafNode(new Yk(e))}return(e){let t=new jd;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(jd)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new r_;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new Pd(s),t(s)}if(n)this._currNode=r.finally=new kd,this.code(n);return this._endBlockNode(Pd,kd)}throw(e){return this._leafNode(new Zk(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=ee.nil,n,r){if(this._blockNode(new Ed(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(Ed)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof xs))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}wn.CodeGen=s_;function zo(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function _d(e,t){return t instanceof ee._CodeOrName?zo(e,t.names):e}function fa(e,t,n){if(e instanceof ee.Name)return r(e);if(!s(e))return e;return new ee._Code(e._items.reduce((o,i)=>{if(i instanceof ee.Name)i=r(i);if(i instanceof ee._Code)o.push(...i._items);else o.push(i);return o},[]));function r(o){let i=n[o.str];if(i===void 0||t[o.str]!==1)return o;return delete t[o.str],i}function s(o){return o instanceof ee._Code&&o._items.some((i)=>i instanceof ee.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function gH(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function o_(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:ee._`!${zx(e)}`}wn.not=o_;var yH=i_(wn.operators.AND);function xH(...e){return e.reduce(yH)}wn.and=xH;var bH=i_(wn.operators.OR);function $H(...e){return e.reduce(bH)}wn.or=$H;function i_(e){return(t,n)=>t===ee.nil?n:n===ee.nil?t:ee._`${zx(t)} ${e} ${zx(n)}`}function zx(e){return e instanceof ee.Name?e:ee._`(${e})`}});var Ce=B(function(g_){Object.defineProperty(g_,"__esModule",{value:!0});g_.checkStrictMode=g_.getErrorPath=g_.Type=g_.useFunc=g_.setEvaluated=g_.evaluatedPropsToName=g_.mergeEvaluated=g_.eachItem=g_.unescapeJsonPointer=g_.escapeJsonPointer=g_.escapeFragment=g_.unescapeFragment=g_.schemaRefOrVal=g_.schemaHasRulesButRef=g_.schemaHasRules=g_.checkUnknownRules=g_.alwaysValidSchema=g_.toHash=void 0;var fe=$e(),u_=lc();function EH(e){let t={};for(let n of e)t[n]=!0;return t}g_.toHash=EH;function jH(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return f_(e,t),!d_(t,e.self.RULES.all)}g_.alwaysValidSchema=jH;function f_(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema)return;if(typeof t==="boolean")return;let s=r.RULES.keywords;for(let o in t)if(!s[o])h_(e,`unknown keyword: "${o}"`)}g_.checkUnknownRules=f_;function d_(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}g_.schemaHasRules=d_;function PH(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}g_.schemaHasRulesButRef=PH;function kH({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return fe._`${n}`}return fe._`${e}${t}${fe.getProperty(r)}`}g_.schemaRefOrVal=kH;function _H(e){return p_(decodeURIComponent(e))}g_.unescapeFragment=_H;function OH(e){return encodeURIComponent(Xx(e))}g_.escapeFragment=OH;function Xx(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}g_.escapeJsonPointer=Xx;function p_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}g_.unescapeJsonPointer=p_;function AH(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}g_.eachItem=AH;function l_({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let l=i===void 0?o:i instanceof fe.Name?(o instanceof fe.Name?e(s,o,i):t(s,o,i),i):o instanceof fe.Name?(t(s,i,o),o):n(o,i);return a===fe.Name&&!(l instanceof fe.Name)?r(s,l):l}}g_.mergeEvaluated={props:l_({mergeNames:(e,t,n)=>e.if(fe._`${n} !== true && ${t} !== undefined`,()=>{e.if(fe._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,fe._`${n} || {}`).code(fe._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(fe._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,fe._`${n} || {}`),Yx(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:m_}),items:l_({mergeNames:(e,t,n)=>e.if(fe._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,fe._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(fe._`${n} !== true`,()=>e.assign(n,t===!0?!0:fe._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function m_(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",fe._`{}`);if(t!==void 0)Yx(e,n,t);return n}g_.evaluatedPropsToName=m_;function Yx(e,t,n){Object.keys(n).forEach((r)=>e.assign(fe._`${t}${fe.getProperty(r)}`,!0))}g_.setEvaluated=Yx;var c_={};function CH(e,t){return e.scopeValue("func",{ref:t,code:c_[t.code]||(c_[t.code]=new u_._Code(t.code))})}g_.useFunc=CH;var Gx;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Gx||(g_.Type=Gx={}));function RH(e,t,n){if(e instanceof fe.Name){let r=t===Gx.Num;return n?r?fe._`"[" + ${e} + "]"`:fe._`"['" + ${e} + "']"`:r?fe._`"/" + ${e}`:fe._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?fe.getProperty(e).toString():"/"+Xx(e)}g_.getErrorPath=RH;function h_(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}g_.checkStrictMode=h_});var Zn=B(function(x_){Object.defineProperty(x_,"__esModule",{value:!0});var Fe=$e(),XH={data:new Fe.Name("data"),valCxt:new Fe.Name("valCxt"),instancePath:new Fe.Name("instancePath"),parentData:new Fe.Name("parentData"),parentDataProperty:new Fe.Name("parentDataProperty"),rootData:new Fe.Name("rootData"),dynamicAnchors:new Fe.Name("dynamicAnchors"),vErrors:new Fe.Name("vErrors"),errors:new Fe.Name("errors"),this:new Fe.Name("this"),self:new Fe.Name("self"),scope:new Fe.Name("scope"),json:new Fe.Name("json"),jsonPos:new Fe.Name("jsonPos"),jsonLen:new Fe.Name("jsonLen"),jsonPart:new Fe.Name("jsonPart")};x_.default=XH});var uc=B(function(w_){Object.defineProperty(w_,"__esModule",{value:!0});w_.extendErrors=w_.resetErrorsCount=w_.reportExtraError=w_.reportError=w_.keyword$DataError=w_.keywordError=void 0;var ne=$e(),Ks=Ce(),cn=Zn();w_.keywordError={message:({keyword:e})=>ne.str`must pass "${e}" keyword validation`};w_.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ne.str`"${e}" keyword must be ${t} ($data)`:ne.str`"${e}" keyword is invalid ($data)`};function ZH(e,t=w_.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,l=S_(e,t,n);if(r!==null&&r!==void 0?r:i||a)b_(o,l);else $_(s,ne._`[${l}]`)}w_.reportError=ZH;function QH(e,t=w_.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=S_(e,t,n);if(b_(s,a),!(o||i))$_(r,cn.default.vErrors)}w_.reportExtraError=QH;function eW(e,t){e.assign(cn.default.errors,t),e.if(ne._`${cn.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ne._`${cn.default.vErrors}.length`,t),()=>e.assign(cn.default.vErrors,null)))}w_.resetErrorsCount=eW;function tW({gen:e,keyword:t,schemaValue:n,data:r,errsCount:s,it:o}){if(s===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",s,cn.default.errors,(a)=>{if(e.const(i,ne._`${cn.default.vErrors}[${a}]`),e.if(ne._`${i}.instancePath === undefined`,()=>e.assign(ne._`${i}.instancePath`,ne.strConcat(cn.default.instancePath,o.errorPath))),e.assign(ne._`${i}.schemaPath`,ne.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(ne._`${i}.schema`,n),e.assign(ne._`${i}.data`,r)})}w_.extendErrors=tW;function b_(e,t){let n=e.const("err",t);e.if(ne._`${cn.default.vErrors} === null`,()=>e.assign(cn.default.vErrors,ne._`[${n}]`),ne._`${cn.default.vErrors}.push(${n})`),e.code(ne._`${cn.default.errors}++`)}function $_(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(ne._`new ${e.ValidationError}(${t})`);else n.assign(ne._`${r}.errors`,t),n.return(!1)}var Ko={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function S_(e,t,n){let{createErrors:r}=e.it;if(r===!1)return ne._`{}`;return nW(e,t,n)}function nW(e,t,n={}){let{gen:r,it:s}=e,o=[rW(s,n),sW(e,n)];return oW(e,t,o),r.object(...o)}function rW({errorPath:e},{instancePath:t}){let n=t?ne.str`${e}${Ks.getErrorPath(t,Ks.Type.Str)}`:e;return[cn.default.instancePath,ne.strConcat(cn.default.instancePath,n)]}function sW({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:ne.str`${t}/${e}`;if(n)s=ne.str`${s}${Ks.getErrorPath(n,Ks.Type.Str)}`;return[Ko.schemaPath,s]}function oW(e,{params:t,message:n},r){let{keyword:s,data:o,schemaValue:i,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=a;if(r.push([Ko.keyword,s],[Ko.params,typeof t=="function"?t(e):t||ne._`{}`]),l.messages)r.push([Ko.message,typeof n=="function"?n(e):n]);if(l.verbose)r.push([Ko.schema,i],[Ko.parentSchema,ne._`${u}${d}`],[cn.default.data,o]);if(c)r.push([Ko.propertyName,c])}});var O_=B(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});k_.boolOrEmptySchema=k_.topBoolOrEmptySchema=void 0;var E_=uc(),j_=$e(),uW=Zn(),fW={message:"boolean schema is false"};function dW(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)P_(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(uW.default.data);else t.assign(j_._`${r}.errors`,null),t.return(!0)}k_.topBoolOrEmptySchema=dW;function pW(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),P_(e);else n.var(t,!0)}k_.boolOrEmptySchema=pW;function P_(e,t){let{gen:n,data:r}=e;E_.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},fW,void 0,t)}});var Qx=B(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});A_.getRules=A_.isJSONType=void 0;var hW=["string","number","integer","boolean","null","object","array"],gW=new Set(hW);function yW(e){return typeof e=="string"&&gW.has(e)}A_.isJSONType=yW;function xW(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}A_.getRules=xW});var eb=B(function(N_){Object.defineProperty(N_,"__esModule",{value:!0});N_.shouldUseRule=N_.shouldUseGroup=N_.schemaHasRulesForType=void 0;function $W({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&R_(e,r)}N_.schemaHasRulesForType=$W;function R_(e,t){return t.rules.some((n)=>T_(e,n))}N_.shouldUseGroup=R_;function T_(e,t){var n;return e[t.keyword]!==void 0||((n=t.definition.implements)===null||n===void 0?void 0:n.some((r)=>e[r]!==void 0))}N_.shouldUseRule=T_});var fc=B(function(V_){Object.defineProperty(V_,"__esModule",{value:!0});V_.reportTypeError=V_.checkDataTypes=V_.checkDataType=V_.coerceAndCheckDataType=V_.getJSONTypes=V_.getSchemaTypes=V_.DataType=void 0;var M_=Qx(),I_=eb(),D_=uc(),Z=$e(),Rd=Ce(),da;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(da||(V_.DataType=da={}));function vW(e){let t=L_(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}V_.getSchemaTypes=vW;function L_(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(M_.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}V_.getJSONTypes=L_;function EW(e,t){let{gen:n,data:r,opts:s}=e,o=jW(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&I_.schemaHasRulesForType(e,t[0]));if(i){let a=nb(t,r,s.strictNumbers,da.Wrong);n.if(a,()=>{if(o.length)PW(e,t,o);else rb(e)})}return i}V_.coerceAndCheckDataType=EW;var F_=new Set(["string","number","integer","boolean","null"]);function jW(e,t){return t?e.filter((n)=>F_.has(n)||t==="array"&&n==="array"):[]}function PW(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",Z._`typeof ${s}`),a=r.let("coerced",Z._`undefined`);if(o.coerceTypes==="array")r.if(Z._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,Z._`${s}[0]`).assign(i,Z._`typeof ${s}`).if(nb(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(Z._`${a} !== undefined`);for(let c of n)if(F_.has(c)||c==="array"&&o.coerceTypes==="array")l(c);r.else(),rb(e),r.endIf(),r.if(Z._`${a} !== undefined`,()=>{r.assign(s,a),kW(e,a)});function l(c){switch(c){case"string":r.elseIf(Z._`${i} == "number" || ${i} == "boolean"`).assign(a,Z._`"" + ${s}`).elseIf(Z._`${s} === null`).assign(a,Z._`""`);return;case"number":r.elseIf(Z._`${i} == "boolean" || ${s} === null
|
|
634
|
-
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,
|
|
635
|
-
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,
|
|
636
|
-
|| ${i} === "boolean" || ${s} === null`).assign(a,Z._`[${s}]`)}}}function kW({gen:e,parentData:t,parentDataProperty:n},r){e.if(Z._`${t} !== undefined`,()=>e.assign(Z._`${t}[${n}]`,r))}function tb(e,t,n,r=da.Correct){let s=r===da.Correct?Z.operators.EQ:Z.operators.NEQ,o;switch(e){case"null":return Z._`${t} ${s} null`;case"array":o=Z._`Array.isArray(${t})`;break;case"object":o=Z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(Z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return Z._`typeof ${t} ${s} ${e}`}return r===da.Correct?o:Z.not(o);function i(a=Z.nil){return Z.and(Z._`typeof ${t} == "number"`,a,n?Z._`isFinite(${t})`:Z.nil)}}V_.checkDataType=tb;function nb(e,t,n,r){if(e.length===1)return tb(e[0],t,n,r);let s,o=Rd.toHash(e);if(o.array&&o.object){let i=Z._`typeof ${t} != "object"`;s=o.null?i:Z._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=Z.nil;if(o.number)delete o.integer;for(let i in o)s=Z.and(s,tb(i,t,n,r));return s}V_.checkDataTypes=nb;var _W={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Z._`{type: ${e}}`:Z._`{type: ${t}}`};function rb(e){let t=OW(e);D_.reportError(t,_W)}V_.reportTypeError=rb;function OW(e){let{gen:t,data:n,schema:r}=e,s=Rd.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var z_=B(function(B_){Object.defineProperty(B_,"__esModule",{value:!0});B_.assignDefaults=void 0;var Qn=$e(),W_=Ce();function MW(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)H_(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>H_(e,o,s.default))}B_.assignDefaults=MW;function H_(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=Qn._`${o}${Qn.getProperty(t)}`;if(s){W_.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=Qn._`${a} === undefined`;if(i.useDefaults==="empty")l=Qn._`${l} || ${a} === null || ${a} === ""`;r.if(l,Qn._`${a} = ${Qn.stringify(n)}`)}});var er=B(function(Y_){Object.defineProperty(Y_,"__esModule",{value:!0});Y_.validateUnion=Y_.validateArray=Y_.usePattern=Y_.callValidateCode=Y_.schemaProperties=Y_.allSchemaProperties=Y_.noPropertyInData=Y_.propertyInData=Y_.isOwnProperty=Y_.hasPropFunc=Y_.reportMissingProp=Y_.checkMissingProp=Y_.checkReportMissingProp=void 0;var he=$e(),pa=Ce(),Gs=Zn(),K_=Ce();function IW(e,t){let{gen:n,data:r,it:s}=e;n.if(ob(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:he._`${t}`},!0),e.error()})}Y_.checkReportMissingProp=IW;function DW({gen:e,data:t,it:{opts:n}},r,s){return he.or(...r.map((o)=>he.and(ob(e,t,o,n.ownProperties),he._`${s} = ${o}`)))}Y_.checkMissingProp=DW;function LW(e,t){e.setParams({missingProperty:t},!0),e.error()}Y_.reportMissingProp=LW;function G_(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:he._`Object.prototype.hasOwnProperty`})}Y_.hasPropFunc=G_;function sb(e,t,n){return he._`${G_(e)}.call(${t}, ${n})`}Y_.isOwnProperty=sb;function FW(e,t,n,r){let s=he._`${t}${he.getProperty(n)} !== undefined`;return r?he._`${s} && ${sb(e,t,n)}`:s}Y_.propertyInData=FW;function ob(e,t,n,r){let s=he._`${t}${he.getProperty(n)} === undefined`;return r?he.or(s,he.not(sb(e,t,n))):s}Y_.noPropertyInData=ob;function X_(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Y_.allSchemaProperties=X_;function VW(e,t){return X_(t).filter((n)=>!pa.alwaysValidSchema(e,t[n]))}Y_.schemaProperties=VW;function qW({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,l,c){let u=c?he._`${e}, ${t}, ${r}${s}`:t,d=[[Gs.default.instancePath,he.strConcat(Gs.default.instancePath,o)],[Gs.default.parentData,i.parentData],[Gs.default.parentDataProperty,i.parentDataProperty],[Gs.default.rootData,Gs.default.rootData]];if(i.opts.dynamicRef)d.push([Gs.default.dynamicAnchors,Gs.default.dynamicAnchors]);let p=he._`${u}, ${n.object(...d)}`;return l!==he.nil?he._`${a}.call(${l}, ${p})`:he._`${a}(${p})`}Y_.callValidateCode=qW;var HW=he._`new RegExp`;function WW({gen:e,it:{opts:t}},n){let r=t.unicodeRegExp?"u":"",{regExp:s}=t.code,o=s(n,r);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:he._`${s.code==="new RegExp"?HW:K_.useFunc(e,s)}(${n}, ${r})`})}Y_.usePattern=WW;function BW(e){let{gen:t,data:n,keyword:r,it:s}=e,o=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(o,!0),i(()=>t.break()),o;function i(a){let l=t.const("len",he._`${n}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:r,dataProp:c,dataPropType:pa.Type.Num},o),t.if(he.not(o),a)})}}Y_.validateArray=BW;function UW(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((l)=>pa.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>n.forEach((l,c)=>{let u=e.subschema({keyword:r,schemaProp:c,compositeRule:!0},a);if(t.assign(i,he._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(he.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Y_.validateUnion=UW});var oO=B(function(rO){Object.defineProperty(rO,"__esModule",{value:!0});rO.validateKeywordUsage=rO.validSchemaType=rO.funcKeywordCode=rO.macroKeywordCode=void 0;var qe=$e(),Go=Zn(),eO=er(),tO=uc();function oB(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),l=nO(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=n.name("valid");e.subschema({schema:a,schemaPath:qe.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}rO.macroKeywordCode=oB;function iB(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:l}=e;lB(l,t);let c=!a&&t.compile?t.compile.call(l.self,o,i,l):t.validate,u=nO(r,s,c),d=r.let("valid");e.block$data(d,p),e.ok((n=t.valid)!==null&&n!==void 0?n:d);function p(){if(t.errors===!1){if(b(),t.modifying)Q_(e);h(()=>e.error())}else{let x=t.async?m():g();if(t.modifying)Q_(e);h(()=>aB(e,x))}}function m(){let x=r.let("ruleErrs",null);return r.try(()=>b(qe._`await `),(k)=>r.assign(d,!1).if(qe._`${k} instanceof ${l.ValidationError}`,()=>r.assign(x,qe._`${k}.errors`),()=>r.throw(k))),x}function g(){let x=qe._`${u}.errors`;return r.assign(x,null),b(qe.nil),x}function b(x=t.async?qe._`await `:qe.nil){let k=l.opts.passContext?Go.default.this:Go.default.self,w=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,qe._`${x}${eO.callValidateCode(e,u,k,w)}`,t.modifying)}function h(x){var k;r.if(qe.not((k=t.valid)!==null&&k!==void 0?k:d),x)}}rO.funcKeywordCode=iB;function Q_(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,qe._`${r.parentData}[${r.parentDataProperty}]`))}function aB(e,t){let{gen:n}=e;n.if(qe._`Array.isArray(${t})`,()=>{n.assign(Go.default.vErrors,qe._`${Go.default.vErrors} === null ? ${t} : ${Go.default.vErrors}.concat(${t})`).assign(Go.default.errors,qe._`${Go.default.vErrors}.length`),tO.extendErrors(e)},()=>e.error())}function lB({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function nO(e,t,n){if(n===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof n=="function"?{ref:n}:{ref:n,code:qe.stringify(n)})}function cB(e,t,n=!1){return!t.length||t.some((r)=>r==="array"?Array.isArray(e):r==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==r||n&&typeof e>"u")}rO.validSchemaType=cB;function uB({schema:e,opts:t,self:n,errSchemaPath:r},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw Error("ajv implementation error");let i=s.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[o])){let l=`keyword "${o}" value is invalid at path "${r}": `+n.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")n.logger.error(l);else throw Error(l)}}}rO.validateKeywordUsage=uB});var lO=B(function(iO){Object.defineProperty(iO,"__esModule",{value:!0});iO.extendSubschemaMode=iO.extendSubschemaData=iO.getSubschema=void 0;var Nt=$e(),Td=Ce();function mB(e,{keyword:t,schemaProp:n,schema:r,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(t!==void 0&&r!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return n===void 0?{schema:a,schemaPath:Nt._`${e.schemaPath}${Nt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:Nt._`${e.schemaPath}${Nt.getProperty(t)}${Nt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${Td.escapeFragment(n)}`}}if(r!==void 0){if(s===void 0||o===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:r,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')}iO.getSubschema=mB;function hB(e,t,{dataProp:n,dataPropType:r,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&n!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(n!==void 0){let{errorPath:c,dataPathArr:u,opts:d}=t,p=a.let("data",Nt._`${t.data}${Nt.getProperty(n)}`,!0);l(p),e.errorPath=Nt.str`${c}${Td.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=Nt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Nt.Name?s:a.let("data",s,!0);if(l(c),i!==void 0)e.propertyName=i}if(o)e.dataTypes=o;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}iO.extendSubschemaData=hB;function gB(e,{jtdDiscriminator:t,jtdMetadata:n,compositeRule:r,createErrors:s,allErrors:o}){if(r!==void 0)e.compositeRule=r;if(s!==void 0)e.createErrors=s;if(o!==void 0)e.allErrors=o;e.jtdDiscriminator=t,e.jtdMetadata=n}iO.extendSubschemaMode=gB});var ib=B(function(Kse,cO){cO.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n}});var fO=B(function(Gse,uO){var Xs=uO.exports=function(e,t,n){if(typeof t=="function")n=t,t={};n=t.cb||n;var r=typeof n=="function"?n:n.pre||function(){},s=n.post||function(){};Nd(t,r,s,e,"",e)};Xs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Xs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Xs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Xs.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Nd(e,t,n,r,s,o,i,a,l,c){if(r&&typeof r=="object"&&!Array.isArray(r)){t(r,s,o,i,a,l,c);for(var u in r){var d=r[u];if(Array.isArray(d)){if(u in Xs.arrayKeywords)for(var p=0;p<d.length;p++)Nd(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in Xs.propsKeywords){if(d&&typeof d=="object")for(var m in d)Nd(e,t,n,d[m],s+"/"+u+"/"+bB(m),o,s,u,r,m)}else if(u in Xs.keywords||e.allKeys&&!(u in Xs.skipKeywords))Nd(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,l,c)}}function bB(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var dc=B(function(gO){Object.defineProperty(gO,"__esModule",{value:!0});gO.getSchemaRefs=gO.resolveUrl=gO.normalizeId=gO._getFullPath=gO.getFullPath=gO.inlineRef=void 0;var dO=Ce(),$B=ib(),SB=fO(),wB=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function vB(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!ab(e);if(!t)return!1;return pO(e)<=t}gO.inlineRef=vB;var EB=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ab(e){for(let t in e){if(EB.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(ab))return!0;if(typeof n=="object"&&ab(n))return!0}return!1}function pO(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,wB.has(n))continue;if(typeof e[n]=="object")dO.eachItem(e[n],(r)=>t+=pO(r));if(t===1/0)return 1/0}return t}function mO(e,t="",n){if(n!==!1)t=ma(t);let r=e.parse(t);return hO(e,r)}gO.getFullPath=mO;function hO(e,t){return e.serialize(t).split("#")[0]+"#"}gO._getFullPath=hO;var jB=/#\/?$/;function ma(e){return e?e.replace(jB,""):""}gO.normalizeId=ma;function PB(e,t,n){return n=ma(n),e.resolve(t,n)}gO.resolveUrl=PB;var kB=/^[a-z_][-a-z0-9._]*$/i;function _B(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=ma(e[n]||t),o={"":s},i=mO(r,s,!1),a={},l=new Set;return SB(e,{allKeys:!0},(d,p,m,g)=>{if(g===void 0)return;let b=i+p,h=o[g];if(typeof d[n]=="string")h=x.call(this,d[n]);k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),o[p]=h;function x(w){let v=this.opts.uriResolver.resolve;if(w=ma(h?v(h,w):w),l.has(w))throw u(w);l.add(w);let E=this.refs[w];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")c(d,E.schema,w);else if(w!==ma(b))if(w[0]==="#")c(d,a[w],w),a[w]=d;else this.refs[w]=b;return w}function k(w){if(typeof w=="string"){if(!kB.test(w))throw Error(`invalid anchor "${w}"`);x.call(this,`#${w}`)}}}),a;function c(d,p,m){if(p!==void 0&&!$B(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}gO.getSchemaRefs=_B});var ya=B(function(RO){Object.defineProperty(RO,"__esModule",{value:!0});RO.getData=RO.KeywordCxt=RO.validateFunctionCode=void 0;var Md=O_(),Jd=fc(),ga=eb(),Ys=fc(),SO=z_(),Mr=oO(),ha=lO(),q=$e(),be=Zn(),wO=dc(),Dt=Ce(),Jr=uc();function NB(e){if(jO(e)){if(PO(e),EO(e)){IB(e);return}}vO(e,()=>Md.topBoolOrEmptySchema(e))}RO.validateFunctionCode=NB;function vO({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,q._`${be.default.data}, ${be.default.valCxt}`,r.$async,()=>{e.code(q._`"use strict"; ${xO(n,s)}`),MB(e,s),e.code(o)});else e.func(t,q._`${be.default.data}, ${JB(s)}`,r.$async,()=>e.code(xO(n,s)).code(o))}function JB(e){return q._`{${be.default.instancePath}="", ${be.default.parentData}, ${be.default.parentDataProperty}, ${be.default.rootData}=${be.default.data}${e.dynamicRef?q._`, ${be.default.dynamicAnchors}={}`:q.nil}}={}`}function MB(e,t){e.if(be.default.valCxt,()=>{if(e.var(be.default.instancePath,q._`${be.default.valCxt}.${be.default.instancePath}`),e.var(be.default.parentData,q._`${be.default.valCxt}.${be.default.parentData}`),e.var(be.default.parentDataProperty,q._`${be.default.valCxt}.${be.default.parentDataProperty}`),e.var(be.default.rootData,q._`${be.default.valCxt}.${be.default.rootData}`),t.dynamicRef)e.var(be.default.dynamicAnchors,q._`${be.default.valCxt}.${be.default.dynamicAnchors}`)},()=>{if(e.var(be.default.instancePath,q._`""`),e.var(be.default.parentData,q._`undefined`),e.var(be.default.parentDataProperty,q._`undefined`),e.var(be.default.rootData,be.default.data),t.dynamicRef)e.var(be.default.dynamicAnchors,q._`{}`)})}function IB(e){let{schema:t,opts:n,gen:r}=e;vO(e,()=>{if(n.$comment&&t.$comment)_O(e);if(qB(e),r.let(be.default.vErrors,null),r.let(be.default.errors,0),n.unevaluated)DB(e);kO(e),BB(e)});return}function DB(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",q._`${n}.evaluated`),t.if(q._`${e.evaluated}.dynamicProps`,()=>t.assign(q._`${e.evaluated}.props`,q._`undefined`)),t.if(q._`${e.evaluated}.dynamicItems`,()=>t.assign(q._`${e.evaluated}.items`,q._`undefined`))}function xO(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?q._`/*# sourceURL=${n} */`:q.nil}function LB(e,t){if(jO(e)){if(PO(e),EO(e)){FB(e,t);return}}Md.boolOrEmptySchema(e,t)}function EO({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let n in e)if(t.RULES.all[n])return!0;return!1}function jO(e){return typeof e.schema!="boolean"}function FB(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)_O(e);HB(e),WB(e);let o=r.const("_errs",be.default.errors);kO(e,o),r.var(t,q._`${o} === ${be.default.errors}`)}function PO(e){Dt.checkUnknownRules(e),VB(e)}function kO(e,t){if(e.opts.jtd)return bO(e,[],!1,t);let n=Jd.getSchemaTypes(e.schema),r=Jd.coerceAndCheckDataType(e,n);bO(e,n,!r,t)}function VB(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&Dt.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function qB(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)Dt.checkStrictMode(e,"default is ignored in the schema root")}function HB(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=wO.resolveUrl(e.opts.uriResolver,e.baseId,t)}function WB(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function _O({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(q._`${be.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=q.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(q._`${be.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function BB(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(q._`${be.default.errors} === 0`,()=>t.return(be.default.data),()=>t.throw(q._`new ${s}(${be.default.vErrors})`));else{if(t.assign(q._`${r}.errors`,be.default.vErrors),o.unevaluated)UB(e);t.return(q._`${be.default.errors} === 0`)}}function UB({gen:e,evaluated:t,props:n,items:r}){if(n instanceof q.Name)e.assign(q._`${t}.props`,n);if(r instanceof q.Name)e.assign(q._`${t}.items`,r)}function bO(e,t,n,r){let{gen:s,schema:o,data:i,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(o.$ref&&(l.ignoreKeywordsWithRef||!Dt.schemaHasRulesButRef(o,u))){s.block(()=>AO(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)zB(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!ga.shouldUseGroup(o,p))return;if(p.type){if(s.if(Ys.checkDataType(p.type,i,l.strictNumbers)),$O(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Ys.reportTypeError(e);s.endIf()}else $O(e,p);if(!a)s.if(q._`${be.default.errors} === ${r||0}`)}}function $O(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)SO.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(ga.shouldUseRule(r,o))AO(e,o.keyword,o.definition,t.type)})}function zB(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(KB(e,t),!e.opts.allowUnionTypes)GB(e,t);XB(e,e.dataTypes)}function KB(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!OO(e.dataTypes,n))lb(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),ZB(e,t)}function GB(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))lb(e,"use allowUnionTypes to allow union type keyword")}function XB(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&ga.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>YB(t,i)))lb(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function YB(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function OO(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function ZB(e,t){let n=[];for(let r of e.dataTypes)if(OO(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function lb(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,Dt.checkStrictMode(e,t,e.opts.strictTypes)}class cb{constructor(e,t,n){if(Mr.validateKeywordUsage(e,t,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Dt.schemaRefOrVal(e,this.schema,n,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",CO(this.$data,e));else if(this.schemaCode=this.schemaValue,!Mr.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${n} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",be.default.errors)}result(e,t,n){this.failResult(q.not(e),t,n)}failResult(e,t,n){if(this.gen.if(e),n)n();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(q.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(q._`${t} !== undefined && (${q.or(this.invalid$data(),e)})`)}error(e,t,n){if(t){this.setParams(t),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,t){(e?Jr.reportExtraError:Jr.reportError)(this,this.def.error,t)}$dataError(){Jr.reportError(this,this.def.$dataError||Jr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Jr.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,n=q.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=q.nil,t=q.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(q.or(q._`${r} === undefined`,t)),e!==q.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==q.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return q.or(o(),i());function o(){if(n.length){if(!(t instanceof q.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return q._`${Ys.checkDataTypes(a,t,s.opts.strictNumbers,Ys.DataType.Wrong)}`}return q.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return q._`!${a}(${t})`}return q.nil}}subschema(e,t){let n=ha.getSubschema(this.it,e);ha.extendSubschemaData(n,this.it,e),ha.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return LB(r,t),r}mergeEvaluated(e,t){let{it:n,gen:r}=this;if(!n.opts.unevaluated)return;if(n.props!==!0&&e.props!==void 0)n.props=Dt.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=Dt.mergeEvaluated.items(r,e.items,n.items,t)}mergeValidEvaluated(e,t){let{it:n,gen:r}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return r.if(t,()=>this.mergeEvaluated(e,q.Name)),!0}}RO.KeywordCxt=cb;function AO(e,t,n,r){let s=new cb(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)Mr.funcKeywordCode(s,n);else if("macro"in n)Mr.macroKeywordCode(s,n);else if(n.compile||n.validate)Mr.funcKeywordCode(s,n)}var QB=/^\/(?:[^~]|~0|~1)*$/,eU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function CO(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return be.default.rootData;if(e[0]==="/"){if(!QB.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=be.default.rootData}else{let c=eU.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(s=c[2],s==="#"){if(u>=t)throw Error(l("property/index",u));return r[t-u]}if(u>t)throw Error(l("data",u));if(o=n[t-u],!s)return o}let i=o,a=s.split("/");for(let c of a)if(c)o=q._`${o}${q.getProperty(Dt.unescapeJsonPointer(c))}`,i=q._`${i} && ${o}`;return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}RO.getData=CO});var pc=B(function(JO){Object.defineProperty(JO,"__esModule",{value:!0});class NO extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}JO.default=NO});var ba=B(function(IO){Object.defineProperty(IO,"__esModule",{value:!0});var xa=dc();class MO extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=xa.resolveUrl(e,t,n),this.missingSchema=xa.normalizeId(xa.getFullPath(e,this.missingRef))}}IO.default=MO});var hc=B(function(FO){Object.defineProperty(FO,"__esModule",{value:!0});FO.resolveSchema=FO.getCompilingSchema=FO.resolveRef=FO.compileSchema=FO.SchemaEnv=void 0;var bt=$e(),oU=pc(),Xo=Zn(),$t=dc(),Id=Ce(),DO=ya();class mc{constructor(e){var t;this.refs={},this.dynamicAnchors={};let n;if(typeof e.schema=="object")n=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:$t.normalizeId(n===null||n===void 0?void 0:n[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n===null||n===void 0?void 0:n.$async,this.refs={}}}FO.SchemaEnv=mc;function fb(e){let t=LO.call(this,e);if(t)return t;let n=$t.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new bt.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:oU.default,code:bt._`require("ajv/dist/runtime/validation_error").default`});let l=i.scopeName("validate");e.validateName=l;let c={gen:i,allErrors:this.opts.allErrors,data:Xo.default.data,parentData:Xo.default.parentData,parentDataProperty:Xo.default.parentDataProperty,dataNames:[Xo.default.data],dataPathArr:[bt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:bt.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:bt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:bt._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),DO.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(Xo.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${Xo.default.self}`,`${Xo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:l,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:g,items:b}=c;if(m.evaluated={props:g instanceof bt.Name?void 0:g,items:b instanceof bt.Name?void 0:b,dynamicProps:g instanceof bt.Name,dynamicItems:b instanceof bt.Name},m.source)m.source.evaluated=bt.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw d}finally{this._compilations.delete(e)}}FO.compileSchema=fb;function iU(e,t,n){var r;n=$t.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=cU.call(this,e,n);if(o===void 0){let i=(r=e.localRefs)===null||r===void 0?void 0:r[n],{schemaId:a}=this.opts;if(i)o=new mc({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=aU.call(this,o)}FO.resolveRef=iU;function aU(e){if($t.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:fb.call(this,e)}function LO(e){for(let t of this._compilations)if(lU(t,e))return t}FO.getCompilingSchema=LO;function lU(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function cU(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||Dd.call(this,e,t)}function Dd(e,t){let n=this.opts.uriResolver.parse(t),r=$t._getFullPath(this.opts.uriResolver,n),s=$t.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return ub.call(this,n,e);let o=$t.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=Dd.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return ub.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)fb.call(this,i);if(o===$t.normalizeId(t)){let{schema:a}=i,{schemaId:l}=this.opts,c=a[l];if(c)s=$t.resolveUrl(this.opts.uriResolver,s,c);return new mc({schema:a,schemaId:l,root:e,baseId:s})}return ub.call(this,n,i)}FO.resolveSchema=Dd;var uU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ub(e,{baseId:t,schema:n,root:r}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof n==="boolean")return;let l=n[Id.unescapeFragment(a)];if(l===void 0)return;n=l;let c=typeof n==="object"&&n[this.opts.schemaId];if(!uU.has(a)&&c)t=$t.resolveUrl(this.opts.uriResolver,t,c)}let o;if(typeof n!="boolean"&&n.$ref&&!Id.schemaHasRulesButRef(n,this.RULES)){let a=$t.resolveUrl(this.opts.uriResolver,t,n.$ref);o=Dd.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new mc({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var qO=B(function(toe,hU){hU.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var yb=B(function(noe,XO){var gU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),pb=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),yU=RegExp.prototype.test.bind(/^\d*$/u),Yo=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),mb=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),WO=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),hb=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),xU=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),vn=Array(256);for(let t=0;t<256;t++)vn[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function en(e){if(e<2048)return vn[192|e>>6]+vn[128|e&63];if(e<65536)return vn[224|e>>12]+vn[128|e>>6&63]+vn[128|e&63];return vn[240|e>>18]+vn[128|e>>12&63]+vn[128|e>>6&63]+vn[128|e&63]}function bU(e){let t="",n=0,r=0;for(r=0;r<e.length;r++){if(n=e[r].charCodeAt(0),n===48)continue;if(!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r];break}for(r+=1;r<e.length;r++){if(n=e[r].charCodeAt(0),!(n>=48&&n<=57||n>=65&&n<=70||n>=97&&n<=102))return"";t+=e[r]}return t}var $U=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),SU=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),wU=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),vU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function EU(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(wU(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Yo(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function HO(e){let t=-1,n=0,r=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(r===-1)r=a;if(s++,s>n)n=s,t=r}else r=-1,s=0;if(n<2)return e.join(":");let o=e.slice(0,t).join(":"),i=e.slice(t+n).join(":");return o+"::"+i}function jU(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let n=t===-1?e.split(":"):e.slice(0,t).split(":"),r=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(n.length===1&&n[0]==="")n.length=0;if(r.length===1&&r[0]==="")r.length=0}let s=n.concat(r),o=0;for(let a=0;a<s.length;a++){let l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&r.length===0||!pb(l))return;o+=2;continue}if(!$U(l))return;s[a]=parseInt(l,16).toString(16),o++}if(t===-1){if(o!==8)return;return HO(s)}if(o>=8)return;let i=s.slice(0,n.length);for(let a=o;a<8;a++)i.push("0");for(let a=n.length;a<s.length;a++)i.push(s[a]);return HO(i)}function db(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let r=t?e.slice(1,-1):e;if(t&&SU(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(PU(r,":")<2)return{host:e,isIPV6:!1,error:t};let s="",o=r.indexOf("%");if(o!==-1){let a=r.slice(o,o+3).toLowerCase()==="%25"?3:1;if(s=r.slice(o+a),!EU(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=jU(r);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(s?"%"+s:""),escapedHost:i+(s?"%25"+s:""),isIPV6:!0}}function PU(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function BO(e){let t=e,n=[],r=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){n.push("/");break}else{n.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){n.push("/");break}}}else if(s===3){if(t==="/.."){if(n.length!==0)n.pop();n.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),n.length!==0)n.pop();continue}}}}if((r=t.indexOf("/",1))===-1){n.push(t);break}else n.push(t.slice(0,r)),t=t.slice(r)}return n.join("")}function kU(e){if(e===""||e[0]==="/")return BO(e);let t=e.split("/"),n=t.length-1,r=[],s=!1;for(let o=0;o<=n;o++){let i=t[o];if(i==="."||i===".."){if(i==="..")if(r.length!==0&&r[r.length-1]!=="..")r.pop();else r.push("..");s=o===n}else r.push(i)}if(s&&r[r.length-1]!=="..")r.push("");if(r.length===0||r[0]===""||r[0].includes(":"))r.unshift(".");return r.join("/")}var _U={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},OU=/[@/?#:]/g,AU=/[@/?#]/g;function UO(e,t){let n=t?AU:OU;return n.lastIndex=0,e.replace(n,(r)=>_U[r])}function zO(e,t=!1){if(e.indexOf("%")===-1)return e;let n="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Yo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&mb(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function CU(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Yo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&mb(i))t+=i;else t+="%"+o;n+=2;continue}}if(WO(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=GO(s)?r:vn[s];else if(s<55296||s>57343)t+=en(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=en(65536+(s-55296<<10)+(o-56320)),n++;else t+=en(65533)}else t+=en(65533)}}return t}function RU(e,t=!1){let n="",r=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let o=e[s];if(o==="%"&&s+2<e.length){let i=e.slice(s+1,s+3);if(Yo(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(WO(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=vn[i];else if(i<55296||i>57343)n+=en(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=en(65536+(i-55296<<10)+(a-56320)),s++;else n+=en(65533)}else n+=en(65533)}}return n}function gb(e,t){let n="";for(let r=0;r<e.length;r++){let s=e[r];if(s==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Yo(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=vn[o];else if(o<55296||o>57343)n+=en(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=en(65536+(o-55296<<10)+(i-56320)),r++;else n+=en(65533)}else n+=en(65533)}}return n}function KO(e){return gb(e,xU)}function TU(e){return gb(e,hb)}function NU(e){return gb(e,hb)}function GO(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function JU(e){let t="";for(let n=0;n<e.length;n++){let r=e[n];if(r==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Yo(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(mb(i))t+=i;else t+="%"+o;n+=2;continue}}if(hb(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=GO(s)?r:vn[s];else if(s<55296||s>57343)t+=en(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=en(65536+(s-55296<<10)+(o-56320)),n++;else t+=en(65533)}else t+=en(65533)}}return t}function MU(e){let t="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let r=e.slice(n+1,n+3);if(Yo(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function IU(e){let t=[];if(e.userinfo!==void 0)t.push(KO(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!pb(n)){let r=db(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=zO(n,!0),r=db(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=UO(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!yU(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}XO.exports={nonSimpleDomain:vU,recomposeAuthority:IU,reescapeHostDelimiters:UO,normalizePercentEncoding:zO,normalizePathEncoding:CU,serializePathEncoding:RU,normalizeQueryFragmentEncoding:JU,encodeUserinfo:KO,encodeQuery:TU,encodeFragment:NU,escapePreservingEscapes:MU,removeDotSegments:BO,removeDotSegmentsRelative:kU,isIPv4:pb,isUUID:gU,normalizeIPv6:db,stringArrayToHexStripped:bU}});var tA=B(function(roe,eA){var{isUUID:DU}=yb(),LU=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,FU=["http","https","ws","wss","urn","urn:uuid"];function VU(e){return FU.indexOf(e)!==-1}function xb(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function YO(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function ZO(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function qU(e){return e.secure=xb(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function HU(e){if(e.port===(xb(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),n=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=n&&n!=="/"?n:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function WU(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(LU);if(n&&n[0]===e.path){let r=t.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];let s=`${r}:${t.nid||e.nid}`,o=bb(s);if(e.path=void 0,o)e=o.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function BU(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let n=t.scheme||e.scheme||"urn",r=e.nid.toLowerCase(),s=`${n}:${t.nid||r}`,o=bb(s);if(o)e=o.serialize(e,t);let i=e,a=e.nss;return i.path=`${r||t.nid}:${a}`,t.skipEscape=!0,i}function UU(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!DU(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function zU(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var QO={scheme:"http",domainHost:!0,parse:YO,serialize:ZO},KU={scheme:"https",domainHost:QO.domainHost,parse:YO,serialize:ZO},Ld={scheme:"ws",domainHost:!0,parse:qU,serialize:HU},GU={scheme:"wss",domainHost:Ld.domainHost,parse:Ld.parse,serialize:Ld.serialize},XU={scheme:"urn",parse:WU,serialize:BU,skipNormalize:!0},YU={scheme:"urn:uuid",parse:UU,serialize:zU,skipNormalize:!0},Fd={http:QO,https:KU,ws:Ld,wss:GU,urn:XU,"urn:uuid":YU};Object.setPrototypeOf(Fd,null);function bb(e){return e&&(Fd[e]||Fd[e.toLowerCase()])||void 0}eA.exports={wsIsSecure:xb,SCHEMES:Fd,isValidSchemeName:VU,getSchemeHandler:bb}});var hA=B(function(soe,Wd){var{normalizeIPv6:iA,removeDotSegments:yc,removeDotSegmentsRelative:aA,recomposeAuthority:ZU,normalizePercentEncoding:$b,normalizePathEncoding:QU,serializePathEncoding:nA,normalizeQueryFragmentEncoding:rA,encodeQuery:ez,encodeFragment:tz,reescapeHostDelimiters:nz,isIPv4:lA,nonSimpleDomain:rz}=yb(),{SCHEMES:cA,getSchemeHandler:Sb}=tA(),uA=/^[A-Za-z][A-Za-z0-9+.-]*$/u,sz=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function sA(e){let t=String(e);if(!uA.test(t))throw TypeError("URI scheme is malformed.");return t}function oz(e,t){if(typeof e==="string")e=mz(e,t);else if(typeof e==="object")e=qd(Zo(e,t),t);return e}function iz(e,t,n){let r=n?Object.assign({scheme:"null"},n):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=Vd(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:g,malformedScheme:b}=Vd(t,r);if(o||d||i||p||a||m||l||g||c||b)throw Error(s.error||u.error||"URI is malformed.");let h=fA(s,u,r,!0),x=Sb(n&&n.scheme||h.scheme),k=h.host,w=k!==void 0&&k!==""&&(lA(k)||iA(k).isIPV6);if(pA(h,n||{},x,w))throw Error("URI host is malformed.");dA(h,n||{},x,w);let v=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(h.error&&!v)throw Error(h.error);return r.skipEscape=!0,Zo(h,r)}function fA(e,t,n,r){let s={};if(!r)e=qd(Zo(e,n),n),t=qd(Zo(t,n),n);if(n=n||{},!n.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=yc(t.path||""),s.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=yc(t.path||""),s.query=t.query;else{if(!t.path)if(s.path=e.path,t.query!==void 0)s.query=t.query;else s.query=e.query;else{if(t.path[0]==="/")s.path=yc(t.path);else{let o=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(o&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!o&&s.path[0]!=="/"?aA(s.path):yc(s.path)}s.query=t.query}s.userinfo=e.userinfo,s.host=e.host,s.port=e.port}s.scheme=e.scheme}return s.fragment=t.fragment,s}function az(e,t,n){let r=oA(e,n),s=oA(t,n);return r!==void 0&&s!==void 0&&r===s}function Zo(e,t){let n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},r=Object.assign({},t),s=[];if(n.scheme)n.scheme=sA(n.scheme);let o=Sb(r.scheme||n.scheme);if(o&&o.serialize)o.serialize(n,r);let i=n.userinfo!==void 0||n.host!==void 0||n.port!==void 0,a=(n.scheme===void 0||r.reference==="suffix")&&!i,l=!r.skipEscape&&a;if(n.path!==void 0)if(!r.skipEscape)n.path=nA(n.path,l);else n.path=$b(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=sA(n.scheme),s.push(n.scheme,":");let c=ZU(n);if(c!==void 0){if(r.reference!=="suffix")s.push("//");if(s.push(c),n.path&&n.path[0]!=="/")s.push("/")}if(n.path!==void 0){let u=n.path;if(!r.absolutePath&&(!o||!o.absolutePath))u=a&&u[0]!=="/"?aA(u):yc(u);if(a)u=nA(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(n.query!==void 0)s.push("?",ez(n.query));if(n.fragment!==void 0)s.push("#",tz(n.fragment));return s.join("")}var lz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,cz=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,uz=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function fz(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function gc(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Hd(e){return e[0]==="["&&e[e.length-1]==="]"}function dz(e){let t=e[4];return gc(e[3])||t!==void 0&&!Hd(t)&&gc(t)||gc(e[6])||gc(e[7])||gc(e[8])}function dA(e,t,n,r){if(pA(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!Hd(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&rz(e.host)){let s;try{s=new URL("http://"+e.host)}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}if(!pz(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function pA(e,t,n,r){return Boolean(e.host&&r===!1&&!Hd(e.host)&&(t.domainHost||n&&n.domainHost)&&sz.test(e.host))}function pz(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Vd(e,t){let n=Object.assign({},t),r={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,o=!1,i=!1,a=!1,l=!1,c=!1,u=!1;if(n.reference==="suffix")if(n.scheme)e=n.scheme+":"+e;else e="//"+e;let d=e.match(cz);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(uz);if(p!==null){let g=p[1],b=g.replace(/[\t\n\r]/g,"");if(b.length>=2){if(b.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(g.length!==b.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(lz);if(m){if(r.scheme=m[1],r.userinfo=m[3],r.host=m[4],r.port=parseInt(m[5],10),r.path=m[6]||"",r.query=m[7],r.fragment=m[8],r.scheme!==void 0)if(uA.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",c=!0;if(o=dz(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let g=fz(r,m);if(g!==void 0)r.error=r.error||g,s=!0;if(r.host)if(lA(r.host)===!1){let x=Hd(r.host),k=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,w=iA(r.host);if(u=w.isIPV6||w.isIPVFuture===!0,l=k&&(!x||w.error===!0),r.host=u?w.host:w.host.toLowerCase(),l)r.error=r.error||"URI host is malformed.",s=!0}else u=!0;if(r.scheme===void 0&&r.userinfo===void 0&&r.host===void 0&&r.port===void 0&&r.query===void 0&&!r.path)r.reference="same-document";else if(r.scheme===void 0)r.reference="relative";else if(r.fragment===void 0)r.reference="absolute";else r.reference="uri";if(n.reference&&n.reference!=="suffix"&&n.reference!==r.reference)r.error=r.error||"URI is not a "+n.reference+" reference.";let b=Sb(n.scheme||r.scheme);if(!l)a=dA(r,n,b,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!l){let h=u?r.host:$b(r.host,!0);if(!u)h=$b(h.toLowerCase());r.host=u||n.scheme!=="null"?nz(h,u):h}if(!b||b&&!b.skipNormalize){if(r.path)r.path=QU(r.path);if(r.query)r.query=rA(r.query);if(r.fragment)r.fragment=rA(r.fragment)}if(b&&b.parse){if(b.parse(r,n),b===cA.urn&&r.nid===void 0)i=!0}}else r.error=r.error||"URI can not be parsed.";return{parsed:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}}function qd(e,t){return Vd(e,t).parsed}function mz(e,t){return mA(e,t).normalized}function mA(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=Vd(e,t);return{normalized:r||s||o||i||a?e:Zo(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function oA(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Zo(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}=mA(n,t);return s||o||i||a||l?void 0:r}var wb={SCHEMES:cA,normalize:oz,resolve:iz,resolveComponent:fA,equal:az,serialize:Zo,parse:qd};Wd.exports=wb;Wd.exports.default=wb;Wd.exports.fastUri=wb});var xA=B(function(yA){Object.defineProperty(yA,"__esModule",{value:!0});var gA=hA();gA.code='require("ajv/dist/runtime/uri").default';yA.default=gA});var Eb=B(function(bs){Object.defineProperty(bs,"__esModule",{value:!0});bs.CodeGen=bs.Name=bs.nil=bs.stringify=bs.str=bs._=bs.KeywordCxt=void 0;var gz=ya();Object.defineProperty(bs,"KeywordCxt",{enumerable:!0,get:function(){return gz.KeywordCxt}});var Sa=$e();Object.defineProperty(bs,"_",{enumerable:!0,get:function(){return Sa._}});Object.defineProperty(bs,"str",{enumerable:!0,get:function(){return Sa.str}});Object.defineProperty(bs,"stringify",{enumerable:!0,get:function(){return Sa.stringify}});Object.defineProperty(bs,"nil",{enumerable:!0,get:function(){return Sa.nil}});Object.defineProperty(bs,"Name",{enumerable:!0,get:function(){return Sa.Name}});Object.defineProperty(bs,"CodeGen",{enumerable:!0,get:function(){return Sa.CodeGen}});var yz=pc(),vA=ba(),EA=Qx(),Ir=hc(),jA=$e(),Dr=dc(),Zs=fc(),$a=Ce(),bA=qO(),xz=xA(),PA=(e,t)=>new RegExp(e,t);PA.code="new RegExp";var bz=["removeAdditional","useDefaults","coerceTypes"],$z=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Sz={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},wz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$A=200;function vz(e){var t,n,r,s,o,i,a,l,c,u,d,p,m,g,b,h,x,k,w,v,E,O,I,D,V;let W=e.strict,A=(t=e.code)===null||t===void 0?void 0:t.optimize,J=A===!0||A===void 0?1:A||0,G=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:PA,se=(s=e.uriResolver)!==null&&s!==void 0?s:xz.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:W)!==null&&i!==void 0?i:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:W)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:W)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:W)!==null&&p!==void 0?p:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:W)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:J,regExp:G}:{optimize:J,regExp:G},loopRequired:(b=e.loopRequired)!==null&&b!==void 0?b:$A,loopEnum:(h=e.loopEnum)!==null&&h!==void 0?h:$A,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(v=e.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(I=e.validateFormats)!==null&&I!==void 0?I:!0,unicodeRegExp:(D=e.unicodeRegExp)!==null&&D!==void 0?D:!0,int32range:(V=e.int32range)!==null&&V!==void 0?V:!0,uriResolver:se}}class Bd{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...vz(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new jA.ValueScope({scope:{},prefixes:$z,es5:t,lines:n}),this.logger=Oz(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=EA.getRules(),SA.call(this,Sz,e,"NOT SUPPORTED"),SA.call(this,wz,e,"DEPRECATED","warn"),this._metaOpts=kz.call(this),e.formats)jz.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Pz.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Ez.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=bA;if(n==="id")r={...bA},r.id=r.$id,delete r.$id;if(t&&e)this.addMetaSchema(r,r[n],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let r=n(t);if(!("$async"in n))this.errors=n.errors;return r}compile(e,t){let n=this._addSchema(e,t);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return r.call(this,e,t);async function r(c,u){await s.call(this,c.$schema);let d=this._addSchema(c,u);return d.validate||o.call(this,d)}async function s(c){if(c&&!this.getSchema(c))await r.call(this,{$ref:c},!0)}async function o(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof vA.default))throw u;return i.call(this,u),await a.call(this,u.missingSchema),o.call(this,c)}}function i({missingSchema:c,missingRef:u}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${u} cannot be resolved`)}async function a(c){let u=await l.call(this,c);if(!this.refs[c])await s.call(this,u.$schema);if(!this.refs[c])this.addSchema(u,c,t)}async function l(c){let u=this._loading[c];if(u)return u;try{return await(this._loading[c]=n(c))}finally{delete this._loading[c]}}}addSchema(e,t,n,r=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,r);return this}let s;if(typeof e==="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw Error(`schema ${o} must be string`)}return t=Dr.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,n,t,r,!0),this}addMetaSchema(e,t,n=this.opts.validateSchema){return this.addSchema(e,t,!0,n),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let r=this.validate(n,e);if(!r&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return r}getSchema(e){let t;while(typeof(t=wA.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new Ir.SchemaEnv({schema:{},schemaId:n});if(t=Ir.resolveSchema.call(this,r,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=wA.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let n=e[this.opts.schemaId];if(n)n=Dr.normalizeId(n),delete this.schemas[n],delete this.refs[n];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let n;if(typeof e=="string"){if(n=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=n}else if(typeof e=="object"&&t===void 0){if(t=e,n=t.keyword,Array.isArray(n)&&!n.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(Cz.call(this,n,t),!t)return $a.eachItem(n,(s)=>vb.call(this,s)),this;Tz.call(this,t);let r={...t,type:Zs.getJSONTypes(t.type),schemaType:Zs.getJSONTypes(t.schemaType)};return $a.eachItem(n,r.type.length===0?(s)=>vb.call(this,s,r):(s)=>r.type.forEach((o)=>vb.call(this,s,r,o))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let n of t.rules){let r=n.rules.findIndex((s)=>s.keyword===e);if(r>=0)n.rules.splice(r,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:n="data"}={}){if(!e||e.length===0)return"No errors";return e.map((r)=>`${n}${r.instancePath} ${r.message}`).reduce((r,s)=>r+t+s)}$dataMetaSchema(e,t){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let r of t){let s=r.split("/").slice(1),o=e;for(let i of s)o=o[i];for(let i in n){let a=n[i];if(typeof a!="object")continue;let{$data:l}=a.definition,c=o[i];if(l&&c)o[i]=kA(c)}}return e}_removeAllSchemas(e,t){for(let n in e){let r=e[n];if(!t||t.test(n)){if(typeof r=="string")delete e[n];else if(r&&!r.meta)this._cache.delete(r.schema),delete e[n]}}}_addSchema(e,t,n,r=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:i}=this.opts;if(typeof e=="object")o=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;n=Dr.normalizeId(o||n);let l=Dr.getSchemaRefs.call(this,e,n);if(a=new Ir.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:n,localRefs:l}),this._cache.set(a.schema,a),s&&!n.startsWith("#")){if(n)this._checkUnique(n);this.refs[n]=a}if(r)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Ir.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Ir.compileSchema.call(this,e)}finally{this.opts=t}}}Bd.ValidationError=yz.default;Bd.MissingRefError=vA.default;bs.default=Bd;function SA(e,t,n,r="error"){for(let s in e){let o=s;if(o in t)this.logger[r](`${n}: option ${s}. ${e[o]}`)}}function wA(e){return e=Dr.normalizeId(e),this.schemas[e]||this.refs[e]}function Ez(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function jz(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Pz(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let n=e[t];if(!n.keyword)n.keyword=t;this.addKeyword(n)}}function kz(){let e={...this.opts};for(let t of bz)delete e[t];return e}var _z={log(){},warn(){},error(){}};function Oz(e){if(e===!1)return _z;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var Az=/^[a-z_$][a-z0-9_$:-]*$/i;function Cz(e,t){let{RULES:n}=this;if($a.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!Az.test(r))throw Error(`Keyword ${r} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function vb(e,t,n){var r;let s=t===null||t===void 0?void 0:t.post;if(n&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:l})=>l===n);if(!i)i={type:n,rules:[]},o.rules.push(i);if(o.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Zs.getJSONTypes(t.type),schemaType:Zs.getJSONTypes(t.schemaType)}};if(t.before)Rz.call(this,i,a,t.before);else i.rules.push(a);o.all[e]=a,(r=t.implements)===null||r===void 0||r.forEach((l)=>this.addKeyword(l))}function Rz(e,t,n){let r=e.rules.findIndex((s)=>s.keyword===n);if(r>=0)e.rules.splice(r,0,t);else e.rules.push(t),this.logger.warn(`rule ${n} is not defined`)}function Tz(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=kA(t);e.validateSchema=this.compile(t,!0)}var Nz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function kA(e){return{anyOf:[e,Nz]}}});var OA=B(function(_A){Object.defineProperty(_A,"__esModule",{value:!0});var Iz={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};_A.default=Iz});var Gd=B(function(CA){Object.defineProperty(CA,"__esModule",{value:!0});CA.callRef=CA.getValidate=void 0;var Lz=ba(),zd=er(),Ge=$e(),wa=Zn(),Kd=hc(),Qs=Ce(),Fz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:n,it:r}=e,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:l}=r,{root:c}=o;if((n==="#"||n==="#/")&&s===c.baseId)return d();let u=Kd.resolveRef.call(l,c,s,n);if(u===void 0)throw new Lz.default(r.opts.uriResolver,s,n);if(u instanceof Kd.SchemaEnv)return p(u);return m(u);function d(){if(o===c)return Ud(e,i,o,o.$async);let g=t.scopeValue("root",{ref:c});return Ud(e,Ge._`${g}.validate`,c,c.$async)}function p(g){let b=AA(e,g);Ud(e,b,g,g.$async)}function m(g){let b=t.scopeValue("schema",a.code.source===!0?{ref:g,code:Ge.stringify(g)}:{ref:g}),h=t.name("valid"),x=e.subschema({schema:g,dataTypes:[],schemaPath:Ge.nil,topSchemaRef:b,errSchemaPath:n},h);e.mergeEvaluated(x),e.ok(h)}}};function AA(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):Ge._`${n.scopeValue("wrapper",{ref:t})}.validate`}CA.getValidate=AA;function Ud(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:l}=o,c=l.passContext?wa.default.this:Ge.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let g=s.let("valid");s.try(()=>{if(s.code(Ge._`await ${zd.callValidateCode(e,t,c)}`),m(t),!i)s.assign(g,!0)},(b)=>{if(s.if(Ge._`!(${b} instanceof ${o.ValidationError})`,()=>s.throw(b)),p(b),!i)s.assign(g,!1)}),e.ok(g)}function d(){e.result(zd.callValidateCode(e,t,c),()=>m(t),()=>p(t))}function p(g){let b=Ge._`${g}.errors`;s.assign(wa.default.vErrors,Ge._`${wa.default.vErrors} === null ? ${b} : ${wa.default.vErrors}.concat(${b})`),s.assign(wa.default.errors,Ge._`${wa.default.vErrors}.length`)}function m(g){var b;if(!o.opts.unevaluated)return;let h=(b=n===null||n===void 0?void 0:n.validate)===null||b===void 0?void 0:b.evaluated;if(o.props!==!0)if(h&&!h.dynamicProps){if(h.props!==void 0)o.props=Qs.mergeEvaluated.props(s,h.props,o.props)}else{let x=s.var("props",Ge._`${g}.evaluated.props`);o.props=Qs.mergeEvaluated.props(s,x,o.props,Ge.Name)}if(o.items!==!0)if(h&&!h.dynamicItems){if(h.items!==void 0)o.items=Qs.mergeEvaluated.items(s,h.items,o.items)}else{let x=s.var("items",Ge._`${g}.evaluated.items`);o.items=Qs.mergeEvaluated.items(s,x,o.items,Ge.Name)}}}CA.callRef=Ud;CA.default=Fz});var jb=B(function(TA){Object.defineProperty(TA,"__esModule",{value:!0});var Hz=OA(),Wz=Gd(),Bz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Hz.default,Wz.default];TA.default=Bz});var JA=B(function(NA){Object.defineProperty(NA,"__esModule",{value:!0});var to=$e(),eo=to.operators,Xd={maximum:{okStr:"<=",ok:eo.LTE,fail:eo.GT},minimum:{okStr:">=",ok:eo.GTE,fail:eo.LT},exclusiveMaximum:{okStr:"<",ok:eo.LT,fail:eo.GTE},exclusiveMinimum:{okStr:">",ok:eo.GT,fail:eo.LTE}},zz={message:({keyword:e,schemaCode:t})=>to.str`must be ${Xd[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>to._`{comparison: ${Xd[e].okStr}, limit: ${t}}`},Kz={keyword:Object.keys(Xd),type:"number",schemaType:"number",$data:!0,error:zz,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(to._`${n} ${Xd[t].fail} ${r} || isNaN(${n})`)}};NA.default=Kz});var IA=B(function(MA){Object.defineProperty(MA,"__esModule",{value:!0});var Lr=$e(),Xz={message:({schemaCode:e})=>Lr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Lr._`{multipleOf: ${e}}`},Yz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Xz,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?Lr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:Lr._`${i} !== parseInt(${i})`;e.fail$data(Lr._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};MA.default=Yz});var FA=B(function(LA){Object.defineProperty(LA,"__esModule",{value:!0});function DA(e){let t=e.length,n=0,r=0,s;while(r<t)if(n++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t){if(s=e.charCodeAt(r),(s&64512)===56320)r++}return n}LA.default=DA;DA.code='require("ajv/dist/runtime/ucs2length").default'});var HA=B(function(qA){Object.defineProperty(qA,"__esModule",{value:!0});var En=$e(),VA=Ce(),e8=FA(),t8={message({keyword:e,schemaCode:t}){return En.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>En._`{limit: ${e}}`},n8={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:t8,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?En.operators.GT:En.operators.LT,i=s.opts.unicode===!1?En._`${n}.length`:En._`${VA.useFunc(e.gen,e8.default)}(${n})`;e.fail$data(En._`${i} ${o} ${r}`)}};qA.default=n8});var zA=B(function(UA){Object.defineProperty(UA,"__esModule",{value:!0});var WA=er(),BA=Ce(),tr=$e(),s8={message:({schemaCode:e})=>tr.str`must match pattern "${e}"`,params:({schemaCode:e})=>tr._`{pattern: ${e}}`},o8={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:s8,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(r){let{regExp:l}=i.opts.code,c=l.code==="new RegExp"?tr._`new RegExp`:BA.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,tr._`${c}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(tr._`!${u}`)}else{let l=WA.usePattern(e,s);e.fail$data(tr._`!${l}.test(${n})`)}}};UA.default=o8});var GA=B(function(KA){Object.defineProperty(KA,"__esModule",{value:!0});var Fr=$e(),a8={message({keyword:e,schemaCode:t}){return Fr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Fr._`{limit: ${e}}`},l8={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:a8,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?Fr.operators.GT:Fr.operators.LT;e.fail$data(Fr._`Object.keys(${n}).length ${s} ${r}`)}};KA.default=l8});var ZA=B(function(YA){Object.defineProperty(YA,"__esModule",{value:!0});var Vr=er(),qr=$e(),XA=Ce(),u8={message:({params:{missingProperty:e}})=>qr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>qr._`{missingProperty: ${e}}`},f8={keyword:"required",type:"object",schemaType:"array",$data:!0,error:u8,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let l=n.length>=a.loopRequired;if(i.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:g}=e.it;for(let b of n)if((m===null||m===void 0?void 0:m[b])===void 0&&!g.has(b)){let h=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${b}" is not defined at "${h}" (strictRequired)`;XA.checkStrictMode(i,x,i.opts.strictRequired)}}function c(){if(l||o)e.block$data(qr.nil,d);else for(let m of n)Vr.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||o){let g=t.let("valid",!0);e.block$data(g,()=>p(m,g)),e.ok(g)}else t.if(Vr.checkMissingProp(e,n,m)),Vr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(Vr.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,g){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(g,Vr.propertyInData(t,s,m,a.ownProperties)),t.if(qr.not(g),()=>{e.error(),t.break()})},qr.nil)}}};YA.default=f8});var eC=B(function(QA){Object.defineProperty(QA,"__esModule",{value:!0});var Hr=$e(),p8={message({keyword:e,schemaCode:t}){return Hr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Hr._`{limit: ${e}}`},m8={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:p8,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?Hr.operators.GT:Hr.operators.LT;e.fail$data(Hr._`${n}.length ${s} ${r}`)}};QA.default=m8});var Yd=B(function(nC){Object.defineProperty(nC,"__esModule",{value:!0});var tC=ib();tC.code='require("ajv/dist/runtime/equal").default';nC.default=tC});var oC=B(function(sC){Object.defineProperty(sC,"__esModule",{value:!0});var va=fc(),Ie=$e(),rC=Ce(),y8=Yd(),x8={message:({params:{i:e,j:t}})=>Ie.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Ie._`{i: ${e}, j: ${t}}`},b8={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:x8,code(e){let{gen:t,data:n,$data:r,schema:s,parentSchema:o,schemaCode:i,it:a}=e;if(!r&&!s)return;let l=t.let("valid"),c=o.items?va.getSchemaTypes(o.items):[];e.block$data(l,u,Ie._`${i} === false`),e.ok(l);function u(){let g=t.let("i",Ie._`${n}.length`),b=t.let("j");e.setParams({i:g,j:b}),t.assign(l,!0),t.if(Ie._`${g} > 1`,()=>(d()?p:m)(g,b))}function d(){return c.length>0&&!c.some((g)=>g==="object"||g==="array")}function p(g,b){let h=t.name("item"),x=va.checkDataTypes(c,h,a.opts.strictNumbers,va.DataType.Wrong),k=t.const("indices",Ie._`{}`);t.for(Ie._`;${g}--;`,()=>{if(t.let(h,Ie._`${n}[${g}]`),t.if(x,Ie._`continue`),c.length>1)t.if(Ie._`typeof ${h} == "string"`,Ie._`${h} += "_"`);t.if(Ie._`typeof ${k}[${h}] == "number"`,()=>{t.assign(b,Ie._`${k}[${h}]`),e.error(),t.assign(l,!1).break()}).code(Ie._`${k}[${h}] = ${g}`)})}function m(g,b){let h=rC.useFunc(t,y8.default),x=t.name("outer");t.label(x).for(Ie._`;${g}--;`,()=>t.for(Ie._`${b} = ${g}; ${b}--;`,()=>t.if(Ie._`${h}(${n}[${g}], ${n}[${b}])`,()=>{e.error(),t.assign(l,!1).break(x)})))}}};sC.default=b8});var lC=B(function(aC){Object.defineProperty(aC,"__esModule",{value:!0});var Ea=$e(),iC=Ce(),S8=Yd(),w8={message:"must be equal to constant",params:({schemaCode:e})=>Ea._`{allowedValue: ${e}}`},v8={keyword:"const",$data:!0,error:w8,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(Ea._`!${iC.useFunc(t,S8.default)}(${n}, ${s})`);else e.fail(Ea._`${o} !== ${n}`)}};aC.default=v8});var fC=B(function(uC){Object.defineProperty(uC,"__esModule",{value:!0});var Wr=$e(),cC=Ce(),j8=Yd(),P8={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Wr._`{allowedValues: ${e}}`},k8={keyword:"enum",schemaType:"array",$data:!0,error:P8,code(e){let{gen:t,data:n,$data:r,schema:s,schemaCode:o,it:i}=e;if(!r&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=cC.useFunc(t,j8.default),u;if(a||r)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",o);u=Wr.or(...s.map((g,b)=>p(m,b)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(Wr._`${c()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,g){let b=s[g];return typeof b==="object"&&b!==null?Wr._`${c()}(${n}, ${m}[${g}])`:Wr._`${n} === ${b}`}}};uC.default=k8});var Pb=B(function(dC){Object.defineProperty(dC,"__esModule",{value:!0});var O8=JA(),A8=IA(),C8=HA(),R8=zA(),T8=GA(),N8=ZA(),J8=eC(),M8=oC(),I8=lC(),D8=fC(),L8=[O8.default,A8.default,C8.default,R8.default,T8.default,N8.default,J8.default,M8.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},I8.default,D8.default];dC.default=L8});var kb=B(function(mC){Object.defineProperty(mC,"__esModule",{value:!0});mC.validateAdditionalItems=void 0;var jn=$e(),ja=Ce(),V8={message:({params:{len:e}})=>jn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>jn._`{limit: ${e}}`},q8={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:V8,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){ja.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}pC(e,r)}};function pC(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",jn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(jn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!ja.alwaysValidSchema(i,r)){let c=n.var("valid",jn._`${a} <= ${t.length}`);n.if(jn.not(c),()=>l(c)),e.ok(c)}function l(c){n.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:o,dataProp:u,dataPropType:ja.Type.Num},c),!i.allErrors)n.if(jn.not(c),()=>n.break())})}}mC.validateAdditionalItems=pC;mC.default=q8});var _b=B(function(xC){Object.defineProperty(xC,"__esModule",{value:!0});xC.validateTuple=void 0;var Zd=$e(),no=Ce(),gC=er(),W8={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return yC(e,"additionalItems",t);if(n.items=!0,no.alwaysValidSchema(n,t))return;e.ok(gC.validateArray(e))}};function yC(e,t,n=e.schema){let{gen:r,parentSchema:s,data:o,keyword:i,it:a}=e;if(u(s),a.opts.unevaluated&&n.length&&a.items!==!0)a.items=no.mergeEvaluated.items(r,n.length,a.items);let l=r.name("valid"),c=r.const("len",Zd._`${o}.length`);n.forEach((d,p)=>{if(no.alwaysValidSchema(a,d))return;r.if(Zd._`${c} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l)});function u(d){let{opts:p,errSchemaPath:m}=a,g=n.length,b=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(p.strictTuples&&!b){let h=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;no.checkStrictMode(a,h,p.strictTuples)}}}xC.validateTuple=yC;xC.default=W8});var wC=B(function(SC){Object.defineProperty(SC,"__esModule",{value:!0});var $C=_b(),U8={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>$C.validateTuple(e,"items")};SC.default=U8});var kC=B(function(PC){Object.defineProperty(PC,"__esModule",{value:!0});var Qd=$e(),vC=Ce(),EC=er(),jC=kb(),K8={message:({params:{len:e}})=>Qd.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Qd._`{limit: ${e}}`},G8={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:K8,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,vC.alwaysValidSchema(r,t))return;if(s)jC.validateAdditionalItems(e,s);else e.ok(EC.validateArray(e))}};PC.default=G8});var OC=B(function(_C){Object.defineProperty(_C,"__esModule",{value:!0});var dt=$e(),ro=Ce(),Y8={message:({params:{min:e,max:t}})=>t===void 0?dt.str`must contain at least ${e} valid item(s)`:dt.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?dt._`{minContains: ${e}}`:dt._`{minContains: ${e}, maxContains: ${t}}`},Z8={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Y8,code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e,i,a,{minContains:l,maxContains:c}=r;if(o.opts.next)i=l===void 0?1:l,a=c;else i=1;let u=t.const("len",dt._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){ro.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){ro.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(ro.alwaysValidSchema(o,n)){let b=dt._`${u} >= ${i}`;if(a!==void 0)b=dt._`${b} && ${u} <= ${a}`;e.pass(b);return}o.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(dt._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let b=t.name("_valid"),h=t.let("count",0);m(b,()=>t.if(b,()=>g(h)))}function m(b,h){t.forRange("i",0,u,(x)=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:ro.Type.Num,compositeRule:!0},b),h()})}function g(b){if(t.code(dt._`${b}++`),a===void 0)t.if(dt._`${b} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(dt._`${b} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(dt._`${b} >= ${i}`,()=>t.assign(d,!0))}}};_C.default=Z8});var ep=B(function(TC){Object.defineProperty(TC,"__esModule",{value:!0});TC.validateSchemaDeps=TC.validatePropertyDeps=TC.error=void 0;var Pa=$e(),AC=Ce(),Br=er();TC.error={message:({params:{property:e,depsCount:t,deps:n}})=>Pa.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>Pa._`{property: ${e},
|
|
674
|
+
`+(" ".repeat(Ie.length)+"^"),W=N==="Syntax"?"since":"inside",z=`${N} error at line ${Re}${f.name?` in ${f.name}`:""}${j&&j.name?`, ${W} \`${j.partial?"partial ":""}${function(X){let fe=[X];for(;X&&X.parent;){let{parent:ze}=X;fe.unshift(ze),X=ze}return fe.map((ze)=>function(_n,Se){let Zt=_n;return Se&&(Zt+=` ${Se}`),Zt}(ze.type,ze.name)).join(" -> ")}(j)}\``:""}:
|
|
675
|
+
${_}`;return{message:`${z} ${k}`,bareMessage:k,context:z,line:Re,sourceName:f.name,level:ee,ruleName:ge,autofix:se,input:Wt,tokens:_t}}function r(f,b,j,k){return n(f,b,j,k,"Syntax")}function s(f,b,j,k,N={}){return N.ruleName=j,n(b.source,f.index,b,k,"Validation",N)}e.r(t),e.d(t,{WebIDLParseError:()=>kt,parse:()=>Ri,validate:()=>xl,write:()=>Us});class o{constructor({source:f,tokens:b}){Object.defineProperties(this,{source:{value:f},tokens:{value:b,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},b=this;for(;b!==Object.prototype;){let j=Object.getOwnPropertyDescriptors(b);for(let[k,N]of Object.entries(j))(N.enumerable||N.get)&&(f[k]=this[k]);b=Object.getPrototypeOf(b)}return f}}function i(f,b,{useNullableInner:j}={}){if(!f.union){let k=b.unique.get(f.idlType);if(!k)return;if(k.type==="typedef"){let{typedefIncludesDictionary:N}=b.cache;if(N.has(k))return N.get(k);b.cache.typedefIncludesDictionary.set(k,void 0);let ee=i(k.idlType,b);if(b.cache.typedefIncludesDictionary.set(k,ee),ee)return{reference:f,dictionary:ee.dictionary}}if(k.type==="dictionary"&&(j||!f.nullable))return{reference:f,dictionary:k}}for(let k of f.subtype){let N=i(k,b);if(N)return k.union?N:{reference:k,dictionary:N.dictionary}}}function a(f,b){if(b.cache.dictionaryIncludesRequiredField.has(f))return b.cache.dictionaryIncludesRequiredField.get(f);b.cache.dictionaryIncludesRequiredField.set(f,void 0);let j=f.members.some((k)=>k.required);if(!j&&f.inheritance){let k=b.unique.get(f.inheritance);k?a(k,b)&&(j=!0):j=!0}return b.cache.dictionaryIncludesRequiredField.set(f,j),j}class l extends Array{constructor({source:f,tokens:b}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:b},parent:{value:null,writable:!0}})}}class c extends o{static parser(f,b){return()=>{let j=f.consumeKind(b);if(j)return new c({source:f.source,tokens:{value:j}})}}get value(){return A(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class u extends c{static parse(f){let b=f.consumeKind("eof");if(b)return new u({source:f.source,tokens:{value:b}})}get type(){return"eof"}}function d(f,b){return L(f,{parser:c.parser(f,b),listName:b+" list"})}let p=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function g(f){for(let b of p){let j=d(f,b);if(j.length)return j}f.error("Expected identifiers, strings, decimals, or integers but none found")}class y extends o{static parse(f){let b={assign:f.consume("=")},j=q(new y({source:f.source,tokens:b}));if(j.list=[],b.assign){if(b.asterisk=f.consume("*"),b.asterisk)return j.this;b.secondaryName=f.consumeKind(...p)}return b.open=f.consume("("),b.open?(j.list=j.rhsIsList?g(f):U(f),b.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):b.assign&&!b.secondaryName&&f.error("No right hand side to extended attribute assignment"),j.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:b}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((j)=>b==="identifier-list"?f.identifier(j,this.parent):j.write(f)),f.token(this.tokens.close)])}}class h extends o{static parse(f){let b=f.consumeKind("identifier");if(b)return new h({source:f.source,tokens:{name:b},params:y.parse(f)})}constructor({source:f,tokens:b,params:j}){super({source:f,tokens:b}),j.parent=this,Object.defineProperty(this,"params",{value:j})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:b,list:j}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?j:this.params.tokens.secondaryName?A(b.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:b}=this.params;return!b||f?[]:b}*validate(f){let{name:b}=this;if(b==="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(b)){let k=`\`[${b}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(b)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",k,{level:"warning",autofix:(j=this,()=>{let{name:N}=j;j.tokens.name.value=m.get(N),N==="TreatNullAs"&&(j.params.tokens={})})})}var j;for(let k of this.arguments)yield*k.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 b={};b.open=f.consume("[");let j=new x({source:f.source,tokens:b});return b.open?(j.push(...L(f,{parser:h.parse,listName:"extended attribute"})),b.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),j.length||(f.unconsume(b.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),j):j}*validate(f){for(let b of this)yield*b.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((b)=>b.write(f)),f.token(this.tokens.close)]):""}}function P(f,b){let j=f.consume("?");j&&(b.tokens.nullable=j),f.probe("?")&&f.error("Can't nullable more than once")}function S(f,b){let j=function(k,N){let ee=k.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!ee)return;let se=q(new v({source:k.source,tokens:{base:ee}}));switch(se.tokens.open=k.consume("<")||k.error(`No opening bracket after ${ee.value}`),ee.value){case"Promise":{k.probe("[")&&k.error("Promise type cannot have extended attribute");let ge=le(k,N)||k.error("Missing Promise subtype");se.subtype.push(ge);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let ge=Z(k,N)||k.error(`Missing ${ee.value} subtype`);se.subtype.push(ge);break}case"record":{k.probe("[")&&k.error("Record key cannot have extended attribute");let ge=k.consume(...Ke)||k.error(`Record key must be one of: ${Ke.join(", ")}`),xe=new v({source:k.source,tokens:{base:ge}});xe.tokens.separator=k.consume(",")||k.error("Missing comma after record key type"),xe.type=N;let Ee=Z(k,N)||k.error("Error parsing generic type record");se.subtype.push(xe,Ee);break}}return se.idlType||k.error(`Error parsing generic type ${ee.value}`),se.tokens.close=k.consume(">")||k.error(`Missing closing bracket after ${ee.value}`),se.this}(f,b)||B(f);if(!j){let k=f.consumeKind("identifier")||f.consume(...Ke,...pe);if(!k)return;j=new v({source:f.source,tokens:{base:k}}),f.probe("<")&&f.error(`Unsupported generic type ${k.value}`)}return j.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),j.type=b||null,P(f,j),j.nullable&&j.idlType==="any"&&f.error("Type `any` cannot be made nullable"),j}class v extends o{static parse(f,b){return S(f,b)||function(j,k){let N={};if(N.open=j.consume("("),!N.open)return;let ee=q(new v({source:j.source,tokens:N}));for(ee.type=k||null;;){let se=Z(j,k)||j.error("No type after open parenthesis or 'or' in union type");se.idlType==="any"&&j.error("Type `any` cannot be included in a union type"),se.generic==="Promise"&&j.error("Type `Promise` cannot be included in a union type"),ee.subtype.push(se);let ge=j.consume("or");if(!ge)break;se.tokens.separator=ge}return ee.idlType.length<2&&j.error("At least two types are expected in a union type but found less"),N.close=j.consume(")")||j.error("Unterminated union type"),P(j,ee),ee.this}(f,b)}constructor({source:f,tokens:b}){super({source:f,tokens:b}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new x({source:f,tokens:{}})}get generic(){return this.subtype.length&&this.tokens.base?this.tokens.base.value:""}get nullable(){return Boolean(this.tokens.nullable)}get union(){return Boolean(this.subtype.length)&&!this.tokens.base}get idlType(){if(this.subtype.length)return this.subtype;return A([this.tokens.prefix,this.tokens.base,this.tokens.postfix].filter((f)=>f).map((f)=>f.value).join(" "))}*validate(f){if(yield*this.extAttrs.validate(f),this.idlType==="BufferSource")for(let N of[this.extAttrs,this.parent?.extAttrs])for(let ee of N){if(ee.name!=="AllowShared")continue;let se="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",se,{autofix:E(this,ee,N)})}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:(b=this,()=>{b.tokens.base.value="undefined"})});var b;let j=!this.union&&f.unique.get(this.idlType),k=this.union?this:j&&j.type==="typedef"?j.idlType:void 0;if(k&&this.nullable){let{reference:N}=i(k,f)||{};if(N){let ee=(this.union?N:this).tokens.base;yield s(ee,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let N of this.subtype)yield*N.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((N)=>N.write(f)),f.token(this.tokens.close)]);let b=this.tokens.prefix||this.tokens.base,j=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],k=f.reference(f.ts.wrap([...j,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(b.trivia),k])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function E(f,b,j){return()=>{let k=j.indexOf(b);j.splice(k,1),!j.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class w extends o{static parse(f){let b=f.consume("=");if(!b)return null;let j=K(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),k=[j];if(j.value==="["){let N=f.consume("]")||f.error("Default sequence value must be empty");k.push(N)}else if(j.value==="{"){let N=f.consume("}")||f.error("Default dictionary value must be empty");k.push(N)}return new w({source:f.source,tokens:{assign:b},expression:k})}constructor({source:f,tokens:b,expression:j}){super({source:f,tokens:b}),j.parent=this,Object.defineProperty(this,"expression",{value:j})}get type(){return ne(this.expression[0]).type}get value(){return ne(this.expression[0]).value}get negative(){return ne(this.expression[0]).negative}write(f){return f.ts.wrap([f.token(this.tokens.assign),...this.expression.map((b)=>f.token(b))])}}class R extends o{static parse(f){let b=f.position,j={},k=q(new R({source:f.source,tokens:j}));return k.extAttrs=x.parse(f),j.optional=f.consume("optional"),k.idlType=Z(f,"argument-type"),k.idlType?(j.optional||(j.variadic=f.consume("...")),j.name=f.consumeKind("identifier")||f.consume(...re),j.name?(k.default=j.optional?w.parse(f):null,k.this):f.unconsume(b)):f.unconsume(b)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let b=i(this.idlType,f,{useNullableInner:!0});if(b){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:C(this)})}else if(this.parent&&!a(b.dictionary,f)&&function(k){let N=k.parent.arguments||k.parent.list,ee=N.indexOf(k);return!N.slice(ee+1).some((ge)=>!ge.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(j=this,()=>{let N=me(j.idlType);j.tokens.optional={...N,type:"optional",value:"optional"},N.trivia=" ",C(j)()})})}var j}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function C(f){return()=>{f.default=w.parse(new dt(" = {}"))}}class J extends o{static parse(f,{special:b,regular:j}={}){let k={special:b},N=q(new J({source:f.source,tokens:k}));return b&&b.value==="stringifier"&&(k.termination=f.consume(";"),k.termination)?(N.arguments=[],N):(b||j||(k.special=f.consume("getter","setter","deleter")),N.idlType=le(f)||f.error("Missing return type"),k.name=f.consumeKind("identifier")||f.consume("includes"),k.open=f.consume("(")||f.error("Invalid operation"),N.arguments=U(f),k.close=f.consume(")")||f.error("Unterminated operation"),k.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),N.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?A(f.value):""}get special(){return this.tokens.special?this.tokens.special.value:""}*validate(f){if(yield*this.extAttrs.validate(f),!this.name&&["","static"].includes(this.special))yield s(this.tokens.open,this,"incomplete-op","Regular or static operations must have both a return type and an identifier.");if(this.idlType){if(this.idlType.generic==="async_sequence")yield s(this.idlType.tokens.base,this,"async-sequence-idl-to-js","async_sequence types cannot be returned by an operation.");yield*this.idlType.validate(f)}for(let b of this.arguments)yield*b.validate(f)}write(f){let{parent:b}=this,j=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:b}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((k)=>k.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:b}),...j,f.token(this.tokens.termination)]),{data:this,parent:b})}}class D extends o{static parse(f,{special:b,noInherit:j=!1,readonly:k=!1}={}){let N=f.position,ee={special:b},se=q(new D({source:f.source,tokens:ee}));if(b||j||(ee.special=f.consume("inherit")),se.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),ee.readonly=f.consume("readonly"),k&&!ee.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),ee.base=f.consume("attribute"),ee.base)return se.idlType=Z(f,"attribute-type")||f.error("Attribute lacks a type"),ee.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),ee.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),se.this;f.unconsume(N)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return A(this.tokens.name.value)}*validate(f){if(yield*this.extAttrs.validate(f),yield*this.idlType.validate(f),["async_sequence","sequence","record"].includes(this.idlType.generic)){let b=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",b)}{let{reference:b}=i(this.idlType,f)||{};if(b){let j=(this.idlType.union?b:this.idlType).tokens.base;yield s(j,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(b,j){if(b.union)return!1;if(b.extAttrs.some((N)=>N.name==="EnforceRange"))return!0;let k=j.unique.get(b.idlType);return k?.type==="typedef"&&k.idlType.extAttrs.some((N)=>N.name==="EnforceRange")}(this.idlType,f)){let b=this.idlType.tokens.base;yield s(b,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:b}=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:b}),f.token(this.tokens.termination)]),{data:this,parent:b})}}function A(f){return f.startsWith("_")?f.slice(1):f}function L(f,{parser:b,allowDangler:j,listName:k="list"}){let N=b(f);if(!N)return[];N.tokens.separator=f.consume(",");let ee=[N];for(;N.tokens.separator;){let se=b(f);if(!se){j||f.error(`Trailing comma in ${k}`);break}if(se.tokens.separator=f.consume(","),ee.push(se),!se.tokens.separator)break}return ee}function K(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function ne({type:f,value:b}){switch(f){case"decimal":case"integer":return{type:"number",value:b};case"string":return{type:"string",value:b.slice(1,-1)}}switch(b){case"true":case"false":return{type:"boolean",value:b==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:b.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:b}}}function B(f){let{source:b}=f,j=function(){let N=f.consume("unsigned"),ee=f.consume("short","long");if(ee){let se=f.consume("long");return new v({source:b,tokens:{prefix:N,base:ee,postfix:se}})}N&&f.error("Failed to parse integer type")}()||function(){let N=f.consume("unrestricted"),ee=f.consume("float","double");if(ee)return new v({source:b,tokens:{prefix:N,base:ee}});N&&f.error("Failed to parse float type")}();if(j)return j;let k=f.consume("bigint","boolean","byte","octet","undefined");return k?new v({source:b,tokens:{base:k}}):void 0}function U(f){return L(f,{parser:R.parse,listName:"arguments list"})}function Z(f,b){let j=x.parse(f),k=v.parse(f,b);return k&&(q(k).extAttrs=j),k}function le(f,b){let j=v.parse(f,b||"return-type");if(j)return j;let k=f.consume("void");if(k){let N=new v({source:f.source,tokens:{base:k}});return N.type="return-type",N}}function we(f){let b=f.consume("stringifier");if(!b)return;return D.parse(f,{special:b})||J.parse(f,{special:b})||f.error("Unterminated stringifier")}function Y(f){let b=f.split(`
|
|
676
|
+
`);if(b.length){let j=b[b.length-1].match(/^\s+/);if(j)return j[0]}return""}function $e(f){return()=>{if(f.extAttrs.length){let b=new dt("Exposed=Window,"),j=h.parse(b);j.tokens.separator=b.consume(",");let k=f.extAttrs[0];/^\s/.test(k.tokens.name.trivia)||(k.tokens.name.trivia=` ${k.tokens.name.trivia}`),f.extAttrs.unshift(j)}else{q(f).extAttrs=x.parse(new dt("[Exposed=Window]"));let b=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=b,f.tokens.base.trivia=`
|
|
677
|
+
${Y(b)}`}}}function me(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return me(f.idlType);return Object.values(f.tokens).sort((b,j)=>b.index-j.index)[0]}function q(f,b){if(b||(b=f),!f)return f;return new Proxy(f,{get(j,k){let N=j[k];return Array.isArray(N)&&k!=="source"?q(N,j):N},set(j,k,N){if(j[k]=N,!N)return!0;if(Array.isArray(N))for(let ee of N)ee.parent!==void 0&&(ee.parent=b);else N.parent!==void 0&&(N.parent=b);return!0}})}let Q={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},pe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Ke=["ByteString","DOMString","USVString"],re=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],Mt=["-Infinity","FrozenArray","Infinity","NaN","ObservableArray","Promise","async_iterable","async_sequence","bigint","boolean","byte","double","false","float","long","mixin","null","octet","optional","or","readonly","record","sequence","short","true","undefined","unsigned","void"].concat(re,Ke,pe),Ot=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],ft=["_constructor","toString","_toString"];class dt{constructor(f){this.source=function(b){let j=[],k=0,N="",ee=1,se=0;for(;k<b.length;){let xe=b.charAt(k),Ee=-1;if(/[\t\n\r ]/.test(xe)?Ee=ge("whitespace",{noFlushTrivia:!0}):xe==="/"&&(Ee=ge("comment",{noFlushTrivia:!0})),Ee!==-1){let Re=j.pop().value;ee+=(Re.match(/\n/g)||[]).length,N+=Re,se-=1}else if(/[-0-9.A-Z_a-z]/.test(xe)){if(Ee=ge("decimal"),Ee===-1&&(Ee=ge("integer")),Ee===-1){Ee=ge("identifier");let Re=j.length-1,Ie=j[Re];if(Ee!==-1){if(ft.includes(Ie.value)){let _t=`${A(Ie.value)} is a reserved identifier and must not be used.`;throw new kt(r(j,Re,null,_t))}Mt.includes(Ie.value)&&(Ie.type="inline")}}}else xe==='"'&&(Ee=ge("string"));for(let Re of Ot)if(b.startsWith(Re,k)){j.push({type:"inline",value:Re,trivia:N,line:ee,index:se}),N="",k+=Re.length,Ee=k;break}if(Ee===-1&&(Ee=ge("other")),Ee===-1)throw Error("Token stream not progressing");k=Ee,se+=1}return j.push({type:"eof",value:"",trivia:N,line:ee,index:se}),j;function ge(xe,{noFlushTrivia:Ee}={}){let Re=Q[xe];Re.lastIndex=k;let Ie=Re.exec(b);return Ie?(j.push({type:xe,value:Ie[0],trivia:N,line:ee,index:se}),Ee||(N=""),Re.lastIndex):-1}}(f),this.position=0}error(f){throw new kt(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 b of f){if(!this.probeKind(b))continue;let j=this.source[this.position];return this.position++,j}}consume(...f){if(!this.probeKind("inline"))return;let b=this.source[this.position];for(let j of f)if(b.value===j)return this.position++,b}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class kt extends Error{constructor({message:f,bareMessage:b,context:j,line:k,sourceName:N,input:ee,tokens:se}){super(f),this.name="WebIDLParseError",this.bareMessage=b,this.context=j,this.line=k,this.sourceName=N,this.input=ee,this.tokens=se}}class Xt extends c{static parse(f){let b=f.consumeKind("string");if(b)return new Xt({source:f.source,tokens:{value:b}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:b}=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:b}),'"']),{data:this,parent:b}),f.token(this.tokens.separator)])}}class kn extends o{static parse(f){let b={};if(b.base=f.consume("enum"),!b.base)return;b.name=f.consumeKind("identifier")||f.error("No name for enum");let j=q(new kn({source:f.source,tokens:b}));return f.current=j.this,b.open=f.consume("{")||f.error("Bodyless enum"),j.values=L(f,{parser:Xt.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),b.close=f.consume("}")||f.error("Unexpected value in enum"),j.values.length||f.error("No value in enum"),b.termination=f.consume(";")||f.error("No semicolon after enum"),j.this}get type(){return"enum"}get name(){return A(this.tokens.name.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.open),f.ts.wrap(this.values.map((b)=>b.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class $s extends o{static parse(f){let b=f.consumeKind("identifier");if(!b)return;let j={target:b};if(j.includes=f.consume("includes"),j.includes)return j.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),j.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new $s({source:f.source,tokens:j});f.unconsume(b.index)}get type(){return"includes"}get target(){return A(this.tokens.target.value)}get includes(){return A(this.tokens.mixin.value)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.reference_token(this.tokens.target,this),f.token(this.tokens.includes),f.reference_token(this.tokens.mixin,this),f.token(this.tokens.termination)]),{data:this})}}class it extends o{static parse(f){let b={},j=q(new it({source:f.source,tokens:b}));if(b.base=f.consume("typedef"),b.base)return j.idlType=Z(f,"typedef-type")||f.error("Typedef lacks a type"),b.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=j.this,b.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),j.this}get type(){return"typedef"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.idlType.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base),f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this}),f.token(this.tokens.termination)]),{data:this})}}class Be extends o{static parse(f,b){let j={base:b},k=q(new Be({source:f.source,tokens:j}));return j.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=k.this,j.assign=f.consume("=")||f.error("Callback lacks an assignment"),k.idlType=le(f)||f.error("Callback lacks a return type"),j.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),k.arguments=U(f),j.close=f.consume(")")||f.error("Unterminated callback"),j.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),k.this}get type(){return"callback"}get name(){return A(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let b of this.arguments)if(yield*b.validate(f),b.idlType.generic==="async_sequence")yield s(b.tokens.name,b,"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((b)=>b.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class qt extends o{static parse(f,b,{inheritable:j,allowedMembers:k}){let{tokens:N,type:ee}=b;for(N.name=f.consumeKind("identifier")||f.error(`Missing name in ${ee}`),f.current=b,b=q(b),j&&Object.assign(N,function(se){let ge=se.consume(":");return ge?{colon:ge,inheritance:se.consumeKind("identifier")||se.error("Inheritance lacks a type")}:{}}(f)),N.open=f.consume("{")||f.error(`Bodyless ${ee}`),b.members=[];;){if(N.close=f.consume("}"),N.close)return N.termination=f.consume(";")||f.error(`Missing semicolon after ${ee}`),b.this;let se=x.parse(f),ge;for(let[xe,...Ee]of k)if(ge=q(xe(f,...Ee)),ge)break;ge||f.error("Unknown member"),ge.extAttrs=se,b.members.push(ge.this)}}get partial(){return!!this.tokens.partial}get name(){return A(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?A(this.tokens.inheritance.value):null}*validate(f){for(let b of this.members)b.validate&&(yield*b.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((b)=>b.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class he extends o{static parse(f){let b={};if(b.base=f.consume("const"),!b.base)return;let j=B(f);if(!j){let N=f.consumeKind("identifier")||f.error("Const lacks a type");j=new v({source:f.source,tokens:{base:N}})}f.probe("?")&&f.error("Unexpected nullable constant type"),j.type="const-type",b.name=f.consumeKind("identifier")||f.error("Const lacks a name"),b.assign=f.consume("=")||f.error("Const lacks value assignment"),b.value=K(f)||f.error("Const lacks a value"),b.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let k=new he({source:f.source,tokens:b});return q(k).idlType=j,k}get type(){return"const"}get name(){return A(this.tokens.name.value)}get value(){return ne(this.tokens.value)}write(f){let{parent:b}=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:b}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:b})}}class Ss extends o{static parse(f){let b=f.position,j=q(new Ss({source:f.source,tokens:{}})),{tokens:k}=j;if(k.readonly=f.consume("readonly"),k.readonly||(k.async=f.consume("async")),k.base=k.readonly?f.consume("maplike","setlike"):k.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!k.base)return void f.unconsume(b);let{type:N}=j,ee=N==="maplike",se=ee||N==="iterable"||N==="async_iterable",ge=N==="async_iterable"||j.async&&N==="iterable";k.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${N} declaration`);let xe=Z(f)||f.error(`Missing a type argument in ${N} declaration`);return j.idlType=[xe],j.arguments=[],se&&(xe.tokens.separator=f.consume(","),xe.tokens.separator?j.idlType.push(Z(f)):ee&&f.error(`Missing second type argument in ${N} declaration`)),k.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${N} declaration`),f.probe("(")&&(ge?(k.argsOpen=f.consume("("),j.arguments.push(...U(f)),k.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),k.termination=f.consume(";")||f.error(`Missing semicolon after ${N} declaration`),j.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(b=this,()=>{let k=b.tokens.async;b.tokens.base={...k,type:"async_iterable",value:"async_iterable"},delete b.tokens.async})});var b;for(let j of this.idlType)yield*j.validate(f);for(let j of this.arguments)yield*j.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((b)=>b.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((b)=>b.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Ht extends o{static parse(f){let b=f.consume("constructor");if(!b)return;let j={base:b};j.open=f.consume("(")||f.error("No argument list in constructor");let k=U(f);j.close=f.consume(")")||f.error("Unterminated constructor"),j.termination=f.consume(";")||f.error("No semicolon after constructor");let N=new Ht({source:f.source,tokens:j});return q(N).arguments=k,N}get type(){return"constructor"}*validate(f){for(let b of this.arguments)yield*b.validate(f)}write(f){let{parent:b}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:b}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((j)=>j.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:b})}}function xt(f){let b=f.consume("static");if(!b)return;return D.parse(f,{special:b})||J.parse(f,{special:b})||f.error("No body in static member")}class Yt extends qt{static parse(f,b,{extMembers:j=[],partial:k=null}={}){let N={partial:k,base:b};return qt.parse(f,new Yt({source:f.source,tokens:N}),{inheritable:!k,allowedMembers:[...j,[he.parse],[Ht.parse],[xt],[we],[Ss.parse],[D.parse],[J.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((j)=>j.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:$e(this)});let b=this.extAttrs.filter((j)=>j.name==="Constructor");for(let j of b)yield s(j.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:gl(this,j)});if(this.extAttrs.some((j)=>j.name==="Global")){let j=this.extAttrs.filter((N)=>N.name==="LegacyFactoryFunction");for(let N of j)yield s(N.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let k=this.members.filter((N)=>N.type==="constructor");for(let N of k)yield s(N.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(j,k){let N=function(Ee){let Re=xe(Ee);return{statics:new Set(Re.filter((Ie)=>Ie.special==="static").map((Ie)=>Ie.name)),nonstatics:new Set(Re.filter((Ie)=>Ie.special!=="static").map((Ie)=>Ie.name))}}(k),ee=j.partials.get(k.name)||[],se=j.mixinMap.get(k.name)||[];for(let Ee of[...ee,...se]){let Re=xe(Ee),Ie=Re.filter((Wt)=>Wt.special==="static"),_t=Re.filter((Wt)=>Wt.special!=="static");yield*ge(Ie,N.statics,Ee,k),yield*ge(_t,N.nonstatics,Ee,k),Ie.forEach((Wt)=>N.statics.add(Wt.name)),_t.forEach((Wt)=>N.nonstatics.add(Wt.name))}function*ge(Ee,Re,Ie,_t){for(let Wt of Ee){let{name:_}=Wt;if(_&&Re.has(_)){let W=`The ${Wt.special==="static"?"static ":""}operation "${_}" has already been defined for the base interface "${_t.name}" either in itself or in a mixin`;yield s(Wt.tokens.name,Ie,"no-cross-overload",W)}}}function xe(Ee){return Ee.members.filter(({type:Re})=>Re==="operation")}}(f,this))}}function gl(f,b){return f=q(f),()=>{let j=Y(f.extAttrs.tokens.open.trivia),k=f.members.length?Y(me(f.members[0]).trivia):function(Re){let Ie=Y(Re),_t=Ie.includes("\t")?"\t":" ";return Ie+_t}(j),N=Ht.parse(new dt(`
|
|
678
|
+
${k}constructor();`));N.extAttrs=new x({source:f.source,tokens:{}}),q(N).arguments=b.arguments;let ee=function(Re,Ie){let _t=Re.slice().reverse().findIndex(Ie);return _t===-1?_t:Re.length-_t-1}(f.members,(Re)=>Re.type==="constructor");f.members.splice(ee+1,0,N);let{close:se}=f.tokens;se.trivia.includes(`
|
|
679
|
+
`)||(se.trivia+=`
|
|
680
|
+
${j}`);let{extAttrs:ge}=f,xe=ge.indexOf(b),Ee=ge.splice(xe,1);ge.length?ge.length===xe?ge[xe-1].tokens.separator=void 0:ge[xe].tokens.name.trivia.trim()||(ge[xe].tokens.name.trivia=Ee[0].tokens.name.trivia):ge.tokens.open=ge.tokens.close=void 0}}class Ws extends qt{static parse(f,b,{extMembers:j=[],partial:k}={}){let N={partial:k,base:b};if(N.mixin=f.consume("mixin"),N.mixin)return qt.parse(f,new Ws({source:f.source,tokens:N}),{allowedMembers:[...j,[he.parse],[we],[D.parse,{noInherit:!0}],[J.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class Vo extends o{static parse(f){let b={},j=q(new Vo({source:f.source,tokens:b}));return j.extAttrs=x.parse(f),b.required=f.consume("required"),j.idlType=Z(f,"dictionary-type")||f.error("Dictionary member lacks a type"),b.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),j.default=w.parse(f),b.required&&j.default&&f.error("Required member must not have a default"),b.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),j.this}get type(){return"field"}get name(){return A(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:b}=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:b}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:b})}}class sr extends qt{static parse(f,{extMembers:b=[],partial:j}={}){let k={partial:j};if(k.base=f.consume("dictionary"),k.base)return qt.parse(f,new sr({source:f.source,tokens:k}),{inheritable:!j,allowedMembers:[...b,[Vo.parse]]})}get type(){return"dictionary"}}class Bs extends qt{static parse(f,{extMembers:b=[],partial:j}={}){let k={partial:j};if(k.base=f.consume("namespace"),k.base)return qt.parse(f,new Bs({source:f.source,tokens:k}),{allowedMembers:[...b,[D.parse,{noInherit:!0,readonly:!0}],[he.parse],[J.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((b)=>b.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:$e(this)});yield*super.validate(f)}}class Un extends qt{static parse(f,b,{extMembers:j=[]}={}){let k={callback:b};if(k.base=f.consume("interface"),k.base)return qt.parse(f,new Un({source:f.source,tokens:k}),{allowedMembers:[...j,[he.parse],[J.parse,{regular:!0}]]})}get type(){return"callback interface"}}function yl(f,b){let j=f.source;function k(xe){f.error(xe)}function N(...xe){return f.consume(...xe)}function ee(xe){let Ee=N("interface");if(Ee)return Ws.parse(f,Ee,{...xe,...b?.extensions?.mixin})||Yt.parse(f,Ee,{...xe,...b?.extensions?.interface})||k("Interface has no proper body")}function se(){if(b.productions)for(let xe of b.productions){let Ee=xe(f);if(Ee)return Ee}return function(){let xe=N("callback");if(xe)return f.probe("interface")?Un.parse(f,xe,{...b?.extensions?.callbackInterface}):Be.parse(f,xe)}()||ee()||function(){let xe=N("partial");if(xe)return sr.parse(f,{partial:xe,...b?.extensions?.dictionary})||ee({partial:xe})||Bs.parse(f,{partial:xe,...b?.extensions?.namespace})||k("Partial doesn't apply to anything")}()||sr.parse(f,b?.extensions?.dictionary)||kn.parse(f)||it.parse(f)||$s.parse(f)||Bs.parse(f,b?.extensions?.namespace)}let ge=function(){if(!j.length)return[];let xe=[];for(;;){let Re=x.parse(f),Ie=se();if(!Ie){Re.length&&k("Stray extended attributes");break}q(Ie).extAttrs=Re,xe.push(Ie)}let Ee=u.parse(f);return b.concrete&&xe.push(Ee),xe}();return f.position<j.length&&k("Unrecognised tokens"),ge}function Ri(f,b={}){let j=new dt(f);return b.sourceName!==void 0&&(j.source.name=b.sourceName),yl(j,b)}function zn(f){return f}let Ti={wrap:(f)=>f.join(""),trivia:zn,name:zn,reference:zn,type:zn,generic:zn,nameless:zn,inheritance:zn,definition:zn,extendedAttribute:zn,extendedAttributeReference:zn};class ku{constructor(f){this.ts=Object.assign({},Ti,f)}reference(f,{unescaped:b,context:j}){return b||(b=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,b,j)}token(f,b=zn,...j){if(!f)return"";let k=b(f.value,...j);return this.ts.wrap([this.ts.trivia(f.trivia),k])}reference_token(f,b){return this.token(f,this.reference.bind(this),{context:b})}name_token(f,b){return this.token(f,this.ts.name,b)}identifier(f,b){return this.ts.wrap([this.reference_token(f.tokens.value,b),this.token(f.tokens.separator)])}}function Us(f,{templates:b=Ti}={}){b=Object.assign({},Ti,b);let j=new ku(b);return b.wrap(f.map((k)=>k.write(j)))}function zs(f,b){let j=new Map,k=f.filter((N)=>N.type==="includes");for(let N of k){let ee=b.get(N.includes);if(!ee)continue;let se=j.get(N.target);se?se.push(ee):j.set(N.target,[ee])}return j}function*Ks(f){let b=function(j){let k=new Map,N=new Set,ee=new Map;for(let se of j)if(se.partial){let ge=ee.get(se.name);ge?ge.push(se):ee.set(se.name,[se])}else se.name&&(k.has(se.name)?N.add(se):k.set(se.name,se));return{all:j,unique:k,partials:ee,duplicates:N,mixinMap:zs(j,k),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let j of b.all)j.validate&&(yield*j.validate(b));yield*function*({unique:j,duplicates:k}){for(let N of k){let{name:ee}=N,se=`The name "${ee}" of type "${j.get(ee).type}" was already seen`;yield s(N.tokens.name,N,"no-duplicate",se)}}(b)}function xl(f){return[...Ks((b=f,b.flat?b.flat():[].concat(...b)))];var b}return t})())});var z_=G(function(ele,U_){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",q_=bt("fs").promises,Vp=bt("path"),H_=V_();class W_{constructor(e,t){this.filename=t,this.shortname=Vp.basename(t,".idl"),this.path=Vp.join(e,t)}async text(){return await q_.readFile(this.path,"utf8")}async parse(){let e=await this.text();return H_.parse(e)}}async function B_({folder:e=__dirname}={}){let t={},n=await q_.readdir(e);for(let r of n)if(r.endsWith(".idl")){let s=new W_(e,r);t[s.shortname]=s}return t}async function XB(e){let t=await B_(e);for(let[n,r]of Object.entries(t))t[n]=await r.parse();return t}U_.exports={listAll:B_,parseAll:XB}});function YB(){return K_??=ZB(),K_}async function ZB(){let[e,t,n]=await Promise.all([X_.listAll(),Y_.default.listAll(),Z_.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 QB(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 eU(e){let t={...Ll.properties};for(let n of e)t[n]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function tU(){let{tagExamples:e,cssProps:t,eventHandlers:n}=await YB();return{$defs:{DefsMap:Gg,TypeDefEntry:Xg,StateMap:Kg,StateEntry:zg,TypedStateDef:jg,PureTypeDef:Mg,FunctionDef:kg,ClassDef:Zg,ClassParameterDef:vf,ClassFieldDef:Ef,ClassConstructorDef:Pf,ClassMethodDef:jf,FormatDef:Of,ProjectBlockDef:kf,ServerBlockDef:_f,ConnectorBlockDef:Af,StudioHints:Cf,ExternalClassDef:Jg,ExpressionPointer:Vg,ExpressionLiteral:qg,ExpressionOperand:Hg,UnaryOperator:Fl,BinaryOperator:Vl,ConditionalOperator:ql,SwitchOperator:Hl,CallOperator:Wl,PureMethod:Bl,AssignmentOperator:Qo,NoArgMethod:ei,OneArgMethod:ti,SpliceMethod:ni,ReduceMethod:Ul,MapFilterMethod:zl,ExpressionNode:Wg,PureExpressionNode:Bg,ExpressionEntry:Ug,Statement:Ag,StatementList:Cg,ElementDef:{...wf,properties:{...wf.properties,...QB(n)}},ChildrenValue:xg,ArrayNamespace:yg,SwitchDef:vg,SwitchNode:Eg,StyleObject:{...Ll,properties:eU(t)},AttributesObject:$g,PropsObject:Sg,RefObject:pg,AnyRef:dg,InternalRef:ig,StateRef:ag,ExternalRef:lg,ExternalComponentRef:mg,GlobalRef:cg,ParentRef:ug,MapRef:fg,ElementPropertyValue:wg,StringOrRef:Kh,BoolOrRef:Gh,NumberOrRef:Xh,CemParameter:eg,CemEvent:tg,TagName:{...Uh,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:Hh,ElementTagName:Wh,JsonSchemaType:sg,HeadEntry:Zh,ImageConfig:Il,PathsValue:{$id:ri,anyOf:[...tc,iy],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:ri,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 nU(){return{$defs:{ImageConfig:Il,StyleObject:Q_},$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:Jf.properties,title:"Jx Project",type:"object"}}function rU(){return{$defs:{ImageConfig:Il,JxFieldSchema:ry,RelationshipRef:ec,StyleObject:Q_},$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:Jf.properties,title:"Jx Project Core",type:"object"}}function sU(){return{$id:Ql,$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 oU(){return{$id:ri,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...tc,iy],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 iU(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...ty}}function h$(){return{$defs:{ClassConstructorDef:Pf,ClassFieldDef:Ef,ClassMethodDef:jf,ClassParameterDef:vf,ConnectorBlockDef:Af,FormatDef:Of,ProjectBlockDef:kf,ServerBlockDef:_f,StudioHints:Cf},$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 aU(e){let{mkdirSync:t,writeFileSync:n}=await import("node:fs"),{resolve:r,dirname:s}=await import("node:path"),o=s(r(e,"..")),i=await tU(),a=nU(),l=h$(),c=rU(),u=iU(),d=sU(),p=oU(),m=JSON.stringify(i,null,2),g=JSON.stringify(a,null,2),y=JSON.stringify(l,null,2),h=JSON.stringify(c,null,2),x=JSON.stringify(u,null,2),P=JSON.stringify(d,null,2),S=JSON.stringify(p,null,2),[v]=process.argv.slice(2);if(v)n(v,m,"utf8"),console.error(`Jx component schema written to ${v}`);else{n(r(o,"schema.json"),m,"utf8"),n(r(o,"project-schema.json"),g,"utf8"),n(r(o,"class-schema.json"),y,"utf8"),t(r(o,"schemas"),{recursive:!0}),n(r(o,"schemas","project.core.schema.json"),h,"utf8"),n(r(o,"schemas","project.fields.schema.json"),P,"utf8"),n(r(o,"schemas","document.paths.schema.json"),S,"utf8"),n(r(o,"extension-manifest.schema.json"),x,"utf8");let E=Bun.spawnSync(["bunx","oxfmt",r(o,"schemas","project.core.schema.json"),r(o,"schemas","project.fields.schema.json"),r(o,"schemas","document.paths.schema.json")],{cwd:o});if(E.exitCode!==0){let w=E.stderr.toString()||E.stdout.toString()||`exit ${E.exitCode}${E.signalCode?`, signal ${E.signalCode}`:""}`;console.error(`Warning: skipped oxfmt reformat of generated schemas (${w})`)}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 X_,Y_,Z_,K_=null,Q_,G_,vle;var eA=F(()=>{Bh();zh();Yh();Qh();ng();og();hg();gg();bg();Pg();Og();_g();Rg();Ng();Dg();Kl();Yg();Qg();ny();sa();rg();ey();X_=Mr(M_(),1),Y_=Mr(F_(),1),Z_=Mr(z_(),1);Q_={...Ll,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,G_]=process.argv,vle=G_?.endsWith("schema.ts")?aU(G_):void 0});function qp(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function cU(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function tA(e,t){return e!==void 0&&Object.hasOwn(e,t)}function uU(e,t,n){if(!e.startsWith(g$))return null;let[r="",...s]=e.slice(g$.length).split("/").map((l)=>cU(l));if(r==="")return null;let o,i;if(tA(t,r))o="document",i=t;else if(tA(n,r))o="project",i=n;else return null;let a=i[r]??null;for(let l of s)if(Array.isArray(a)){if(!lU.test(l)||Number(l)>=a.length)return null;a=a[Number(l)]??null}else if(M(a)&&Object.hasOwn(a,l))a=a[l]??null;else return null;return{name:r,schema:a,scope:o}}function nA(e,t=""){let n=[],r=(s,o)=>{if(!M(s))return;let i=s.$ref;if(O(i)&&i.startsWith(g$))n.push({at:`${o}/$ref`,ref:i});for(let[a,l]of Object.entries(s)){if(!y$.has(a))continue;let c=`${o}/${qp(a)}`;if(Array.isArray(l))for(let[u,d]of l.entries())r(d,`${c}/${u}`);else if(Hp.has(a)){if(M(l))for(let[u,d]of Object.entries(l))r(d,`${c}/${qp(u)}`)}else r(l,c)}};return r(e,t),n}function x$(e,t){let n=[];if(M(e.state)){for(let[r,s]of Object.entries(e.state))if(M(s)&&M(s.type))n.push(...nA(s.type,`/state/${qp(r)}/type`))}if(M(e.$defs)){for(let[r,s]of Object.entries(e.$defs))if(M(s)&&!Object.hasOwn(s,"$prototype"))n.push(...nA(s,`/$defs/${qp(r)}`))}return n.filter(({ref:r})=>uU(r,M(e.$defs)?e.$defs:void 0,t)===null)}var g$="#/$defs/",Hp,y$,lU;var rA=F(()=>{ae();Hp=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),y$=new Set([...Hp,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"]),lU=/^(?:0|[1-9]\d*)$/});var pu=G(function(iA){Object.defineProperty(iA,"__esModule",{value:!0});iA.regexpCode=iA.getEsmExportName=iA.getProperty=iA.safeStringify=iA.stringify=iA.strConcat=iA.addCodeArg=iA.str=iA._=iA.nil=iA._Code=iA.Name=iA.IDENTIFIER=iA._CodeOrName=void 0;class Wp{}iA._CodeOrName=Wp;iA.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class qa extends Wp{constructor(e){super();if(!iA.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}}}iA.Name=qa;class Nr extends Wp{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 qa)t[n.str]=(t[n.str]||0)+1;return t},{})}}iA._Code=Nr;iA.nil=new Nr("");function sA(e,...t){let n=[e[0]],r=0;while(r<t.length)$$(n,t[r]),n.push(e[++r]);return new Nr(n)}iA._=sA;var b$=new Nr("+");function oA(e,...t){let n=[du(e[0])],r=0;while(r<t.length)n.push(b$),$$(n,t[r]),n.push(b$,du(e[++r]));return fU(n),new Nr(n)}iA.str=oA;function $$(e,t){if(t instanceof Nr)e.push(...t._items);else if(t instanceof qa)e.push(t);else e.push(mU(t))}iA.addCodeArg=$$;function fU(e){let t=1;while(t<e.length-1){if(e[t]===b$){let n=dU(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]="+"}t++}}function dU(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof qa||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 qa))return`"${e}${t.slice(1)}`;return}function pU(e,t){return t.emptyStr()?e:e.emptyStr()?t:oA`${e}${t}`}iA.strConcat=pU;function mU(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:du(Array.isArray(e)?e.join(","):e)}function hU(e){return new Nr(du(e))}iA.stringify=hU;function du(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}iA.safeStringify=du;function gU(e){return typeof e=="string"&&iA.IDENTIFIER.test(e)?new Nr(`.${e}`):sA`[${e}]`}iA.getProperty=gU;function yU(e){if(typeof e=="string"&&iA.IDENTIFIER.test(e))return new Nr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}iA.getEsmExportName=yU;function xU(e){return new Nr(e.toString())}iA.regexpCode=xU});var E$=G(function(uA){Object.defineProperty(uA,"__esModule",{value:!0});uA.ValueScope=uA.ValueScopeName=uA.Scope=uA.varKinds=uA.UsedValueState=void 0;var Qe=pu();class lA extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Up;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Up||(uA.UsedValueState=Up={}));uA.varKinds={const:new Qe.Name("const"),let:new Qe.Name("let"),var:new Qe.Name("var")};class w${constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Qe.Name?e:this.name(e)}name(e){return new Qe.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}}}uA.Scope=w$;class v$ extends Qe.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:n}){this.value=e,this.scopePath=Qe._`.${new Qe.Name(t)}[${n}]`}}uA.ValueScopeName=v$;var CU=Qe._`\n`;class cA extends w${constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?CU:Qe.nil}}get(){return this._scope}name(e){return new v$(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 Qe._`${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=Qe.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,Up.Started);let c=t(l);if(c){let u=this.opts.es5?uA.varKinds.var:uA.varKinds.const;s=Qe._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=r===null||r===void 0?void 0:r(l))s=Qe._`${s}${c}${this.opts._n}`;else throw new lA(l);a.set(l,Up.Completed)})}return s}}uA.ValueScope=cA});var je=G(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 oe=pu(),wt=E$(),So=pu();Object.defineProperty(Ln,"_",{enumerable:!0,get:function(){return So._}});Object.defineProperty(Ln,"str",{enumerable:!0,get:function(){return So.str}});Object.defineProperty(Ln,"strConcat",{enumerable:!0,get:function(){return So.strConcat}});Object.defineProperty(Ln,"nil",{enumerable:!0,get:function(){return So.nil}});Object.defineProperty(Ln,"getProperty",{enumerable:!0,get:function(){return So.getProperty}});Object.defineProperty(Ln,"stringify",{enumerable:!0,get:function(){return So.stringify}});Object.defineProperty(Ln,"regexpCode",{enumerable:!0,get:function(){return So.regexpCode}});Object.defineProperty(Ln,"Name",{enumerable:!0,get:function(){return So.Name}});var Zp=E$();Object.defineProperty(Ln,"Scope",{enumerable:!0,get:function(){return Zp.Scope}});Object.defineProperty(Ln,"ValueScope",{enumerable:!0,get:function(){return Zp.ValueScope}});Object.defineProperty(Ln,"ValueScopeName",{enumerable:!0,get:function(){return Zp.ValueScopeName}});Object.defineProperty(Ln,"varKinds",{enumerable:!0,get:function(){return Zp.varKinds}});Ln.operators={GT:new oe._Code(">"),GTE:new oe._Code(">="),LT:new oe._Code("<"),LTE:new oe._Code("<="),EQ:new oe._Code("==="),NEQ:new oe._Code("!=="),NOT:new oe._Code("!"),OR:new oe._Code("||"),AND:new oe._Code("&&"),ADD:new oe._Code("+")};class wo{optimizeNodes(){return this}optimizeNames(e,t){return this}}class dA extends wo{constructor(e,t,n){super();this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let n=e?wt.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=Wa(this.rhs,e,t);return this}get names(){return this.rhs instanceof oe._CodeOrName?this.rhs.names:{}}}class O$ extends wo{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 oe.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Wa(this.rhs,e,t),this}get names(){let e=this.lhs instanceof oe.Name?{}:{...this.lhs.names};return Yp(e,this.rhs)}}class pA extends O${constructor(e,t,n,r){super(e,n,r);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class mA extends wo{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class hA extends wo{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class gA extends wo{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class yA extends wo{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=Wa(this.code,e,t),this}get names(){return this.code instanceof oe._CodeOrName?this.code.names:{}}}class Qp extends wo{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;NU(e,s.names),n.splice(r,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>ji(e,t.names),{})}}class vo extends Qp{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class xA extends Qp{}class mu extends vo{}mu.kind="else";class qs extends vo{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 mu(n):n}if(t){if(e===!1)return t instanceof qs?t:t.nodes;if(this.nodes.length)return this;return new qs(vA(e),t instanceof qs?[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=Wa(this.condition,e,t),this}get names(){let e=super.names;if(Yp(e,this.condition),this.else)ji(e,this.else.names);return e}}qs.kind="if";class Ha extends vo{}Ha.kind="for";class bA extends Ha{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=Wa(this.iteration,e,t),this}get names(){return ji(super.names,this.iteration.names)}}class $A extends Ha{constructor(e,t,n,r){super();this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?wt.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=Yp(super.names,this.from);return Yp(e,this.to)}}class P$ extends Ha{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=Wa(this.iterable,e,t),this}get names(){return ji(super.names,this.iterable.names)}}class zp extends vo{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)}}zp.kind="func";class Kp extends Qp{render(e){return"return "+super.render(e)}}Kp.kind="return";class SA extends vo{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)ji(e,this.catch.names);if(this.finally)ji(e,this.finally.names);return e}}class Gp extends vo{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Gp.kind="catch";class Xp extends vo{render(e){return"finally"+super.render(e)}}Xp.kind="finally";class wA{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
681
|
+
`:""},this._extScope=e,this._scope=new wt.Scope({parent:e}),this._nodes=[new xA]}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 dA(e,s,n)),s}const(e,t,n){return this._def(wt.varKinds.const,e,t,n)}let(e,t,n){return this._def(wt.varKinds.let,e,t,n)}var(e,t,n){return this._def(wt.varKinds.var,e,t,n)}assign(e,t,n){return this._leafNode(new O$(e,t,n))}add(e,t){return this._leafNode(new pA(e,Ln.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==oe.nil)this._leafNode(new yA(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(":"),oe.addCodeArg(t,r)}return t.push("}"),new oe._Code(t)}if(e,t,n){if(this._blockNode(new qs(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 qs(e))}else(){return this._elseNode(new mu)}endIf(){return this._endBlockNode(qs,mu)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new bA(e),t)}forRange(e,t,n,r,s=this.opts.es5?wt.varKinds.var:wt.varKinds.let){let o=this._scope.toName(e);return this._for(new $A(s,o,t,n),()=>r(o))}forOf(e,t,n,r=wt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=t instanceof oe.Name?t:this.var("_arr",t);return this.forRange("_i",0,oe._`${o}.length`,(i)=>{this.var(s,oe._`${o}[${i}]`),n(s)})}return this._for(new P$("of",r,s,t),()=>n(s))}forIn(e,t,n,r=this.opts.es5?wt.varKinds.var:wt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,oe._`Object.keys(${t})`,n);let s=this._scope.toName(e);return this._for(new P$("in",r,s,t),()=>n(s))}endFor(){return this._endBlockNode(Ha)}label(e){return this._leafNode(new mA(e))}break(e){return this._leafNode(new hA(e))}return(e){let t=new Kp;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Kp)}try(e,t,n){if(!t&&!n)throw Error('CodeGen: "try" without "catch" and "finally"');let r=new SA;if(this._blockNode(r),this.code(e),t){let s=this.name("e");this._currNode=r.catch=new Gp(s),t(s)}if(n)this._currNode=r.finally=new Xp,this.code(n);return this._endBlockNode(Gp,Xp)}throw(e){return this._leafNode(new gA(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=oe.nil,n,r){if(this._blockNode(new zp(e,t,n)),r)this.code(r).endFunc();return this}endFunc(){return this._endBlockNode(zp)}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 qs))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=wA;function ji(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function Yp(e,t){return t instanceof oe._CodeOrName?ji(e,t.names):e}function Wa(e,t,n){if(e instanceof oe.Name)return r(e);if(!s(e))return e;return new oe._Code(e._items.reduce((o,i)=>{if(i instanceof oe.Name)i=r(i);if(i instanceof oe._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 oe._Code&&o._items.some((i)=>i instanceof oe.Name&&t[i.str]===1&&n[i.str]!==void 0)}}function NU(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function vA(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:oe._`!${j$(e)}`}Ln.not=vA;var MU=EA(Ln.operators.AND);function DU(...e){return e.reduce(MU)}Ln.and=DU;var IU=EA(Ln.operators.OR);function LU(...e){return e.reduce(IU)}Ln.or=LU;function EA(e){return(t,n)=>t===oe.nil?n:n===oe.nil?t:oe._`${j$(t)} ${e} ${j$(n)}`}function j$(e){return e instanceof oe.Name?e:oe._`(${e})`}});var Me=G(function(JA){Object.defineProperty(JA,"__esModule",{value:!0});JA.checkStrictMode=JA.getErrorPath=JA.Type=JA.useFunc=JA.setEvaluated=JA.evaluatedPropsToName=JA.mergeEvaluated=JA.eachItem=JA.unescapeJsonPointer=JA.escapeJsonPointer=JA.escapeFragment=JA.unescapeFragment=JA.schemaRefOrVal=JA.schemaHasRulesButRef=JA.schemaHasRules=JA.checkUnknownRules=JA.alwaysValidSchema=JA.toHash=void 0;var be=je(),kA=pu();function HU(e){let t={};for(let n of e)t[n]=!0;return t}JA.toHash=HU;function WU(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return _A(e,t),!AA(t,e.self.RULES.all)}JA.alwaysValidSchema=WU;function _A(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])TA(e,`unknown keyword: "${o}"`)}JA.checkUnknownRules=_A;function AA(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(t[n])return!0;return!1}JA.schemaHasRules=AA;function BU(e,t){if(typeof e=="boolean")return!e;for(let n in e)if(n!=="$ref"&&t.all[n])return!0;return!1}JA.schemaHasRulesButRef=BU;function UU({topSchemaRef:e,schemaPath:t},n,r,s){if(!s){if(typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="string")return be._`${n}`}return be._`${e}${t}${be.getProperty(r)}`}JA.schemaRefOrVal=UU;function zU(e){return CA(decodeURIComponent(e))}JA.unescapeFragment=zU;function KU(e){return encodeURIComponent(_$(e))}JA.escapeFragment=KU;function _$(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}JA.escapeJsonPointer=_$;function CA(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}JA.unescapeJsonPointer=CA;function GU(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}JA.eachItem=GU;function jA({mergeNames:e,mergeToName:t,mergeValues:n,resultToName:r}){return(s,o,i,a)=>{let l=i===void 0?o:i instanceof be.Name?(o instanceof be.Name?e(s,o,i):t(s,o,i),i):o instanceof be.Name?(t(s,i,o),o):n(o,i);return a===be.Name&&!(l instanceof be.Name)?r(s,l):l}}JA.mergeEvaluated={props:jA({mergeNames:(e,t,n)=>e.if(be._`${n} !== true && ${t} !== undefined`,()=>{e.if(be._`${t} === true`,()=>e.assign(n,!0),()=>e.assign(n,be._`${n} || {}`).code(be._`Object.assign(${n}, ${t})`))}),mergeToName:(e,t,n)=>e.if(be._`${n} !== true`,()=>{if(t===!0)e.assign(n,!0);else e.assign(n,be._`${n} || {}`),A$(e,n,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:RA}),items:jA({mergeNames:(e,t,n)=>e.if(be._`${n} !== true && ${t} !== undefined`,()=>e.assign(n,be._`${t} === true ? true : ${n} > ${t} ? ${n} : ${t}`)),mergeToName:(e,t,n)=>e.if(be._`${n} !== true`,()=>e.assign(n,t===!0?!0:be._`${n} > ${t} ? ${n} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function RA(e,t){if(t===!0)return e.var("props",!0);let n=e.var("props",be._`{}`);if(t!==void 0)A$(e,n,t);return n}JA.evaluatedPropsToName=RA;function A$(e,t,n){Object.keys(n).forEach((r)=>e.assign(be._`${t}${be.getProperty(r)}`,!0))}JA.setEvaluated=A$;var OA={};function XU(e,t){return e.scopeValue("func",{ref:t,code:OA[t.code]||(OA[t.code]=new kA._Code(t.code))})}JA.useFunc=XU;var k$;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(k$||(JA.Type=k$={}));function YU(e,t,n){if(e instanceof be.Name){let r=t===k$.Num;return n?r?be._`"[" + ${e} + "]"`:be._`"['" + ${e} + "']"`:r?be._`"/" + ${e}`:be._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?be.getProperty(e).toString():"/"+_$(e)}JA.getErrorPath=YU;function TA(e,t,n=e.opts.strictSchema){if(!n)return;if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}JA.checkStrictMode=TA});var gr=G(function(MA){Object.defineProperty(MA,"__esModule",{value:!0});var Ue=je(),hz={data:new Ue.Name("data"),valCxt:new Ue.Name("valCxt"),instancePath:new Ue.Name("instancePath"),parentData:new Ue.Name("parentData"),parentDataProperty:new Ue.Name("parentDataProperty"),rootData:new Ue.Name("rootData"),dynamicAnchors:new Ue.Name("dynamicAnchors"),vErrors:new Ue.Name("vErrors"),errors:new Ue.Name("errors"),this:new Ue.Name("this"),self:new Ue.Name("self"),scope:new Ue.Name("scope"),json:new Ue.Name("json"),jsonPos:new Ue.Name("jsonPos"),jsonLen:new Ue.Name("jsonLen"),jsonPart:new Ue.Name("jsonPart")};MA.default=hz});var hu=G(function(FA){Object.defineProperty(FA,"__esModule",{value:!0});FA.extendErrors=FA.resetErrorsCount=FA.reportExtraError=FA.reportError=FA.keyword$DataError=FA.keywordError=void 0;var ie=je(),Eo=Me(),On=gr();FA.keywordError={message:({keyword:e})=>ie.str`must pass "${e}" keyword validation`};FA.keyword$DataError={message:({keyword:e,schemaType:t})=>t?ie.str`"${e}" keyword must be ${t} ($data)`:ie.str`"${e}" keyword is invalid ($data)`};function yz(e,t=FA.keywordError,n,r){let{it:s}=e,{gen:o,compositeRule:i,allErrors:a}=s,l=LA(e,t,n);if(r!==null&&r!==void 0?r:i||a)DA(o,l);else IA(s,ie._`[${l}]`)}FA.reportError=yz;function xz(e,t=FA.keywordError,n){let{it:r}=e,{gen:s,compositeRule:o,allErrors:i}=r,a=LA(e,t,n);if(DA(s,a),!(o||i))IA(r,On.default.vErrors)}FA.reportExtraError=xz;function bz(e,t){e.assign(On.default.errors,t),e.if(ie._`${On.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(ie._`${On.default.vErrors}.length`,t),()=>e.assign(On.default.vErrors,null)))}FA.resetErrorsCount=bz;function $z({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,On.default.errors,(a)=>{if(e.const(i,ie._`${On.default.vErrors}[${a}]`),e.if(ie._`${i}.instancePath === undefined`,()=>e.assign(ie._`${i}.instancePath`,ie.strConcat(On.default.instancePath,o.errorPath))),e.assign(ie._`${i}.schemaPath`,ie.str`${o.errSchemaPath}/${t}`),o.opts.verbose)e.assign(ie._`${i}.schema`,n),e.assign(ie._`${i}.data`,r)})}FA.extendErrors=$z;function DA(e,t){let n=e.const("err",t);e.if(ie._`${On.default.vErrors} === null`,()=>e.assign(On.default.vErrors,ie._`[${n}]`),ie._`${On.default.vErrors}.push(${n})`),e.code(ie._`${On.default.errors}++`)}function IA(e,t){let{gen:n,validateName:r,schemaEnv:s}=e;if(s.$async)n.throw(ie._`new ${e.ValidationError}(${t})`);else n.assign(ie._`${r}.errors`,t),n.return(!1)}var Oi={keyword:new ie.Name("keyword"),schemaPath:new ie.Name("schemaPath"),params:new ie.Name("params"),propertyName:new ie.Name("propertyName"),message:new ie.Name("message"),schema:new ie.Name("schema"),parentSchema:new ie.Name("parentSchema")};function LA(e,t,n){let{createErrors:r}=e.it;if(r===!1)return ie._`{}`;return Sz(e,t,n)}function Sz(e,t,n={}){let{gen:r,it:s}=e,o=[wz(s,n),vz(e,n)];return Ez(e,t,o),r.object(...o)}function wz({errorPath:e},{instancePath:t}){let n=t?ie.str`${e}${Eo.getErrorPath(t,Eo.Type.Str)}`:e;return[On.default.instancePath,ie.strConcat(On.default.instancePath,n)]}function vz({keyword:e,it:{errSchemaPath:t}},{schemaPath:n,parentSchema:r}){let s=r?t:ie.str`${t}/${e}`;if(n)s=ie.str`${s}${Eo.getErrorPath(n,Eo.Type.Str)}`;return[Oi.schemaPath,s]}function Ez(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([Oi.keyword,s],[Oi.params,typeof t=="function"?t(e):t||ie._`{}`]),l.messages)r.push([Oi.message,typeof n=="function"?n(e):n]);if(l.verbose)r.push([Oi.schema,i],[Oi.parentSchema,ie._`${u}${d}`],[On.default.data,o]);if(c)r.push([Oi.propertyName,c])}});var zA=G(function(BA){Object.defineProperty(BA,"__esModule",{value:!0});BA.boolOrEmptySchema=BA.topBoolOrEmptySchema=void 0;var qA=hu(),HA=je(),_z=gr(),Az={message:"boolean schema is false"};function Cz(e){let{gen:t,schema:n,validateName:r}=e;if(n===!1)WA(e,!1);else if(typeof n=="object"&&n.$async===!0)t.return(_z.default.data);else t.assign(HA._`${r}.errors`,null),t.return(!0)}BA.topBoolOrEmptySchema=Cz;function Rz(e,t){let{gen:n,schema:r}=e;if(r===!1)n.var(t,!1),WA(e);else n.var(t,!0)}BA.boolOrEmptySchema=Rz;function WA(e,t){let{gen:n,data:r}=e;qA.reportError({gen:n,keyword:"false schema",data:r,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},Az,void 0,t)}});var R$=G(function(KA){Object.defineProperty(KA,"__esModule",{value:!0});KA.getRules=KA.isJSONType=void 0;var Jz=["string","number","integer","boolean","null","object","array"],Nz=new Set(Jz);function Mz(e){return typeof e=="string"&&Nz.has(e)}KA.isJSONType=Mz;function Dz(){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:{}}}KA.getRules=Dz});var T$=G(function(ZA){Object.defineProperty(ZA,"__esModule",{value:!0});ZA.shouldUseRule=ZA.shouldUseGroup=ZA.schemaHasRulesForType=void 0;function Lz({schema:e,self:t},n){let r=t.RULES.types[n];return r&&r!==!0&&XA(e,r)}ZA.schemaHasRulesForType=Lz;function XA(e,t){return t.rules.some((n)=>YA(e,n))}ZA.shouldUseGroup=XA;function YA(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))}ZA.shouldUseRule=YA});var gu=G(function(oC){Object.defineProperty(oC,"__esModule",{value:!0});oC.reportTypeError=oC.checkDataTypes=oC.checkDataType=oC.coerceAndCheckDataType=oC.getJSONTypes=oC.getSchemaTypes=oC.DataType=void 0;var eC=R$(),tC=T$(),nC=hu(),te=je(),tm=Me(),Ba;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ba||(oC.DataType=Ba={}));function qz(e){let t=rC(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}oC.getSchemaTypes=qz;function rC(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(eC.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}oC.getJSONTypes=rC;function Hz(e,t){let{gen:n,data:r,opts:s}=e,o=Wz(t,s.coerceTypes),i=t.length>0&&!(o.length===0&&t.length===1&&tC.schemaHasRulesForType(e,t[0]));if(i){let a=N$(t,r,s.strictNumbers,Ba.Wrong);n.if(a,()=>{if(o.length)Bz(e,t,o);else M$(e)})}return i}oC.coerceAndCheckDataType=Hz;var sC=new Set(["string","number","integer","boolean","null"]);function Wz(e,t){return t?e.filter((n)=>sC.has(n)||t==="array"&&n==="array"):[]}function Bz(e,t,n){let{gen:r,data:s,opts:o}=e,i=r.let("dataType",te._`typeof ${s}`),a=r.let("coerced",te._`undefined`);if(o.coerceTypes==="array")r.if(te._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>r.assign(s,te._`${s}[0]`).assign(i,te._`typeof ${s}`).if(N$(t,s,o.strictNumbers),()=>r.assign(a,s)));r.if(te._`${a} !== undefined`);for(let c of n)if(sC.has(c)||c==="array"&&o.coerceTypes==="array")l(c);r.else(),M$(e),r.endIf(),r.if(te._`${a} !== undefined`,()=>{r.assign(s,a),Uz(e,a)});function l(c){switch(c){case"string":r.elseIf(te._`${i} == "number" || ${i} == "boolean"`).assign(a,te._`"" + ${s}`).elseIf(te._`${s} === null`).assign(a,te._`""`);return;case"number":r.elseIf(te._`${i} == "boolean" || ${s} === null
|
|
682
|
+
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,te._`+${s}`);return;case"integer":r.elseIf(te._`${i} === "boolean" || ${s} === null
|
|
683
|
+
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,te._`+${s}`);return;case"boolean":r.elseIf(te._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(te._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":r.elseIf(te._`${s} === "" || ${s} === 0 || ${s} === false`),r.assign(a,null);return;case"array":r.elseIf(te._`${i} === "string" || ${i} === "number"
|
|
684
|
+
|| ${i} === "boolean" || ${s} === null`).assign(a,te._`[${s}]`)}}}function Uz({gen:e,parentData:t,parentDataProperty:n},r){e.if(te._`${t} !== undefined`,()=>e.assign(te._`${t}[${n}]`,r))}function J$(e,t,n,r=Ba.Correct){let s=r===Ba.Correct?te.operators.EQ:te.operators.NEQ,o;switch(e){case"null":return te._`${t} ${s} null`;case"array":o=te._`Array.isArray(${t})`;break;case"object":o=te._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=i(te._`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=i();break;default:return te._`typeof ${t} ${s} ${e}`}return r===Ba.Correct?o:te.not(o);function i(a=te.nil){return te.and(te._`typeof ${t} == "number"`,a,n?te._`isFinite(${t})`:te.nil)}}oC.checkDataType=J$;function N$(e,t,n,r){if(e.length===1)return J$(e[0],t,n,r);let s,o=tm.toHash(e);if(o.array&&o.object){let i=te._`typeof ${t} != "object"`;s=o.null?i:te._`!${t} || ${i}`,delete o.null,delete o.array,delete o.object}else s=te.nil;if(o.number)delete o.integer;for(let i in o)s=te.and(s,J$(i,t,n,r));return s}oC.checkDataTypes=N$;var zz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?te._`{type: ${e}}`:te._`{type: ${t}}`};function M$(e){let t=Kz(e);nC.reportError(t,zz)}oC.reportTypeError=M$;function Kz(e){let{gen:t,data:n,schema:r}=e,s=tm.schemaRefOrVal(e,r,"type");return{gen:t,keyword:"type",data:n,schema:r.type,schemaCode:s,schemaValue:s,parentSchema:r,params:{},it:e}}});var fC=G(function(cC){Object.defineProperty(cC,"__esModule",{value:!0});cC.assignDefaults=void 0;var yr=je(),lC=Me();function t8(e,t){let{properties:n,items:r}=e.schema;if(t==="object"&&n)for(let s in n)aC(e,s,n[s].default);else if(t==="array"&&Array.isArray(r))r.forEach((s,o)=>aC(e,o,s.default))}cC.assignDefaults=t8;function aC(e,t,n){let{gen:r,compositeRule:s,data:o,opts:i}=e;if(n===void 0)return;let a=yr._`${o}${yr.getProperty(t)}`;if(s){lC.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=yr._`${a} === undefined`;if(i.useDefaults==="empty")l=yr._`${l} || ${a} === null || ${a} === ""`;r.if(l,yr._`${a} = ${yr.stringify(n)}`)}});var xr=G(function(hC){Object.defineProperty(hC,"__esModule",{value:!0});hC.validateUnion=hC.validateArray=hC.usePattern=hC.callValidateCode=hC.schemaProperties=hC.allSchemaProperties=hC.noPropertyInData=hC.propertyInData=hC.isOwnProperty=hC.hasPropFunc=hC.reportMissingProp=hC.checkMissingProp=hC.checkReportMissingProp=void 0;var ve=je(),Ua=Me(),Po=gr(),dC=Me();function n8(e,t){let{gen:n,data:r,it:s}=e;n.if(I$(n,r,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:ve._`${t}`},!0),e.error()})}hC.checkReportMissingProp=n8;function r8({gen:e,data:t,it:{opts:n}},r,s){return ve.or(...r.map((o)=>ve.and(I$(e,t,o,n.ownProperties),ve._`${s} = ${o}`)))}hC.checkMissingProp=r8;function s8(e,t){e.setParams({missingProperty:t},!0),e.error()}hC.reportMissingProp=s8;function pC(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:ve._`Object.prototype.hasOwnProperty`})}hC.hasPropFunc=pC;function D$(e,t,n){return ve._`${pC(e)}.call(${t}, ${n})`}hC.isOwnProperty=D$;function o8(e,t,n,r){let s=ve._`${t}${ve.getProperty(n)} !== undefined`;return r?ve._`${s} && ${D$(e,t,n)}`:s}hC.propertyInData=o8;function I$(e,t,n,r){let s=ve._`${t}${ve.getProperty(n)} === undefined`;return r?ve.or(s,ve.not(D$(e,t,n))):s}hC.noPropertyInData=I$;function mC(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}hC.allSchemaProperties=mC;function i8(e,t){return mC(t).filter((n)=>!Ua.alwaysValidSchema(e,t[n]))}hC.schemaProperties=i8;function a8({schemaCode:e,data:t,it:{gen:n,topSchemaRef:r,schemaPath:s,errorPath:o},it:i},a,l,c){let u=c?ve._`${e}, ${t}, ${r}${s}`:t,d=[[Po.default.instancePath,ve.strConcat(Po.default.instancePath,o)],[Po.default.parentData,i.parentData],[Po.default.parentDataProperty,i.parentDataProperty],[Po.default.rootData,Po.default.rootData]];if(i.opts.dynamicRef)d.push([Po.default.dynamicAnchors,Po.default.dynamicAnchors]);let p=ve._`${u}, ${n.object(...d)}`;return l!==ve.nil?ve._`${a}.call(${l}, ${p})`:ve._`${a}(${p})`}hC.callValidateCode=a8;var l8=ve._`new RegExp`;function c8({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:ve._`${s.code==="new RegExp"?l8:dC.useFunc(e,s)}(${n}, ${r})`})}hC.usePattern=c8;function u8(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",ve._`${n}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:r,dataProp:c,dataPropType:Ua.Type.Num},o),t.if(ve.not(o),a)})}}hC.validateArray=u8;function f8(e){let{gen:t,schema:n,keyword:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(n.some((l)=>Ua.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,ve._`${i} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(ve.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}hC.validateUnion=f8});var vC=G(function(SC){Object.defineProperty(SC,"__esModule",{value:!0});SC.validateKeywordUsage=SC.validSchemaType=SC.funcKeywordCode=SC.macroKeywordCode=void 0;var Xe=je(),ki=gr(),xC=xr(),bC=hu();function E8(e,t){let{gen:n,keyword:r,schema:s,parentSchema:o,it:i}=e,a=t.macro.call(i.self,s,o,i),l=$C(n,r,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=n.name("valid");e.subschema({schema:a,schemaPath:Xe.nil,errSchemaPath:`${i.errSchemaPath}/${r}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}SC.macroKeywordCode=E8;function P8(e,t){var n;let{gen:r,keyword:s,schema:o,parentSchema:i,$data:a,it:l}=e;O8(l,t);let c=!a&&t.compile?t.compile.call(l.self,o,i,l):t.validate,u=$C(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(y(),t.modifying)yC(e);h(()=>e.error())}else{let x=t.async?m():g();if(t.modifying)yC(e);h(()=>j8(e,x))}}function m(){let x=r.let("ruleErrs",null);return r.try(()=>y(Xe._`await `),(P)=>r.assign(d,!1).if(Xe._`${P} instanceof ${l.ValidationError}`,()=>r.assign(x,Xe._`${P}.errors`),()=>r.throw(P))),x}function g(){let x=Xe._`${u}.errors`;return r.assign(x,null),y(Xe.nil),x}function y(x=t.async?Xe._`await `:Xe.nil){let P=l.opts.passContext?ki.default.this:ki.default.self,S=!(("compile"in t)&&!a||t.schema===!1);r.assign(d,Xe._`${x}${xC.callValidateCode(e,u,P,S)}`,t.modifying)}function h(x){var P;r.if(Xe.not((P=t.valid)!==null&&P!==void 0?P:d),x)}}SC.funcKeywordCode=P8;function yC(e){let{gen:t,data:n,it:r}=e;t.if(r.parentData,()=>t.assign(n,Xe._`${r.parentData}[${r.parentDataProperty}]`))}function j8(e,t){let{gen:n}=e;n.if(Xe._`Array.isArray(${t})`,()=>{n.assign(ki.default.vErrors,Xe._`${ki.default.vErrors} === null ? ${t} : ${ki.default.vErrors}.concat(${t})`).assign(ki.default.errors,Xe._`${ki.default.vErrors}.length`),bC.extendErrors(e)},()=>e.error())}function O8({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function $C(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:Xe.stringify(n)})}function k8(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")}SC.validSchemaType=k8;function _8({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)}}}SC.validateKeywordUsage=_8});var jC=G(function(EC){Object.defineProperty(EC,"__esModule",{value:!0});EC.extendSubschemaMode=EC.extendSubschemaData=EC.getSubschema=void 0;var Vt=je(),nm=Me();function T8(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:Vt._`${e.schemaPath}${Vt.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[n],schemaPath:Vt._`${e.schemaPath}${Vt.getProperty(t)}${Vt.getProperty(n)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${nm.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')}EC.getSubschema=T8;function J8(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",Vt._`${t.data}${Vt.getProperty(n)}`,!0);l(p),e.errorPath=Vt.str`${c}${nm.getErrorPath(n,r,d.jsPropertySyntax)}`,e.parentDataProperty=Vt._`${n}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Vt.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]}}EC.extendSubschemaData=J8;function N8(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}EC.extendSubschemaMode=N8});var L$=G(function(Qle,OC){OC.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 _C=G(function(ece,kC){var jo=kC.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(){};rm(t,r,s,e,"",e)};jo.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};jo.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};jo.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};jo.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 rm(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 jo.arrayKeywords)for(var p=0;p<d.length;p++)rm(e,t,n,d[p],s+"/"+u+"/"+p,o,s,u,r,p)}else if(u in jo.propsKeywords){if(d&&typeof d=="object")for(var m in d)rm(e,t,n,d[m],s+"/"+u+"/"+I8(m),o,s,u,r,m)}else if(u in jo.keywords||e.allKeys&&!(u in jo.skipKeywords))rm(e,t,n,d,s+"/"+u,o,s,u,r)}n(r,s,o,i,a,l,c)}}function I8(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var yu=G(function(JC){Object.defineProperty(JC,"__esModule",{value:!0});JC.getSchemaRefs=JC.resolveUrl=JC.normalizeId=JC._getFullPath=JC.getFullPath=JC.inlineRef=void 0;var AC=Me(),L8=L$(),F8=_C(),V8=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function q8(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!F$(e);if(!t)return!1;return CC(e)<=t}JC.inlineRef=q8;var H8=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function F$(e){for(let t in e){if(H8.has(t))return!0;let n=e[t];if(Array.isArray(n)&&n.some(F$))return!0;if(typeof n=="object"&&F$(n))return!0}return!1}function CC(e){let t=0;for(let n in e){if(n==="$ref")return 1/0;if(t++,V8.has(n))continue;if(typeof e[n]=="object")AC.eachItem(e[n],(r)=>t+=CC(r));if(t===1/0)return 1/0}return t}function RC(e,t="",n){if(n!==!1)t=za(t);let r=e.parse(t);return TC(e,r)}JC.getFullPath=RC;function TC(e,t){return e.serialize(t).split("#")[0]+"#"}JC._getFullPath=TC;var W8=/#\/?$/;function za(e){return e?e.replace(W8,""):""}JC.normalizeId=za;function B8(e,t,n){return n=za(n),e.resolve(t,n)}JC.resolveUrl=B8;var U8=/^[a-z_][-a-z0-9._]*$/i;function z8(e,t){if(typeof e=="boolean")return{};let{schemaId:n,uriResolver:r}=this.opts,s=za(e[n]||t),o={"":s},i=RC(r,s,!1),a={},l=new Set;return F8(e,{allKeys:!0},(d,p,m,g)=>{if(g===void 0)return;let y=i+p,h=o[g];if(typeof d[n]=="string")h=x.call(this,d[n]);P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),o[p]=h;function x(S){let v=this.opts.uriResolver.resolve;if(S=za(h?v(h,S):S),l.has(S))throw u(S);l.add(S);let E=this.refs[S];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")c(d,E.schema,S);else if(S!==za(y))if(S[0]==="#")c(d,a[S],S),a[S]=d;else this.refs[S]=y;return S}function P(S){if(typeof S=="string"){if(!U8.test(S))throw Error(`invalid anchor "${S}"`);x.call(this,`#${S}`)}}}),a;function c(d,p,m){if(p!==void 0&&!L8(d,p))throw u(m)}function u(d){return Error(`reference "${d}" resolves to more than one schema`)}}JC.getSchemaRefs=z8});var Xa=G(function(XC){Object.defineProperty(XC,"__esModule",{value:!0});XC.getData=XC.KeywordCxt=XC.validateFunctionCode=void 0;var om=zA(),sm=gu(),Ga=T$(),Oo=gu(),LC=fC(),ls=vC(),Ka=jC(),H=je(),Pe=gr(),FC=yu(),Gt=Me(),as=hu();function Q8(e){if(HC(e)){if(WC(e),qC(e)){nK(e);return}}VC(e,()=>om.topBoolOrEmptySchema(e))}XC.validateFunctionCode=Q8;function VC({gen:e,validateName:t,schema:n,schemaEnv:r,opts:s},o){if(s.code.es5)e.func(t,H._`${Pe.default.data}, ${Pe.default.valCxt}`,r.$async,()=>{e.code(H._`"use strict"; ${MC(n,s)}`),tK(e,s),e.code(o)});else e.func(t,H._`${Pe.default.data}, ${eK(s)}`,r.$async,()=>e.code(MC(n,s)).code(o))}function eK(e){return H._`{${Pe.default.instancePath}="", ${Pe.default.parentData}, ${Pe.default.parentDataProperty}, ${Pe.default.rootData}=${Pe.default.data}${e.dynamicRef?H._`, ${Pe.default.dynamicAnchors}={}`:H.nil}}={}`}function tK(e,t){e.if(Pe.default.valCxt,()=>{if(e.var(Pe.default.instancePath,H._`${Pe.default.valCxt}.${Pe.default.instancePath}`),e.var(Pe.default.parentData,H._`${Pe.default.valCxt}.${Pe.default.parentData}`),e.var(Pe.default.parentDataProperty,H._`${Pe.default.valCxt}.${Pe.default.parentDataProperty}`),e.var(Pe.default.rootData,H._`${Pe.default.valCxt}.${Pe.default.rootData}`),t.dynamicRef)e.var(Pe.default.dynamicAnchors,H._`${Pe.default.valCxt}.${Pe.default.dynamicAnchors}`)},()=>{if(e.var(Pe.default.instancePath,H._`""`),e.var(Pe.default.parentData,H._`undefined`),e.var(Pe.default.parentDataProperty,H._`undefined`),e.var(Pe.default.rootData,Pe.default.data),t.dynamicRef)e.var(Pe.default.dynamicAnchors,H._`{}`)})}function nK(e){let{schema:t,opts:n,gen:r}=e;VC(e,()=>{if(n.$comment&&t.$comment)UC(e);if(aK(e),r.let(Pe.default.vErrors,null),r.let(Pe.default.errors,0),n.unevaluated)rK(e);BC(e),uK(e)});return}function rK(e){let{gen:t,validateName:n}=e;e.evaluated=t.const("evaluated",H._`${n}.evaluated`),t.if(H._`${e.evaluated}.dynamicProps`,()=>t.assign(H._`${e.evaluated}.props`,H._`undefined`)),t.if(H._`${e.evaluated}.dynamicItems`,()=>t.assign(H._`${e.evaluated}.items`,H._`undefined`))}function MC(e,t){let n=typeof e=="object"&&e[t.schemaId];return n&&(t.code.source||t.code.process)?H._`/*# sourceURL=${n} */`:H.nil}function sK(e,t){if(HC(e)){if(WC(e),qC(e)){oK(e,t);return}}om.boolOrEmptySchema(e,t)}function qC({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 HC(e){return typeof e.schema!="boolean"}function oK(e,t){let{schema:n,gen:r,opts:s}=e;if(s.$comment&&n.$comment)UC(e);lK(e),cK(e);let o=r.const("_errs",Pe.default.errors);BC(e,o),r.var(t,H._`${o} === ${Pe.default.errors}`)}function WC(e){Gt.checkUnknownRules(e),iK(e)}function BC(e,t){if(e.opts.jtd)return DC(e,[],!1,t);let n=sm.getSchemaTypes(e.schema),r=sm.coerceAndCheckDataType(e,n);DC(e,n,!r,t)}function iK(e){let{schema:t,errSchemaPath:n,opts:r,self:s}=e;if(t.$ref&&r.ignoreKeywordsWithRef&&Gt.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${n}"`)}function aK(e){let{schema:t,opts:n}=e;if(t.default!==void 0&&n.useDefaults&&n.strictSchema)Gt.checkStrictMode(e,"default is ignored in the schema root")}function lK(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=FC.resolveUrl(e.opts.uriResolver,e.baseId,t)}function cK(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function UC({gen:e,schemaEnv:t,schema:n,errSchemaPath:r,opts:s}){let o=n.$comment;if(s.$comment===!0)e.code(H._`${Pe.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=H.str`${r}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(H._`${Pe.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function uK(e){let{gen:t,schemaEnv:n,validateName:r,ValidationError:s,opts:o}=e;if(n.$async)t.if(H._`${Pe.default.errors} === 0`,()=>t.return(Pe.default.data),()=>t.throw(H._`new ${s}(${Pe.default.vErrors})`));else{if(t.assign(H._`${r}.errors`,Pe.default.vErrors),o.unevaluated)fK(e);t.return(H._`${Pe.default.errors} === 0`)}}function fK({gen:e,evaluated:t,props:n,items:r}){if(n instanceof H.Name)e.assign(H._`${t}.props`,n);if(r instanceof H.Name)e.assign(H._`${t}.items`,r)}function DC(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||!Gt.schemaHasRulesButRef(o,u))){s.block(()=>KC(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)dK(e,t);s.block(()=>{for(let p of u.rules)d(p);d(u.post)});function d(p){if(!Ga.shouldUseGroup(o,p))return;if(p.type){if(s.if(Oo.checkDataType(p.type,i,l.strictNumbers)),IC(e,p),t.length===1&&t[0]===p.type&&n)s.else(),Oo.reportTypeError(e);s.endIf()}else IC(e,p);if(!a)s.if(H._`${Pe.default.errors} === ${r||0}`)}}function IC(e,t){let{gen:n,schema:r,opts:{useDefaults:s}}=e;if(s)LC.assignDefaults(e,t.type);n.block(()=>{for(let o of t.rules)if(Ga.shouldUseRule(r,o))KC(e,o.keyword,o.definition,t.type)})}function dK(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(pK(e,t),!e.opts.allowUnionTypes)mK(e,t);hK(e,e.dataTypes)}function pK(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((n)=>{if(!zC(e.dataTypes,n))V$(e,`type "${n}" not allowed by context "${e.dataTypes.join(",")}"`)}),yK(e,t)}function mK(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))V$(e,"use allowUnionTypes to allow union type keyword")}function hK(e,t){let n=e.self.RULES.all;for(let r in n){let s=n[r];if(typeof s=="object"&&Ga.shouldUseRule(e.schema,s)){let{type:o}=s.definition;if(o.length&&!o.some((i)=>gK(t,i)))V$(e,`missing type "${o.join(",")}" for keyword "${r}"`)}}}function gK(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function zC(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function yK(e,t){let n=[];for(let r of e.dataTypes)if(zC(t,r))n.push(r);else if(t.includes("integer")&&r==="number")n.push("integer");e.dataTypes=n}function V$(e,t){let n=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${n}" (strictTypes)`,Gt.checkStrictMode(e,t,e.opts.strictTypes)}class q${constructor(e,t,n){if(ls.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=Gt.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",GC(this.$data,e));else if(this.schemaCode=this.schemaValue,!ls.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",Pe.default.errors)}result(e,t,n){this.failResult(H.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(H.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(H._`${t} !== undefined && (${H.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?as.reportExtraError:as.reportError)(this,this.def.error,t)}$dataError(){as.reportError(this,this.def.$dataError||as.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');as.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=H.nil){this.gen.block(()=>{this.check$data(e,n),t()})}check$data(e=H.nil,t=H.nil){if(!this.$data)return;let{gen:n,schemaCode:r,schemaType:s,def:o}=this;if(n.if(H.or(H._`${r} === undefined`,t)),e!==H.nil)n.assign(e,!0);if(s.length||o.validateSchema){if(n.elseIf(this.invalid$data()),this.$dataError(),e!==H.nil)n.assign(e,!1)}n.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:n,def:r,it:s}=this;return H.or(o(),i());function o(){if(n.length){if(!(t instanceof H.Name))throw Error("ajv implementation error");let a=Array.isArray(n)?n:[n];return H._`${Oo.checkDataTypes(a,t,s.opts.strictNumbers,Oo.DataType.Wrong)}`}return H.nil}function i(){if(r.validateSchema){let a=e.scopeValue("validate$data",{ref:r.validateSchema});return H._`!${a}(${t})`}return H.nil}}subschema(e,t){let n=Ka.getSubschema(this.it,e);Ka.extendSubschemaData(n,this.it,e),Ka.extendSubschemaMode(n,e);let r={...this.it,...n,items:void 0,props:void 0};return sK(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=Gt.mergeEvaluated.props(r,e.props,n.props,t);if(n.items!==!0&&e.items!==void 0)n.items=Gt.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,H.Name)),!0}}XC.KeywordCxt=q$;function KC(e,t,n,r){let s=new q$(e,n,t);if("code"in n)n.code(s,r);else if(s.$data&&n.validate)ls.funcKeywordCode(s,n);else if("macro"in n)ls.macroKeywordCode(s,n);else if(n.compile||n.validate)ls.funcKeywordCode(s,n)}var xK=/^\/(?:[^~]|~0|~1)*$/,bK=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function GC(e,{dataLevel:t,dataNames:n,dataPathArr:r}){let s,o;if(e==="")return Pe.default.rootData;if(e[0]==="/"){if(!xK.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,o=Pe.default.rootData}else{let c=bK.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=H._`${o}${H.getProperty(Gt.unescapeJsonPointer(c))}`,i=H._`${i} && ${o}`;return i;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}XC.getData=GC});var xu=G(function(QC){Object.defineProperty(QC,"__esModule",{value:!0});class ZC extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}QC.default=ZC});var Za=G(function(tR){Object.defineProperty(tR,"__esModule",{value:!0});var Ya=yu();class eR extends Error{constructor(e,t,n,r){super(r||`can't resolve reference ${n} from id ${t}`);this.missingRef=Ya.resolveUrl(e,t,n),this.missingSchema=Ya.normalizeId(Ya.getFullPath(e,this.missingRef))}}tR.default=eR});var $u=G(function(sR){Object.defineProperty(sR,"__esModule",{value:!0});sR.resolveSchema=sR.getCompilingSchema=sR.resolveRef=sR.compileSchema=sR.SchemaEnv=void 0;var vt=je(),EK=xu(),_i=gr(),Et=yu(),im=Me(),nR=Xa();class bu{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:Et.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={}}}sR.SchemaEnv=bu;function W$(e){let t=rR.call(this,e);if(t)return t;let n=Et.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:r,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new vt.CodeGen(this.scope,{es5:r,lines:s,ownProperties:o}),a;if(e.$async)a=i.scopeValue("Error",{ref:EK.default,code:vt._`require("ajv/dist/runtime/validation_error").default`});let l=i.scopeName("validate");e.validateName=l;let c={gen:i,allErrors:this.opts.allErrors,data:_i.default.data,parentData:_i.default.parentData,parentDataProperty:_i.default.parentDataProperty,dataNames:[_i.default.data],dataPathArr:[vt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:vt.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:n,baseId:e.baseId||n,schemaPath:vt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:vt._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),nR.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(u=`${i.scopeRefs(_i.default.scope)}return ${d}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${_i.default.self}`,`${_i.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:l,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:g,items:y}=c;if(m.evaluated={props:g instanceof vt.Name?void 0:g,items:y instanceof vt.Name?void 0:y,dynamicProps:g instanceof vt.Name,dynamicItems:y instanceof vt.Name},m.source)m.source.evaluated=vt.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)}}sR.compileSchema=W$;function PK(e,t,n){var r;n=Et.resolveUrl(this.opts.uriResolver,t,n);let s=e.refs[n];if(s)return s;let o=kK.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 bu({schema:i,schemaId:a,root:e,baseId:t})}if(o===void 0)return;return e.refs[n]=jK.call(this,o)}sR.resolveRef=PK;function jK(e){if(Et.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:W$.call(this,e)}function rR(e){for(let t of this._compilations)if(OK(t,e))return t}sR.getCompilingSchema=rR;function OK(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function kK(e,t){let n;while(typeof(n=this.refs[t])=="string")t=n;return n||this.schemas[t]||am.call(this,e,t)}function am(e,t){let n=this.opts.uriResolver.parse(t),r=Et._getFullPath(this.opts.uriResolver,n),s=Et.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&r===s)return H$.call(this,n,e);let o=Et.normalizeId(r),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=am.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return H$.call(this,n,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)W$.call(this,i);if(o===Et.normalizeId(t)){let{schema:a}=i,{schemaId:l}=this.opts,c=a[l];if(c)s=Et.resolveUrl(this.opts.uriResolver,s,c);return new bu({schema:a,schemaId:l,root:e,baseId:s})}return H$.call(this,n,i)}sR.resolveSchema=am;var _K=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function H$(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[im.unescapeFragment(a)];if(l===void 0)return;n=l;let c=typeof n==="object"&&n[this.opts.schemaId];if(!_K.has(a)&&c)t=Et.resolveUrl(this.opts.uriResolver,t,c)}let o;if(typeof n!="boolean"&&n.$ref&&!im.schemaHasRulesButRef(n,this.RULES)){let a=Et.resolveUrl(this.opts.uriResolver,t,n.$ref);o=am.call(this,r,a)}let{schemaId:i}=this.opts;if(o=o||new bu({schema:n,schemaId:i,root:r,baseId:t}),o.schema!==o.root.schema)return o;return}});var iR=G(function(ice,JK){JK.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 X$=G(function(ace,mR){var NK=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),U$=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),MK=RegExp.prototype.test.bind(/^\d*$/u),Ai=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),z$=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),lR=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),K$=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),DK=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Fn=Array(256);for(let t=0;t<256;t++)Fn[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function yn(e){if(e<2048)return Fn[192|e>>6]+Fn[128|e&63];if(e<65536)return Fn[224|e>>12]+Fn[128|e>>6&63]+Fn[128|e&63];return Fn[240|e>>18]+Fn[128|e>>12&63]+Fn[128|e>>6&63]+Fn[128|e&63]}function IK(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 LK=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),FK=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),VK=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),qK=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function HK(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(VK(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Ai(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function aR(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 WK(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||!U$(l))return;o+=2;continue}if(!LK(l))return;s[a]=parseInt(l,16).toString(16),o++}if(t===-1){if(o!==8)return;return aR(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 aR(i)}function B$(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&&FK(r))return r=r.toLowerCase(),{host:`[${r}]`,escapedHost:r,isIPV6:!1,isIPVFuture:!0};if(BK(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),!HK(s))return{host:e,isIPV6:!1,error:!0};r=r.slice(0,o)}let i=WK(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 BK(e,t){let n=0;for(let r=0;r<e.length;r++)if(e[r]===t)n++;return n}function cR(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 UK(e){if(e===""||e[0]==="/")return cR(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 zK={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},KK=/[@/?#:]/g,GK=/[@/?#]/g;function uR(e,t){let n=t?GK:KK;return n.lastIndex=0,e.replace(n,(r)=>zK[r])}function fR(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(Ai(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(t&&z$(i))n+=i;else n+="%"+o;r+=2;continue}}n+=e[r]}return n}function XK(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(Ai(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(i!=="."&&z$(i))t+=i;else t+="%"+o;n+=2;continue}}if(lR(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=pR(s)?r:Fn[s];else if(s<55296||s>57343)t+=yn(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=yn(65536+(s-55296<<10)+(o-56320)),n++;else t+=yn(65533)}else t+=yn(65533)}}return t}function YK(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(Ai(i)){n+="%"+i.toUpperCase(),s+=2;continue}}if(o==="/")r=!1;if(lR(o)&&(o!==":"||!r))n+=o;else{let i=e.charCodeAt(s);if(i<128)n+=Fn[i];else if(i<55296||i>57343)n+=yn(i);else if(i<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)n+=yn(65536+(i-55296<<10)+(a-56320)),s++;else n+=yn(65533)}else n+=yn(65533)}}return n}function G$(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(Ai(o)){n+="%"+o.toUpperCase(),r+=2;continue}}if(t(s))n+=s;else{let o=e.charCodeAt(r);if(o<128)n+=Fn[o];else if(o<55296||o>57343)n+=yn(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)n+=yn(65536+(o-55296<<10)+(i-56320)),r++;else n+=yn(65533)}else n+=yn(65533)}}return n}function dR(e){return G$(e,DK)}function ZK(e){return G$(e,K$)}function QK(e){return G$(e,K$)}function pR(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 e9(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(Ai(s)){let o=s.toUpperCase(),i=String.fromCharCode(parseInt(o,16));if(z$(i))t+=i;else t+="%"+o;n+=2;continue}}if(K$(r))t+=r;else{let s=e.charCodeAt(n);if(s<128)t+=pR(s)?r:Fn[s];else if(s<55296||s>57343)t+=yn(s);else if(s<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)t+=yn(65536+(s-55296<<10)+(o-56320)),n++;else t+=yn(65533)}else t+=yn(65533)}}return t}function t9(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(Ai(r)){t+="%"+r.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t}function n9(e){let t=[];if(e.userinfo!==void 0)t.push(dR(e.userinfo)),t.push("@");if(e.host!==void 0){let n=e.host;if(!U$(n)){let r=B$(n);if(r.isIPV6!==!0&&r.isIPVFuture!==!0)n=fR(n,!0),r=B$(n);if(r.isIPV6===!0||r.isIPVFuture===!0)n=`[${r.escapedHost}]`;else n=uR(n,!1)}t.push(n)}if(typeof e.port==="number"||typeof e.port==="string"){let n=String(e.port);if(!MK(n))throw TypeError("URI port is malformed.");t.push(":"),t.push(n)}return t.length?t.join(""):void 0}mR.exports={nonSimpleDomain:qK,recomposeAuthority:n9,reescapeHostDelimiters:uR,normalizePercentEncoding:fR,normalizePathEncoding:XK,serializePathEncoding:YK,normalizeQueryFragmentEncoding:e9,encodeUserinfo:dR,encodeQuery:ZK,encodeFragment:QK,escapePreservingEscapes:t9,removeDotSegments:cR,removeDotSegmentsRelative:UK,isIPv4:U$,isUUID:NK,normalizeIPv6:B$,stringArrayToHexStripped:IK}});var bR=G(function(lce,xR){var{isUUID:r9}=X$(),s9=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,o9=["http","https","ws","wss","urn","urn:uuid"];function i9(e){return o9.indexOf(e)!==-1}function Y$(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 hR(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function gR(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 a9(e){return e.secure=Y$(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function l9(e){if(e.port===(Y$(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 c9(e,t){if(!e.path)return e.error="URN can not be parsed",e;let n=e.path.match(s9);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=Z$(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 u9(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=Z$(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 f9(e,t){let n=e;if(n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!r9(n.uuid)))n.error=n.error||"UUID is not valid.";return n}function d9(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var yR={scheme:"http",domainHost:!0,parse:hR,serialize:gR},p9={scheme:"https",domainHost:yR.domainHost,parse:hR,serialize:gR},lm={scheme:"ws",domainHost:!0,parse:a9,serialize:l9},m9={scheme:"wss",domainHost:lm.domainHost,parse:lm.parse,serialize:lm.serialize},h9={scheme:"urn",parse:c9,serialize:u9,skipNormalize:!0},g9={scheme:"urn:uuid",parse:f9,serialize:d9,skipNormalize:!0},cm={http:yR,https:p9,ws:lm,wss:m9,urn:h9,"urn:uuid":g9};Object.setPrototypeOf(cm,null);function Z$(e){return e&&(cm[e]||cm[e.toLowerCase()])||void 0}xR.exports={wsIsSecure:Y$,SCHEMES:cm,isValidSchemeName:i9,getSchemeHandler:Z$}});var TR=G(function(cce,pm){var{normalizeIPv6:ER,removeDotSegments:wu,removeDotSegmentsRelative:PR,recomposeAuthority:y9,normalizePercentEncoding:Q$,normalizePathEncoding:x9,serializePathEncoding:$R,normalizeQueryFragmentEncoding:SR,encodeQuery:b9,encodeFragment:$9,reescapeHostDelimiters:S9,isIPv4:jR,nonSimpleDomain:w9}=X$(),{SCHEMES:OR,getSchemeHandler:eS}=bR(),kR=/^[A-Za-z][A-Za-z0-9+.-]*$/u,v9=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function wR(e){let t=String(e);if(!kR.test(t))throw TypeError("URI scheme is malformed.");return t}function E9(e,t){if(typeof e==="string")e=T9(e,t);else if(typeof e==="object")e=fm(Ci(e,t),t);return e}function P9(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}=um(e,r),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:m,malformedHost:g,malformedScheme:y}=um(t,r);if(o||d||i||p||a||m||l||g||c||y)throw Error(s.error||u.error||"URI is malformed.");let h=_R(s,u,r,!0),x=eS(n&&n.scheme||h.scheme),P=h.host,S=P!==void 0&&P!==""&&(jR(P)||ER(P).isIPV6);if(CR(h,n||{},x,S))throw Error("URI host is malformed.");AR(h,n||{},x,S);let v=P&&P.indexOf("%")!==-1&&!/\P{ASCII}/u.test(P);if(h.error&&!v)throw Error(h.error);return r.skipEscape=!0,Ci(h,r)}function _R(e,t,n,r){let s={};if(!r)e=fm(Ci(e,n),n),t=fm(Ci(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=wu(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=wu(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=wu(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]!=="/"?PR(s.path):wu(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 j9(e,t,n){let r=vR(e,n),s=vR(t,n);return r!==void 0&&s!==void 0&&r===s}function Ci(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=wR(n.scheme);let o=eS(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=$R(n.path,l);else n.path=Q$(n.path);if(r.reference!=="suffix"&&n.scheme)n.scheme=wR(n.scheme),s.push(n.scheme,":");let c=y9(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]!=="/"?PR(u):wu(u);if(a)u=$R(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("?",b9(n.query));if(n.fragment!==void 0)s.push("#",$9(n.fragment));return s.join("")}var O9=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,k9=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,_9=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function A9(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 Su(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 dm(e){return e[0]==="["&&e[e.length-1]==="]"}function C9(e){let t=e[4];return Su(e[3])||t!==void 0&&!dm(t)&&Su(t)||Su(e[6])||Su(e[7])||Su(e[8])}function AR(e,t,n,r){if(CR(e,t,n,r))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!n||!n.unicodeSupport)&&e.host&&!dm(e.host)&&(t.domainHost||n&&n.domainHost)&&r===!1&&w9(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(!R9(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function CR(e,t,n,r){return Boolean(e.host&&r===!1&&!dm(e.host)&&(t.domainHost||n&&n.domainHost)&&v9.test(e.host))}function R9(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function um(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(k9);if(d!==null&&d[1].indexOf("\\")!==-1)r.error="URI authority must not contain a literal backslash.",s=!0;let p=e.match(_9);if(p!==null){let g=p[1],y=g.replace(/[\t\n\r]/g,"");if(y.length>=2){if(y.slice(0,2)!=="//")r.error=r.error||"URI authority must not contain a literal backslash.",s=!0;else if(g.length!==y.length)r.error=r.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(O9);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(kR.test(r.scheme))r.scheme=r.scheme.toLowerCase();else r.error=r.error||"URI scheme is malformed.",c=!0;if(o=C9(m),o)r.error=r.error||"URI contains malformed percent-encoding.";if(isNaN(r.port))r.port=m[5];let g=A9(r,m);if(g!==void 0)r.error=r.error||g,s=!0;if(r.host)if(jR(r.host)===!1){let x=dm(r.host),P=r.host.indexOf("[")!==-1||r.host.indexOf("]")!==-1,S=ER(r.host);if(u=S.isIPV6||S.isIPVFuture===!0,l=P&&(!x||S.error===!0),r.host=u?S.host:S.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 y=eS(n.scheme||r.scheme);if(!l)a=AR(r,n,y,u);if(e.indexOf("%")!==-1&&r.host!==void 0&&!l){let h=u?r.host:Q$(r.host,!0);if(!u)h=Q$(h.toLowerCase());r.host=u||n.scheme!=="null"?S9(h,u):h}if(!y||y&&!y.skipNormalize){if(r.path)r.path=x9(r.path);if(r.query)r.query=SR(r.query);if(r.fragment)r.fragment=SR(r.fragment)}if(y&&y.parse){if(y.parse(r,n),y===OR.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 fm(e,t){return um(e,t).parsed}function T9(e,t){return RR(e,t).normalized}function RR(e,t){let{parsed:n,malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}=um(e,t);return{normalized:r||s||o||i||a?e:Ci(n,t),malformedAuthorityOrPort:r,malformedPercentEncoding:s,malformedSchemeSpecific:o,malformedHost:i,malformedScheme:a}}function vR(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let n;try{n=typeof e==="string"?e:Ci(e,t)}catch{return}let{normalized:r,malformedAuthorityOrPort:s,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:l}=RR(n,t);return s||o||i||a||l?void 0:r}var tS={SCHEMES:OR,normalize:E9,resolve:P9,resolveComponent:_R,equal:j9,serialize:Ci,parse:fm};pm.exports=tS;pm.exports.default=tS;pm.exports.fastUri=tS});var MR=G(function(NR){Object.defineProperty(NR,"__esModule",{value:!0});var JR=TR();JR.code='require("ajv/dist/runtime/uri").default';NR.default=JR});var rS=G(function(Hs){Object.defineProperty(Hs,"__esModule",{value:!0});Hs.CodeGen=Hs.Name=Hs.nil=Hs.stringify=Hs.str=Hs._=Hs.KeywordCxt=void 0;var N9=Xa();Object.defineProperty(Hs,"KeywordCxt",{enumerable:!0,get:function(){return N9.KeywordCxt}});var el=je();Object.defineProperty(Hs,"_",{enumerable:!0,get:function(){return el._}});Object.defineProperty(Hs,"str",{enumerable:!0,get:function(){return el.str}});Object.defineProperty(Hs,"stringify",{enumerable:!0,get:function(){return el.stringify}});Object.defineProperty(Hs,"nil",{enumerable:!0,get:function(){return el.nil}});Object.defineProperty(Hs,"Name",{enumerable:!0,get:function(){return el.Name}});Object.defineProperty(Hs,"CodeGen",{enumerable:!0,get:function(){return el.CodeGen}});var M9=xu(),VR=Za(),qR=R$(),cs=$u(),HR=je(),us=yu(),ko=gu(),Qa=Me(),DR=iR(),D9=MR(),WR=(e,t)=>new RegExp(e,t);WR.code="new RegExp";var I9=["removeAdditional","useDefaults","coerceTypes"],L9=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),F9={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."},V9={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},IR=200;function q9(e){var t,n,r,s,o,i,a,l,c,u,d,p,m,g,y,h,x,P,S,v,E,w,R,C,J;let D=e.strict,A=(t=e.code)===null||t===void 0?void 0:t.optimize,L=A===!0||A===void 0?1:A||0,K=(r=(n=e.code)===null||n===void 0?void 0:n.regExp)!==null&&r!==void 0?r:WR,ne=(s=e.uriResolver)!==null&&s!==void 0?s:D9.default;return{strictSchema:(i=(o=e.strictSchema)!==null&&o!==void 0?o:D)!==null&&i!==void 0?i:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:D)!==null&&u!==void 0?u:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:D)!==null&&p!==void 0?p:"log",strictRequired:(g=(m=e.strictRequired)!==null&&m!==void 0?m:D)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:L,regExp:K}:{optimize:L,regExp:K},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:IR,loopEnum:(h=e.loopEnum)!==null&&h!==void 0?h:IR,meta:(x=e.meta)!==null&&x!==void 0?x:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(v=e.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(w=e.validateSchema)!==null&&w!==void 0?w:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(C=e.unicodeRegExp)!==null&&C!==void 0?C:!0,int32range:(J=e.int32range)!==null&&J!==void 0?J:!0,uriResolver:ne}}class mm{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,...q9(e)};let{es5:t,lines:n}=this.opts.code;this.scope=new HR.ValueScope({scope:{},prefixes:L9,es5:t,lines:n}),this.logger=K9(e.logger);let r=e.validateFormats;if(e.validateFormats=!1,this.RULES=qR.getRules(),LR.call(this,F9,e,"NOT SUPPORTED"),LR.call(this,V9,e,"DEPRECATED","warn"),this._metaOpts=U9.call(this),e.formats)W9.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)B9.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);H9.call(this),e.validateFormats=r}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:n}=this.opts,r=DR;if(n==="id")r={...DR},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 VR.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=us.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=FR.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:n}=this.opts,r=new cs.SchemaEnv({schema:{},schemaId:n});if(t=cs.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=FR.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=us.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(X9.call(this,n,t),!t)return Qa.eachItem(n,(s)=>nS.call(this,s)),this;Z9.call(this,t);let r={...t,type:ko.getJSONTypes(t.type),schemaType:ko.getJSONTypes(t.schemaType)};return Qa.eachItem(n,r.type.length===0?(s)=>nS.call(this,s,r):(s)=>r.type.forEach((o)=>nS.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]=BR(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=us.normalizeId(o||n);let l=us.getSchemaRefs.call(this,e,n);if(a=new cs.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 cs.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{cs.compileSchema.call(this,e)}finally{this.opts=t}}}mm.ValidationError=M9.default;mm.MissingRefError=VR.default;Hs.default=mm;function LR(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 FR(e){return e=us.normalizeId(e),this.schemas[e]||this.refs[e]}function H9(){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 W9(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function B9(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 U9(){let e={...this.opts};for(let t of I9)delete e[t];return e}var z9={log(){},warn(){},error(){}};function K9(e){if(e===!1)return z9;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 G9=/^[a-z_$][a-z0-9_$:-]*$/i;function X9(e,t){let{RULES:n}=this;if(Qa.eachItem(e,(r)=>{if(n.keywords[r])throw Error(`Keyword ${r} is already defined`);if(!G9.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 nS(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:ko.getJSONTypes(t.type),schemaType:ko.getJSONTypes(t.schemaType)}};if(t.before)Y9.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 Y9(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 Z9(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=BR(t);e.validateSchema=this.compile(t,!0)}var Q9={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function BR(e){return{anyOf:[e,Q9]}}});var zR=G(function(UR){Object.defineProperty(UR,"__esModule",{value:!0});var n3={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};UR.default=n3});var xm=G(function(GR){Object.defineProperty(GR,"__esModule",{value:!0});GR.callRef=GR.getValidate=void 0;var s3=Za(),gm=xr(),et=je(),tl=gr(),ym=$u(),_o=Me(),o3={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=ym.resolveRef.call(l,c,s,n);if(u===void 0)throw new s3.default(r.opts.uriResolver,s,n);if(u instanceof ym.SchemaEnv)return p(u);return m(u);function d(){if(o===c)return hm(e,i,o,o.$async);let g=t.scopeValue("root",{ref:c});return hm(e,et._`${g}.validate`,c,c.$async)}function p(g){let y=KR(e,g);hm(e,y,g,g.$async)}function m(g){let y=t.scopeValue("schema",a.code.source===!0?{ref:g,code:et.stringify(g)}:{ref:g}),h=t.name("valid"),x=e.subschema({schema:g,dataTypes:[],schemaPath:et.nil,topSchemaRef:y,errSchemaPath:n},h);e.mergeEvaluated(x),e.ok(h)}}};function KR(e,t){let{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):et._`${n.scopeValue("wrapper",{ref:t})}.validate`}GR.getValidate=KR;function hm(e,t,n,r){let{gen:s,it:o}=e,{allErrors:i,schemaEnv:a,opts:l}=o,c=l.passContext?tl.default.this:et.nil;if(r)u();else d();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let g=s.let("valid");s.try(()=>{if(s.code(et._`await ${gm.callValidateCode(e,t,c)}`),m(t),!i)s.assign(g,!0)},(y)=>{if(s.if(et._`!(${y} instanceof ${o.ValidationError})`,()=>s.throw(y)),p(y),!i)s.assign(g,!1)}),e.ok(g)}function d(){e.result(gm.callValidateCode(e,t,c),()=>m(t),()=>p(t))}function p(g){let y=et._`${g}.errors`;s.assign(tl.default.vErrors,et._`${tl.default.vErrors} === null ? ${y} : ${tl.default.vErrors}.concat(${y})`),s.assign(tl.default.errors,et._`${tl.default.vErrors}.length`)}function m(g){var y;if(!o.opts.unevaluated)return;let h=(y=n===null||n===void 0?void 0:n.validate)===null||y===void 0?void 0:y.evaluated;if(o.props!==!0)if(h&&!h.dynamicProps){if(h.props!==void 0)o.props=_o.mergeEvaluated.props(s,h.props,o.props)}else{let x=s.var("props",et._`${g}.evaluated.props`);o.props=_o.mergeEvaluated.props(s,x,o.props,et.Name)}if(o.items!==!0)if(h&&!h.dynamicItems){if(h.items!==void 0)o.items=_o.mergeEvaluated.items(s,h.items,o.items)}else{let x=s.var("items",et._`${g}.evaluated.items`);o.items=_o.mergeEvaluated.items(s,x,o.items,et.Name)}}}GR.callRef=hm;GR.default=o3});var sS=G(function(YR){Object.defineProperty(YR,"__esModule",{value:!0});var l3=zR(),c3=xm(),u3=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",l3.default,c3.default];YR.default=u3});var QR=G(function(ZR){Object.defineProperty(ZR,"__esModule",{value:!0});var Co=je(),Ao=Co.operators,bm={maximum:{okStr:"<=",ok:Ao.LTE,fail:Ao.GT},minimum:{okStr:">=",ok:Ao.GTE,fail:Ao.LT},exclusiveMaximum:{okStr:"<",ok:Ao.LT,fail:Ao.GTE},exclusiveMinimum:{okStr:">",ok:Ao.GT,fail:Ao.LTE}},d3={message:({keyword:e,schemaCode:t})=>Co.str`must be ${bm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Co._`{comparison: ${bm[e].okStr}, limit: ${t}}`},p3={keyword:Object.keys(bm),type:"number",schemaType:"number",$data:!0,error:d3,code(e){let{keyword:t,data:n,schemaCode:r}=e;e.fail$data(Co._`${n} ${bm[t].fail} ${r} || isNaN(${n})`)}};ZR.default=p3});var tT=G(function(eT){Object.defineProperty(eT,"__esModule",{value:!0});var fs=je(),h3={message:({schemaCode:e})=>fs.str`must be multiple of ${e}`,params:({schemaCode:e})=>fs._`{multipleOf: ${e}}`},g3={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:h3,code(e){let{gen:t,data:n,schemaCode:r,it:s}=e,o=s.opts.multipleOfPrecision,i=t.let("res"),a=o?fs._`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:fs._`${i} !== parseInt(${i})`;e.fail$data(fs._`(${r} === 0 || (${i} = ${n}/${r}, ${a}))`)}};eT.default=g3});var sT=G(function(rT){Object.defineProperty(rT,"__esModule",{value:!0});function nT(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}rT.default=nT;nT.code='require("ajv/dist/runtime/ucs2length").default'});var aT=G(function(iT){Object.defineProperty(iT,"__esModule",{value:!0});var Vn=je(),oT=Me(),b3=sT(),$3={message({keyword:e,schemaCode:t}){return Vn.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Vn._`{limit: ${e}}`},S3={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$3,code(e){let{keyword:t,data:n,schemaCode:r,it:s}=e,o=t==="maxLength"?Vn.operators.GT:Vn.operators.LT,i=s.opts.unicode===!1?Vn._`${n}.length`:Vn._`${oT.useFunc(e.gen,b3.default)}(${n})`;e.fail$data(Vn._`${i} ${o} ${r}`)}};iT.default=S3});var fT=G(function(uT){Object.defineProperty(uT,"__esModule",{value:!0});var lT=xr(),cT=Me(),br=je(),v3={message:({schemaCode:e})=>br.str`must match pattern "${e}"`,params:({schemaCode:e})=>br._`{pattern: ${e}}`},E3={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:v3,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"?br._`new RegExp`:cT.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,br._`${c}(${o}, ${a}).test(${n})`),()=>t.assign(u,!1)),e.fail$data(br._`!${u}`)}else{let l=lT.usePattern(e,s);e.fail$data(br._`!${l}.test(${n})`)}}};uT.default=E3});var pT=G(function(dT){Object.defineProperty(dT,"__esModule",{value:!0});var ds=je(),j3={message({keyword:e,schemaCode:t}){return ds.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>ds._`{limit: ${e}}`},O3={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:j3,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxProperties"?ds.operators.GT:ds.operators.LT;e.fail$data(ds._`Object.keys(${n}).length ${s} ${r}`)}};dT.default=O3});var gT=G(function(hT){Object.defineProperty(hT,"__esModule",{value:!0});var ps=xr(),ms=je(),mT=Me(),_3={message:({params:{missingProperty:e}})=>ms.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>ms._`{missingProperty: ${e}}`},A3={keyword:"required",type:"object",schemaType:"array",$data:!0,error:_3,code(e){let{gen:t,schema:n,schemaCode:r,data:s,$data:o,it:i}=e,{opts:a}=i;if(!o&&n.length===0)return;let l=n.length>=a.loopRequired;if(i.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:g}=e.it;for(let y of n)if((m===null||m===void 0?void 0:m[y])===void 0&&!g.has(y)){let h=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${y}" is not defined at "${h}" (strictRequired)`;mT.checkStrictMode(i,x,i.opts.strictRequired)}}function c(){if(l||o)e.block$data(ms.nil,d);else for(let m of n)ps.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||o){let g=t.let("valid",!0);e.block$data(g,()=>p(m,g)),e.ok(g)}else t.if(ps.checkMissingProp(e,n,m)),ps.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",r,(m)=>{e.setParams({missingProperty:m}),t.if(ps.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function p(m,g){e.setParams({missingProperty:m}),t.forOf(m,r,()=>{t.assign(g,ps.propertyInData(t,s,m,a.ownProperties)),t.if(ms.not(g),()=>{e.error(),t.break()})},ms.nil)}}};hT.default=A3});var xT=G(function(yT){Object.defineProperty(yT,"__esModule",{value:!0});var hs=je(),R3={message({keyword:e,schemaCode:t}){return hs.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>hs._`{limit: ${e}}`},T3={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:R3,code(e){let{keyword:t,data:n,schemaCode:r}=e,s=t==="maxItems"?hs.operators.GT:hs.operators.LT;e.fail$data(hs._`${n}.length ${s} ${r}`)}};yT.default=T3});var $m=G(function($T){Object.defineProperty($T,"__esModule",{value:!0});var bT=L$();bT.code='require("ajv/dist/runtime/equal").default';$T.default=bT});var vT=G(function(wT){Object.defineProperty(wT,"__esModule",{value:!0});var nl=gu(),We=je(),ST=Me(),M3=$m(),D3={message:({params:{i:e,j:t}})=>We.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>We._`{i: ${e}, j: ${t}}`},I3={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:D3,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?nl.getSchemaTypes(o.items):[];e.block$data(l,u,We._`${i} === false`),e.ok(l);function u(){let g=t.let("i",We._`${n}.length`),y=t.let("j");e.setParams({i:g,j:y}),t.assign(l,!0),t.if(We._`${g} > 1`,()=>(d()?p:m)(g,y))}function d(){return c.length>0&&!c.some((g)=>g==="object"||g==="array")}function p(g,y){let h=t.name("item"),x=nl.checkDataTypes(c,h,a.opts.strictNumbers,nl.DataType.Wrong),P=t.const("indices",We._`{}`);t.for(We._`;${g}--;`,()=>{if(t.let(h,We._`${n}[${g}]`),t.if(x,We._`continue`),c.length>1)t.if(We._`typeof ${h} == "string"`,We._`${h} += "_"`);t.if(We._`typeof ${P}[${h}] == "number"`,()=>{t.assign(y,We._`${P}[${h}]`),e.error(),t.assign(l,!1).break()}).code(We._`${P}[${h}] = ${g}`)})}function m(g,y){let h=ST.useFunc(t,M3.default),x=t.name("outer");t.label(x).for(We._`;${g}--;`,()=>t.for(We._`${y} = ${g}; ${y}--;`,()=>t.if(We._`${h}(${n}[${g}], ${n}[${y}])`,()=>{e.error(),t.assign(l,!1).break(x)})))}}};wT.default=I3});var jT=G(function(PT){Object.defineProperty(PT,"__esModule",{value:!0});var rl=je(),ET=Me(),F3=$m(),V3={message:"must be equal to constant",params:({schemaCode:e})=>rl._`{allowedValue: ${e}}`},q3={keyword:"const",$data:!0,error:V3,code(e){let{gen:t,data:n,$data:r,schemaCode:s,schema:o}=e;if(r||o&&typeof o=="object")e.fail$data(rl._`!${ET.useFunc(t,F3.default)}(${n}, ${s})`);else e.fail(rl._`${o} !== ${n}`)}};PT.default=q3});var _T=G(function(kT){Object.defineProperty(kT,"__esModule",{value:!0});var gs=je(),OT=Me(),W3=$m(),B3={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>gs._`{allowedValues: ${e}}`},U3={keyword:"enum",schemaType:"array",$data:!0,error:B3,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=OT.useFunc(t,W3.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=gs.or(...s.map((g,y)=>p(m,y)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",o,(m)=>t.if(gs._`${c()}(${n}, ${m})`,()=>t.assign(u,!0).break()))}function p(m,g){let y=s[g];return typeof y==="object"&&y!==null?gs._`${c()}(${n}, ${m}[${g}])`:gs._`${n} === ${y}`}}};kT.default=U3});var oS=G(function(AT){Object.defineProperty(AT,"__esModule",{value:!0});var K3=QR(),G3=tT(),X3=aT(),Y3=fT(),Z3=pT(),Q3=gT(),e4=xT(),t4=vT(),n4=jT(),r4=_T(),s4=[K3.default,G3.default,X3.default,Y3.default,Z3.default,Q3.default,e4.default,t4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},n4.default,r4.default];AT.default=s4});var iS=G(function(RT){Object.defineProperty(RT,"__esModule",{value:!0});RT.validateAdditionalItems=void 0;var qn=je(),sl=Me(),i4={message:({params:{len:e}})=>qn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>qn._`{limit: ${e}}`},a4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:i4,code(e){let{parentSchema:t,it:n}=e,{items:r}=t;if(!Array.isArray(r)){sl.checkStrictMode(n,'"additionalItems" is ignored when "items" is not an array of schemas');return}CT(e,r)}};function CT(e,t){let{gen:n,schema:r,data:s,keyword:o,it:i}=e;i.items=!0;let a=n.const("len",qn._`${s}.length`);if(r===!1)e.setParams({len:t.length}),e.pass(qn._`${a} <= ${t.length}`);else if(typeof r=="object"&&!sl.alwaysValidSchema(i,r)){let c=n.var("valid",qn._`${a} <= ${t.length}`);n.if(qn.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:sl.Type.Num},c),!i.allErrors)n.if(qn.not(c),()=>n.break())})}}RT.validateAdditionalItems=CT;RT.default=a4});var aS=G(function(MT){Object.defineProperty(MT,"__esModule",{value:!0});MT.validateTuple=void 0;var Sm=je(),Ro=Me(),JT=xr(),c4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:n}=e;if(Array.isArray(t))return NT(e,"additionalItems",t);if(n.items=!0,Ro.alwaysValidSchema(n,t))return;e.ok(JT.validateArray(e))}};function NT(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=Ro.mergeEvaluated.items(r,n.length,a.items);let l=r.name("valid"),c=r.const("len",Sm._`${o}.length`);n.forEach((d,p)=>{if(Ro.alwaysValidSchema(a,d))return;r.if(Sm._`${c} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},l)),e.ok(l)});function u(d){let{opts:p,errSchemaPath:m}=a,g=n.length,y=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(p.strictTuples&&!y){let h=`"${i}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Ro.checkStrictMode(a,h,p.strictTuples)}}}MT.validateTuple=NT;MT.default=c4});var FT=G(function(LT){Object.defineProperty(LT,"__esModule",{value:!0});var IT=aS(),f4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>IT.validateTuple(e,"items")};LT.default=f4});var BT=G(function(WT){Object.defineProperty(WT,"__esModule",{value:!0});var wm=je(),VT=Me(),qT=xr(),HT=iS(),p4={message:({params:{len:e}})=>wm.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>wm._`{limit: ${e}}`},m4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:p4,code(e){let{schema:t,parentSchema:n,it:r}=e,{prefixItems:s}=n;if(r.items=!0,VT.alwaysValidSchema(r,t))return;if(s)HT.validateAdditionalItems(e,s);else e.ok(qT.validateArray(e))}};WT.default=m4});var zT=G(function(UT){Object.defineProperty(UT,"__esModule",{value:!0});var ht=je(),To=Me(),g4={message:({params:{min:e,max:t}})=>t===void 0?ht.str`must contain at least ${e} valid item(s)`:ht.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ht._`{minContains: ${e}}`:ht._`{minContains: ${e}, maxContains: ${t}}`},y4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:g4,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",ht._`${s}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){To.checkStrictMode(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){To.checkStrictMode(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(To.alwaysValidSchema(o,n)){let y=ht._`${u} >= ${i}`;if(a!==void 0)y=ht._`${y} && ${u} <= ${a}`;e.pass(y);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(ht._`${s}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let y=t.name("_valid"),h=t.let("count",0);m(y,()=>t.if(y,()=>g(h)))}function m(y,h){t.forRange("i",0,u,(x)=>{e.subschema({keyword:"contains",dataProp:x,dataPropType:To.Type.Num,compositeRule:!0},y),h()})}function g(y){if(t.code(ht._`${y}++`),a===void 0)t.if(ht._`${y} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ht._`${y} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ht._`${y} >= ${i}`,()=>t.assign(d,!0))}}};UT.default=y4});var vm=G(function(YT){Object.defineProperty(YT,"__esModule",{value:!0});YT.validateSchemaDeps=YT.validatePropertyDeps=YT.error=void 0;var ol=je(),KT=Me(),ys=xr();YT.error={message:({params:{property:e,depsCount:t,deps:n}})=>ol.str`must have ${t===1?"property":"properties"} ${n} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:n,missingProperty:r}})=>ol._`{property: ${e},
|
|
637
685
|
missingProperty: ${r},
|
|
638
686
|
depsCount: ${t},
|
|
639
|
-
deps: ${n}}`};var eK={keyword:"dependencies",type:"object",schemaType:"object",error:TC.error,code(e){let[t,n]=tK(e);CC(e,t),RC(e,n)}};function tK({schema:e}){let t={},n={};for(let r in e){if(r==="__proto__")continue;let s=Array.isArray(e[r])?t:n;s[r]=e[r]}return[t,n]}function CC(e,t=e.schema){let{gen:n,data:r,it:s}=e;if(Object.keys(t).length===0)return;let o=n.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let l=Br.propertyInData(n,r,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)n.if(l,()=>{for(let c of a)Br.checkReportMissingProp(e,c)});else n.if(Pa._`${l} && (${Br.checkMissingProp(e,a,o)})`),Br.reportMissingProp(e,o),n.else()}}TC.validatePropertyDeps=CC;function RC(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(AC.alwaysValidSchema(o,t[a]))continue;n.if(Br.propertyInData(n,r,a,o.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(l,i)},()=>n.var(i,!0)),e.ok(i)}}TC.validateSchemaDeps=RC;TC.default=eK});var DC=B(function(IC){Object.defineProperty(IC,"__esModule",{value:!0});var tp=$e(),MC=Ce(),sK={message:"property name must be valid",params:({params:e})=>tp._`{propertyName: ${e.propertyName}}`},oK={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:sK,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(MC.alwaysValidSchema(s,n))return;let o=t.name("valid");t.forIn("key",r,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(tp.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};IC.default=oK});var Ob=B(function(LC){Object.defineProperty(LC,"__esModule",{value:!0});var so=er(),St=$e(),aK=Zn(),oo=Ce(),lK={message:"must NOT have additional properties",params:({params:e})=>St._`{additionalProperty: ${e.additionalProperty}}`},cK={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:lK,code(e){let{gen:t,schema:n,parentSchema:r,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:l}=i;if(i.props=!0,l.removeAdditional!=="all"&&oo.alwaysValidSchema(i,n))return;let c=so.allSchemaProperties(r.properties),u=so.allSchemaProperties(r.patternProperties);d(),e.ok(St._`${o} === ${aK.default.errors}`);function d(){t.forIn("key",s,(h)=>{if(!c.length&&!u.length)g(h);else t.if(p(h),()=>g(h))})}function p(h){let x;if(c.length>8){let k=oo.schemaRefOrVal(i,r.properties,"properties");x=so.isOwnProperty(t,k,h)}else if(c.length)x=St.or(...c.map((k)=>St._`${h} === ${k}`));else x=St.nil;if(u.length)x=St.or(x,...u.map((k)=>St._`${so.usePattern(e,k)}.test(${h})`));return St.not(x)}function m(h){t.code(St._`delete ${s}[${h}]`)}function g(h){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){m(h);return}if(n===!1){if(e.setParams({additionalProperty:h}),e.error(),!a)t.break();return}if(typeof n=="object"&&!oo.alwaysValidSchema(i,n)){let x=t.name("valid");if(l.removeAdditional==="failing")b(h,x,!1),t.if(St.not(x),()=>{e.reset(),m(h)});else if(b(h,x),!a)t.if(St.not(x),()=>t.break())}}function b(h,x,k){let w={keyword:"additionalProperties",dataProp:h,dataPropType:oo.Type.Str};if(k===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,x)}}};LC.default=cK});var HC=B(function(qC){Object.defineProperty(qC,"__esModule",{value:!0});var VC=ya(),np=er(),ka=Ce(),FC=Ob(),fK={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,parentSchema:r,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&r.additionalProperties===void 0)FC.default.code(new VC.KeywordCxt(o,FC.default,"additionalProperties"));let i=np.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=ka.mergeEvaluated.props(t,ka.toHash(i),o.props);let a=i.filter((d)=>!ka.alwaysValidSchema(o,n[d]));if(a.length===0)return;let l=t.name("valid");for(let d of a){if(c(d))u(d);else{if(t.if(np.propertyInData(t,s,d,o.opts.ownProperties)),u(d),!o.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(l)}function c(d){return o.opts.useDefaults&&!o.compositeRule&&n[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};qC.default=fK});var BC=B(function(WC){Object.defineProperty(WC,"__esModule",{value:!0});var rp=er(),io=$e(),sp=Ce(),op=Ce(),pK={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=rp.allSchemaProperties(n),l=a.filter((b)=>sp.alwaysValidSchema(o,n[b]));if(a.length===0||l.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&s.properties,u=t.name("valid");if(o.props!==!0&&!(o.props instanceof io.Name))o.props=op.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let b of a){if(c)m(b);if(o.allErrors)g(b);else t.var(u,!0),g(b),t.if(u)}}function m(b){for(let h in c)if(new RegExp(b).test(h))sp.checkStrictMode(o,`property ${h} matches pattern ${b} (use allowMatchingProperties)`)}function g(b){t.forIn("key",r,(h)=>{t.if(io._`${rp.usePattern(e,b)}.test(${h})`,()=>{let x=l.includes(b);if(!x)e.subschema({keyword:"patternProperties",schemaProp:b,dataProp:h,dataPropType:op.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(io._`${d}[${h}]`,!0);else if(!x&&!o.allErrors)t.if(io.not(u),()=>t.break())})})}}};WC.default=pK});var KC=B(function(zC){Object.defineProperty(zC,"__esModule",{value:!0});var UC=Ce(),hK={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(UC.alwaysValidSchema(r,n)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};zC.default=hK});var YC=B(function(XC){Object.defineProperty(XC,"__esModule",{value:!0});var GC=er(),yK={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:GC.validateUnion,error:{message:"must match a schema in anyOf"}};XC.default=yK});var eR=B(function(QC){Object.defineProperty(QC,"__esModule",{value:!0});var ao=$e(),ZC=Ce(),bK={message:"must match exactly one schema in oneOf",params:({params:e})=>ao._`{passingSchemas: ${e.passing}}`},$K={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:bK,code(e){let{gen:t,schema:n,parentSchema:r,it:s}=e;if(!Array.isArray(n))throw Error("ajv implementation error");if(s.opts.discriminator&&r.discriminator)return;let o=n,i=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){o.forEach((u,d)=>{let p;if(ZC.alwaysValidSchema(s,u))t.var(l,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l);if(d>0)t.if(ao._`${l} && ${i}`).assign(i,!1).assign(a,ao._`[${a}, ${d}]`).else();t.if(l,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,ao.Name)})})}}};QC.default=$K});var rR=B(function(nR){Object.defineProperty(nR,"__esModule",{value:!0});var tR=Ce(),wK={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:n,it:r}=e;if(!Array.isArray(n))throw Error("ajv implementation error");let s=t.name("valid");n.forEach((o,i)=>{if(tR.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};nR.default=wK});var iR=B(function(oR){Object.defineProperty(oR,"__esModule",{value:!0});var lo=$e(),ip=Ce(),EK={message:({params:e})=>lo.str`must match "${e.ifClause}" schema`,params:({params:e})=>lo._`{failingKeyword: ${e.ifClause}}`},jK={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:EK,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)ip.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=sR(r,"then"),o=sR(r,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&o){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else if(s)t.if(a,c("then"));else t.if(lo.not(a),c("else"));e.pass(i,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,d){return()=>{let p=e.subschema({keyword:u},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,lo._`${u}`);else e.setParams({ifClause:u})}}}};function sR(e,t){let n=e.schema[t];return n!==void 0&&!ip.alwaysValidSchema(e,n)}oR.default=jK});var cR=B(function(lR){Object.defineProperty(lR,"__esModule",{value:!0});var aR=Ce(),kK={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)aR.checkStrictMode(n,`"${e}" without "if" is ignored`)}};lR.default=kK});var Ab=B(function(uR){Object.defineProperty(uR,"__esModule",{value:!0});var OK=kb(),AK=wC(),CK=_b(),RK=kC(),TK=OC(),NK=ep(),JK=DC(),MK=Ob(),IK=HC(),DK=BC(),LK=KC(),FK=YC(),VK=eR(),qK=rR(),HK=iR(),WK=cR();function BK(e=!1){let t=[LK.default,FK.default,VK.default,qK.default,HK.default,WK.default,JK.default,MK.default,NK.default,IK.default,DK.default];if(e)t.push(AK.default,RK.default);else t.push(OK.default,CK.default);return t.push(TK.default),t}uR.default=BK});var Cb=B(function(pR){Object.defineProperty(pR,"__esModule",{value:!0});pR.dynamicAnchor=void 0;var _a=$e(),zK=Zn(),ap=hc(),fR=Gd(),KK={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>dR(e,e.schema)};function dR(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=_a._`${zK.default.dynamicAnchors}${_a.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:GK(e);n.if(_a._`!${s}`,()=>n.assign(s,o))}pR.dynamicAnchor=dR;function GK(e){let{schemaEnv:t,schema:n,self:r}=e.it,{root:s,baseId:o,localRefs:i,meta:a}=t.root,{schemaId:l}=r.opts,c=new ap.SchemaEnv({schema:n,schemaId:l,root:s,baseId:o,localRefs:i,meta:a});return ap.compileSchema.call(r,c),fR.getValidate(e,c)}pR.default=KK});var Rb=B(function(gR){Object.defineProperty(gR,"__esModule",{value:!0});gR.dynamicRef=void 0;var lp=$e(),YK=Zn(),cp=Gd(),ZK={keyword:"$dynamicRef",schemaType:"string",code:(e)=>hR(e,e.schema)};function hR(e,t){let{gen:n,keyword:r,it:s}=e;if(t[0]!=="#")throw Error(`"${r}" only supports hash fragment reference`);let o=t.slice(1);if(s.allErrors)i();else{let l=n.let("valid",!1);i(l),e.ok(l)}function i(l){if(s.schemaEnv.root.dynamicAnchors[o]){let c=n.let("_v",lp._`${YK.default.dynamicAnchors}${lp.getProperty(o)}`);n.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>n.block(()=>{cp.callRef(e,l),n.let(c,!0)}):()=>cp.callRef(e,l)}}gR.dynamicRef=hR;gR.default=ZK});var SR=B(function($R){Object.defineProperty($R,"__esModule",{value:!0});var xR=Cb(),bR=Ce(),e9={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)xR.dynamicAnchor(e,"");else bR.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};$R.default=e9});var ER=B(function(vR){Object.defineProperty(vR,"__esModule",{value:!0});var wR=Rb(),n9={keyword:"$recursiveRef",schemaType:"string",code:(e)=>wR.dynamicRef(e,e.schema)};vR.default=n9});var PR=B(function(jR){Object.defineProperty(jR,"__esModule",{value:!0});var s9=Cb(),o9=Rb(),i9=SR(),a9=ER(),l9=[s9.default,o9.default,i9.default,a9.default];jR.default=l9});var _R=B(function(kR){Object.defineProperty(kR,"__esModule",{value:!0});var up=ep(),u9={keyword:"dependentRequired",type:"object",schemaType:"object",error:up.error,code:(e)=>up.validatePropertyDeps(e)};kR.default=u9});var CR=B(function(AR){Object.defineProperty(AR,"__esModule",{value:!0});var OR=ep(),d9={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>OR.validateSchemaDeps(e)};AR.default=d9});var NR=B(function(TR){Object.defineProperty(TR,"__esModule",{value:!0});var RR=Ce(),m9={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)RR.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};TR.default=m9});var MR=B(function(JR){Object.defineProperty(JR,"__esModule",{value:!0});var g9=_R(),y9=CR(),x9=NR(),b9=[g9.default,y9.default,x9.default];JR.default=b9});var DR=B(function(IR){Object.defineProperty(IR,"__esModule",{value:!0});var tn=$e(),fp=Ce(),S9=Zn(),w9={message:"must NOT have unevaluated properties",params:({params:e})=>tn._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},v9={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:w9,code(e){let{gen:t,schema:n,data:r,errsCount:s,it:o}=e;if(!s)throw Error("ajv implementation error");let{allErrors:i,props:a}=o;if(a instanceof tn.Name)t.if(tn._`${a} !== true`,()=>t.forIn("key",r,(d)=>t.if(c(a,d),()=>l(d))));else if(a!==!0)t.forIn("key",r,(d)=>a===void 0?l(d):t.if(u(a,d),()=>l(d)));o.props=!0,e.ok(tn._`${s} === ${S9.default.errors}`);function l(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!fp.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:fp.Type.Str},p),!i)t.if(tn.not(p),()=>t.break())}}function c(d,p){return tn._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let g in d)if(d[g]===!0)m.push(tn._`${p} !== ${g}`);return tn.and(...m)}}};IR.default=v9});var FR=B(function(LR){Object.defineProperty(LR,"__esModule",{value:!0});var Pn=$e(),dp=Ce(),j9={message:({params:{len:e}})=>Pn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Pn._`{limit: ${e}}`},P9={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:j9,code(e){let{gen:t,schema:n,data:r,it:s}=e,o=s.items||0;if(o===!0)return;let i=t.const("len",Pn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(Pn._`${i} > ${o}`);else if(typeof n=="object"&&!dp.alwaysValidSchema(s,n)){let l=t.var("valid",Pn._`${i} <= ${o}`);t.if(Pn.not(l),()=>a(l,o)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,i,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:dp.Type.Num},l),!s.allErrors)t.if(Pn.not(l),()=>t.break())})}}};LR.default=P9});var qR=B(function(VR){Object.defineProperty(VR,"__esModule",{value:!0});var _9=DR(),O9=FR(),A9=[_9.default,O9.default];VR.default=A9});var WR=B(function(HR){Object.defineProperty(HR,"__esModule",{value:!0});var ve=$e(),R9={message:({schemaCode:e})=>ve.str`must match format "${e}"`,params:({schemaCode:e})=>ve._`{format: ${e}}`},T9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:R9,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;if(s)p();else m();function p(){let g=n.scopeValue("formats",{ref:d.formats,code:l.code.formats}),b=n.const("fDef",ve._`${g}[${i}]`),h=n.let("fType"),x=n.let("format");n.if(ve._`typeof ${b} == "object" && !(${b} instanceof RegExp)`,()=>n.assign(h,ve._`${b}.type || "string"`).assign(x,ve._`${b}.validate`),()=>n.assign(h,ve._`"string"`).assign(x,b)),e.fail$data(ve.or(k(),w()));function k(){if(l.strictSchema===!1)return ve.nil;return ve._`${i} && !${x}`}function w(){let v=u.$async?ve._`(${b}.async ? await ${x}(${r}) : ${x}(${r}))`:ve._`${x}(${r})`,E=ve._`(typeof ${x} == "function" ? ${v} : ${x}.test(${r}))`;return ve._`${x} && ${x} !== true && ${h} === ${t} && !${E}`}}function m(){let g=d.formats[o];if(!g){k();return}if(g===!0)return;let[b,h,x]=w(g);if(b===t)e.pass(v());function k(){if(l.strictSchema===!1){d.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function w(E){let O=E instanceof RegExp?ve.regexpCode(E):l.code.formats?ve._`${l.code.formats}${ve.getProperty(o)}`:void 0,I=n.scopeValue("formats",{key:o,ref:E,code:O});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,ve._`${I}.validate`];return["string",E,I]}function v(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw Error("async format in sync schema");return ve._`await ${x}(${r})`}return typeof h=="function"?ve._`${x}(${r})`:ve._`${x}.test(${r})`}}}};HR.default=T9});var Tb=B(function(BR){Object.defineProperty(BR,"__esModule",{value:!0});var J9=WR(),M9=[J9.default];BR.default=M9});var Nb=B(function(UR){Object.defineProperty(UR,"__esModule",{value:!0});UR.contentVocabulary=UR.metadataVocabulary=void 0;UR.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];UR.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var GR=B(function(KR){Object.defineProperty(KR,"__esModule",{value:!0});var L9=jb(),F9=Pb(),V9=Ab(),q9=PR(),H9=MR(),W9=qR(),B9=Tb(),pp=Nb(),U9=[q9.default,L9.default,F9.default,(0,V9.default)(!0),B9.default,pp.metadataVocabulary,pp.contentVocabulary,H9.default,W9.default];KR.default=U9});var QR=B(function(YR){Object.defineProperty(YR,"__esModule",{value:!0});YR.DiscrError=void 0;var XR;(function(e){e.Tag="tag",e.Mapping="mapping"})(XR||(YR.DiscrError=XR={}))});var Jb=B(function(tT){Object.defineProperty(tT,"__esModule",{value:!0});var nr=$e(),Oa=QR(),mp=hc(),K9=ba(),eT=Ce(),G9={message:({params:{discrError:e,tagName:t}})=>e===Oa.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>nr._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},X9={keyword:"discriminator",type:"object",schemaType:"object",error:G9,code(e){let{gen:t,data:n,schema:r,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=r.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(r.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",nr._`${n}${nr.getProperty(a)}`);t.if(nr._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:Oa.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=p();t.if(!1);for(let g in m)t.elseIf(nr._`${c} === ${g}`),t.assign(l,d(m[g]));t.else(),e.error(!1,{discrError:Oa.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let g=t.name("valid"),b=e.subschema({keyword:"oneOf",schemaProp:m},g);return e.mergeEvaluated(b,nr.Name),g}function p(){var m;let g={},b=x(s),h=!0;for(let v=0;v<i.length;v++){let E=i[v];if((E===null||E===void 0?void 0:E.$ref)&&!eT.schemaHasRulesButRef(E,o.self.RULES)){let I=E.$ref;if(E=mp.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,I),E instanceof mp.SchemaEnv)E=E.schema;if(E===void 0)throw new K9.default(o.opts.uriResolver,o.baseId,I)}let O=(m=E===null||E===void 0?void 0:E.properties)===null||m===void 0?void 0:m[a];if(typeof O!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);h=h&&(b||x(E)),k(O,v)}if(!h)throw Error(`discriminator: "${a}" must be required`);return g;function x({required:v}){return Array.isArray(v)&&v.includes(a)}function k(v,E){if(v.const)w(v.const,E);else if(v.enum)for(let O of v.enum)w(O,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(v,E){if(typeof v!="string"||v in g)throw Error(`discriminator: "${a}" values must be unique strings`);g[v]=E}}}};tT.default=X9});var nT=B(function(uie,Z9){Z9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}});var rT=B(function(fie,Q9){Q9.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}});var sT=B(function(die,e4){e4.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}});var oT=B(function(pie,t4){t4.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}});var iT=B(function(mie,n4){n4.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}});var aT=B(function(hie,r4){r4.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}});var lT=B(function(gie,s4){s4.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var cT=B(function(yie,o4){o4.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var fT=B(function(uT){Object.defineProperty(uT,"__esModule",{value:!0});var i4=nT(),a4=rT(),l4=sT(),c4=oT(),u4=iT(),f4=aT(),d4=lT(),p4=cT(),m4=["/properties"];function h4(e){return[i4,a4,l4,c4,u4,t(this,f4),d4,t(this,p4)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,m4):r}}uT.default=h4});var Db=B(function(kn,Ib){Object.defineProperty(kn,"__esModule",{value:!0});kn.MissingRefError=kn.ValidationError=kn.CodeGen=kn.Name=kn.nil=kn.stringify=kn.str=kn._=kn.KeywordCxt=kn.Ajv2020=void 0;var y4=Eb(),x4=GR(),b4=Jb(),$4=fT(),Mb="https://json-schema.org/draft/2020-12/schema";class xc extends y4.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),x4.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(b4.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;$4.default.call(this,e),this.refs["http://json-schema.org/schema"]=Mb}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Mb)?Mb:void 0)}}kn.Ajv2020=xc;Ib.exports=kn=xc;Ib.exports.Ajv2020=xc;Object.defineProperty(kn,"__esModule",{value:!0});kn.default=xc;var S4=ya();Object.defineProperty(kn,"KeywordCxt",{enumerable:!0,get:function(){return S4.KeywordCxt}});var Aa=$e();Object.defineProperty(kn,"_",{enumerable:!0,get:function(){return Aa._}});Object.defineProperty(kn,"str",{enumerable:!0,get:function(){return Aa.str}});Object.defineProperty(kn,"stringify",{enumerable:!0,get:function(){return Aa.stringify}});Object.defineProperty(kn,"nil",{enumerable:!0,get:function(){return Aa.nil}});Object.defineProperty(kn,"Name",{enumerable:!0,get:function(){return Aa.Name}});Object.defineProperty(kn,"CodeGen",{enumerable:!0,get:function(){return Aa.CodeGen}});var w4=pc();Object.defineProperty(kn,"ValidationError",{enumerable:!0,get:function(){return w4.default}});var v4=ba();Object.defineProperty(kn,"MissingRefError",{enumerable:!0,get:function(){return v4.default}})});import{existsSync as gp,readFileSync as mT}from"node:fs";import{createRequire as dT}from"node:module";import{basename as P4,isAbsolute as k4,relative as _4,resolve as Lb}from"node:path";import{fileURLToPath as pT,pathToFileURL as O4}from"node:url";function hp(e){return JSON.parse(mT(e,"utf8"))}async function hT(e){let t=Lb(e),n=Un(t),r=Lb(t,"project.schema.json");if(!gp(n))throw Error(`No project.jxn or project.json in ${t}`);if(!gp(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s=du(mT(n,"utf8"),n),o=hp(r);o.$id=O4(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Sr(Db(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new i({allErrors:!0,loadSchema:(d)=>R4(d,t),strict:!1}).compileAsync(o),c=l(s),u=l.errors??null;return{errors:u&&rs(n)?C4(u,s):u,file:P4(n),valid:c}}function A4(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");n=Array.isArray(n)?n[Number(s)]:L(n)?n[s]:void 0}return n}function C4(e,t){return e.map((n)=>{if(!F(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!F(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!_(n.instancePath))return n;let r=A4(t,n.instancePath),s=pt(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
|
|
640
|
-
`)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function R4(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let n=pT(e),r=_4(t,n);if(r.startsWith("..")||k4(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(gp(n))return hp(n);let s=r.split("\\").join("/"),o="node_modules/",i=s.lastIndexOf(o);if(i===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(i+o.length),l="@jxsuite/schema/",c;try{c=dT(Lb(t,"package.json")).resolve(a)}catch(u){if(!a.startsWith(l))throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the `+"project — is the package installed?",{cause:u});try{c=dT(import.meta.url).resolve(a)}catch(d){let p=pT(new URL(`../${a.slice(l.length)}`,import.meta.url));if(gp(p))return hp(p);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:d})}}return hp(c)}var gT=M(()=>{ae();ru();uu();pu();ko()});function zr(e){return L(e.attributes)?e.attributes:{}}function nn(e,t){let n=zr(e)[t];return _(n)?n:null}function Pt(e){return _(e.tagName)?e.tagName.toLowerCase():""}function fn(e,t="the popover"){let n=_(e.id)?e.id:nn(e,"id");if(n)return`#${n}`;let r=Pt(e);return r===""?t:`the <${r}>`}function J4(e){let t=zr(e).popover;return _(t)?t:null}function xT(e){let t=new Set,n=new Set;for(let r of e){let s=r!==null&&_(r.tagName)?r.tagName:"";if(r===null||!s.includes("-"))continue;if(Fb(r))t.add(s);let o=r.observedAttributes;if(Array.isArray(o)&&M4.every((i)=>o.includes(i)))n.add(s)}return{invokerTags:n,popoverTags:t}}function Fb(e){return"popover"in zr(e)||"popover"in e}function bc(e,t){return Fb(e)||(t?.popoverTags?.has(Pt(e))??!1)}function co(e){if(_(e.id)&&e.id!=="")return e.id;let t=nn(e,"id");return t===""?null:t}function*Ur(e,t=[],n=null,r){yield{enclosing:n,node:e,path:t};let s=bc(e,r)?e:n,{children:o}=e;if(Array.isArray(o)){for(let[l,c]of o.entries())if(F(c))yield*Ur(c,[...t,"children",l],s,r)}else if(L(o)&&Ct(o.map))yield*Ur(o.map,[...t,"children","map"],s,r);let i=Ct(e.map)?e.map:null;if(i)yield*Ur(i,[...t,"map"],s,r);let a=L(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(F(c))yield*Ur(c,[...t,"cases",l],s,r)}function Vb(e,t){let n=[];for(let{node:r}of Ur(e,[],null,t)){if(!bc(r,t))continue;let s=co(r);if(s!==null&&!n.includes(s))n.push(s)}return n}function yp(e){return e.startsWith("@")}function bT(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function un(e,t){let n=e?.[t];if(n===void 0||yo(n)||Array.isArray(n))return null;return String(n)}function $T(e){for(let[t,n]of Object.entries(e??{})){if(!yo(n))continue;if(bT(t)&&t.includes(":popover-open")&&un(n,"display")!==null)return!0;if(yp(t)&&$T(n))return!0}return!1}function ST(e){for(let[t,n]of Object.entries(e??{})){if(!yo(n))continue;if(bT(t)&&t.includes(":popover-open"))return!0;if(yp(t)&&ST(n))return!0}return!1}function D4(e){return I4.some((t)=>un(e,t)!==null)}function L4(e){if(!e)return[];let t=[];for(let[n,r]of Object.entries(e))if(yp(n)&&yo(r)&&un(r,"display")!==null)t.push(n);return t}function wT(e){if(!e)return[];let t=[],n=un(e,"transition");if(n!==null)t.push(n);for(let[r,s]of Object.entries(e))if(yp(r)&&yo(s))t.push(...wT(s));return t}function F4(e){if(!e)return!1;if(un(e,"positionAnchor")!==null||un(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(un(e,t)??"").includes("anchor("))}function V4(e){if(!e)return!1;if(un(e,"positionArea")!==null||un(e,"position-area")!==null||un(e,"positionTryFallbacks")!==null||un(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function vT(e,t){let n=[...Ur(e,[],null,t)],r=Vb(e,t),s=n.some(({node:a})=>bc(a,t)),o=new Set;for(let{node:a}of n)if(yT.has(Pt(a))){let l=nn(a,"popovertarget");if(l!==null)o.add(l)}let i=[];for(let{enclosing:a,node:l,path:c}of n)if(i.push(...q4(l,c,a,r,s,t)),Fb(l))i.push(...H4(l,c,o));return i}function q4(e,t,n,r,s,o){let i=[],a=Pt(e),l=nn(e,"popovertarget"),c=yT.has(a)||(o?.invokerTags?.has(a)??!1);if(l!==null&&!c)return i.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${lt}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),i;if(l!==null){if(s&&!r.includes(l)){let u=r.length>0?`The popovers here are: ${r.map((d)=>`"${d}"`).join(", ")}. `:"";i.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${u}A target that names nothing does nothing, silently. ${lt}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(n!==null&&co(n)!==null&&co(n)!==l)i.push({detail:`This control is inside ${fn(n)} but targets "${l}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${lt}`,message:`A control inside ${fn(n)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&n!==null&&l===null){let u=nn(e,"href")??(_(e.href)?e.href:null),d=nn(e,"target")==="_blank",p=u!==null&&u.includes("#");if(d||p){let m=d?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";i.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${lt}`,message:`A link inside ${fn(n)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return i}function H4(e,t,n){let r=[],{style:s}=e,o=fn(e),i=J4(e);if(i!==null&&i!==""&&!N4.some((c)=>c===i))r.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${lt}`,fix:"mode",message:`${o} declares popover="${i}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if(Xe(zr(e).popover))r.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${lt}`,fix:"mode",message:`${o} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=un(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")r.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${lt}`,fix:"display",message:`${o} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of L4(s))r.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${lt}`,fix:"display",message:`${o} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(un(s,"visibility")!==null)r.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${lt}`,fix:"display",message:`${o} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!ST(s))r.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${lt}`,message:`${o} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!$T(s)&&a===null&&D4(s))r.push({detail:`${o} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${lt}`,fix:"open-display",message:`${o} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of wT(s))if(c.includes("display")&&!c.includes("overlay")){r.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${lt}`,message:`${o} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(F4(s)&&!V4(s))r.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${lt}`,message:`${o} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=co(e);if(l!==null&&!n.has(l))r.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${lt}`,message:`${o} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return r}var N4,yT,M4,I4,lt="See docs/framework/concepts/overlays.";var xp=M(()=>{ae();N4=["auto","manual","hint"],yT=new Set(["button","input"]);M4=["popovertarget","popovertargetaction","command","commandfor"];I4=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function Na(e,t){let n=zr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(pe(r)||L(r))return{kind:"bound"};if(_(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function Ra(e,t){let n=Na(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function rn(e,t){return Na(e,t).kind!=="absent"}function uo(e){let t=Na(e,"role");if(t.kind==="bound")return Ta;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function bp(e){let t=Na(e,"id");if(t.kind==="bound")return Ta;return t.kind==="text"&&t.text!==""?t.text:null}function rr(e,t){let n=Na(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function $p(e){let t=e.textContent;if(_(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(rr(e,"aria-label")||rn(e,"aria-labelledby"))return!0;if(Pt(e)==="img"&&(rr(e,"alt")||rr(e,"title")))return!0;if(Pt(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(_(s)){if(s.trim()!=="")return!0}else if(F(s)&&$p(s))return!0}else if(n!=null)return!0;if(L(e.map))return!0;return(L(e.cases)?Object.values(e.cases):[]).some((s)=>Ct(s)&&$p(s))}function*Ca(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,uo(e)],o=[...r,Pt(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,l]of i.entries())if(F(l))yield*Ca(l,[...t,"children",a],s,o)}else if(L(i)&&Ct(i.map))yield*Ca(i.map,[...t,"children","map"],s,o);if(Ct(e.map))yield*Ca(e.map,[...t,"map"],s,o);if(L(e.cases)){for(let[a,l]of Object.entries(e.cases))if(F(l))yield*Ca(l,[...t,"cases",a],s,o)}}function G4(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${W4}`,message:n,path:t,rule:e,severity:o}}function ET(e,t,n){if(n.includes("label"))return!0;if(e===Ta||t.bound)return!0;return e!==null&&t.ids.has(e)}function X4(e,t){let{node:n,path:r,tags:s}=e,o=Pt(n),i=uo(n);if(i==="bound")return null;if(rr(n,"aria-label")||rn(n,"aria-labelledby")||rr(n,"title"))return null;let l=fn(n,"the control"),c=(d)=>Kr("interactive-unnamed",r,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${d}`,"4.1.2"),u=Y4(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&B4.has(i))return $p(n)?null:c("Give it text content, or an aria-label.");if(i!==null&&U4.has(i))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(i!==null)return null;if(o==="button"||o==="summary"||o==="a"&&rn(n,"href"))return $p(n)?null:c("Give it text content, or an aria-label.");if(u==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return c("Give it a value, or an aria-label.");if(u==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function Y4(e,t,n,r){if(t==="area"){if(!rn(e,"href"))return"none";return rr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return ET(bp(e),n,r)||rr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Ra(e,"type")??"text").toLowerCase();if(s==="hidden"||rn(e,"type")&&Ra(e,"type")===null)return"exempt";if(z4.has(s))return rr(e,"value")?"named":"unnamed-value";if(s==="image")return rr(e,"alt")?"named":"unnamed-alt";return ET(bp(e),n,r)||rr(e,"placeholder")?"named":"unnamed"}function Q4(e){let{node:t,path:n,tags:r}=e,s=Pt(t);if(!s.includes("-")||!r.some((o)=>Z4.has(o)))return null;return Kr("custom-element-in-select",n,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function e3(e){let{node:t,path:n}=e;if(Pt(t)!=="img")return null;let r=uo(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(rn(t,"alt")||rr(t,"aria-label")||rn(t,"aria-labelledby"))return null;return Kr("img-alt-missing",n,`${fn(t,"the image")} has no alt text.`,'An image with no alt is announced by its file name. Describe it in alt, or write alt="" for a decorative one.',"1.1.1")}function n3(e,t){let{node:n,path:r}=e,s=[];for(let o of t3){let i=Ra(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",r,`${fn(n,"the element")} points ${o} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function r3(e,t,n){for(let r of jT.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===Ta&&s.ids.size>0)return!0;if(e!==null&&e!==Ta&&s.ids.has(e))return!0}return!1}function s3(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=uo(n);if(i===null||i==="bound"||r.length===0||G4(o))return null;if(s.includes("bound")||r3(bp(n),i,t))return null;let a=fn(n,"the element");if(i==="tab"&&!s.includes("tablist"))return Kr("tab-outside-tablist",r,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((i==="menuitem"||i==="menuitemcheckbox"||i==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Kr("menuitem-outside-menu",r,`${a} is a ${i} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(i==="option"&&!s.includes("listbox")&&!o.includes("select")&&!o.includes("datalist"))return Kr("option-outside-listbox",r,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function o3(e){let t=[];for(let{node:n}of Ca(e)){if(uo(n)!=="tab")continue;let r=Na(n,"aria-selected");if(r.kind==="bound")return null;t.push(r.kind==="other"&&r.isTrue||r.kind==="text"&&r.text==="true")}return t}function i3(e){let{node:t,path:n}=e;if(uo(t)!=="tablist")return null;let r=o3(t);if(r===null||r.length===0||r.includes(!0))return null;return Kr("tablist-none-selected",n,`${fn(t,"the tablist")} has ${r.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function a3(e){let{node:t,path:n}=e,r=uo(t);if(!(Pt(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(rr(t,"aria-label")||rn(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",n,`${fn(t,"the dialog")} has no accessible name.`,"A dialog is announced by its name when it opens, and its content does not name it. Give it aria-labelledby naming its heading, or an aria-label.","4.1.2")}function c3(e){let{node:t,path:n}=e;if(!rn(t,"aria-activedescendant"))return null;let r=Pt(t);if(l3.has(r)||r==="a"&&rn(t,"href")||rn(t,"tabIndex")||rn(t,"tabindex")||rn(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",n,`${fn(t,"the element")} manages focus with aria-activedescendant but cannot itself take focus.`,"aria-activedescendant names the active child of a FOCUSED container; on one that cannot be focused, the keyboard never reaches it. Give the container a tabindex.","2.1.1")}function PT(e){let t=[...Ca(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let l=uo(a);if(l!==null&&K4.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},d=Ra(a,"aria-owns");if(d===null)u.bound||=rn(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(l,u)}let c=bp(a);if(c===Ta)o=!0;else if(c!==null)n.add(c);if(Pt(a)==="label"){let u=Ra(a,"for")??Ra(a,"htmlFor");if(u===null)r.bound||=rn(a,"for")||rn(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let l=[X4(a,r),e3(a),s3(a,s),Q4(a),i3(a),a3(a),c3(a)];for(let c of l)if(c)i.push(c);if(!o)i.push(...n3(a,n))}return i}var W4="See docs/framework/concepts/accessibility.",Ta="bound",B4,U4,z4,jT,K4,Z4,t3,l3;var kT=M(()=>{ae();xp();B4=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),U4=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),z4=new Set(["button","reset","submit"]),jT=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),K4=new Set([...jT.values()].flat());Z4=new Set(["select","jx-select"]);t3=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];l3=new Set(["button","input","select","textarea"])});function qb(e){return Pt(e)==="dialog"}function _T(e){return e.startsWith("--")}function g3(e){let t=[];for(let{node:n}of Ur(e)){let r=co(n);if(qb(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function y3(e){let t=e.oncommand;return t!==void 0&&t!==null}function x3(e,t){for(let{node:n}of Ur(e)){if(n===e)continue;let r=Pt(n);if(r==="button"){let s=nn(n,"command"),o=nn(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&nn(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function AT(e,t){let n=[...Ur(e,[],null,t)],r=g3(e),s=Vb(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:c}of n){let u=co(c);if(u!==null&&!i.has(u))i.set(u,c);if(Pt(c)==="button"){let d=nn(c,"commandfor"),p=nn(c,"command");if(d!==null){let m=a.get(d)??new Set;m.add(p??""),a.set(d,m)}}}let l=[];for(let{node:c,path:u}of n)if(l.push(...b3(c,u,i,r,s,o,t)),qb(c))l.push(...$3(c,u,a));return l}function b3(e,t,n,r,s,o,i){let a=[],l=Pt(e),c=i?.invokerTags?.has(l)??!1,u=nn(e,"command"),d=nn(e,"commandfor");if(!(u!==null||d!==null||("command"in zr(e))||("commandfor"in zr(e))))return a;let m=fn(e,"the element");if(!h3.has(l)&&!c)return a.push({detail:"`command` and `commandfor` are attributes of `HTMLButtonElement` and of no other "+"interface — not even `<input>`, which `popovertarget` does allow. Elsewhere they parse "+`and do nothing. Make it a <button>, or remove both attributes. ${lt}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!p3.has(u)&&!_T(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${OT.map((g)=>`\`${g}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${lt}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let g=n.get(d),b=r.includes(d),h=s.includes(d);if(!g&&o){let x=[...r,...s].map((k)=>`"${k}"`).join(", ");return a.push({detail:`No element in this document has the id "${d}". The dialogs and popovers here are: ${x}. A commandfor that names nothing does nothing, silently. ${lt}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&g){if(u3.has(u)&&!qb(g))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${h?"a popover":`a <${Pt(g)||"element"}>`}. The click is ignored. ${h?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${lt}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(f3.has(u)&&!bc(g,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${b?"a dialog":`a <${Pt(g)||"element"}>`} that declares no \`popover\`. The click is ignored. ${b?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${lt}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(_T(u)&&!y3(g))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${lt}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function $3(e,t,n){let r=[],s=fn(e,"the dialog"),o=co(e),{style:i}=e,a=nn(e,"closedby");if(a!==null&&!m3.has(a))r.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${lt}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(un(i,"display")!==null)r.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${lt}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=o===null?void 0:n.get(o),c=nn(e,"open")!==null||zr(e).open===!0||e.open===!0;if(o!==null&&!l?.has("show-modal")&&!c)r.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${lt}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!x3(e,o))r.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${lt}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var OT,u3,f3,d3,p3,m3,h3;var CT=M(()=>{ae();xp();OT=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],u3=new Set(["show-modal","close","request-close"]),f3=new Set(["toggle-popover","show-popover","hide-popover"]),d3=["any","closerequest","none"],p3=new Set(OT),m3=new Set(d3),h3=new Set(["button"])});var VT=B(function(LT){Object.defineProperty(LT,"__esModule",{value:!0});LT.formatNames=LT.fastFormats=LT.fullFormats=void 0;function Gr(e,t){return{validate:e,compare:t}}LT.fullFormats={date:Gr(JT,Ub),time:Gr(Wb(!0),zb),"date-time":Gr(RT(!0),IT),"iso-time":Gr(Wb(),MT),"iso-date-time":Gr(RT(),DT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:P3,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:T3,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:k3,int32:{type:"number",validate:A3},int64:{type:"number",validate:C3},float:{type:"number",validate:NT},double:{type:"number",validate:NT},password:!0,binary:!0};LT.fastFormats={...LT.fullFormats,date:Gr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ub),time:Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,zb),"date-time":Gr(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,IT),"iso-time":Gr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,MT),"iso-date-time":Gr(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,DT),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};LT.formatNames=Object.keys(LT.fullFormats);function S3(e){return e%4===0&&(e%100!==0||e%400===0)}var w3=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,v3=[0,31,28,31,30,31,30,31,31,30,31,30,31];function JT(e){let t=w3.exec(e);if(!t)return!1;let n=+t[1],r=+t[2],s=+t[3];return r>=1&&r<=12&&s>=1&&s<=(r===2&&S3(n)?29:v3[r])}function Ub(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Hb=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Wb(e){return function(n){let r=Hb.exec(n);if(!r)return!1;let s=+r[1],o=+r[2],i=+r[3],a=r[4],l=r[5]==="-"?-1:1,c=+(r[6]||0),u=+(r[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-u*l,p=s-c*l-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function zb(e,t){if(!(e&&t))return;let n=new Date("2020-01-01T"+e).valueOf(),r=new Date("2020-01-01T"+t).valueOf();if(!(n&&r))return;return n-r}function MT(e,t){if(!(e&&t))return;let n=Hb.exec(e),r=Hb.exec(t);if(!(n&&r))return;if(e=n[1]+n[2]+n[3],t=r[1]+r[2]+r[3],e>t)return 1;if(e<t)return-1;return 0}var Bb=/t|\s/i;function RT(e){let t=Wb(e);return function(r){let s=r.split(Bb);return s.length===2&&JT(s[0])&&t(s[1])}}function IT(e,t){if(!(e&&t))return;let n=new Date(e).valueOf(),r=new Date(t).valueOf();if(!(n&&r))return;return n-r}function DT(e,t){if(!(e&&t))return;let[n,r]=e.split(Bb),[s,o]=t.split(Bb),i=Ub(n,s);if(i===void 0)return;return i||zb(r,o)}var E3=/\/|:/,j3=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function P3(e){return E3.test(e)&&j3.test(e)}var TT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function k3(e){return TT.lastIndex=0,TT.test(e)}var _3=-2147483648,O3=2147483647;function A3(e){return Number.isInteger(e)&&e<=O3&&e>=_3}function C3(e){return Number.isInteger(e)}function NT(){return!0}var R3=/[^\\]\\Z/;function T3(e){if(R3.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var HT=B(function(qT){Object.defineProperty(qT,"__esModule",{value:!0});var J3=jb(),M3=Pb(),I3=Ab(),D3=Tb(),Sp=Nb(),L3=[J3.default,M3.default,(0,I3.default)(),D3.default,Sp.metadataVocabulary,Sp.contentVocabulary];qT.default=L3});var WT=B(function(zie,V3){V3.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var UT=B(function(_n,Gb){Object.defineProperty(_n,"__esModule",{value:!0});_n.MissingRefError=_n.ValidationError=_n.CodeGen=_n.Name=_n.nil=_n.stringify=_n.str=_n._=_n.KeywordCxt=_n.Ajv=void 0;var q3=Eb(),H3=HT(),W3=Jb(),BT=WT(),B3=["/properties"],wp="http://json-schema.org/draft-07/schema";class $c extends q3.default{_addVocabularies(){if(super._addVocabularies(),H3.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(W3.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(BT,B3):BT;this.addMetaSchema(e,wp,!1),this.refs["http://json-schema.org/schema"]=wp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wp)?wp:void 0)}}_n.Ajv=$c;Gb.exports=_n=$c;Gb.exports.Ajv=$c;Object.defineProperty(_n,"__esModule",{value:!0});_n.default=$c;var U3=ya();Object.defineProperty(_n,"KeywordCxt",{enumerable:!0,get:function(){return U3.KeywordCxt}});var Ja=$e();Object.defineProperty(_n,"_",{enumerable:!0,get:function(){return Ja._}});Object.defineProperty(_n,"str",{enumerable:!0,get:function(){return Ja.str}});Object.defineProperty(_n,"stringify",{enumerable:!0,get:function(){return Ja.stringify}});Object.defineProperty(_n,"nil",{enumerable:!0,get:function(){return Ja.nil}});Object.defineProperty(_n,"Name",{enumerable:!0,get:function(){return Ja.Name}});Object.defineProperty(_n,"CodeGen",{enumerable:!0,get:function(){return Ja.CodeGen}});var z3=pc();Object.defineProperty(_n,"ValidationError",{enumerable:!0,get:function(){return z3.default}});var K3=ba();Object.defineProperty(_n,"MissingRefError",{enumerable:!0,get:function(){return K3.default}})});var GT=B(function(KT){Object.defineProperty(KT,"__esModule",{value:!0});KT.formatLimitDefinition=void 0;var zT=UT(),wt=$e(),fo=wt.operators,vp={formatMaximum:{okStr:"<=",ok:fo.LTE,fail:fo.GT},formatMinimum:{okStr:">=",ok:fo.GTE,fail:fo.LT},formatExclusiveMaximum:{okStr:"<",ok:fo.LT,fail:fo.GTE},formatExclusiveMinimum:{okStr:">",ok:fo.GT,fail:fo.LTE}},Y3={message:({keyword:e,schemaCode:t})=>wt.str`should be ${vp[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>wt._`{comparison: ${vp[e].okStr}, limit: ${t}}`};KT.formatLimitDefinition={keyword:Object.keys(vp),type:"string",schemaType:"string",$data:!0,error:Y3,code(e){let{gen:t,data:n,schemaCode:r,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let l=new zT.KeywordCxt(o,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",wt._`${p}[${l.schemaCode}]`);e.fail$data(wt.or(wt._`typeof ${m} != "object"`,wt._`${m} instanceof RegExp`,wt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=l.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let g=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?wt._`${i.code.formats}${wt.getProperty(p)}`:void 0});e.fail$data(d(g))}function d(p){return wt._`${p}.compare(${n}, ${r}) ${vp[s].fail} 0`}},dependencies:["format"]};var Z3=(e)=>(e.addKeyword(KT.formatLimitDefinition),e);KT.default=Z3});var QT=B(function(Sc,ZT){Object.defineProperty(Sc,"__esModule",{value:!0});var sr=VT(),e6=GT(),Ma=$e(),XT=new Ma.Name("fullFormats"),t6=new Ma.Name("fastFormats"),Yb=(e,t={keywords:!0})=>{if(Array.isArray(t))return YT(e,t,sr.fullFormats,XT),e;let[n,r]=t.mode==="fast"?[sr.fastFormats,t6]:[sr.fullFormats,XT],s=t.formats||sr.formatNames;if(YT(e,s,n,r),t.keywords)(0,e6.default)(e);return e};Yb.get=(e,t="full")=>{let r=(t==="fast"?sr.fastFormats:sr.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function YT(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=Ma._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}ZT.exports=Sc=Yb;Object.defineProperty(Sc,"__esModule",{value:!0});Sc.default=Yb});import{existsSync as nN,readFileSync as Qb,readdirSync as rN,statSync as sN}from"node:fs";import{createRequire as n6}from"node:module";import{join as oN,relative as Qo,resolve as Zb}from"node:path";async function i6(){try{let{default:e}=await Promise.resolve().then(() => Sr(Db(),1)),{default:t}=await Promise.resolve().then(() => Sr(QT(),1));return{addFormats:t,Ajv:e}}catch(e){throw Error("Project validation requires ajv and ajv-formats: bun add ajv ajv-formats",{cause:e})}}async function iN(e,t={}){let n=Zb(e),r=[],s=[],o=0;for(let v of["project.schema.json","document.schema.json"]){let E=Zb(n,v);if(!nN(E))continue;o+=1;let O=wc(E),I=f6(O);if(I.length>0)r.push({errors:I.map(({reason:D,ref:V})=>({message:`$ref "${V}" ${D} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:v})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await hT(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let a=a6(n);if(a!==void 0){let v=Lx({$defs:a}).map(({at:E,ref:O})=>({instancePath:E,message:`type reference "${O}" names no definition in project.json's $defs`}));if(v.length>0){let E=r.find((O)=>O.file===i.file);if(E===void 0)r.push({errors:v,file:i.file});else E.errors.push(...v)}}let{addFormats:l,Ajv:c}=await i6(),{document:u}=await pk(n,{write:!1}),d=new c({allErrors:!0,ownProperties:!0,strict:!1});l(d);let p=d.compile(u),m=xT(tN(n).flatMap((v)=>{try{return[JSON.parse(Qb(v,"utf8"))]}catch{return[]}}));for(let v of r6)for(let E of lN(Zb(n,v))){if(E.endsWith(".class.json"))continue;o+=1;let O=l6(E,Qo(n,E));if(s.push(...O.warnings),O.failure!==null){r.push(O.failure);continue}let I=O.document,D=eN(I,Qo(n,E));if(s.push(...D.warnings),D.failure!==null){r.push(D.failure);continue}if(p(I)){let V=I;s.push(...u6(V,Qo(n,E),m));let W=Lx(V,a);if(W.length>0)r.push({errors:W.map(({at:A,ref:J})=>({instancePath:A,message:`type reference "${J}" names no definition in this document's $defs or in project.json's $defs`})),file:Qo(n,E)})}else r.push({errors:p.errors??[],file:Qo(n,E)})}let g=new c({allErrors:!0,ownProperties:!0,strict:!1});l(g);let b=g.compile(Mx());for(let v of tN(n)){o+=1;let E=wc(v),O=eN(E,Qo(n,v));if(s.push(...O.warnings),O.failure!==null)r.push(O.failure);else if(!b(E))r.push({errors:b.errors??[],file:Qo(n,v)})}let{config:h}=as(n),x=await Rs(n,h),k=n6(import.meta.url);for(let v of x.extensions)for(let E of["project","document","fields"]){let O=v.schemas[E];if(!O)continue;o+=1;let I=new c({allErrors:!0,ownProperties:!0,strict:!1});l(I);for(let D of o6){let V=k.resolve(D);I.addSchema(wc(V))}try{I.compile(wc(O))}catch(D){r.push({errors:[{message:D instanceof Error?D.message:String(D)}],file:`${v.specifier} (${E} fragment)`})}}let w=t.strict===!0&&s.some((v)=>v.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!w}}function a6(e){try{let t=as(e).config.$defs;return L(t)?t:void 0}catch{return}}function l6(e,t){if(!rs(e))return{document:wc(e),failure:null,warnings:[]};let n=Qb(e,"utf8"),r=rm(n).map((s)=>({detail:s.message,file:t,message:`line ${s.line}, column ${s.column}: ${s.message}`,path:[],rule:"escape",severity:"warn",source:"notation"}));try{return{document:c6(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:ye(s)}],file:t},warnings:r}}}function eN(e,t){let n=[];try{yl(e,t,n)}catch(s){return{failure:{errors:[{message:ye(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function c6(e){let t=Po(e);return L(t)?t:null}function wc(e){return JSON.parse(Qb(e,"utf8"))}function u6(e,t,n){let r=[];for(let s of vT(e,n))r.push({...Ep(s),file:t,source:"popover"});for(let s of AT(e,n))r.push({...Ep(s),file:t,source:"dialog"});for(let s of PT(e))r.push({...Ep(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of Gv(e))r.push({...Ep({...s,severity:"info"}),file:t,source:"module"});return r}function Ep(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function aN(e){return e.lint.map((t)=>{let n=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${n}]`})}function f6(e){let t=[],n=new Set,r=(o)=>{let i=e;for(let a of o.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!F(i))return!1;if(i=i[l],i===void 0)return!1}return!0},s=(o)=>{if(!L(o)||n.has(o))return;n.add(o);let i=o.$ref;if(_(i)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(i))t.push({reason:"is an absolute URI editors resolve over the network",ref:i});else if(!i.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:i});else if(i.length>1&&!i.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:i});else if(i.length>1&&!r(i.slice(1)))t.push({reason:"points at no node in this document",ref:i})}for(let[a,l]of Object.entries(o)){if(!Dx.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(L(l)){if(s(l),$d.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function lN(e){if(!nN(e))return[];let t=[];for(let n of rN(e)){let r=oN(e,n);if(sN(r).isDirectory())t.push(...lN(r));else if(Bn(n))t.push(r)}return t.toSorted()}function tN(e){let t=[],n=(r)=>{for(let s of rN(r)){if(s6.has(s))continue;let o=oN(r,s);if(sN(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function cN(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=L(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var r6,s6,o6;var uN=M(()=>{os();Ft();Gu();Mk();Lk();gT();kT();CT();Fi();xp();ae();is();ji();Nx();r6=["components","pages","layouts"],s6=new Set(["node_modules","dist",".git"]),o6=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"]});Ft();import{relative as e$,resolve as fN}from"node:path";async function d6(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
687
|
+
deps: ${n}}`};var b4={keyword:"dependencies",type:"object",schemaType:"object",error:YT.error,code(e){let[t,n]=$4(e);GT(e,t),XT(e,n)}};function $4({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 GT(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=ys.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)ys.checkReportMissingProp(e,c)});else n.if(ol._`${l} && (${ys.checkMissingProp(e,a,o)})`),ys.reportMissingProp(e,o),n.else()}}YT.validatePropertyDeps=GT;function XT(e,t=e.schema){let{gen:n,data:r,keyword:s,it:o}=e,i=n.name("valid");for(let a in t){if(KT.alwaysValidSchema(o,t[a]))continue;n.if(ys.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)}}YT.validateSchemaDeps=XT;YT.default=b4});var nJ=G(function(tJ){Object.defineProperty(tJ,"__esModule",{value:!0});var Em=je(),eJ=Me(),v4={message:"property name must be valid",params:({params:e})=>Em._`{propertyName: ${e.propertyName}}`},E4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:v4,code(e){let{gen:t,schema:n,data:r,it:s}=e;if(eJ.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(Em.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};tJ.default=E4});var lS=G(function(rJ){Object.defineProperty(rJ,"__esModule",{value:!0});var Jo=xr(),Pt=je(),j4=gr(),No=Me(),O4={message:"must NOT have additional properties",params:({params:e})=>Pt._`{additionalProperty: ${e.additionalProperty}}`},k4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:O4,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=Jo.allSchemaProperties(r.properties),u=Jo.allSchemaProperties(r.patternProperties);d(),e.ok(Pt._`${o} === ${j4.default.errors}`);function d(){t.forIn("key",s,(h)=>{if(!c.length&&!u.length)g(h);else t.if(p(h),()=>g(h))})}function p(h){let x;if(c.length>8){let P=No.schemaRefOrVal(i,r.properties,"properties");x=Jo.isOwnProperty(t,P,h)}else if(c.length)x=Pt.or(...c.map((P)=>Pt._`${h} === ${P}`));else x=Pt.nil;if(u.length)x=Pt.or(x,...u.map((P)=>Pt._`${Jo.usePattern(e,P)}.test(${h})`));return Pt.not(x)}function m(h){t.code(Pt._`delete ${s}[${h}]`)}function g(h){if(l.removeAdditional==="all"||l.removeAdditional&&n===!1){m(h);return}if(n===!1){if(e.setParams({additionalProperty:h}),e.error(),!a)t.break();return}if(typeof n=="object"&&!No.alwaysValidSchema(i,n)){let x=t.name("valid");if(l.removeAdditional==="failing")y(h,x,!1),t.if(Pt.not(x),()=>{e.reset(),m(h)});else if(y(h,x),!a)t.if(Pt.not(x),()=>t.break())}}function y(h,x,P){let S={keyword:"additionalProperties",dataProp:h,dataPropType:No.Type.Str};if(P===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,x)}}};rJ.default=k4});var aJ=G(function(iJ){Object.defineProperty(iJ,"__esModule",{value:!0});var oJ=Xa(),Pm=xr(),il=Me(),sJ=lS(),A4={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)sJ.default.code(new oJ.KeywordCxt(o,sJ.default,"additionalProperties"));let i=Pm.allSchemaProperties(n);for(let d of i)o.definedProperties.add(d);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=il.mergeEvaluated.props(t,il.toHash(i),o.props);let a=i.filter((d)=>!il.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(Pm.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)}}};iJ.default=A4});var cJ=G(function(lJ){Object.defineProperty(lJ,"__esModule",{value:!0});var jm=xr(),Mo=je(),Om=Me(),km=Me(),R4={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:n,data:r,parentSchema:s,it:o}=e,{opts:i}=o,a=jm.allSchemaProperties(n),l=a.filter((y)=>Om.alwaysValidSchema(o,n[y]));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 Mo.Name))o.props=km.evaluatedPropsToName(t,o.props);let{props:d}=o;p();function p(){for(let y of a){if(c)m(y);if(o.allErrors)g(y);else t.var(u,!0),g(y),t.if(u)}}function m(y){for(let h in c)if(new RegExp(y).test(h))Om.checkStrictMode(o,`property ${h} matches pattern ${y} (use allowMatchingProperties)`)}function g(y){t.forIn("key",r,(h)=>{t.if(Mo._`${jm.usePattern(e,y)}.test(${h})`,()=>{let x=l.includes(y);if(!x)e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:h,dataPropType:km.Type.Str},u);if(o.opts.unevaluated&&d!==!0)t.assign(Mo._`${d}[${h}]`,!0);else if(!x&&!o.allErrors)t.if(Mo.not(u),()=>t.break())})})}}};lJ.default=R4});var dJ=G(function(fJ){Object.defineProperty(fJ,"__esModule",{value:!0});var uJ=Me(),J4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:n,it:r}=e;if(uJ.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"}};fJ.default=J4});var hJ=G(function(mJ){Object.defineProperty(mJ,"__esModule",{value:!0});var pJ=xr(),M4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:pJ.validateUnion,error:{message:"must match a schema in anyOf"}};mJ.default=M4});var xJ=G(function(yJ){Object.defineProperty(yJ,"__esModule",{value:!0});var Do=je(),gJ=Me(),I4={message:"must match exactly one schema in oneOf",params:({params:e})=>Do._`{passingSchemas: ${e.passing}}`},L4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:I4,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(gJ.alwaysValidSchema(s,u))t.var(l,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l);if(d>0)t.if(Do._`${l} && ${i}`).assign(i,!1).assign(a,Do._`[${a}, ${d}]`).else();t.if(l,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,Do.Name)})})}}};yJ.default=L4});var SJ=G(function($J){Object.defineProperty($J,"__esModule",{value:!0});var bJ=Me(),V4={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(bJ.alwaysValidSchema(r,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};$J.default=V4});var EJ=G(function(vJ){Object.defineProperty(vJ,"__esModule",{value:!0});var Io=je(),_m=Me(),H4={message:({params:e})=>Io.str`must match "${e.ifClause}" schema`,params:({params:e})=>Io._`{failingKeyword: ${e.ifClause}}`},W4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:H4,code(e){let{gen:t,parentSchema:n,it:r}=e;if(n.then===void 0&&n.else===void 0)_m.checkStrictMode(r,'"if" without "then" and "else" is ignored');let s=wJ(r,"then"),o=wJ(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(Io.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,Io._`${u}`);else e.setParams({ifClause:u})}}}};function wJ(e,t){let n=e.schema[t];return n!==void 0&&!_m.alwaysValidSchema(e,n)}vJ.default=W4});var OJ=G(function(jJ){Object.defineProperty(jJ,"__esModule",{value:!0});var PJ=Me(),U4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:n}){if(t.if===void 0)PJ.checkStrictMode(n,`"${e}" without "if" is ignored`)}};jJ.default=U4});var cS=G(function(kJ){Object.defineProperty(kJ,"__esModule",{value:!0});var K4=iS(),G4=FT(),X4=aS(),Y4=BT(),Z4=zT(),Q4=vm(),eG=nJ(),tG=lS(),nG=aJ(),rG=cJ(),sG=dJ(),oG=hJ(),iG=xJ(),aG=SJ(),lG=EJ(),cG=OJ();function uG(e=!1){let t=[sG.default,oG.default,iG.default,aG.default,lG.default,cG.default,eG.default,tG.default,Q4.default,nG.default,rG.default];if(e)t.push(G4.default,Y4.default);else t.push(K4.default,X4.default);return t.push(Z4.default),t}kJ.default=uG});var uS=G(function(CJ){Object.defineProperty(CJ,"__esModule",{value:!0});CJ.dynamicAnchor=void 0;var al=je(),dG=gr(),Am=$u(),_J=xm(),pG={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>AJ(e,e.schema)};function AJ(e,t){let{gen:n,it:r}=e;r.schemaEnv.root.dynamicAnchors[t]=!0;let s=al._`${dG.default.dynamicAnchors}${al.getProperty(t)}`,o=r.errSchemaPath==="#"?r.validateName:mG(e);n.if(al._`!${s}`,()=>n.assign(s,o))}CJ.dynamicAnchor=AJ;function mG(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 Am.SchemaEnv({schema:n,schemaId:l,root:s,baseId:o,localRefs:i,meta:a});return Am.compileSchema.call(r,c),_J.getValidate(e,c)}CJ.default=pG});var fS=G(function(JJ){Object.defineProperty(JJ,"__esModule",{value:!0});JJ.dynamicRef=void 0;var Cm=je(),gG=gr(),Rm=xm(),yG={keyword:"$dynamicRef",schemaType:"string",code:(e)=>TJ(e,e.schema)};function TJ(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",Cm._`${gG.default.dynamicAnchors}${Cm.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(()=>{Rm.callRef(e,l),n.let(c,!0)}):()=>Rm.callRef(e,l)}}JJ.dynamicRef=TJ;JJ.default=yG});var LJ=G(function(IJ){Object.defineProperty(IJ,"__esModule",{value:!0});var MJ=uS(),DJ=Me(),bG={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)MJ.dynamicAnchor(e,"");else DJ.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};IJ.default=bG});var qJ=G(function(VJ){Object.defineProperty(VJ,"__esModule",{value:!0});var FJ=fS(),SG={keyword:"$recursiveRef",schemaType:"string",code:(e)=>FJ.dynamicRef(e,e.schema)};VJ.default=SG});var WJ=G(function(HJ){Object.defineProperty(HJ,"__esModule",{value:!0});var vG=uS(),EG=fS(),PG=LJ(),jG=qJ(),OG=[vG.default,EG.default,PG.default,jG.default];HJ.default=OG});var UJ=G(function(BJ){Object.defineProperty(BJ,"__esModule",{value:!0});var Tm=vm(),_G={keyword:"dependentRequired",type:"object",schemaType:"object",error:Tm.error,code:(e)=>Tm.validatePropertyDeps(e)};BJ.default=_G});var GJ=G(function(KJ){Object.defineProperty(KJ,"__esModule",{value:!0});var zJ=vm(),CG={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>zJ.validateSchemaDeps(e)};KJ.default=CG});var ZJ=G(function(YJ){Object.defineProperty(YJ,"__esModule",{value:!0});var XJ=Me(),TG={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:n}){if(t.contains===void 0)XJ.checkStrictMode(n,`"${e}" without "contains" is ignored`)}};YJ.default=TG});var eN=G(function(QJ){Object.defineProperty(QJ,"__esModule",{value:!0});var NG=UJ(),MG=GJ(),DG=ZJ(),IG=[NG.default,MG.default,DG.default];QJ.default=IG});var nN=G(function(tN){Object.defineProperty(tN,"__esModule",{value:!0});var xn=je(),Jm=Me(),FG=gr(),VG={message:"must NOT have unevaluated properties",params:({params:e})=>xn._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},qG={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:VG,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 xn.Name)t.if(xn._`${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(xn._`${s} === ${FG.default.errors}`);function l(d){if(n===!1){if(e.setParams({unevaluatedProperty:d}),e.error(),!i)t.break();return}if(!Jm.alwaysValidSchema(o,n)){let p=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:Jm.Type.Str},p),!i)t.if(xn.not(p),()=>t.break())}}function c(d,p){return xn._`!${d} || !${d}[${p}]`}function u(d,p){let m=[];for(let g in d)if(d[g]===!0)m.push(xn._`${p} !== ${g}`);return xn.and(...m)}}};tN.default=qG});var sN=G(function(rN){Object.defineProperty(rN,"__esModule",{value:!0});var Hn=je(),Nm=Me(),WG={message:({params:{len:e}})=>Hn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Hn._`{limit: ${e}}`},BG={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:WG,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",Hn._`${r}.length`);if(n===!1)e.setParams({len:o}),e.fail(Hn._`${i} > ${o}`);else if(typeof n=="object"&&!Nm.alwaysValidSchema(s,n)){let l=t.var("valid",Hn._`${i} <= ${o}`);t.if(Hn.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:Nm.Type.Num},l),!s.allErrors)t.if(Hn.not(l),()=>t.break())})}}};rN.default=BG});var iN=G(function(oN){Object.defineProperty(oN,"__esModule",{value:!0});var zG=nN(),KG=sN(),GG=[zG.default,KG.default];oN.default=GG});var lN=G(function(aN){Object.defineProperty(aN,"__esModule",{value:!0});var ke=je(),YG={message:({schemaCode:e})=>ke.str`must match format "${e}"`,params:({schemaCode:e})=>ke._`{format: ${e}}`},ZG={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:YG,code(e,t){let{gen:n,data:r,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=a;if(!l.validateFormats)return;if(s)p();else m();function p(){let g=n.scopeValue("formats",{ref:d.formats,code:l.code.formats}),y=n.const("fDef",ke._`${g}[${i}]`),h=n.let("fType"),x=n.let("format");n.if(ke._`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>n.assign(h,ke._`${y}.type || "string"`).assign(x,ke._`${y}.validate`),()=>n.assign(h,ke._`"string"`).assign(x,y)),e.fail$data(ke.or(P(),S()));function P(){if(l.strictSchema===!1)return ke.nil;return ke._`${i} && !${x}`}function S(){let v=u.$async?ke._`(${y}.async ? await ${x}(${r}) : ${x}(${r}))`:ke._`${x}(${r})`,E=ke._`(typeof ${x} == "function" ? ${v} : ${x}.test(${r}))`;return ke._`${x} && ${x} !== true && ${h} === ${t} && !${E}`}}function m(){let g=d.formats[o];if(!g){P();return}if(g===!0)return;let[y,h,x]=S(g);if(y===t)e.pass(v());function P(){if(l.strictSchema===!1){d.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${c}"`}}function S(E){let w=E instanceof RegExp?ke.regexpCode(E):l.code.formats?ke._`${l.code.formats}${ke.getProperty(o)}`:void 0,R=n.scopeValue("formats",{key:o,ref:E,code:w});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,ke._`${R}.validate`];return["string",E,R]}function v(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw Error("async format in sync schema");return ke._`await ${x}(${r})`}return typeof h=="function"?ke._`${x}(${r})`:ke._`${x}.test(${r})`}}}};aN.default=ZG});var dS=G(function(cN){Object.defineProperty(cN,"__esModule",{value:!0});var e6=lN(),t6=[e6.default];cN.default=t6});var pS=G(function(uN){Object.defineProperty(uN,"__esModule",{value:!0});uN.contentVocabulary=uN.metadataVocabulary=void 0;uN.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];uN.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var pN=G(function(dN){Object.defineProperty(dN,"__esModule",{value:!0});var s6=sS(),o6=oS(),i6=cS(),a6=WJ(),l6=eN(),c6=iN(),u6=dS(),Mm=pS(),f6=[a6.default,s6.default,o6.default,(0,i6.default)(!0),u6.default,Mm.metadataVocabulary,Mm.contentVocabulary,l6.default,c6.default];dN.default=f6});var yN=G(function(hN){Object.defineProperty(hN,"__esModule",{value:!0});hN.DiscrError=void 0;var mN;(function(e){e.Tag="tag",e.Mapping="mapping"})(mN||(hN.DiscrError=mN={}))});var mS=G(function(bN){Object.defineProperty(bN,"__esModule",{value:!0});var $r=je(),ll=yN(),Dm=$u(),p6=Za(),xN=Me(),m6={message:({params:{discrError:e,tagName:t}})=>e===ll.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:n}})=>$r._`{error: ${e}, tag: ${n}, tagValue: ${t}}`},h6={keyword:"discriminator",type:"object",schemaType:"object",error:m6,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",$r._`${n}${$r.getProperty(a)}`);t.if($r._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:ll.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=p();t.if(!1);for(let g in m)t.elseIf($r._`${c} === ${g}`),t.assign(l,d(m[g]));t.else(),e.error(!1,{discrError:ll.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let g=t.name("valid"),y=e.subschema({keyword:"oneOf",schemaProp:m},g);return e.mergeEvaluated(y,$r.Name),g}function p(){var m;let g={},y=x(s),h=!0;for(let v=0;v<i.length;v++){let E=i[v];if((E===null||E===void 0?void 0:E.$ref)&&!xN.schemaHasRulesButRef(E,o.self.RULES)){let R=E.$ref;if(E=Dm.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,R),E instanceof Dm.SchemaEnv)E=E.schema;if(E===void 0)throw new p6.default(o.opts.uriResolver,o.baseId,R)}let w=(m=E===null||E===void 0?void 0:E.properties)===null||m===void 0?void 0:m[a];if(typeof w!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);h=h&&(y||x(E)),P(w,v)}if(!h)throw Error(`discriminator: "${a}" must be required`);return g;function x({required:v}){return Array.isArray(v)&&v.includes(a)}function P(v,E){if(v.const)S(v.const,E);else if(v.enum)for(let w of v.enum)S(w,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(v,E){if(typeof v!="string"||v in g)throw Error(`discriminator: "${a}" values must be unique strings`);g[v]=E}}}};bN.default=h6});var $N=G(function(hue,y6){y6.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 SN=G(function(gue,x6){x6.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 wN=G(function(yue,b6){b6.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 vN=G(function(xue,$6){$6.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 EN=G(function(bue,S6){S6.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 PN=G(function($ue,w6){w6.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 jN=G(function(Sue,v6){v6.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 ON=G(function(wue,E6){E6.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 _N=G(function(kN){Object.defineProperty(kN,"__esModule",{value:!0});var P6=$N(),j6=SN(),O6=wN(),k6=vN(),_6=EN(),A6=PN(),C6=jN(),R6=ON(),T6=["/properties"];function J6(e){return[P6,j6,O6,k6,_6,t(this,A6),C6,t(this,R6)].forEach((n)=>this.addMetaSchema(n,void 0,!1)),this;function t(n,r){return e?n.$dataMetaSchema(r,T6):r}}kN.default=J6});var yS=G(function(Wn,gS){Object.defineProperty(Wn,"__esModule",{value:!0});Wn.MissingRefError=Wn.ValidationError=Wn.CodeGen=Wn.Name=Wn.nil=Wn.stringify=Wn.str=Wn._=Wn.KeywordCxt=Wn.Ajv2020=void 0;var M6=rS(),D6=pN(),I6=mS(),L6=_N(),hS="https://json-schema.org/draft/2020-12/schema";class vu extends M6.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),D6.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(I6.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;L6.default.call(this,e),this.refs["http://json-schema.org/schema"]=hS}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(hS)?hS:void 0)}}Wn.Ajv2020=vu;gS.exports=Wn=vu;gS.exports.Ajv2020=vu;Object.defineProperty(Wn,"__esModule",{value:!0});Wn.default=vu;var F6=Xa();Object.defineProperty(Wn,"KeywordCxt",{enumerable:!0,get:function(){return F6.KeywordCxt}});var cl=je();Object.defineProperty(Wn,"_",{enumerable:!0,get:function(){return cl._}});Object.defineProperty(Wn,"str",{enumerable:!0,get:function(){return cl.str}});Object.defineProperty(Wn,"stringify",{enumerable:!0,get:function(){return cl.stringify}});Object.defineProperty(Wn,"nil",{enumerable:!0,get:function(){return cl.nil}});Object.defineProperty(Wn,"Name",{enumerable:!0,get:function(){return cl.Name}});Object.defineProperty(Wn,"CodeGen",{enumerable:!0,get:function(){return cl.CodeGen}});var V6=xu();Object.defineProperty(Wn,"ValidationError",{enumerable:!0,get:function(){return V6.default}});var q6=Za();Object.defineProperty(Wn,"MissingRefError",{enumerable:!0,get:function(){return q6.default}})});import{existsSync as Lm,readFileSync as TN}from"node:fs";import{createRequire as AN}from"node:module";import{basename as CN,isAbsolute as B6,relative as U6,resolve as xS}from"node:path";import{fileURLToPath as RN,pathToFileURL as z6}from"node:url";function Im(e){return JSON.parse(TN(e,"utf8"))}async function JN(e){let t=xS(e),n=dr(t),r=xS(t,"project.schema.json");if(!Lm(n))throw Error(`No project.jxn or project.json in ${t}`);if(!Lm(r))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"the project file's extensions");let s;try{s=ra(TN(n,"utf8"),n)}catch(d){if(Vr(n))throw d;return{errors:[{message:ye(d)}],file:CN(n),valid:!1}}let o=Im(r);o.$id=z6(r).href;let i;try{({default:i}=await Promise.resolve().then(() => Mr(yS(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new i({allErrors:!0,loadSchema:(d)=>X6(d,t),strict:!1}).compileAsync(o),c=l(s),u=l.errors??null;return{errors:u&&Vr(n)?G6(u,s):u,file:CN(n),valid:c}}function K6(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)]:M(n)?n[s]:void 0}return n}function G6(e,t){return e.map((n)=>{if(!V(n)||!("keyword"in n)||n.keyword!=="type"||!("params"in n)||!V(n.params)||!("type"in n.params)||n.params.type!=="array"||!("instancePath"in n)||!O(n.instancePath))return n;let r=K6(t,n.instancePath),s=gt(r,"",n.instancePath),o=n.instancePath.split("/").at(-1)??"";if(s===null||s.includes(`
|
|
688
|
+
`)||o==="")return n;return{...n,message:`must be a list, written as ${o} { - ${s} }`}})}async function X6(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=RN(e),r=U6(t,n);if(r.startsWith("..")||B6(r))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(Lm(n))return Im(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=AN(xS(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=AN(import.meta.url).resolve(a)}catch(d){let p=RN(new URL(`../${a.slice(l.length)}`,import.meta.url));if(Lm(p))return Im(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 Im(c)}var NN=F(()=>{ae();St();cf();gf();Dl();so()});function pl(e,t){let n=Zr(e),r=t in n?n[t]:e[t];if(r===void 0||r===null)return{kind:"absent"};if(de(r)||M(r))return{kind:"bound"};if(O(r))return r.includes("${")?{kind:"bound"}:{kind:"text",text:r};return{isTrue:r===!0,kind:"other"}}function fl(e,t){let n=pl(e,t);return n.kind==="text"&&n.text.trim()!==""?n.text:null}function bn(e,t){return pl(e,t).kind!=="absent"}function Lo(e){let t=pl(e,"role");if(t.kind==="bound")return dl;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function Fm(e){let t=pl(e,"id");if(t.kind==="bound")return dl;return t.kind==="text"&&t.text!==""?t.text:null}function Sr(e,t){let n=pl(e,t);return n.kind==="bound"||n.kind==="text"&&n.text.trim()!==""}function Vm(e){let t=e.textContent;if(O(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(Sr(e,"aria-label")||bn(e,"aria-labelledby"))return!0;if(Nt(e)==="img"&&(Sr(e,"alt")||Sr(e,"title")))return!0;if(Nt(e)==="slot")return!0;let{children:n}=e;if(Array.isArray(n)){for(let s of n)if(O(s)){if(s.trim()!=="")return!0}else if(V(s)&&Vm(s))return!0}else if(n!=null)return!0;if(M(e.map))return!0;return(M(e.cases)?Object.values(e.cases):[]).some((s)=>It(s)&&Vm(s))}function*ul(e,t=[],n=[],r=[]){yield{node:e,path:t,roles:n,tags:r};let s=[...n,Lo(e)],o=[...r,Nt(e)],{children:i}=e;if(Array.isArray(i)){for(let[a,l]of i.entries())if(V(l))yield*ul(l,[...t,"children",a],s,o)}else if(M(i)&&It(i.map))yield*ul(i.map,[...t,"children","map"],s,o);if(It(e.map))yield*ul(e.map,[...t,"map"],s,o);if(M(e.cases)){for(let[a,l]of Object.entries(e.cases))if(V(l))yield*ul(l,[...t,"cases",a],s,o)}}function n5(e){return e.some((t)=>t.includes("-"))}function xs(e,t,n,r,s,o="error"){return{criterion:s,detail:`${r} ${Y6}`,message:n,path:t,rule:e,severity:o}}function MN(e,t,n){if(n.includes("label"))return!0;if(e===dl||t.bound)return!0;return e!==null&&t.ids.has(e)}function r5(e,t){let{node:n,path:r,tags:s}=e,o=Nt(n),i=Lo(n);if(i==="bound")return null;if(Sr(n,"aria-label")||bn(n,"aria-labelledby")||Sr(n,"title"))return null;let l=Pn(n,"the control"),c=(d)=>xs("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=s5(n,o,t,s);if(u==="named"||u==="exempt")return null;if(i!==null&&Z6.has(i))return Vm(n)?null:c("Give it text content, or an aria-label.");if(i!==null&&Q6.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"&&bn(n,"href"))return Vm(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 s5(e,t,n,r){if(t==="area"){if(!bn(e,"href"))return"none";return Sr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return MN(Fm(e),n,r)||Sr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(fl(e,"type")??"text").toLowerCase();if(s==="hidden"||bn(e,"type")&&fl(e,"type")===null)return"exempt";if(e5.has(s))return Sr(e,"value")?"named":"unnamed-value";if(s==="image")return Sr(e,"alt")?"named":"unnamed-alt";return MN(Fm(e),n,r)||Sr(e,"placeholder")?"named":"unnamed"}function i5(e){let{node:t,path:n,tags:r}=e,s=Nt(t);if(!s.includes("-")||!r.some((o)=>o5.has(o)))return null;return xs("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 a5(e){let{node:t,path:n}=e;if(Nt(t)!=="img")return null;let r=Lo(t);if(r==="bound"||r==="presentation"||r==="none")return null;if(bn(t,"alt")||Sr(t,"aria-label")||bn(t,"aria-labelledby"))return null;return xs("img-alt-missing",n,`${Pn(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 c5(e,t){let{node:n,path:r}=e,s=[];for(let o of l5){let i=fl(n,o);if(i===null)continue;for(let a of i.split(/\s+/))if(a!==""&&!t.has(a))s.push(xs("aria-target-missing",r,`${Pn(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 u5(e,t,n){for(let r of DN.get(t)??[]){let s=n.get(r);if(s===void 0)continue;if(s.bound)return!0;if(e===dl&&s.ids.size>0)return!0;if(e!==null&&e!==dl&&s.ids.has(e))return!0}return!1}function f5(e,t){let{node:n,path:r,roles:s,tags:o}=e,i=Lo(n);if(i===null||i==="bound"||r.length===0||n5(o))return null;if(s.includes("bound")||u5(Fm(n),i,t))return null;let a=Pn(n,"the element");if(i==="tab"&&!s.includes("tablist"))return xs("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 xs("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 xs("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 d5(e){let t=[];for(let{node:n}of ul(e)){if(Lo(n)!=="tab")continue;let r=pl(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 p5(e){let{node:t,path:n}=e;if(Lo(t)!=="tablist")return null;let r=d5(t);if(r===null||r.length===0||r.includes(!0))return null;return xs("tablist-none-selected",n,`${Pn(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 m5(e){let{node:t,path:n}=e,r=Lo(t);if(!(Nt(t)==="dialog"||r==="dialog"||r==="alertdialog")||r==="bound")return null;if(Sr(t,"aria-label")||bn(t,"aria-labelledby"))return null;return xs("dialog-unnamed",n,`${Pn(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 g5(e){let{node:t,path:n}=e;if(!bn(t,"aria-activedescendant"))return null;let r=Nt(t);if(h5.has(r)||r==="a"&&bn(t,"href")||bn(t,"tabIndex")||bn(t,"tabindex")||bn(t,"contenteditable"))return null;return xs("activedescendant-not-focusable",n,`${Pn(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 IN(e){let t=[...ul(e)],n=new Set,r={bound:!1,ids:new Set},s=new Map,o=!1;for(let{node:a}of t){let l=Lo(a);if(l!==null&&t5.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},d=fl(a,"aria-owns");if(d===null)u.bound||=bn(a,"aria-owns");else for(let p of d.split(/\s+/))if(p!=="")u.ids.add(p);s.set(l,u)}let c=Fm(a);if(c===dl)o=!0;else if(c!==null)n.add(c);if(Nt(a)==="label"){let u=fl(a,"for")??fl(a,"htmlFor");if(u===null)r.bound||=bn(a,"for")||bn(a,"htmlFor");else r.ids.add(u)}}let i=[];for(let a of t){let l=[r5(a,r),a5(a),f5(a,s),i5(a),p5(a),m5(a),g5(a)];for(let c of l)if(c)i.push(c);if(!o)i.push(...c5(a,n))}return i}var Y6="See docs/framework/concepts/accessibility.",dl="bound",Z6,Q6,e5,DN,t5,o5,l5,h5;var LN=F(()=>{ae();kc();Z6=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),Q6=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),e5=new Set(["button","reset","submit"]),DN=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),t5=new Set([...DN.values()].flat());o5=new Set(["select","jx-select"]);l5=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];h5=new Set(["button","input","select","textarea"])});function bS(e){return Nt(e)==="dialog"}function FN(e){return e.startsWith("--")}function v5(e){let t=[];for(let{node:n}of hr(e)){let r=co(n);if(bS(n)&&r!==null&&!t.includes(r))t.push(r)}return t}function E5(e){let t=e.oncommand;return t!==void 0&&t!==null}function P5(e,t){for(let{node:n}of hr(e)){if(n===e)continue;let r=Nt(n);if(r==="button"){let s=mn(n,"command"),o=mn(n,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(o===null||o===t))return!0}if(r==="form"&&mn(n,"method")?.toLowerCase()==="dialog")return!0}return!1}function qN(e,t){let n=[...hr(e,[],null,t)],r=v5(e),s=Sx(e,t),o=r.length>0||s.length>0,i=new Map,a=new Map;for(let{node:c}of n){let u=co(c);if(u!==null&&!i.has(u))i.set(u,c);if(Nt(c)==="button"){let d=mn(c,"commandfor"),p=mn(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(...j5(c,u,i,r,s,o,t)),bS(c))l.push(...O5(c,u,a));return l}function j5(e,t,n,r,s,o,i){let a=[],l=Nt(e),c=i?.invokerTags?.has(l)??!1,u=mn(e,"command"),d=mn(e,"commandfor");if(!(u!==null||d!==null||("command"in Zr(e))||("commandfor"in Zr(e))))return a;let m=Pn(e,"the element");if(!w5.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. ${ct}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!$5.has(u)&&!FN(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${VN.map((g)=>`\`${g}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${ct}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(d!==null){let g=n.get(d),y=r.includes(d),h=s.includes(d);if(!g&&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. ${ct}`,message:`commandfor="${d}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&g){if(y5.has(u)&&!bS(g))a.push({detail:`\`${u}\` acts on a <dialog>, and "${d}" is ${h?"a popover":`a <${Nt(g)||"element"}>`}. The click is ignored. ${h?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${ct}`,message:`${m} sends ${u} to "${d}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(x5.has(u)&&!Oc(g,i))a.push({detail:`\`${u}\` acts on a popover, and "${d}" is ${y?"a dialog":`a <${Nt(g)||"element"}>`} that declares no \`popover\`. The click is ignored. ${y?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${ct}`,message:`${m} sends ${u} to "${d}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(FN(u)&&!E5(g))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${d}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${ct}`,message:`${m} sends ${u} to "${d}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function O5(e,t,n){let r=[],s=Pn(e,"the dialog"),o=co(e),{style:i}=e,a=mn(e,"closedby");if(a!==null&&!S5.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. ${ct}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(En(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. ${ct}`,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=mn(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. ${ct}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!P5(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"\`. ${ct}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return r}var VN,y5,x5,b5,$5,S5,w5;var HN=F(()=>{ae();kc();VN=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],y5=new Set(["show-modal","close","request-close"]),x5=new Set(["toggle-popover","show-popover","hide-popover"]),b5=["any","closerequest","none"],$5=new Set(VN),S5=new Set(b5),w5=new Set(["button"])});function Hm(e){let t,n;if(e.startsWith("#/state/"))t="state",n=e.slice(8);else if(e.startsWith("$map/"))t="map",n=e.slice(5);else return null;let r=n.split("/").map((s)=>s.replaceAll("~1","/").replaceAll("~0","~"));return{scheme:t,segments:r}}function zN(e){let t=e.segments.map((n)=>n.replaceAll("~","~0").replaceAll("/","~1")).join("/");return e.scheme==="state"?`#/state/${t}`:`$map/${t}`}function $S(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r+=1)if(e[r]!==t[r])return!1;return!0}function qm(e,t=[]){if(Array.isArray(e))for(let n of e)qm(n,t);else if(M(e))for(let[n,r]of Object.entries(e))if(n==="$ref"&&O(r))t.push(r);else qm(r,t);return t}function KN(e){let t=Es(e),n=[];for(let r of t.matchAll(_5)){let s=r.index,o=s+r[0].length,i=e.slice(s,o),a=[];for(let u of i.slice(5).matchAll(A5))a.push(u[1]??u[2]??u[3]??"");let l=t.slice(o),c=t.slice(0,s);n.push({called:/^\s*\(/.test(l),segments:a,written:C5.test(l)||/(?:\+\+|--)\s*$/.test(c)||/\bdelete\s+$/.test(c)})}return n}function BN(e){let t=[];for(let n of KN(e)){let r=n.called?n.segments.slice(0,-1):n.segments;if(r.length>0)t.push(r)}return t}function R5(e){let t=[];for(let n of KN(e)){let r=n.segments.at(-1);if(n.called&&r!==void 0&&k5.has(r)){if(n.segments.length>1)t.push(n.segments.slice(0,-1))}else if(n.written)t.push(n.segments)}return t}function T5(e){return[...e.matchAll(/\$\{([^}]*)\}/g)].map((t)=>t[1]).join(" ; ")}function J5(e){if(O(e))return ce(e)?BN(T5(e)).map((t)=>({scheme:"state",segments:t})):null;if(!M(e))return null;if(M(e.$expression)){let{operator:t}=e.$expression;if(O(t)&&UN.has(t))return null;return qm(e.$expression).map((n)=>Hm(n)).filter((n)=>n!==null)}if(e.$prototype==="Function"&&O(e.body)&&Ru(e.body))return BN(e.body).map((t)=>({scheme:"state",segments:t}));return null}function SS(e,t,n,r){if(Array.isArray(e)){for(let[o,i]of e.entries())SS(i,[...t,o],n,r);return}if(!M(e))return;let s=n;if(qe(e)){s=t.join("/");let o=M(e.items)?e.items.$ref:void 0,i=O(o)?Hm(o):null;if(i?.scheme==="state")r.items.set(s,i)}N5(e,t,s,r);for(let[o,i]of Object.entries(e))SS(i,[...t,o],s,r)}function N5(e,t,n,r){if(Kn(e.tagName))r.sites.push({path:t,refs:qm(e.tagName.$expression),repeater:n});let{target:s}=e;if(O(e.operator)&&UN.has(e.operator)&&M(s)){let o=O(s.$ref)?Hm(s.$ref):null;if(o!==null)r.writes.push({path:t,pointer:o,repeater:n})}if(e.$prototype==="Function"&&O(e.body))for(let o of R5(e.body))r.writes.push({path:t,pointer:{scheme:"state",segments:o},repeater:n})}function M5(e,t){let n=new Map,r=e.refs.map((o)=>Hm(o)).filter((o)=>o!==null),s=new Set;for(let o=r.shift();o!==void 0;o=r.shift()){let i=zN(o);if(!n.has(i))n.set(i,o);let a=o.scheme==="state"?o.segments[0]:void 0;if(a!==void 0&&!s.has(a))s.add(a),r.push(...J5(t[a])??[])}return[...n.values()]}function D5(e,t,n){if(e.scheme==="state")return n.writes.find((s)=>s.pointer.scheme==="state"&&$S(s.pointer.segments,e.segments));let r=t.repeater===null?void 0:n.items.get(t.repeater);return n.writes.find((s)=>s.pointer.scheme==="map"?s.repeater===t.repeater&&$S(s.pointer.segments,e.segments):r!==void 0&&$S(s.pointer.segments,r.segments))}function GN(e){let t={items:new Map,sites:[],writes:[]};SS(e,[],null,t);let n=M(e.state)?e.state:{},r=[];for(let s of t.sites)for(let o of M5(s,n)){let i=zN(o),a=D5(o,s,t);if(a!==void 0)r.push({detail:`It is written at ${a.path.join("/")||"the document root"}. Choose the tag from a value nothing writes, or swap content with a $switch. ${WN}`,message:`This tag is chosen once, when the element is created, but \`${i}\` is written later in this document`,path:s.path,pointer:i,rule:"tag-discriminant-written",severity:"warn",writtenAt:a.path});let l=o.scheme==="state"?n[o.segments[0]??""]:void 0;if(M(l)&&l.$prototype==="Request"&&l.timing!=="compiler")r.push({detail:`Its response arrives after the element is created, so the element keeps the tag a pending request selects. Give the request timing "compiler", or choose the tag from a value that is settled. ${WN}`,message:`This tag is chosen once, when the element is created, but \`${i}\` is a request that has not settled by then`,path:s.path,pointer:i,rule:"tag-discriminant-late",severity:"warn",writtenAt:null})}return r}var UN,k5,WN="See docs/framework/concepts/expressions.",_5,A5,C5;var XN=F(()=>{Kl();ae();UN=new Set([...Qo.enum,...ei.enum,...ti.enum,ni.const]),k5=new Set(["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"]);_5=/(?<![\w$])state((?:\s*(?:\?\.|\.)\s*[A-Za-z_$][\w$]*|\s*\[\s*(?:"[^"\n]*"|'[^'\n]*')\s*\])+)/g,A5=/(?:\?\.|\.)\s*([A-Za-z_$][\w$]*)|\[\s*(?:"([^"\n]*)"|'([^'\n]*)')\s*\]/g,C5=/^\s*(?:(?:[-+*/%&|^]|\*\*|<<|>>>?|&&|\|\||\?\?)?=(?![=>])|\+\+|--)/});var iM=G(function(sM){Object.defineProperty(sM,"__esModule",{value:!0});sM.formatNames=sM.fastFormats=sM.fullFormats=void 0;function bs(e,t){return{validate:e,compare:t}}sM.fullFormats={date:bs(eM,PS),time:bs(vS(!0),jS),"date-time":bs(YN(!0),nM),"iso-time":bs(vS(),tM),"iso-date-time":bs(YN(),rM),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:H5,"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:X5,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:W5,int32:{type:"number",validate:z5},int64:{type:"number",validate:K5},float:{type:"number",validate:QN},double:{type:"number",validate:QN},password:!0,binary:!0};sM.fastFormats={...sM.fullFormats,date:bs(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,PS),time:bs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,jS),"date-time":bs(/^\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,nM),"iso-time":bs(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,tM),"iso-date-time":bs(/^\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,rM),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};sM.formatNames=Object.keys(sM.fullFormats);function I5(e){return e%4===0&&(e%100!==0||e%400===0)}var L5=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,F5=[0,31,28,31,30,31,30,31,31,30,31,30,31];function eM(e){let t=L5.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&&I5(n)?29:F5[r])}function PS(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var wS=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function vS(e){return function(n){let r=wS.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 jS(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 tM(e,t){if(!(e&&t))return;let n=wS.exec(e),r=wS.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 ES=/t|\s/i;function YN(e){let t=vS(e);return function(r){let s=r.split(ES);return s.length===2&&eM(s[0])&&t(s[1])}}function nM(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 rM(e,t){if(!(e&&t))return;let[n,r]=e.split(ES),[s,o]=t.split(ES),i=PS(n,s);if(i===void 0)return;return i||jS(r,o)}var V5=/\/|:/,q5=/^(?:[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 H5(e){return V5.test(e)&&q5.test(e)}var ZN=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function W5(e){return ZN.lastIndex=0,ZN.test(e)}var B5=-2147483648,U5=2147483647;function z5(e){return Number.isInteger(e)&&e<=U5&&e>=B5}function K5(e){return Number.isInteger(e)}function QN(){return!0}var G5=/[^\\]\\Z/;function X5(e){if(G5.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var lM=G(function(aM){Object.defineProperty(aM,"__esModule",{value:!0});var Z5=sS(),Q5=oS(),eX=cS(),tX=dS(),Wm=pS(),nX=[Z5.default,Q5.default,(0,eX.default)(),tX.default,Wm.metadataVocabulary,Wm.contentVocabulary];aM.default=nX});var cM=G(function(efe,sX){sX.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 fM=G(function(Bn,kS){Object.defineProperty(Bn,"__esModule",{value:!0});Bn.MissingRefError=Bn.ValidationError=Bn.CodeGen=Bn.Name=Bn.nil=Bn.stringify=Bn.str=Bn._=Bn.KeywordCxt=Bn.Ajv=void 0;var oX=rS(),iX=lM(),aX=mS(),uM=cM(),lX=["/properties"],Bm="http://json-schema.org/draft-07/schema";class Eu extends oX.default{_addVocabularies(){if(super._addVocabularies(),iX.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(aX.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(uM,lX):uM;this.addMetaSchema(e,Bm,!1),this.refs["http://json-schema.org/schema"]=Bm}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Bm)?Bm:void 0)}}Bn.Ajv=Eu;kS.exports=Bn=Eu;kS.exports.Ajv=Eu;Object.defineProperty(Bn,"__esModule",{value:!0});Bn.default=Eu;var cX=Xa();Object.defineProperty(Bn,"KeywordCxt",{enumerable:!0,get:function(){return cX.KeywordCxt}});var ml=je();Object.defineProperty(Bn,"_",{enumerable:!0,get:function(){return ml._}});Object.defineProperty(Bn,"str",{enumerable:!0,get:function(){return ml.str}});Object.defineProperty(Bn,"stringify",{enumerable:!0,get:function(){return ml.stringify}});Object.defineProperty(Bn,"nil",{enumerable:!0,get:function(){return ml.nil}});Object.defineProperty(Bn,"Name",{enumerable:!0,get:function(){return ml.Name}});Object.defineProperty(Bn,"CodeGen",{enumerable:!0,get:function(){return ml.CodeGen}});var uX=xu();Object.defineProperty(Bn,"ValidationError",{enumerable:!0,get:function(){return uX.default}});var fX=Za();Object.defineProperty(Bn,"MissingRefError",{enumerable:!0,get:function(){return fX.default}})});var mM=G(function(pM){Object.defineProperty(pM,"__esModule",{value:!0});pM.formatLimitDefinition=void 0;var dM=fM(),jt=je(),Fo=jt.operators,Um={formatMaximum:{okStr:"<=",ok:Fo.LTE,fail:Fo.GT},formatMinimum:{okStr:">=",ok:Fo.GTE,fail:Fo.LT},formatExclusiveMaximum:{okStr:"<",ok:Fo.LT,fail:Fo.GTE},formatExclusiveMinimum:{okStr:">",ok:Fo.GT,fail:Fo.LTE}},mX={message:({keyword:e,schemaCode:t})=>jt.str`should be ${Um[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>jt._`{comparison: ${Um[e].okStr}, limit: ${t}}`};pM.formatLimitDefinition={keyword:Object.keys(Um),type:"string",schemaType:"string",$data:!0,error:mX,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 dM.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",jt._`${p}[${l.schemaCode}]`);e.fail$data(jt.or(jt._`typeof ${m} != "object"`,jt._`${m} instanceof RegExp`,jt._`typeof ${m}.compare != "function"`,d(m)))}function u(){let p=l.schema,m=a.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let g=t.scopeValue("formats",{key:p,ref:m,code:i.code.formats?jt._`${i.code.formats}${jt.getProperty(p)}`:void 0});e.fail$data(d(g))}function d(p){return jt._`${p}.compare(${n}, ${r}) ${Um[s].fail} 0`}},dependencies:["format"]};var hX=(e)=>(e.addKeyword(pM.formatLimitDefinition),e);pM.default=hX});var xM=G(function(Pu,yM){Object.defineProperty(Pu,"__esModule",{value:!0});var wr=iM(),yX=mM(),hl=je(),hM=new hl.Name("fullFormats"),xX=new hl.Name("fastFormats"),AS=(e,t={keywords:!0})=>{if(Array.isArray(t))return gM(e,t,wr.fullFormats,hM),e;let[n,r]=t.mode==="fast"?[wr.fastFormats,xX]:[wr.fullFormats,hM],s=t.formats||wr.formatNames;if(gM(e,s,n,r),t.keywords)(0,yX.default)(e);return e};AS.get=(e,t="full")=>{let r=(t==="fast"?wr.fastFormats:wr.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r};function gM(e,t,n,r){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=hl._`require("ajv-formats/dist/formats").${r}`);for(let i of t)e.addFormat(i,n[i])}yM.exports=Pu=AS;Object.defineProperty(Pu,"__esModule",{value:!0});Pu.default=AS});import{existsSync as wM,readFileSync as Ou,readdirSync as vM,statSync as EM}from"node:fs";import{createRequire as bX}from"node:module";import{join as PM,relative as vr,resolve as CS}from"node:path";async function vX(){try{let{default:e}=await Promise.resolve().then(() => Mr(yS(),1)),{default:t}=await Promise.resolve().then(() => Mr(xM(),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 jM(e,t={}){let n=CS(e),r=[],s=[],o=0;for(let R of["project.schema.json","document.schema.json"]){let C=CS(n,R);if(!wM(C))continue;o+=1;let J=RS(C),D=AX(J);if(D.length>0)r.push({errors:D.map(({reason:A,ref:L})=>({message:`$ref "${L}" ${A} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:R})}if(r.length>0)return{checked:o,issues:r,lint:s,valid:!1};let i=await JN(n);if(o+=1,!i.valid)r.push({errors:i.errors??[],file:i.file});let a=jX(n);if(a!==void 0){let R=x$({$defs:a}).map(({at:C,ref:J})=>({instancePath:C,message:`type reference "${J}" names no definition in project.json's $defs`}));if(R.length>0){let C=r.find((J)=>J.file===i.file);if(C===void 0)r.push({errors:R,file:i.file});else C.errors.push(...R)}}let l=EX(n),c=l?.state??{};if(l!==void 0){let R=bM(l);if(R.length>0){let C=r.find((J)=>J.file===i.file);if(C===void 0)r.push({errors:R,file:i.file});else C.errors.unshift(...R)}}let u=ma(c).map((R)=>({instancePath:`/state/${R[0]}`,message:kd(R)}));if(u.length>0)r.push({errors:u,file:i.file});let{addFormats:d,Ajv:p}=await vX(),{document:m}=await C_(n,{write:!1}),g=new p({allErrors:!0,ownProperties:!0,strict:!1});d(g);let y=g.compile(m),h=nP(SM(n).flatMap((R)=>{try{return[Di(Ou(R,"utf8"),vr(n,R),"class definition")]}catch{return[]}}));for(let R of $X)for(let C of kM(CS(n,R))){if(C.endsWith(".class.json"))continue;o+=1;let J=OX(C,vr(n,C));if(s.push(...J.warnings),J.failure!==null){r.push(J.failure);continue}let D=J.document,A=$M(D,vr(n,C));if(s.push(...A.warnings),A.failure!==null){r.push(A.failure);continue}let L=bM(D);if(y(D)){if(L.length>0)r.push({errors:L,file:vr(n,C)});let K=D;s.push(..._X(K,vr(n,C),h));let ne=PX(K,R==="pages",c);if(ne.length>0)r.push({errors:ne.map((U)=>({instancePath:`/state/${U[0]}`,message:kd(U)})),file:vr(n,C)});let B=x$(K,a);if(B.length>0)r.push({errors:B.map(({at:U,ref:Z})=>({instancePath:U,message:`type reference "${Z}" names no definition in this document's $defs or in project.json's $defs`})),file:vr(n,C)})}else r.push({errors:[...L,...y.errors??[]],file:vr(n,C)})}let x=new p({allErrors:!0,ownProperties:!0,strict:!1});d(x);let P=x.compile(h$());for(let R of SM(n)){o+=1;let C;try{C=Sl(Ou(R,"utf8"),vr(n,R))}catch(D){r.push({errors:[{message:ye(D)}],file:vr(n,R)});continue}let J=$M(C,vr(n,R));if(s.push(...J.warnings),J.failure!==null)r.push(J.failure);else if(!P(C))r.push({errors:P.errors??[],file:vr(n,R)})}let{config:S}=Ur(n),v=await qr(n,S),E=bX(import.meta.url);for(let R of v.extensions)for(let C of["project","document","fields"]){let J=R.schemas[C];if(!J)continue;o+=1;let D=new p({allErrors:!0,ownProperties:!0,strict:!1});d(D);for(let A of wX){let L=E.resolve(A);D.addSchema(RS(L))}try{D.compile(RS(J))}catch(A){r.push({errors:[{message:A instanceof Error?A.message:String(A)}],file:`${R.specifier} (${C} fragment)`})}}let w=t.strict===!0&&s.some((R)=>R.severity==="error");return{checked:o,issues:r,lint:s,valid:r.length===0&&!w}}function bM(e){return $d(e).map(({message:t,pointer:n})=>({instancePath:n,message:t}))}function EX(e){try{return Ur(e).config}catch{return}}function PX(e,t,n){let r=e.state??{};if(!t)return ma(r);let s={...r};for(let[o,i]of Object.entries(n))if(o!=="$site"&&o!=="$page"&&!(o in r))s[o]=i;return ma(s).filter((o)=>o.some((i)=>(i in r)))}function jX(e){try{let t=Ur(e).config.$defs;return M(t)?t:void 0}catch{return}}function OX(e,t){if(!Vr(e))try{return{document:$l(Ou(e,"utf8"),t),failure:null,warnings:[]}}catch(s){return{document:null,failure:{errors:[{message:ye(s)}],file:t},warnings:[]}}let n=Ou(e,"utf8"),r=Eh(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:kX(n),failure:null,warnings:r}}catch(s){return{document:null,failure:{errors:[{message:ye(s)}],file:t},warnings:r}}}function $M(e,t){let n=[];try{mc(e,t,n)}catch(s){return{failure:{errors:[{message:ye(s)}],file:t},warnings:[]}}return{failure:null,warnings:n.map(({pointer:s,problem:o})=>({detail:o.message,file:t,message:`${s} (line ${o.line}, column ${o.column}): ${o.message}`,path:s.split("/").slice(1),rule:"typescript-reading",severity:"warn",source:"function-body"}))}}function kX(e){let t=Zo(e);return M(t)?t:null}function RS(e){return JSON.parse(Ou(e,"utf8"))}function _X(e,t,n){let r=[];for(let s of aP(e,n))r.push({...ju(s),file:t,source:"popover"});for(let s of qN(e,n))r.push({...ju(s),file:t,source:"dialog"});for(let s of IN(e))r.push({...ju(s),criterion:s.criterion,file:t,source:"accessibility"});for(let s of GN(e))r.push({...ju(s),file:t,source:"expression"});for(let s of z0(e))r.push({...ju({...s,severity:"info"}),file:t,source:"module"});return r}function ju(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function OM(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 AX(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(!V(i))return!1;if(i=i[l],i===void 0)return!1}return!0},s=(o)=>{if(!M(o)||n.has(o))return;n.add(o);let i=o.$ref;if(O(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(!y$.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(M(l)){if(s(l),Hp.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function kM(e){if(!wM(e))return[];let t=[];for(let n of vM(e)){let r=PM(e,n);if(EM(r).isDirectory())t.push(...kM(r));else if(fr(n))t.push(r)}return t.toSorted()}function SM(e){let t=[],n=(r)=>{for(let s of vM(r)){if(SX.has(s))continue;let o=PM(r,s);if(EM(o).isDirectory())n(o);else if(s.endsWith(".class.json"))t.push(o)}};return n(e),t.toSorted()}function _M(e){let t=[];for(let n of e.issues){t.push(`${n.file}:`);for(let r of n.errors){let s=M(r)?r:{},{instancePath:o,message:i}=s;t.push(` - ${o||"/"}: ${i??JSON.stringify(r)}`)}}return t}var $X,SX,wX;var AM=F(()=>{As();St();yi();hn();nd();eA();rA();NN();LN();HN();XN();vx();ba();kc();ae();Hr();oa();p$();$X=["components","pages","layouts"],SX=new Set(["node_modules","dist",".git"]),wX=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"]});St();import{relative as TS,resolve as CM}from"node:path";async function CX(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
|
|
641
689
|
|
|
642
690
|
Commands:
|
|
643
691
|
build [root] Build a Jx site to dist/
|
|
@@ -647,7 +695,7 @@ Commands:
|
|
|
647
695
|
validate [root] Validate the whole project: project.json, documents, classes, and fragments
|
|
648
696
|
convert <paths…> Move documents and the project file between .json and .jxn, repairing references
|
|
649
697
|
format [paths…] Format .jxn files and the code they hold (requires @jxsuite/server and Bun)
|
|
650
|
-
db push [root] Sync
|
|
698
|
+
db push [root] Sync data tables, then section owners' steps, to their connections (additive-only)
|
|
651
699
|
|
|
652
700
|
Options:
|
|
653
701
|
--verbose Print detailed build progress
|
|
@@ -661,8 +709,8 @@ Options:
|
|
|
661
709
|
--strict validate: fail on an overlay or accessibility lint error, not only a schema error
|
|
662
710
|
--to <format> convert: jxn or json
|
|
663
711
|
--drop-comments convert: convert a .jxn file to .json even though it has comments
|
|
664
|
-
--check format: write nothing, and fail when a file would change`),process.exit(0);if(t==="convert"||t==="format"){try{if(t==="convert"){await Promise.resolve().then(() =>
|
|
665
|
-
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run");try{await Promise.resolve().then(() =>
|
|
666
|
-
Build completed with ${x.errors.length} error(s):`);for(let
|
|
667
|
-
Done: ${x.routes} routes → ${x.files} files`)}catch(g){console.error(`Build failed: ${ye(g)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() =>
|
|
668
|
-
Run "jx --help" for usage.`),process.exit(1)}var
|
|
712
|
+
--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(() => rw());nw(process.cwd(),e.slice(1))}else{await Promise.resolve().then(() => ow());sw(process.cwd(),e.slice(1))}}catch(d){console.error(ye(d)),process.exit(1)}return}let n=t==="db",r=n?e[1]:null,s=e.slice(n?2:1),o=new Set,i=[],a,l;for(let d=0;d<s.length;d+=1){let p=s[d];if(p==="--connection")d+=1,a=s[d];else if(p==="--port"){d+=1;let m=Math.trunc(Number(s[d]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(p.startsWith("--"))o.add(p);else i.push(p)}let[c]=i,u=CM(c??".");if(n){if(r!=="push")console.error(`Unknown db subcommand: ${r??"(none)"}
|
|
713
|
+
Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let d=o.has("--dry-run"),p=!1;try{await Promise.resolve().then(() => tE());let g={dryRun:d};if(a!==void 0)g.connection=a;let{results:y,sections:h,bindingsPatched:x,wranglerPath:P}=await eE(u,g);for(let S of y){let v=S.applied?"applied":"dry-run";console.log(`${S.connection} (${S.provider}) — ${S.tables.length} table(s), ${S.statements.length} statement(s) [${v}]`);for(let E of S.statements)console.log(` ${E}`);for(let E of S.warnings)console.warn(` warning: ${E}`)}for(let S of h){let v=S.applied?"applied":"dry-run";console.log(`${S.section} (section) — ${S.steps.length} step(s) [${v}]`);for(let E of S.steps)console.log(` ${E.sql??E.summary}`);for(let E of S.warnings)console.warn(` warning: ${E}`);if(S.error!==void 0)console.error(` error: ${S.error}`)}if(x&&P)console.log(`Updated bindings in ${TS(u,P)}`);p=h.some((S)=>S.error!==void 0)}catch(m){console.error(`db push failed: ${ye(m)}`),process.exit(1)}if(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(() => m_());await Promise.resolve().then(() => oa());let h=!o.has("--no-optimize-images")&&!Yv(process.env.JX_IMAGES_OPTIMIZE),x=await l_(u,{clean:p,includeHeld:m,optimizeImages:h,verbose:d});if(x.errors.length>0){console.error(`
|
|
714
|
+
Build completed with ${x.errors.length} error(s):`);for(let P of x.errors)console.error(` - ${P}`);process.exit(1)}console.log(`
|
|
715
|
+
Done: ${x.routes} routes → ${x.files} files`)}catch(g){console.error(`Build failed: ${ye(g)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => g_());h_(u,l)}catch(d){console.error(ye(d)),process.exit(1)}else if(t==="preview"){let{existsSync:d}=await import("node:fs"),p=CM(u,"dist");if(!d(p))console.error(`No build output at ${p} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => b_());let g=l??4173;x_(p,g,u),console.log(`Previewing ${p} at http://localhost:${g}`)}else if(t==="schema")try{await Promise.resolve().then(() => p$());let{projectSchemaPath:p,documentSchemaPath:m}=await A_(u);console.log(`Wrote ${TS(u,p)}`),console.log(`Wrote ${TS(u,m)}`)}catch(d){console.error(`Schema generation failed: ${ye(d)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => AM());let g=await jM(u,{strict:o.has("--strict")}),y=OM(g);if(g.valid){console.log(`Project is valid (${g.checked} files checked in ${u})`);for(let h of y)console.log(h)}else{console.error(`Project is INVALID (${u}):`);for(let h of[..._M(g),...y])console.error(h);process.exit(1)}}catch(d){console.error(`Validation failed: ${ye(d)}`),process.exit(1)}else console.error(`Unknown command: ${t}
|
|
716
|
+
Run "jx --help" for usage.`),process.exit(1)}var Jfe=CX();export{Jfe as ready};
|