@jxsuite/compiler 8.0.2 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,22 +1,22 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as Xj}from"node:module";var Wj=Object.create;var{getPrototypeOf:Uj,defineProperty:Bp,getOwnPropertyNames:zj}=Object;var Wp=Object.prototype.hasOwnProperty;function Gj(e){return this[e]}var Kj,Yj,Lt=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?Kj??=new WeakMap:Yj??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?Wj(Uj(e)):{};let o=t||!e||!e.__esModule||!Wp.call(e,"default")?Bp(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of zj(e))if(!Wp.call(o,a))Bp(o,a,{get:Gj.bind(e,a),enumerable:!0})}if(n)s.set(e,o);return o};var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var q=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var Ne=Xj(import.meta.url);function T(e){return typeof e==="string"}function lr(e){return typeof e==="number"}function $t(e){return typeof e==="boolean"}function vt(e){return typeof e==="function"}function F(e){return typeof e==="object"&&e!==null}function ee(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ce(e){return ee(e)&&typeof e.$ref==="string"}function er(e){return ee(e)&&e.$prototype==="Function"}function tr(e){return ee(e)&&ee(e.$expression)}function ns(e){return tr(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function _n(e){return er(e)&&Array.isArray(e.body)}function Cr(e){return ee(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function tn(e){return ee(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Up(e){return ee(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Pn(e){if(!ee(e))return!1;for(let t of Object.keys(e))if(!zp.has(t))return!1;return!0}function Qe(e){return ee(e)&&e.$prototype==="Array"}function _c(e){return(Array.isArray(e)?e:[e]).some((r)=>Qe(r))}function Gp(e){return ee(e)&&e.$prototype==="Class"}function Ft(e){return ee(e)}function pe(e){return typeof e==="string"&&e.includes("${")}function ss(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function is(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function rn(e){if(!e)return[];return e.map((t)=>T(t)?t:t.name)}function Zj(e){return typeof e==="string"}function Nr(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!ee(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 ee(t.cases)&&Object.values(t.cases).every((r)=>T(r))&&typeof t.default==="string";return!1}function Ms(e){if(Zj(e))return[e];if(!Nr(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}var zp;var ve=q(()=>{zp=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"])});function Yp(e){let t=[],r=[],n=null,s=0,i=()=>r.at(-1)?.path??"",o=()=>n===null?i():tk(i(),n),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let d=e[s+1]??"";if(d==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=Qj.get(d)??d,s+=2;continue}if(c==='"')return s+=1,l;l+=c,s+=1}return l};while(s<e.length){let l=e[s];if(Kp.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){r.push(l==="{"?{keys:new Set,kind:"object",path:o()}:{kind:"array",path:o()}),n=null,s+=1;continue}if(l==="}"||l==="]"){r.pop(),n=null,s+=1;continue}if(l==='"'){let d=a(),p=r.at(-1);if(p?.kind==="object"&&ek(e,s)===":"){if(p.keys.has(d))t.push({detail:d,kind:"duplicate-key",path:p.path});p.keys.add(d),n=d}else n=null;continue}if(l==="-"||l>="0"&&l<="9"){let d=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(d,s);if(!rk(p))t.push({detail:p,kind:"unsafe-number",path:o()});n=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;n=null}return t}function ek(e,t){let r=t;while(r<e.length&&Kp.has(e[r]))r+=1;return e[r]??""}function tk(e,t){return e===""?t:`${e}.${t}`}function rk(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Xp(e){let t=e.path===""?"the document root":`"${e.path}"`;return e.kind==="duplicate-key"?`duplicate key "${e.detail}" in ${t} — JSON.parse keeps the last one and `+"silently discards the first (RFC 7493 §2.3)":`number ${e.detail} in ${t} cannot be represented exactly and will change when `+"the document is written back (RFC 7493 §2.2)"}var Kp,Qj;var Zp=q(()=>{Kp=new Set([" ","\t",`
3
- `,"\r"]);Qj=new Map([["b","\b"],["f","\f"],["n",`
4
- `],["r","\r"],["t","\t"]])});function Ee(e){return e instanceof Error?e.message:String(e)}function em(e){if(T(e))return Qp.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>em(t));if(ee(e))return tm(e);return e}function tm(e){let t={};for(let[r,n]of Object.entries(e))t[Qp.test(r)?r.normalize("NFC"):r]=em(n);return t}function Pc(e,t,r){let n;try{n=JSON.parse(e)}catch(i){throw Error(`Failed to parse ${r} at ${t}: ${Ee(i)}`,{cause:i})}if(!ee(n))throw Error(`Invalid ${r} at ${t}: expected a JSON object`);let s=Yp(e);if(s.length>0){let i=s.map((o)=>Xp(o)).join("; ");throw Error(`Invalid ${r} at ${t}: ${i}`)}return tm(n)}function jn(e,t){return Pc(e,t,"Jx document")}function rm(e,t){return Pc(e,t,"project config")}function nm(e,t){return Pc(e,t,"class definition")}var Qp;var rr=q(()=>{ve();Zp();Qp=/[^\p{ASCII}]/u});function nk(e){return JSON.parse(e)}function Js(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function sk(e){return Js(e)&&typeof e.binding==="string"}function ik(e){try{let t=nk(e);return Js(t)?t:void 0}catch{return}}function sm(e,t){if(t.length===0)return{content:e??"",patched:!1};let r={};if(e){let n=ik(e);if(n===void 0)return{content:e,patched:!1};r=n}for(let n of t)im(r,n);return{content:`${JSON.stringify(r,null,"\t")}
5
- `,patched:!0}}function im(e,t){for(let[r,n]of Object.entries(t)){let s=r in e?e[r]:void 0;if(Array.isArray(n)){e[r]=ok(Array.isArray(s)?s:[],n);continue}if(Js(n)){if(Js(s))im(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function ok(e,t){let r=[...e];for(let n of t){if(!sk(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>Js(o)&&o.binding===n.binding),i=r[s];if(Js(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var om=()=>{};function um(e){if(!T(e))return null;let[t,...r]=e.split(";"),n=(t??"").indexOf("/");if(n===-1)return null;let s=(t??"").slice(0,n).trim().toLowerCase(),i=(t??"").slice(n+1).trim().toLowerCase();if(!am.test(s)||!am.test(i))return null;let o=i.lastIndexOf("+"),a=o===-1?null:i.slice(o+1),l=o===-1?i:i.slice(0,o);if(a==="")return null;let c=l.indexOf("."),d=c===-1?null:l.slice(0,c),p=d!==null&&ak.has(d)?d:null,h=p===null?l:l.slice(p.length+1);if(h==="")return null;let m={};for(let b of r){let g=b.indexOf("=");if(g===-1)return null;let y=b.slice(0,g).trim().toLowerCase(),v=b.slice(g+1).trim();if(y==="")return null;if(v.startsWith('"')&&v.endsWith('"')&&v.length>=2)v=v.slice(1,-1);m[y]=v}return{parameters:m,subtype:h,suffix:a,tree:p,type:s}}function dm(e){if(!T(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(um(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function fm(e){let t=um(e);if(t===null)return null;let r=t.tree===null?"":`${t.tree}.`,n=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${r}${t.subtype}${n}`}var am,ak,lm="text/markdown; variant=GFM",cm="application/yaml",pm;var jc=q(()=>{ve();am=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,ak=new Set(["vnd","prs","x"]);pm={".markdown":`${lm}; charset=utf-8`,".md":`${lm}; charset=utf-8`,".yaml":`${cm}; charset=utf-8`,".yml":`${cm}; charset=utf-8`}});function ym(e){if(e===null)throw TypeError("A class descriptor cannot be null");return ee(e)?e:{}}class oa{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,r,n){this.name=e,this.classPath=t,this.classDef=r,this.#t=n;let{format:s}=r;this.extensions=(s?.extensions??[]).map((i)=>i.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=fm(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=r.$studio??null,this.project=r.project??null,this.server=r.server??null,this.connector=r.connector??null,this.capabilities=ck(r)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#r(await this.implementation())}#r(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let r=this.capabilities[e];if(!r)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let n=this.#r(await this.implementation()),s=n?.[r.identifier];if(!vt(s)){let o=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${o}" has no static "${r.identifier}" method`)}return await s.call(n,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class aa{#t;constructor(e){this.#t=e;for(let t of e){if(t.mediaType===null)continue;let r=dm(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of hm){let r=new Map;for(let n of e){if(!n.capabilities[t])continue;for(let s of n.extensions){let i=r.get(s);if(i)throw Error(`Format conflict: "${i.name}" and "${n.name}" both claim "${s}" with the "${t}" capability`);r.set(s,n)}}}}get entries(){return this.#t}byExtension(e,t){let r=mm(e);return this.#t.find((n)=>n.extensions.includes(r)&&(!t||n.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#t.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let r of this.#t){if(e&&!r.documentKinds.includes(e))continue;for(let n of r.extensions)t.add(n)}return t.delete(".json"),[...t]}has(e){let t=mm(e);return this.#t.some((r)=>r.extensions.includes(t))}}function ck(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!dk(i))continue;let o={identifier:s.identifier??n,timing:s.timing??lk};if(T(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function dk(e){return e!==void 0&&uk.has(e)}function mm(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var hm,gm,lk,uk;var kc=q(()=>{ve();jc();hm=["parse","serialize","rewrite","discover","load"],gm=[...hm,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];lk=["compiler","server"];uk=new Set(gm)});class bm{#t;#e;#r;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let i of s.classes){let o=t.get(i.name);if(o&&o!==s.specifier)throw Error(`Extension conflict: "${o}" and "${s.specifier}" both provide a class named "${i.name}"`);t.set(i.name,s.specifier)}let r=new Map;for(let s of this.#e){if(!s.project)continue;let i=r.get(s.project.key);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both claim the project section "${s.project.key}"`);r.set(s.project.key,s)}let n=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:i}=s.server;if(!i.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${i}" must be under /_jx/`);let o=n.get(i);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both mount "${i}"`);n.set(i,s)}this.#r=new aa(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#r}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function xm(e,t,r){let n=[];for(let s of e??[])n.push(await fk(s,t,r));return new bm(n)}async function fk(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${Fi}`)}else try{n=t.resolvePath(r,`${e}/${Fi}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${Fi} (is the package installed, and does its exports map include it?): ${Rc(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${Rc(l)}`,{cause:l})}if(!ee(s)||!T(s.name))throw Error(`Extension "${e}": ${Fi} must declare a "name"`);let i=s;if(!e.startsWith(".")&&i.name!==e)throw Error(`Extension "${e}": manifest name "${i.name}" does not match the specifier`);let o=[];for(let[l,c]of Object.entries(i.classes??{})){let d=t.resolvePath(n,c),p;try{p=await t.loadJson(d)}catch(h){throw Error(`Extension "${e}": cannot read class "${l}" at ${d}: ${Rc(h)}`,{cause:h})}o.push(new oa(l,d,ym(p),t))}let a={};if(i.schemas?.project)a.project=t.resolvePath(n,i.schemas.project);if(i.schemas?.document)a.document=t.resolvePath(n,i.schemas.document);if(i.schemas?.fields)a.fields=t.resolvePath(n,i.schemas.fields);return{specifier:e,manifestPath:n,manifest:i,classes:o,schemas:a}}function Rc(e){return e instanceof Error?e.message:String(e)}var Fi="jx-extension.json";var $m=q(()=>{kc();ve();kc()});import{readFileSync as pk}from"node:fs";import{dirname as mk,isAbsolute as hk,resolve as Ac,sep as la}from"node:path";import{pathToFileURL as gk}from"node:url";import{createRequire as yk}from"node:module";async function Oc(e){let t=[e],r=`${la}src${la}`,n=`${la}dist${la}`;if(e.includes(r)){let i=e.replace(r,n);if(t.push(i),i.endsWith(".ts"))t.push(`${i.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let i of t)try{return await import(gk(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function Cc(e,t){return yk(Ac(e,"package.json")).resolve(t)}function Nc(e){return{importModule:(t)=>Oc(t),loadJson:async(t)=>JSON.parse(pk(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return Ac(mk(t),r);if(hk(r))return r;return Cc(e,r)}}}async function kn(e,t){return xm(t?.extensions,Nc(e),Ac(e,"project.json"))}function ca(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 nn=q(()=>{$m();ve()});import{existsSync as bk,readFileSync as xk}from"node:fs";import{resolve as vm}from"node:path";function Rn(e){let t=vm(e,"project.json");if(!bk(t))throw Error(`project.json not found in ${e}`);let r;try{r=rm(xk(t,"utf8"),t)}catch(o){throw Error(`Invalid project.json: ${Ee(o)}`,{cause:o})}let n={...qi,...r,build:{...qi.build,...r.build},defaults:{...qi.defaults,...r.defaults},images:{...qi.images,...r.images},url:r.url??qi.url};if(r.$head)n.$head=r.$head;if(r.$media)n.$media=r.$media;if(r.style)n.style=r.style;if(r.state)n.state=r.state;if(r.redirects)n.redirects=r.redirects;if(r.imports)n.imports=r.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(n.build.adapter==="static")delete n.build.adapter;if(n.build.adapter&&!s.includes(n.build.adapter))throw Error(`Unknown build adapter "${n.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let i=["build","cloudflare"];if(!i.includes(n.images.service))throw Error(`Unknown images.service "${n.images.service}" in project.json. Valid services: ${i.join(", ")}`);return{config:n,configPath:t,projectRoot:vm(e)}}var qi;var Hi=q(()=>{rr();qi={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["webp","avif"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80,png:80,webp:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as Tc,readFileSync as wm,writeFileSync as $k}from"node:fs";import{resolve as Sm}from"node:path";async function Em(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=Rn(e),i=await kn(e,s),o=ee(s.connections)?s.connections:{},a=ee(s.data)?s.data:{},l=Object.keys(o).filter((b)=>!n||b===n);if(n&&l.length===0)throw Error(`Unknown connection "${n}" (no such connections entry in project.json)`);if(l.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let c={...process.env,...wk(e),JX_PROJECT_ROOT:e},d=[],p=[];for(let b of l){let g=o[b],y=ee(g)?{...g,$name:b}:{$name:b},v=String(y.provider??""),j=vk(i.connectors(),v);if(!j)throw Error(`Connection "${b}" names provider "${v}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[E,O]of Object.entries(a))if(ee(O)&&O.connection===b)S[E]=O;let P=await j.call("deploySchema",S,y,{dryRun:r,env:c});if(d.push({applied:P.applied??!r,connection:b,provider:v,statements:P.statements??[],tables:Object.keys(S),warnings:P.warnings??[]}),j.capabilities.bindings){let E=await j.call("bindings",y);if(ee(E)&&Object.keys(E).length>0)p.push(E)}}let h=Sm(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&Tc(h)){let b=wm(h,"utf8"),{content:g,patched:y}=sm(b,p);if(y&&g!==b)$k(h,g,"utf8"),m=!0}return{bindingsPatched:m,results:d,wranglerPath:Tc(h)?h:null}}function vk(e,t){return e.find((r)=>r.connector?.provider===t)}function wk(e){let t=Sm(e,".dev.vars");if(!Tc(t))return{};let r=new Map;for(let n of wm(t,"utf8").split(`
6
- `)){let s=n.trim();if(s===""||s.startsWith("#"))continue;let i=s.indexOf("=");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(o!=="")r.set(o,a)}return Object.fromEntries(r)}var _m=q(()=>{om();nn();Hi();ve()});function os(e){return e.startsWith(ua)}function Pm(e){let t=e;if(os(t))t=t.slice(ua.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Ic}${t}.js`}function jm(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",r=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Ic}${r}`:`${Ic}${r}.${t}`}function km(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function da(e){let t=km(e);return t.startsWith("/")?t:`/${t}`}function Sk(e,t){return[...e].toSorted((r,n)=>n[t].length-r[t].length)}function fa(e,t){let r=t.split("#")[0].split("?")[0];if(!r.startsWith("/"))return null;let n;try{n=decodeURIComponent(r)}catch{return null}if(/%2e|%2f/i.test(n))return null;for(let s of Sk(e,"urlPrefix")){let i=da(s.urlPrefix);if(!n.startsWith(`${i}/`))continue;let a=n.slice(i.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${km(s.dir)}/${a.join("/")}`}return null}function Rm(e,t){let r=new Set;for(let n of t){let s=da(n.urlPrefix),i=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${Ek}]+`,"g");for(let o of e.matchAll(i)){let a=o[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))r.add(a)}}return[...r].filter(Boolean)}function Mc(e){let t=[],r=0;while(r<e.length){while(r<e.length&&(/\s/.test(e[r])||e[r]===","))r+=1;if(r>=e.length)break;let n=r;while(r<e.length&&!/\s/.test(e[r]))r+=1;let s=e.slice(n,r);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(r<e.length&&/\s/.test(e[r]))r+=1;let i=r;while(r<e.length&&e[r]!==",")r+=1;let o=e.slice(i,r).trim();if(r+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:o,url:s})}return t}function Jc(e){return e.map(({url:t,descriptor:r})=>r?`${t} ${r}`:t).join(", ")}function as(e){if(!T(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let r=t.replace(/\/+$/,"");if(r===""||r==="/")return"";return r.startsWith("/")?r:`/${r}`}function Ie(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function An(e,t){let r=new URL(t);if(!r.pathname.endsWith("/"))r.pathname+="/";return new URL(e.replace(/^\/+/,""),r).href}var ua="npm:",Ic="/assets/",Ek;var nr=q(()=>{ve();Ek=String.raw`"'\s<>()\\`});function Am(e,t){return e.replaceAll(Rk,(r,n,s)=>{let i=s.trim(),o=Tk.exec(i),a=o?o[2]:i,l=Ie(t,a);if(l===a)return r;return`url(${n}${o?`${o[1]}${l}${o[1]}`:l}${n})`})}function Ik(e,t,r,n,s){let i=r.toLowerCase();if(_k.has(i))return Ie(s,n);if(Pk.has(i)){let o=Mc(n);return o.length===0?n:Jc(o.map((a)=>({descriptor:a.descriptor,url:Ie(s,a.url)})))}if(i==="style")return Am(n,s);if(i==="content"&&e==="meta"&&Nk.test(t))return Ie(s,n);return n}function Om(e,t){if(t==="")return e;let r=e.replaceAll(Ok,(n,s,i,o)=>{let a=i.replaceAll(Ak,(l,c)=>`"${Ie(t,c)}"`);return s+a+o});return r=r.replaceAll(Ck,(n,s,i,o)=>s+Am(i,t)+o),r.replaceAll(jk,(n,s,i)=>{if(i==="")return n;let o=s.toLowerCase(),a=i.replaceAll(kk,(l,c,d,p,h)=>{let m=p===void 0?"'":'"',b=p??h??"",g=Ik(o,i,c,b,t);return g===b?l:`${c}=${m}${g}${m}`});return a===i?n:`<${s}${a}>`})}var _k,Pk,jk,kk,Rk,Ak,Ok,Ck,Nk,Tk;var Cm=q(()=>{nr();_k=new Set(["href","src","poster","action","formaction","data"]),Pk=new Set(["srcset","imagesrcset"]),jk=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,kk=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,Rk=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,Ak=/"(\/[^"/][^"]*)"/g,Ok=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,Ck=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,Nk=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,Tk=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var Ea=C(function(hz,nh){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:Hc,getOwnPropertyDescriptor:Mk,getOwnPropertyNames:Jk}=Object,Dk=Object.prototype.hasOwnProperty,Lk=(e,t)=>{for(var r in t)Hc(e,r,{get:t[r],enumerable:!0})},Fk=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of Jk(t))if(!Dk.call(e,s)&&s!==r)Hc(e,s,{get:()=>t[s],enumerable:!(n=Mk(t,s))||n.enumerable})}return e},qk=(e)=>Fk(Hc({},"__esModule",{value:!0}),e),Ui={};Lk(Ui,{analyzeMetafile:()=>bR,analyzeMetafileSync:()=>wR,build:()=>mR,buildSync:()=>xR,context:()=>hR,default:()=>PR,formatMessages:()=>yR,formatMessagesSync:()=>vR,initialize:()=>ER,stop:()=>SR,transform:()=>gR,transformSync:()=>$R,version:()=>pR});nh.exports=qk(Ui);function Nm(e){let t=(n)=>{if(n===null)r.write8(0);else if(typeof n==="boolean")r.write8(1),r.write8(+n);else if(typeof n==="number")r.write8(2),r.write32(n|0);else if(typeof n==="string")r.write8(3),r.write($r(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let s of n)t(s)}else{let s=Object.keys(n);r.write8(6),r.write32(s.length);for(let i of s)r.write($r(i)),t(n[i])}},r=new Vm;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Lc(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function Hk(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return fs(r.read());case 4:return r.read();case 5:{let o=r.read32(),a=[];for(let l=0;l<o;l++)a.push(t());return a}case 6:{let o=r.read32(),a={};for(let l=0;l<o;l++)a[fs(r.read())]=t();return a}default:throw Error("Invalid packet")}},r=new Vm(e),n=r.read32(),s=(n&1)===0;n>>>=1;let i=t();if(r.ptr!==e.length)throw Error("Invalid packet");return{id:n,isRequest:s,value:i}}var Vm=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);Lc(this.buf,e,t)}write(e){let t=this._write(4+e.length);Lc(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 Bm(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},$r,fs,Dc;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;$r=(r)=>e.encode(r),fs=(r)=>t.decode(r),Dc='new TextEncoder().encode("")'}else if(typeof Buffer<"u")$r=(e)=>Buffer.from(e),fs=(e)=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},Dc='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!($r("")instanceof Uint8Array))throw Error(`Invariant violation: "${Dc} instanceof Uint8Array" is incorrectly false
2
+ import{createRequire as ak}from"node:module";var tk=Object.create;var{getPrototypeOf:rk,defineProperty:Xp,getOwnPropertyNames:nk}=Object;var Zp=Object.prototype.hasOwnProperty;function sk(e){return this[e]}var ik,ok,Lt=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var s=t?ik??=new WeakMap:ok??=new WeakMap,i=s.get(e);if(i)return i}r=e!=null?tk(rk(e)):{};let o=t||!e||!e.__esModule||!Zp.call(e,"default")?Xp(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of nk(e))if(!Zp.call(o,a))Xp(o,a,{get:sk.bind(e,a),enumerable:!0})}if(n)s.set(e,o);return o};var C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var q=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var Te=ak(import.meta.url);function N(e){return typeof e==="string"}function Ft(e){return typeof e==="number"}function $t(e){return typeof e==="boolean"}function vt(e){return typeof e==="function"}function F(e){return typeof e==="object"&&e!==null}function z(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ce(e){return z(e)&&typeof e.$ref==="string"}function tr(e){return z(e)&&e.$prototype==="Function"}function rr(e){return z(e)&&z(e.$expression)}function ns(e){return rr(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function _n(e){return tr(e)&&Array.isArray(e.body)}function Tr(e){return z(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function tn(e){return z(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Qp(e){return z(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Pn(e){if(!z(e))return!1;for(let t of Object.keys(e))if(!em.has(t))return!1;return!0}function Qe(e){return z(e)&&e.$prototype==="Array"}function kc(e){return(Array.isArray(e)?e:[e]).some((r)=>Qe(r))}function tm(e){return z(e)&&e.$prototype==="Class"}function qt(e){return z(e)}function pe(e){return typeof e==="string"&&e.includes("${")}function ss(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(e)}function is(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function rn(e){if(!e)return[];return e.map((t)=>N(t)?t:t.name)}function lk(e){return typeof e==="string"}function Nr(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!z(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 z(t.cases)&&Object.values(t.cases).every((r)=>N(r))&&typeof t.default==="string";return!1}function Js(e){if(lk(e))return[e];if(!Nr(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}var em;var $e=q(()=>{em=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"])});function nm(e){let t=[],r=[],n=null,s=0,i=()=>r.at(-1)?.path??"",o=()=>n===null?i():dk(i(),n),a=()=>{s+=1;let l="";while(s<e.length){let c=e[s];if(c==="\\"){let u=e[s+1]??"";if(u==="u")l+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else l+=ck.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(rm.has(l)||l===","||l===":"){s+=1;continue}if(l==="{"||l==="["){r.push(l==="{"?{keys:new Set,kind:"object",path:o()}:{kind:"array",path:o()}),n=null,s+=1;continue}if(l==="}"||l==="]"){r.pop(),n=null,s+=1;continue}if(l==='"'){let u=a(),p=r.at(-1);if(p?.kind==="object"&&uk(e,s)===":"){if(p.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:p.path});p.keys.add(u),n=u}else n=null;continue}if(l==="-"||l>="0"&&l<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let p=e.slice(u,s);if(!fk(p))t.push({detail:p,kind:"unsafe-number",path:o()});n=null;continue}let c=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===c)s+=1;n=null}return t}function uk(e,t){let r=t;while(r<e.length&&rm.has(e[r]))r+=1;return e[r]??""}function dk(e,t){return e===""?t:`${e}.${t}`}function fk(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function sm(e){let t=e.path===""?"the document root":`"${e.path}"`;return e.kind==="duplicate-key"?`duplicate key "${e.detail}" in ${t} — JSON.parse keeps the last one and `+"silently discards the first (RFC 7493 §2.3)":`number ${e.detail} in ${t} cannot be represented exactly and will change when `+"the document is written back (RFC 7493 §2.2)"}var rm,ck;var im=q(()=>{rm=new Set([" ","\t",`
3
+ `,"\r"]);ck=new Map([["b","\b"],["f","\f"],["n",`
4
+ `],["r","\r"],["t","\t"]])});function we(e){return e instanceof Error?e.message:String(e)}function am(e){if(N(e))return om.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>am(t));if(z(e))return lm(e);return e}function lm(e){let t={};for(let[r,n]of Object.entries(e))t[om.test(r)?r.normalize("NFC"):r]=am(n);return t}function Rc(e,t,r){let n;try{n=JSON.parse(e)}catch(i){throw Error(`Failed to parse ${r} at ${t}: ${we(i)}`,{cause:i})}if(!z(n))throw Error(`Invalid ${r} at ${t}: expected a JSON object`);let s=nm(e);if(s.length>0){let i=s.map((o)=>sm(o)).join("; ");throw Error(`Invalid ${r} at ${t}: ${i}`)}return lm(n)}function jn(e,t){return Rc(e,t,"Jx document")}function cm(e,t){return Rc(e,t,"project config")}function um(e,t){return Rc(e,t,"class definition")}var om;var nr=q(()=>{$e();im();om=/[^\p{ASCII}]/u});function pk(e){return JSON.parse(e)}function Ds(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function mk(e){return Ds(e)&&typeof e.binding==="string"}function hk(e){try{let t=pk(e);return Ds(t)?t:void 0}catch{return}}function dm(e,t){if(t.length===0)return{content:e??"",patched:!1};let r={};if(e){let n=hk(e);if(n===void 0)return{content:e,patched:!1};r=n}for(let n of t)fm(r,n);return{content:`${JSON.stringify(r,null,"\t")}
5
+ `,patched:!0}}function fm(e,t){for(let[r,n]of Object.entries(t)){let s=r in e?e[r]:void 0;if(Array.isArray(n)){e[r]=gk(Array.isArray(s)?s:[],n);continue}if(Ds(n)){if(Ds(s))fm(s,n);else if(s===void 0)e[r]=structuredClone(n);continue}if(s===void 0)e[r]=n}}function gk(e,t){let r=[...e];for(let n of t){if(!mk(n)){if(!r.some((a)=>JSON.stringify(a)===JSON.stringify(n)))r.push(structuredClone(n));continue}let s=r.findIndex((o)=>Ds(o)&&o.binding===n.binding),i=r[s];if(Ds(i))r[s]={...i,...n};else r.push(structuredClone(n))}return r}var pm=()=>{};function ym(e){if(!N(e))return null;let[t,...r]=e.split(";"),n=(t??"").indexOf("/");if(n===-1)return null;let s=(t??"").slice(0,n).trim().toLowerCase(),i=(t??"").slice(n+1).trim().toLowerCase();if(!mm.test(s)||!mm.test(i))return null;let o=i.lastIndexOf("+"),a=o===-1?null:i.slice(o+1),l=o===-1?i:i.slice(0,o);if(a==="")return null;let c=l.indexOf("."),u=c===-1?null:l.slice(0,c),p=u!==null&&yk.has(u)?u:null,g=p===null?l:l.slice(p.length+1);if(g==="")return null;let m={};for(let b of r){let h=b.indexOf("=");if(h===-1)return null;let y=b.slice(0,h).trim().toLowerCase(),v=b.slice(h+1).trim();if(y==="")return null;if(v.startsWith('"')&&v.endsWith('"')&&v.length>=2)v=v.slice(1,-1);m[y]=v}return{parameters:m,subtype:g,suffix:a,tree:p,type:s}}function bm(e){if(!N(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(ym(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function xm(e){let t=ym(e);if(t===null)return null;let r=t.tree===null?"":`${t.tree}.`,n=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${r}${t.subtype}${n}`}var mm,yk,hm="text/markdown; variant=GFM",gm="application/yaml",$m;var Ac=q(()=>{$e();mm=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,yk=new Set(["vnd","prs","x"]);$m={".markdown":`${hm}; charset=utf-8`,".md":`${hm}; charset=utf-8`,".yaml":`${gm}; charset=utf-8`,".yml":`${gm}; charset=utf-8`}});function Em(e){if(e===null)throw TypeError("A class descriptor cannot be null");return z(e)?e:{}}class aa{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,r,n){this.name=e,this.classPath=t,this.classDef=r,this.#t=n;let{format:s}=r;this.extensions=(s?.extensions??[]).map((i)=>i.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=xm(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=r.$studio??null,this.project=r.project??null,this.server=r.server??null,this.connector=r.connector??null,this.capabilities=xk(r)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#r(await this.implementation())}#r(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let r=this.capabilities[e];if(!r)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let n=this.#r(await this.implementation()),s=n?.[r.identifier];if(!vt(s)){let o=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${o}" has no static "${r.identifier}" method`)}return await s.call(n,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class la{#t;constructor(e){this.#t=e;for(let t of e){if(t.mediaType===null)continue;let r=bm(t.mediaType);if(r!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${r}`)}for(let t of wm){let r=new Map;for(let n of e){if(!n.capabilities[t])continue;for(let s of n.extensions){let i=r.get(s);if(i)throw Error(`Format conflict: "${i.name}" and "${n.name}" both claim "${s}" with the "${t}" capability`);r.set(s,n)}}}}get entries(){return this.#t}byExtension(e,t){let r=vm(e);return this.#t.find((n)=>n.extensions.includes(r)&&(!t||n.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#t.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let r of this.#t){if(e&&!r.documentKinds.includes(e))continue;for(let n of r.extensions)t.add(n)}return t.delete(".json"),[...t]}has(e){let t=vm(e);return this.#t.some((r)=>r.extensions.includes(t))}}function xk(e){let t={},r=e.$defs?.methods??{};for(let[n,s]of Object.entries(r)){let{role:i}=s;if(!vk(i))continue;let o={identifier:s.identifier??n,timing:s.timing??bk};if(N(s.discriminator))o.discriminator=s.discriminator;t[i]=o}return t}function vk(e){return e!==void 0&&$k.has(e)}function vm(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var wm,Sm,bk,$k;var Oc=q(()=>{$e();Ac();wm=["parse","serialize","rewrite","discover","load"],Sm=[...wm,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];bk=["compiler","server"];$k=new Set(Sm)});class _m{#t;#e;#r;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let i of s.classes){let o=t.get(i.name);if(o&&o!==s.specifier)throw Error(`Extension conflict: "${o}" and "${s.specifier}" both provide a class named "${i.name}"`);t.set(i.name,s.specifier)}let r=new Map;for(let s of this.#e){if(!s.project)continue;let i=r.get(s.project.key);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both claim the project section "${s.project.key}"`);r.set(s.project.key,s)}let n=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:i}=s.server;if(!i.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${i}" must be under /_jx/`);let o=n.get(i);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both mount "${i}"`);n.set(i,s)}this.#r=new la(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#r}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function Pm(e,t,r){let n=[];for(let s of e??[])n.push(await wk(s,t,r));return new _m(n)}async function wk(e,t,r){let n;if(e.startsWith("./")||e.startsWith("../")){let l=t.resolvePath(r,e);n=t.resolvePath(`${l}/package.json`,`./${qi}`)}else try{n=t.resolvePath(r,`${e}/${qi}`)}catch(l){throw Error(`Extension "${e}" is not resolvable: it must export ${qi} (is the package installed, and does its exports map include it?): ${Cc(l)}`,{cause:l})}let s;try{s=await t.loadJson(n)}catch(l){throw Error(`Extension "${e}": cannot read manifest ${n}: ${Cc(l)}`,{cause:l})}if(!z(s)||!N(s.name))throw Error(`Extension "${e}": ${qi} must declare a "name"`);let i=s;if(!e.startsWith(".")&&i.name!==e)throw Error(`Extension "${e}": manifest name "${i.name}" does not match the specifier`);let o=[];for(let[l,c]of Object.entries(i.classes??{})){let u=t.resolvePath(n,c),p;try{p=await t.loadJson(u)}catch(g){throw Error(`Extension "${e}": cannot read class "${l}" at ${u}: ${Cc(g)}`,{cause:g})}o.push(new aa(l,u,Em(p),t))}let a={};if(i.schemas?.project)a.project=t.resolvePath(n,i.schemas.project);if(i.schemas?.document)a.document=t.resolvePath(n,i.schemas.document);if(i.schemas?.fields)a.fields=t.resolvePath(n,i.schemas.fields);return{specifier:e,manifestPath:n,manifest:i,classes:o,schemas:a}}function Cc(e){return e instanceof Error?e.message:String(e)}var qi="jx-extension.json";var jm=q(()=>{Oc();$e();Oc()});import{readFileSync as Sk}from"node:fs";import{dirname as Ek,isAbsolute as _k,resolve as Tc,sep as ca}from"node:path";import{pathToFileURL as Pk}from"node:url";import{createRequire as jk}from"node:module";async function Nc(e){let t=[e],r=`${ca}src${ca}`,n=`${ca}dist${ca}`;if(e.includes(r)){let i=e.replace(r,n);if(t.push(i),i.endsWith(".ts"))t.push(`${i.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);let s;for(let i of t)try{return await import(Pk(i).href)}catch(o){s=o}throw s instanceof Error?s:Error(String(s))}function Ic(e,t){return jk(Tc(e,"package.json")).resolve(t)}function Mc(e){return{importModule:(t)=>Nc(t),loadJson:async(t)=>JSON.parse(Sk(t,"utf8")),resolvePath:(t,r)=>{if(r.startsWith("./")||r.startsWith("../"))return Tc(Ek(t),r);if(_k(r))return r;return Ic(e,r)}}}async function kn(e,t){return Pm(t?.extensions,Mc(e),Tc(e,"project.json"))}function ua(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 nn=q(()=>{jm();$e()});import{existsSync as kk,readFileSync as Rk}from"node:fs";import{resolve as km}from"node:path";function Rn(e){let t=km(e,"project.json");if(!kk(t))throw Error(`project.json not found in ${e}`);let r;try{r=cm(Rk(t,"utf8"),t)}catch(o){throw Error(`Invalid project.json: ${we(o)}`,{cause:o})}let n={...Hi,...r,build:{...Hi.build,...r.build},defaults:{...Hi.defaults,...r.defaults},images:{...Hi.images,...r.images},url:r.url??Hi.url};if(r.$head)n.$head=r.$head;if(r.$media)n.$media=r.$media;if(r.style)n.style=r.style;if(r.state)n.state=r.state;if(r.redirects)n.redirects=r.redirects;if(r.imports)n.imports=r.imports;let s=["cloudflare-workers","cloudflare-pages","node","bun"];if(n.build.adapter==="static")delete n.build.adapter;if(n.build.adapter&&!s.includes(n.build.adapter))throw Error(`Unknown build adapter "${n.build.adapter}" in project.json. Valid adapters: ${s.join(", ")}`);let i=["build","cloudflare"];if(!i.includes(n.images.service))throw Error(`Unknown images.service "${n.images.service}" in project.json. Valid services: ${i.join(", ")}`);return{config:n,configPath:t,projectRoot:km(e)}}var Hi;var Vi=q(()=>{nr();Hi={$head:[],$media:{},build:{format:"directory",outDir:"./dist",provider:null,trailingSlash:"always"},defaults:{charset:"utf8",lang:"en",layout:null},images:{formats:["webp","avif"],lazyLoad:!0,optimize:!0,picture:!0,quality:{avif:65,jpeg:80,png:80,webp:80},service:"build",sizes:"(max-width: 768px) 100vw, 50vw",widths:[320,640,960,1280,1920]},imports:{},name:"Jx Site",redirects:{},state:{},style:{},url:""}});import{existsSync as Jc,readFileSync as Rm,writeFileSync as Ak}from"node:fs";import{resolve as Am}from"node:path";async function Om(e,t={}){let{dryRun:r=!1,connection:n}=t,{config:s}=Rn(e),i=await kn(e,s),o=z(s.connections)?s.connections:{},a=z(s.data)?s.data:{},l=Object.keys(o).filter((b)=>!n||b===n);if(n&&l.length===0)throw Error(`Unknown connection "${n}" (no such connections entry in project.json)`);if(l.length===0)throw Error('project.json has no "connections" section — nothing to push. Declare a connection and '+'its tables in the "data" section first.');let c={...process.env,...Ck(e),JX_PROJECT_ROOT:e},u=[],p=[];for(let b of l){let h=o[b],y=z(h)?{...h,$name:b}:{$name:b},v=String(y.provider??""),j=Ok(i.connectors(),v);if(!j)throw Error(`Connection "${b}" names provider "${v}", but no enabled extension provides it (enable the extension in project.json "extensions")`);let S={};for(let[E,O]of Object.entries(a))if(z(O)&&O.connection===b)S[E]=O;let _=await j.call("deploySchema",S,y,{dryRun:r,env:c});if(u.push({applied:_.applied??!r,connection:b,provider:v,statements:_.statements??[],tables:Object.keys(S),warnings:_.warnings??[]}),j.capabilities.bindings){let E=await j.call("bindings",y);if(z(E)&&Object.keys(E).length>0)p.push(E)}}let g=Am(e,"wrangler.jsonc"),m=!1;if(!r&&p.length>0&&Jc(g)){let b=Rm(g,"utf8"),{content:h,patched:y}=dm(b,p);if(y&&h!==b)Ak(g,h,"utf8"),m=!0}return{bindingsPatched:m,results:u,wranglerPath:Jc(g)?g:null}}function Ok(e,t){return e.find((r)=>r.connector?.provider===t)}function Ck(e){let t=Am(e,".dev.vars");if(!Jc(t))return{};let r=new Map;for(let n of Rm(t,"utf8").split(`
6
+ `)){let s=n.trim();if(s===""||s.startsWith("#"))continue;let i=s.indexOf("=");if(i===-1)continue;let o=s.slice(0,i).trim(),a=s.slice(i+1).trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))a=a.slice(1,-1);if(o!=="")r.set(o,a)}return Object.fromEntries(r)}var Cm=q(()=>{pm();nn();Vi();$e()});function os(e){return e.startsWith(da)}function Tm(e){let t=e;if(os(t))t=t.slice(da.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Dc}${t}.js`}function Nm(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",r=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Dc}${r}`:`${Dc}${r}.${t}`}function Im(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function fa(e){let t=Im(e);return t.startsWith("/")?t:`/${t}`}function Tk(e,t){return[...e].toSorted((r,n)=>n[t].length-r[t].length)}function pa(e,t){let r=t.split("#")[0].split("?")[0];if(!r.startsWith("/"))return null;let n;try{n=decodeURIComponent(r)}catch{return null}if(/%2e|%2f/i.test(n))return null;for(let s of Tk(e,"urlPrefix")){let i=fa(s.urlPrefix);if(!n.startsWith(`${i}/`))continue;let a=n.slice(i.length+1).split("/");if(a.some((c)=>c===""||c==="."||c===".."))return null;let{filter:l}=s;if(l&&!l(a.join("/")))return null;return`${Im(s.dir)}/${a.join("/")}`}return null}function Mm(e,t){let r=new Set;for(let n of t){let s=fa(n.urlPrefix),i=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${Nk}]+`,"g");for(let o of e.matchAll(i)){let a=o[0].split("#")[0].split("?")[0];if(!a.endsWith("/"))r.add(a)}}return[...r].filter(Boolean)}function Lc(e){let t=[],r=0;while(r<e.length){while(r<e.length&&(/\s/.test(e[r])||e[r]===","))r+=1;if(r>=e.length)break;let n=r;while(r<e.length&&!/\s/.test(e[r]))r+=1;let s=e.slice(n,r);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(r<e.length&&/\s/.test(e[r]))r+=1;let i=r;while(r<e.length&&e[r]!==",")r+=1;let o=e.slice(i,r).trim();if(r+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:o,url:s})}return t}function Fc(e){return e.map(({url:t,descriptor:r})=>r?`${t} ${r}`:t).join(", ")}function as(e){if(!N(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let r=t.replace(/\/+$/,"");if(r===""||r==="/")return"";return r.startsWith("/")?r:`/${r}`}function Ie(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function An(e,t){let r=new URL(t);if(!r.pathname.endsWith("/"))r.pathname+="/";return new URL(e.replace(/^\/+/,""),r).href}var da="npm:",Dc="/assets/",Nk;var sr=q(()=>{$e();Nk=String.raw`"'\s<>()\\`});function Jm(e,t){return e.replaceAll(Lk,(r,n,s)=>{let i=s.trim(),o=Bk.exec(i),a=o?o[2]:i,l=Ie(t,a);if(l===a)return r;return`url(${n}${o?`${o[1]}${l}${o[1]}`:l}${n})`})}function Wk(e,t,r,n,s){let i=r.toLowerCase();if(Ik.has(i))return Ie(s,n);if(Mk.has(i)){let o=Lc(n);return o.length===0?n:Fc(o.map((a)=>({descriptor:a.descriptor,url:Ie(s,a.url)})))}if(i==="style")return Jm(n,s);if(i==="content"&&e==="meta"&&Vk.test(t))return Ie(s,n);return n}function Dm(e,t){if(t==="")return e;let r=e.replaceAll(qk,(n,s,i,o)=>{let a=i.replaceAll(Fk,(l,c)=>`"${Ie(t,c)}"`);return s+a+o});return r=r.replaceAll(Hk,(n,s,i,o)=>s+Jm(i,t)+o),r.replaceAll(Jk,(n,s,i)=>{if(i==="")return n;let o=s.toLowerCase(),a=i.replaceAll(Dk,(l,c,u,p,g)=>{let m=p===void 0?"'":'"',b=p??g??"",h=Wk(o,i,c,b,t);return h===b?l:`${c}=${m}${h}${m}`});return a===i?n:`<${s}${a}>`})}var Ik,Mk,Jk,Dk,Lk,Fk,qk,Hk,Vk,Bk;var Lm=q(()=>{sr();Ik=new Set(["href","src","poster","action","formaction","data"]),Mk=new Set(["srcset","imagesrcset"]),Jk=/<([a-zA-Z][a-zA-Z0-9-]*)((?:"[^"]*"|'[^']*'|[^>"'])*)>/g,Dk=/([a-zA-Z_:][\w:.-]*)\s*=\s*("([^"]*)"|'([^']*)')/g,Lk=/url\(\s*(['"]?)([^'")]+)\1\s*\)/g,Fk=/"(\/[^"/][^"]*)"/g,qk=/(<script\b[^>]*\btype\s*=\s*["']importmap["'][^>]*>)([\s\S]*?)(<\/script>)/gi,Hk=/(<style\b[^>]*>)([\s\S]*?)(<\/style>)/gi,Vk=/\b(?:property|name)\s*=\s*["'](?:og:|twitter:)[\w:.-]*(?:image|url|video|audio|player)[\w:.-]*["']/i,Bk=/^(&quot;|&#34;|&apos;|&#39;)([\s\S]*)\1$/});var _a=C(function(kz,uh){var __dirname="/home/runner/work/jx/jx/node_modules/esbuild/lib",__filename="/home/runner/work/jx/jx/node_modules/esbuild/lib/main.js",{defineProperty:Wc,getOwnPropertyDescriptor:Uk,getOwnPropertyNames:zk}=Object,Gk=Object.prototype.hasOwnProperty,Kk=(e,t)=>{for(var r in t)Wc(e,r,{get:t[r],enumerable:!0})},Yk=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of zk(t))if(!Gk.call(e,s)&&s!==r)Wc(e,s,{get:()=>t[s],enumerable:!(n=Uk(t,s))||n.enumerable})}return e},Xk=(e)=>Yk(Wc({},"__esModule",{value:!0}),e),zi={};Kk(zi,{analyzeMetafile:()=>kR,analyzeMetafileSync:()=>CR,build:()=>ER,buildSync:()=>RR,context:()=>_R,default:()=>MR,formatMessages:()=>jR,formatMessagesSync:()=>OR,initialize:()=>NR,stop:()=>TR,transform:()=>PR,transformSync:()=>AR,version:()=>SR});uh.exports=Xk(zi);function Fm(e){let t=(n)=>{if(n===null)r.write8(0);else if(typeof n==="boolean")r.write8(1),r.write8(+n);else if(typeof n==="number")r.write8(2),r.write32(n|0);else if(typeof n==="string")r.write8(3),r.write($r(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let s of n)t(s)}else{let s=Object.keys(n);r.write8(6),r.write32(s.length);for(let i of s)r.write($r(i)),t(n[i])}},r=new Ym;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Hc(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function Zk(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return fs(r.read());case 4:return r.read();case 5:{let o=r.read32(),a=[];for(let l=0;l<o;l++)a.push(t());return a}case 6:{let o=r.read32(),a={};for(let l=0;l<o;l++)a[fs(r.read())]=t();return a}default:throw Error("Invalid packet")}},r=new Ym(e),n=r.read32(),s=(n&1)===0;n>>>=1;let i=t();if(r.ptr!==e.length)throw Error("Invalid packet");return{id:n,isRequest:s,value:i}}var Ym=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);Hc(this.buf,e,t)}write(e){let t=this._write(4+e.length);Hc(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 Xm(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},$r,fs,qc;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;$r=(r)=>e.encode(r),fs=(r)=>t.decode(r),qc='new TextEncoder().encode("")'}else if(typeof Buffer<"u")$r=(e)=>Buffer.from(e),fs=(e)=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},qc='Buffer.from("")';else throw Error("No UTF-8 codec found");if(!($r("")instanceof Uint8Array))throw Error(`Invariant violation: "${qc} instanceof Uint8Array" is incorrectly false
7
7
 
8
8
  This indicates that your JavaScript environment is broken. You cannot use
9
9
  esbuild in this environment because esbuild relies on this invariant. This
10
10
  is not a problem with esbuild. You need to fix your environment instead.
11
- `);function Bm(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Lc(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var sn=String.fromCharCode;function cr(e,t,r){let n=e[t],s=1,i=0;for(let o=0;o<t;o++)if(e[o]===10)s++,i=0;else i++;throw SyntaxError(r?r:t===e.length?"Unexpected end of input while parsing JSON":n>=32&&n<=126?`Unexpected character ${sn(n)} in JSON at position ${t} (line ${s}, column ${i})`:`Unexpected byte 0x${n.toString(16)} in JSON at position ${t} (line ${s}, column ${i})`)}function Vk(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],r=[],n=[],s=e.length,i=null,o=0,a,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let d;if(o===2&&i===null&&c!==34&&c!==125)cr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)cr(e,--l);d=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)cr(e,--l);d=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)cr(e,--l);d=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let p=l;d=sn(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:{d+=sn(c),c=e[++l];continue}}break}if(d=+d,isNaN(d))cr(e,--p,"Invalid number");break}case 34:{d="";while(!0){if(l>=s)cr(e,s);if(c=e[l++],c===34)break;else if(c===92)switch(e[l++]){case 34:d+='"';break;case 47:d+="/";break;case 92:d+="\\";break;case 98:d+="\b";break;case 102:d+="\f";break;case 110:d+=`
12
- `;break;case 114:d+="\r";break;case 116:d+="\t";break;case 117:{let p=0;for(let h=0;h<4;h++)if(c=e[l++],p<<=4,c>=48&&c<=57)p|=c-48;else if(c>=97&&c<=102)p|=c+-87;else if(c>=65&&c<=70)p|=c+-55;else cr(e,--l);d+=sn(p);break}default:cr(e,--l);break}else if(c<=127)d+=sn(c);else if((c&224)===192)d+=sn((c&31)<<6|e[l++]&63);else if((c&240)===224)d+=sn((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let p=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(p>65535)p-=65536,d+=sn(p>>10&1023|55296),p=56320|p&1023;d+=sn(p)}}d[0];break}case 91:{d=[],t.push(i),r.push(a),n.push(o),i=null,a=d,o=1;continue}case 123:{d={},t.push(i),r.push(a),n.push(o),i=null,a=d,o=2;continue}case 93:{if(o!==1)cr(e,--l);d=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)cr(e,--l);d=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:cr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){case 0:{if(l===s)return d;break}case 1:{if(a.push(d),c===44){l++;continue}if(c===93)continue;break}case 2:{if(i===null){if(i=d,c===58){l++;continue}}else{if(a[i]=d,i=null,c===44){l++;continue}if(c===125)continue}break}}break}cr(e,l)}var it=JSON.stringify,Tm="warning",Im="silent";function Ls(e,t){let r=[];for(let n of e){if(qt(n,t),n.indexOf(",")>=0)throw Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var ha=()=>null,Ge=(e)=>typeof e==="boolean"?null:"a boolean",re=(e)=>typeof e==="string"?null:"a string",ga=(e)=>e instanceof RegExp?null:"a RegExp object",cs=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",Bk=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Wm=(e)=>typeof e==="function"?null:"a function",on=(e)=>Array.isArray(e)?null:"an array",Ht=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",sr=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",Wk=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",Uk=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Mm=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Um=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",zk=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",zm=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",Gm=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Gk=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function N(e,t,r,n){let s=e[r];if(t[r+""]=!0,s===void 0)return;let i=n(s);if(i!==null)throw Error(`${it(r)} must be ${i}`);return s}function tt(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${it(n)}`)}function Kk(e){let t=Object.create(null),r=N(e,t,"wasmURL",Gk),n=N(e,t,"wasmModule",Uk),s=N(e,t,"worker",Ge);return tt(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function Km(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n==="string"||n===!1)t[r]=n;else throw Error(`Expected ${it(r)} in mangle cache to map to either a string or false`)}}return t}function va(e,t,r,n,s){let i=N(t,r,"color",Ge),o=N(t,r,"logLevel",re),a=N(t,r,"logLimit",cs),l=N(t,r,"logStyle",re);if(i!==void 0)e.push(`--color=${i}`);else if(n)e.push("--color=true");if(e.push(`--log-level=${o||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function qt(e,t,r){if(typeof e!=="string")throw Error(`Expected value for ${t}${r!==void 0?" "+it(r):""} to be a string, got ${typeof e} instead`);return e}function Ym(e,t,r){let n=N(t,r,"legalComments",re),s=N(t,r,"sourceRoot",re),i=N(t,r,"sourcesContent",Ge),o=N(t,r,"target",zm),a=N(t,r,"format",re),l=N(t,r,"globalName",re),c=N(t,r,"mangleProps",ga),d=N(t,r,"reserveProps",ga),p=N(t,r,"mangleQuoted",Ge),h=N(t,r,"minify",Ge),m=N(t,r,"minifySyntax",Ge),b=N(t,r,"minifyWhitespace",Ge),g=N(t,r,"minifyIdentifiers",Ge),y=N(t,r,"lineLimit",cs),v=N(t,r,"drop",Ht),j=N(t,r,"dropLabels",Ht),S=N(t,r,"charset",re),P=N(t,r,"treeShaking",Ge),E=N(t,r,"ignoreAnnotations",Ge),O=N(t,r,"jsx",re),R=N(t,r,"jsxFactory",re),k=N(t,r,"jsxFragment",re),I=N(t,r,"jsxImportSource",re),D=N(t,r,"jsxDev",Ge),M=N(t,r,"jsxSideEffects",Ge),L=N(t,r,"define",sr),W=N(t,r,"logOverride",sr),se=N(t,r,"supported",sr),ue=N(t,r,"pure",Ht),oe=N(t,r,"keepNames",Ge),Q=N(t,r,"platform",re),ae=N(t,r,"tsconfigRaw",zk),ke=N(t,r,"absPaths",Ht);if(n)e.push(`--legal-comments=${n}`);if(s!==void 0)e.push(`--source-root=${s}`);if(i!==void 0)e.push(`--sources-content=${i}`);if(o)e.push(`--target=${Ls(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(Q)e.push(`--platform=${Q}`);if(ae)e.push(`--tsconfig-raw=${typeof ae==="string"?ae:JSON.stringify(ae)}`);if(h)e.push("--minify");if(m)e.push("--minify-syntax");if(b)e.push("--minify-whitespace");if(g)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(S)e.push(`--charset=${S}`);if(P!==void 0)e.push(`--tree-shaking=${P}`);if(E)e.push("--ignore-annotations");if(v)for(let U of v)e.push(`--drop:${qt(U,"drop")}`);if(j)e.push(`--drop-labels=${Ls(j,"drop label")}`);if(ke)e.push(`--abs-paths=${Ls(ke,"abs paths")}`);if(c)e.push(`--mangle-props=${ya(c)}`);if(d)e.push(`--reserve-props=${ya(d)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(O)e.push(`--jsx=${O}`);if(R)e.push(`--jsx-factory=${R}`);if(k)e.push(`--jsx-fragment=${k}`);if(I)e.push(`--jsx-import-source=${I}`);if(D)e.push("--jsx-dev");if(M)e.push("--jsx-side-effects");if(L)for(let U in L){if(U.indexOf("=")>=0)throw Error(`Invalid define: ${U}`);e.push(`--define:${U}=${qt(L[U],"define",U)}`)}if(W)for(let U in W){if(U.indexOf("=")>=0)throw Error(`Invalid log override: ${U}`);e.push(`--log-override:${U}=${qt(W[U],"log override",U)}`)}if(se)for(let U in se){if(U.indexOf("=")>=0)throw Error(`Invalid supported: ${U}`);let le=se[U];if(typeof le!=="boolean")throw Error(`Expected value for supported ${it(U)} to be a boolean, got ${typeof le} instead`);e.push(`--supported:${U}=${le}`)}if(ue)for(let U of ue)e.push(`--pure:${qt(U,"pure")}`);if(oe)e.push("--keep-names")}function Yk(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,d=null;va(o,t,l,r,n),Ym(o,t,l);let p=N(t,l,"sourcemap",Um),h=N(t,l,"bundle",Ge),m=N(t,l,"splitting",Ge),b=N(t,l,"preserveSymlinks",Ge),g=N(t,l,"metafile",Ge),y=N(t,l,"outfile",re),v=N(t,l,"outdir",re),j=N(t,l,"outbase",re),S=N(t,l,"tsconfig",re),P=N(t,l,"resolveExtensions",Ht),E=N(t,l,"nodePaths",Ht),O=N(t,l,"mainFields",Ht),R=N(t,l,"conditions",Ht),k=N(t,l,"external",Ht),I=N(t,l,"packages",re),D=N(t,l,"alias",sr),M=N(t,l,"loader",sr),L=N(t,l,"outExtension",sr),W=N(t,l,"publicPath",re),se=N(t,l,"entryNames",re),ue=N(t,l,"chunkNames",re),oe=N(t,l,"assetNames",re),Q=N(t,l,"inject",Ht),ae=N(t,l,"banner",sr),ke=N(t,l,"footer",sr),U=N(t,l,"entryPoints",Wk),le=N(t,l,"absWorkingDir",re),z=N(t,l,"stdin",sr),te=(i=N(t,l,"write",Ge))!=null?i:s,Le=N(t,l,"allowOverwrite",Ge),fe=N(t,l,"mangleCache",sr);if(l.plugins=!0,tt(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(h)o.push("--bundle");if(Le)o.push("--allow-overwrite");if(m)o.push("--splitting");if(b)o.push("--preserve-symlinks");if(g)o.push("--metafile");if(y)o.push(`--outfile=${y}`);if(v)o.push(`--outdir=${v}`);if(j)o.push(`--outbase=${j}`);if(S)o.push(`--tsconfig=${S}`);if(I)o.push(`--packages=${I}`);if(P)o.push(`--resolve-extensions=${Ls(P,"resolve extension")}`);if(W)o.push(`--public-path=${W}`);if(se)o.push(`--entry-names=${se}`);if(ue)o.push(`--chunk-names=${ue}`);if(oe)o.push(`--asset-names=${oe}`);if(O)o.push(`--main-fields=${Ls(O,"main field")}`);if(R)o.push(`--conditions=${Ls(R,"condition")}`);if(k)for(let G of k)o.push(`--external:${qt(G,"external")}`);if(D)for(let G in D){if(G.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${G}`);o.push(`--alias:${G}=${qt(D[G],"alias",G)}`)}if(ae)for(let G in ae){if(G.indexOf("=")>=0)throw Error(`Invalid banner file type: ${G}`);o.push(`--banner:${G}=${qt(ae[G],"banner",G)}`)}if(ke)for(let G in ke){if(G.indexOf("=")>=0)throw Error(`Invalid footer file type: ${G}`);o.push(`--footer:${G}=${qt(ke[G],"footer",G)}`)}if(Q)for(let G of Q)o.push(`--inject:${qt(G,"inject")}`);if(M)for(let G in M){if(G.indexOf("=")>=0)throw Error(`Invalid loader extension: ${G}`);o.push(`--loader:${G}=${qt(M[G],"loader",G)}`)}if(L)for(let G in L){if(G.indexOf("=")>=0)throw Error(`Invalid out extension: ${G}`);o.push(`--out-extension:${G}=${qt(L[G],"out extension",G)}`)}if(U)if(Array.isArray(U))for(let G=0,We=U.length;G<We;G++){let Xe=U[G];if(typeof Xe==="object"&&Xe!==null){let pt=Object.create(null),ut=N(Xe,pt,"in",re),Ue=N(Xe,pt,"out",re);if(tt(Xe,pt,"in entry point at index "+G),ut===void 0)throw Error('Missing property "in" for entry point at index '+G);if(Ue===void 0)throw Error('Missing property "out" for entry point at index '+G);a.push([Ue,ut])}else a.push(["",qt(Xe,"entry point at index "+G)])}else for(let G in U)a.push([G,qt(U[G],"entry point",G)]);if(z){let G=Object.create(null),We=N(z,G,"contents",Gm),Xe=N(z,G,"resolveDir",re),pt=N(z,G,"sourcefile",re),ut=N(z,G,"loader",re);if(tt(z,G,'in "stdin" object'),pt)o.push(`--sourcefile=${pt}`);if(ut)o.push(`--loader=${ut}`);if(Xe)d=Xe;if(typeof We==="string")c=$r(We);else if(We instanceof Uint8Array)c=We}let Be=[];if(E)for(let G of E)G+="",Be.push(G);return{entries:a,flags:o,write:te,stdinContents:c,stdinResolveDir:d,absWorkingDir:le,nodePaths:Be,mangleCache:Km(fe)}}function Xk(e,t,r,n){let s=[],i=Object.create(null);va(s,t,i,r,n),Ym(s,t,i);let o=N(t,i,"sourcemap",Um),a=N(t,i,"sourcefile",re),l=N(t,i,"loader",re),c=N(t,i,"banner",re),d=N(t,i,"footer",re),p=N(t,i,"mangleCache",sr);if(tt(t,i,`in ${e}() call`),o)s.push(`--sourcemap=${o===!0?"external":o}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(d)s.push(`--footer=${d}`);return{flags:s,mangleCache:Km(p)}}function Xm(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let P=a+S.length;if(P>o.length){let O=new Uint8Array(P*2);O.set(o),o=O}o.set(S,a),a+=S.length;let E=0;while(E+4<=a){let O=Bm(o,E);if(E+4+O>a)break;E+=4,b(o.subarray(E,E+O)),E+=O}if(E>0)o.copyWithin(0,E,a),a-=E},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let P="The service was stopped"+r.reason;for(let E in n)n[E](P,null);n={}},d=(S,P,E)=>{if(r.didClose)return E("The service is no longer running"+r.reason,null);let O=s++;if(n[O]=(R,k)=>{try{E(R,k)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(Nm({id:O,isRequest:!0,value:P}))},p=(S,P)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(Nm({id:S,isRequest:!1,value:P}))},h=async(S,P)=>{try{if(P.command==="ping"){p(S,{});return}if(typeof P.key==="number"){let E=t[P.key];if(!E)return;let O=E[P.command];if(O){await O(S,P);return}}throw Error("Invalid command: "+P.command)}catch(E){let O=[ls(E,e,null,void 0,"")];try{p(S,{errors:O})}catch{}}},m=!0,b=(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 ${it(E)}`);return}let P=Hk(S);if(P.isRequest)h(P.id,P.value);else{let E=n[P.id];if(delete n[P.id],P.value.error)E(P.value.error,{});else E(null,P.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:P,options:E,isTTY:O,defaultWD:R,callback:k})=>{let I=0,D=i++,M={},L={ref(){if(++I===1){if(P)P.ref()}},unref(){if(--I===0){if(delete t[D],P)P.unref()}}};t[D]=M,L.ref(),Zk(S,D,d,p,L,e,M,E,O,R,(W,se)=>{try{k(W,se)}finally{L.unref()}})},transform:({callName:S,refs:P,input:E,options:O,isTTY:R,fs:k,callback:I})=>{let D=Zm(),M=(L)=>{try{if(typeof E!=="string"&&!(E instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:W,mangleCache:se}=Xk(S,O,R,Im),ue={command:"transform",flags:W,inputFS:L!==null,input:L!==null?$r(L):typeof E==="string"?$r(E):E};if(se)ue.mangleCache=se;d(P,ue,(oe,Q)=>{if(oe)return I(Error(oe),null);let ae=Fs(Q.errors,D),ke=Fs(Q.warnings,D),U=1,le=()=>{if(--U===0){let z={warnings:ke,code:Q.code,map:Q.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in Q)z.legalComments=Q==null?void 0:Q.legalComments;if(Q.mangleCache)z.mangleCache=Q==null?void 0:Q.mangleCache;I(null,z)}};if(ae.length>0)return I(Bi("Transform failed",ae,ke),null);if(Q.codeFS)U++,k.readFile(Q.code,(z,te)=>{if(z!==null)I(z,null);else Q.code=te,le()});if(Q.mapFS)U++,k.readFile(Q.map,(z,te)=>{if(z!==null)I(z,null);else Q.map=te,le()});le()})}catch(W){let se=[];try{va(se,O,{},R,Im)}catch{}let ue=ls(W,e,D,void 0,"");d(P,{command:"error",flags:se,error:ue},()=>{ue.detail=D.load(ue.detail),I(Bi("Transform failed",[ue],[]),null)})}};if((typeof E==="string"||E instanceof Uint8Array)&&E.length>1048576){let L=M;M=()=>k.writeFile(E,L)}M(null)},formatMessages:({callName:S,refs:P,messages:E,options:O,callback:R})=>{if(!O)throw Error(`Missing second argument in ${S}() call`);let k={},I=N(O,k,"kind",re),D=N(O,k,"color",Ge),M=N(O,k,"terminalWidth",cs),L=N(O,k,"logStyle",re);if(tt(O,k,`in ${S}() call`),I===void 0)throw Error(`Missing "kind" in ${S}() call`);if(I!=="error"&&I!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${S}() call`);let W={command:"format-msgs",messages:an(E,"messages",null,"",M),isWarning:I==="warning"};if(D!==void 0)W.color=D;if(M!==void 0)W.terminalWidth=M;if(L!==void 0)W.logStyle=L;d(P,W,(se,ue)=>{if(se)return R(Error(se),null);R(null,ue.messages)})},analyzeMetafile:({callName:S,refs:P,metafile:E,options:O,callback:R})=>{if(O===void 0)O={};let k={},I=N(O,k,"color",Ge),D=N(O,k,"verbose",Ge);tt(O,k,`in ${S}() call`);let M={command:"analyze-metafile",metafile:E};if(I!==void 0)M.color=I;if(D!==void 0)M.verbose=D;d(P,M,(L,W)=>{if(L)return R(Error(L),null);R(null,W.result)})}}}}function Zk(e,t,r,n,s,i,o,a,l,c,d){let p=Zm(),h=e==="context",m=(y,v)=>{let j=[];try{va(j,a,{},l,Tm)}catch{}let S=ls(y,i,p,void 0,v);r(s,{command:"error",flags:j,error:S},()=>{S.detail=p.load(S.detail),d(Bi(h?"Context failed":"Build failed",[S],[]),null)})},b;if(typeof a==="object"){let y=a.plugins;if(y!==void 0){if(!Array.isArray(y))return m(Error('"plugins" must be an array'),"");b=y}}if(b&&b.length>0){if(i.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");Qk(t,r,n,s,i,o,a,b,p).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{g(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(v){m(v,"")}},(y)=>m(y,""));return}try{g(null,(y,v)=>v([],[]),()=>{})}catch(y){m(y,"")}function g(y,v,j){let S=i.hasFS,{entries:P,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I,nodePaths:D,mangleCache:M}=Yk(e,a,l,Tm,S);if(O&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:P,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I||c,nodePaths:D,context:h};if(y)L.plugins=y;if(M)L.mangleCache=M;let W=(oe,Q)=>{let ae={errors:Fs(oe.errors,p),warnings:Fs(oe.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},ke=ae.errors.slice(),U=ae.warnings.slice();if(oe.outputFiles)ae.outputFiles=oe.outputFiles.map(tR);if(oe.metafile&&oe.metafile.length)ae.metafile=rR(oe.metafile);if(oe.mangleCache)ae.mangleCache=oe.mangleCache;if(oe.writeToStdout!==void 0)console.log(fs(oe.writeToStdout).replace(/\n$/,""));v(ae,(le,z)=>{if(ke.length>0||le.length>0){let te=Bi("Build failed",ke.concat(le),U.concat(z));return Q(te,null,le,z)}Q(null,ae,le,z)})},se,ue;if(h)o["on-end"]=(oe,Q)=>new Promise((ae)=>{W(Q,(ke,U,le,z)=>{let te={errors:le,warnings:z};if(ue)ue(ke,U);se=void 0,ue=void 0,n(oe,te),ae()})});r(s,L,(oe,Q)=>{if(oe)return d(Error(oe),null);if(!h)return W(Q,(U,le)=>(j(),d(U,le)));if(Q.errors.length>0)return d(Bi("Context failed",Q.errors,Q.warnings),null);let ae=!1,ke={rebuild:()=>{if(!se)se=new Promise((U,le)=>{let z;ue=(Le,fe)=>{if(!z)z=()=>Le?le(Le):U(fe)};let te=()=>{r(s,{command:"rebuild",key:t},(fe,Be)=>{if(fe)le(Error(fe));else if(z)z();else te()})};te()});return se},watch:(U={})=>new Promise((le,z)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let te={},Le=N(U,te,"delay",cs);tt(U,te,"in watch() call");let fe={command:"watch",key:t};if(Le)fe.delay=Le;r(s,fe,(Be)=>{if(Be)z(Error(Be));else le(void 0)})}),serve:(U={})=>new Promise((le,z)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let te={},Le=N(U,te,"port",Bk),fe=N(U,te,"host",re),Be=N(U,te,"servedir",re),G=N(U,te,"keyfile",re),We=N(U,te,"certfile",re),Xe=N(U,te,"fallback",re),pt=N(U,te,"cors",sr),ut=N(U,te,"onRequest",Wm);tt(U,te,"in serve() call");let Ue={command:"serve",key:t,onRequest:!!ut};if(Le!==void 0)Ue.port=Le;if(fe!==void 0)Ue.host=fe;if(Be!==void 0)Ue.servedir=Be;if(G!==void 0)Ue.keyfile=G;if(We!==void 0)Ue.certfile=We;if(Xe!==void 0)Ue.fallback=Xe;if(pt){let bt={},Mt=N(pt,bt,"origin",zm);if(tt(pt,bt,'on "cors" object'),Array.isArray(Mt))Ue.corsOrigin=Mt;else if(Mt!==void 0)Ue.corsOrigin=[Mt]}r(s,Ue,(bt,Mt)=>{if(bt)return z(Error(bt));if(ut)o["serve-request"]=(Xr,En)=>{ut(En.args),n(Xr,{})};le(Mt)})}),cancel:()=>new Promise((U)=>{if(ae)return U();r(s,{command:"cancel",key:t},()=>{U()})}),dispose:()=>new Promise((U)=>{if(ae)return U();ae=!0,r(s,{command:"dispose",key:t},()=>{U(),j(),s.unref()})})};s.ref(),d(null,ke)})}}var Qk=async(e,t,r,n,s,i,o,a,l)=>{let c=[],d=[],p={},h={},m=[],b=0,g=0,y=[],v=!1;a=[...a];for(let P of a){let E={};if(typeof P!=="object")throw Error(`Plugin at index ${g} must be an object`);let O=N(P,E,"name",re);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${g} is missing a name`);try{let R=N(P,E,"setup",Wm);if(typeof R!=="function")throw Error("Plugin is missing a setup function");tt(P,E,`on plugin ${it(O)}`);let k={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};g++;let D=R({initialOptions:o,resolve:(M,L={})=>{if(!v)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof M!=="string")throw Error("The path to resolve must be a string");let W=Object.create(null),se=N(L,W,"pluginName",re),ue=N(L,W,"importer",re),oe=N(L,W,"namespace",re),Q=N(L,W,"resolveDir",re),ae=N(L,W,"kind",re),ke=N(L,W,"pluginData",ha),U=N(L,W,"with",sr);return tt(L,W,"in resolve() call"),new Promise((le,z)=>{let te={command:"resolve",path:M,key:e,pluginName:O};if(se!=null)te.pluginName=se;if(ue!=null)te.importer=ue;if(oe!=null)te.namespace=oe;if(Q!=null)te.resolveDir=Q;if(ae!=null)te.kind=ae;else throw Error('Must specify "kind" when calling "resolve"');if(ke!=null)te.pluginData=l.store(ke);if(U!=null)te.with=eR(U,"with");t(n,te,(Le,fe)=>{if(Le!==null)z(Error(Le));else le({errors:Fs(fe.errors,l),warnings:Fs(fe.warnings,l),path:fe.path,external:fe.external,sideEffects:fe.sideEffects,namespace:fe.namespace,suffix:fe.suffix,pluginData:l.load(fe.pluginData)})})})},onStart(M){let W=pa(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:O,callback:M,note:W}),k.onStart=!0},onEnd(M){let W=pa(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");d.push({name:O,callback:M,note:W}),k.onEnd=!0},onResolve(M,L){let se=pa(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),ue={},oe=N(M,ue,"filter",ga),Q=N(M,ue,"namespace",re);if(tt(M,ue,`in onResolve() call for plugin ${it(O)}`),oe==null)throw Error("onResolve() call is missing a filter");let ae=b++;p[ae]={name:O,callback:L,note:se},k.onResolve.push({id:ae,filter:ya(oe),namespace:Q||""})},onLoad(M,L){let se=pa(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),ue={},oe=N(M,ue,"filter",ga),Q=N(M,ue,"namespace",re);if(tt(M,ue,`in onLoad() call for plugin ${it(O)}`),oe==null)throw Error("onLoad() call is missing a filter");let ae=b++;h[ae]={name:O,callback:L,note:se},k.onLoad.push({id:ae,filter:ya(oe),namespace:Q||""})},onDispose(M){m.push(M)},esbuild:s.esbuild});if(D)await D;y.push(k)}catch(R){return{ok:!1,error:R,pluginName:O}}}i["on-start"]=async(P,E)=>{l.clear();let O={errors:[],warnings:[]};await Promise.all(c.map(async({name:R,callback:k,note:I})=>{try{let D=await k();if(D!=null){if(typeof D!=="object")throw Error(`Expected onStart() callback in plugin ${it(R)} to return an object`);let M={},L=N(D,M,"errors",on),W=N(D,M,"warnings",on);if(tt(D,M,`from onStart() callback in plugin ${it(R)}`),L!=null)O.errors.push(...an(L,"errors",l,R,void 0));if(W!=null)O.warnings.push(...an(W,"warnings",l,R,void 0))}}catch(D){O.errors.push(ls(D,s,l,I&&I(),R))}})),r(P,O)},i["on-resolve"]=async(P,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=p[D]);let M=await k({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onResolve() callback in plugin ${it(R)} to return an object`);let L={},W=N(M,L,"pluginName",re),se=N(M,L,"path",re),ue=N(M,L,"namespace",re),oe=N(M,L,"suffix",re),Q=N(M,L,"external",Ge),ae=N(M,L,"sideEffects",Ge),ke=N(M,L,"pluginData",ha),U=N(M,L,"errors",on),le=N(M,L,"warnings",on),z=N(M,L,"watchFiles",Ht),te=N(M,L,"watchDirs",Ht);if(tt(M,L,`from onResolve() callback in plugin ${it(R)}`),O.id=D,W!=null)O.pluginName=W;if(se!=null)O.path=se;if(ue!=null)O.namespace=ue;if(oe!=null)O.suffix=oe;if(Q!=null)O.external=Q;if(ae!=null)O.sideEffects=ae;if(ke!=null)O.pluginData=l.store(ke);if(U!=null)O.errors=an(U,"errors",l,R,void 0);if(le!=null)O.warnings=an(le,"warnings",l,R,void 0);if(z!=null)O.watchFiles=ma(z,"watchFiles");if(te!=null)O.watchDirs=ma(te,"watchDirs");break}}catch(M){O={id:D,errors:[ls(M,s,l,I&&I(),R)]};break}r(P,O)},i["on-load"]=async(P,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=h[D]);let M=await k({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onLoad() callback in plugin ${it(R)} to return an object`);let L={},W=N(M,L,"pluginName",re),se=N(M,L,"contents",Gm),ue=N(M,L,"resolveDir",re),oe=N(M,L,"pluginData",ha),Q=N(M,L,"loader",re),ae=N(M,L,"errors",on),ke=N(M,L,"warnings",on),U=N(M,L,"watchFiles",Ht),le=N(M,L,"watchDirs",Ht);if(tt(M,L,`from onLoad() callback in plugin ${it(R)}`),O.id=D,W!=null)O.pluginName=W;if(se instanceof Uint8Array)O.contents=se;else if(se!=null)O.contents=$r(se);if(ue!=null)O.resolveDir=ue;if(oe!=null)O.pluginData=l.store(oe);if(Q!=null)O.loader=Q;if(ae!=null)O.errors=an(ae,"errors",l,R,void 0);if(ke!=null)O.warnings=an(ke,"warnings",l,R,void 0);if(U!=null)O.watchFiles=ma(U,"watchFiles");if(le!=null)O.watchDirs=ma(le,"watchDirs");break}}catch(M){O={id:D,errors:[ls(M,s,l,I&&I(),R)]};break}r(P,O)};let j=(P,E)=>E([],[]);if(d.length>0)j=(P,E)=>{(async()=>{let O=[],R=[];for(let{name:k,callback:I,note:D}of d){let M,L;try{let W=await I(P);if(W!=null){if(typeof W!=="object")throw Error(`Expected onEnd() callback in plugin ${it(k)} to return an object`);let se={},ue=N(W,se,"errors",on),oe=N(W,se,"warnings",on);if(tt(W,se,`from onEnd() callback in plugin ${it(k)}`),ue!=null)M=an(ue,"errors",l,k,void 0);if(oe!=null)L=an(oe,"warnings",l,k,void 0)}}catch(W){M=[ls(W,s,l,D&&D(),k)]}if(M){O.push(...M);try{P.errors.push(...M)}catch{}}if(L){R.push(...L);try{P.warnings.push(...L)}catch{}}}E(O,R)})()};let S=()=>{for(let P of m)setTimeout(()=>P(),0)};return v=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:S}};function Zm(){let e=new Map,t=0;return{clear(){e.clear()},load(r){return e.get(r)},store(r){if(r===void 0)return-1;let n=t++;return e.set(n,r),n}}}function pa(e,t,r){let n,s=!1;return()=>{if(s)return n;s=!0;try{let i=(e.stack+"").split(`
13
- `);i.splice(1,1);let o=Qm(t,i,r);if(o)return n={text:e.message,location:o},n}catch{}}}function ls(e,t,r,n,s){let i="Internal error",o=null;try{i=(e&&e.message||e)+""}catch{}try{o=Qm(t,(e.stack+"").split(`
14
- `),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function Qm(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let s=1;s<t.length;s++){let i=t[s];if(!i.startsWith(n))continue;i=i.slice(n.length);while(!0){let o=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(o){i=o[1];continue}if(o=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),o){i=o[1];continue}if(o=/^(\S+):(\d+):(\d+)$/.exec(i),o){let a;try{a=e.readFileSync(o[1],"utf8")}catch{break}let l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+o[2]-1]||"",c=+o[3]-1,d=l.slice(c,c+r.length)===r?r.length:0;return{file:o[1],namespace:"file",line:+o[2],column:$r(l.slice(0,c)).length,length:$r(l.slice(c,c+d)).length,lineText:l+`
11
+ `);function Xm(e,t){return(e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Hc(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var sn=String.fromCharCode;function cr(e,t,r){let n=e[t],s=1,i=0;for(let o=0;o<t;o++)if(e[o]===10)s++,i=0;else i++;throw SyntaxError(r?r:t===e.length?"Unexpected end of input while parsing JSON":n>=32&&n<=126?`Unexpected character ${sn(n)} in JSON at position ${t} (line ${s}, column ${i})`:`Unexpected byte 0x${n.toString(16)} in JSON at position ${t} (line ${s}, column ${i})`)}function Qk(e){if(!(e instanceof Uint8Array))throw Error("JSON input must be a Uint8Array");let t=[],r=[],n=[],s=e.length,i=null,o=0,a,l=0;while(l<s){let c=e[l++];if(c<=32)continue;let u;if(o===2&&i===null&&c!==34&&c!==125)cr(e,--l);switch(c){case 116:{if(e[l++]!==114||e[l++]!==117||e[l++]!==101)cr(e,--l);u=!0;break}case 102:{if(e[l++]!==97||e[l++]!==108||e[l++]!==115||e[l++]!==101)cr(e,--l);u=!1;break}case 110:{if(e[l++]!==117||e[l++]!==108||e[l++]!==108)cr(e,--l);u=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let p=l;u=sn(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+=sn(c),c=e[++l];continue}}break}if(u=+u,isNaN(u))cr(e,--p,"Invalid number");break}case 34:{u="";while(!0){if(l>=s)cr(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+=`
12
+ `;break;case 114:u+="\r";break;case 116:u+="\t";break;case 117:{let p=0;for(let g=0;g<4;g++)if(c=e[l++],p<<=4,c>=48&&c<=57)p|=c-48;else if(c>=97&&c<=102)p|=c+-87;else if(c>=65&&c<=70)p|=c+-55;else cr(e,--l);u+=sn(p);break}default:cr(e,--l);break}else if(c<=127)u+=sn(c);else if((c&224)===192)u+=sn((c&31)<<6|e[l++]&63);else if((c&240)===224)u+=sn((c&15)<<12|(e[l++]&63)<<6|e[l++]&63);else if((c&248)==240){let p=(c&7)<<18|(e[l++]&63)<<12|(e[l++]&63)<<6|e[l++]&63;if(p>65535)p-=65536,u+=sn(p>>10&1023|55296),p=56320|p&1023;u+=sn(p)}}u[0];break}case 91:{u=[],t.push(i),r.push(a),n.push(o),i=null,a=u,o=1;continue}case 123:{u={},t.push(i),r.push(a),n.push(o),i=null,a=u,o=2;continue}case 93:{if(o!==1)cr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}case 125:{if(o!==2)cr(e,--l);u=a,i=t.pop(),a=r.pop(),o=n.pop();break}default:cr(e,--l)}c=e[l];while(c<=32)c=e[++l];switch(o){case 0:{if(l===s)return u;break}case 1:{if(a.push(u),c===44){l++;continue}if(c===93)continue;break}case 2:{if(i===null){if(i=u,c===58){l++;continue}}else{if(a[i]=u,i=null,c===44){l++;continue}if(c===125)continue}break}}break}cr(e,l)}var it=JSON.stringify,qm="warning",Hm="silent";function Fs(e,t){let r=[];for(let n of e){if(Ht(n,t),n.indexOf(",")>=0)throw Error(`Invalid ${t}: ${n}`);r.push(n)}return r.join(",")}var ga=()=>null,Ge=(e)=>typeof e==="boolean"?null:"a boolean",re=(e)=>typeof e==="string"?null:"a string",ya=(e)=>e instanceof RegExp?null:"a RegExp object",cs=(e)=>typeof e==="number"&&e===(e|0)?null:"an integer",eR=(e)=>typeof e==="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",Zm=(e)=>typeof e==="function"?null:"a function",on=(e)=>Array.isArray(e)?null:"an array",Vt=(e)=>Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"an array of strings",ir=(e)=>typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"an object",tR=(e)=>typeof e==="object"&&e!==null?null:"an array or an object",rR=(e)=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Vm=(e)=>typeof e==="object"&&!Array.isArray(e)?null:"an object or null",Qm=(e)=>typeof e==="string"||typeof e==="boolean"?null:"a string or a boolean",nR=(e)=>typeof e==="string"||typeof e==="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",eh=(e)=>typeof e==="string"||Array.isArray(e)&&e.every((t)=>typeof t==="string")?null:"a string or an array of strings",th=(e)=>typeof e==="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",sR=(e)=>typeof e==="string"||e instanceof URL?null:"a string or a URL";function T(e,t,r,n){let s=e[r];if(t[r+""]=!0,s===void 0)return;let i=n(s);if(i!==null)throw Error(`${it(r)} must be ${i}`);return s}function tt(e,t,r){for(let n in e)if(!(n in t))throw Error(`Invalid option ${r}: ${it(n)}`)}function iR(e){let t=Object.create(null),r=T(e,t,"wasmURL",sR),n=T(e,t,"wasmModule",rR),s=T(e,t,"worker",Ge);return tt(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:s}}function rh(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n==="string"||n===!1)t[r]=n;else throw Error(`Expected ${it(r)} in mangle cache to map to either a string or false`)}}return t}function wa(e,t,r,n,s){let i=T(t,r,"color",Ge),o=T(t,r,"logLevel",re),a=T(t,r,"logLimit",cs),l=T(t,r,"logStyle",re);if(i!==void 0)e.push(`--color=${i}`);else if(n)e.push("--color=true");if(e.push(`--log-level=${o||s}`),e.push(`--log-limit=${a||0}`),l)e.push(`--log-style=${l}`)}function Ht(e,t,r){if(typeof e!=="string")throw Error(`Expected value for ${t}${r!==void 0?" "+it(r):""} to be a string, got ${typeof e} instead`);return e}function nh(e,t,r){let n=T(t,r,"legalComments",re),s=T(t,r,"sourceRoot",re),i=T(t,r,"sourcesContent",Ge),o=T(t,r,"target",eh),a=T(t,r,"format",re),l=T(t,r,"globalName",re),c=T(t,r,"mangleProps",ya),u=T(t,r,"reserveProps",ya),p=T(t,r,"mangleQuoted",Ge),g=T(t,r,"minify",Ge),m=T(t,r,"minifySyntax",Ge),b=T(t,r,"minifyWhitespace",Ge),h=T(t,r,"minifyIdentifiers",Ge),y=T(t,r,"lineLimit",cs),v=T(t,r,"drop",Vt),j=T(t,r,"dropLabels",Vt),S=T(t,r,"charset",re),_=T(t,r,"treeShaking",Ge),E=T(t,r,"ignoreAnnotations",Ge),O=T(t,r,"jsx",re),R=T(t,r,"jsxFactory",re),k=T(t,r,"jsxFragment",re),I=T(t,r,"jsxImportSource",re),D=T(t,r,"jsxDev",Ge),M=T(t,r,"jsxSideEffects",Ge),L=T(t,r,"define",ir),W=T(t,r,"logOverride",ir),se=T(t,r,"supported",ir),ue=T(t,r,"pure",Vt),oe=T(t,r,"keepNames",Ge),ee=T(t,r,"platform",re),ae=T(t,r,"tsconfigRaw",nR),ke=T(t,r,"absPaths",Vt);if(n)e.push(`--legal-comments=${n}`);if(s!==void 0)e.push(`--source-root=${s}`);if(i!==void 0)e.push(`--sources-content=${i}`);if(o)e.push(`--target=${Fs(Array.isArray(o)?o:[o],"target")}`);if(a)e.push(`--format=${a}`);if(l)e.push(`--global-name=${l}`);if(ee)e.push(`--platform=${ee}`);if(ae)e.push(`--tsconfig-raw=${typeof ae==="string"?ae:JSON.stringify(ae)}`);if(g)e.push("--minify");if(m)e.push("--minify-syntax");if(b)e.push("--minify-whitespace");if(h)e.push("--minify-identifiers");if(y)e.push(`--line-limit=${y}`);if(S)e.push(`--charset=${S}`);if(_!==void 0)e.push(`--tree-shaking=${_}`);if(E)e.push("--ignore-annotations");if(v)for(let U of v)e.push(`--drop:${Ht(U,"drop")}`);if(j)e.push(`--drop-labels=${Fs(j,"drop label")}`);if(ke)e.push(`--abs-paths=${Fs(ke,"abs paths")}`);if(c)e.push(`--mangle-props=${ba(c)}`);if(u)e.push(`--reserve-props=${ba(u)}`);if(p!==void 0)e.push(`--mangle-quoted=${p}`);if(O)e.push(`--jsx=${O}`);if(R)e.push(`--jsx-factory=${R}`);if(k)e.push(`--jsx-fragment=${k}`);if(I)e.push(`--jsx-import-source=${I}`);if(D)e.push("--jsx-dev");if(M)e.push("--jsx-side-effects");if(L)for(let U in L){if(U.indexOf("=")>=0)throw Error(`Invalid define: ${U}`);e.push(`--define:${U}=${Ht(L[U],"define",U)}`)}if(W)for(let U in W){if(U.indexOf("=")>=0)throw Error(`Invalid log override: ${U}`);e.push(`--log-override:${U}=${Ht(W[U],"log override",U)}`)}if(se)for(let U in se){if(U.indexOf("=")>=0)throw Error(`Invalid supported: ${U}`);let le=se[U];if(typeof le!=="boolean")throw Error(`Expected value for supported ${it(U)} to be a boolean, got ${typeof le} instead`);e.push(`--supported:${U}=${le}`)}if(ue)for(let U of ue)e.push(`--pure:${Ht(U,"pure")}`);if(oe)e.push("--keep-names")}function oR(e,t,r,n,s){var i;let o=[],a=[],l=Object.create(null),c=null,u=null;wa(o,t,l,r,n),nh(o,t,l);let p=T(t,l,"sourcemap",Qm),g=T(t,l,"bundle",Ge),m=T(t,l,"splitting",Ge),b=T(t,l,"preserveSymlinks",Ge),h=T(t,l,"metafile",Ge),y=T(t,l,"outfile",re),v=T(t,l,"outdir",re),j=T(t,l,"outbase",re),S=T(t,l,"tsconfig",re),_=T(t,l,"resolveExtensions",Vt),E=T(t,l,"nodePaths",Vt),O=T(t,l,"mainFields",Vt),R=T(t,l,"conditions",Vt),k=T(t,l,"external",Vt),I=T(t,l,"packages",re),D=T(t,l,"alias",ir),M=T(t,l,"loader",ir),L=T(t,l,"outExtension",ir),W=T(t,l,"publicPath",re),se=T(t,l,"entryNames",re),ue=T(t,l,"chunkNames",re),oe=T(t,l,"assetNames",re),ee=T(t,l,"inject",Vt),ae=T(t,l,"banner",ir),ke=T(t,l,"footer",ir),U=T(t,l,"entryPoints",tR),le=T(t,l,"absWorkingDir",re),G=T(t,l,"stdin",ir),te=(i=T(t,l,"write",Ge))!=null?i:s,Le=T(t,l,"allowOverwrite",Ge),fe=T(t,l,"mangleCache",ir);if(l.plugins=!0,tt(t,l,`in ${e}() call`),p)o.push(`--sourcemap${p===!0?"":`=${p}`}`);if(g)o.push("--bundle");if(Le)o.push("--allow-overwrite");if(m)o.push("--splitting");if(b)o.push("--preserve-symlinks");if(h)o.push("--metafile");if(y)o.push(`--outfile=${y}`);if(v)o.push(`--outdir=${v}`);if(j)o.push(`--outbase=${j}`);if(S)o.push(`--tsconfig=${S}`);if(I)o.push(`--packages=${I}`);if(_)o.push(`--resolve-extensions=${Fs(_,"resolve extension")}`);if(W)o.push(`--public-path=${W}`);if(se)o.push(`--entry-names=${se}`);if(ue)o.push(`--chunk-names=${ue}`);if(oe)o.push(`--asset-names=${oe}`);if(O)o.push(`--main-fields=${Fs(O,"main field")}`);if(R)o.push(`--conditions=${Fs(R,"condition")}`);if(k)for(let K of k)o.push(`--external:${Ht(K,"external")}`);if(D)for(let K in D){if(K.indexOf("=")>=0)throw Error(`Invalid package name in alias: ${K}`);o.push(`--alias:${K}=${Ht(D[K],"alias",K)}`)}if(ae)for(let K in ae){if(K.indexOf("=")>=0)throw Error(`Invalid banner file type: ${K}`);o.push(`--banner:${K}=${Ht(ae[K],"banner",K)}`)}if(ke)for(let K in ke){if(K.indexOf("=")>=0)throw Error(`Invalid footer file type: ${K}`);o.push(`--footer:${K}=${Ht(ke[K],"footer",K)}`)}if(ee)for(let K of ee)o.push(`--inject:${Ht(K,"inject")}`);if(M)for(let K in M){if(K.indexOf("=")>=0)throw Error(`Invalid loader extension: ${K}`);o.push(`--loader:${K}=${Ht(M[K],"loader",K)}`)}if(L)for(let K in L){if(K.indexOf("=")>=0)throw Error(`Invalid out extension: ${K}`);o.push(`--out-extension:${K}=${Ht(L[K],"out extension",K)}`)}if(U)if(Array.isArray(U))for(let K=0,We=U.length;K<We;K++){let Xe=U[K];if(typeof Xe==="object"&&Xe!==null){let pt=Object.create(null),ut=T(Xe,pt,"in",re),Ue=T(Xe,pt,"out",re);if(tt(Xe,pt,"in entry point at index "+K),ut===void 0)throw Error('Missing property "in" for entry point at index '+K);if(Ue===void 0)throw Error('Missing property "out" for entry point at index '+K);a.push([Ue,ut])}else a.push(["",Ht(Xe,"entry point at index "+K)])}else for(let K in U)a.push([K,Ht(U[K],"entry point",K)]);if(G){let K=Object.create(null),We=T(G,K,"contents",th),Xe=T(G,K,"resolveDir",re),pt=T(G,K,"sourcefile",re),ut=T(G,K,"loader",re);if(tt(G,K,'in "stdin" object'),pt)o.push(`--sourcefile=${pt}`);if(ut)o.push(`--loader=${ut}`);if(Xe)u=Xe;if(typeof We==="string")c=$r(We);else if(We instanceof Uint8Array)c=We}let Be=[];if(E)for(let K of E)K+="",Be.push(K);return{entries:a,flags:o,write:te,stdinContents:c,stdinResolveDir:u,absWorkingDir:le,nodePaths:Be,mangleCache:rh(fe)}}function aR(e,t,r,n){let s=[],i=Object.create(null);wa(s,t,i,r,n),nh(s,t,i);let o=T(t,i,"sourcemap",Qm),a=T(t,i,"sourcefile",re),l=T(t,i,"loader",re),c=T(t,i,"banner",re),u=T(t,i,"footer",re),p=T(t,i,"mangleCache",ir);if(tt(t,i,`in ${e}() call`),o)s.push(`--sourcemap=${o===!0?"external":o}`);if(a)s.push(`--sourcefile=${a}`);if(l)s.push(`--loader=${l}`);if(c)s.push(`--banner=${c}`);if(u)s.push(`--footer=${u}`);return{flags:s,mangleCache:rh(p)}}function sh(e){let t={},r={didClose:!1,reason:""},n={},s=0,i=0,o=new Uint8Array(16384),a=0,l=(S)=>{let _=a+S.length;if(_>o.length){let O=new Uint8Array(_*2);O.set(o),o=O}o.set(S,a),a+=S.length;let E=0;while(E+4<=a){let O=Xm(o,E);if(E+4+O>a)break;E+=4,b(o.subarray(E,E+O)),E+=O}if(E>0)o.copyWithin(0,E,a),a-=E},c=(S)=>{if(r.didClose=!0,S)r.reason=": "+(S.message||S);let _="The service was stopped"+r.reason;for(let E in n)n[E](_,null);n={}},u=(S,_,E)=>{if(r.didClose)return E("The service is no longer running"+r.reason,null);let O=s++;if(n[O]=(R,k)=>{try{E(R,k)}finally{if(S)S.unref()}},S)S.ref();e.writeToStdin(Fm({id:O,isRequest:!0,value:_}))},p=(S,_)=>{if(r.didClose)throw Error("The service is no longer running"+r.reason);e.writeToStdin(Fm({id:S,isRequest:!1,value:_}))},g=async(S,_)=>{try{if(_.command==="ping"){p(S,{});return}if(typeof _.key==="number"){let E=t[_.key];if(!E)return;let O=E[_.command];if(O){await O(S,_);return}}throw Error("Invalid command: "+_.command)}catch(E){let O=[ls(E,e,null,void 0,"")];try{p(S,{errors:O})}catch{}}},m=!0,b=(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 ${it(E)}`);return}let _=Zk(S);if(_.isRequest)g(_.id,_.value);else{let E=n[_.id];if(delete n[_.id],_.value.error)E(_.value.error,{});else E(null,_.value)}};return{readFromStdout:l,afterClose:c,service:{buildOrContext:({callName:S,refs:_,options:E,isTTY:O,defaultWD:R,callback:k})=>{let I=0,D=i++,M={},L={ref(){if(++I===1){if(_)_.ref()}},unref(){if(--I===0){if(delete t[D],_)_.unref()}}};t[D]=M,L.ref(),lR(S,D,u,p,L,e,M,E,O,R,(W,se)=>{try{k(W,se)}finally{L.unref()}})},transform:({callName:S,refs:_,input:E,options:O,isTTY:R,fs:k,callback:I})=>{let D=ih(),M=(L)=>{try{if(typeof E!=="string"&&!(E instanceof Uint8Array))throw Error('The input to "transform" must be a string or a Uint8Array');let{flags:W,mangleCache:se}=aR(S,O,R,Hm),ue={command:"transform",flags:W,inputFS:L!==null,input:L!==null?$r(L):typeof E==="string"?$r(E):E};if(se)ue.mangleCache=se;u(_,ue,(oe,ee)=>{if(oe)return I(Error(oe),null);let ae=qs(ee.errors,D),ke=qs(ee.warnings,D),U=1,le=()=>{if(--U===0){let G={warnings:ke,code:ee.code,map:ee.map,mangleCache:void 0,legalComments:void 0};if("legalComments"in ee)G.legalComments=ee==null?void 0:ee.legalComments;if(ee.mangleCache)G.mangleCache=ee==null?void 0:ee.mangleCache;I(null,G)}};if(ae.length>0)return I(Wi("Transform failed",ae,ke),null);if(ee.codeFS)U++,k.readFile(ee.code,(G,te)=>{if(G!==null)I(G,null);else ee.code=te,le()});if(ee.mapFS)U++,k.readFile(ee.map,(G,te)=>{if(G!==null)I(G,null);else ee.map=te,le()});le()})}catch(W){let se=[];try{wa(se,O,{},R,Hm)}catch{}let ue=ls(W,e,D,void 0,"");u(_,{command:"error",flags:se,error:ue},()=>{ue.detail=D.load(ue.detail),I(Wi("Transform failed",[ue],[]),null)})}};if((typeof E==="string"||E instanceof Uint8Array)&&E.length>1048576){let L=M;M=()=>k.writeFile(E,L)}M(null)},formatMessages:({callName:S,refs:_,messages:E,options:O,callback:R})=>{if(!O)throw Error(`Missing second argument in ${S}() call`);let k={},I=T(O,k,"kind",re),D=T(O,k,"color",Ge),M=T(O,k,"terminalWidth",cs),L=T(O,k,"logStyle",re);if(tt(O,k,`in ${S}() call`),I===void 0)throw Error(`Missing "kind" in ${S}() call`);if(I!=="error"&&I!=="warning")throw Error(`Expected "kind" to be "error" or "warning" in ${S}() call`);let W={command:"format-msgs",messages:an(E,"messages",null,"",M),isWarning:I==="warning"};if(D!==void 0)W.color=D;if(M!==void 0)W.terminalWidth=M;if(L!==void 0)W.logStyle=L;u(_,W,(se,ue)=>{if(se)return R(Error(se),null);R(null,ue.messages)})},analyzeMetafile:({callName:S,refs:_,metafile:E,options:O,callback:R})=>{if(O===void 0)O={};let k={},I=T(O,k,"color",Ge),D=T(O,k,"verbose",Ge);tt(O,k,`in ${S}() call`);let M={command:"analyze-metafile",metafile:E};if(I!==void 0)M.color=I;if(D!==void 0)M.verbose=D;u(_,M,(L,W)=>{if(L)return R(Error(L),null);R(null,W.result)})}}}}function lR(e,t,r,n,s,i,o,a,l,c,u){let p=ih(),g=e==="context",m=(y,v)=>{let j=[];try{wa(j,a,{},l,qm)}catch{}let S=ls(y,i,p,void 0,v);r(s,{command:"error",flags:j,error:S},()=>{S.detail=p.load(S.detail),u(Wi(g?"Context failed":"Build failed",[S],[]),null)})},b;if(typeof a==="object"){let y=a.plugins;if(y!==void 0){if(!Array.isArray(y))return m(Error('"plugins" must be an array'),"");b=y}}if(b&&b.length>0){if(i.isSync)return m(Error("Cannot use plugins in synchronous API calls"),"");cR(t,r,n,s,i,o,a,b,p).then((y)=>{if(!y.ok)return m(y.error,y.pluginName);try{h(y.requestPlugins,y.runOnEndCallbacks,y.scheduleOnDisposeCallbacks)}catch(v){m(v,"")}},(y)=>m(y,""));return}try{h(null,(y,v)=>v([],[]),()=>{})}catch(y){m(y,"")}function h(y,v,j){let S=i.hasFS,{entries:_,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I,nodePaths:D,mangleCache:M}=oR(e,a,l,qm,S);if(O&&!i.hasFS)throw Error('The "write" option is unavailable in this environment');let L={command:"build",key:t,entries:_,flags:E,write:O,stdinContents:R,stdinResolveDir:k,absWorkingDir:I||c,nodePaths:D,context:g};if(y)L.plugins=y;if(M)L.mangleCache=M;let W=(oe,ee)=>{let ae={errors:qs(oe.errors,p),warnings:qs(oe.warnings,p),outputFiles:void 0,metafile:void 0,mangleCache:void 0},ke=ae.errors.slice(),U=ae.warnings.slice();if(oe.outputFiles)ae.outputFiles=oe.outputFiles.map(dR);if(oe.metafile&&oe.metafile.length)ae.metafile=fR(oe.metafile);if(oe.mangleCache)ae.mangleCache=oe.mangleCache;if(oe.writeToStdout!==void 0)console.log(fs(oe.writeToStdout).replace(/\n$/,""));v(ae,(le,G)=>{if(ke.length>0||le.length>0){let te=Wi("Build failed",ke.concat(le),U.concat(G));return ee(te,null,le,G)}ee(null,ae,le,G)})},se,ue;if(g)o["on-end"]=(oe,ee)=>new Promise((ae)=>{W(ee,(ke,U,le,G)=>{let te={errors:le,warnings:G};if(ue)ue(ke,U);se=void 0,ue=void 0,n(oe,te),ae()})});r(s,L,(oe,ee)=>{if(oe)return u(Error(oe),null);if(!g)return W(ee,(U,le)=>(j(),u(U,le)));if(ee.errors.length>0)return u(Wi("Context failed",ee.errors,ee.warnings),null);let ae=!1,ke={rebuild:()=>{if(!se)se=new Promise((U,le)=>{let G;ue=(Le,fe)=>{if(!G)G=()=>Le?le(Le):U(fe)};let te=()=>{r(s,{command:"rebuild",key:t},(fe,Be)=>{if(fe)le(Error(fe));else if(G)G();else te()})};te()});return se},watch:(U={})=>new Promise((le,G)=>{if(!i.hasFS)throw Error('Cannot use the "watch" API in this environment');let te={},Le=T(U,te,"delay",cs);tt(U,te,"in watch() call");let fe={command:"watch",key:t};if(Le)fe.delay=Le;r(s,fe,(Be)=>{if(Be)G(Error(Be));else le(void 0)})}),serve:(U={})=>new Promise((le,G)=>{if(!i.hasFS)throw Error('Cannot use the "serve" API in this environment');let te={},Le=T(U,te,"port",eR),fe=T(U,te,"host",re),Be=T(U,te,"servedir",re),K=T(U,te,"keyfile",re),We=T(U,te,"certfile",re),Xe=T(U,te,"fallback",re),pt=T(U,te,"cors",ir),ut=T(U,te,"onRequest",Zm);tt(U,te,"in serve() call");let Ue={command:"serve",key:t,onRequest:!!ut};if(Le!==void 0)Ue.port=Le;if(fe!==void 0)Ue.host=fe;if(Be!==void 0)Ue.servedir=Be;if(K!==void 0)Ue.keyfile=K;if(We!==void 0)Ue.certfile=We;if(Xe!==void 0)Ue.fallback=Xe;if(pt){let bt={},Mt=T(pt,bt,"origin",eh);if(tt(pt,bt,'on "cors" object'),Array.isArray(Mt))Ue.corsOrigin=Mt;else if(Mt!==void 0)Ue.corsOrigin=[Mt]}r(s,Ue,(bt,Mt)=>{if(bt)return G(Error(bt));if(ut)o["serve-request"]=(Xr,En)=>{ut(En.args),n(Xr,{})};le(Mt)})}),cancel:()=>new Promise((U)=>{if(ae)return U();r(s,{command:"cancel",key:t},()=>{U()})}),dispose:()=>new Promise((U)=>{if(ae)return U();ae=!0,r(s,{command:"dispose",key:t},()=>{U(),j(),s.unref()})})};s.ref(),u(null,ke)})}}var cR=async(e,t,r,n,s,i,o,a,l)=>{let c=[],u=[],p={},g={},m=[],b=0,h=0,y=[],v=!1;a=[...a];for(let _ of a){let E={};if(typeof _!=="object")throw Error(`Plugin at index ${h} must be an object`);let O=T(_,E,"name",re);if(typeof O!=="string"||O==="")throw Error(`Plugin at index ${h} is missing a name`);try{let R=T(_,E,"setup",Zm);if(typeof R!=="function")throw Error("Plugin is missing a setup function");tt(_,E,`on plugin ${it(O)}`);let k={name:O,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};h++;let D=R({initialOptions:o,resolve:(M,L={})=>{if(!v)throw Error('Cannot call "resolve" before plugin setup has completed');if(typeof M!=="string")throw Error("The path to resolve must be a string");let W=Object.create(null),se=T(L,W,"pluginName",re),ue=T(L,W,"importer",re),oe=T(L,W,"namespace",re),ee=T(L,W,"resolveDir",re),ae=T(L,W,"kind",re),ke=T(L,W,"pluginData",ga),U=T(L,W,"with",ir);return tt(L,W,"in resolve() call"),new Promise((le,G)=>{let te={command:"resolve",path:M,key:e,pluginName:O};if(se!=null)te.pluginName=se;if(ue!=null)te.importer=ue;if(oe!=null)te.namespace=oe;if(ee!=null)te.resolveDir=ee;if(ae!=null)te.kind=ae;else throw Error('Must specify "kind" when calling "resolve"');if(ke!=null)te.pluginData=l.store(ke);if(U!=null)te.with=uR(U,"with");t(n,te,(Le,fe)=>{if(Le!==null)G(Error(Le));else le({errors:qs(fe.errors,l),warnings:qs(fe.warnings,l),path:fe.path,external:fe.external,sideEffects:fe.sideEffects,namespace:fe.namespace,suffix:fe.suffix,pluginData:l.load(fe.pluginData)})})})},onStart(M){let W=ma(Error('This error came from the "onStart" callback registered here:'),s,"onStart");c.push({name:O,callback:M,note:W}),k.onStart=!0},onEnd(M){let W=ma(Error('This error came from the "onEnd" callback registered here:'),s,"onEnd");u.push({name:O,callback:M,note:W}),k.onEnd=!0},onResolve(M,L){let se=ma(Error('This error came from the "onResolve" callback registered here:'),s,"onResolve"),ue={},oe=T(M,ue,"filter",ya),ee=T(M,ue,"namespace",re);if(tt(M,ue,`in onResolve() call for plugin ${it(O)}`),oe==null)throw Error("onResolve() call is missing a filter");let ae=b++;p[ae]={name:O,callback:L,note:se},k.onResolve.push({id:ae,filter:ba(oe),namespace:ee||""})},onLoad(M,L){let se=ma(Error('This error came from the "onLoad" callback registered here:'),s,"onLoad"),ue={},oe=T(M,ue,"filter",ya),ee=T(M,ue,"namespace",re);if(tt(M,ue,`in onLoad() call for plugin ${it(O)}`),oe==null)throw Error("onLoad() call is missing a filter");let ae=b++;g[ae]={name:O,callback:L,note:se},k.onLoad.push({id:ae,filter:ba(oe),namespace:ee||""})},onDispose(M){m.push(M)},esbuild:s.esbuild});if(D)await D;y.push(k)}catch(R){return{ok:!1,error:R,pluginName:O}}}i["on-start"]=async(_,E)=>{l.clear();let O={errors:[],warnings:[]};await Promise.all(c.map(async({name:R,callback:k,note:I})=>{try{let D=await k();if(D!=null){if(typeof D!=="object")throw Error(`Expected onStart() callback in plugin ${it(R)} to return an object`);let M={},L=T(D,M,"errors",on),W=T(D,M,"warnings",on);if(tt(D,M,`from onStart() callback in plugin ${it(R)}`),L!=null)O.errors.push(...an(L,"errors",l,R,void 0));if(W!=null)O.warnings.push(...an(W,"warnings",l,R,void 0))}}catch(D){O.errors.push(ls(D,s,l,I&&I(),R))}})),r(_,O)},i["on-resolve"]=async(_,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=p[D]);let M=await k({path:E.path,importer:E.importer,namespace:E.namespace,resolveDir:E.resolveDir,kind:E.kind,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onResolve() callback in plugin ${it(R)} to return an object`);let L={},W=T(M,L,"pluginName",re),se=T(M,L,"path",re),ue=T(M,L,"namespace",re),oe=T(M,L,"suffix",re),ee=T(M,L,"external",Ge),ae=T(M,L,"sideEffects",Ge),ke=T(M,L,"pluginData",ga),U=T(M,L,"errors",on),le=T(M,L,"warnings",on),G=T(M,L,"watchFiles",Vt),te=T(M,L,"watchDirs",Vt);if(tt(M,L,`from onResolve() callback in plugin ${it(R)}`),O.id=D,W!=null)O.pluginName=W;if(se!=null)O.path=se;if(ue!=null)O.namespace=ue;if(oe!=null)O.suffix=oe;if(ee!=null)O.external=ee;if(ae!=null)O.sideEffects=ae;if(ke!=null)O.pluginData=l.store(ke);if(U!=null)O.errors=an(U,"errors",l,R,void 0);if(le!=null)O.warnings=an(le,"warnings",l,R,void 0);if(G!=null)O.watchFiles=ha(G,"watchFiles");if(te!=null)O.watchDirs=ha(te,"watchDirs");break}}catch(M){O={id:D,errors:[ls(M,s,l,I&&I(),R)]};break}r(_,O)},i["on-load"]=async(_,E)=>{let O={},R="",k,I;for(let D of E.ids)try{({name:R,callback:k,note:I}=g[D]);let M=await k({path:E.path,namespace:E.namespace,suffix:E.suffix,pluginData:l.load(E.pluginData),with:E.with});if(M!=null){if(typeof M!=="object")throw Error(`Expected onLoad() callback in plugin ${it(R)} to return an object`);let L={},W=T(M,L,"pluginName",re),se=T(M,L,"contents",th),ue=T(M,L,"resolveDir",re),oe=T(M,L,"pluginData",ga),ee=T(M,L,"loader",re),ae=T(M,L,"errors",on),ke=T(M,L,"warnings",on),U=T(M,L,"watchFiles",Vt),le=T(M,L,"watchDirs",Vt);if(tt(M,L,`from onLoad() callback in plugin ${it(R)}`),O.id=D,W!=null)O.pluginName=W;if(se instanceof Uint8Array)O.contents=se;else if(se!=null)O.contents=$r(se);if(ue!=null)O.resolveDir=ue;if(oe!=null)O.pluginData=l.store(oe);if(ee!=null)O.loader=ee;if(ae!=null)O.errors=an(ae,"errors",l,R,void 0);if(ke!=null)O.warnings=an(ke,"warnings",l,R,void 0);if(U!=null)O.watchFiles=ha(U,"watchFiles");if(le!=null)O.watchDirs=ha(le,"watchDirs");break}}catch(M){O={id:D,errors:[ls(M,s,l,I&&I(),R)]};break}r(_,O)};let j=(_,E)=>E([],[]);if(u.length>0)j=(_,E)=>{(async()=>{let O=[],R=[];for(let{name:k,callback:I,note:D}of u){let M,L;try{let W=await I(_);if(W!=null){if(typeof W!=="object")throw Error(`Expected onEnd() callback in plugin ${it(k)} to return an object`);let se={},ue=T(W,se,"errors",on),oe=T(W,se,"warnings",on);if(tt(W,se,`from onEnd() callback in plugin ${it(k)}`),ue!=null)M=an(ue,"errors",l,k,void 0);if(oe!=null)L=an(oe,"warnings",l,k,void 0)}}catch(W){M=[ls(W,s,l,D&&D(),k)]}if(M){O.push(...M);try{_.errors.push(...M)}catch{}}if(L){R.push(...L);try{_.warnings.push(...L)}catch{}}}E(O,R)})()};let S=()=>{for(let _ of m)setTimeout(()=>_(),0)};return v=!0,{ok:!0,requestPlugins:y,runOnEndCallbacks:j,scheduleOnDisposeCallbacks:S}};function ih(){let e=new Map,t=0;return{clear(){e.clear()},load(r){return e.get(r)},store(r){if(r===void 0)return-1;let n=t++;return e.set(n,r),n}}}function ma(e,t,r){let n,s=!1;return()=>{if(s)return n;s=!0;try{let i=(e.stack+"").split(`
13
+ `);i.splice(1,1);let o=oh(t,i,r);if(o)return n={text:e.message,location:o},n}catch{}}}function ls(e,t,r,n,s){let i="Internal error",o=null;try{i=(e&&e.message||e)+""}catch{}try{o=oh(t,(e.stack+"").split(`
14
+ `),"")}catch{}return{id:"",pluginName:s,text:i,location:o,notes:n?[n]:[],detail:r?r.store(e):-1}}function oh(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let s=1;s<t.length;s++){let i=t[s];if(!i.startsWith(n))continue;i=i.slice(n.length);while(!0){let o=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(o){i=o[1];continue}if(o=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),o){i=o[1];continue}if(o=/^(\S+):(\d+):(\d+)$/.exec(i),o){let a;try{a=e.readFileSync(o[1],"utf8")}catch{break}let l=a.split(/\r\n|\r|\n|\u2028|\u2029/)[+o[2]-1]||"",c=+o[3]-1,u=l.slice(c,c+r.length)===r?r.length:0;return{file:o[1],namespace:"file",line:+o[2],column:$r(l.slice(0,c)).length,length:$r(l.slice(c,c+u)).length,lineText:l+`
15
15
  `+t.slice(1).join(`
16
- `),suggestion:""}}break}}return null}function Bi(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((i,o)=>{if(o===n)return`
16
+ `),suggestion:""}}break}}return null}function Wi(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((i,o)=>{if(o===n)return`
17
17
  ...`;if(!i.location)return`
18
- error: ${i.text}`;let{file:a,line:l,column:c}=i.location,d=i.pluginName?`[plugin: ${i.pluginName}] `:"";return`
19
- ${a}:${l}:${c}: ERROR: ${d}${i.text}`}).join("");let s=Error(e);for(let[i,o]of[["errors",t],["warnings",r]])Object.defineProperty(s,i,{configurable:!0,enumerable:!0,get:()=>o,set:(a)=>Object.defineProperty(s,i,{configurable:!0,enumerable:!0,value:a})});return s}function Fs(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Jm(e,t,r){if(e==null)return null;let n={},s=N(e,n,"file",re),i=N(e,n,"namespace",re),o=N(e,n,"line",cs),a=N(e,n,"column",cs),l=N(e,n,"length",cs),c=N(e,n,"lineText",re),d=N(e,n,"suggestion",re);if(tt(e,n,t),c){let p=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(r&&r>0?r:80));if(!/[\x7F-\uFFFF]/.test(p)&&!/\n/.test(c))c=p}return{file:s||"",namespace:i||"",line:o||0,column:a||0,length:l||0,lineText:c||"",suggestion:d||""}}function an(e,t,r,n,s){let i=[],o=0;for(let a of e){let l={},c=N(a,l,"id",re),d=N(a,l,"pluginName",re),p=N(a,l,"text",re),h=N(a,l,"location",Mm),m=N(a,l,"notes",on),b=N(a,l,"detail",ha),g=`in element ${o} of "${t}"`;tt(a,l,g);let y=[];if(m)for(let v of m){let j={},S=N(v,j,"text",re),P=N(v,j,"location",Mm);tt(v,j,g),y.push({text:S||"",location:Jm(P,g,s)})}i.push({id:c||"",pluginName:d||n,text:p||"",location:Jm(h,g,s),notes:y,detail:r?r.store(b):-1}),o++}return i}function ma(e,t){let r=[];for(let n of e){if(typeof n!=="string")throw Error(`${it(t)} must be an array of strings`);r.push(n)}return r}function eR(e,t){let r=Object.create(null);for(let n in e){let s=e[n];if(typeof s!=="string")throw Error(`key ${it(n)} in object ${it(t)} must be a string`);r[n]=s}return r}function tR({path:e,contents:t,hash:r}){let n=null;return{path:e,contents:t,hash:r,get text(){let s=this.contents;if(n===null||s!==t)t=s,n=fs(s);return n}}}function ya(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function rR(e){let t;try{t=fs(e)}catch{return Vk(e)}return JSON.parse(t)}var On=Ne("fs"),Dm=Ne("os"),ur=Ne("path"),Ds=process.env.ESBUILD_BINARY_PATH||Ds,nR=(e)=>!!e&&e!=="/usr/bin/esbuild",Lm="@esbuild/darwin-arm64",Fm="@esbuild/darwin-x64",ba={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},xa={"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"},qm={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function sR(){let e,t,r=!1,n=`${process.platform} ${Dm.arch()} ${Dm.endianness()}`;if(n in ba)e=ba[n],t="esbuild.exe";else if(n in xa)e=xa[n],t="bin/esbuild";else if(n in qm)e=qm[n],t="bin/esbuild",r=!0;else throw Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function iR(){let e=Ne.resolve("esbuild"),t=ur.dirname(ur.dirname(ur.dirname(e)));if(ur.basename(t)==="node_modules"){for(let r in xa)try{let n=xa[r];if(On.existsSync(ur.join(t,n)))return n}catch{}for(let r in ba)try{let n=ba[r];if(On.existsSync(ur.join(t,n)))return n}catch{}}return null}function oR(e,t){let r=ur.dirname(Ne.resolve("esbuild"));return ur.join(r,`downloaded-${e.replace("/","-")}-${ur.basename(t)}`)}function aR(){if(nR(Ds))if(!On.existsSync(Ds))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Ds}`);else return{binPath:Ds,isWASM:!1};let{pkg:e,subpath:t,isWASM:r}=sR(),n;try{n=Ne.resolve(`${e}/${t}`)}catch(s){if(n=oR(e,t),!On.existsSync(n)){try{Ne.resolve(e)}catch{let i=iR();if(i){let o=`
18
+ error: ${i.text}`;let{file:a,line:l,column:c}=i.location,u=i.pluginName?`[plugin: ${i.pluginName}] `:"";return`
19
+ ${a}:${l}:${c}: ERROR: ${u}${i.text}`}).join("");let s=Error(e);for(let[i,o]of[["errors",t],["warnings",r]])Object.defineProperty(s,i,{configurable:!0,enumerable:!0,get:()=>o,set:(a)=>Object.defineProperty(s,i,{configurable:!0,enumerable:!0,value:a})});return s}function qs(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Bm(e,t,r){if(e==null)return null;let n={},s=T(e,n,"file",re),i=T(e,n,"namespace",re),o=T(e,n,"line",cs),a=T(e,n,"column",cs),l=T(e,n,"length",cs),c=T(e,n,"lineText",re),u=T(e,n,"suggestion",re);if(tt(e,n,t),c){let p=c.slice(0,(a&&a>0?a:0)+(l&&l>0?l:0)+(r&&r>0?r:80));if(!/[\x7F-\uFFFF]/.test(p)&&!/\n/.test(c))c=p}return{file:s||"",namespace:i||"",line:o||0,column:a||0,length:l||0,lineText:c||"",suggestion:u||""}}function an(e,t,r,n,s){let i=[],o=0;for(let a of e){let l={},c=T(a,l,"id",re),u=T(a,l,"pluginName",re),p=T(a,l,"text",re),g=T(a,l,"location",Vm),m=T(a,l,"notes",on),b=T(a,l,"detail",ga),h=`in element ${o} of "${t}"`;tt(a,l,h);let y=[];if(m)for(let v of m){let j={},S=T(v,j,"text",re),_=T(v,j,"location",Vm);tt(v,j,h),y.push({text:S||"",location:Bm(_,h,s)})}i.push({id:c||"",pluginName:u||n,text:p||"",location:Bm(g,h,s),notes:y,detail:r?r.store(b):-1}),o++}return i}function ha(e,t){let r=[];for(let n of e){if(typeof n!=="string")throw Error(`${it(t)} must be an array of strings`);r.push(n)}return r}function uR(e,t){let r=Object.create(null);for(let n in e){let s=e[n];if(typeof s!=="string")throw Error(`key ${it(n)} in object ${it(t)} must be a string`);r[n]=s}return r}function dR({path:e,contents:t,hash:r}){let n=null;return{path:e,contents:t,hash:r,get text(){let s=this.contents;if(n===null||s!==t)t=s,n=fs(s);return n}}}function ba(e){let t=e.source;if(e.flags)t=`(?${e.flags})${t}`;return t}function fR(e){let t;try{t=fs(e)}catch{return Qk(e)}return JSON.parse(t)}var On=Te("fs"),Wm=Te("os"),ur=Te("path"),Ls=process.env.ESBUILD_BINARY_PATH||Ls,pR=(e)=>!!e&&e!=="/usr/bin/esbuild",Um="@esbuild/darwin-arm64",zm="@esbuild/darwin-x64",xa={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},$a={"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"},Gm={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function mR(){let e,t,r=!1,n=`${process.platform} ${Wm.arch()} ${Wm.endianness()}`;if(n in xa)e=xa[n],t="esbuild.exe";else if(n in $a)e=$a[n],t="bin/esbuild";else if(n in Gm)e=Gm[n],t="bin/esbuild",r=!0;else throw Error(`Unsupported platform: ${n}`);return{pkg:e,subpath:t,isWASM:r}}function hR(){let e=Te.resolve("esbuild"),t=ur.dirname(ur.dirname(ur.dirname(e)));if(ur.basename(t)==="node_modules"){for(let r in $a)try{let n=$a[r];if(On.existsSync(ur.join(t,n)))return n}catch{}for(let r in xa)try{let n=xa[r];if(On.existsSync(ur.join(t,n)))return n}catch{}}return null}function gR(e,t){let r=ur.dirname(Te.resolve("esbuild"));return ur.join(r,`downloaded-${e.replace("/","-")}-${ur.basename(t)}`)}function yR(){if(pR(Ls))if(!On.existsSync(Ls))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${Ls}`);else return{binPath:Ls,isWASM:!1};let{pkg:e,subpath:t,isWASM:r}=mR(),n;try{n=Te.resolve(`${e}/${t}`)}catch(s){if(n=gR(e,t),!On.existsSync(n)){try{Te.resolve(e)}catch{let i=hR();if(i){let o=`
20
20
  Specifically the "${i}" package is present but this platform
21
21
  needs the "${e}" package instead. People often get into this
22
22
  situation by installing esbuild on Windows or macOS and copying "node_modules"
@@ -33,7 +33,7 @@ If you are installing with yarn, you can try listing both this platform and the
33
33
  other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
34
34
  feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
35
35
  Keep in mind that this means multiple copies of esbuild will be present.
36
- `;if(e===Fm&&i===Lm||e===Lm&&i===Fm)o=`
36
+ `;if(e===zm&&i===Um||e===Um&&i===zm)o=`
37
37
  Specifically the "${i}" package is present but this platform
38
38
  needs the "${e}" package instead. People often get into this
39
39
  situation by installing esbuild with npm running inside of Rosetta 2 and then
@@ -65,47 +65,47 @@ want to do that.
65
65
  If you are installing esbuild with npm, make sure that you don't specify the
66
66
  "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
67
67
  of "package.json" is used by esbuild to install the correct binary executable
68
- for your current platform.`)}throw s}}if(/\.zip\//.test(n)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(i){}if(s){let i=s.getPackageInformation(s.topLevel).packageLocation,o=ur.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${ur.basename(t)}`);if(!On.existsSync(o))On.mkdirSync(ur.dirname(o),{recursive:!0}),On.copyFileSync(n,o),On.chmodSync(o,493);return{binPath:o,isWASM:r}}}return{binPath:n,isWASM:r}}var eh=Ne("child_process"),lR=Ne("crypto"),Fc=Ne("path"),us=Ne("fs"),cR=Ne("os"),uR=Ne("tty"),kt;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{kt=Ne("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)kt=void 0}var Hm,zi=((Hm=kt==null?void 0:kt.workerData)==null?void 0:Hm.esbuildVersion)==="0.28.2",th=()=>{if((!Ds||!1)&&(Fc.basename(__filename)!=="main.js"||Fc.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.
68
+ for your current platform.`)}throw s}}if(/\.zip\//.test(n)){let s;try{s=(()=>{throw new Error("Cannot require module "+"pnpapi");})()}catch(i){}if(s){let i=s.getPackageInformation(s.topLevel).packageLocation,o=ur.join(i,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.28.2-${ur.basename(t)}`);if(!On.existsSync(o))On.mkdirSync(ur.dirname(o),{recursive:!0}),On.copyFileSync(n,o),On.chmodSync(o,493);return{binPath:o,isWASM:r}}}return{binPath:n,isWASM:r}}var ah=Te("child_process"),bR=Te("crypto"),Vc=Te("path"),us=Te("fs"),xR=Te("os"),$R=Te("tty"),kt;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{kt=Te("worker_threads")}catch{}let[e,t]=process.versions.node.split(".");if(+e<12||+e===12&&+t<17||+e===13&&+t<13)kt=void 0}var Km,Gi=((Km=kt==null?void 0:kt.workerData)==null?void 0:Km.esbuildVersion)==="0.28.2",lh=()=>{if((!Ls||!1)&&(Vc.basename(__filename)!=="main.js"||Vc.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.
69
69
 
70
- 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}=aR();if(t)return["node",[e]];else return[e,[]]}},Wi=()=>uR.isatty(2),dR={readFile(e,t){try{let r=us.readFileSync(e,"utf8");try{us.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=rh();us.writeFileSync(r,e),t(r)}catch{t(null)}}},fR={readFile(e,t){try{us.readFile(e,"utf8",(r,n)=>{try{us.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=rh();us.writeFile(r,e,(n)=>n!==null?t(null):t(r))}catch{t(null)}}},pR="0.28.2",mR=(e)=>ps().build(e),hR=(e)=>ps().context(e),gR=(e,t)=>ps().transform(e,t),yR=(e,t)=>ps().formatMessages(e,t),bR=(e,t)=>ps().analyzeMetafile(e,t),xR=(e)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.buildSync(e)}let t;return wa((r)=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Wi(),defaultWD:ds,callback:(n,s)=>{if(n)throw n;t=s}})),t},$R=(e,t)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.transformSync(e,t)}let r;return wa((n)=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Wi(),fs:dR,callback:(s,i)=>{if(s)throw s;r=i}})),r},vR=(e,t)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.formatMessagesSync(e,t)}let r;return wa((n)=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},wR=(e,t)=>{if(kt&&!zi){if(!Rt)Rt=Sa(kt);return Rt.analyzeMetafileSync(e,t)}let r;return wa((n)=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},SR=()=>{if($a)$a();if(Rt)Rt.stop();return Promise.resolve()},qc=!1,ER=(e)=>{if(e=Kk(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(qc)throw Error('Cannot call "initialize" more than once');return ps(),qc=!0,Promise.resolve()},ds=process.cwd(),Vi,$a,ps=()=>{if(Vi)return Vi;let[e,t]=th(),r=eh.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:ds}),{readFromStdout:n,afterClose:s,service:i}=Xm({writeToStdin(d){r.stdin.write(d,(p)=>{if(p)s(p)})},readFileSync:us.readFileSync,isSync:!1,hasFS:!0,esbuild:Ui});r.stdin.on("error",s),r.on("error",s);let{stdin:o,stdout:a}=r;a.on("data",n),a.on("end",s),$a=()=>{o.destroy(),a.destroy(),r.kill(),qc=!1,Vi=void 0,$a=void 0};let l=0;if(r.unref(),o.unref)o.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)r.ref()},unref(){if(--l===0)r.unref()}};return Vi={build:(d)=>new Promise((p,h)=>{i.buildOrContext({callName:"build",refs:c,options:d,isTTY:Wi(),defaultWD:ds,callback:(m,b)=>m?h(m):p(b)})}),context:(d)=>new Promise((p,h)=>i.buildOrContext({callName:"context",refs:c,options:d,isTTY:Wi(),defaultWD:ds,callback:(m,b)=>m?h(m):p(b)})),transform:(d,p)=>new Promise((h,m)=>i.transform({callName:"transform",refs:c,input:d,options:p||{},isTTY:Wi(),fs:fR,callback:(b,g)=>b?m(b):h(g)})),formatMessages:(d,p)=>new Promise((h,m)=>i.formatMessages({callName:"formatMessages",refs:c,messages:d,options:p,callback:(b,g)=>b?m(b):h(g)})),analyzeMetafile:(d,p)=>new Promise((h,m)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof d==="string"?d:JSON.stringify(d),options:p,callback:(b,g)=>b?m(b):h(g)}))},Vi},wa=(e)=>{let[t,r]=th(),n=new Uint8Array,{readFromStdout:s,afterClose:i,service:o}=Xm({writeToStdin(l){if(n.length!==0)throw Error("Must run at most one command");n=l},isSync:!0,hasFS:!0,esbuild:Ui});e(o);let a=eh.execFileSync(t,r.concat("--service=0.28.2"),{cwd:ds,windowsHide:!0,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),i(null)},rh=()=>Fc.join(cR.tmpdir(),`esbuild-${lR.randomBytes(32).toString("hex")}`),Rt=null,Sa=(e)=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:ds,esbuildVersion:"0.28.2"},transferList:[r],execArgv:[]}),s=0,i=(c)=>{let d=Error(`Build failed with 1 error:
71
- error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return d.errors=p,d.warnings=[],d},o=(c)=>{if(!c)return;let d=c.plugins;if(d&&d.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,d)=>{for(let p in d)c[p]=d[p]},l=(c,d)=>{let p=s++,h=new SharedArrayBuffer(8),m=new Int32Array(h),b={sharedBuffer:h,id:p,command:c,args:d};n.postMessage(b);let g=Atomics.wait(m,0,0);if(g!=="ok"&&g!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+g);let{message:{id:y,resolve:v,reject:j,properties:S}}=e.receiveMessageOnPort(t);if(p!==y)throw Error(`Internal error: Expected id ${p} but got id ${y}`);if(j)throw a(j,S),j;return v};return n.unref(),{buildSync(c){return o(c),l("build",[c])},transformSync(c,d){return l("transform",[c,d])},formatMessagesSync(c,d){return l("formatMessages",[c,d])},analyzeMetafileSync(c,d){return l("analyzeMetafile",[c,d])},stop(){n.terminate(),Rt=null}}},_R=()=>{let e=kt.workerData.workerPort,t=kt.parentPort,r=(n)=>{let s={};if(n&&typeof n==="object")for(let i in n)s[i]=n[i];return s};try{let n=ps();ds=kt.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:i,id:o,command:a,args:l}=s,c=new Int32Array(i);try{switch(a){case"build":e.postMessage({id:o,resolve:await n.build(l[0])});break;case"transform":e.postMessage({id:o,resolve:await n.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:o,resolve:await n.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:o,resolve:await n.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(d){e.postMessage({id:o,reject:d,properties:r(d)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(n){t.on("message",(s)=>{let{sharedBuffer:i,id:o}=s,a=new Int32Array(i);e.postMessage({id:o,reject:n,properties:r(n)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(zi)_R();var PR=Ui});import{createRequire as jR}from"node:module";import{join as kR}from"node:path";function Vc(e,t){return jR(kR(t,"package.json")).resolve(e)}function RR(e){return e==="node"||e==="bun"?"node":"browser"}async function Bc(e){let t=await Promise.resolve().then(() => Lt(Ea(),1)),{entry:r}=e,n={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:RR(e.target),plugins:e.plugins,write:!1};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;if("path"in r)n.entryPoints=[r.path];else n.stdin={contents:r.source,loader:"js",resolveDir:r.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...n,write:!1})).outputFiles[0].text}var sh=()=>{};var ih=".jx-entry-";import{rmSync as OR,writeFileSync as oh}from"node:fs";import{tmpdir as CR}from"node:os";import{basename as NR,join as TR,resolve as IR}from"node:path";function lh(e){return os(e)||e.startsWith("./")||e.startsWith("../")}function Wc(e,t,r){if(os(e))return Vc(e.slice(ua.length),r);return IR(t,e)}function ch(e,t){return Vc(e,t)}function MR(e){let{onFileLoaded:t,resolver:r}=e;if(r===void 0&&t===void 0)return[];return[{name:"jx-bundle-hooks",setup:(s)=>{if(r!==void 0)s.onResolve({filter:r.filter},(i)=>r.resolve(i));if(t!==void 0)s.onLoad({filter:/.*/},(i)=>{t(i.path)})}}]}function JR(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function LR(e){return e.minify??e.target==="browser"}function FR(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...DR};return t}function uh(e){return{...FR(e),external:e.external??[],minify:LR(e),plugins:MR(e),target:e.target}}async function dh(e,t){let r=await Bc({entry:{path:e.entryPath},...uh(t)});oh(e.outfile,r,"utf8")}function Uc(e){return e==="<stdin>"||NR(e).startsWith(ih)}async function fh(e,t,r){let n=[],s=TR(CR(),`jx-resolve-${process.pid}.js`);try{await ms(`export * from ${JSON.stringify(e)};
72
- `,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{OR(s,{force:!0})}return n.find((i)=>!Uc(i))}async function ms(e,{resolveDir:t,outfile:r},n){let s=await Bc({entry:{resolveDir:t,source:e},...uh(n)});oh(r,s,"utf8")}async function ph(e,{projectRoot:t,outfile:r,adapter:n}){await ms(e,{outfile:r,resolveDir:t},JR(n))}var ah,DR;var zc=q(()=>{nr();sh();ah=["@vue/reactivity","lit-html"];DR={"process.env.NODE_ENV":'"production"'}});function HR(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function mh(e){let t=HR(e),r=t.slice(t.lastIndexOf("/")+1),n=r.lastIndexOf(".");if(n>0)t=t.slice(0,t.length-(r.length-n));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],i=!1,o=!1,a=t.replaceAll(qR,(l,c,d)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(d),`:${d}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function hh(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var qR;var gh=q(()=>{qR=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function dr(e){if(!T(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Gi(e){let t=dr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&VR.has(n)?"rtl":"ltr"}function yh(e){let t=dr(e);if(t===null)return T(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Gc(e){let t=e.i18n,r=[];if(!F(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=dr(a);if(l===null){r.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let i=dr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&dr(t.defaultLocale)===null)r.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return r.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:r,i18n:null};if(!s.includes(i))s.unshift(i);let o=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:BR;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function Tr(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=dr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var VR,_a="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",BR="prefix-except-default";var hs=q(()=>{ve();VR=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function Vt(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function bh(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return WR.has(r.toLowerCase())?r:e.slice(1)}return null}function Ki(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Xi(e){return e.startsWith("@keyframes")}function xh(e,t){let r=[];for(let n of Yi(e))for(let s of Yi(t))r.push(UR(n,s));return r.join(", ")}function UR(e,t){let r=ja(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Kc(e){let t=[],r=null,n=0;for(let s=0;s<e.length;s+=1){let i=e[s];if(r){if(i==="\\")s+=1;else if(i===r)r=null;continue}if(i==="\\")s+=1;else if(i==='"'||i==="'")r=i;else if(i==="[")n+=1;else if(i==="]")n=Math.max(0,n-1);else if(i==="&"&&n===0)t.push(s)}return t}function ja(e,t){return Kc(e).length>0?zR(e,t):null}function zR(e,t){let r="",n=0;for(let s of Kc(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function Yi(e){let t=[],r=0,n=null,s=0;for(let o=0;o<e.length;o+=1){let a=e[o];if(n){if(a==="\\")o+=1;else if(a===n)n=null;continue}if(a==='"'||a==="'")n=a;else if(a==="("||a==="[")r+=1;else if(a===")"||a==="]")r=Math.max(0,r-1);else if(a===","&&r===0)t.push(e.slice(s,o)),s=o+1}t.push(e.slice(s));let i=t.flatMap((o)=>{let a=o.trim();return a===""?[]:[a]});return i.length>0?i:[e]}function wr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Yc(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${vr}]))`,forced:`${e}:where([${vr}="${t}"])`};return{auto:`:where(:root:not([${vr}])) ${e}`,forced:`:where(:root[${vr}="${t}"]) ${e}`}}function Cn(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Xc(e){return e.startsWith("--")?e:Vt(e)}function Pa(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function $h(e,t,r){let n=r.map(([i,o])=>`${i}: ${o}`).join("; "),s=t===null?n:`${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function GR(e,t,r){let n=r.map(({selector:i,declarations:o})=>`${i} { ${o.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function KR(e){let t=Object.keys(e).filter((n)=>Xi(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function YR(e){let r=Kc(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function qs(e,t={}){let{scope:r=null,mediaQueries:n={},transposeValue:s=(y)=>y,transposeSelector:i=(y)=>y,resolveValue:o}=t,a=[],l=(y)=>y!==null&&typeof y==="object"&&!Array.isArray(y)&&!Ce(y),c=(y,v)=>{if(l(v))return[v];if(!Ki(y)||!Array.isArray(v)||v.length===0)return[];return v.every((j)=>l(j))?v:[]},d=(y,v,j,S)=>{if(v===void 0||v===null)return null;if(Ce(v))return j?o?.(y,v,S)??null:null;if(F(v))return null;let P=String(v);if(pe(P))return j?o?.(y,P,S)??null:null;return s(P)},p=(y,v,j=!0,S="self")=>{let P=[];for(let[E,O]of Object.entries(y)){if(c(E,O).length>0)continue;if(v&&(E.startsWith("@")||Cn(E)))continue;if(E.startsWith("$"))continue;let R=d(E,O,j,S);if(R!==null)P.push([Xc(E),R])}return P},h=(y,v,j,S,P)=>{if(j.length===0)return;let E=v;if(E!==null){let k=i(E);if(k===null)return;E=k}let O=$h(y,E,j),R={text:O,conditions:[...y],selector:E,declarations:j,target:S,key:Pa(O)};if(T(P)&&P!=="")R.description=P;a.push(R)},m=(y,v,j)=>{let S=y.slice(10).trim();if(S==="")return;let P=[];for(let[O,R]of Object.entries(v)){if(!l(R))continue;let k=p(R,!0,!1,"unscoped");if(k.length>0)P.push({declarations:k,selector:O.trim()})}if(P.length===0)return;let E=GR(j,S,P);a.push({blocks:P,conditions:[...j],declarations:[],key:Pa(E),selector:null,target:"unscoped",text:E})},b=(y,v,j,S,P)=>{if(y==="@--")return;if(Ki(y)){h([...S,y],null,p(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(Xi(y)){m(y,v,S);return}let E=bh(y,n),O=E===null?y:`@media ${E}`,R=E===null?null:wr(E);if(R!==null&&j!==null){let{auto:k,forced:I}=Yc(j,R);g(v,k,[...S,O],P),g(KR(v),I,S,P);return}g(v,j,[...S,O],P)};function g(y,v,j,S){h(j,v,p(y,!0,!0,S),S,y.$description);for(let[P,E]of Object.entries(y))for(let O of c(P,E))if(P.startsWith("@"))b(P,O,v,j,S);else if(v!==null)g(O,xh(v,P),j,YR(P)?S:"descendant")}return g(e,r,[],"self"),a}var WR,vr="data-color-scheme",ka="jx-color-scheme";var Zi=q(()=>{ve();WR=new Set(["all","print","screen","speech"])});function Sh(){return`the Intl helpers ${Qc.join(", ")}`}var Ir="en-US",Zc="UTC",vh,Qc,wh;var eu=q(()=>{vh=[{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."}],Qc=vh.map((e)=>e.path),wh=Object.fromEntries(vh.map((e)=>[e.path,e.params.indexOf("locale")]))});function XR(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function dt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function cn(e){if(e==="")return[];return e.split("/").map((t)=>XR(t))}function mt(e,t){let r=e;for(let n of cn(t))r=r?.[n];return r}function Pe(e,t){let r=e;for(let n of cn(t))r+=tu.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function Eh(e,t){let r=e;for(let[n,s]of cn(t).entries()){let i=n===0?"":"?.";r+=tu.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function un(e){return tu.test(e)?e:JSON.stringify(e)}function _h(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var tu;var Hs=q(()=>{tu=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function ru(e){let t=e.$map;return F(t)?t:void 0}function Rh(e){return F(e)&&!Array.isArray(e)&&"operator"in e}function Qi(e){return F(e)&&!Array.isArray(e)&&"$ref"in e}function tA(e,t,r){let n=wh[e];if(n===void 0||n<0||t[n]!=null)return t;let s=mt(r.$page,"locale");if(!T(s)||s==="")return t;let i=[...t];return i[n]=s,i}function Nh(e){return e.startsWith("window#/")&&QR.has(e.slice(8))}function dn(e){return Ah.has(e)}function Ke(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>rA)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Fe(e,t,r,n,s){if(e===null||e===void 0)return e;if(Rh(e))return ir(e,t,r,n,s);if(Qi(e)){let i=Ra(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return Th(e,t,r,n,s);return s?.report(s.path??[],e),e}function Th(e,t,r,n,s){return e.map((i,o)=>Fe(i,t,r,n,Ke(s,o)))}function nA(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return Ra(e.slice(0,e.lastIndexOf("/")),t,r,n)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?Ra(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function Ra(e,t,r,n){if(e==="$reduce/acc")return n?.acc;if(e.startsWith("$reduce/"))return n?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),i=n?.args?.[s[0]];return s.length>1?mt(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return mt(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=ru(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];return s.length>2?mt(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return mt(t,e.slice(8));if(e.startsWith("parent#/"))return mt(t,e.slice(8));if(e.startsWith("window#/"))return mt(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return mt(globalThis.document,e.slice(10));return mt(t,e)??null}function sA(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=ru(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];if(s.length>2){let l=s.slice(2),c=l.pop(),d=l.length>0?mt(o,l.join("/")):o;return{key:c,obj:d}}return{key:i==="item"?"$map/item":"$map/index",obj:ru(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=cn(s),a=o.pop(),l=t;for(let c of o)l=l[c];return{key:a,obj:l}}return{key:e,obj:t}}function ir(e,t,r,n,s){let i=iA(e,t,r,n,s);return s?.report(s.path??[],i),i}function jh(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"<":return t<r;case"<=":return t<=r;case">":return t>r;default:return t>=r}}function iA(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!ZR.has(i))throw Error(`$expression: unknown operator "${i}"`);if(nu.has(i)&&!("value"in e)){let c=Fe(o,t,r,n,Ke(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=Qi(o)?o.$ref:void 0;if(!T(c))throw TypeError("$expression: call target must be a $ref pointer");let d=(n?.callDepth??0)+1;if(d>Ph)throw Error(`$expression: call depth exceeded (${Ph})`);let p=Array.isArray(a)?a.map((m,b)=>Fe(m,t,r,n,Ke(s,["value",b]))):[];if(c.startsWith("window#/")){if(!Nh(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),b=eA.get(m);if(b)return b(...tA(m,p,t));let g=mt(globalThis.window,m),y=m.lastIndexOf("/"),v=y===-1?globalThis.window:mt(globalThis.window,m.slice(0,y));return g.apply(v,p)}let h=Ra(c,t,r,n);if(vt(h))return h.apply(nA(c,t,r,n),p);if(F(h)&&"$expression"in h){let m=h,b={};for(let[g,y]of(m.parameters??[]).entries()){let v=T(y)?y:y?.name??"";if(!v)continue;b[v]=p[g]===void 0&&F(y)&&"default"in y?y.default:p[g]}return ir(m.$expression,t,r,{args:b,callDepth:d})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(ou.has(i)){if(i==="?:"){let m=Fe(o,t,r,n,Ke(s,"target"));if(s){let b=Fe(a,t,r,n,Ke(s,"value")),g=Fe(l,t,r,n,Ke(s,"initial"));return m?b:g}return m?Fe(a,t,r,n):Fe(l,t,r,n)}let c=Fe(o,t,r,n,Ke(s,"target")),d=String(c),p=e.cases??{},h=Object.hasOwn(p,d);if(s){let m;for(let[g,y]of Object.entries(p)){let v=Fe(y,t,r,n,Ke(s,["cases",g]));if(g===d)m=v}let b=Fe(e.default,t,r,n,Ke(s,"default"));return h?m:b}return h?Fe(p[d],t,r,n):Fe(e.default,t,r,n)}if(su.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=Fe(a,t,r,n,Ke(s,"value"));switch(i){case"===":return c===d;case"!==":return c!==d;case"&&":return c&&d;case"||":return c||d;case"??":return c??d;default:return jh(i,c,d)}}if(Oh.has(i)){let c=Fe(a,t,r,n,Ke(s,"value")),{obj:d,key:p}=sA(o.$ref,t,r,n);d[p]=i==="="?c:jh(i.slice(0,-1),d[p],c);return}if(Ch.has(i)){let c=Fe(o,t,r,n,Ke(s,"target"));switch(i){case"push":return c.push(Fe(a,t,r,n,Ke(s,"value")));case"unshift":return c.unshift(Fe(a,t,r,n,Ke(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let d=Fe(a,t,r,n,Ke(s,"value"));return c.splice(...d)}default:break}}if(au.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=a===void 0?[]:Array.isArray(a)?Th(a,t,r,n,Ke(s,"value")):[Fe(a,t,r,n,Ke(s,"value"))],p=mt(c,i);if(!vt(p))return;return p.apply(c,d)}if(iu.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),d=a;if(i==="reduce"){let p=Fe(l,t,r,n,Ke(s,"initial"));for(let[h,m]of c.entries())p=ir(d,t,r,{acc:p,index:h,item:m},h===0?Ke(s,"value"):void 0);return p}if(i==="map")return c.map((p,h)=>ir(d,t,r,{...n,index:h,item:p},h===0?Ke(s,"value"):void 0));if(i==="filter")return c.filter((p,h)=>ir(d,t,r,{...n,index:h,item:p},h===0?Ke(s,"value"):void 0))}return}function Ze(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Rh(e))return At(e,t);if(Qi(e))return lu(e.$ref,t);if(Array.isArray(e))return e.map((r)=>Ze(r,t)).join(", ");return JSON.stringify(e)}function oA(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function lu(e,t){let r=t.statePrefix??"state",n=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Pe("_args",e.slice(6));if(e.startsWith("event#/"))return Pe(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Pe("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Pe(r,e.slice(8));if(e.startsWith("parent#/"))return Pe(r,e.slice(8));if(e.startsWith("window#/"))return Pe("window",e.slice(8));if(e.startsWith("document#/"))return Pe("document",e.slice(10));return Pe(r,e)}function kh(e,t){if(Qi(e))return lu(e.$ref,t);return Ze(e,t)}function aA(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Ir)})`,i=JSON.stringify(Zc);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${n(1)} ?? ${s}, {timeZone: ${i}, ...${n(2)}}).format(new Date(${n(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${n(2)} ?? ${s}, ${n(3)}).format(${n(0)}, ${n(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/plural":return`new Intl.PluralRules(${n(1)} ?? ${s}, ${n(2)}).select(${n(0)})`;case"Intl/compare":return`new Intl.Collator(${n(2)} ?? ${s}, ${n(3)}).compare(${n(0)}, ${n(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${n(2)} ?? ${s}, {...${n(3)}, type: ${n(1)} ?? 'language'}).of(${n(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${n(2)} ?? ${s}, {granularity: ${n(1)} ?? 'grapheme'}).segment(${n(0)})].map((p) => p.segment)`;default:return null}}function At(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(nu.has(r)&&!("value"in e)){let o=Ze(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(Qi(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>Ze(l,t)):[];if(o.startsWith("window#/")){if(!Nh(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=aA(o.slice(8),a,t);if(l)return l;return`window.${o.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(o.startsWith("#/state/")){let l=o.slice(8),c=t.formulaParams?.[l];if(c){let d=c.map((p,h)=>`${JSON.stringify(p)}: ${a[h]??"undefined"}`).join(", ");return`${oA(l)}(${t.statePrefix??"state"}, { ${d} })`}}return`${lu(o,t)}(${a.join(", ")})`}if(ou.has(r)){if(r==="?:"){let c=Ze(n,t),d=Ze(s,t),p=Ze(i,t);return`(${c} ? ${d} : ${p})`}let o=Ze(n,t),a=Object.entries(e.cases??{}).map(([c,d])=>`_d === ${JSON.stringify(c)} ? ${Ze(d,t)} : `).join(""),l="default"in e?Ze(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(su.has(r)){let o=Ze(n,t),a=Ze(s,t);return`(${o} ${r} ${a})`}if(Oh.has(r)){let o=kh(n,t),a=Ze(s,t);return`${o} ${r} ${a}`}if(Ch.has(r)){let o=kh(n,t);switch(r){case"push":return`${o}.push(${Ze(s,t)})`;case"unshift":return`${o}.unshift(${Ze(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`${o}.splice(${a})`}default:break}}if(au.has(r)){let o=Ze(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`(${o})?.${r}?.(${a})`}if(iu.has(r)){let o=Ze(n,t),a=At(s,t);if(r==="reduce"){let l=Ze(i,t);return`${o}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(r==="map")return`${o}.map((_item, _index) => ${a})`;if(r==="filter")return`${o}.filter((_item, _index) => ${a})`}return"undefined"}function Vs(e,t,r,n){return Fe(e,t,r,n)}function fn(e,t={}){return Ze(e,t)}var Ah,nu,su,Oh,Ch,iu,ou,au,ZR,QR,eA,Ph=64,rA=64;var eo=q(()=>{eu();ve();Hs();Ah=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),nu=new Set(["!","-"]),su=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Oh=new Set(["=","+=","-=","*=","/="]),Ch=new Set(["push","pop","shift","unshift","splice"]),iu=new Set(["reduce","map","filter"]),ou=new Set(["?:","switch"]),au=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"]),ZR=new Set([...Ah,...nu,...su,...iu,...ou,...au,"call"]),QR=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",...Qc]),eA=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??Ir,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??Ir,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??Ir,{timeZone:Zc,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??Ir,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??Ir,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??Ir,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??Ir,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??Ir,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function Ih(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 lA(e){return(F(e)||vt(e))&&"then"in e&&vt(e.then)}async function Bs(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=Ih(i);switch(o.kind){case"expression":{let a=ir(o.node,t,r,s);if(lA(a))await a;break}case"if":{let a=o.node,l=Vs(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await Bs(l,t,r,n);break}case"switch":{let a=o.node,l=String(Vs(a.$switch,t,r,s)),c=a.cases??{},d=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(d))await Bs(d,t,r,n);break}case"dispatch":{let a=o.node,l=vt(n.target)?n.target():n.target,c=r?.currentTarget??l;if(!c)break;let d={};if("detail"in a)d.detail=Vs(a.detail,t,r,s);if(a.bubbles!==void 0)d.bubbles=a.bubbles;if(a.composed!==void 0)d.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,d));break}case"stopPropagation":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function fr(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=Ih(s);switch(i.kind){case"expression":{n.push(`${r}${At(i.node,t)};`);break}case"if":{let o=i.node,a=fn(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,fr(o.then??[],l)),o.else)n.push(`${r}} else {`,fr(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=fn(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,d]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,fr(d,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,fr(o.default,l),`${r} }`);n.push(`${r}}`);break}case"dispatch":{let o=i.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in o)c.push(`detail: ${fn(o.detail,t)}`);if(o.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(o.bubbles)}`);if(o.composed!==void 0)c.push(`composed: ${JSON.stringify(o.composed)}`);let d=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${d}));`);break}case"stopPropagation":{n.push(`${r}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{n.push(`${r}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return n.join(`
73
- `)}var Aa=q(()=>{ve();eo()});function Ws(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let t=0;for(let r=1;r<e.length;r+=1){let n=e[r];if(n==="{")t+=1;else if(n==="}"){if(t-=1,t===0)return r===e.length-1}}return!1}function Jh(){return[...Mh].toSorted()}function gs(e,t){let r=e.toLowerCase();if(r.startsWith("aria-")||Mh.has(r))return String(t);return t?"":null}var pn,Mh,cu=32,Oa,Ca="jx-slot",to="data-jx-slots",uu="jx.slot.group",e8;var Us=q(()=>{Zi();eo();Hs();ve();nr();Aa();Zi();pn=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Mh=new Set(["contenteditable","draggable","spellcheck"]);Oa=/^[\t\n\f\r ]+$/u,e8=(()=>{let e=Symbol.for(uu),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function Dh(e,t,r,n,s=uA){let i=[],o=(p,h)=>{let m={mediaQueries:t,scope:h,transposeValue:r};if(n)m.resolveValue=(b,g)=>n(b,g,h);for(let b of qs(p,m))i.push(b.text)},a={},l={},c=[],d=[];for(let[p,h]of Object.entries(e)){if(F(h)&&!Array.isArray(h)){if(p.startsWith("@"))c.push([p,h]);else if(!p.startsWith("--"))d.push([p,h]);continue}if(Cn(p)||p.startsWith("@"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")a[p]=h;else l[p]=h}o(a,s.root),o(l,s.body);for(let[p,h]of d)if(p.startsWith("&"))o({[p]:h},s.root);else o(h,p);for(let[p,h]of c){if(Ki(p)||Xi(p)){o({[p]:h},null);continue}let m={},b={},g=[];for(let[y,v]of Object.entries(h)){if(F(v)&&!Array.isArray(v)){if(!y.startsWith("@"))g.push([y,v]);continue}if(y.startsWith("--"))m[y]=v;else b[y]=v}o({[p]:m},s.root),o({[p]:b},s.body);for(let[y,v]of g)o({[p]:v},y)}if(Object.values(t).some((p)=>wr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${vr}="light"]) { color-scheme: light }`,`${s.root}:where([${vr}="dark"]) { color-scheme: dark }`);return i.join(`
74
- `)}var uA;var Lh=q(()=>{Zi();ve();uA={body:"body",root:":root"}});function Fh(e){return e===!1||e==="open"||e==="closed"}function ys(e,t){let r=e?.$shadow;if(Fh(r))return r===!1?null:r;let n=t?.shadow;return Fh(n)&&n!==!1?n:null}function qh(e,t){return t===null?e:":host"}function no(e,t){let r=[];for(let[n,s]of(e.parameters??[]).entries()){let i=Hh(s);if(!i)continue;let o=Vh(s)?`_a[${n}] === undefined ? ${JSON.stringify(s.default)} : _a[${n}]`:`_a[${n}]`;r.push(`${JSON.stringify(i)}: ${o}`)}return`(..._a) => { const _args = { ${r.join(", ")} }; return ${t}; }`}function Hh(e){return T(e)?e:e?.name??""}function Vh(e){return F(e)&&"default"in e}function Ia(e,t){let r=hu(e,t);return r===e?e:`${r} as ${e}`}function hu(e,t){let r=t?.$export;return T(r)&&r!==""?r:e}function Ma(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i}=r,{url:o}=t,a=pe(o),l=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":o}`,i?`${i}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${fA(o,n)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(o)};`);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 h=F(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);d.push(`body: ${h}`)}let p=d.length>0?`, { ${d.join(", ")} }`:"";return c.push(` fetch(url${p})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${n}.${e} = d; })`,` .catch(e => { ${n}.${e} = { error: String(e) }; });`,i?"}));":"});"),c.map((h)=>`${s}${h}`).join(`
75
- `)}function Ja(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i,serverBaseUrl:o="/_jx/server"}=r,a=JSON.stringify(`${o}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([g,y])=>{if(!Ce(y))return`${un(g)}: ${JSON.stringify(y)}`;if(dA.some((v)=>y.$ref.startsWith(v)))throw Error(`Server function "${e}": argument "${g}" references "${y.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${un(g)}: ${fn({$ref:y.$ref},{statePrefix:n})}`}),d=l.some(([,g])=>Ce(g)),p=`${Yh}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,h=Pe(n,dt(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(d?[`// ${e}: server function ${t.$export}, called again when an argument changes`,"{"," let _jxSeq = 0;",i?` ${i}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${p}`,` .then((d) => { if (_seq === _jxSeq) ${h} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,i?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,p,` .then((d) => { ${h} = d; })`,` .catch((e) => { ${m}; });`]).map((g)=>`${s}${g}`).join(`
76
- `)}function fA(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function Da(e){if(!F(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!F(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(Pn(r))continue;return!0}if(e.$switch)return!0;if(Qe(e)||_c(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>Da(t)))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function Wh(e){if(!F(e))return!1;if(e.$switch)return!0;if(Qe(e)||_c(e.children))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function Xs(e,t=null,r={},n={}){let s=e?.state?zs(e.state,t):t??Uh();return{media:n,scope:s,scopeDefs:r}}function Uh(e=null){return Object.create(e)}function zh(e){return e[Bh]}function pu(e,t){if(T(e)){for(let i of e.matchAll(pA))t.add(i[1]);for(let i of e.matchAll(mA))t.add(i[1]);return}if(Array.isArray(e)){for(let i of e)pu(i,t);return}if(!F(e))return;let r=e,{operator:n,target:s}=r;if(T(n)&&dn(n)&&Ce(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))pu(i,t)}function zs(e={},t=null){let r=Uh(t),n=t?zh(t):void 0,s=new Set(n);Object.defineProperty(r,Bh,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let c of Object.values(e))if(er(c)||tr(c))pu(c.body??c.$expression,i);for(let c of i)if(c in e)s.add(c);for(let[c,d]of Object.entries(e)){if(!F(d)||Array.isArray(d)){mn(r,c,Na(d));continue}if("default"in d){mn(r,c,Na(d.default));continue}if(tn(d)){s.add(c);continue}if(!d.$prototype&&!("$expression"in d)&&!Pn(d))mn(r,c,Na(d))}let o=[],a=[];for(let[c,d]of Object.entries(e)){if(pe(d)){o.push([c,d]);continue}if(!F(d))continue;if(tr(d)){let p=d.$expression;if(ns(d)){let h=d.parameters;mn(r,c,(...m)=>{let b={};for(let[g,y]of h.entries()){let v=Hh(y);if(!v)continue;b[v]=m[g]===void 0&&Vh(y)?y.default:m[g]}return ir(p,r,null,{args:b})})}else if(dn(p.operator))mn(r,c,(h,m)=>ir(p,h,m));else du(r,c,()=>ir(p,r,null));continue}if(er(d)){if(_n(d)){let{body:p}=d;mn(r,c,(h,m)=>{Bs(p,h??r,m??null)})}else if(T(d.body)){let p=d.parameters?rn(d.parameters):d.arguments??[],{body:h}=d,m=p.includes("state")?p:["state",...p],b=Function(...m,h),g=(y,v)=>b(...m.map((j)=>j==="state"?y:v));if(ss(h))du(r,c,()=>g(r)),a.push([c,h]);else mn(r,c,g)}else mn(r,c,()=>{}),s.add(c);continue}if(Cr(d)&&(d.$prototype==="LocalStorage"||d.$prototype==="SessionStorage")){mn(r,c,Na(d.default??null));continue}if(Cr(d)&&d.$prototype==="Request")s.add(c)}let l=!0;while(l){l=!1;for(let[c,d]of[...a,...o])if(!s.has(c)&&Gh(d,r))s.add(c),l=!0}for(let[c,d]of o)du(r,c,()=>wt(d,r));return r}function mn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function du(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Me(e,t){if(Ce(e))return gu(e.$ref,t);if(pe(e))return wt(e,t);return e}function Bt(e){return Ce(e)}function gu(e,t){if(!T(e))return e;if(e.startsWith("$map/")){let r=e.split("/"),n=r[1],i=t.$map?.[n]??t[`$map/${n}`];return r.length>2?fu(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return fu(t,e.slice(8));return fu(t,e)??null}function Gh(e,t){if(!t)return!1;let r=zh(t);for(let n of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(n[2])continue;let s=n[1];if(r?.has(s))return!0;let i;try{i=t[s]}catch{continue}if(vt(i))return!0}return!1}function La(e){return Ws(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function wt(e,t){if(Gh(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=Ws(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function fu(e,t){return mt(e,t)}function Na(e){if(!F(e))return e;return structuredClone(e)}function hA(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&pe(n)).map(([r,n])=>{let s=Me(n,t);return s==null?null:`${Vt(r)}: ${s}`}).filter(Boolean).join("; ")}function bs(e,t,r=""){let n="",s=Me(e.id,t),i=Me(e.className,t),o=Me(e.hidden,t),a=Me(e.tabIndex,t),l=Me(e.title,t),c=Me(e.lang,t),d=Me(e.dir,t);if(s)n+=` id="${$e(String(s))}"`;if(i)n+=` class="${$e(String(i))}"`;if(o)n+=" hidden";if(a!==void 0&&a!==null)n+=` tabindex="${$e(String(a))}"`;if(l)n+=` title="${$e(String(l))}"`;if(c)n+=` lang="${$e(String(c))}"`;if(d)n+=` dir="${$e(String(d))}"`;let p=[hA(e.style,t),r].filter(Boolean).join("; ");if(p)n+=` style="${$e(p)}"`;if(e.attributes)for(let[h,m]of Object.entries(e.attributes)){let b=Me(m,t);if($t(b)){let g=gs(h,b);if(g!==null)n+=g===""?` ${h}`:` ${h}="${$e(g)}"`;continue}if(T(b)||lr(b))n+=` ${h}="${$e(String(b))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function so(e,t=" "){return e?"":`
77
- ${t}`}function Zs(){let e=JSON.stringify(ka),t=JSON.stringify(vr);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Ta(e,t,r,n){for(let s of qs(t,{mediaQueries:n,resolveValue:(i,o)=>Kh(i,o,r),scope:r}))e.push(s.text)}function Kh(e,t,r){let n=T(t)?t:t.$ref;return gA.push({property:e,selector:r,source:n}),null}function Fa(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Jh())});
78
- function ${Qs}(n, v) {
70
+ 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}=yR();if(t)return["node",[e]];else return[e,[]]}},Ui=()=>$R.isatty(2),vR={readFile(e,t){try{let r=us.readFileSync(e,"utf8");try{us.unlinkSync(e)}catch{}t(null,r)}catch(r){t(r,null)}},writeFile(e,t){try{let r=ch();us.writeFileSync(r,e),t(r)}catch{t(null)}}},wR={readFile(e,t){try{us.readFile(e,"utf8",(r,n)=>{try{us.unlink(e,()=>t(r,n))}catch{t(r,n)}})}catch(r){t(r,null)}},writeFile(e,t){try{let r=ch();us.writeFile(r,e,(n)=>n!==null?t(null):t(r))}catch{t(null)}}},SR="0.28.2",ER=(e)=>ps().build(e),_R=(e)=>ps().context(e),PR=(e,t)=>ps().transform(e,t),jR=(e,t)=>ps().formatMessages(e,t),kR=(e,t)=>ps().analyzeMetafile(e,t),RR=(e)=>{if(kt&&!Gi){if(!Rt)Rt=Ea(kt);return Rt.buildSync(e)}let t;return Sa((r)=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Ui(),defaultWD:ds,callback:(n,s)=>{if(n)throw n;t=s}})),t},AR=(e,t)=>{if(kt&&!Gi){if(!Rt)Rt=Ea(kt);return Rt.transformSync(e,t)}let r;return Sa((n)=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Ui(),fs:vR,callback:(s,i)=>{if(s)throw s;r=i}})),r},OR=(e,t)=>{if(kt&&!Gi){if(!Rt)Rt=Ea(kt);return Rt.formatMessagesSync(e,t)}let r;return Sa((n)=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},CR=(e,t)=>{if(kt&&!Gi){if(!Rt)Rt=Ea(kt);return Rt.analyzeMetafileSync(e,t)}let r;return Sa((n)=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e==="string"?e:JSON.stringify(e),options:t,callback:(s,i)=>{if(s)throw s;r=i}})),r},TR=()=>{if(va)va();if(Rt)Rt.stop();return Promise.resolve()},Bc=!1,NR=(e)=>{if(e=iR(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(Bc)throw Error('Cannot call "initialize" more than once');return ps(),Bc=!0,Promise.resolve()},ds=process.cwd(),Bi,va,ps=()=>{if(Bi)return Bi;let[e,t]=lh(),r=ah.spawn(e,t.concat("--service=0.28.2","--ping"),{windowsHide:!0,stdio:["pipe","pipe","inherit"],cwd:ds}),{readFromStdout:n,afterClose:s,service:i}=sh({writeToStdin(u){r.stdin.write(u,(p)=>{if(p)s(p)})},readFileSync:us.readFileSync,isSync:!1,hasFS:!0,esbuild:zi});r.stdin.on("error",s),r.on("error",s);let{stdin:o,stdout:a}=r;a.on("data",n),a.on("end",s),va=()=>{o.destroy(),a.destroy(),r.kill(),Bc=!1,Bi=void 0,va=void 0};let l=0;if(r.unref(),o.unref)o.unref();if(a.unref)a.unref();let c={ref(){if(++l===1)r.ref()},unref(){if(--l===0)r.unref()}};return Bi={build:(u)=>new Promise((p,g)=>{i.buildOrContext({callName:"build",refs:c,options:u,isTTY:Ui(),defaultWD:ds,callback:(m,b)=>m?g(m):p(b)})}),context:(u)=>new Promise((p,g)=>i.buildOrContext({callName:"context",refs:c,options:u,isTTY:Ui(),defaultWD:ds,callback:(m,b)=>m?g(m):p(b)})),transform:(u,p)=>new Promise((g,m)=>i.transform({callName:"transform",refs:c,input:u,options:p||{},isTTY:Ui(),fs:wR,callback:(b,h)=>b?m(b):g(h)})),formatMessages:(u,p)=>new Promise((g,m)=>i.formatMessages({callName:"formatMessages",refs:c,messages:u,options:p,callback:(b,h)=>b?m(b):g(h)})),analyzeMetafile:(u,p)=>new Promise((g,m)=>i.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u==="string"?u:JSON.stringify(u),options:p,callback:(b,h)=>b?m(b):g(h)}))},Bi},Sa=(e)=>{let[t,r]=lh(),n=new Uint8Array,{readFromStdout:s,afterClose:i,service:o}=sh({writeToStdin(l){if(n.length!==0)throw Error("Must run at most one command");n=l},isSync:!0,hasFS:!0,esbuild:zi});e(o);let a=ah.execFileSync(t,r.concat("--service=0.28.2"),{cwd:ds,windowsHide:!0,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16777216});s(a),i(null)},ch=()=>Vc.join(xR.tmpdir(),`esbuild-${bR.randomBytes(32).toString("hex")}`),Rt=null,Ea=(e)=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:ds,esbuildVersion:"0.28.2"},transferList:[r],execArgv:[]}),s=0,i=(c)=>{let u=Error(`Build failed with 1 error:
71
+ error: ${c}`),p=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=p,u.warnings=[],u},o=(c)=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw i("Cannot use plugins in synchronous API calls")},a=(c,u)=>{for(let p in u)c[p]=u[p]},l=(c,u)=>{let p=s++,g=new SharedArrayBuffer(8),m=new Int32Array(g),b={sharedBuffer:g,id:p,command:c,args:u};n.postMessage(b);let h=Atomics.wait(m,0,0);if(h!=="ok"&&h!=="not-equal")throw Error("Internal error: Atomics.wait() failed: "+h);let{message:{id:y,resolve:v,reject:j,properties:S}}=e.receiveMessageOnPort(t);if(p!==y)throw Error(`Internal error: Expected id ${p} but got id ${y}`);if(j)throw a(j,S),j;return v};return n.unref(),{buildSync(c){return o(c),l("build",[c])},transformSync(c,u){return l("transform",[c,u])},formatMessagesSync(c,u){return l("formatMessages",[c,u])},analyzeMetafileSync(c,u){return l("analyzeMetafile",[c,u])},stop(){n.terminate(),Rt=null}}},IR=()=>{let e=kt.workerData.workerPort,t=kt.parentPort,r=(n)=>{let s={};if(n&&typeof n==="object")for(let i in n)s[i]=n[i];return s};try{let n=ps();ds=kt.workerData.defaultWD,t.on("message",(s)=>{(async()=>{let{sharedBuffer:i,id:o,command:a,args:l}=s,c=new Int32Array(i);try{switch(a){case"build":e.postMessage({id:o,resolve:await n.build(l[0])});break;case"transform":e.postMessage({id:o,resolve:await n.transform(l[0],l[1])});break;case"formatMessages":e.postMessage({id:o,resolve:await n.formatMessages(l[0],l[1])});break;case"analyzeMetafile":e.postMessage({id:o,resolve:await n.analyzeMetafile(l[0],l[1])});break;default:throw Error(`Invalid command: ${a}`)}}catch(u){e.postMessage({id:o,reject:u,properties:r(u)})}Atomics.add(c,0,1),Atomics.notify(c,0,1/0)})()})}catch(n){t.on("message",(s)=>{let{sharedBuffer:i,id:o}=s,a=new Int32Array(i);e.postMessage({id:o,reject:n,properties:r(n)}),Atomics.add(a,0,1),Atomics.notify(a,0,1/0)})}};if(Gi)IR();var MR=zi});import{createRequire as JR}from"node:module";import{join as DR}from"node:path";function Uc(e,t){return JR(DR(t,"package.json")).resolve(e)}function LR(e){return e==="node"||e==="bun"?"node":"browser"}async function zc(e){let t=await Promise.resolve().then(() => Lt(_a(),1)),{entry:r}=e,n={bundle:!0,external:e.external,format:"esm",logLevel:"silent",minify:e.minify,platform:LR(e.target),plugins:e.plugins,write:!1};if(e.conditions)n.conditions=e.conditions;if(e.define)n.define=e.define;if("path"in r)n.entryPoints=[r.path];else n.stdin={contents:r.source,loader:"js",resolveDir:r.resolveDir,sourcefile:"jx-entry.js"};return(await t.build({...n,write:!1})).outputFiles[0].text}var dh=()=>{};var fh=".jx-entry-";import{rmSync as qR,writeFileSync as ph}from"node:fs";import{tmpdir as HR}from"node:os";import{basename as VR,join as BR,resolve as WR}from"node:path";function hh(e){return os(e)||e.startsWith("./")||e.startsWith("../")}function Gc(e,t,r){if(os(e))return Uc(e.slice(da.length),r);return WR(t,e)}function gh(e,t){return Uc(e,t)}function UR(e){let{onFileLoaded:t,resolver:r}=e;if(r===void 0&&t===void 0)return[];return[{name:"jx-bundle-hooks",setup:(s)=>{if(r!==void 0)s.onResolve({filter:r.filter},(i)=>r.resolve(i));if(t!==void 0)s.onLoad({filter:/.*/},(i)=>{t(i.path)})}}]}function zR(e){if(e==="cloudflare-workers"||e==="cloudflare-pages")return{conditions:["workerd","worker"],external:["cloudflare:*","node:*"],target:"workerd"};return{target:e==="bun"?"bun":"node"}}function KR(e){return e.minify??e.target==="browser"}function YR(e){let t={};if(e.conditions)t.conditions=e.conditions;if(e.target==="browser")t.define={...GR};return t}function yh(e){return{...YR(e),external:e.external??[],minify:KR(e),plugins:UR(e),target:e.target}}async function bh(e,t){let r=await zc({entry:{path:e.entryPath},...yh(t)});ph(e.outfile,r,"utf8")}function Kc(e){return e==="<stdin>"||VR(e).startsWith(fh)}async function xh(e,t,r){let n=[],s=BR(HR(),`jx-resolve-${process.pid}.js`);try{await ms(`export * from ${JSON.stringify(e)};
72
+ `,{outfile:s,resolveDir:t},{...r,minify:!1,onFileLoaded:(i)=>n.push(i)})}catch{return}finally{qR(s,{force:!0})}return n.find((i)=>!Kc(i))}async function ms(e,{resolveDir:t,outfile:r},n){let s=await zc({entry:{resolveDir:t,source:e},...yh(n)});ph(r,s,"utf8")}async function $h(e,{projectRoot:t,outfile:r,adapter:n}){await ms(e,{outfile:r,resolveDir:t},zR(n))}var mh,GR;var Yc=q(()=>{sr();dh();mh=["@vue/reactivity","lit-html"];GR={"process.env.NODE_ENV":'"production"'}});function ZR(e){return e.split("\\").join("/").replace(/^\.\//,"").replace(/^\//,"").replace(/^pages\//,"")}function vh(e){let t=ZR(e),r=t.slice(t.lastIndexOf("/")+1),n=r.lastIndexOf(".");if(n>0)t=t.slice(0,t.length-(r.length-n));if(t.endsWith("/index"))t=t.slice(0,-6)||"/";else if(t==="index")t="/";if(!t.startsWith("/"))t=`/${t}`;let s=[],i=!1,o=!1,a=t.replaceAll(XR,(l,c,u)=>{if(i=!0,c)return o=!0,s.push(c),"*";return s.push(u),`:${u}`});return{isCatchAll:o,isDynamic:i,params:s,urlPattern:a}}function wh(e,t){if(e.isDynamic!==t.isDynamic)return e.isDynamic?1:-1;if(e.isCatchAll!==t.isCatchAll)return e.isCatchAll?1:-1;return e.urlPattern.localeCompare(t.urlPattern)}var XR;var Sh=q(()=>{XR=/\[\.\.\.(\w+)\]|\[(\w+)\]/g});function eA(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Eh(e){if(!z(e)||!("paginate"in e))return null;let{each:t,pageSize:r,paginate:n}=e,s=z(n)?n.$ref:void 0,i=N(s)?QR.exec(s)?.[1]:void 0;if(i===void 0)throw TypeError('$paths.paginate must be { "$ref": "#/state/<key>" }');if(!Ft(r)||!Number.isInteger(r)||r<1)throw TypeError("$paths.pageSize must be a positive integer");let o={key:eA(i),pageSize:r};if(t!==void 0){if(!z(t)&&!Array.isArray(t))throw TypeError("$paths.each must be a $paths source");if(z(t)&&"paginate"in t)throw TypeError("$paths.each cannot itself be paged");o.each=t}return o}function Xc(e,t){return Math.max(1,Math.ceil(e/t))}function _h(e,t,r){let n=(t-1)*r;return e.slice(n,n+r)}function hs(e,t){if(e.endsWith("*")){if(t===1){let r=e.slice(0,-1).replace(/\/$/,"");return r===""?"/":r}return`${e.slice(0,-1)}${t}`}return e.replace(/:[^/]+/,String(t))}function Ph(e,t,r,n){let s=Xc(n,r),i=[];for(let o=1;o<=s;o++)i.push({current:o===t,number:o,url:hs(e,o)});return{first:hs(e,1),itemCount:n,last:hs(e,s),next:t<s?hs(e,t+1):null,number:t,pageCount:s,pageSize:r,pages:i,prev:t>1?hs(e,t-1):null}}var QR;var jh=q(()=>{$e();QR=/^#\/state\/([^/]+)$/});function dr(e){if(!N(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Ki(e){let t=dr(e);if(t===null)return"ltr";let r=new Intl.Locale(t),n=r.script??r.maximize().script;return n!==void 0&&tA.has(n)?"rtl":"ltr"}function kh(e){let t=dr(e);if(t===null)return N(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Zc(e){let t=e.i18n,r=[];if(!F(t))return{errors:r,i18n:null};let n=Array.isArray(t.locales)?t.locales:[],s=[];for(let a of n){let l=dr(a);if(l===null){r.push(`i18n.locales: "${String(a)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(l))s.push(l)}let i=dr(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&dr(t.defaultLocale)===null)r.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(i===null)return r.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:r,i18n:null};if(!s.includes(i))s.unshift(i);let o=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:rA;return{errors:r,i18n:{defaultLocale:i,locales:s,routing:o}}}function vr(e,t){if(t===null)return null;let r=e.split("/").find(Boolean);if(r===void 0)return t.defaultLocale;let n=dr(r);return n!==null&&t.locales.includes(n)?n:t.defaultLocale}var tA,Pa="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",rA="prefix-except-default";var gs=q(()=>{$e();tA=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});function Bt(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Rh(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let r=e.slice(2,-1).trim();return nA.has(r.toLowerCase())?r:e.slice(1)}return null}function Yi(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Zi(e){return e.startsWith("@keyframes")}function Ah(e,t){let r=[];for(let n of Xi(e))for(let s of Xi(t))r.push(sA(n,s));return r.join(", ")}function sA(e,t){let r=ka(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Qc(e){let t=[],r=null,n=0;for(let s=0;s<e.length;s+=1){let i=e[s];if(r){if(i==="\\")s+=1;else if(i===r)r=null;continue}if(i==="\\")s+=1;else if(i==='"'||i==="'")r=i;else if(i==="[")n+=1;else if(i==="]")n=Math.max(0,n-1);else if(i==="&"&&n===0)t.push(s)}return t}function ka(e,t){return Qc(e).length>0?iA(e,t):null}function iA(e,t){let r="",n=0;for(let s of Qc(e))r+=e.slice(n,s)+t,n=s+1;return r+e.slice(n)}function Xi(e){let t=[],r=0,n=null,s=0;for(let o=0;o<e.length;o+=1){let a=e[o];if(n){if(a==="\\")o+=1;else if(a===n)n=null;continue}if(a==='"'||a==="'")n=a;else if(a==="("||a==="[")r+=1;else if(a===")"||a==="]")r=Math.max(0,r-1);else if(a===","&&r===0)t.push(e.slice(s,o)),s=o+1}t.push(e.slice(s));let i=t.flatMap((o)=>{let a=o.trim();return a===""?[]:[a]});return i.length>0?i:[e]}function Sr(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function eu(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${wr}]))`,forced:`${e}:where([${wr}="${t}"])`};return{auto:`:where(:root:not([${wr}])) ${e}`,forced:`:where(:root[${wr}="${t}"]) ${e}`}}function Cn(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function tu(e){return e.startsWith("--")?e:Bt(e)}function ja(e){let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Oh(e,t,r){let n=r.map(([i,o])=>`${i}: ${o}`).join("; "),s=t===null?n:`${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function oA(e,t,r){let n=r.map(({selector:i,declarations:o})=>`${i} { ${o.map(([a,l])=>`${a}: ${l}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${n} }`;for(let i=e.length-1;i>=0;i-=1)s=`${e[i]} { ${s} }`;return s}function aA(e){let t=Object.keys(e).filter((n)=>Zi(n));if(t.length===0)return e;let r={...e};for(let n of t)delete r[n];return r}function lA(e){let r=Qc(e).at(-1),n=r===void 0?e:e.slice(r+1);return n===""||n.startsWith(":")||n.startsWith(".")||n.startsWith("[")}function Hs(e,t={}){let{scope:r=null,mediaQueries:n={},transposeValue:s=(y)=>y,transposeSelector:i=(y)=>y,resolveValue:o}=t,a=[],l=(y)=>y!==null&&typeof y==="object"&&!Array.isArray(y)&&!Ce(y),c=(y,v)=>{if(l(v))return[v];if(!Yi(y)||!Array.isArray(v)||v.length===0)return[];return v.every((j)=>l(j))?v:[]},u=(y,v,j,S)=>{if(v===void 0||v===null)return null;if(Ce(v))return j?o?.(y,v,S)??null:null;if(F(v))return null;let _=String(v);if(pe(_))return j?o?.(y,_,S)??null:null;return s(_)},p=(y,v,j=!0,S="self")=>{let _=[];for(let[E,O]of Object.entries(y)){if(c(E,O).length>0)continue;if(v&&(E.startsWith("@")||Cn(E)))continue;if(E.startsWith("$"))continue;let R=u(E,O,j,S);if(R!==null)_.push([tu(E),R])}return _},g=(y,v,j,S,_)=>{if(j.length===0)return;let E=v;if(E!==null){let k=i(E);if(k===null)return;E=k}let O=Oh(y,E,j),R={text:O,conditions:[...y],selector:E,declarations:j,target:S,key:ja(O)};if(N(_)&&_!=="")R.description=_;a.push(R)},m=(y,v,j)=>{let S=y.slice(10).trim();if(S==="")return;let _=[];for(let[O,R]of Object.entries(v)){if(!l(R))continue;let k=p(R,!0,!1,"unscoped");if(k.length>0)_.push({declarations:k,selector:O.trim()})}if(_.length===0)return;let E=oA(j,S,_);a.push({blocks:_,conditions:[...j],declarations:[],key:ja(E),selector:null,target:"unscoped",text:E})},b=(y,v,j,S,_)=>{if(y==="@--")return;if(Yi(y)){g([...S,y],null,p(v,!1,!0,"unscoped"),"unscoped",v.$description);return}if(Zi(y)){m(y,v,S);return}let E=Rh(y,n),O=E===null?y:`@media ${E}`,R=E===null?null:Sr(E);if(R!==null&&j!==null){let{auto:k,forced:I}=eu(j,R);h(v,k,[...S,O],_),h(aA(v),I,S,_);return}h(v,j,[...S,O],_)};function h(y,v,j,S){g(j,v,p(y,!0,!0,S),S,y.$description);for(let[_,E]of Object.entries(y))for(let O of c(_,E))if(_.startsWith("@"))b(_,O,v,j,S);else if(v!==null)h(O,Ah(v,_),j,lA(_)?S:"descendant")}return h(e,r,[],"self"),a}var nA,wr="data-color-scheme",Ra="jx-color-scheme";var Qi=q(()=>{$e();nA=new Set(["all","print","screen","speech"])});function Nh(){return`the Intl helpers ${nu.join(", ")}`}var Ir="en-US",ru="UTC",Ch,nu,Th;var su=q(()=>{Ch=[{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."}],nu=Ch.map((e)=>e.path),Th=Object.fromEntries(Ch.map((e)=>[e.path,e.params.indexOf("locale")]))});function cA(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function dt(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function cn(e){if(e==="")return[];return e.split("/").map((t)=>cA(t))}function mt(e,t){let r=e;for(let n of cn(t))r=r?.[n];return r}function Pe(e,t){let r=e;for(let n of cn(t))r+=iu.test(n)?`.${n}`:`[${JSON.stringify(n)}]`;return r}function Ih(e,t){let r=e;for(let[n,s]of cn(t).entries()){let i=n===0?"":"?.";r+=iu.test(s)?`${n===0?".":i}${s}`:`${i}[${JSON.stringify(s)}]`}return r}function un(e){return iu.test(e)?e:JSON.stringify(e)}function Mh(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var iu;var Vs=q(()=>{iu=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function ou(e){let t=e.$map;return F(t)?t:void 0}function Fh(e){return F(e)&&!Array.isArray(e)&&"operator"in e}function eo(e){return F(e)&&!Array.isArray(e)&&"$ref"in e}function pA(e,t,r){let n=Th[e];if(n===void 0||n<0||t[n]!=null)return t;let s=mt(r.$page,"locale");if(!N(s)||s==="")return t;let i=[...t];return i[n]=s,i}function Bh(e){return e.startsWith("window#/")&&dA.has(e.slice(8))}function dn(e){return qh.has(e)}function Ke(e,t){if(!e)return;let r=(e.depth??0)+1;if(r>mA)return;return{depth:r,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Fe(e,t,r,n,s){if(e===null||e===void 0)return e;if(Fh(e))return or(e,t,r,n,s);if(eo(e)){let i=Aa(e.$ref,t,r,n);return s?.report(s.path??[],i),i}if(Array.isArray(e))return Wh(e,t,r,n,s);return s?.report(s.path??[],e),e}function Wh(e,t,r,n,s){return e.map((i,o)=>Fe(i,t,r,n,Ke(s,o)))}function hA(e,t,r,n){let s=(i)=>{if(!e.slice(i.length).includes("/"))return t;return Aa(e.slice(0,e.lastIndexOf("/")),t,r,n)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?Aa(e.slice(0,e.lastIndexOf("/")),t,r,n):void 0;return}function Aa(e,t,r,n){if(e==="$reduce/acc")return n?.acc;if(e.startsWith("$reduce/"))return n?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),i=n?.args?.[s[0]];return s.length>1?mt(i,s.slice(1).join("/")):i}if(e.startsWith("event#/")){let s=e.slice(7);return mt(r,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=ou(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];return s.length>2?mt(o,s.slice(2).join("/")):o}if(e.startsWith("#/state/"))return mt(t,e.slice(8));if(e.startsWith("parent#/"))return mt(t,e.slice(8));if(e.startsWith("window#/"))return mt(globalThis.window,e.slice(8));if(e.startsWith("document#/"))return mt(globalThis.document,e.slice(10));return mt(t,e)??null}function gA(e,t,r,n){if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s,o,a=ou(t);if(i==="item")o=n?.item??a?.item??t["$map/item"];else if(i==="index")o=n?.index??a?.index??t["$map/index"];else o=a?.[i]??t[`$map/${i}`];if(s.length>2){let l=s.slice(2),c=l.pop(),u=l.length>0?mt(o,l.join("/")):o;return{key:c,obj:u}}return{key:i==="item"?"$map/item":"$map/index",obj:ou(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let o=cn(s),a=o.pop(),l=t;for(let c of o)l=l[c];return{key:a,obj:l}}return{key:e,obj:t}}function or(e,t,r,n,s){let i=yA(e,t,r,n,s);return s?.report(s.path??[],i),i}function Dh(e,t,r){switch(e){case"+":return t+r;case"-":return t-r;case"*":return t*r;case"/":return t/r;case"%":return t%r;case"<":return t<r;case"<=":return t<=r;case">":return t>r;default:return t>=r}}function yA(e,t,r,n,s){let{operator:i,target:o,value:a,initial:l}=e;if(!uA.has(i))throw Error(`$expression: unknown operator "${i}"`);if(au.has(i)&&!("value"in e)){let c=Fe(o,t,r,n,Ke(s,"target"));if(i==="!")return!c;if(i==="-")return-c}if(i==="call"){let c=eo(o)?o.$ref:void 0;if(!N(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(n?.callDepth??0)+1;if(u>Jh)throw Error(`$expression: call depth exceeded (${Jh})`);let p=Array.isArray(a)?a.map((m,b)=>Fe(m,t,r,n,Ke(s,["value",b]))):[];if(c.startsWith("window#/")){if(!Bh(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let m=c.slice(8),b=fA.get(m);if(b)return b(...pA(m,p,t));let h=mt(globalThis.window,m),y=m.lastIndexOf("/"),v=y===-1?globalThis.window:mt(globalThis.window,m.slice(0,y));return h.apply(v,p)}let g=Aa(c,t,r,n);if(vt(g))return g.apply(hA(c,t,r,n),p);if(F(g)&&"$expression"in g){let m=g,b={};for(let[h,y]of(m.parameters??[]).entries()){let v=N(y)?y:y?.name??"";if(!v)continue;b[v]=p[h]===void 0&&F(y)&&"default"in y?y.default:p[h]}return or(m.$expression,t,r,{args:b,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(uu.has(i)){if(i==="?:"){let m=Fe(o,t,r,n,Ke(s,"target"));if(s){let b=Fe(a,t,r,n,Ke(s,"value")),h=Fe(l,t,r,n,Ke(s,"initial"));return m?b:h}return m?Fe(a,t,r,n):Fe(l,t,r,n)}let c=Fe(o,t,r,n,Ke(s,"target")),u=String(c),p=e.cases??{},g=Object.hasOwn(p,u);if(s){let m;for(let[h,y]of Object.entries(p)){let v=Fe(y,t,r,n,Ke(s,["cases",h]));if(h===u)m=v}let b=Fe(e.default,t,r,n,Ke(s,"default"));return g?m:b}return g?Fe(p[u],t,r,n):Fe(e.default,t,r,n)}if(lu.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),u=Fe(a,t,r,n,Ke(s,"value"));switch(i){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return Dh(i,c,u)}}if(Hh.has(i)){let c=Fe(a,t,r,n,Ke(s,"value")),{obj:u,key:p}=gA(o.$ref,t,r,n);u[p]=i==="="?c:Dh(i.slice(0,-1),u[p],c);return}if(Vh.has(i)){let c=Fe(o,t,r,n,Ke(s,"target"));switch(i){case"push":return c.push(Fe(a,t,r,n,Ke(s,"value")));case"unshift":return c.unshift(Fe(a,t,r,n,Ke(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=Fe(a,t,r,n,Ke(s,"value"));return c.splice(...u)}default:break}}if(du.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),u=a===void 0?[]:Array.isArray(a)?Wh(a,t,r,n,Ke(s,"value")):[Fe(a,t,r,n,Ke(s,"value"))],p=mt(c,i);if(!vt(p))return;return p.apply(c,u)}if(cu.has(i)){let c=Fe(o,t,r,n,Ke(s,"target")),u=a;if(i==="reduce"){let p=Fe(l,t,r,n,Ke(s,"initial"));for(let[g,m]of c.entries())p=or(u,t,r,{acc:p,index:g,item:m},g===0?Ke(s,"value"):void 0);return p}if(i==="map")return c.map((p,g)=>or(u,t,r,{...n,index:g,item:p},g===0?Ke(s,"value"):void 0));if(i==="filter")return c.filter((p,g)=>or(u,t,r,{...n,index:g,item:p},g===0?Ke(s,"value"):void 0))}return}function Ze(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Fh(e))return At(e,t);if(eo(e))return fu(e.$ref,t);if(Array.isArray(e))return e.map((r)=>Ze(r,t)).join(", ");return JSON.stringify(e)}function bA(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function fu(e,t){let r=t.statePrefix??"state",n=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return Pe("_args",e.slice(6));if(e.startsWith("event#/"))return Pe(n,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,i]=s;if(i==="item")return s.length>2?Pe("_item",s.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(e.startsWith("#/state/"))return Pe(r,e.slice(8));if(e.startsWith("parent#/"))return Pe(r,e.slice(8));if(e.startsWith("window#/"))return Pe("window",e.slice(8));if(e.startsWith("document#/"))return Pe("document",e.slice(10));return Pe(r,e)}function Lh(e,t){if(eo(e))return fu(e.$ref,t);return Ze(e,t)}function xA(e,t,r){let n=(o)=>t[o]??"undefined",s=`(${r.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(Ir)})`,i=JSON.stringify(ru);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${n(1)} ?? ${s}, {timeZone: ${i}, ...${n(2)}}).format(new Date(${n(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${n(2)} ?? ${s}, ${n(3)}).format(${n(0)}, ${n(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${n(1)} ?? ${s}, ${n(2)}).format(${n(0)})`;case"Intl/plural":return`new Intl.PluralRules(${n(1)} ?? ${s}, ${n(2)}).select(${n(0)})`;case"Intl/compare":return`new Intl.Collator(${n(2)} ?? ${s}, ${n(3)}).compare(${n(0)}, ${n(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${n(2)} ?? ${s}, {...${n(3)}, type: ${n(1)} ?? 'language'}).of(${n(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${n(2)} ?? ${s}, {granularity: ${n(1)} ?? 'grapheme'}).segment(${n(0)})].map((p) => p.segment)`;default:return null}}function At(e,t={}){let{operator:r,target:n,value:s,initial:i}=e;if(au.has(r)&&!("value"in e)){let o=Ze(n,t);if(r==="!")return`!(${o})`;if(r==="-")return`-(${o})`}if(r==="call"){let o=(eo(n)?n.$ref:void 0)??"",a=Array.isArray(s)?s.map((l)=>Ze(l,t)):[];if(o.startsWith("window#/")){if(!Bh(o))throw Error(`$expression: "${o}" is not a blessed pure global`);let l=xA(o.slice(8),a,t);if(l)return l;return`window.${o.slice(8).replaceAll("/",".")}(${a.join(", ")})`}if(o.startsWith("#/state/")){let l=o.slice(8),c=t.formulaParams?.[l];if(c){let u=c.map((p,g)=>`${JSON.stringify(p)}: ${a[g]??"undefined"}`).join(", ");return`${bA(l)}(${t.statePrefix??"state"}, { ${u} })`}}return`${fu(o,t)}(${a.join(", ")})`}if(uu.has(r)){if(r==="?:"){let c=Ze(n,t),u=Ze(s,t),p=Ze(i,t);return`(${c} ? ${u} : ${p})`}let o=Ze(n,t),a=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${Ze(u,t)} : `).join(""),l="default"in e?Ze(e.default,t):"undefined";return`((_d) => ${a}${l})(String(${o}))`}if(lu.has(r)){let o=Ze(n,t),a=Ze(s,t);return`(${o} ${r} ${a})`}if(Hh.has(r)){let o=Lh(n,t),a=Ze(s,t);return`${o} ${r} ${a}`}if(Vh.has(r)){let o=Lh(n,t);switch(r){case"push":return`${o}.push(${Ze(s,t)})`;case"unshift":return`${o}.unshift(${Ze(s,t)})`;case"pop":return`${o}.pop()`;case"shift":return`${o}.shift()`;case"splice":{let a=Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`${o}.splice(${a})`}default:break}}if(du.has(r)){let o=Ze(n,t),a=s===void 0?"":Array.isArray(s)?s.map((l)=>Ze(l,t)).join(", "):Ze(s,t);return`(${o})?.${r}?.(${a})`}if(cu.has(r)){let o=Ze(n,t),a=At(s,t);if(r==="reduce"){let l=Ze(i,t);return`${o}.reduce((_acc, _item, _index) => ${a}, ${l})`}if(r==="map")return`${o}.map((_item, _index) => ${a})`;if(r==="filter")return`${o}.filter((_item, _index) => ${a})`}return"undefined"}function Bs(e,t,r,n){return Fe(e,t,r,n)}function fn(e,t={}){return Ze(e,t)}var qh,au,lu,Hh,Vh,cu,uu,du,uA,dA,fA,Jh=64,mA=64;var to=q(()=>{su();$e();Vs();qh=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),au=new Set(["!","-"]),lu=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),Hh=new Set(["=","+=","-=","*=","/="]),Vh=new Set(["push","pop","shift","unshift","splice"]),cu=new Set(["reduce","map","filter"]),uu=new Set(["?:","switch"]),du=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"]),uA=new Set([...qh,...au,...lu,...cu,...uu,...du,"call"]),dA=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",...nu]),fA=new Map([["Intl/compare",(e,t,r,n)=>new Intl.Collator(r??Ir,n).compare(e,t)],["Intl/displayName",(e,t,r,n)=>new Intl.DisplayNames(r??Ir,{...n,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,r)=>new Intl.DateTimeFormat(t??Ir,{timeZone:ru,...r}).format(new Date(e))],["Intl/formatList",(e,t,r)=>new Intl.ListFormat(t??Ir,r).format(e)],["Intl/formatNumber",(e,t,r)=>new Intl.NumberFormat(t??Ir,r).format(e)],["Intl/formatRelativeTime",(e,t,r,n)=>new Intl.RelativeTimeFormat(r??Ir,n).format(e,t)],["Intl/plural",(e,t,r)=>new Intl.PluralRules(t??Ir,r).select(e)],["Intl/segment",(e,t,r)=>[...new Intl.Segmenter(r??Ir,{granularity:t??"grapheme"}).segment(e)].map((n)=>n.segment)]])});function Uh(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 $A(e){return(F(e)||vt(e))&&"then"in e&&vt(e.then)}async function Ws(e,t,r,n={}){let s=n.args?{args:n.args}:void 0;for(let i of e){let o=Uh(i);switch(o.kind){case"expression":{let a=or(o.node,t,r,s);if($A(a))await a;break}case"if":{let a=o.node,l=Bs(a.if,t,r,s)?a.then:a.else;if(Array.isArray(l))await Ws(l,t,r,n);break}case"switch":{let a=o.node,l=String(Bs(a.$switch,t,r,s)),c=a.cases??{},u=Object.hasOwn(c,l)?c[l]:a.default;if(Array.isArray(u))await Ws(u,t,r,n);break}case"dispatch":{let a=o.node,l=vt(n.target)?n.target():n.target,c=r?.currentTarget??l;if(!c)break;let u={};if("detail"in a)u.detail=Bs(a.detail,t,r,s);if(a.bubbles!==void 0)u.bubbles=a.bubbles;if(a.composed!==void 0)u.composed=a.composed;c.dispatchEvent(new CustomEvent(a.dispatchEvent,u));break}case"stopPropagation":{r?.stopPropagation();break}case"preventDefault":{r?.preventDefault();break}default:break}}}function fr(e,t={}){let r=t.indent??"",n=[];for(let s of e){let i=Uh(s);switch(i.kind){case"expression":{n.push(`${r}${At(i.node,t)};`);break}case"if":{let o=i.node,a=fn(o.if,t),l={...t,indent:`${r} `};if(n.push(`${r}if (${a}) {`,fr(o.then??[],l)),o.else)n.push(`${r}} else {`,fr(o.else,l));n.push(`${r}}`);break}case"switch":{let o=i.node,a=fn(o.$switch,t),l={...t,indent:`${r} `};n.push(`${r}switch (String(${a})) {`);for(let[c,u]of Object.entries(o.cases??{}))n.push(`${r} case ${JSON.stringify(c)}: {`,fr(u,l),`${r} break;`,`${r} }`);if(o.default)n.push(`${r} default: {`,fr(o.default,l),`${r} }`);n.push(`${r}}`);break}case"dispatch":{let o=i.node,a=t.eventParam??"event",l=t.dispatchTarget??`(${a} && ${a}.currentTarget)`,c=[];if("detail"in o)c.push(`detail: ${fn(o.detail,t)}`);if(o.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(o.bubbles)}`);if(o.composed!==void 0)c.push(`composed: ${JSON.stringify(o.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";n.push(`${r}${l}?.dispatchEvent(new CustomEvent(${JSON.stringify(o.dispatchEvent)}${u}));`);break}case"stopPropagation":{n.push(`${r}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{n.push(`${r}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return n.join(`
73
+ `)}var Oa=q(()=>{$e();to()});function Us(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let t=0;for(let r=1;r<e.length;r+=1){let n=e[r];if(n==="{")t+=1;else if(n==="}"){if(t-=1,t===0)return r===e.length-1}}return!1}function Gh(){return[...zh].toSorted()}function ys(e,t){let r=e.toLowerCase();if(r.startsWith("aria-")||zh.has(r))return String(t);return t?"":null}var pn,zh,pu=32,Ca,Ta="jx-slot",ro="data-jx-slots",mu="jx.slot.group",h8;var zs=q(()=>{Qi();to();Vs();$e();sr();Oa();Qi();pn=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),zh=new Set(["contenteditable","draggable","spellcheck"]);Ca=/^[\t\n\f\r ]+$/u,h8=(()=>{let e=Symbol.for(mu),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function Kh(e,t,r,n,s=wA){let i=[],o=(p,g)=>{let m={mediaQueries:t,scope:g,transposeValue:r};if(n)m.resolveValue=(b,h)=>n(b,h,g);for(let b of Hs(p,m))i.push(b.text)},a={},l={},c=[],u=[];for(let[p,g]of Object.entries(e)){if(F(g)&&!Array.isArray(g)){if(p.startsWith("@"))c.push([p,g]);else if(!p.startsWith("--"))u.push([p,g]);continue}if(Cn(p)||p.startsWith("@"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")a[p]=g;else l[p]=g}o(a,s.root),o(l,s.body);for(let[p,g]of u)if(p.startsWith("&"))o({[p]:g},s.root);else o(g,p);for(let[p,g]of c){if(Yi(p)||Zi(p)){o({[p]:g},null);continue}let m={},b={},h=[];for(let[y,v]of Object.entries(g)){if(F(v)&&!Array.isArray(v)){if(!y.startsWith("@"))h.push([y,v]);continue}if(y.startsWith("--"))m[y]=v;else b[y]=v}o({[p]:m},s.root),o({[p]:b},s.body);for(let[y,v]of h)o({[p]:v},y)}if(Object.values(t).some((p)=>Sr(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${wr}="light"]) { color-scheme: light }`,`${s.root}:where([${wr}="dark"]) { color-scheme: dark }`);return i.join(`
74
+ `)}var wA;var Yh=q(()=>{Qi();$e();wA={body:"body",root:":root"}});function Xh(e){return e===!1||e==="open"||e==="closed"}function bs(e,t){let r=e?.$shadow;if(Xh(r))return r===!1?null:r;let n=t?.shadow;return Xh(n)&&n!==!1?n:null}function Zh(e,t){return t===null?e:":host"}function so(e,t){let r=[];for(let[n,s]of(e.parameters??[]).entries()){let i=Qh(s);if(!i)continue;let o=eg(s)?`_a[${n}] === undefined ? ${JSON.stringify(s.default)} : _a[${n}]`:`_a[${n}]`;r.push(`${JSON.stringify(i)}: ${o}`)}return`(..._a) => { const _args = { ${r.join(", ")} }; return ${t}; }`}function Qh(e){return N(e)?e:e?.name??""}function eg(e){return F(e)&&"default"in e}function Ma(e,t){let r=xu(e,t);return r===e?e:`${r} as ${e}`}function xu(e,t){let r=t?.$export;return N(r)&&r!==""?r:e}function Ja(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i}=r,{url:o}=t,a=pe(o),l=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let c=[`// ${e}: auto-fetch from ${a?"(dynamic URL)":o}`,i?`${i}.push(effect(() => {`:"effect(() => {"];if(a)c.push(` const url = \`${EA(o,n)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else c.push(` const url = ${JSON.stringify(o)};`);let u=[];if(l!=="GET")u.push(`method: ${JSON.stringify(l)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let g=F(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${g}`)}let p=u.length>0?`, { ${u.join(", ")} }`:"";return c.push(` fetch(url${p})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${n}.${e} = d; })`,` .catch(e => { ${n}.${e} = { error: String(e) }; });`,i?"}));":"});"),c.map((g)=>`${s}${g}`).join(`
75
+ `)}function Da(e,t,r={}){let{statePrefix:n="state",indent:s="",collect:i,serverBaseUrl:o="/_jx/server"}=r,a=JSON.stringify(`${o}/${t.$export}`),l=Object.entries(t.arguments??{}),c=l.map(([h,y])=>{if(!Ce(y))return`${un(h)}: ${JSON.stringify(y)}`;if(SA.some((v)=>y.$ref.startsWith(v)))throw Error(`Server function "${e}": argument "${h}" references "${y.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${un(h)}: ${fn({$ref:y.$ref},{statePrefix:n})}`}),u=l.some(([,h])=>Ce(h)),p=`${ag}(${a}, ${c.length>0?`{ ${c.join(", ")} }`:"{}"})`,g=Pe(n,dt(e)),m=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(u?[`// ${e}: server function ${t.$export}, called again when an argument changes`,"{"," let _jxSeq = 0;",i?` ${i}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${p}`,` .then((d) => { if (_seq === _jxSeq) ${g} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${m}; });`,i?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,p,` .then((d) => { ${g} = d; })`,` .catch((e) => { ${m}; });`]).map((h)=>`${s}${h}`).join(`
76
+ `)}function EA(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(r,n)=>`\${${n.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function La(e){if(!F(e))return!1;if(e.state)for(let[t,r]of Object.entries(e.state)){if(t==="$site"||t==="$page")continue;if(!F(r)||Array.isArray(r))return!0;if(r.timing==="compiler")continue;if(r.$prototype)return!0;if("default"in r)return!0;if(Pn(r))continue;return!0}if(e.$switch)return!0;if(Qe(e)||kc(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((t)=>La(t)))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function rg(e){if(!F(e))return!1;if(e.$switch)return!0;if(Qe(e)||kc(e.children))return!0;for(let[t,r]of Object.entries(e)){if(pn.has(t))continue;if(Ce(r))return!0;if(pe(r))return!0}if(F(e.style)){for(let t of Object.values(e.style))if(pe(t))return!0}if(F(e.attributes)){for(let t of Object.values(e.attributes))if(pe(t))return!0}return!1}function Zs(e,t=null,r={},n={}){let s=e?.state?Gs(e.state,t):t??ng();return{media:n,scope:s,scopeDefs:r}}function ng(e=null){return Object.create(e)}function sg(e){return e[tg]}function yu(e,t){if(N(e)){for(let i of e.matchAll(_A))t.add(i[1]);for(let i of e.matchAll(PA))t.add(i[1]);return}if(Array.isArray(e)){for(let i of e)yu(i,t);return}if(!F(e))return;let r=e,{operator:n,target:s}=r;if(N(n)&&dn(n)&&Ce(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let i of Object.values(r))yu(i,t)}function Gs(e={},t=null){let r=ng(t),n=t?sg(t):void 0,s=new Set(n);Object.defineProperty(r,tg,{configurable:!0,enumerable:!1,value:s,writable:!0});let i=new Set;for(let c of Object.values(e))if(tr(c)||rr(c))yu(c.body??c.$expression,i);for(let c of i)if(c in e)s.add(c);for(let[c,u]of Object.entries(e)){if(!F(u)||Array.isArray(u)){mn(r,c,Na(u));continue}if("default"in u){mn(r,c,Na(u.default));continue}if(tn(u)){s.add(c);continue}if(!u.$prototype&&!("$expression"in u)&&!Pn(u))mn(r,c,Na(u))}let o=[],a=[];for(let[c,u]of Object.entries(e)){if(pe(u)){o.push([c,u]);continue}if(!F(u))continue;if(rr(u)){let p=u.$expression;if(ns(u)){let g=u.parameters;mn(r,c,(...m)=>{let b={};for(let[h,y]of g.entries()){let v=Qh(y);if(!v)continue;b[v]=m[h]===void 0&&eg(y)?y.default:m[h]}return or(p,r,null,{args:b})})}else if(dn(p.operator))mn(r,c,(g,m)=>or(p,g,m));else hu(r,c,()=>or(p,r,null));continue}if(tr(u)){if(_n(u)){let{body:p}=u;mn(r,c,(g,m)=>{Ws(p,g??r,m??null)})}else if(N(u.body)){let p=u.parameters?rn(u.parameters):u.arguments??[],{body:g}=u,m=p.includes("state")?p:["state",...p],b=Function(...m,g),h=(y,v)=>b(...m.map((j)=>j==="state"?y:v));if(ss(g))hu(r,c,()=>h(r)),a.push([c,g]);else mn(r,c,h)}else mn(r,c,()=>{}),s.add(c);continue}if(Tr(u)&&(u.$prototype==="LocalStorage"||u.$prototype==="SessionStorage")){mn(r,c,Na(u.default??null));continue}if(Tr(u)&&u.$prototype==="Request")s.add(c)}let l=!0;while(l){l=!1;for(let[c,u]of[...a,...o])if(!s.has(c)&&ig(u,r))s.add(c),l=!0}for(let[c,u]of o)hu(r,c,()=>wt(u,r));return r}function mn(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0})}function hu(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:r})}function Me(e,t){if(Ce(e))return $u(e.$ref,t);if(pe(e))return wt(e,t);return e}function Wt(e){return Ce(e)}function $u(e,t){if(!N(e))return e;if(e.startsWith("$map/")){let r=e.split("/"),n=r[1],i=t.$map?.[n]??t[`$map/${n}`];return r.length>2?gu(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return gu(t,e.slice(8));return gu(t,e)??null}function ig(e,t){if(!t)return!1;let r=sg(t);for(let n of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(n[2])continue;let s=n[1];if(r?.has(s))return!0;let i;try{i=t[s]}catch{continue}if(vt(i))return!0}return!1}function Fa(e){return Us(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function wt(e,t){if(ig(e,t))return null;let r=["state","$map","$site","$page"],n=[t,t?.$map,t?.$site,t?.$page];try{let s=Us(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...r,s)(...n)}catch{return null}}function gu(e,t){return mt(e,t)}function Na(e){if(!F(e))return e;return structuredClone(e)}function jA(e,t){if(!e||!t)return"";return Object.entries(e).filter(([r,n])=>!r.startsWith(":")&&!r.startsWith(".")&&!r.startsWith("&")&&!r.startsWith("[")&&!r.startsWith("@")&&pe(n)).map(([r,n])=>{let s=Me(n,t);return s==null?null:`${Bt(r)}: ${s}`}).filter(Boolean).join("; ")}function xs(e,t,r=""){let n="",s=Me(e.id,t),i=Me(e.className,t),o=Me(e.hidden,t),a=Me(e.tabIndex,t),l=Me(e.title,t),c=Me(e.lang,t),u=Me(e.dir,t);if(s)n+=` id="${ve(String(s))}"`;if(i)n+=` class="${ve(String(i))}"`;if(o)n+=" hidden";if(a!==void 0&&a!==null)n+=` tabindex="${ve(String(a))}"`;if(l)n+=` title="${ve(String(l))}"`;if(c)n+=` lang="${ve(String(c))}"`;if(u)n+=` dir="${ve(String(u))}"`;let p=[jA(e.style,t),r].filter(Boolean).join("; ");if(p)n+=` style="${ve(p)}"`;if(e.attributes)for(let[g,m]of Object.entries(e.attributes)){let b=Me(m,t);if($t(b)){let h=ys(g,b);if(h!==null)n+=h===""?` ${g}`:` ${g}="${ve(h)}"`;continue}if(N(b)||Ft(b))n+=` ${g}="${ve(String(b))}"`}if(e.$static)n+=" data-jx-static";else if(e.$prerendered)n+=" data-jx-prerendered";return n}function io(e,t=" "){return e?"":`
77
+ ${t}`}function Qs(){let e=JSON.stringify(Ra),t=JSON.stringify(wr);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Ia(e,t,r,n){for(let s of Hs(t,{mediaQueries:n,resolveValue:(i,o)=>og(i,o,r),scope:r}))e.push(s.text)}function og(e,t,r){let n=N(t)?t:t.$ref;return kA.push({property:e,selector:r,source:n}),null}function qa(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Gh())});
78
+ function ${ei}(n, v) {
79
79
  if (typeof v !== 'boolean') return v;
80
80
  const l = n.toLowerCase();
81
81
  if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
82
82
  return v ? '' : null;
83
- }`}function qa(){return[`async function ${Yh}(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(`
84
- `)}function Xh(){let e=`new RegExp(${JSON.stringify(Oa.source)}, ${JSON.stringify(Oa.flags)})`,t=`Symbol.for(${JSON.stringify(uu)})`,r=JSON.stringify(to),n=JSON.stringify(Ca);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${yu}(host) {`,` const id = host.getAttribute(${r});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${r});`,` const open = ${n} + ' ' + id + ' ';`,` const close = '/' + ${n} + ' ' + id;`," const openers = [];"," const w = host.ownerDocument.createTreeWalker(host, 128);"," for (let n = w.nextNode(); n; n = w.nextNode()) if (n.data.startsWith(open)) openers.push(n);"," const out = [];"," for (const o of openers) {"," const name = decodeURIComponent(o.data.slice(open.length));"," for (let n = o.nextSibling; n; n = n.nextSibling) {"," if (n.nodeType === 8 && n.data === close) break;"," __jxSlotRec.set(n, name);"," out.push(n);"," }"," }"," return out;","}",`function ${bu}(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(`
85
- `)}function Nn(e){for(let t of xu(e)){if(Qe(t)){if(t.map&&Nn([t.map]))return!0;continue}if(!Ft(t))continue;if(t.tagName==="slot")return!0;let r=Object.values(t.cases??{}).filter((n)=>Ft(n)&&!Bt(n));if(Nn(r)||Nn(t.children))return!0}return!1}function xu(e){if(Qe(e))return[e];if(!Array.isArray(e))return[];return e}function ti(e,t={},r=null){let n=[],s=Dh(F(r)?r:{},t,(o)=>o,Kh);if(s!=="")n.push(s);if(Tn(e,n,t,"",{n:0}),n.length===0)return"";return`<style>
86
- ${Ha(n.join(`
83
+ }`}function Ha(){return[`async function ${ag}(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(`
84
+ `)}function lg(){let e=`new RegExp(${JSON.stringify(Ca.source)}, ${JSON.stringify(Ca.flags)})`,t=`Symbol.for(${JSON.stringify(mu)})`,r=JSON.stringify(ro),n=JSON.stringify(Ta);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${vu}(host) {`,` const id = host.getAttribute(${r});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${r});`,` const open = ${n} + ' ' + id + ' ';`,` const close = '/' + ${n} + ' ' + id;`," const openers = [];"," const w = host.ownerDocument.createTreeWalker(host, 128);"," for (let n = w.nextNode(); n; n = w.nextNode()) if (n.data.startsWith(open)) openers.push(n);"," const out = [];"," for (const o of openers) {"," const name = decodeURIComponent(o.data.slice(open.length));"," for (let n = o.nextSibling; n; n = n.nextSibling) {"," if (n.nodeType === 8 && n.data === close) break;"," __jxSlotRec.set(n, name);"," out.push(n);"," }"," }"," return out;","}",`function ${wu}(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(`
85
+ `)}function Tn(e){for(let t of Su(e)){if(Qe(t)){if(t.map&&Tn([t.map]))return!0;continue}if(!qt(t))continue;if(t.tagName==="slot")return!0;let r=Object.values(t.cases??{}).filter((n)=>qt(n)&&!Wt(n));if(Tn(r)||Tn(t.children))return!0}return!1}function Su(e){if(Qe(e))return[e];if(!Array.isArray(e))return[];return e}function ri(e,t={},r=null){let n=[],s=Kh(F(r)?r:{},t,(o)=>o,og);if(s!=="")n.push(s);if(Nn(e,n,t,"",{n:0}),n.length===0)return"";return`<style>
86
+ ${Va(n.join(`
87
87
  `))}
88
- </style>`}function Ha(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Tn(e,t,r,n="",s,i="jx"){let o=s??{n:0};if(!F(e))return;if(e.style&&!e.id&&!e.className)e.className=`${i}-${o.n}`,o.n+=1;let a=Ms(e.tagName).join(", ")||"*",l=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)Ta(t,e.style,l,r);if(Array.isArray(e.children))for(let c of e.children)Tn(c,t,r,l,o,i);if(F(e.cases))for(let c of Object.values(e.cases))Tn(c,t,r,l,o,i)}function $e(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Va(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Zh(e){let t=[];return Qh(e,t),t}function Qh(e,t){if(!F(e))return;if(e.state){for(let[r,n]of Object.entries(e.state))if(tn(n))t.push({exportName:n.$export,key:r,src:n.$src})}if(Array.isArray(e.children))for(let r of e.children)Qh(r,t)}function vu(e,t){if(T(e))return e;let r=Ms(e);if(r.length===0)return"div";if(!Nr(e))return r[0];let n=e.$expression,s=n.target;if(n.operator==="?:")return Me(s,t)?n.value:n.initial;let i=Me(s,t);return n.cases[String(i)]??n.default}function wu(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function Su(e,t,r,n=null){let s=new Map;for(let i of xu(e)){let o="",a=!0,l;if(T(i)||lr(i)||$t(i)){if(l=r(i),Oa.test(l))continue;a=l!==""}else if(Qe(i))l="";else if(!Ft(i))l=r(i),a=l!=="";else{let d=Me(i.attributes?.slot,t),p=T(i.slot)?Me(i.slot,t):null;if(T(d)&&d!=="")o=d,l=r(i);else if(T(p)&&p!==""){o=p;let{slot:h,...m}=i;l=r({...m,attributes:{...m.attributes,slot:p}})}else l=r(i)}let c=s.get(o);if(c)c.html=c.html===""?l:`${c.html}
89
- ${l}`,c.content||=a;else s.set(o,{content:a,html:l})}return{groups:s,id:n,taken:new Set}}function eg(e,t,r){for(let n of xu(e)){if(Qe(n)||!Ft(n))continue;if(n.tagName==="slot"){let s=Me(n.attributes?.name,t);r.taken.add(T(s)?s:"")}eg(n.children,t,r)}}function Eu(e){let t=null,r={};for(let[n,s]of Object.entries(e??{}))if(n.startsWith("props.")&&n.length>6)t??={},t[n.slice(6)]=s;else r[n]=s;return{lifted:t,rest:r}}function Ba(e,t){if(!t)return zs(e.state??{},null);let r={...e.state};for(let[n,s]of Object.entries(t)){let i=r[n];r[n]=F(i)&&!Array.isArray(i)&&"default"in i?{...i,default:s}:s}return zs(r,null)}function _u(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([r,n])=>{if(!pe(n))return[];let s=Me(n,t);return s==null?[]:[[r,s]]}))}function ro(e,t,r,n){if(e.textContent!==void 0){let s=Me(e.textContent,t);return s!=null?$e(String(s)):""}if(e.innerHTML){let s=Me(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>Gs(s,t,r,n)).join(`
90
- `);return""}function Gs(e,t,r=null,n=null){if(T(e)){if(pe(e)&&t){let a=wt(e,t);return a!=null?$e(String(a)):$e(e)}return $e(e)}if(lr(e)||$t(e))return $e(String(e));if(Array.isArray(e))return e.map((a)=>Gs(a,t,r,n)).join(`
91
- `);if(!F(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=bs(e,t),c=Me(e.$switch,t),d=c==null?void 0:e.cases?.[String(c)],p=d!==void 0&&!Bt(d)?Gs(d,t,r,n):"";return`<${a}${l}>${p}</${a}>`}let s=vu(e.tagName,t);if(s==="slot"&&r){let a=Me(e.attributes?.name,t),l=T(a)?a:"",c;if(!r.taken.has(l))r.taken.add(l),c=r.groups.get(l);let d=c?.html??"";if(d!==""&&r.id!==null)d=`<!--${Ca} ${r.id} ${encodeURIComponent(l)}-->${d}<!--/${Ca} ${r.id}-->`;if(c?.content)return eg(e.children,t,r),d;let p=ro(e,t,r,n);return d===""?p:p===""?d:`${d}
92
- ${p}`}let i=n?.componentDefs.get(s);if(i&&n)return yA(e,i,t,r,n);let o=bs(e,t);if($u.has(s))return`<${s}${o}>`;return`<${s}${o}>${ro(e,t,r,n)}</${s}>`}function yA(e,t,r,n,s){let i=t.tagName,{lifted:o,rest:a}=Eu(e.attributes),l={...o,...e.$props},c={};for(let[k,I]of Object.entries(l))c[k]=Me(I,r)??I;let d=Object.keys(c).length>0,p=s.path??[],h={key:JSON.stringify(c),tag:i},m=[...p.map((k)=>k.tag),i].join(" → ");if(p.some((k)=>k.tag===h.tag&&k.key===h.key))throw Error(`Component <${i}> renders itself: ${m}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(p.length>=cu)throw Error(`Component nesting exceeds ${cu} levels: ${m}. A component that renders itself with changing props needs a case that stops.`);let b={...s,path:[...p,h]},{children:g}=e,y=(k)=>Gs(k,r,n,s),v=ys(t,s.defaults),j=Wa(t),S=Ba(t,d?c:null),P,E=null;if(v){let k=Array.isArray(g)?g.map((I)=>y(I)).join(`
93
- `):"";P=`<template shadowrootmode="${v}"><link rel="stylesheet" href="/components/${i}.css">${ro(t,S,null,b)}</template>${k}`}else{E=!j&&Nn(t.children)?wu(s):null;let k=Su(g,r,y,E);P=ro(t,S,k,b)}let O=Object.entries(_u(t.style,S)).map(([k,I])=>`${Vt(k)}: ${I}`).join("; "),R={...e};if(delete R.$props,delete R.children,R.attributes=!j&&d?{...a,"data-jx-props":JSON.stringify(c)}:a,E!==null)R.attributes={...R.attributes,[to]:String(E)};if(j)R.$static=!0;else R.$prerendered=!0;return`<${i}${bs(R,r,O)}>${P}</${i}>`}function tg(e,t=null,r=null,n=null){return ro(e,Ba(e,t),r,n)}function Wa(e){return mu(e)}function mu(e){if(!F(e))return!0;if(Array.isArray(e))return e.every((t)=>mu(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!F(t)||Array.isArray(t))continue;if(t.$prototype)return!1;if(t.$ref)return!1}for(let t of Object.keys(e))if(t.startsWith("on")&&t!=="observedAttributes")return!1;if(Array.isArray(e.children))return e.children.every((t)=>mu(t));if(Qe(e.children))return!1;return!0}function xA(e,t){return Yi(e).map((r)=>$A(r,t)).join(", ")}function $A(e,t){let r=ja(e,t);if(r!==null)return r;if(e.startsWith(":host")){let n=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return n===void 0?t:`${t}${n}`}if(t===":host"&&bA.test(e))return e;return`${t}${e}`}function rg(e,t,r=null,n={},s=null){let i=[],o=qh(e,s);if(F(t)){let a={},l=[];for(let[c,d]of Object.entries(t))if(Ce(d))a[c]=d;else if(F(d)&&!Array.isArray(d))l.push([c,d]);else if(!c.startsWith("@")&&!Cn(c))a[c]=d;Ta(i,a,o,n);for(let[c,d]of l)if(c.startsWith("@"))Ta(i,{[c]:d},o,n);else if(Cn(c))Ta(i,d,xA(c,o),n)}if(r&&Array.isArray(r.children)){let a={n:0};for(let l of r.children)Tn(l,i,n,"",a,e)}return i.length>0?`${i.join(`
88
+ </style>`}function Va(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Nn(e,t,r,n="",s,i="jx"){let o=s??{n:0};if(!F(e))return;if(e.style&&!e.id&&!e.className)e.className=`${i}-${o.n}`,o.n+=1;let a=Js(e.tagName).join(", ")||"*",l=e.id?`#${e.id}`:e.className?`.${e.className.split(" ")[0]}`:a;if(e.style)Ia(t,e.style,l,r);if(Array.isArray(e.children))for(let c of e.children)Nn(c,t,r,l,o,i);if(F(e.cases))for(let c of Object.values(e.cases))Nn(c,t,r,l,o,i)}function ve(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Ba(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function cg(e){let t=[];return ug(e,t),t}function ug(e,t){if(!F(e))return;if(e.state){for(let[r,n]of Object.entries(e.state))if(tn(n))t.push({exportName:n.$export,key:r,src:n.$src})}if(Array.isArray(e.children))for(let r of e.children)ug(r,t)}function _u(e,t){if(N(e))return e;let r=Js(e);if(r.length===0)return"div";if(!Nr(e))return r[0];let n=e.$expression,s=n.target;if(n.operator==="?:")return Me(s,t)?n.value:n.initial;let i=Me(s,t);return n.cases[String(i)]??n.default}function Pu(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function ju(e,t,r,n=null){let s=new Map;for(let i of Su(e)){let o="",a=!0,l;if(N(i)||Ft(i)||$t(i)){if(l=r(i),Ca.test(l))continue;a=l!==""}else if(Qe(i))l="";else if(!qt(i))l=r(i),a=l!=="";else{let u=Me(i.attributes?.slot,t),p=N(i.slot)?Me(i.slot,t):null;if(N(u)&&u!=="")o=u,l=r(i);else if(N(p)&&p!==""){o=p;let{slot:g,...m}=i;l=r({...m,attributes:{...m.attributes,slot:p}})}else l=r(i)}let c=s.get(o);if(c)c.html=c.html===""?l:`${c.html}
89
+ ${l}`,c.content||=a;else s.set(o,{content:a,html:l})}return{groups:s,id:n,taken:new Set}}function dg(e,t,r){for(let n of Su(e)){if(Qe(n)||!qt(n))continue;if(n.tagName==="slot"){let s=Me(n.attributes?.name,t);r.taken.add(N(s)?s:"")}dg(n.children,t,r)}}function ku(e){let t=null,r={};for(let[n,s]of Object.entries(e??{}))if(n.startsWith("props.")&&n.length>6)t??={},t[n.slice(6)]=s;else r[n]=s;return{lifted:t,rest:r}}function Wa(e,t){if(!t)return Gs(e.state??{},null);let r={...e.state};for(let[n,s]of Object.entries(t)){let i=r[n];r[n]=F(i)&&!Array.isArray(i)&&"default"in i?{...i,default:s}:s}return Gs(r,null)}function Ru(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([r,n])=>{if(!pe(n))return[];let s=Me(n,t);return s==null?[]:[[r,s]]}))}function no(e,t,r,n){if(e.textContent!==void 0){let s=Me(e.textContent,t);return s!=null?ve(String(s)):""}if(e.innerHTML){let s=Me(e.innerHTML,t);return s!=null?String(s):e.innerHTML}if(Array.isArray(e.children))return e.children.map((s)=>Ks(s,t,r,n)).join(`
90
+ `);return""}function Ks(e,t,r=null,n=null){if(N(e)){if(pe(e)&&t){let a=wt(e,t);return a!=null?ve(String(a)):ve(e)}return ve(e)}if(Ft(e)||$t(e))return ve(String(e));if(Array.isArray(e))return e.map((a)=>Ks(a,t,r,n)).join(`
91
+ `);if(!F(e))return"";if(e.$prototype==="Array")return"";if(e.$switch){let a=e.tagName??"div",l=xs(e,t),c=Me(e.$switch,t),u=c==null?void 0:e.cases?.[String(c)],p=u!==void 0&&!Wt(u)?Ks(u,t,r,n):"";return`<${a}${l}>${p}</${a}>`}let s=_u(e.tagName,t);if(s==="slot"&&r){let a=Me(e.attributes?.name,t),l=N(a)?a:"",c;if(!r.taken.has(l))r.taken.add(l),c=r.groups.get(l);let u=c?.html??"";if(u!==""&&r.id!==null)u=`<!--${Ta} ${r.id} ${encodeURIComponent(l)}-->${u}<!--/${Ta} ${r.id}-->`;if(c?.content)return dg(e.children,t,r),u;let p=no(e,t,r,n);return u===""?p:p===""?u:`${u}
92
+ ${p}`}let i=n?.componentDefs.get(s);if(i&&n)return RA(e,i,t,r,n);let o=xs(e,t);if(Eu.has(s))return`<${s}${o}>`;return`<${s}${o}>${no(e,t,r,n)}</${s}>`}function RA(e,t,r,n,s){let i=t.tagName,{lifted:o,rest:a}=ku(e.attributes),l={...o,...e.$props},c={};for(let[k,I]of Object.entries(l))c[k]=Me(I,r)??I;let u=Object.keys(c).length>0,p=s.path??[],g={key:JSON.stringify(c),tag:i},m=[...p.map((k)=>k.tag),i].join(" → ");if(p.some((k)=>k.tag===g.tag&&k.key===g.key))throw Error(`Component <${i}> renders itself: ${m}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(p.length>=pu)throw Error(`Component nesting exceeds ${pu} levels: ${m}. A component that renders itself with changing props needs a case that stops.`);let b={...s,path:[...p,g]},{children:h}=e,y=(k)=>Ks(k,r,n,s),v=bs(t,s.defaults),j=Ua(t),S=Wa(t,u?c:null),_,E=null;if(v){let k=Array.isArray(h)?h.map((I)=>y(I)).join(`
93
+ `):"";_=`<template shadowrootmode="${v}"><link rel="stylesheet" href="/components/${i}.css">${no(t,S,null,b)}</template>${k}`}else{E=!j&&Tn(t.children)?Pu(s):null;let k=ju(h,r,y,E);_=no(t,S,k,b)}let O=Object.entries(Ru(t.style,S)).map(([k,I])=>`${Bt(k)}: ${I}`).join("; "),R={...e};if(delete R.$props,delete R.children,R.attributes=!j&&u?{...a,"data-jx-props":JSON.stringify(c)}:a,E!==null)R.attributes={...R.attributes,[ro]:String(E)};if(j)R.$static=!0;else R.$prerendered=!0;return`<${i}${xs(R,r,O)}>${_}</${i}>`}function fg(e,t=null,r=null,n=null){return no(e,Wa(e,t),r,n)}function Ua(e){return bu(e)}function bu(e){if(!F(e))return!0;if(Array.isArray(e))return e.every((t)=>bu(t));if(e.$prototype)return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!F(t)||Array.isArray(t))continue;if(t.$prototype)return!1;if(t.$ref)return!1}for(let t of Object.keys(e))if(t.startsWith("on")&&t!=="observedAttributes")return!1;if(Array.isArray(e.children))return e.children.every((t)=>bu(t));if(Qe(e.children))return!1;return!0}function OA(e,t){return Xi(e).map((r)=>CA(r,t)).join(", ")}function CA(e,t){let r=ka(e,t);if(r!==null)return r;if(e.startsWith(":host")){let n=/^:host\((.*)\)$/.exec(e)?.[1];if(t===":host")return e;return n===void 0?t:`${t}${n}`}if(t===":host"&&AA.test(e))return e;return`${t}${e}`}function pg(e,t,r=null,n={},s=null){let i=[],o=Zh(e,s);if(F(t)){let a={},l=[];for(let[c,u]of Object.entries(t))if(Ce(u))a[c]=u;else if(F(u)&&!Array.isArray(u))l.push([c,u]);else if(!c.startsWith("@")&&!Cn(c))a[c]=u;Ia(i,a,o,n);for(let[c,u]of l)if(c.startsWith("@"))Ia(i,{[c]:u},o,n);else if(Cn(c))Ia(i,u,OA(c,o),n)}if(r&&Array.isArray(r.children)){let a={n:0};for(let l of r.children)Nn(l,i,n,"",a,e)}return i.length>0?`${i.join(`
94
94
  `)}
95
- `:""}var dA,Bh,Ks="https://esm.sh/@vue/reactivity@3.5.40",Ys="https://esm.sh/lit-html@3.3.0",pA,mA,In,gA,Qs="__jxAttrText",Yh="__jxServerCall",yu="__jxCaptureSlotted",bu="__jxDistributeSlots",ei="<!---->",$u,bA;var Mr=q(()=>{Us();Zi();eo();Aa();Lh();ve();Hs();Us();eo();Aa();ve();dA=["$map/","event#/","$args/","$reduce/"];Bh=Symbol("jx.runtimeOnlyStateKeys");pA=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,mA=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g;In=new Set(["pre","textarea","listing","plaintext","xmp"]);gA=[];$u=new Set(["input","br","hr","img","meta","link","area","col","source"]);bA=/^(?:::slotted\(|::part\()/});import{relative as vA,sep as wA}from"node:path";function io(e){return e===SA}function ri(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function Ua(e,t){let r=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return r===null?null:r[1]??r[2]??r[3]??""}function ng(e){let t=e.search(/<\/head\s*>/i),r=t===-1?e:e.slice(0,t);for(let[n]of r.matchAll(/<meta\b[^>]*>/gi)){if(Ua(n,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((Ua(n,"content")??"").toLowerCase().split(",").map((i)=>i.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function sg(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function EA(e,t){let r=t.trim().toLowerCase();for(let[n]of sg(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(Ua(n,"rel")??"").toLowerCase().split(/\s+/),i=(Ua(n,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&i===r)return!0}return!1}function ig(e,t){let{end:r}=sg(e);if(r===-1||EA(e,t.type))return e;let n=`<link href="${$e(t.href)}" rel="alternate" type="${$e(t.type)}">`;return`${e.slice(0,r)}${n}
96
- ${e.slice(r)}`}function og(e,t){return new URL(`/${vA(e,t).split(wA).join("/")}`,"http://localhost").pathname}var SA="/404";var Pu=q(()=>{Mr()});function ag(e,t){if(t===null||t.routing!=="prefix-always")return[];let r=[];for(let n of e){if(n.urlPattern==="/")continue;let s=n.urlPattern.split("/").find(Boolean),i=dr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function lg(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=dr(r);if(r===void 0||n===null||t.locales.includes(n))return null;let s=t.locales.find((i)=>i!==n&&i.split("-")[0]===n.split("-")[0]);return s===void 0?null:{meant:s,segment:r}}function _A(e,t){let r=e.split("/").filter(Boolean),n=dr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function ju(e,t){let r=new Map,n=[];if(t===null)return{conflicts:n,sets:r};let s=new Map,i=new Set;for(let o of e){let a=o.translationKey===void 0?_A(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=Tr(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],d=c.find((p)=>p.locale===l);if(d===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(d.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[d.urlPattern,o.urlPattern]});s.set(a,c)}for(let o of s.values()){let a=o.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of o)r.set(l.urlPattern,a)}return{conflicts:n,sets:r}}function cg(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of ju(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((d)=>({href:An(ri(d.urlPattern,n),r),hreflang:d.locale}));let c=a.find((d)=>d.locale===t.defaultLocale);if(c!==void 0)l.push({href:An(ri(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function ug({pageLang:e,pageDir:t,routeLocale:r,defaults:n}){let s=e??r??n?.lang??"en",i=t??n?.dir;if(i!==void 0)return{dir:i,lang:s};return Gi(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var ku=q(()=>{nr();hs();Pu();hs();hs()});import{readFileSync as Ru,readdirSync as PA}from"node:fs";import{extname as dg,join as jA,relative as kA,resolve as RA}from"node:path";async function xs(e,t){let r=Ru(e,"utf8");if(e.endsWith(".json"))return jn(r,e);let n=dg(e).toLowerCase(),s=t?.byExtension(n,"parse");if(!s)throw Error(`No format class registered for "${n}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return await s.parseDocument(r)}async function fg(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await OA(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,AA(i,s._pathParams))}return r}function AA(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function OA(e,t){if(!Ru(e,"utf8").includes("$translationKey"))return null;let r;try{r=await xs(e,t)}catch{return null}return T(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function pg(e,t){let r=[],n=new Set([".json",...t?.documentExtensions("page")??[]]);return await mg(e,e,r,n,t),r.sort(hh),r}async function mg(e,t,r,n,s){let i=PA(e,{withFileTypes:!0});for(let o of i){let a=jA(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await mg(a,t,r,n,s);continue}let l=dg(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=kA(t,a);r.push(await CA(c,a,s))}}async function CA(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=mh(e),a=null;try{let c=(await xs(t,r)).$layout;if(T(c))a=c}catch{}return{$layout:a,isCatchAll:n,isDynamic:s,params:i,relativePath:e,sourcePath:t,urlPattern:o}}function NA(e){let t=e[hg];if(!ee(t))return null;let{mtime:r}=t;return T(r)&&r!==""?r:null}function TA(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 gg(e,t,r={},n,s,i){let o=[],a=e.flatMap((l)=>l.isDynamic?[l.urlPattern]:[]);for(let l of e){if(!l.isDynamic){o.push(l);continue}let c;try{c=await xs(l.sourcePath,n?.formats)}catch{o.push(l);continue}if(!c.$paths){console.warn(`Warning: dynamic route ${l.urlPattern} has no $paths — skipping`);continue}let d=await IA(c.$paths,t,r,n,s,Tr(l.urlPattern,i??null),l,a);for(let p of d){let h=l.urlPattern,m={};for(let[v,j]of Object.entries(p)){if(v===hg)continue;m[v]=String(j),h=h.replace(`:${v}`,m[v]),h=h.replace("*",m[v])}let b=TA(h);if(b!==null){console.warn(`Warning: $paths for ${l.urlPattern} produced "${h}", which ${b}; skipping it`);continue}let g=NA(p),y={...l,_pathParams:m,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:h};if(g!==null)y.sourceMtime=g;o.push(y)}}return o}async function IA(e,t,r,n,s,i,o,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=T(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&T(e.$ref)&&e.$ref){let l=e.$ref,c=RA(t,l),d;try{d=JSON.parse(Ru(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${Ee(m)}`),[]}if(!Array.isArray(d))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=T(e.param)?e.param:"id",h=T(e.field)?e.field:"id";return d.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(ee(m)?m[h]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=n?.byPathsDiscriminator(l);if(!c?.project)continue;let d={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)d.params=o.params,d.urlPattern=o.urlPattern;if(a!==void 0)d.patterns=a;return await c.call("resolvePaths",e,d)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var hg="_meta";var yg=q(()=>{ve();rr();gh();ku()});import{createHash as MA}from"node:crypto";function bg(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function $s(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function Au(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function BA(e){return`'sha256-${MA("sha256").update(e,"utf8").digest("base64")}'`}function xg(e,t){for(let r of e.matchAll(DA)){let n=r[1]??"",s=$s(n,"src"),i=($s(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=Au(s);if(o)t.scriptOrigins.add(o);continue}if(JA.has(i))t.scriptHashes.add(BA(r[2]??""))}for(let r of e.matchAll(LA)){let n=r[1]??"",s=($s(n,"rel")??"").toLowerCase(),i=$s(n,"href"),o=Au(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(VA.test(i??"")||($s(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[FA,t.imgOrigins],[qA,t.imgOrigins],[HA,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[$s(i,"src"),...WA($s(i,"srcset"))]){let a=Au(o);if(a)n.add(a)}}}function WA(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function $g(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 vg(e,t){let r=(o,a)=>[...o,...a].join(" "),n={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":"'self'","frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")n["report-to"]="csp-endpoint",n["report-uri"]=t.reportUri;for(let[o,a]of Object.entries(t.directives??{}))n[o]=a;let s=Object.entries(n).filter(([,o])=>o!==!1&&o!=="").toSorted(([o],[a])=>o<a?-1:1).map(([o,a])=>`${o} ${String(a)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":s}:{"Content-Security-Policy":s};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var JA,DA,LA,FA,qA,HA,VA;var Ou=q(()=>{JA=new Set(["","module","importmap","text/javascript","module-shim"]),DA=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,LA=/<link\b([^>]*)>/gi,FA=/<img\b([^>]*)>/gi,qA=/<source\b([^>]*)>/gi,HA=/<iframe\b([^>]*)>/gi,VA=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as za,readFileSync as UA,writeFileSync as Sg}from"node:fs";import{join as Ga}from"node:path";function Eg(e,t){let r=e?.headers??{},n=[];if(r.enabled===!1)return{errors:n,rules:[]};let s=r.security??{},i={};if(s.contentTypeOptions!==!1)i["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)i["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)i["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)i["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:o}=s;if(o){let d=o===!0?{}:o,p=d.maxAge??wg,h=d.includeSubDomains??!0,m=d.preload??!1;if(m&&!h)n.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else i["Strict-Transport-Security"]=[`max-age=${p}`,h?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=$g(s);if(a)if(t===void 0)n.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(i,vg(t,a));let l=r.cache??"auto";if(l==="auto")i["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(i).length>0)c.push({headers:i,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${wg}, immutable`},pattern:zA});for(let[d,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:d});return{errors:n,rules:c}}function _g(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],r=[];for(let[n,s]of t)if(za(Ga(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(za(Ga(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function Pg(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:Ie(t,r.pattern)}))}function YA(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
97
- `)});return`${[GA,"",...t].join(`
95
+ `:""}var SA,tg,Ys="https://esm.sh/@vue/reactivity@3.5.40",Xs="https://esm.sh/lit-html@3.3.0",_A,PA,In,kA,ei="__jxAttrText",ag="__jxServerCall",vu="__jxCaptureSlotted",wu="__jxDistributeSlots",ti="<!---->",Eu,AA;var Mr=q(()=>{zs();Qi();to();Oa();Yh();$e();Vs();zs();to();Oa();$e();SA=["$map/","event#/","$args/","$reduce/"];tg=Symbol("jx.runtimeOnlyStateKeys");_A=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,PA=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g;In=new Set(["pre","textarea","listing","plaintext","xmp"]);kA=[];Eu=new Set(["input","br","hr","img","meta","link","area","col","source"]);AA=/^(?:::slotted\(|::part\()/});import{relative as TA,sep as NA}from"node:path";function oo(e){return e===IA}function ni(e,t){if(e==="/")return"/";if(t==="always")return e.endsWith("/")?e:`${e}/`;if(t==="never")return e.replace(/\/+$/,"")||"/";return e}function za(e,t){let r=new RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'>]+))`,"i").exec(e);return r===null?null:r[1]??r[2]??r[3]??""}function mg(e){let t=e.search(/<\/head\s*>/i),r=t===-1?e:e.slice(0,t);for(let[n]of r.matchAll(/<meta\b[^>]*>/gi)){if(za(n,"name")?.trim().toLowerCase()!=="robots")continue;let s=new Set((za(n,"content")??"").toLowerCase().split(",").map((i)=>i.trim()));if(s.has("noindex")||s.has("none"))return!0}return!1}function hg(e){let t=e.search(/<\/head\s*>/i);return{end:t,head:t===-1?e:e.slice(0,t)}}function MA(e,t){let r=t.trim().toLowerCase();for(let[n]of hg(e).head.matchAll(/<link\b[^>]*>/gi)){let s=(za(n,"rel")??"").toLowerCase().split(/\s+/),i=(za(n,"type")??"").split(";")[0]?.trim().toLowerCase();if(s.includes("alternate")&&i===r)return!0}return!1}function gg(e,t){let{end:r}=hg(e);if(r===-1||MA(e,t.type))return e;let n=`<link href="${ve(t.href)}" rel="alternate" type="${ve(t.type)}">`;return`${e.slice(0,r)}${n}
96
+ ${e.slice(r)}`}function yg(e,t){return new URL(`/${TA(e,t).split(NA).join("/")}`,"http://localhost").pathname}var IA="/404";var Au=q(()=>{Mr()});function bg(e,t){if(t===null||t.routing!=="prefix-always")return[];let r=[];for(let n of e){if(n.urlPattern==="/")continue;let s=n.urlPattern.split("/").find(Boolean),i=dr(s);if(i===null||!t.locales.includes(i))r.push(n.urlPattern)}return r}function xg(e,t){if(t===null)return null;let r=e.split("/").find(Boolean),n=dr(r);if(r===void 0||n===null||t.locales.includes(n))return null;let s=t.locales.find((i)=>i!==n&&i.split("-")[0]===n.split("-")[0]);return s===void 0?null:{meant:s,segment:r}}function JA(e,t){let r=e.split("/").filter(Boolean),n=dr(r[0]);if(t!==null&&n!==null&&t.locales.includes(n))return r.slice(1).join("/");return r.join("/")}function Ou(e,t){let r=new Map,n=[];if(t===null)return{conflicts:n,sets:r};let s=new Map,i=new Set;for(let o of e){let a=o.translationKey===void 0?JA(o.urlPattern,t):o.translationKey.replaceAll(/^\/+|\/+$/g,"");if(o.translationKey!==void 0)i.add(o.urlPattern);let l=vr(o.urlPattern,t);if(l===null)continue;let c=s.get(a)??[],u=c.find((p)=>p.locale===l);if(u===void 0)c.push({locale:l,urlPattern:o.urlPattern});else n.push({declared:i.has(u.urlPattern)||o.translationKey!==void 0,key:a,locale:l,urlPatterns:[u.urlPattern,o.urlPattern]});s.set(a,c)}for(let o of s.values()){let a=o.toSorted((l,c)=>l.locale===c.locale?0:l.locale<c.locale?-1:1);for(let l of o)r.set(l.urlPattern,a)}return{conflicts:n,sets:r}}function $g(e,t,r,n){let s=new Map;if(t===null||r==="")return s;let i=new Map;for(let[o,a]of Ou(e,t).sets){if(a.length<2)continue;let l=i.get(a);if(l===void 0){l=a.map((u)=>({href:An(ni(u.urlPattern,n),r),hreflang:u.locale}));let c=a.find((u)=>u.locale===t.defaultLocale);if(c!==void 0)l.push({href:An(ni(c.urlPattern,n),r),hreflang:"x-default"});i.set(a,l)}s.set(o,l)}return s}function vg({pageLang:e,pageDir:t,routeLocale:r,defaults:n}){let s=e??r??n?.lang??"en",i=t??n?.dir;if(i!==void 0)return{dir:i,lang:s};return Ki(s)==="rtl"?{dir:"rtl",lang:s}:{lang:s}}var Cu=q(()=>{sr();gs();Au();gs();gs()});function wg(e,t,r,n=null,s=null,i=[]){if(!e.state)e.state={};let o={};if(s!==null)o.defaultLocale=s.defaultLocale,o.locales=s.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...o,...t.state};let a=(N(e.$lang)?e.$lang:void 0)??vr(r.urlPattern,s)??t.defaults?.lang,l=i.map((u)=>({code:u.locale,current:u.urlPattern===r.urlPattern,dir:Ki(u.locale),label:kh(u.locale),url:u.urlPattern})),c={params:r._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:r.urlPattern};if(l.length>0)c.alternates=l;if(r.pagination){let{first:u,itemCount:p,last:g,next:m,number:b,pageCount:h,pageSize:y,pages:v,prev:j}=r.pagination;c.pagination={first:u,itemCount:p,last:g,next:m,number:b,pageCount:h,pageSize:y,pages:v.map(({current:S,number:_,url:E})=>({current:S,number:_,url:E})),prev:j}}if(a!==void 0)c.dir=Ki(a),c.locale=a;if(e.state.$page=c,t.state){for(let[u,p]of Object.entries(t.state))if(u!=="$site"&&u!=="$page"&&!(u in e.state))e.state[u]=p}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[u,p]of Object.entries(t.imports))if(!(u in e.imports))e.imports[u]=n&&(p.startsWith("./")||p.startsWith("../"))?n(p,r):p}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let u=new Set,p=[];for(let g of[...t.$elements,...e.$elements]){let m=N(g)?g:F(g)?g.$ref:void 0;if(m&&!u.has(m))u.add(m),p.push(g)}e.$elements=p}return e}var Sg=q(()=>{$e();gs()});import{dirname as DA,relative as LA,resolve as FA}from"node:path";function Tu(e){return(t,r)=>{if(!r.sourcePath)return t;return`./${LA(DA(r.sourcePath),FA(e,t))}`}}function Eg(e,t,r,n=null,s=null,i=[]){return wg(e,t,r,n===null?null:Tu(n),s,i)}var Nu=q(()=>{Sg()});import{readFileSync as qA}from"node:fs";import{dirname as Iu,resolve as Ga}from"node:path";import{createRequire as HA}from"node:module";function WA(e){return vt(e.resolve)}async function Ka(e,t,r,n={}){let s=e.imports??{},{state:i}=e;if(!i)return;for(let[o,a]of Object.entries(i)){if(!Tr(a))continue;if(VA.has(a.$prototype))continue;if(a.timing&&a.timing!=="compiler"){let l=n.registry?.byName(a.$prototype);if(l?.capabilities.lower)try{let c=await l.call("lower",a,{projectConfig:n.config,root:r,route:t});if(z(c)){let u=c.$bundle;if(Array.isArray(u)){for(let p of u)if(N(p))n.registerBundle?.(p)}delete c.$bundle}i[o]=c}catch(c){console.warn(`prototype-resolver: failed to lower "${o}" ($prototype: "${a.$prototype}"):`,we(c))}continue}if(!a.$src){let l=s[a.$prototype]??UA(n,a.$prototype);if(!l)continue;a.$src=l}try{let l=await zA(a,t,r,i,n);if(a.timing&&z(l))l.timing=a.timing;i[o]=l}catch(l){console.warn(`prototype-resolver: failed to resolve "${o}" ($prototype: "${a.$prototype}"):`,we(l))}}}function UA(e,t){return e.registry?.byName(t)?.classPath}async function zA(e,t,r,n,s){let i=e.$src;if(!i)throw Error(`$prototype "${e.$prototype}" has no $src to resolve`);let o;if(i.startsWith("./")||i.startsWith("../"))o=t.sourcePath?Ga(Iu(t.sourcePath),i):Ga(r,i);else o=HA(Ga(r,"package.json")).resolve(i);let a=qA(o,"utf8"),l=um(a,o);if(!l.$implementation)throw Error(`${i} has no $implementation field`);let c=Ga(Iu(o),l.$implementation),u=await Nc(c),p=e.$export??l.title??e.$prototype,g=u[p]??u.default?.[p];if(!g)throw Error(`Module ${l.$implementation} does not export "${p}"`);let m={};for(let[h,y]of Object.entries(e))if(!BA.has(h))m[h]=y;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=Iu(t.sourcePath);m._project={config:s.config??null,root:r,...s.sections},m._document={route:t,state:n};let b=new g(m);if(WA(b))return await b.resolve();return b}var VA,BA;var Mu=q(()=>{nn();$e();nr();VA=new Set(["Function","LocalStorage","SessionStorage","Array"]),BA=new Set(["$prototype","$src","$export","timing","default","description"])});import{readFileSync as Ju,readdirSync as GA,statSync as KA}from"node:fs";import{extname as Pg,join as YA,relative as XA,resolve as ZA}from"node:path";async function $s(e,t){let r=Ju(e,"utf8");if(e.endsWith(".json"))return jn(r,e);let n=Pg(e).toLowerCase(),s=t?.byExtension(n,"parse");if(!s)throw Error(`No format class registered for "${n}" (${e}). Enable an extension providing this format in project.json "extensions", e.g. "@jxsuite/parser".`);return await s.parseDocument(r)}async function jg(e,t){let r=new Map,n=new Map;for(let s of e){if(!n.has(s.sourcePath))n.set(s.sourcePath,await eO(s.sourcePath,t));let i=n.get(s.sourcePath);if(i!==null&&i!==void 0)r.set(s.urlPattern,QA(i,s._pathParams))}return r}function QA(e,t){if(!e.includes("${"))return e;return e.replaceAll(/\$\{(\w+)\}/g,(r,n)=>t?.[n]??r)}async function eO(e,t){if(!Ju(e,"utf8").includes("$translationKey"))return null;let r;try{r=await $s(e,t)}catch{return null}return N(r.$translationKey)&&r.$translationKey!==""?r.$translationKey:null}async function kg(e,t){let r=[],n=new Set([".json",...t?.documentExtensions("page")??[]]);return await Rg(e,e,r,n,t),r.sort(wh),r}async function Rg(e,t,r,n,s){let i=GA(e,{withFileTypes:!0});for(let o of i){let a=YA(e,o.name);if(o.isDirectory()){if(o.name.startsWith("_"))continue;await Rg(a,t,r,n,s);continue}let l=Pg(o.name).toLowerCase();if(!n.has(l))continue;if(o.name.startsWith("_"))continue;let c=XA(t,a);r.push(await tO(c,a,s))}}async function tO(e,t,r){let{isCatchAll:n,isDynamic:s,params:i,urlPattern:o}=vh(e),a=null;try{let c=(await $s(t,r)).$layout;if(N(c))a=c}catch{}return{$layout:a,isCatchAll:n,isDynamic:s,params:i,relativePath:e,sourcePath:t,urlPattern:o}}function rO(e){let t=e[Ya];if(!z(t))return null;let{mtime:r}=t;return N(r)&&r!==""?r:null}function Ag(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 Og(e,t,r={},n,s,i,o={}){let a=[],l=(u,p)=>{let g=`Dynamic route ${u.urlPattern}: ${p}`;if(o.errors===void 0)throw Error(g);o.errors.push(g)},c=e.flatMap((u)=>u.isDynamic?[u.urlPattern]:[]);for(let u of e){if(!u.isDynamic){a.push(u);continue}let p;try{p=await $s(u.sourcePath,n?.formats)}catch{a.push(u);continue}if(!p.$paths){console.warn(`Warning: dynamic route ${u.urlPattern} has no $paths — skipping`);continue}let g;try{g=Eh(p.$paths)}catch(b){l(u,we(b));continue}if(g!==null){let b=vr(u.urlPattern,i??null),h=g.each===void 0?[{}]:await _g(g.each,t,r,n,s,b,u,c);for(let y of h){let v=await nO(u,p,g,y,{locale:b,projectConfig:s,projectRoot:t,registry:n,report:l,sections:r});a.push(...v)}continue}let m=await _g(p.$paths,t,r,n,s,vr(u.urlPattern,i??null),u,c);for(let b of m){let h=u.urlPattern,y={};for(let[_,E]of Object.entries(b)){if(_===Ya)continue;y[_]=String(E),h=h.replace(`:${_}`,y[_]),h=h.replace("*",y[_])}let v=Ag(h);if(v!==null){console.warn(`Warning: $paths for ${u.urlPattern} produced "${h}", which ${v}; skipping it`);continue}let j=rO(b),S={...u,_pathParams:y,isCatchAll:!1,isDynamic:!1,params:[],urlPattern:h};if(j!==null)S.sourceMtime=j;a.push(S)}}return a}function Cg(e,t){let r=e;for(let[n,s]of Object.entries(t)){let i=new RegExp(`:${n.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}(?=/|$)`);r=i.test(r)?r.replace(i,()=>s):r.replace("*",()=>s)}return r}async function nO(e,t,r,n,s){let i={};for(let[b,h]of Object.entries(n))if(b!==Ya)i[b]=String(h);let o=e.params.filter((b)=>!(b in i));if(o.length!==1)return s.report(e,`a paged route takes exactly one parameter besides those its each source fills; this one has ${o.length}`),[];let a=o[0];if(t.state?.[r.key]===void 0)return s.report(e,`$paths.paginate names state entry "${r.key}", which this page does not declare`),[];let l=Cg(e.urlPattern,i),c=Ag(l);if(c!==null)return console.warn(`Warning: $paths for ${e.urlPattern} produced "${l}", which ${c}; skipping it`),[];let u=await iO(t,r.key,e,i,s);if(!Array.isArray(u))return s.report(e,`state entry "${r.key}" did not resolve to an array at build time`),[];let p=sO(u,e.sourcePath),g=Xc(u.length,r.pageSize),m=[];for(let b=1;b<=g;b++){let h={...e,_pathParams:{...i,[a]:String(b)},isCatchAll:!1,isDynamic:!1,pagedState:{items:_h(u,b,r.pageSize),key:r.key},pagination:Ph(l,b,r.pageSize,u.length),params:[],urlPattern:hs(l,b)};if(p!==null)h.sourceMtime=p;m.push(h)}return m}function sO(e,t){let r=null,n=KA(t).mtime.getTime();for(let s of e){let i=z(s)?s[Ya]:void 0,o=z(i)?i.mtime:void 0;if(N(o)&&Date.parse(o)>n)n=Date.parse(o),r=o}return r}async function iO(e,t,r,n,s){let i=e.state?.[t];if(i===void 0||Array.isArray(i))return i;let o={},a=Tu(s.projectRoot);for(let[u,p]of Object.entries(s.projectConfig?.imports??{}))o[u]=p.startsWith("./")||p.startsWith("../")?a(p,r):p;Object.assign(o,e.imports);let l={imports:o,state:{[t]:structuredClone(i)}},c={_pathParams:n,locale:s.locale,sourcePath:r.sourcePath,urlPattern:Cg(r.urlPattern,n)};return await Ka(l,c,s.projectRoot,{...s.projectConfig&&{config:s.projectConfig},...s.registry&&{registry:s.registry},sections:s.sections}),l.state?.[t]}async function _g(e,t,r,n,s,i,o,a){if(Array.isArray(e))return e;if("values"in e&&Array.isArray(e.values)){let l=N(e.param)?e.param:"value";return e.values.map((c)=>({[l]:c}))}if("$ref"in e&&N(e.$ref)&&e.$ref){let l=e.$ref,c=ZA(t,l),u;try{u=JSON.parse(Ju(c,"utf8"))}catch(m){return console.warn(`Warning: $paths.$ref could not load "${l}": ${we(m)}`),[]}if(!Array.isArray(u))return console.warn(`Warning: $paths.$ref "${l}" must be a JSON array`),[];let p=N(e.param)?e.param:"id",g=N(e.field)?e.field:"id";return u.map((m)=>{if(m===null)throw TypeError(`$paths.$ref "${l}" contains a null entry`);return{[p]:(z(m)?m[g]??m.id:void 0)??String(m)}})}for(let l of Object.keys(e)){let c=n?.byPathsDiscriminator(l);if(!c?.project)continue;let u={data:r[c.project.key],locale:i,projectConfig:s,root:t};if(o!==void 0)u.params=o.params,u.urlPattern=o.urlPattern;if(a!==void 0)u.patterns=a;return await c.call("resolvePaths",e,u)}return console.warn("Warning: unrecognized $paths shape — skipping"),[]}var Ya="_meta";var Tg=q(()=>{$e();nr();Sh();jh();Cu();Nu();Mu()});import{createHash as oO}from"node:crypto";function Ng(){return{fontOrigins:new Set,frameOrigins:new Set,imgOrigins:new Set,scriptHashes:new Set,scriptOrigins:new Set,styleOrigins:new Set}}function vs(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[2]??r?.[3]}function Du(e){if(e===void 0||!/^https?:\/\//i.test(e))return null;try{return new URL(e).origin}catch{return null}}function mO(e){return`'sha256-${oO("sha256").update(e,"utf8").digest("base64")}'`}function Ig(e,t){for(let r of e.matchAll(lO)){let n=r[1]??"",s=vs(n,"src"),i=(vs(n,"type")??"").trim().toLowerCase();if(s!==void 0){let o=Du(s);if(o)t.scriptOrigins.add(o);continue}if(aO.has(i))t.scriptHashes.add(mO(r[2]??""))}for(let r of e.matchAll(cO)){let n=r[1]??"",s=(vs(n,"rel")??"").toLowerCase(),i=vs(n,"href"),o=Du(i);if(!o)continue;if(s.includes("stylesheet"))t.styleOrigins.add(o);if(pO.test(i??"")||(vs(n,"as")??"")==="font")t.fontOrigins.add(o)}for(let[r,n]of[[uO,t.imgOrigins],[dO,t.imgOrigins],[fO,t.frameOrigins]])for(let s of e.matchAll(r)){let i=s[1]??"";for(let o of[vs(i,"src"),...hO(vs(i,"srcset"))]){let a=Du(o);if(a)n.add(a)}}}function hO(e){return e===void 0?[]:e.split(",").map((t)=>t.trim().split(/\s+/)[0]??"").filter(Boolean)}function Mg(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 Jg(e,t){let r=(o,a)=>[...o,...a].join(" "),n={"base-uri":"'self'","default-src":"'self'","font-src":r(["'self'"],e.fontOrigins),"form-action":"'self'","frame-ancestors":"'self'","frame-src":r(["'self'"],e.frameOrigins),"img-src":r(["'self'","data:"],e.imgOrigins),"object-src":"'none'","script-src":r(["'self'",...[...e.scriptHashes].toSorted()],e.scriptOrigins),"style-src":r(["'self'","'unsafe-inline'"],e.styleOrigins)};if(t.reportUri!==void 0&&t.reportUri!=="")n["report-to"]="csp-endpoint",n["report-uri"]=t.reportUri;for(let[o,a]of Object.entries(t.directives??{}))n[o]=a;let s=Object.entries(n).filter(([,o])=>o!==!1&&o!=="").toSorted(([o],[a])=>o<a?-1:1).map(([o,a])=>`${o} ${String(a)}`).join("; "),i=t.mode==="report-only"?{"Content-Security-Policy-Report-Only":s}:{"Content-Security-Policy":s};if(t.reportUri!==void 0&&t.reportUri!=="")i["Reporting-Endpoints"]=`csp-endpoint="${t.reportUri}"`;return i}var aO,lO,cO,uO,dO,fO,pO;var Lu=q(()=>{aO=new Set(["","module","importmap","text/javascript","module-shim"]),lO=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,cO=/<link\b([^>]*)>/gi,uO=/<img\b([^>]*)>/gi,dO=/<source\b([^>]*)>/gi,fO=/<iframe\b([^>]*)>/gi,pO=/\.(woff2?|ttf|otf|eot)(\?|#|$)/i});import{existsSync as Xa,readFileSync as gO,writeFileSync as Lg}from"node:fs";import{join as Za}from"node:path";function Fg(e,t){let r=e?.headers??{},n=[];if(r.enabled===!1)return{errors:n,rules:[]};let s=r.security??{},i={};if(s.contentTypeOptions!==!1)i["X-Content-Type-Options"]="nosniff";if(s.referrerPolicy!==!1)i["Referrer-Policy"]=s.referrerPolicy??"strict-origin-when-cross-origin";if(s.permissionsPolicy!==!1)i["Permissions-Policy"]=s.permissionsPolicy??"camera=(), microphone=(), geolocation=()";if(s.frameOptions!==!1)i["X-Frame-Options"]=s.frameOptions??"SAMEORIGIN";let{hsts:o}=s;if(o){let u=o===!0?{}:o,p=u.maxAge??Dg,g=u.includeSubDomains??!0,m=u.preload??!1;if(m&&!g)n.push("build.headers.security.hsts: `preload` requires `includeSubDomains` — the preload list "+"will not accept the header without it.");else i["Strict-Transport-Security"]=[`max-age=${p}`,g?"includeSubDomains":null,m?"preload":null].filter(Boolean).join("; ")}let a=Mg(s);if(a)if(t===void 0)n.push("build.headers.security.csp is set, but no page was scanned for inline scripts — the "+"policy would block every one of them.");else Object.assign(i,Jg(t,a));let l=r.cache??"auto";if(l==="auto")i["Cache-Control"]="public, max-age=0, must-revalidate";let c=[];if(Object.keys(i).length>0)c.push({headers:i,pattern:"/*"});if(l==="auto")c.push({headers:{"Cache-Control":`public, max-age=${Dg}, immutable`},pattern:yO});for(let[u,p]of Object.entries(r.rules??{}))c.push({headers:p,pattern:u});return{errors:n,rules:c}}function qg(e){let t=[["feed.xml","application/atom+xml; charset=utf-8"],["feed.json","application/feed+json; charset=utf-8"],["manifest.webmanifest","application/manifest+json; charset=utf-8"],[".well-known/security.txt","text/plain; charset=utf-8"]],r=[];for(let[n,s]of t)if(Xa(Za(e,n)))r.push({headers:{"Content-Type":s},pattern:`/${n}`});if(Xa(Za(e,"feed","archive")))r.push({headers:{"Content-Type":"application/atom+xml; charset=utf-8"},pattern:"/feed/archive/*"});return r}function Hg(e,t){if(t==="")return[...e];return e.map((r)=>({headers:r.headers,pattern:Ie(t,r.pattern)}))}function $O(e){let t=e.map((r)=>{let n=Object.entries(r.headers).map(([s,i])=>` ${s}: ${i}`);return[r.pattern,...n].join(`
97
+ `)});return`${[bO,"",...t].join(`
98
98
  `)}
99
- `}function jg(e,t){if(t.length===0)return 0;let r=Ga(e,"_headers"),n=za(r)?UA(r,"utf8").trim():"",s=YA(t),i=n===""?s:`${s}
100
- ${KA}
99
+ `}function Vg(e,t){if(t.length===0)return 0;let r=Za(e,"_headers"),n=Xa(r)?gO(r,"utf8").trim():"",s=$O(t),i=n===""?s:`${s}
100
+ ${xO}
101
101
  ${n}
102
- `;return Sg(r,i,"utf8"),1}function kg(e){let t=Ga(e,".nojekyll");if(za(t))return 0;return Sg(t,"","utf8"),1}var zA="/images/_optimized/*",wg=31536000,GA="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",KA="# ─── public/_headers (hand-authored; these rules override the block above) ───";var Rg=q(()=>{nr();Ou()});async function Ag(e,t,r,n={}){let s={},i=Nc(e);for(let o of r.projectContributions()){let a=o.project?.key;if(!a||!o.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await o.call("projectData",t[a],{io:i,projectConfig:t,registry:r,root:e,...n.lazy===!0&&{lazy:!0}})}return s}var Og=q(()=>{nn()});import{cpSync as XA,existsSync as ZA,mkdirSync as QA}from"node:fs";import{dirname as eO,resolve as tO}from"node:path";async function Cg(e,t,r){let n=[],s=[],i=new Map;for(let o of e.assetProviders()){let a=o.project?.key,l=a?t[a]:void 0;if(a&&(l==null||F(l)&&Object.keys(l).length===0))continue;try{let c=await o.call("assets",l??null,{projectConfig:t,root:r});for(let d of c??[]){if(!F(d)||!d.urlPrefix||!d.dir)continue;let p={dir:d.dir,urlPrefix:da(d.urlPrefix)};if(vt(d.filter))p.filter=d.filter;let h=i.get(p.urlPrefix);if(h){if(h.dir!==p.dir)s.push(`Asset mount conflict: "${p.urlPrefix}" is claimed by both "${h.dir}" and "${p.dir}"`);continue}i.set(p.urlPrefix,p),n.push(p)}}catch(c){s.push(`Error in ${o.name}.assets: ${Ee(c)}`)}}return{errors:s,mounts:n}}function Cu(e,t,r){if(t.length===0||!e)return;for(let n of Rm(e,t))r.add(n)}function Ng(e,t,r){let n=0,s=[];for(let i of e){let o=fa(t,i);if(!o||!ZA(o)){s.push(i);continue}let a=tO(r,decodeURIComponent(i).replace(/^\//,""));QA(eO(a),{recursive:!0}),XA(o,a),n+=1}return{copied:n,missing:s}}var Tg=q(()=>{nr();ve();rr()});async function Nu(e,t,r){let n=e.$layout??t.defaults?.layout??null;if(!n)return e;let s=await r(n);if(s.$layout)s=await Nu(s,t,r);let i=e.children??[],o=T(i)?[i]:Array.isArray(i)?i:[],a=nO(s);if(rO(a,o),e.state)a.state={...a.state,...e.state};if(e.$media)a.$media={...a.$media,...e.$media};if(e.style)a.style={...a.style,...e.style};if(e.attributes)a.attributes={...a.attributes,...e.attributes};if(e.$head)a._pageHead=e.$head;if(e.title)a._pageTitle=e.title;return delete a.$layout,a}function rO(e,t){let r=new Map,n=[];for(let s of t){let i=F(s)?s.attributes?.slot:void 0;if(i){let o=r.get(i);if(!o)o=[],r.set(i,o);o.push(s)}else n.push(s)}Ig(e,r,n)}function Ig(e,t,r){if(!F(e))return;if(!Array.isArray(e.children))return;let n=[];for(let s of e.children)if(F(s)&&s.tagName==="slot"){let i=s.attributes?.name,o=i?t.get(i):void 0;if(i&&o)n.push(...o),t.delete(i);else if(!i&&r.length>0)n.push(...r);else if(Array.isArray(s.children))n.push(...s.children)}else Ig(s,t,r),n.push(s);e.children=n}function nO(e){return structuredClone(e)}var Mg=q(()=>{ve()});import{existsSync as sO,readFileSync as iO}from"node:fs";import{resolve as Jg}from"node:path";function Dg(e){return(t)=>{let r=Jg(e,t);if(!sO(r))throw Error(`Layout not found: ${t} (resolved to ${r})`);try{return jn(iO(r,"utf8"),r)}catch(n){throw Error(`Invalid layout JSON at ${r}: ${Ee(n)}`,{cause:n})}}}function Lg(e,t,r){return Nu(e,t,Dg(r))}function Fg(e,t,r){let n=Dg(r),s=[],i=e.$layout??t.defaults?.layout;while(i){let o=Jg(r,i);if(s.some((l)=>l.path===o))break;let a=n(i);s.push({doc:a,path:o}),i=a.$layout}return s}var qg=q(()=>{rr();Mg()});import{dirname as oO,relative as aO,resolve as lO,sep as cO}from"node:path";function Hg(e,t){return aO(t,e).split(cO).join("/")}function uO(e,t,r){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${Hg(lO(t,e),r)}`}function oo(e,t,r){let n=oO(t),s=Hg(t,r);return Zh(e).map((i)=>({exportName:i.exportName,src:uO(i.src,n,r),declaredIn:s}))}function Vg(e){let t=new Map;for(let{exportName:s,src:i,declaredIn:o}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(i))a.set(i,o)}let r=[],n=[];for(let[s,i]of t){let o=[...i];if(r.push({exportName:s,src:o[0][0]}),o.length>1){let a=o.map(([l,c])=>`${l} (declared in ${c})`);n.push(`Server function "${s}" is exported by ${o.length} different modules: ${a.join(", ")}. The site worker serves one function per export name, at /_jx/server/${s}, so a call meant for any but the first would get the first's answer. Rename the export in all but one module, and the $export that names it.`)}}return{entries:r,errors:n}}var Bg=q(()=>{Mr()});function Wg(e,t){if(!T(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function Ug(e=[],t=[],r=[],n={}){let s=[{attributes:{charset:n.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],i=new Map;for(let a of[...s,...e,...t,...r]){let l=Tu(a);i.set(l,a)}let o=n.title??n.siteName??"Jx Site";if(i.set("title",{children:[o],tagName:"title"}),n.pageUrl&&n.siteUrl){let a=An(n.pageUrl,n.siteUrl);if(![...i.values()].some((c)=>F(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};i.set(Tu(c),c)}if(!i.has("meta:og:url"))i.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(n.siteName&&!i.has("meta:og:site_name"))i.set("meta:og:site_name",{attributes:{content:n.siteName,property:"og:site_name"},tagName:"meta"});for(let a of n.alternates??[]){let l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=Tu(l);if(!i.has(c))i.set(c,l)}return[...i.values()]}function Tu(e){if(!F(e))return String(e);let t=e.tagName??"unknown",r=e.attributes??{};if(t==="title")return"title";if(r.charset)return"meta:charset";if(t==="meta"&&r.name)return`meta:${r.name}`;if(t==="meta"&&r.property)return`meta:${r.property}`;if(t==="link"&&r.rel){let n=r.hreflang??r.type??r.media??r.sizes??"";return`link:${r.rel}:${r.href??""}:${String(n)}`}if(t==="script"&&r.src)return`script:${r.src}`;if(t==="style"){let n=Array.isArray(e.children)?e.children.join(""):e.textContent,s=F(n)?JSON.stringify(n):n??"";return`style:${dO(s)}`}return`${t}:${JSON.stringify(e)}`}function dO(e){let t=0;for(let r=0;r<e.length;r++)t=Math.trunc((t<<5)-t+(e.codePointAt(r)??0));return t.toString(36)}function zg(e){return e.map((t)=>fO(t)).join(`
103
- `)}function fO(e){if(T(e))return e;if(!F(e))return"";let t=e.tagName,r=e.attributes??{},n=Object.entries(r).map(([l,c])=>c===!0?l:`${l}="${pO(c)}"`).join(" "),s=n?`<${t} ${n}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let o=Array.isArray(e.children)?e.children.join(""):e.textContent,a=F(o)?JSON.stringify(o,null,2):o??"";return`${s}${a}</${t}>`}function pO(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var Gg=q(()=>{nr();ve()});function gO(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 yO(e){if(!T(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let r=t.toLowerCase();return!mO.has(r)&&!hO.has(r)&&!gO(t)})}function Kg(e){let t=new Set;for(let r of e){if(!F(r)||r.tagName!=="link")continue;for(let n of yO(r.attributes?.rel))t.add(n)}return[...t]}var mO,hO;var Yg=q(()=>{ve();mO=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"]),hO=new Set(["shortcut"])});function Xg(e,t,r,n=null,s=null,i=[]){if(!e.state)e.state={};let o={};if(s!==null)o.defaultLocale=s.defaultLocale,o.locales=s.locales;e.state.$site={name:t.name??"Jx Site",url:t.url??"",...o,...t.state};let a=(T(e.$lang)?e.$lang:void 0)??Tr(r.urlPattern,s)??t.defaults?.lang,l=i.map((d)=>({code:d.locale,current:d.urlPattern===r.urlPattern,dir:Gi(d.locale),label:yh(d.locale),url:d.urlPattern})),c={params:r._pathParams??{},title:e.title??e._pageTitle??t.name??"",url:r.urlPattern};if(l.length>0)c.alternates=l;if(a!==void 0)c.dir=Gi(a),c.locale=a;if(e.state.$page=c,t.state){for(let[d,p]of Object.entries(t.state))if(d!=="$site"&&d!=="$page"&&!(d in e.state))e.state[d]=p}if(t.$media)e.$media={...t.$media,...e.$media};if(t.imports&&Object.keys(t.imports).length>0){if(!e.imports)e.imports={};for(let[d,p]of Object.entries(t.imports))if(!(d in e.imports))e.imports[d]=n&&(p.startsWith("./")||p.startsWith("../"))?n(p,r):p}if(t.$elements?.length)if(!e.$elements?.length)e.$elements=[...t.$elements];else{let d=new Set,p=[];for(let h of[...t.$elements,...e.$elements]){let m=T(h)?h:F(h)?h.$ref:void 0;if(m&&!d.has(m))d.add(m),p.push(h)}e.$elements=p}return e}var Zg=q(()=>{ve();hs()});import{dirname as bO,relative as xO,resolve as $O}from"node:path";function vO(e){return(t,r)=>{if(!r.sourcePath)return t;return`./${xO(bO(r.sourcePath),$O(e,t))}`}}function Qg(e,t,r,n=null,s=null,i=[]){return Xg(e,t,r,n===null?null:vO(n),s,i)}var ey=q(()=>{Zg()});async function Xa(e,t={}){let{resolveElementPath:r,$media:n,formats:s}=t,i=[],o=new Set;async function a(l,c){let d,p;if(T(l)){let{readFileSync:P}=await import("node:fs"),{resolve:E}=await import("node:path");if(p=c?E(c,l):E(l),o.has(p))return;if(o.add(p),p.endsWith(".json"))d=jn(P(p,"utf8"),p);else{let{extname:O}=await import("node:path"),R=O(p).toLowerCase(),k=s?.byExtension(R,"parse");if(!k){await Promise.resolve().then(() => nn());throw ca(p,R)}d=await k.parseDocument(P(p,"utf8"))}}else{if(d=l,p=null,d.tagName&&o.has(d.tagName))return;if(d.tagName)o.add(d.tagName)}let{tagName:h}=d;if(!h||!h.includes("-"))throw Error(`compileElement: tagName "${h}" must contain a hyphen`);let{dirname:m}=await import("node:path"),b=p?m(p):null,g=[];if(Array.isArray(d.$elements))for(let P of d.$elements){let E=Ce(P)?P.$ref:P;if(!T(E))continue;if(b)await a(E,b);let O=r?r(E,b):E.replace(/\.json$/,".js");g.push(O)}let y=Va(h);if(n)d.$media={...n,...d.$media};let{rewriteSrc:v}=t,j=ao(d,y,g,v?(P)=>v(P,b):void 0,ys(d,t.defaults),t.serverBaseUrl),S=p?p.replace(/\.json$/,".js"):`${h}.js`;i.push({content:j,path:S,tagName:h})}return await a(e,t.basePath??null),{files:i}}async function wO(e,t={}){let{title:r="Jx App",reactivitySrc:n="https://esm.sh/@vue/reactivity@3.5.13",litHtmlSrc:s="https://esm.sh/lit-html@3.3.0"}=t,i=await Xa(e,t),o=i.files.at(-1);if(!o)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(o.path),c=`<!DOCTYPE html>
102
+ `;return Lg(r,i,"utf8"),1}function Bg(e){let t=Za(e,".nojekyll");if(Xa(t))return 0;return Lg(t,"","utf8"),1}var yO="/images/_optimized/*",Dg=31536000,bO="# Generated by @jxsuite/compiler — configure via build.headers in project.json.",xO="# ─── public/_headers (hand-authored; these rules override the block above) ───";var Wg=q(()=>{sr();Lu()});async function Ug(e,t,r,n={}){let s={},i=Mc(e);for(let o of r.projectContributions()){let a=o.project?.key;if(!a||!o.capabilities.projectData)continue;if(!t||!(a in t))continue;s[a]=await o.call("projectData",t[a],{io:i,projectConfig:t,registry:r,root:e,...n.lazy===!0&&{lazy:!0}})}return s}var zg=q(()=>{nn()});import{cpSync as vO,existsSync as wO,mkdirSync as SO}from"node:fs";import{dirname as EO,resolve as _O}from"node:path";async function Gg(e,t,r){let n=[],s=[],i=new Map;for(let o of e.assetProviders()){let a=o.project?.key,l=a?t[a]:void 0;if(a&&(l==null||F(l)&&Object.keys(l).length===0))continue;try{let c=await o.call("assets",l??null,{projectConfig:t,root:r});for(let u of c??[]){if(!F(u)||!u.urlPrefix||!u.dir)continue;let p={dir:u.dir,urlPrefix:fa(u.urlPrefix)};if(vt(u.filter))p.filter=u.filter;let g=i.get(p.urlPrefix);if(g){if(g.dir!==p.dir)s.push(`Asset mount conflict: "${p.urlPrefix}" is claimed by both "${g.dir}" and "${p.dir}"`);continue}i.set(p.urlPrefix,p),n.push(p)}}catch(c){s.push(`Error in ${o.name}.assets: ${we(c)}`)}}return{errors:s,mounts:n}}function Fu(e,t,r){if(t.length===0||!e)return;for(let n of Mm(e,t))r.add(n)}function Kg(e,t,r){let n=0,s=[];for(let i of e){let o=pa(t,i);if(!o||!wO(o)){s.push(i);continue}let a=_O(r,decodeURIComponent(i).replace(/^\//,""));SO(EO(a),{recursive:!0}),vO(o,a),n+=1}return{copied:n,missing:s}}var Yg=q(()=>{sr();$e();nr()});async function qu(e,t,r){let n=e.$layout??t.defaults?.layout??null;if(!n)return e;let s=await r(n);if(s.$layout)s=await qu(s,t,r);let i=e.children??[],o=N(i)?[i]:Array.isArray(i)?i:[],a=jO(s);if(PO(a,o),e.state)a.state={...a.state,...e.state};if(e.$media)a.$media={...a.$media,...e.$media};if(e.style)a.style={...a.style,...e.style};if(e.attributes)a.attributes={...a.attributes,...e.attributes};if(e.$head)a._pageHead=e.$head;if(e.title)a._pageTitle=e.title;return delete a.$layout,a}function PO(e,t){let r=new Map,n=[];for(let s of t){let i=F(s)?s.attributes?.slot:void 0;if(i){let o=r.get(i);if(!o)o=[],r.set(i,o);o.push(s)}else n.push(s)}Xg(e,r,n)}function Xg(e,t,r){if(!F(e))return;if(!Array.isArray(e.children))return;let n=[];for(let s of e.children)if(F(s)&&s.tagName==="slot"){let i=s.attributes?.name,o=i?t.get(i):void 0;if(i&&o)n.push(...o),t.delete(i);else if(!i&&r.length>0)n.push(...r);else if(Array.isArray(s.children))n.push(...s.children)}else Xg(s,t,r),n.push(s);e.children=n}function jO(e){return structuredClone(e)}var Zg=q(()=>{$e()});import{existsSync as kO,readFileSync as RO}from"node:fs";import{resolve as Qg}from"node:path";function ey(e){return(t)=>{let r=Qg(e,t);if(!kO(r))throw Error(`Layout not found: ${t} (resolved to ${r})`);try{return jn(RO(r,"utf8"),r)}catch(n){throw Error(`Invalid layout JSON at ${r}: ${we(n)}`,{cause:n})}}}function ty(e,t,r){return qu(e,t,ey(r))}function ry(e,t,r){let n=ey(r),s=[],i=e.$layout??t.defaults?.layout;while(i){let o=Qg(r,i);if(s.some((l)=>l.path===o))break;let a=n(i);s.push({doc:a,path:o}),i=a.$layout}return s}var ny=q(()=>{nr();Zg()});import{dirname as AO,relative as OO,resolve as CO,sep as TO}from"node:path";function sy(e,t){return OO(t,e).split(TO).join("/")}function NO(e,t,r){if(!e.startsWith("./")&&!e.startsWith("../"))return e;return`./${sy(CO(t,e),r)}`}function ao(e,t,r){let n=AO(t),s=sy(t,r);return cg(e).map((i)=>({exportName:i.exportName,src:NO(i.src,n,r),declaredIn:s}))}function iy(e){let t=new Map;for(let{exportName:s,src:i,declaredIn:o}of e){let a=t.get(s)??new Map;if(t.set(s,a),!a.has(i))a.set(i,o)}let r=[],n=[];for(let[s,i]of t){let o=[...i];if(r.push({exportName:s,src:o[0][0]}),o.length>1){let a=o.map(([l,c])=>`${l} (declared in ${c})`);n.push(`Server function "${s}" is exported by ${o.length} different modules: ${a.join(", ")}. The site worker serves one function per export name, at /_jx/server/${s}, so a call meant for any but the first would get the first's answer. Rename the export in all but one module, and the $export that names it.`)}}return{entries:r,errors:n}}var oy=q(()=>{Mr()});function ay(e,t){if(!N(t)||t.trim()==="")return[...e];return[{attributes:{content:t,name:"description"},tagName:"meta"},...e]}function ly(e=[],t=[],r=[],n={}){let s=[{attributes:{charset:n.charset??"utf8"},tagName:"meta"},{attributes:{content:"width=device-width, initial-scale=1",name:"viewport"},tagName:"meta"}],i=new Map;for(let a of[...s,...e,...t,...r]){let l=Hu(a);i.set(l,a)}let o=n.title??n.siteName??"Jx Site";if(i.set("title",{children:[o],tagName:"title"}),n.pageUrl&&n.siteUrl){let a=An(n.pageUrl,n.siteUrl);if(![...i.values()].some((c)=>F(c)&&c.tagName==="link"&&c.attributes?.rel==="canonical")){let c={attributes:{href:a,rel:"canonical"},tagName:"link"};i.set(Hu(c),c)}if(!i.has("meta:og:url"))i.set("meta:og:url",{attributes:{content:a,property:"og:url"},tagName:"meta"})}if(n.siteName&&!i.has("meta:og:site_name"))i.set("meta:og:site_name",{attributes:{content:n.siteName,property:"og:site_name"},tagName:"meta"});for(let a of n.alternates??[]){let l={attributes:{href:a.href,hreflang:a.hreflang,rel:"alternate"},tagName:"link"},c=Hu(l);if(!i.has(c))i.set(c,l)}return[...i.values()]}function Hu(e){if(!F(e))return String(e);let t=e.tagName??"unknown",r=e.attributes??{};if(t==="title")return"title";if(r.charset)return"meta:charset";if(t==="meta"&&r.name)return`meta:${r.name}`;if(t==="meta"&&r.property)return`meta:${r.property}`;if(t==="link"&&r.rel){let n=r.hreflang??r.type??r.media??r.sizes??"";return`link:${r.rel}:${r.href??""}:${String(n)}`}if(t==="script"&&r.src)return`script:${r.src}`;if(t==="style"){let n=Array.isArray(e.children)?e.children.join(""):e.textContent,s=F(n)?JSON.stringify(n):n??"";return`style:${IO(s)}`}return`${t}:${JSON.stringify(e)}`}function IO(e){let t=0;for(let r=0;r<e.length;r++)t=Math.trunc((t<<5)-t+(e.codePointAt(r)??0));return t.toString(36)}function cy(e){return e.map((t)=>MO(t)).join(`
103
+ `)}function MO(e){if(N(e))return e;if(!F(e))return"";let t=e.tagName,r=e.attributes??{},n=Object.entries(r).map(([l,c])=>c===!0?l:`${l}="${JO(c)}"`).join(" "),s=n?`<${t} ${n}>`:`<${t}>`;if(t!==void 0&&new Set(["meta","link","base","br","hr","img","input"]).has(t))return s;let o=Array.isArray(e.children)?e.children.join(""):e.textContent,a=F(o)?JSON.stringify(o,null,2):o??"";return`${s}${a}</${t}>`}function JO(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}var uy=q(()=>{sr();$e()});function FO(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 qO(e){if(!N(e))return[];return e.split(/\s+/).filter((t)=>{if(t==="")return!1;let r=t.toLowerCase();return!DO.has(r)&&!LO.has(r)&&!FO(t)})}function dy(e){let t=new Set;for(let r of e){if(!F(r)||r.tagName!=="link")continue;for(let n of qO(r.attributes?.rel))t.add(n)}return[...t]}var DO,LO;var fy=q(()=>{$e();DO=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"]),LO=new Set(["shortcut"])});async function tl(e,t={}){let{resolveElementPath:r,$media:n,formats:s}=t,i=[],o=new Set;async function a(l,c){let u,p;if(N(l)){let{readFileSync:_}=await import("node:fs"),{resolve:E}=await import("node:path");if(p=c?E(c,l):E(l),o.has(p))return;if(o.add(p),p.endsWith(".json"))u=jn(_(p,"utf8"),p);else{let{extname:O}=await import("node:path"),R=O(p).toLowerCase(),k=s?.byExtension(R,"parse");if(!k){await Promise.resolve().then(() => nn());throw ua(p,R)}u=await k.parseDocument(_(p,"utf8"))}}else{if(u=l,p=null,u.tagName&&o.has(u.tagName))return;if(u.tagName)o.add(u.tagName)}let{tagName:g}=u;if(!g||!g.includes("-"))throw Error(`compileElement: tagName "${g}" must contain a hyphen`);let{dirname:m}=await import("node:path"),b=p?m(p):null,h=[];if(Array.isArray(u.$elements))for(let _ of u.$elements){let E=Ce(_)?_.$ref:_;if(!N(E))continue;if(b)await a(E,b);let O=r?r(E,b):E.replace(/\.json$/,".js");h.push(O)}let y=Ba(g);if(n)u.$media={...n,...u.$media};let{rewriteSrc:v}=t,j=lo(u,y,h,v?(_)=>v(_,b):void 0,bs(u,t.defaults),t.serverBaseUrl),S=p?p.replace(/\.json$/,".js"):`${g}.js`;i.push({content:j,path:S,tagName:g})}return await a(e,t.basePath??null),{files:i}}async function HO(e,t={}){let{title:r="Jx App",reactivitySrc:n="https://esm.sh/@vue/reactivity@3.5.13",litHtmlSrc:s="https://esm.sh/lit-html@3.3.0"}=t,i=await tl(e,t),o=i.files.at(-1);if(!o)throw Error("compileElementPage: no element modules were produced");let{basename:a}=await import("node:path"),l=a(o.path),c=`<!DOCTYPE html>
104
104
  <html lang="en">
105
105
  <head>
106
106
  <meta charset="utf-8">
107
107
  <meta name="viewport" content="width=device-width, initial-scale=1">
108
- <title>${$e(r)}</title>
108
+ <title>${ve(r)}</title>
109
109
  <script type="importmap">
110
110
  {
111
111
  "imports": {
@@ -119,11 +119,11 @@ ${n}
119
119
  <${o.tagName}></${o.tagName}>
120
120
  <script type="module" src="./${l}"></script>
121
121
  </body>
122
- </html>`;return{files:i.files,html:c}}function SO(e){if(!F(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Pn(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(tn(e))return"null";return JSON.stringify(e)}function EO(e){let t=new Set,r=new Set,n=(i)=>{if(i.startsWith("#/state/"))t.add(i.slice(8).split("/")[0])},s=(i)=>{if(T(i)){for(let a of i.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/g))t.add(a[1]);return}if(!F(i)||r.has(i))return;if(r.add(i),Array.isArray(i)){for(let a of i)s(a);return}let o=i;if(o.operator==="call"&&Ce(o.target))n(o.target.$ref);for(let[a,l]of Object.entries(o)){if(a.startsWith("on")&&a!=="observedAttributes"&&Ce(l))n(l.$ref);s(l)}};return s(e.children),s(e.state),t}function ao(e,t,r,n,s=null,i="/_jx/server"){let o=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)o.push(`// Source: ${e.$id}`);for(let R of r)o.push(`import '${R}';`);let a=new Map,l=new Map,c=e.state??{},d=EO(e);for(let[R,k]of Object.entries(c))if(er(k)&&k.$src){let I=k.$src;if(k.$lazy===!0){if(!d.has(R)&&!ty.has(R))throw Error(`"${R}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${R}() from a handler instead of binding its value.`);let M=l.get(I);if(!M)M=[],l.set(I,M);M.push({binding:R,exportName:hu(R,k)});continue}let D=a.get(I);if(!D)D=[],a.set(I,D);D.push(Ia(R,k))}for(let[R,k]of a){let I=n?n(R):R;o.push(`import { ${k.join(", ")} } from '${I}';`)}let p=Object.entries(c).flatMap(([R,k])=>Cr(k)&&k.$prototype==="Request"?[[R,k]]:[]),h=Object.entries(c).flatMap(([R,k])=>tn(k)?[[R,k]]:[]);if(o.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",Fa()),h.length>0)o.push(qa());let m=s===null&&Nn(e.children);if(m)o.push(Xh());let b=0;for(let[R,k]of l){let I=n?n(R):R,D=`_jxLazy${b}`;b+=1,o.push(`let ${D};`,`const ${D}Load = () => (${D} ??= import('${I}'));`,...k.map(({binding:M,exportName:L})=>`const ${M} = (...args) => ${D}Load().then((m) => m.${L}(...args));`))}o.push("",`class ${t} extends HTMLElement {`," #effects = [];",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let g=[],y=[],v=[],j=[],S=[];for(let[R,k]of Object.entries(c))if(tr(k))if(ns(k))j.push([R,k]);else if(dn(k.$expression.operator))v.push([R,k]);else y.push([R,k]);else if(er(k))if(k.$src&&!T(k.body))if(d.has(R)||ty.has(R))v.push([R,k]);else y.push([R,k]);else if(T(k.body)&&ss(k.body))y.push([R,k]);else v.push([R,k]);else if(T(k)&&k.includes("${"))S.push([R,k]);else{let I=SO(k);if(I!==void 0)g.push([R,I])}o.push(" this.state = reactive({");for(let[R,k]of g)o.push(` ${un(R)}: ${k},`);o.push(" });");for(let[R,k]of v)if(o.push(""),tr(k)){let I=At(k.$expression,{eventParam:"e",statePrefix:"s"});o.push(` ${Pe("this.state",dt(R))} = (s, e) => { ${I}; };`)}else if(_n(k)){let I=fr(k.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = (s, e) => {`,I," };")}else{let I=k.parameters?rn(k.parameters):k.arguments??["state"],D=I.join(", "),M=T(k.body)?k.body:"";if(I[0]==="state")if(k.$src)o.push(` ${Pe("this.state",dt(R))} = (${D}) => ${R}(${D});`);else o.push(` ${Pe("this.state",dt(R))} = (${D}) => {`,` ${M}`," };");else{let L=I.map((W)=>W==="state"?"state":"e").join(", ");if(k.$src)o.push(` ${Pe("this.state",dt(R))} = (state, e) => ${R}(${L});`);else o.push(` ${Pe("this.state",dt(R))} = (state, e) => {`,` const _fn = (${D}) => {`,` ${M}`," };",` return _fn(${L});`," };")}}for(let[R,k]of j){o.push("");let I=At(k.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = ${no(k,I)};`)}for(let[R,k]of S)o.push("",` ${Pe("this.state",dt(R))} = computed(() => ${La(k.replaceAll("state.","this.state."))});`);for(let[R,k]of y)if(o.push(""),tr(k)){let I=At(k.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = computed(() => ${I});`)}else if(k.$src)o.push(` ${Pe("this.state",dt(R))} = computed(() => ${R}(this.state));`);else{o.push(` ${Pe("this.state",dt(R))} = computed(() => {`);let I=(T(k.body)?k.body:"").replaceAll("state.","this.state.");o.push(` ${I}`," });")}o.push(" }","");let P=[];if(Array.isArray(e.children)){let R={n:0};for(let k of e.children)Tn(k,P,e.$media??{},"",R,e.tagName)}let E=sy(),O=!Array.isArray(e.children)&&e.textContent!==void 0?` ${Za(e.textContent)}`:Ya(e.children,e.style," ",!1,!1,E);o.push(" template() {"," const s = this.state;",...E.decls," return html`",O," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[R,k]of p)o.push(Ma(R,k,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[R,k]of h)o.push(Ja(R,k,{collect:"this.#effects",indent:" ",serverBaseUrl:i,statePrefix:"this.state"}));if(F(e.style)){let R=[];for(let[k,I]of Object.entries(e.style)){if(k.startsWith(":")||k.startsWith(".")||k.startsWith("&")||k.startsWith("[")||k.startsWith("@"))continue;if(T(I)&&I.includes("${"))R.push([Vt(k),I])}if(R.length>0){o.push(" this.#effects.push(effect(() => {");for(let[k,I]of R){let D=I.replaceAll(/\$\{([^}]+)\}/g,(M,L)=>`\${${L.replaceAll("state.","this.state.")}}`);o.push(` this.style['${k}'] = \`${D}\`;`)}o.push(" }));")}}if(m)o.push(` const _slotted = ${yu}(this);`);if(o.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)o.push(" this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else o.push(" const _root = this.#renderRoot();"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(m)o.push(` ${bu}(this, _slotted);`);return o.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),o.join(`
123
- `)}function sy(){return{byText:new Map,decls:[]}}function iy(e,t){let r=e.byText.get(t);if(r)return r;let n=`_c${e.decls.length}`;e.decls.push(` const ${n} = html\`
122
+ </html>`;return{files:i.files,html:c}}function VO(e){if(!F(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Pn(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(tn(e))return"null";return JSON.stringify(e)}function BO(e){let t=new Set,r=new Set,n=(i)=>{if(i.startsWith("#/state/"))t.add(i.slice(8).split("/")[0])},s=(i)=>{if(N(i)){for(let a of i.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/g))t.add(a[1]);return}if(!F(i)||r.has(i))return;if(r.add(i),Array.isArray(i)){for(let a of i)s(a);return}let o=i;if(o.operator==="call"&&Ce(o.target))n(o.target.$ref);for(let[a,l]of Object.entries(o)){if(a.startsWith("on")&&a!=="observedAttributes"&&Ce(l))n(l.$ref);s(l)}};return s(e.children),s(e.state),t}function lo(e,t,r,n,s=null,i="/_jx/server"){let o=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)o.push(`// Source: ${e.$id}`);for(let R of r)o.push(`import '${R}';`);let a=new Map,l=new Map,c=e.state??{},u=BO(e);for(let[R,k]of Object.entries(c))if(tr(k)&&k.$src){let I=k.$src;if(k.$lazy===!0){if(!u.has(R)&&!py.has(R))throw Error(`"${R}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${R}() from a handler instead of binding its value.`);let M=l.get(I);if(!M)M=[],l.set(I,M);M.push({binding:R,exportName:xu(R,k)});continue}let D=a.get(I);if(!D)D=[],a.set(I,D);D.push(Ma(R,k))}for(let[R,k]of a){let I=n?n(R):R;o.push(`import { ${k.join(", ")} } from '${I}';`)}let p=Object.entries(c).flatMap(([R,k])=>Tr(k)&&k.$prototype==="Request"?[[R,k]]:[]),g=Object.entries(c).flatMap(([R,k])=>tn(k)?[[R,k]]:[]);if(o.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",qa()),g.length>0)o.push(Ha());let m=s===null&&Tn(e.children);if(m)o.push(lg());let b=0;for(let[R,k]of l){let I=n?n(R):R,D=`_jxLazy${b}`;b+=1,o.push(`let ${D};`,`const ${D}Load = () => (${D} ??= import('${I}'));`,...k.map(({binding:M,exportName:L})=>`const ${M} = (...args) => ${D}Load().then((m) => m.${L}(...args));`))}o.push("",`class ${t} extends HTMLElement {`," #effects = [];",...s===null?[]:[" #root = null;"],""," constructor() {"," super();");let h=[],y=[],v=[],j=[],S=[];for(let[R,k]of Object.entries(c))if(rr(k))if(ns(k))j.push([R,k]);else if(dn(k.$expression.operator))v.push([R,k]);else y.push([R,k]);else if(tr(k))if(k.$src&&!N(k.body))if(u.has(R)||py.has(R))v.push([R,k]);else y.push([R,k]);else if(N(k.body)&&ss(k.body))y.push([R,k]);else v.push([R,k]);else if(N(k)&&k.includes("${"))S.push([R,k]);else{let I=VO(k);if(I!==void 0)h.push([R,I])}o.push(" this.state = reactive({");for(let[R,k]of h)o.push(` ${un(R)}: ${k},`);o.push(" });");for(let[R,k]of v)if(o.push(""),rr(k)){let I=At(k.$expression,{eventParam:"e",statePrefix:"s"});o.push(` ${Pe("this.state",dt(R))} = (s, e) => { ${I}; };`)}else if(_n(k)){let I=fr(k.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = (s, e) => {`,I," };")}else{let I=k.parameters?rn(k.parameters):k.arguments??["state"],D=I.join(", "),M=N(k.body)?k.body:"";if(I[0]==="state")if(k.$src)o.push(` ${Pe("this.state",dt(R))} = (${D}) => ${R}(${D});`);else o.push(` ${Pe("this.state",dt(R))} = (${D}) => {`,` ${M}`," };");else{let L=I.map((W)=>W==="state"?"state":"e").join(", ");if(k.$src)o.push(` ${Pe("this.state",dt(R))} = (state, e) => ${R}(${L});`);else o.push(` ${Pe("this.state",dt(R))} = (state, e) => {`,` const _fn = (${D}) => {`,` ${M}`," };",` return _fn(${L});`," };")}}for(let[R,k]of j){o.push("");let I=At(k.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = ${so(k,I)};`)}for(let[R,k]of S)o.push("",` ${Pe("this.state",dt(R))} = computed(() => ${Fa(k.replaceAll("state.","this.state."))});`);for(let[R,k]of y)if(o.push(""),rr(k)){let I=At(k.$expression,{eventParam:"e",statePrefix:"this.state"});o.push(` ${Pe("this.state",dt(R))} = computed(() => ${I});`)}else if(k.$src)o.push(` ${Pe("this.state",dt(R))} = computed(() => ${R}(this.state));`);else{o.push(` ${Pe("this.state",dt(R))} = computed(() => {`);let I=(N(k.body)?k.body:"").replaceAll("state.","this.state.");o.push(` ${I}`," });")}o.push(" }","");let _=[];if(Array.isArray(e.children)){let R={n:0};for(let k of e.children)Nn(k,_,e.$media??{},"",R,e.tagName)}let E=gy(),O=!Array.isArray(e.children)&&e.textContent!==void 0?` ${rl(e.textContent)}`:el(e.children,e.style," ",!1,!1,E);o.push(" template() {"," const s = this.state;",...E.decls," return html`",O," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?" this.#root = this.attachInternals().shadowRoot ?? this.attachShadow({ mode: 'closed' });":" this.#root = this.shadowRoot ?? this.attachShadow({ mode: 'open' });"," return this.#root;"," }",""]," connectedCallback() {"," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;"," if (k in this.state) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (_k in this.state) {"," this.state[_k] = this.getAttribute(_n);"," this.removeAttribute(_n);"," }"," }"," for (const key of Object.keys(this.state)) {"," if (key.startsWith('#')) continue;"," if (this.hasOwnProperty(key) && this[key] !== undefined) {"," this.state[key] = this[key];"," }"," }");for(let[R,k]of p)o.push(Ja(R,k,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[R,k]of g)o.push(Da(R,k,{collect:"this.#effects",indent:" ",serverBaseUrl:i,statePrefix:"this.state"}));if(F(e.style)){let R=[];for(let[k,I]of Object.entries(e.style)){if(k.startsWith(":")||k.startsWith(".")||k.startsWith("&")||k.startsWith("[")||k.startsWith("@"))continue;if(N(I)&&I.includes("${"))R.push([Bt(k),I])}if(R.length>0){o.push(" this.#effects.push(effect(() => {");for(let[k,I]of R){let D=I.replaceAll(/\$\{([^}]+)\}/g,(M,L)=>`\${${L.replaceAll("state.","this.state.")}}`);o.push(` this.style['${k}'] = \`${D}\`;`)}o.push(" }));")}}if(m)o.push(` const _slotted = ${vu}(this);`);if(o.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)o.push(" this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else o.push(" const _root = this.#renderRoot();"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(m)o.push(` ${wu}(this, _slotted);`);return o.push(" if (typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount(this.state));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }","}","",`customElements.define('${e.tagName}', ${t});`,""),o.join(`
123
+ `)}function gy(){return{byText:new Map,decls:[]}}function yy(e,t){let r=e.byText.get(t);if(r)return r;let n=`_c${e.decls.length}`;e.decls.push(` const ${n} = html\`
124
124
  ${t}
125
- \`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function Ya(e,t,r,n=!1,s=!1,i=null,o=!1){if(!e)return"";let a=o?ei:"";if(Qe(e))return`${ny(e,r)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(Qe(l))return`${ny(l,r)}${a}`;let c=Mu(l,n?"":r,n,s,i);return T(l)&&l.includes("${")||F(l)&&Nr(l.tagName)?`${c}${a}`:c}).join(n?"":`
126
- `)}function Mu(e,t,r=!1,n=!1,s=null,i=null){if(T(e)){if(e.includes("${"))return`${t}${Za(e)}`;return`${t}${$e(e)}`}if(lr(e)||$t(e))return`${t}${$e(String(e))}`;if(!F(e))return"";if(Nr(e.tagName)){let g=e.tagName.$expression,y=fn(g.target,{eventParam:"e",statePrefix:"s"}),v=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],j=v.map(([,k])=>k),S=j.map((k)=>r||In.has(k)),P=null;if(s&&S.every((k)=>k===S[0])){let k=ry(e,`${t} `,S[0]===!0,n,s,j.some((I)=>I.includes("-")));if(k.trim()!=="")P=iy(s,k)}let E=v.map(([k,I])=>{let D={...e,tagName:I};return[k,Mu(D,`${t} `,r,n,s,P)]});if(g.operator==="?:"){let[,k]=E[0],[,I]=E[1];return`${t}\${${y}
125
+ \`;`);let s=`\${${n}}`;return e.byText.set(t,s),s}function el(e,t,r,n=!1,s=!1,i=null,o=!1){if(!e)return"";let a=o?ti:"";if(Qe(e))return`${hy(e,r)}${a}`;if(!Array.isArray(e))return"";return e.map((l)=>{if(Qe(l))return`${hy(l,r)}${a}`;let c=Bu(l,n?"":r,n,s,i);return N(l)&&l.includes("${")||F(l)&&Nr(l.tagName)?`${c}${a}`:c}).join(n?"":`
126
+ `)}function Bu(e,t,r=!1,n=!1,s=null,i=null){if(N(e)){if(e.includes("${"))return`${t}${rl(e)}`;return`${t}${ve(e)}`}if(Ft(e)||$t(e))return`${t}${ve(String(e))}`;if(!F(e))return"";if(Nr(e.tagName)){let h=e.tagName.$expression,y=fn(h.target,{eventParam:"e",statePrefix:"s"}),v=h.operator==="?:"?[[!0,h.value],[!1,h.initial]]:[...Object.entries(h.cases),["__default__",h.default]],j=v.map(([,k])=>k),S=j.map((k)=>r||In.has(k)),_=null;if(s&&S.every((k)=>k===S[0])){let k=my(e,`${t} `,S[0]===!0,n,s,j.some((I)=>I.includes("-")));if(k.trim()!=="")_=yy(s,k)}let E=v.map(([k,I])=>{let D={...e,tagName:I};return[k,Bu(D,`${t} `,r,n,s,_)]});if(h.operator==="?:"){let[,k]=E[0],[,I]=E[1];return`${t}\${${y}
127
127
  ? html\`
128
128
  ${k}
129
129
  \`
@@ -136,25 +136,25 @@ ${O.join(`,
136
136
  `)}
137
137
  }[String(${y})] ?? html\`
138
138
  ${R}
139
- \`}`}let o=e.tagName??"div",a=r||In.has(o),l=[];if(e.attributes)for(let[g,y]of Object.entries(e.attributes))if(Ce(y))l.push(`${g}="\${${Qs}('${g}', ${Jr(y.$ref)}) ?? nothing}"`);else if(T(y)&&_O(y))l.push(`${g}="\${${Qs}('${g}', ${or(y).slice(2,-1)}) ?? nothing}"`);else if(T(y)&&y.includes("${"))l.push(`${g}="${or(y)}"`);else if($t(y)){let v=gs(g,y);if(v!==null)l.push(v===""?g:`${g}="${v}"`)}else l.push(`${g}="${y}"`);if(e.id)l.push(`id="${or(String(e.id))}"`);if(e.className)l.push(`class="${or(String(e.className))}"`);for(let[g,y]of Object.entries(e)){if(pn.has(g)||g.startsWith("$")||g.startsWith("on")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Ka(y))l.push(`.${g}="\${${Jr(y.$ref)}}"`);else if(T(y)&&y.includes("${"))l.push(`.${g}="${or(y)}"`);else l.push(`.${g}="\${${JSON.stringify(y)}}"`)}if(e.$props)for(let[g,y]of Object.entries(e.$props))if(Ka(y))l.push(`.${g}="\${${Jr(y.$ref)}}"`);else if(T(y)&&y.includes("${"))l.push(`.${g}="${or(y)}"`);else l.push(`.${g}="\${${JSON.stringify(y)}}"`);let c=n?"s.$map = $map; ":"";for(let[g,y]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;let v=g.slice(2).toLowerCase();if(Ka(y))l.push(c?`@${v}="\${(e) => { ${c}${Jr(y.$ref)}(s, e); }}"`:`@${v}="\${(e) => ${Jr(y.$ref)}(s, e)}"`);else if(F(y)&&"$expression"in y){let j=At(y.$expression,{eventParam:"e",statePrefix:"s"});l.push(`@${v}="\${(e) => { ${c}${j}; }}"`)}else if(er(y))l.push(`@${v}="\${(e) => { ${c}${PO(y)} }}"`)}let d=ay(e.style);if(d)l.push(`style="${d}"`);let p=l.length>0?`
139
+ \`}`}let o=e.tagName??"div",a=r||In.has(o),l=[];if(e.attributes)for(let[h,y]of Object.entries(e.attributes))if(Ce(y))l.push(`${h}="\${${ei}('${h}', ${Jr(y.$ref)}) ?? nothing}"`);else if(N(y)&&WO(y))l.push(`${h}="\${${ei}('${h}', ${ar(y).slice(2,-1)}) ?? nothing}"`);else if(N(y)&&y.includes("${"))l.push(`${h}="${ar(y)}"`);else if($t(y)){let v=ys(h,y);if(v!==null)l.push(v===""?h:`${h}="${v}"`)}else l.push(`${h}="${y}"`);if(e.id)l.push(`id="${ar(String(e.id))}"`);if(e.className)l.push(`class="${ar(String(e.className))}"`);for(let[h,y]of Object.entries(e)){if(pn.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(Qa(y))l.push(`.${h}="\${${Jr(y.$ref)}}"`);else if(N(y)&&y.includes("${"))l.push(`.${h}="${ar(y)}"`);else l.push(`.${h}="\${${JSON.stringify(y)}}"`)}if(e.$props)for(let[h,y]of Object.entries(e.$props))if(Qa(y))l.push(`.${h}="\${${Jr(y.$ref)}}"`);else if(N(y)&&y.includes("${"))l.push(`.${h}="${ar(y)}"`);else l.push(`.${h}="\${${JSON.stringify(y)}}"`);let c=n?"s.$map = $map; ":"";for(let[h,y]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;let v=h.slice(2).toLowerCase();if(Qa(y))l.push(c?`@${v}="\${(e) => { ${c}${Jr(y.$ref)}(s, e); }}"`:`@${v}="\${(e) => ${Jr(y.$ref)}(s, e)}"`);else if(F(y)&&"$expression"in y){let j=At(y.$expression,{eventParam:"e",statePrefix:"s"});l.push(`@${v}="\${(e) => { ${c}${j}; }}"`)}else if(tr(y))l.push(`@${v}="\${(e) => { ${c}${UO(y)} }}"`)}let u=xy(e.style);if(u)l.push(`style="${u}"`);let p=l.length>0?`
140
140
  ${t} ${l.join(`
141
141
  ${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(o))return`${t}<${o}${p}
142
- ${t}>`;let m=i??ry(e,t,a,n,s,o.includes("-")),b=o==="slot"?ei:"";return a?`${b}<${o}${p}>${m}${b}</${o}>`:`${t}${b}<${o}${p}
143
- ${t}>${m}${b}</${o}>`}function ry(e,t,r,n,s,i=!1){if(e.$switch){let o=Ce(e.$switch)?e.$switch.$ref:e.$switch,a=Jr(o),l=[];for(let[h,m]of Object.entries(e.cases??{})){if(!m||Ce(m))continue;l.push([h,Mu(m,`${t} `,!1,n,s)])}let c=l.map(([,h])=>h),d=new Set(c.filter((h,m)=>c.indexOf(h)!==m&&h.trim()!==""));return`\${{
144
- ${l.map(([h,m])=>{let b=s&&d.has(m)?iy(s,m):m;return` ${JSON.stringify(h)}: html\`
142
+ ${t}>`;let m=i??my(e,t,a,n,s,o.includes("-")),b=o==="slot"?ti:"";return a?`${b}<${o}${p}>${m}${b}</${o}>`:`${t}${b}<${o}${p}
143
+ ${t}>${m}${b}</${o}>`}function my(e,t,r,n,s,i=!1){if(e.$switch){let o=Ce(e.$switch)?e.$switch.$ref:e.$switch,a=Jr(o),l=[];for(let[g,m]of Object.entries(e.cases??{})){if(!m||Ce(m))continue;l.push([g,Bu(m,`${t} `,!1,n,s)])}let c=l.map(([,g])=>g),u=new Set(c.filter((g,m)=>c.indexOf(g)!==m&&g.trim()!==""));return`\${{
144
+ ${l.map(([g,m])=>{let b=s&&u.has(m)?yy(s,m):m;return` ${JSON.stringify(g)}: html\`
145
145
  ${b}
146
146
  \``}).join(`,
147
147
  `)}
148
- }[${a}]}`}if(e.textContent!==void 0){let o=Za(e.textContent),a=Ce(e.textContent)||T(e.textContent)&&e.textContent.includes("${");return i&&a?`${o}${ei}`:o}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return r?Ya(e.children,e.style,"",!0,n,s,i):`
149
- ${Ya(e.children,e.style,`${t} `,!1,n,s,i)}
150
- ${t}`;return""}function ny(e,t){let r=Ce(e.items)?Jr(e.items.$ref):"ITEMS",n=e.map;if(!n)return"";let s=n.tagName??"div",i=[];if(n.attributes)for(let[m,b]of Object.entries(n.attributes))if(Ce(b))i.push(`${m}="\${${Iu(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`${m}="${or(b)}"`);else i.push(`${m}="${b}"`);if(n.id)i.push(`id="${or(String(n.id))}"`);if(n.className)i.push(`class="${or(String(n.className))}"`);for(let[m,b]of Object.entries(n)){if(pn.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(Ka(b))i.push(`.${m}="\${${Iu(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`.${m}="${or(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`)}if(n.$props)for(let[m,b]of Object.entries(n.$props))if(Ce(b))i.push(`.${m}="\${${Iu(b.$ref)}}"`);else if(T(b)&&b.includes("${"))i.push(`.${m}="${or(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`);let o=ay(n.style);if(o)i.push(`style="${o}"`);for(let[m,b]of Object.entries(n)){if(!m.startsWith("on"))continue;let g=m.slice(2).toLowerCase();if(Ce(b))i.push(`@${g}="\${(e) => { s.$map = $map; ${Jr(b.$ref)}(s, e); }}"`);else if(tr(b)){let y=At(b.$expression,{eventParam:"e",statePrefix:"s"});i.push(`@${g}="\${(e) => { s.$map = $map; ${y}; }}"`)}}let a=i.length>0?`
148
+ }[${a}]}`}if(e.textContent!==void 0){let o=rl(e.textContent),a=Ce(e.textContent)||N(e.textContent)&&e.textContent.includes("${");return i&&a?`${o}${ti}`:o}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return r?el(e.children,e.style,"",!0,n,s,i):`
149
+ ${el(e.children,e.style,`${t} `,!1,n,s,i)}
150
+ ${t}`;return""}function hy(e,t){let r=Ce(e.items)?Jr(e.items.$ref):"ITEMS",n=e.map;if(!n)return"";let s=n.tagName??"div",i=[];if(n.attributes)for(let[m,b]of Object.entries(n.attributes))if(Ce(b))i.push(`${m}="\${${Vu(b.$ref)}}"`);else if(N(b)&&b.includes("${"))i.push(`${m}="${ar(b)}"`);else i.push(`${m}="${b}"`);if(n.id)i.push(`id="${ar(String(n.id))}"`);if(n.className)i.push(`class="${ar(String(n.className))}"`);for(let[m,b]of Object.entries(n)){if(pn.has(m)||m.startsWith("$")||m.startsWith("on")||m==="tagName"||m==="id"||m==="className"||m==="style"||m==="children"||m==="textContent"||m==="innerHTML"||m==="attributes")continue;if(Qa(b))i.push(`.${m}="\${${Vu(b.$ref)}}"`);else if(N(b)&&b.includes("${"))i.push(`.${m}="${ar(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`)}if(n.$props)for(let[m,b]of Object.entries(n.$props))if(Ce(b))i.push(`.${m}="\${${Vu(b.$ref)}}"`);else if(N(b)&&b.includes("${"))i.push(`.${m}="${ar(b)}"`);else i.push(`.${m}="\${${JSON.stringify(b)}}"`);let o=xy(n.style);if(o)i.push(`style="${o}"`);for(let[m,b]of Object.entries(n)){if(!m.startsWith("on"))continue;let h=m.slice(2).toLowerCase();if(Ce(b))i.push(`@${h}="\${(e) => { s.$map = $map; ${Jr(b.$ref)}(s, e); }}"`);else if(rr(b)){let y=At(b.$expression,{eventParam:"e",statePrefix:"s"});i.push(`@${h}="\${(e) => { s.$map = $map; ${y}; }}"`)}}let a=i.length>0?`
151
151
  ${t} ${i.join(`
152
- ${t} `)}`:"",l=sy(),c="";if(n.textContent!==void 0)c=Za(n.textContent);else if(n.children)c=`
153
- ${Ya(n.children,null,`${t} `,!1,!0,l)}
154
- ${t} `;let d=`html\`
152
+ ${t} `)}`:"",l=gy(),c="";if(n.textContent!==void 0)c=rl(n.textContent);else if(n.children)c=`
153
+ ${el(n.children,null,`${t} `,!1,!0,l)}
154
+ ${t} `;let u=`html\`
155
155
  ${t} <${s}${a}
156
156
  ${t} >${c}</${s}>
157
- ${t}\``,p=(d.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),h=p?`(item, index) => { ${p}return ${d}; }`:`(item, index) => ${d}`;return`${t}\${${r}.map(${h})}`}function Ka(e){return Ce(e)&&e.$ref!==""}function Jr(e){if(e.startsWith("#/state/"))return Pe("s",e.slice(8));if(e.startsWith("$map/"))return oy(e.slice(5));if(e.startsWith("parent#/"))return Pe("s",e.slice(8));if(e.startsWith("window#/"))return Pe("window",e.slice(8));if(e.startsWith("document#/"))return Pe("document",e.slice(10));return Pe("s",e)}function oy(e){let[t,...r]=cn(e);return Pe(t??"",r.map((n)=>dt(n)).join("/"))}function Iu(e){if(e.startsWith("$map/"))return oy(e.slice(5));return Jr(e)}function or(e){return e.replaceAll("state.","s.")}function _O(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function Za(e){if(Ce(e))return`\${${Jr(e.$ref)}}`;if(T(e)&&e.includes("${"))return or(e);return String(e)}function PO(e){if(_n(e))return fr(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=T(e.body)?e.body:"",r=e.parameters?rn(e.parameters):e.arguments??[];if(r.length>0){let n=r.map((s)=>s==="state"?"s":"e").join(", ");return`((${r.join(", ")}) => { ${t} })(${n});`}return t.replaceAll(/(?<!this\.)state\./g,"s.").replaceAll(/(?<!this\.)state(?!\.)/g,"s")}function ay(e){if(!F(e))return"";let t=[];for(let[r,n]of Object.entries(e)){if(r.startsWith(":")||r.startsWith(".")||r.startsWith("&")||r.startsWith("[")||r.startsWith("@"))continue;if(T(n)&&n.includes("${")){let s=Vt(r);t.push(`${s}: ${or(n)}`)}}return t.join("; ")}var ty;var lo=q(()=>{Us();Mr();ve();rr();Hs();ty=new Set(["onMount","onUnmount","onAdopted"])});function ly(e,t){let{title:r="Jx App",reactivitySrc:n,litHtmlSrc:s}=t,i=Xs(e,null,e.state??{},e.$media??{}),o=ti(e,e.$media??{},t.projectStyle??null),a=[],l=cy(e,!1,i,a),c=[],d="",p="";if(a.length>0){for(let b of a){let g=ao(b.def,b.className,[],t.rewriteSrc);c.push({content:g,path:`_islands/${b.tagName}.js`,tagName:b.tagName})}d=`<script type="importmap">
157
+ ${t}\``,p=(u.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((m)=>`${m.trim()} `).join(""),g=p?`(item, index) => { ${p}return ${u}; }`:`(item, index) => ${u}`;return`${t}\${${r}.map(${g})}`}function Qa(e){return Ce(e)&&e.$ref!==""}function Jr(e){if(e.startsWith("#/state/"))return Pe("s",e.slice(8));if(e.startsWith("$map/"))return by(e.slice(5));if(e.startsWith("parent#/"))return Pe("s",e.slice(8));if(e.startsWith("window#/"))return Pe("window",e.slice(8));if(e.startsWith("document#/"))return Pe("document",e.slice(10));return Pe("s",e)}function by(e){let[t,...r]=cn(e);return Pe(t??"",r.map((n)=>dt(n)).join("/"))}function Vu(e){if(e.startsWith("$map/"))return by(e.slice(5));return Jr(e)}function ar(e){return e.replaceAll("state.","s.")}function WO(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function rl(e){if(Ce(e))return`\${${Jr(e.$ref)}}`;if(N(e)&&e.includes("${"))return ar(e);return String(e)}function UO(e){if(_n(e))return fr(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=N(e.body)?e.body:"",r=e.parameters?rn(e.parameters):e.arguments??[];if(r.length>0){let n=r.map((s)=>s==="state"?"s":"e").join(", ");return`((${r.join(", ")}) => { ${t} })(${n});`}return t.replaceAll(/(?<!this\.)state\./g,"s.").replaceAll(/(?<!this\.)state(?!\.)/g,"s")}function xy(e){if(!F(e))return"";let t=[];for(let[r,n]of Object.entries(e)){if(r.startsWith(":")||r.startsWith(".")||r.startsWith("&")||r.startsWith("[")||r.startsWith("@"))continue;if(N(n)&&n.includes("${")){let s=Bt(r);t.push(`${s}: ${ar(n)}`)}}return t.join("; ")}var py;var co=q(()=>{zs();Mr();$e();nr();Vs();py=new Set(["onMount","onUnmount","onAdopted"])});function $y(e,t){let{title:r="Jx App",reactivitySrc:n,litHtmlSrc:s}=t,i=Zs(e,null,e.state??{},e.$media??{}),o=ri(e,e.$media??{},t.projectStyle??null),a=[],l=vy(e,!1,i,a),c=[],u="",p="";if(a.length>0){for(let b of a){let h=lo(b.def,b.className,[],t.rewriteSrc);c.push({content:h,path:`_islands/${b.tagName}.js`,tagName:b.tagName})}u=`<script type="importmap">
158
158
  {
159
159
  "imports": {
160
160
  "@vue/reactivity": "${n}",
@@ -162,29 +162,29 @@ ${t}\``,p=(d.includes("$map")?"const $map = { item, index }; ":"")+l.decls.map((
162
162
  }
163
163
  }
164
164
  </script>`,p=c.map((b)=>`<script type="module" src="./${b.path}"></script>`).join(`
165
- `)}let h=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((b)=>wr(String(b))!==null)?`<script>${Zs()}</script>
165
+ `)}let g=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((b)=>Sr(String(b))!==null)?`<script>${Qs()}</script>
166
166
  `:"",m=`<!DOCTYPE html>
167
167
  <html lang="en">
168
168
  <head>
169
169
  <meta charset="utf-8">
170
170
  <meta name="viewport" content="width=device-width, initial-scale=1">
171
- <title>${$e(r)}</title>
172
- ${h}${d}
171
+ <title>${ve(r)}</title>
172
+ ${g}${u}
173
173
  ${o}
174
174
  </head>
175
175
  <body>
176
176
  ${l}
177
177
  ${p}
178
178
  </body>
179
- </html>`;return{files:c,html:m}}function cy(e,t,r,n){if(T(e))return $e(e);if(lr(e)||$t(e))return $e(String(e));if(!F(e))return"";let s=Xs(e,r.scope,e.state??r.scopeDefs,e.$media??r.media);if(t){let c=n.length,d=`jx-island-${c}`,p=`JxIsland${c}`,h={...e,tagName:d};return n.push({className:p,def:h,tagName:d}),`<${d}></${d}>`}let i=vu(e.tagName,s.scope),o=bs(e,s.scope);if($u.has(i))return`<${i}${o}>`;let a=r.preformatted===!0||In.has(i),l=jO(e,{...s,preformatted:a},n);return`<${i}${o}>${l}</${i}>`}function jO(e,t,r){if(e.textContent!==void 0){let n=Me(e.textContent,t.scope);return n==null?"":$e(String(n))}if(e.innerHTML){let n=Me(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>cy(n,Wh(n),t,r)).join(so(t.preformatted));return""}var uy=q(()=>{Mr();lo();ve()});function Fu(e,t){let{title:r="Jx App",reactivitySrc:n=Ks,litHtmlSrc:s=Ys,modulePath:i="app.js",serverBaseUrl:o="/_jx/server"}=t,a=Xs(e,null,e.state??{},e.$media??{}),l=ti(e,e.$media??{},t.projectStyle??null),c={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},d=new Map,p=new Map,h=[],m=[],b=[],g=[],y=[],v=[],j=new Map,S=e.state??{};for(let[I,D]of Object.entries(S)){if(!F(D)||Array.isArray(D)){if(pe(D))m.push([I,`() => ${La(D)}`]);else h.push([I,D]);continue}if(tr(D)){let M=D.$expression,L=At(M,{eventParam:"e",statePrefix:"state"});if(ns(D))y.push(`state[${JSON.stringify(I)}] = ${no(D,L)};`);else if(dn(M.operator))g.push([I,{args:["state","e"],body:L}]);else m.push([I,`() => ${L}`]);continue}if(er(D)){let M=D.parameters?rn(D.parameters):D.arguments,{body:L}=D;if(Array.isArray(L)){let W=fr(L,{eventParam:"e",statePrefix:"state"});if(D.parameters&&D.parameters.length>0)y.push(`state[${JSON.stringify(I)}] = ${no(D,`(() => {
179
+ </html>`;return{files:c,html:m}}function vy(e,t,r,n){if(N(e))return ve(e);if(Ft(e)||$t(e))return ve(String(e));if(!F(e))return"";let s=Zs(e,r.scope,e.state??r.scopeDefs,e.$media??r.media);if(t){let c=n.length,u=`jx-island-${c}`,p=`JxIsland${c}`,g={...e,tagName:u};return n.push({className:p,def:g,tagName:u}),`<${u}></${u}>`}let i=_u(e.tagName,s.scope),o=xs(e,s.scope);if(Eu.has(i))return`<${i}${o}>`;let a=r.preformatted===!0||In.has(i),l=zO(e,{...s,preformatted:a},n);return`<${i}${o}>${l}</${i}>`}function zO(e,t,r){if(e.textContent!==void 0){let n=Me(e.textContent,t.scope);return n==null?"":ve(String(n))}if(e.innerHTML){let n=Me(e.innerHTML,t.scope);return n==null?e.innerHTML:String(n)}if(Array.isArray(e.children))return e.children.map((n)=>vy(n,rg(n),t,r)).join(io(t.preformatted));return""}var wy=q(()=>{Mr();co();$e()});function Gu(e,t){let{title:r="Jx App",reactivitySrc:n=Ys,litHtmlSrc:s=Xs,modulePath:i="app.js",serverBaseUrl:o="/_jx/server"}=t,a=Zs(e,null,e.state??{},e.$media??{}),l=ri(e,e.$media??{},t.projectStyle??null),c={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0},u=new Map,p=new Map,g=[],m=[],b=[],h=[],y=[],v=[],j=new Map,S=e.state??{};for(let[I,D]of Object.entries(S)){if(!F(D)||Array.isArray(D)){if(pe(D))m.push([I,`() => ${Fa(D)}`]);else g.push([I,D]);continue}if(rr(D)){let M=D.$expression,L=At(M,{eventParam:"e",statePrefix:"state"});if(ns(D))y.push(`state[${JSON.stringify(I)}] = ${so(D,L)};`);else if(dn(M.operator))h.push([I,{args:["state","e"],body:L}]);else m.push([I,`() => ${L}`]);continue}if(tr(D)){let M=D.parameters?rn(D.parameters):D.arguments,{body:L}=D;if(Array.isArray(L)){let W=fr(L,{eventParam:"e",statePrefix:"state"});if(D.parameters&&D.parameters.length>0)y.push(`state[${JSON.stringify(I)}] = ${so(D,`(() => {
180
180
  ${W}
181
- })()`)};`);else g.push([I,{args:["state","e"],body:W}])}else if(D.$src){let W=j.get(D.$src);if(!W)W=new Set,j.set(D.$src,W);W.add(Ia(I,D)),m.push([I,`() => { return ${I}(state); }`])}else if(T(L)&&ss(L))m.push([I,`() => { ${L} }`]);else g.push([I,{args:M??["state"],body:L}]);continue}if(Pn(D))continue;if(Up(D)){h.push([I,D.default]);continue}if(Cr(D)){if(D.$prototype==="LocalStorage"||D.$prototype==="SessionStorage"){let M=D.$prototype==="LocalStorage"?"localStorage":"sessionStorage",L=D.key??I,W=D.default??null;h.push([I,null]),y.push(RO(I,M,L,W));continue}if(D.$prototype==="Request"){h.push([I,null]),y.push(Ma(I,D));continue}if(D.$prototype==="Cookie"){h.push([I,null]),y.push(AO(I,D.name??I,D.default??null));continue}}if(tn(D)){h.push([I,null]),v.push(Ja(I,D,{serverBaseUrl:o}));continue}h.push([I,D])}let P=dy(e,a,d,p,c);for(let[I,D]of d)if(!b.some(([M])=>M===I))b.push([I,D]);for(let[I,D]of p)if(!g.some(([M])=>M===I))g.push([I,D]);let E=kO(h,m,b,g,y,v,j,c,n,t.rewriteSrc),O=[` "@vue/reactivity": "${n}"`,` "lit-html": "${s}"`],R=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((I)=>wr(String(I))!==null)?`<script>${Zs()}</script>
181
+ })()`)};`);else h.push([I,{args:["state","e"],body:W}])}else if(D.$src){let W=j.get(D.$src);if(!W)W=new Set,j.set(D.$src,W);W.add(Ma(I,D)),m.push([I,`() => { return ${I}(state); }`])}else if(N(L)&&ss(L))m.push([I,`() => { ${L} }`]);else h.push([I,{args:M??["state"],body:L}]);continue}if(Pn(D))continue;if(Qp(D)){g.push([I,D.default]);continue}if(Tr(D)){if(D.$prototype==="LocalStorage"||D.$prototype==="SessionStorage"){let M=D.$prototype==="LocalStorage"?"localStorage":"sessionStorage",L=D.key??I,W=D.default??null;g.push([I,null]),y.push(KO(I,M,L,W));continue}if(D.$prototype==="Request"){g.push([I,null]),y.push(Ja(I,D));continue}if(D.$prototype==="Cookie"){g.push([I,null]),y.push(YO(I,D.name??I,D.default??null));continue}}if(tn(D)){g.push([I,null]),v.push(Da(I,D,{serverBaseUrl:o}));continue}g.push([I,D])}let _=Sy(e,a,u,p,c);for(let[I,D]of u)if(!b.some(([M])=>M===I))b.push([I,D]);for(let[I,D]of p)if(!h.some(([M])=>M===I))h.push([I,D]);let E=GO(g,m,b,h,y,v,j,c,n,t.rewriteSrc),O=[` "@vue/reactivity": "${n}"`,` "lit-html": "${s}"`],R=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((I)=>Sr(String(I))!==null)?`<script>${Qs()}</script>
182
182
  `:"",k=`<!DOCTYPE html>
183
183
  <html lang="en">
184
184
  <head>
185
185
  <meta charset="utf-8">
186
186
  <meta name="viewport" content="width=device-width, initial-scale=1">
187
- <title>${$e(r)}</title>
187
+ <title>${ve(r)}</title>
188
188
  ${R}<script type="importmap">
189
189
  {
190
190
  "imports": {
@@ -197,19 +197,19 @@ ${O.join(`,
197
197
  <script type="module" src="./${i}"></script>
198
198
  </head>
199
199
  <body>
200
- ${P}
200
+ ${_}
201
201
  </body>
202
- </html>`;return{files:[{content:E,path:i}],html:k}}function dy(e,t,r,n,s){if(T(e))return $e(e);if(lr(e)||$t(e))return $e(String(e));if(!F(e))return"";let i=Xs(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Nr(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Ms(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let o=e.tagName??"div";i.preformatted=t.preformatted===!0||In.has(o);let a=[],l=!1;if(e.textContent!==void 0){let g=e.textContent;if(Bt(g)){let y=ni(g.$ref);a.push(`:text-content="${y}"`),Ju(r,y,g.$ref),l=!0}else if(pe(g)){let y=`_t${s.t}`;s.t+=1,a.push(`:text-content="${y}"`),r.set(y,`() => \`${g}\``),l=!0}}for(let[g,y]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;let v=g.slice(2).toLowerCase();if(Bt(y)){let j=ni(y.$ref);a.push(`@${v}="${j}"`),l=!0}else if(er(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${v}="${j}"`);let{body:S}=y;n.set(j,Array.isArray(S)?{args:["state","e"],body:fr(S,{eventParam:"e",statePrefix:"state"})}:{args:y.parameters?rn(y.parameters):y.arguments??["state","event"],body:S}),l=!0}else if(tr(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${v}="${j}"`);let S=At(y.$expression,{eventParam:"e",statePrefix:"state"});n.set(j,{args:["state","e"],body:S}),l=!0}}if(F(e.style))for(let[g,y]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(py(y))continue;if(pe(y)){let v=`_s${s.s}`;s.s+=1,a.push(`:style.${Vt(g)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}if(F(e.attributes)){for(let[g,y]of Object.entries(e.attributes))if(Bt(y)){let v=ni(y.$ref);a.push(`:attr.${g}="${v}"`),Ju(r,v,y.$ref),l=!0}else if(pe(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:attr.${g}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}for(let[g,y]of Object.entries(e)){if(pn.has(g)||g.startsWith("on")||g.startsWith("$")||g==="tagName"||g==="id"||g==="className"||g==="style"||g==="children"||g==="textContent"||g==="innerHTML"||g==="attributes")continue;if(Bt(y)){let v=ni(y.$ref);a.push(`:${Vt(g)}="${v}"`),Ju(r,v,y.$ref),l=!0}else if(pe(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:${Vt(g)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}let c=bs(e,i.scope),d=l?" data-bind":"",p=a.length>0?` ${a.join(" ")}`:"",h="",m=e;if(m.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let y=Bt(m.$switch)?Lu(m.$switch.$ref):`\`${String(m.$switch)}\``,v=m.cases??{},j=Object.entries(v).filter(([,P])=>P&&!Bt(P)).map(([P,E])=>`${JSON.stringify(P)}: html\`${Du(E,i.preformatted)}\``);r.set(g,`() => ({${j.join(", ")}})[String(${y})] ?? html\`\``),a.push(`:render="${g}"`);let S=` ${a.join(" ")}`;return`<${o}${c} data-bind${S}></${o}>`}if(m.textContent!==void 0&&!l){let g=Me(m.textContent,i.scope);h=g==null?"":$e(String(g))}else if(m.textContent!==void 0&&l){let g=Me(m.textContent,i.scope);h=g==null?"":$e(String(g))}else if(m.innerHTML){let g=Me(m.innerHTML,i.scope);h=g==null?m.innerHTML:String(g)}else if(Qe(m.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let y=m.children,v=Bt(y.items)?Lu(y.items.$ref):JSON.stringify(y.items),j=qu(y.map);r.set(g,`() => (${v} ?? []).map((item, index) => html\`${j}\`)`),a.push(`:render="${g}"`),l=!0;let S=" data-bind",P=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${S}${P}>`;return`<${o}${c}${S}${P}></${o}>`}else if(Array.isArray(m.children)&&m.children.some((g)=>Qe(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let y=m.children.map((j)=>Du(j,i.preformatted)).join(so(i.preformatted," "));r.set(g,i.preformatted?`() => html\`${y}\``:`() => html\`
202
+ </html>`;return{files:[{content:E,path:i}],html:k}}function Sy(e,t,r,n,s){if(N(e))return ve(e);if(Ft(e)||$t(e))return ve(String(e));if(!F(e))return"";let i=Zs(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Nr(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Js(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let o=e.tagName??"div";i.preformatted=t.preformatted===!0||In.has(o);let a=[],l=!1;if(e.textContent!==void 0){let h=e.textContent;if(Wt(h)){let y=si(h.$ref);a.push(`:text-content="${y}"`),Wu(r,y,h.$ref),l=!0}else if(pe(h)){let y=`_t${s.t}`;s.t+=1,a.push(`:text-content="${y}"`),r.set(y,`() => \`${h}\``),l=!0}}for(let[h,y]of Object.entries(e)){if(!h.startsWith("on")||h==="observedAttributes")continue;let v=h.slice(2).toLowerCase();if(Wt(y)){let j=si(y.$ref);a.push(`@${v}="${j}"`),l=!0}else if(tr(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${v}="${j}"`);let{body:S}=y;n.set(j,Array.isArray(S)?{args:["state","e"],body:fr(S,{eventParam:"e",statePrefix:"state"})}:{args:y.parameters?rn(y.parameters):y.arguments??["state","event"],body:S}),l=!0}else if(rr(y)){let j=`_h${s.h}`;s.h+=1,a.push(`@${v}="${j}"`);let S=At(y.$expression,{eventParam:"e",statePrefix:"state"});n.set(j,{args:["state","e"],body:S}),l=!0}}if(F(e.style))for(let[h,y]of Object.entries(e.style)){if(h.startsWith(":")||h.startsWith(".")||h.startsWith("&")||h.startsWith("[")||h.startsWith("@"))continue;if(_y(y))continue;if(pe(y)){let v=`_s${s.s}`;s.s+=1,a.push(`:style.${Bt(h)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}if(F(e.attributes)){for(let[h,y]of Object.entries(e.attributes))if(Wt(y)){let v=si(y.$ref);a.push(`:attr.${h}="${v}"`),Wu(r,v,y.$ref),l=!0}else if(pe(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:attr.${h}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}for(let[h,y]of Object.entries(e)){if(pn.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(Wt(y)){let v=si(y.$ref);a.push(`:${Bt(h)}="${v}"`),Wu(r,v,y.$ref),l=!0}else if(pe(y)){let v=`_t${s.t}`;s.t+=1,a.push(`:${Bt(h)}="${v}"`),r.set(v,`() => \`${y}\``),l=!0}}let c=xs(e,i.scope),u=l?" data-bind":"",p=a.length>0?` ${a.join(" ")}`:"",g="",m=e;if(m.$switch){s.needsLit=!0;let h=`_sw${s.sw}`;s.sw+=1;let y=Wt(m.$switch)?zu(m.$switch.$ref):`\`${String(m.$switch)}\``,v=m.cases??{},j=Object.entries(v).filter(([,_])=>_&&!Wt(_)).map(([_,E])=>`${JSON.stringify(_)}: html\`${Uu(E,i.preformatted)}\``);r.set(h,`() => ({${j.join(", ")}})[String(${y})] ?? html\`\``),a.push(`:render="${h}"`);let S=` ${a.join(" ")}`;return`<${o}${c} data-bind${S}></${o}>`}if(m.textContent!==void 0&&!l){let h=Me(m.textContent,i.scope);g=h==null?"":ve(String(h))}else if(m.textContent!==void 0&&l){let h=Me(m.textContent,i.scope);g=h==null?"":ve(String(h))}else if(m.innerHTML){let h=Me(m.innerHTML,i.scope);g=h==null?m.innerHTML:String(h)}else if(Qe(m.children)){s.needsLit=!0;let h=`_list${s.l}`;s.l+=1;let y=m.children,v=Wt(y.items)?zu(y.items.$ref):JSON.stringify(y.items),j=Ku(y.map);r.set(h,`() => (${v} ?? []).map((item, index) => html\`${j}\`)`),a.push(`:render="${h}"`),l=!0;let S=" data-bind",_=` ${a.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${S}${_}>`;return`<${o}${c}${S}${_}></${o}>`}else if(Array.isArray(m.children)&&m.children.some((h)=>Qe(h))){s.needsLit=!0;let h=`_children${s.l}`;s.l+=1;let y=m.children.map((j)=>Uu(j,i.preformatted)).join(io(i.preformatted," "));r.set(h,i.preformatted?`() => html\`${y}\``:`() => html\`
203
203
  ${y}
204
- \``),a.push(`:render="${g}"`),l=!0;let v=` ${a.join(" ")}`;return`<${o}${c} data-bind${v}></${o}>`}else if(Array.isArray(m.children))h=m.children.map((g)=>dy(g,i,r,n,s)).join(so(i.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${d}${p}>`;return`<${o}${c}${d}${p}>${h}</${o}>`}function qu(e,t=!1){if(!e)return"";if(Nr(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Ms(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let r=e.tagName??"div",n=t||In.has(r),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${Mn(e.className)}"`;if(F(e.$props))for(let[l,c]of Object.entries(e.$props))if(Bt(c))s+=` .${l}="\${${OO(c.$ref)}}"`;else if(pe(c))s+=` .${l}="${Mn(c)}"`;else s+=` .${l}="\${${JSON.stringify(c)}}"`;if(F(e.attributes))for(let[l,c]of Object.entries(e.attributes)){if(pe(c)){s+=` ${l}="${Mn(c)}"`;continue}if($t(c)){let d=gs(l,c);if(d!==null)s+=d===""?` ${l}`:` ${l}="${$e(d)}"`;continue}s+=` ${l}="${$e(String(c))}"`}if(F(e.style)){let l=[];for(let[c,d]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(py(d))continue;let p=Vt(c);if(pe(String(d)))l.push(`${p}: ${Mn(String(d))}`);else l.push(`${p}: ${d}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,c]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;let d=l.slice(2).toLowerCase();if(Bt(c)){let p=ni(c.$ref);s+=` @${d}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(_n(c)){let p=fr(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(er(c)){let p=Mn(c.body);s+=` @${d}=\${(e) => { ${p} }}`}else if(F(c)&&"$expression"in c){let p=At(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${d}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=r.includes("-")?ei:"",o="";if(e.textContent!==void 0){let l=String(e.textContent);if(pe(l))o=`${Mn(l)}${i}`;else if(Bt(e.textContent))o=`\${state.${ni(e.textContent.$ref)}}${i}`;else o=$e(l)}else if(e.innerHTML)o=Mn(String(e.innerHTML));else if(Qe(e.children))o=`
205
- ${fy(e.children)}${i}
206
- `;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let d=Du(c,n);return Qe(c)||T(c)&&pe(c)?`${d}${i}`:d});o=n?l.join(""):`
204
+ \``),a.push(`:render="${h}"`),l=!0;let v=` ${a.join(" ")}`;return`<${o}${c} data-bind${v}></${o}>`}else if(Array.isArray(m.children))g=m.children.map((h)=>Sy(h,i,r,n,s)).join(io(i.preformatted));if(new Set(["input","br","hr","img","meta","link"]).has(o))return`<${o}${c}${u}${p}>`;return`<${o}${c}${u}${p}>${g}</${o}>`}function Ku(e,t=!1){if(!e)return"";if(Nr(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Js(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let r=e.tagName??"div",n=t||In.has(r),s="";if(e.id)s+=` id="${e.id}"`;if(e.className)s+=` class="${Mn(e.className)}"`;if(F(e.$props))for(let[l,c]of Object.entries(e.$props))if(Wt(c))s+=` .${l}="\${${XO(c.$ref)}}"`;else if(pe(c))s+=` .${l}="${Mn(c)}"`;else s+=` .${l}="\${${JSON.stringify(c)}}"`;if(F(e.attributes))for(let[l,c]of Object.entries(e.attributes)){if(pe(c)){s+=` ${l}="${Mn(c)}"`;continue}if($t(c)){let u=ys(l,c);if(u!==null)s+=u===""?` ${l}`:` ${l}="${ve(u)}"`;continue}s+=` ${l}="${ve(String(c))}"`}if(F(e.style)){let l=[];for(let[c,u]of Object.entries(e.style)){if(c.startsWith(":")||c.startsWith(".")||c.startsWith("&")||c.startsWith("[")||c.startsWith("@"))continue;if(_y(u))continue;let p=Bt(c);if(pe(String(u)))l.push(`${p}: ${Mn(String(u))}`);else l.push(`${p}: ${u}`)}if(l.length>0)s+=` style="${l.join("; ")}"`}for(let[l,c]of Object.entries(e)){if(!l.startsWith("on")||l==="observedAttributes")continue;let u=l.slice(2).toLowerCase();if(Wt(c)){let p=si(c.$ref);s+=` @${u}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(_n(c)){let p=fr(c.body,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(tr(c)){let p=Mn(c.body);s+=` @${u}=\${(e) => { ${p} }}`}else if(F(c)&&"$expression"in c){let p=At(c.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${u}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}if(e.contentEditable)s+=` contenteditable="${e.contentEditable}"`;let i=r.includes("-")?ti:"",o="";if(e.textContent!==void 0){let l=String(e.textContent);if(pe(l))o=`${Mn(l)}${i}`;else if(Wt(e.textContent))o=`\${state.${si(e.textContent.$ref)}}${i}`;else o=ve(l)}else if(e.innerHTML)o=Mn(String(e.innerHTML));else if(Qe(e.children))o=`
205
+ ${Ey(e.children)}${i}
206
+ `;else if(Array.isArray(e.children)){let l=e.children.map((c)=>{let u=Uu(c,n);return Qe(c)||N(c)&&pe(c)?`${u}${i}`:u});o=n?l.join(""):`
207
207
  ${l.join(`
208
208
  `)}
209
- `}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function Du(e,t=!1){if(T(e))return pe(e)?Mn(e):$e(e);if(lr(e)||$t(e))return $e(String(e));if(Qe(e))return fy(e);return qu(e,t)}function fy(e){let{items:t}=e,r=Bt(t)?Lu(t.$ref):JSON.stringify(t??[]),n=qu(e.map);return`\${(${r} ?? []).map((item, index) => html\`${n}\`)}`}function Mn(e){return e.replaceAll("$map.","")}function kO(e,t,r,n,s,i,o,a,l,c){let d=[],{needsLit:p}=a,h=t.length>0;d.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(h)m.push("computed");if(d.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),p)d.push("import { html, render } from 'lit-html';");for(let[b,g]of o){let y=c?c(b):b;d.push(`import { ${[...g].join(", ")} } from '${y}';`)}if(d.push("",Fa()),i.length>0)d.push("",qa());d.push("","const state = reactive({");for(let[b,g]of e)d.push(` ${un(b)}: ${JSON.stringify(g)},`);if(d.push("});",""),s.length>0){for(let b of s)d.push(b);d.push("")}if(t.length>0){for(let[b,g]of t)d.push(`${Pe("state",dt(b))} = computed(${g});`);d.push("")}if(i.length>0){for(let b of i)d.push(b);d.push("")}if(r.length>0){d.push("const bind = {");for(let[b,g]of r)d.push(` ${un(b)}: ${g},`);d.push("};")}else d.push("const bind = {};");if(d.push(""),n.length>0){d.push("const on = {");for(let[b,g]of n){let y=g.args??["state"],v=y.map((j)=>j==="state"?"state":"e").join(", ");d.push(` ${un(b)}: (e) => { const fn = (${y.join(", ")}) => { ${g.body} }; fn(${v}); },`)}d.push("};")}else d.push("const on = {};");if(d.push("","function hydrate(root) {"," root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),p)d.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else d.push(" if (parts[0] === 'style' && parts.length > 1) {");return d.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${Qs}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });","}","","hydrate(document);",""),d.join(`
210
- `)}function RO(e,t,r,n){return[`// ${e}: ${t} (key: "${r}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(r)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(n)};`,`} catch { state.${e} = ${JSON.stringify(n)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(r)});`,` else ${t}.setItem(${JSON.stringify(r)}, JSON.stringify(v));`," } catch {}","});"].join(`
211
- `)}function AO(e,t,r){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(r)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(r)}; }`,"}"].join(`
212
- `)}function py(e){return e===null||F(e)}function OO(e){if(e.startsWith("$map/")){let[t,...r]=cn(e.slice(5));return Pe(t??"",r.map((n)=>dt(n)).join("/"))}if(e.startsWith("#/state/"))return Pe("state",e.slice(8));return Pe("state",e)}function Lu(e){return Eh("state",e.startsWith("#/state/")?e.slice(8):e)}function ni(e){return _h(e.startsWith("#/state/")?e.slice(8):e)}function Ju(e,t,r){if(e.has(t))return;e.set(t,`() => ${Pe("state",r.startsWith("#/state/")?r.slice(8):r)}`)}var Hu=q(()=>{Us();Mr();ve();Hs()});function CO(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function my(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),n=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,CO(s,e)])));return`
209
+ `}if(new Set(["input","br","hr","img","meta","link"]).has(r))return`<${r}${s}>`;return`<${r}${s}>${o}</${r}>`}function Uu(e,t=!1){if(N(e))return pe(e)?Mn(e):ve(e);if(Ft(e)||$t(e))return ve(String(e));if(Qe(e))return Ey(e);return Ku(e,t)}function Ey(e){let{items:t}=e,r=Wt(t)?zu(t.$ref):JSON.stringify(t??[]),n=Ku(e.map);return`\${(${r} ?? []).map((item, index) => html\`${n}\`)}`}function Mn(e){return e.replaceAll("$map.","")}function GO(e,t,r,n,s,i,o,a,l,c){let u=[],{needsLit:p}=a,g=t.length>0;u.push("// Generated by @jxsuite/compiler — do not edit manually");let m=["reactive","effect"];if(g)m.push("computed");if(u.push(`import { ${m.join(", ")} } from '@vue/reactivity';`),p)u.push("import { html, render } from 'lit-html';");for(let[b,h]of o){let y=c?c(b):b;u.push(`import { ${[...h].join(", ")} } from '${y}';`)}if(u.push("",qa()),i.length>0)u.push("",Ha());u.push("","const state = reactive({");for(let[b,h]of e)u.push(` ${un(b)}: ${JSON.stringify(h)},`);if(u.push("});",""),s.length>0){for(let b of s)u.push(b);u.push("")}if(t.length>0){for(let[b,h]of t)u.push(`${Pe("state",dt(b))} = computed(${h});`);u.push("")}if(i.length>0){for(let b of i)u.push(b);u.push("")}if(r.length>0){u.push("const bind = {");for(let[b,h]of r)u.push(` ${un(b)}: ${h},`);u.push("};")}else u.push("const bind = {};");if(u.push(""),n.length>0){u.push("const on = {");for(let[b,h]of n){let y=h.args??["state"],v=y.map((j)=>j==="state"?"state":"e").join(", ");u.push(` ${un(b)}: (e) => { const fn = (${y.join(", ")}) => { ${h.body} }; fn(${v}); },`)}u.push("};")}else u.push("const on = {};");if(u.push("","function hydrate(root) {"," root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),p)u.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else u.push(" if (parts[0] === 'style' && parts.length > 1) {");return u.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${ei}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });","}","","hydrate(document);",""),u.join(`
210
+ `)}function KO(e,t,r,n){return[`// ${e}: ${t} (key: "${r}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(r)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(n)};`,`} catch { state.${e} = ${JSON.stringify(n)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(r)});`,` else ${t}.setItem(${JSON.stringify(r)}, JSON.stringify(v));`," } catch {}","});"].join(`
211
+ `)}function YO(e,t,r){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(r)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(r)}; }`,"}"].join(`
212
+ `)}function _y(e){return e===null||F(e)}function XO(e){if(e.startsWith("$map/")){let[t,...r]=cn(e.slice(5));return Pe(t??"",r.map((n)=>dt(n)).join("/"))}if(e.startsWith("#/state/"))return Pe("state",e.slice(8));return Pe("state",e)}function zu(e){return Ih("state",e.startsWith("#/state/")?e.slice(8):e)}function si(e){return Mh(e.startsWith("#/state/")?e.slice(8):e)}function Wu(e,t,r){if(e.has(t))return;e.set(t,`() => ${Pe("state",r.startsWith("#/state/")?r.slice(8):r)}`)}var Yu=q(()=>{zs();Mr();$e();Vs()});function ZO(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function Py(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),n=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,ZO(s,e)])));return`
213
213
  // ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
214
214
  const JX_LOCALES = ${t}
215
215
  const JX_DEFAULT_LOCALE = ${r}
@@ -278,24 +278,24 @@ app.use('/', async (c, next) => {
278
278
  res.headers.set('Content-Language', locale)
279
279
  c.res = res
280
280
  })
281
- `}function Qa(e,t="/_jx/server"){return Ie(e,t)}function Vu(e,t={}){let{adapter:r=null,mounts:n=[],connectors:s=[],i18n:i=null,base:o=""}=t,a=Qa(o,t.baseUrl);if(e.length===0&&n.length===0&&!r)return null;let l=e.map(({exportName:m,src:b})=>`import { ${m} } from '${b}'`).join(`
282
- `),c=NO(n,s),d=e.map(({exportName:m})=>TO(m,a)).join(`
281
+ `}function nl(e,t="/_jx/server"){return Ie(e,t)}function Xu(e,t={}){let{adapter:r=null,mounts:n=[],connectors:s=[],i18n:i=null,base:o=""}=t,a=nl(o,t.baseUrl);if(e.length===0&&n.length===0&&!r)return null;let l=e.map(({exportName:m,src:b})=>`import { ${m} } from '${b}'`).join(`
282
+ `),c=QO(n,s),u=e.map(({exportName:m})=>eC(m,a)).join(`
283
283
  `),p=r==="cloudflare-workers"||r==="cloudflare-pages"?`
284
284
  app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
285
285
  `:`
286
- `,h=my(i);return`// Generated by @jxsuite/compiler — do not edit manually
286
+ `,g=Py(i);return`// Generated by @jxsuite/compiler — do not edit manually
287
287
  import { Hono } from 'hono'
288
288
  ${l}${c.imports}
289
289
 
290
290
  const app = new Hono()
291
- ${h}${c.routes}${d}
291
+ ${g}${c.routes}${u}
292
292
  ${p}
293
293
  export default app
294
- `}function NO(e,t){if(e.length===0)return{imports:"",routes:""};let r=e.toSorted((i,o)=>i.order-o.order),n=[];for(let i of r)n.push(`import { ${i.className} } from '${i.module}'`);for(let i of t)n.push(`import { ${i.className} } from '${i.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((i)=>`${JSON.stringify(i.provider)}: ${i.className}`).join(", ")} }`];for(let[i,o]of r.entries()){let a=JSON.stringify(o.options);s.push(`const jxMount${i} = await ${o.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${o.basePath}/*', (c) => jxMount${i}(c.req.raw, c.env))`,`app.all('${o.basePath}', (c) => jxMount${i}(c.req.raw, c.env))`)}return{imports:`
294
+ `}function QO(e,t){if(e.length===0)return{imports:"",routes:""};let r=e.toSorted((i,o)=>i.order-o.order),n=[];for(let i of r)n.push(`import { ${i.className} } from '${i.module}'`);for(let i of t)n.push(`import { ${i.className} } from '${i.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((i)=>`${JSON.stringify(i.provider)}: ${i.className}`).join(", ")} }`];for(let[i,o]of r.entries()){let a=JSON.stringify(o.options);s.push(`const jxMount${i} = await ${o.className}.mount({ ...${a}, connectors: jxConnectors }, jxCtx)`,`app.all('${o.basePath}/*', (c) => jxMount${i}(c.req.raw, c.env))`,`app.all('${o.basePath}', (c) => jxMount${i}(c.req.raw, c.env))`)}return{imports:`
295
295
  ${n.join(`
296
296
  `)}`,routes:`${s.join(`
297
297
  `)}
298
- `}}function TO(e,t){return`
298
+ `}}function eC(e,t){return`
299
299
  app.post('${t}/${e}', async (c) => {
300
300
  const args = await c.req.json().catch(() => ({}))
301
301
  try {
@@ -303,14 +303,14 @@ app.post('${t}/${e}', async (c) => {
303
303
  } catch (e) {
304
304
  return c.json({ ok: false, error: e?.message ?? 'Server error' }, 500)
305
305
  }
306
- })`}var Bu=q(()=>{nr()});function gy(e){let t=e.title;if(!t)throw Error("compileClassJson: missing title (class name)");let r=MO(e.extends),n=e.$defs,s=n?.fields??{},i=n?.constructor,o=IO(i)?i:void 0,a=n?.methods??{},l=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(e.$id)l.push(`// Source: ${e.$id}`);l.push("");let c=r!=="Object"?` extends ${r}`:"";l.push(`class ${t}${c} {`);for(let[d,p]of Object.entries(s)){if(p.scope!=="static")continue;let h=p.identifier??d,m=p.access==="private"?"#":"",b=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` static ${m}${h} = ${b};`)}for(let[d,p]of Object.entries(s)){if(p.scope==="static")continue;if(p.access!=="private")continue;let h=p.identifier??d;l.push(` #${h};`)}if(Object.keys(s).length>0)l.push("");if(l.push(" constructor(config = {}) {"),o?.superCall||r!=="Object"){let d=o?.superCall?.arguments?o.superCall.arguments.join(", "):"";l.push(` super(${d});`)}for(let[d,p]of Object.entries(s)){if(p.scope==="static")continue;let h=p.identifier??d,m=p.access==="private"?"#":"",b=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` this.${m}${h} = config.${h} !== undefined ? config.${h} : ${b};`)}if(o?.body){let d=Array.isArray(o.body)?o.body:[o.body];for(let p of d)l.push(` ${p}`)}l.push(" }");for(let[d,p]of Object.entries(a)){let h=p.identifier??d,m=p.scope==="static",g=p.access==="private"?"#":"",y=m?"static ":"",v=p.returnType?.$ref?.includes("Promise")||DO(p)?"async ":"",j=hy(p.parameters??[]),S=JO(p.body);if(l.push(""),p.role==="accessor"){if(p.getter)l.push(` ${y}get ${g}${h}() {`,` ${p.getter.body}`," }");if(p.setter){let P=hy(p.setter.parameters??[]);l.push(` ${y}set ${g}${h}(${P}) {`,` ${p.setter.body}`," }")}}else{l.push(` ${y}${v}${g}${h}(${j}) {`);for(let P of S)l.push(` ${P}`);l.push(" }")}}return l.push("}","",`export { ${t} };`,`export default ${t};`,""),l.join(`
307
- `)}function IO(e){return typeof e==="object"}function MO(e){if(!e)return"Object";if(T(e))return e;if(e.$ref){let t=e.$ref.match(/([A-Za-z0-9_]+)\.class\.json/);return t?t[1]:"Object"}return"Object"}function hy(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let r=t.identifier??t.name;return T(r)?r:"arg"}).join(", ")}function JO(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function DO(e){return(Array.isArray(e.body)?e.body.join(`
308
- `):e.body??"").includes("await ")}var yy=q(()=>{ve()});import{readFileSync as LO}from"node:fs";async function Wu(e,t={}){let{title:r="Jx App",reactivitySrc:n=Ks,litHtmlSrc:s=Ys,projectStyle:i=null}=t,o;if(T(e)){let l=LO(e,"utf8");if(e.endsWith(".json"))o=jn(l,e);else{let{extname:c}=await import("node:path"),d=c(e).toLowerCase(),p=t.formats?.byExtension(d,"parse");if(!p){await Promise.resolve().then(() => nn());throw ca(e,d)}o=await p.parseDocument(l)}}else o=e;if(Gp(o)){await Promise.resolve().then(() => yy());let c=gy(o),d=T(e)?e.replace(/\.class\.json$/,".js"):`${o.title}.js`;return{files:[{content:c,path:d}],html:""}}if(!Da(o))return ly(o,{litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...by(t),title:r});if(o.tagName&&o.tagName.includes("-")){let{tagName:l}=o,c=Va(l),p={content:ao(o,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${l}.js`,tagName:l},h=ti(o,o.$media??{},i),m=`<!DOCTYPE html>
306
+ })`}var Zu=q(()=>{sr()});function ky(e){let t=e.title;if(!t)throw Error("compileClassJson: missing title (class name)");let r=rC(e.extends),n=e.$defs,s=n?.fields??{},i=n?.constructor,o=tC(i)?i:void 0,a=n?.methods??{},l=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(e.$id)l.push(`// Source: ${e.$id}`);l.push("");let c=r!=="Object"?` extends ${r}`:"";l.push(`class ${t}${c} {`);for(let[u,p]of Object.entries(s)){if(p.scope!=="static")continue;let g=p.identifier??u,m=p.access==="private"?"#":"",b=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` static ${m}${g} = ${b};`)}for(let[u,p]of Object.entries(s)){if(p.scope==="static")continue;if(p.access!=="private")continue;let g=p.identifier??u;l.push(` #${g};`)}if(Object.keys(s).length>0)l.push("");if(l.push(" constructor(config = {}) {"),o?.superCall||r!=="Object"){let u=o?.superCall?.arguments?o.superCall.arguments.join(", "):"";l.push(` super(${u});`)}for(let[u,p]of Object.entries(s)){if(p.scope==="static")continue;let g=p.identifier??u,m=p.access==="private"?"#":"",b=p.initializer!==void 0?JSON.stringify(p.initializer):p.default!==void 0?JSON.stringify(p.default):"null";l.push(` this.${m}${g} = config.${g} !== undefined ? config.${g} : ${b};`)}if(o?.body){let u=Array.isArray(o.body)?o.body:[o.body];for(let p of u)l.push(` ${p}`)}l.push(" }");for(let[u,p]of Object.entries(a)){let g=p.identifier??u,m=p.scope==="static",h=p.access==="private"?"#":"",y=m?"static ":"",v=p.returnType?.$ref?.includes("Promise")||sC(p)?"async ":"",j=jy(p.parameters??[]),S=nC(p.body);if(l.push(""),p.role==="accessor"){if(p.getter)l.push(` ${y}get ${h}${g}() {`,` ${p.getter.body}`," }");if(p.setter){let _=jy(p.setter.parameters??[]);l.push(` ${y}set ${h}${g}(${_}) {`,` ${p.setter.body}`," }")}}else{l.push(` ${y}${v}${h}${g}(${j}) {`);for(let _ of S)l.push(` ${_}`);l.push(" }")}}return l.push("}","",`export { ${t} };`,`export default ${t};`,""),l.join(`
307
+ `)}function tC(e){return typeof e==="object"}function rC(e){if(!e)return"Object";if(N(e))return e;if(e.$ref){let t=e.$ref.match(/([A-Za-z0-9_]+)\.class\.json/);return t?t[1]:"Object"}return"Object"}function jy(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let r=t.identifier??t.name;return N(r)?r:"arg"}).join(", ")}function nC(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function sC(e){return(Array.isArray(e.body)?e.body.join(`
308
+ `):e.body??"").includes("await ")}var Ry=q(()=>{$e()});import{readFileSync as iC}from"node:fs";async function Qu(e,t={}){let{title:r="Jx App",reactivitySrc:n=Ys,litHtmlSrc:s=Xs,projectStyle:i=null}=t,o;if(N(e)){let l=iC(e,"utf8");if(e.endsWith(".json"))o=jn(l,e);else{let{extname:c}=await import("node:path"),u=c(e).toLowerCase(),p=t.formats?.byExtension(u,"parse");if(!p){await Promise.resolve().then(() => nn());throw ua(e,u)}o=await p.parseDocument(l)}}else o=e;if(tm(o)){await Promise.resolve().then(() => Ry());let c=ky(o),u=N(e)?e.replace(/\.class\.json$/,".js"):`${o.title}.js`;return{files:[{content:c,path:u}],html:""}}if(!La(o))return $y(o,{litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...Ay(t),title:r});if(o.tagName&&o.tagName.includes("-")){let{tagName:l}=o,c=Ba(l),p={content:lo(o,c,[],t.rewriteSrc,null,t.serverBaseUrl),path:`${l}.js`,tagName:l},g=ri(o,o.$media??{},i),m=`<!DOCTYPE html>
309
309
  <html lang="en">
310
310
  <head>
311
311
  <meta charset="utf-8">
312
312
  <meta name="viewport" content="width=device-width, initial-scale=1">
313
- <title>${$e(r)}</title>
313
+ <title>${ve(r)}</title>
314
314
  <script type="importmap">
315
315
  {
316
316
  "imports": {
@@ -319,57 +319,57 @@ app.post('${t}/${e}', async (c) => {
319
319
  }
320
320
  }
321
321
  </script>
322
- ${h}
322
+ ${g}
323
323
  </head>
324
324
  <body>
325
325
  <${l}></${l}>
326
326
  <script type="module" src="./${l}.js"></script>
327
327
  </body>
328
- </html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...by(t),title:r};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return Fu(o,a)}function by(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function G9(e,t){let r=await Wu(e),{writeFileSync:n,mkdirSync:s}=await import("node:fs"),{dirname:i,join:o}=await import("node:path");if(t){n(t,r.html,"utf8"),console.error(`Written to ${t}`);let a=i(t);for(let l of r.files){let c=o(a,l.path);s(i(c),{recursive:!0}),n(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(r.html)}var xy=q(()=>{Mr();lo();uy();Hu();ve();rr();Mr();Bu();lo();Hu()});import{readFileSync as FO}from"node:fs";import{dirname as Uu,resolve as el}from"node:path";import{createRequire as qO}from"node:module";function BO(e){return vt(e.resolve)}async function $y(e,t,r,n={}){let s=e.imports??{},{state:i}=e;if(!i)return;for(let[o,a]of Object.entries(i)){if(!Cr(a))continue;if(HO.has(a.$prototype))continue;if(a.timing&&a.timing!=="compiler"){let l=n.registry?.byName(a.$prototype);if(l?.capabilities.lower)try{let c=await l.call("lower",a,{projectConfig:n.config,root:r,route:t});if(ee(c)){let d=c.$bundle;if(Array.isArray(d)){for(let p of d)if(T(p))n.registerBundle?.(p)}delete c.$bundle}i[o]=c}catch(c){console.warn(`prototype-resolver: failed to lower "${o}" ($prototype: "${a.$prototype}"):`,Ee(c))}continue}if(!a.$src){let l=s[a.$prototype]??WO(n,a.$prototype);if(!l)continue;a.$src=l}try{let l=await UO(a,t,r,i,n);if(a.timing&&ee(l))l.timing=a.timing;i[o]=l}catch(l){console.warn(`prototype-resolver: failed to resolve "${o}" ($prototype: "${a.$prototype}"):`,Ee(l))}}}function WO(e,t){return e.registry?.byName(t)?.classPath}async function UO(e,t,r,n,s){let i=e.$src;if(!i)throw Error(`$prototype "${e.$prototype}" has no $src to resolve`);let o;if(i.startsWith("./")||i.startsWith("../"))o=t.sourcePath?el(Uu(t.sourcePath),i):el(r,i);else o=qO(el(r,"package.json")).resolve(i);let a=FO(o,"utf8"),l=nm(a,o);if(!l.$implementation)throw Error(`${i} has no $implementation field`);let c=el(Uu(o),l.$implementation),d=await Oc(c),p=e.$export??l.title??e.$prototype,h=d[p]??d.default?.[p];if(!h)throw Error(`Module ${l.$implementation} does not export "${p}"`);let m={};for(let[g,y]of Object.entries(e))if(!VO.has(g))m[g]=y;if(m.src&&!m.basePath&&t.sourcePath)m.basePath=Uu(t.sourcePath);m._project={config:s.config??null,root:r,...s.sections},m._document={route:t,state:n};let b=new h(m);if(BO(b))return await b.resolve();return b}var HO,VO;var vy=q(()=>{nn();ve();rr();HO=new Set(["Function","LocalStorage","SessionStorage","Array"]),VO=new Set(["$prototype","$src","$export","timing","default","description"])});var wy=(e)=>typeof e<"u"&&e!==null,zO=(e)=>typeof e==="object",GO=(e)=>Object.prototype.toString.call(e)==="[object Object]",KO=(e)=>typeof e==="function",YO=(e)=>typeof e==="boolean",XO=(e)=>e instanceof Buffer,ZO=(e)=>{if(wy(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},QO=(e)=>e instanceof ArrayBuffer,eC=(e)=>typeof e==="string"&&e.length>0,tC=(e)=>typeof e==="number"&&Number.isFinite(e),rC=(e)=>Number.isInteger(e),nC=(e,t,r)=>e>=t&&e<=r,sC=(e,t)=>t.includes(e),iC=(e,t,r)=>{let n;try{n=String(r).slice(0,100)}catch{}return Error(`Expected ${t} for ${e} but received ${n} of type ${typeof r}`)},oC=(e,t)=>(t.message=e.message,t),u;var Dr=q(()=>{/*!
328
+ </html>`;return{files:[p],html:m}}let a={litHtmlSrc:s,projectStyle:i,reactivitySrc:n,...Ay(t),title:r};if(t.serverBaseUrl!==void 0)a.serverBaseUrl=t.serverBaseUrl;return Gu(o,a)}function Ay(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function xG(e,t){let r=await Qu(e),{writeFileSync:n,mkdirSync:s}=await import("node:fs"),{dirname:i,join:o}=await import("node:path");if(t){n(t,r.html,"utf8"),console.error(`Written to ${t}`);let a=i(t);for(let l of r.files){let c=o(a,l.path);s(i(c),{recursive:!0}),n(c,l.content,"utf8"),console.error(`Written to ${c}`)}}else process.stdout.write(r.html)}var Oy=q(()=>{Mr();co();wy();Yu();$e();nr();Mr();Zu();co();Yu()});var Cy=(e)=>typeof e<"u"&&e!==null,oC=(e)=>typeof e==="object",aC=(e)=>Object.prototype.toString.call(e)==="[object Object]",lC=(e)=>typeof e==="function",cC=(e)=>typeof e==="boolean",uC=(e)=>e instanceof Buffer,dC=(e)=>{if(Cy(e))switch(e.constructor){case Uint8Array:case Uint8ClampedArray:case Int8Array:case Uint16Array:case Int16Array:case Uint32Array:case Int32Array:case Float32Array:case Float64Array:return!0}return!1},fC=(e)=>e instanceof ArrayBuffer,pC=(e)=>typeof e==="string"&&e.length>0,mC=(e)=>typeof e==="number"&&Number.isFinite(e),hC=(e)=>Number.isInteger(e),gC=(e,t,r)=>e>=t&&e<=r,yC=(e,t)=>t.includes(e),bC=(e,t,r)=>{let n;try{n=String(r).slice(0,100)}catch{}return Error(`Expected ${t} for ${e} but received ${n} of type ${typeof r}`)},xC=(e,t)=>(t.message=e.message,t),d;var Dr=q(()=>{/*!
329
329
  Copyright 2013 Lovell Fuller and others.
330
330
  SPDX-License-Identifier: Apache-2.0
331
- */u={defined:wy,object:zO,plainObject:GO,fn:KO,bool:YO,buffer:XO,typedArray:ZO,arrayBuffer:QO,string:eC,number:tC,integer:rC,inRange:nC,inArray:sC,invalidParameterError:iC,nativeError:oC}});var _y=C(function(lG,Ey){var Sy=()=>process.platform==="linux",tl=null,aC=()=>{if(!tl)if(Sy()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,tl=process.report.getReport(),process.report.excludeNetwork=e}else tl={};return tl};Ey.exports={isLinux:Sy,getReport:aC}});var jy=C(function(cG,Py){var si=Ne("fs"),lC=(e)=>{let t=si.openSync(e,"r"),r=Buffer.alloc(2048),n=si.readSync(t,r,0,2048,0);return si.close(t,()=>{}),r.subarray(0,n)},cC=(e)=>new Promise((t,r)=>{si.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);si.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),si.close(s,()=>{})})}})});Py.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:lC,readFile:cC}});var Ry=C(function(uG,ky){var uC=(e)=>{if(e.length<64)return null;if(e.readUInt32BE(0)!==2135247942)return null;if(e.readUInt8(4)!==2)return null;if(e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let s=0;s<n;s++){let i=t+s*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};ky.exports={interpreterPath:uC}});var nl=C(function(dG,Uy){var Oy=Ne("child_process"),{isLinux:ii,getReport:Cy}=_y(),{LDD_PATH:rl,SELF_PATH:Ny,readFile:zu,readFileSync:Gu}=jy(),{interpreterPath:Ty}=Ry(),Lr,Fr,qr,Jn="",Iy=()=>{if(!Jn)return new Promise((e)=>{Oy.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Jn=t?" ":r,e(Jn)})});return Jn},My=()=>{if(!Jn)try{Jn=Oy.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Jn=" "}return Jn},hn="glibc",Jy=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,vs="musl",dC=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),Dy=()=>{let e=Cy();if(e.header&&e.header.glibcVersionRuntime)return hn;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(dC))return vs}return null},Ly=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return hn;if(r&&r.includes(vs))return vs;return null},Fy=(e)=>{if(e){if(e.includes("/ld-musl-"))return vs;else if(e.includes("/ld-linux-"))return hn}return null},qy=(e)=>{if(e=e.toString(),e.includes("musl"))return vs;if(e.includes("GNU C Library"))return hn;return null},fC=async()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=await zu(rl);Fr=qy(e)}catch(e){}return Fr},pC=()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=Gu(rl);Fr=qy(e)}catch(e){}return Fr},mC=async()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=await zu(Ny),t=Ty(e);Lr=Fy(t)}catch(e){}return Lr},hC=()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=Gu(Ny),t=Ty(e);Lr=Fy(t)}catch(e){}return Lr},Hy=async()=>{let e=null;if(ii()){if(e=await mC(),!e){if(e=await fC(),!e)e=Dy();if(!e){let t=await Iy();e=Ly(t)}}}return e},Vy=()=>{let e=null;if(ii()){if(e=hC(),!e){if(e=pC(),!e)e=Dy();if(!e){let t=My();e=Ly(t)}}}return e},gC=async()=>ii()&&await Hy()!==hn,yC=()=>ii()&&Vy()!==hn,bC=async()=>{if(qr!==void 0)return qr;qr=null;try{let t=(await zu(rl)).match(Jy);if(t)qr=t[1]}catch(e){}return qr},xC=()=>{if(qr!==void 0)return qr;qr=null;try{let t=Gu(rl).match(Jy);if(t)qr=t[1]}catch(e){}return qr},By=()=>{let e=Cy();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},Ay=(e)=>e.trim().split(/\s+/)[1],Wy=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return Ay(t);if(r&&n&&r.includes(vs))return Ay(n);return null},$C=async()=>{let e=null;if(ii()){if(e=await bC(),!e)e=By();if(!e){let t=await Iy();e=Wy(t)}}return e},vC=()=>{let e=null;if(ii()){if(e=xC(),!e)e=By();if(!e){let t=My();e=Wy(t)}}return e};Uy.exports={GLIBC:hn,MUSL:vs,family:Hy,familySync:Vy,isNonGlibcLinux:gC,isNonGlibcLinuxSync:yC,version:$C,versionSync:vC}});var oi=C(function(fG,zy){var wC=Number.MAX_SAFE_INTEGER||9007199254740991,SC=["major","premajor","minor","preminor","patch","prepatch","prerelease"];zy.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:wC,RELEASE_TYPES:SC,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var co=C(function(pG,Gy){var EC=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};Gy.exports=EC});var ai=C(function(Hr,Ky){var{MAX_SAFE_COMPONENT_LENGTH:Ku,MAX_SAFE_BUILD_LENGTH:_C,MAX_LENGTH:PC}=oi(),jC=co();Hr=Ky.exports={};var kC=Hr.re=[],RC=Hr.safeRe=[],X=Hr.src=[],AC=Hr.safeSrc=[],Z=Hr.t={},OC=0,Yu="[a-zA-Z0-9-]",CC=[["\\s",1],["\\d",PC],[Yu,_C]],NC=(e)=>{for(let[t,r]of CC)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},be=(e,t,r)=>{let n=NC(t),s=OC++;jC(e,s,t),Z[e]=s,X[s]=t,AC[s]=n,kC[s]=new RegExp(t,r?"g":void 0),RC[s]=new RegExp(n,r?"g":void 0)};be("NUMERICIDENTIFIER","0|[1-9]\\d*");be("NUMERICIDENTIFIERLOOSE","\\d+");be("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Yu}*`);be("MAINVERSION",`(${X[Z.NUMERICIDENTIFIER]})\\.(${X[Z.NUMERICIDENTIFIER]})\\.(${X[Z.NUMERICIDENTIFIER]})`);be("MAINVERSIONLOOSE",`(${X[Z.NUMERICIDENTIFIERLOOSE]})\\.(${X[Z.NUMERICIDENTIFIERLOOSE]})\\.(${X[Z.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASEIDENTIFIER",`(?:${X[Z.NONNUMERICIDENTIFIER]}|${X[Z.NUMERICIDENTIFIER]})`);be("PRERELEASEIDENTIFIERLOOSE",`(?:${X[Z.NONNUMERICIDENTIFIER]}|${X[Z.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASE",`(?:-(${X[Z.PRERELEASEIDENTIFIER]}(?:\\.${X[Z.PRERELEASEIDENTIFIER]})*))`);be("PRERELEASELOOSE",`(?:-?(${X[Z.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${X[Z.PRERELEASEIDENTIFIERLOOSE]})*))`);be("BUILDIDENTIFIER",`${Yu}+`);be("BUILD",`(?:\\+(${X[Z.BUILDIDENTIFIER]}(?:\\.${X[Z.BUILDIDENTIFIER]})*))`);be("FULLPLAIN",`v?${X[Z.MAINVERSION]}${X[Z.PRERELEASE]}?${X[Z.BUILD]}?`);be("FULL",`^${X[Z.FULLPLAIN]}$`);be("LOOSEPLAIN",`[v=\\s]*${X[Z.MAINVERSIONLOOSE]}${X[Z.PRERELEASELOOSE]}?${X[Z.BUILD]}?`);be("LOOSE",`^${X[Z.LOOSEPLAIN]}$`);be("GTLT","((?:<|>)?=?)");be("XRANGEIDENTIFIERLOOSE",`${X[Z.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);be("XRANGEIDENTIFIER",`${X[Z.NUMERICIDENTIFIER]}|x|X|\\*`);be("XRANGEPLAIN",`[v=\\s]*(${X[Z.XRANGEIDENTIFIER]})(?:\\.(${X[Z.XRANGEIDENTIFIER]})(?:\\.(${X[Z.XRANGEIDENTIFIER]})(?:${X[Z.PRERELEASE]})?${X[Z.BUILD]}?)?)?`);be("XRANGEPLAINLOOSE",`[v=\\s]*(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:\\.(${X[Z.XRANGEIDENTIFIERLOOSE]})(?:${X[Z.PRERELEASELOOSE]})?${X[Z.BUILD]}?)?)?`);be("XRANGE",`^${X[Z.GTLT]}\\s*${X[Z.XRANGEPLAIN]}$`);be("XRANGELOOSE",`^${X[Z.GTLT]}\\s*${X[Z.XRANGEPLAINLOOSE]}$`);be("COERCEPLAIN",`(^|[^\\d])(\\d{1,${Ku}})(?:\\.(\\d{1,${Ku}}))?(?:\\.(\\d{1,${Ku}}))?`);be("COERCE",`${X[Z.COERCEPLAIN]}(?:$|[^\\d])`);be("COERCEFULL",X[Z.COERCEPLAIN]+`(?:${X[Z.PRERELEASE]})?(?:${X[Z.BUILD]})?(?:$|[^\\d])`);be("COERCERTL",X[Z.COERCE],!0);be("COERCERTLFULL",X[Z.COERCEFULL],!0);be("LONETILDE","(?:~>?)");be("TILDETRIM",`(\\s*)${X[Z.LONETILDE]}\\s+`,!0);Hr.tildeTrimReplace="$1~";be("TILDE",`^${X[Z.LONETILDE]}${X[Z.XRANGEPLAIN]}$`);be("TILDELOOSE",`^${X[Z.LONETILDE]}${X[Z.XRANGEPLAINLOOSE]}$`);be("LONECARET","(?:\\^)");be("CARETTRIM",`(\\s*)${X[Z.LONECARET]}\\s+`,!0);Hr.caretTrimReplace="$1^";be("CARET",`^${X[Z.LONECARET]}${X[Z.XRANGEPLAIN]}$`);be("CARETLOOSE",`^${X[Z.LONECARET]}${X[Z.XRANGEPLAINLOOSE]}$`);be("COMPARATORLOOSE",`^${X[Z.GTLT]}\\s*(${X[Z.LOOSEPLAIN]})$|^$`);be("COMPARATOR",`^${X[Z.GTLT]}\\s*(${X[Z.FULLPLAIN]})$|^$`);be("COMPARATORTRIM",`(\\s*)${X[Z.GTLT]}\\s*(${X[Z.LOOSEPLAIN]}|${X[Z.XRANGEPLAIN]})`,!0);Hr.comparatorTrimReplace="$1$2$3";be("HYPHENRANGE",`^\\s*(${X[Z.XRANGEPLAIN]})\\s+-\\s+(${X[Z.XRANGEPLAIN]})\\s*$`);be("HYPHENRANGELOOSE",`^\\s*(${X[Z.XRANGEPLAINLOOSE]})\\s+-\\s+(${X[Z.XRANGEPLAINLOOSE]})\\s*$`);be("STAR","(<|>)?=?\\s*\\*");be("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");be("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var sl=C(function(mG,Yy){var TC=Object.freeze({loose:!0}),IC=Object.freeze({}),MC=(e)=>{if(!e)return IC;if(typeof e!=="object")return TC;return e};Yy.exports=MC});var Xu=C(function(hG,Qy){var Xy=/^[0-9]+$/,Zy=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=Xy.test(e),n=Xy.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},JC=(e,t)=>Zy(t,e);Qy.exports={compareIdentifiers:Zy,rcompareIdentifiers:JC}});var ht=C(function(gG,tb){var il=co(),{MAX_LENGTH:eb,MAX_SAFE_INTEGER:ol}=oi(),{safeRe:al,t:ll}=ai(),DC=sl(),{compareIdentifiers:Zu}=Xu(),LC=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(Zu(e[n],r[n])!==0)return!1;return!0};class Sr{constructor(e,t){if(t=DC(t),e instanceof Sr)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>eb)throw TypeError(`version is longer than ${eb} characters`);il("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?al[ll.LOOSE]:al[ll.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>ol||this.major<0)throw TypeError("Invalid major version");if(this.minor>ol||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>ol||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<ol)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(il("SemVer.compare",this.version,this.options,e),!(e instanceof Sr)){if(typeof e==="string"&&e===this.version)return 0;e=new Sr(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Sr))e=new Sr(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(il("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Zu(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Sr))e=new Sr(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(il("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return Zu(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?al[ll.PRERELEASELOOSE]:al[ll.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(LC(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}tb.exports=Sr});var Dn=C(function(yG,nb){var rb=ht(),FC=(e,t,r=!1)=>{if(e instanceof rb)return e;try{return new rb(e,t)}catch(n){if(!r)return null;throw n}};nb.exports=FC});var ib=C(function(bG,sb){var qC=Dn(),HC=(e,t)=>{let r=qC(e,t);return r?r.version:null};sb.exports=HC});var ab=C(function(xG,ob){var VC=Dn(),BC=(e,t)=>{let r=VC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};ob.exports=BC});var ub=C(function($G,cb){var lb=ht(),WC=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new lb(e instanceof lb?e.version:e,r).inc(t,n,s).version}catch(i){return null}};cb.exports=WC});var pb=C(function(vG,fb){var db=Dn(),UC=(e,t)=>{let r=db(e,null,!0),n=db(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let d=l?"pre":"";if(r.major!==n.major)return d+"major";if(r.minor!==n.minor)return d+"minor";if(r.patch!==n.patch)return d+"patch";return"prerelease"};fb.exports=UC});var hb=C(function(wG,mb){var zC=ht(),GC=(e,t)=>new zC(e,t).major;mb.exports=GC});var yb=C(function(SG,gb){var KC=ht(),YC=(e,t)=>new KC(e,t).minor;gb.exports=YC});var xb=C(function(EG,bb){var XC=ht(),ZC=(e,t)=>new XC(e,t).patch;bb.exports=ZC});var vb=C(function(_G,$b){var QC=Dn(),eN=(e,t)=>{let r=QC(e,t);return r&&r.prerelease.length?r.prerelease:null};$b.exports=eN});var pr=C(function(PG,Sb){var wb=ht(),tN=(e,t,r)=>new wb(e,r).compare(new wb(t,r));Sb.exports=tN});var _b=C(function(jG,Eb){var rN=pr(),nN=(e,t,r)=>rN(t,e,r);Eb.exports=nN});var jb=C(function(kG,Pb){var sN=pr(),iN=(e,t)=>sN(e,t,!0);Pb.exports=iN});var cl=C(function(RG,Rb){var kb=ht(),oN=(e,t,r)=>{let n=new kb(e,r),s=new kb(t,r);return n.compare(s)||n.compareBuild(s)};Rb.exports=oN});var Ob=C(function(AG,Ab){var aN=cl(),lN=(e,t)=>e.sort((r,n)=>aN(r,n,t));Ab.exports=lN});var Nb=C(function(OG,Cb){var cN=cl(),uN=(e,t)=>e.sort((r,n)=>cN(n,r,t));Cb.exports=uN});var uo=C(function(CG,Tb){var dN=pr(),fN=(e,t,r)=>dN(e,t,r)>0;Tb.exports=fN});var ul=C(function(NG,Ib){var pN=pr(),mN=(e,t,r)=>pN(e,t,r)<0;Ib.exports=mN});var Qu=C(function(TG,Mb){var hN=pr(),gN=(e,t,r)=>hN(e,t,r)===0;Mb.exports=gN});var ed=C(function(IG,Jb){var yN=pr(),bN=(e,t,r)=>yN(e,t,r)!==0;Jb.exports=bN});var dl=C(function(MG,Db){var xN=pr(),$N=(e,t,r)=>xN(e,t,r)>=0;Db.exports=$N});var fl=C(function(JG,Lb){var vN=pr(),wN=(e,t,r)=>vN(e,t,r)<=0;Lb.exports=wN});var td=C(function(DG,Fb){var SN=Qu(),EN=ed(),_N=uo(),PN=dl(),jN=ul(),kN=fl(),RN=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return SN(e,r,n);case"!=":return EN(e,r,n);case">":return _N(e,r,n);case">=":return PN(e,r,n);case"<":return jN(e,r,n);case"<=":return kN(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Fb.exports=RN});var Hb=C(function(LG,qb){var AN=ht(),ON=Dn(),{safeRe:pl,t:ml}=ai(),CN=(e,t)=>{if(e instanceof AN)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?pl[ml.COERCEFULL]:pl[ml.COERCE]);else{let l=t.includePrerelease?pl[ml.COERCERTLFULL]:pl[ml.COERCERTL],c;while((c=l.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;l.lastIndex=c.index+c[1].length+c[2].length}l.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return ON(`${n}.${s}.${i}${o}${a}`,t)};qb.exports=CN});var Bb=C(function(FG,Vb){var NN=Dn(),TN=oi(),IN=ht(),MN=(e,t,r)=>{if(!TN.RELEASE_TYPES.includes(t))return null;let n=JN(e,r);return n&&DN(n,t)},JN=(e,t)=>{let r=e instanceof IN?e.version:e;return NN(r,t)},DN=(e,t)=>{if(LN(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},LN=(e)=>e.startsWith("pre");Vb.exports=MN});var zb=C(function(qG,Ub){class Wb{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}Ub.exports=Wb});var mr=C(function(HG,Xb){var FN=/\s+/g;class fo{constructor(e,t){if(t=HN(t),e instanceof fo)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new fo(e.raw,t);if(e instanceof rd)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(FN," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!Kb(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&XN(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(YN,"");let r=((this.options.includePrerelease&&GN)|(this.options.loose&&KN))+":"+e,n=Gb.get(r);if(n)return n;let s=this.options.loose,i=s?Ot[gt.HYPHENRANGELOOSE]:Ot[gt.HYPHENRANGE];e=e.replace(i,lT(this.options.includePrerelease)),qe("hyphen replace",e),e=e.replace(Ot[gt.COMPARATORTRIM],WN),qe("comparator trim",e),e=e.replace(Ot[gt.TILDETRIM],UN),qe("tilde trim",e),e=e.replace(Ot[gt.CARETTRIM],zN),qe("caret trim",e);let o=e.split(" ").map((d)=>ZN(d,this.options)).join(" ").split(/\s+/).map((d)=>aT(d,this.options));if(s)o=o.filter((d)=>(qe("loose invalid filter",d,this.options),!!d.match(Ot[gt.COMPARATORLOOSE])));qe("range list",o);let a=new Map,l=o.map((d)=>new rd(d,this.options));for(let d of l){if(Kb(d))return[d];a.set(d.value,d)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return Gb.set(r,c),c}intersects(e,t){if(!(e instanceof fo))throw TypeError("a Range is required");return this.set.some((r)=>Yb(r,t)&&e.set.some((n)=>Yb(n,t)&&r.every((s)=>n.every((i)=>s.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new VN(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(cT(this.set[t],e,this.options))return!0;return!1}}Xb.exports=fo;var qN=zb(),Gb=new qN,HN=sl(),rd=po(),qe=co(),VN=ht(),{safeRe:Ot,src:BN,t:gt,comparatorTrimReplace:WN,tildeTrimReplace:UN,caretTrimReplace:zN}=ai(),{FLAG_INCLUDE_PRERELEASE:GN,FLAG_LOOSE:KN}=oi(),YN=new RegExp(BN[gt.BUILD],"g"),Kb=(e)=>e.value==="<0.0.0-0",XN=(e)=>e.value==="",Yb=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((i)=>s.intersects(i,t)),s=n.pop();return r},ZN=(e,t)=>(e=e.replace(Ot[gt.BUILD],""),qe("comp",e,t),e=rT(e,t),qe("caret",e),e=eT(e,t),qe("tildes",e),e=sT(e,t),qe("xrange",e),e=oT(e,t),qe("stars",e),e),at=(e)=>!e||e.toLowerCase()==="x"||e==="*",QN=(e,t,r)=>at(e)&&!at(t)||at(t)&&r&&!at(r),eT=(e,t)=>e.trim().split(/\s+/).map((r)=>tT(r,t)).join(" "),tT=(e,t)=>{let r=t.loose?Ot[gt.TILDELOOSE]:Ot[gt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("tilde",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)qe("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return qe("tilde return",c),c})},rT=(e,t)=>e.trim().split(/\s+/).map((r)=>nT(r,t)).join(" "),nT=(e,t)=>{qe("caret",e,t);let r=t.loose?Ot[gt.CARETLOOSE]:Ot[gt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("caret",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))if(i==="0")c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`;else if(l)if(qe("replaceCaret pr",l),i==="0")if(o==="0")c=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`;else if(qe("no pr"),i==="0")if(o==="0")c=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`;return qe("caret return",c),c})},sT=(e,t)=>(qe("replaceXRanges",e,t),e.split(/\s+/).map((r)=>iT(r,t)).join(" ")),iT=(e,t)=>{e=e.trim();let r=t.loose?Ot[gt.XRANGELOOSE]:Ot[gt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(qe("xRange",e,n,s,i,o,a,l),QN(i,o,a))return e;let c=at(i),d=c||at(o),p=d||at(a),h=p;if(s==="="&&h)s="";if(l=t.includePrerelease?"-0":"",c)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&h){if(d)o=0;if(a=0,s===">")if(s=">=",d)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",d)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(d)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return qe("xRange return",n),n})},oT=(e,t)=>(qe("replaceStars",e,t),e.trim().replace(Ot[gt.STAR],"")),aT=(e,t)=>(qe("replaceGTE0",e,t),e.trim().replace(Ot[t.includePrerelease?gt.GTE0PRE:gt.GTE0],"")),lT=(e)=>(t,r,n,s,i,o,a,l,c,d,p,h)=>{if(at(n))r="";else if(at(s))r=`>=${n}.0.0${e?"-0":""}`;else if(at(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(at(c))l="";else if(at(d))l=`<${+c+1}.0.0-0`;else if(at(p))l=`<${c}.${+d+1}.0-0`;else if(h)l=`<=${c}.${d}.${p}-${h}`;else if(e)l=`<${c}.${d}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},cT=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(qe(e[n].semver),e[n].semver===rd.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var po=C(function(VG,nx){var mo=Symbol("SemVer ANY");class hl{static get ANY(){return mo}constructor(e,t){if(t=Zb(t),e instanceof hl)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),sd("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===mo)this.value="";else this.value=this.operator+this.semver.version;sd("comp",this)}parse(e){let t=this.options.loose?Qb[ex.COMPARATORLOOSE]:Qb[ex.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=mo;else this.semver=new tx(r[2],this.options.loose)}toString(){return this.value}test(e){if(sd("Comparator.test",e,this.options.loose),this.semver===mo||e===mo)return!0;if(typeof e==="string")try{e=new tx(e,this.options)}catch(t){return!1}return nd(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof hl))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new rx(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new rx(this.value,t).test(e.semver)}if(t=Zb(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(nd(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(nd(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}nx.exports=hl;var Zb=sl(),{safeRe:Qb,t:ex}=ai(),nd=td(),sd=co(),tx=ht(),rx=mr()});var ho=C(function(BG,sx){var uT=mr(),dT=(e,t,r)=>{try{t=new uT(t,r)}catch(n){return!1}return t.test(e)};sx.exports=dT});var ox=C(function(WG,ix){var fT=mr(),pT=(e,t)=>new fT(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));ix.exports=pT});var lx=C(function(UG,ax){var mT=ht(),hT=mr(),gT=(e,t,r)=>{let n=null,s=null,i=null;try{i=new hT(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new mT(n,r)}}),n};ax.exports=gT});var ux=C(function(zG,cx){var yT=ht(),bT=mr(),xT=(e,t,r)=>{let n=null,s=null,i=null;try{i=new bT(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new yT(n,r)}}),n};cx.exports=xT});var px=C(function(GG,fx){var id=ht(),$T=mr(),dx=uo(),vT=(e,t)=>{e=new $T(e,t);let r=new id("0.0.0");if(e.test(r))return r;if(r=new id("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],i=null;if(s.forEach((o)=>{let a=new id(o.semver.version);switch(o.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!i||dx(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||dx(r,i)))r=i}if(r&&e.test(r))return r;return null};fx.exports=vT});var hx=C(function(KG,mx){var wT=mr(),ST=(e,t)=>{try{return new wT(e,t).range||"*"}catch(r){return null}};mx.exports=ST});var gl=C(function(YG,xx){var ET=ht(),bx=po(),{ANY:_T}=bx,PT=mr(),jT=ho(),gx=uo(),yx=ul(),kT=fl(),RT=dl(),AT=(e,t,r,n)=>{e=new ET(e,n),t=new PT(t,n);let s,i,o,a,l;switch(r){case">":s=gx,i=kT,o=yx,a=">",l=">=";break;case"<":s=yx,i=RT,o=gx,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(jT(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let d=t.set[c],p=null,h=null;if(d.forEach((m)=>{if(m.semver===_T)m=new bx(">=0.0.0");if(p=p||m,h=h||m,s(m.semver,p.semver,n))p=m;else if(o(m.semver,h.semver,n))h=m}),p.operator===a||p.operator===l)return!1;if((!h.operator||h.operator===a)&&i(e,h.semver))return!1;else if(h.operator===l&&o(e,h.semver))return!1}return!0};xx.exports=AT});var vx=C(function(XG,$x){var OT=gl(),CT=(e,t,r)=>OT(e,t,">",r);$x.exports=CT});var Sx=C(function(ZG,wx){var NT=gl(),TT=(e,t,r)=>NT(e,t,"<",r);wx.exports=TT});var Px=C(function(QG,_x){var Ex=mr(),IT=(e,t,r)=>(e=new Ex(e,r),t=new Ex(t,r),e.intersects(t,r));_x.exports=IT});var kx=C(function(eK,jx){var MT=ho(),JT=pr();jx.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((d,p)=>JT(d,p,r));for(let d of o)if(MT(d,t,r)){if(i=d,!s)s=d}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[d,p]of n)if(d===p)a.push(d);else if(!p&&d===o[0])a.push("*");else if(!p)a.push(`>=${d}`);else if(d===o[0])a.push(`<=${p}`);else a.push(`${d} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var Tx=C(function(tK,Nx){var Rx=mr(),ld=po(),{ANY:od}=ld,ad=ho(),cd=pr(),DT=(e,t,r={})=>{if(e===t)return!0;e=new Rx(e,r),t=new Rx(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=FT(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},LT=[new ld(">=0.0.0-0")],Ax=[new ld(">=0.0.0")],FT=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===od)if(t.length===1&&t[0].semver===od)return!0;else if(r.includePrerelease)e=LT;else e=Ax;if(t.length===1&&t[0].semver===od)if(r.includePrerelease)return!0;else t=Ax;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=Ox(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=Cx(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=cd(s.semver,i.semver,r),o>0)return null;else if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!ad(m,String(s),r))return null;if(i&&!ad(m,String(i),r))return null;for(let b of t)if(!ad(m,String(b),r))return!1;return!0}let a,l,c,d,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0)p=!1;for(let m of t){if(d=d||m.operator===">"||m.operator===">=",c=c||m.operator==="<"||m.operator==="<=",s){if(h){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===h.major&&m.semver.minor===h.minor&&m.semver.patch===h.patch)h=!1}if(m.operator===">"||m.operator===">="){if(a=Ox(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!m.test(s.semver))return!1}if(i){if(p){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===p.major&&m.semver.minor===p.minor&&m.semver.patch===p.patch)p=!1}if(m.operator==="<"||m.operator==="<="){if(l=Cx(i,m,r),l===m&&l!==i)return!1}else if(i.operator==="<="&&!m.test(i.semver))return!1}if(!m.operator&&(i||s)&&o!==0)return!1}if(s&&c&&!i&&o!==0)return!1;if(i&&d&&!s&&o!==0)return!1;if(h||p)return!1;return!0},Ox=(e,t,r)=>{if(!e)return t;let n=cd(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Cx=(e,t,r)=>{if(!e)return t;let n=cd(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Nx.exports=DT});var Dx=C(function(rK,Jx){var ud=ai(),Ix=oi(),qT=ht(),Mx=Xu(),HT=Dn(),VT=ib(),BT=ab(),WT=ub(),UT=pb(),zT=hb(),GT=yb(),KT=xb(),YT=vb(),XT=pr(),ZT=_b(),QT=jb(),eI=cl(),tI=Ob(),rI=Nb(),nI=uo(),sI=ul(),iI=Qu(),oI=ed(),aI=dl(),lI=fl(),cI=td(),uI=Hb(),dI=Bb(),fI=po(),pI=mr(),mI=ho(),hI=ox(),gI=lx(),yI=ux(),bI=px(),xI=hx(),$I=gl(),vI=vx(),wI=Sx(),SI=Px(),EI=kx(),_I=Tx();Jx.exports={parse:HT,valid:VT,clean:BT,inc:WT,diff:UT,major:zT,minor:GT,patch:KT,prerelease:YT,compare:XT,rcompare:ZT,compareLoose:QT,compareBuild:eI,sort:tI,rsort:rI,gt:nI,lt:sI,eq:iI,neq:oI,gte:aI,lte:lI,cmp:cI,coerce:uI,truncate:dI,Comparator:fI,Range:pI,satisfies:mI,toComparators:hI,maxSatisfying:gI,minSatisfying:yI,minVersion:bI,validRange:xI,outside:$I,gtr:vI,ltr:wI,intersects:SI,simplifyRange:EI,subset:_I,SemVer:qT,re:ud.re,src:ud.src,tokens:ud.t,SEMVER_SPEC_VERSION:Ix.SEMVER_SPEC_VERSION,RELEASE_TYPES:Ix.RELEASE_TYPES,compareIdentifiers:Mx.compareIdentifiers,rcompareIdentifiers:Mx.rcompareIdentifiers}});var gn;var yl=q(()=>{gn={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.35.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unnebäck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix Bünemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","Jérémy Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kotěšovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugué <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>","Dmytro Tiapukhin <cool.gegeg@gmail.com>","Florian Lefebvre <contact@florian-lefebvre.dev>"],scripts:{build:"node install/build.js","build:dist":"node scripts/build.mjs",clean:"rm -rf src/build/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types && npm run lint-publish","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-publish":"publint --strict","lint-types":"tsd --files ./test/types/sharp.test-d.{cts,mts}","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-wasm-wrappers":"node npm/wasm-wrappers.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",files:["dist","install","lib/index.d.ts","src/*.{cc,h,gyp}"],main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.mts",exports:{".":{import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},sideEffects:!0,repository:{type:"git",url:"git+https://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.1.0","detect-libc":"^2.1.2",semver:"^7.8.5"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.35.5","@img/sharp-darwin-x64":"0.35.5","@img/sharp-freebsd-wasm32":"0.35.5","@img/sharp-libvips-darwin-arm64":"1.3.4","@img/sharp-libvips-darwin-x64":"1.3.4","@img/sharp-libvips-linux-arm":"1.3.4","@img/sharp-libvips-linux-arm64":"1.3.4","@img/sharp-libvips-linux-ppc64":"1.3.4","@img/sharp-libvips-linux-riscv64":"1.3.4","@img/sharp-libvips-linux-s390x":"1.3.4","@img/sharp-libvips-linux-x64":"1.3.4","@img/sharp-libvips-linuxmusl-arm64":"1.3.4","@img/sharp-libvips-linuxmusl-x64":"1.3.4","@img/sharp-linux-arm":"0.35.5","@img/sharp-linux-arm64":"0.35.5","@img/sharp-linux-ppc64":"0.35.5","@img/sharp-linux-riscv64":"0.35.5","@img/sharp-linux-s390x":"0.35.5","@img/sharp-linux-x64":"0.35.5","@img/sharp-linuxmusl-arm64":"0.35.5","@img/sharp-linuxmusl-x64":"0.35.5","@img/sharp-webcontainers-wasm32":"0.35.5","@img/sharp-win32-arm64":"0.35.5","@img/sharp-win32-ia32":"0.35.5","@img/sharp-win32-x64":"0.35.5"},peerDependenciesMeta:{"@types/node":{optional:!0}},devDependencies:{"@biomejs/biome":"^2.5.14","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.11.3","@img/sharp-libvips-dev":"1.3.4","@img/sharp-libvips-dev-wasm32":"1.3.4","@img/sharp-libvips-win32-arm64":"1.3.4","@img/sharp-libvips-win32-ia32":"1.3.4","@img/sharp-libvips-win32-x64":"1.3.4","@types/node":"*",emnapi:"^1.11.3","exif-reader":"^2.0.3",icc:"^4.0.0","node-addon-api":"^8.9.2","node-gyp":"^12.4.0",publint:"^0.3.24","tar-fs":"^3.1.3",tsd:"^0.33.0",yauzl:"^3.4.0"},license:"Apache-2.0",engines:{node:">=20.9.0"},config:{libvips:">=8.18.7"},funding:{url:"https://opencollective.com/libvips"}}});import{spawnSync as go}from"node:child_process";import{createHash as jI}from"node:crypto";var yo,fd,kI,Fx,RI,pd,AI=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},qx=()=>fd.default.isNonGlibcLinuxSync()?fd.default.familySync():"",OI=()=>`${process.platform}${qx()}-${process.arch}`,li=()=>{if(Hx())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:qx();return`${t||process.platform}${n}-${e||process.arch}`},CI=()=>{try{return Ne(`@img/sharp-libvips-dev-${li()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},NI=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},TI=()=>{try{return Ne(`@img/sharp-libvips-dev-${li()}/lib`)}catch{try{return Ne(`@img/sharp-libvips-${li()}/lib`)}catch{}}return""},II=()=>{if(process.release?.name==="node"&&process.versions){if(!yo.default.satisfies(process.versions.node,gn.engines.node))return{found:process.versions.node,expected:gn.engines.node}}},Hx=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},MI=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(go("sysctl sysctl.proc_translated",pd).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},Lx=(e)=>jI("sha512").update(e).digest("hex"),JI=()=>{try{let e=Lx(`imgsharp-libvips-${li()}`),t=yo.default.coerce(gn.optionalDependencies[`@img/sharp-libvips-${li()}`],{includePrerelease:!0}).version;return Lx(`${e}npm:${t}`).slice(0,10)}catch{}return""},DI=()=>go(`node-gyp rebuild --directory=src ${Hx()?"--nodedir=emscripten":""}`,{...pd,stdio:"inherit"}).status,Vx=()=>{if(process.platform!=="win32")return(go("pkg-config --modversion vips-cpp",{...pd,env:{...process.env,PKG_CONFIG_PATH:Bx()}}).stdout||"").trim();else return""},LI=()=>{try{let e=(go("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},FI=()=>{try{let e=(go("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},Bx=()=>{if(process.platform!=="win32")return[LI(),FI(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},dd=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},qI=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return dd(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return dd(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(MI())return dd(!1,"Rosetta",e);let t=Vx();return!!t&&yo.default.gte(t,Fx)},bl;var md=q(()=>{yl();yo=Lt(Dx(),1),fd=Lt(nl(),1);/*!
331
+ */d={defined:Cy,object:oC,plainObject:aC,fn:lC,bool:cC,buffer:uC,typedArray:dC,arrayBuffer:fC,string:pC,number:mC,integer:hC,inRange:gC,inArray:yC,invalidParameterError:bC,nativeError:xC}});var Iy=C(function(PG,Ny){var Ty=()=>process.platform==="linux",sl=null,$C=()=>{if(!sl)if(Ty()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,sl=process.report.getReport(),process.report.excludeNetwork=e}else sl={};return sl};Ny.exports={isLinux:Ty,getReport:$C}});var Jy=C(function(jG,My){var ii=Te("fs"),vC=(e)=>{let t=ii.openSync(e,"r"),r=Buffer.alloc(2048),n=ii.readSync(t,r,0,2048,0);return ii.close(t,()=>{}),r.subarray(0,n)},wC=(e)=>new Promise((t,r)=>{ii.open(e,"r",(n,s)=>{if(n)r(n);else{let i=Buffer.alloc(2048);ii.read(s,i,0,2048,0,(o,a)=>{t(i.subarray(0,a)),ii.close(s,()=>{})})}})});My.exports={LDD_PATH:"/usr/bin/ldd",SELF_PATH:"/proc/self/exe",readFileSync:vC,readFile:wC}});var Ly=C(function(kG,Dy){var SC=(e)=>{if(e.length<64)return null;if(e.readUInt32BE(0)!==2135247942)return null;if(e.readUInt8(4)!==2)return null;if(e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),r=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let s=0;s<n;s++){let i=t+s*r;if(e.readUInt32LE(i)===3){let a=e.readUInt32LE(i+8),l=e.readUInt32LE(i+32);return e.subarray(a,a+l).toString().replace(/\0.*$/g,"")}}return null};Dy.exports={interpreterPath:SC}});var ol=C(function(RG,rb){var qy=Te("child_process"),{isLinux:oi,getReport:Hy}=Iy(),{LDD_PATH:il,SELF_PATH:Vy,readFile:ed,readFileSync:td}=Jy(),{interpreterPath:By}=Ly(),Lr,Fr,qr,Jn="",Wy=()=>{if(!Jn)return new Promise((e)=>{qy.exec("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",(t,r)=>{Jn=t?" ":r,e(Jn)})});return Jn},Uy=()=>{if(!Jn)try{Jn=qy.execSync("getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",{encoding:"utf8"})}catch(e){Jn=" "}return Jn},hn="glibc",zy=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,ws="musl",EC=(e)=>e.includes("libc.musl-")||e.includes("ld-musl-"),Gy=()=>{let e=Hy();if(e.header&&e.header.glibcVersionRuntime)return hn;if(Array.isArray(e.sharedObjects)){if(e.sharedObjects.some(EC))return ws}return null},Ky=(e)=>{let[t,r]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return hn;if(r&&r.includes(ws))return ws;return null},Yy=(e)=>{if(e){if(e.includes("/ld-musl-"))return ws;else if(e.includes("/ld-linux-"))return hn}return null},Xy=(e)=>{if(e=e.toString(),e.includes("musl"))return ws;if(e.includes("GNU C Library"))return hn;return null},_C=async()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=await ed(il);Fr=Xy(e)}catch(e){}return Fr},PC=()=>{if(Fr!==void 0)return Fr;Fr=null;try{let e=td(il);Fr=Xy(e)}catch(e){}return Fr},jC=async()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=await ed(Vy),t=By(e);Lr=Yy(t)}catch(e){}return Lr},kC=()=>{if(Lr!==void 0)return Lr;Lr=null;try{let e=td(Vy),t=By(e);Lr=Yy(t)}catch(e){}return Lr},Zy=async()=>{let e=null;if(oi()){if(e=await jC(),!e){if(e=await _C(),!e)e=Gy();if(!e){let t=await Wy();e=Ky(t)}}}return e},Qy=()=>{let e=null;if(oi()){if(e=kC(),!e){if(e=PC(),!e)e=Gy();if(!e){let t=Uy();e=Ky(t)}}}return e},RC=async()=>oi()&&await Zy()!==hn,AC=()=>oi()&&Qy()!==hn,OC=async()=>{if(qr!==void 0)return qr;qr=null;try{let t=(await ed(il)).match(zy);if(t)qr=t[1]}catch(e){}return qr},CC=()=>{if(qr!==void 0)return qr;qr=null;try{let t=td(il).match(zy);if(t)qr=t[1]}catch(e){}return qr},eb=()=>{let e=Hy();if(e.header&&e.header.glibcVersionRuntime)return e.header.glibcVersionRuntime;return null},Fy=(e)=>e.trim().split(/\s+/)[1],tb=(e)=>{let[t,r,n]=e.split(/[\r\n]+/);if(t&&t.includes(hn))return Fy(t);if(r&&n&&r.includes(ws))return Fy(n);return null},TC=async()=>{let e=null;if(oi()){if(e=await OC(),!e)e=eb();if(!e){let t=await Wy();e=tb(t)}}return e},NC=()=>{let e=null;if(oi()){if(e=CC(),!e)e=eb();if(!e){let t=Uy();e=tb(t)}}return e};rb.exports={GLIBC:hn,MUSL:ws,family:Zy,familySync:Qy,isNonGlibcLinux:RC,isNonGlibcLinuxSync:AC,version:TC,versionSync:NC}});var ai=C(function(AG,nb){var IC=Number.MAX_SAFE_INTEGER||9007199254740991,MC=["major","premajor","minor","preminor","patch","prepatch","prerelease"];nb.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:IC,RELEASE_TYPES:MC,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var uo=C(function(OG,sb){var JC=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};sb.exports=JC});var li=C(function(Hr,ib){var{MAX_SAFE_COMPONENT_LENGTH:rd,MAX_SAFE_BUILD_LENGTH:DC,MAX_LENGTH:LC}=ai(),FC=uo();Hr=ib.exports={};var qC=Hr.re=[],HC=Hr.safeRe=[],Z=Hr.src=[],VC=Hr.safeSrc=[],Q=Hr.t={},BC=0,nd="[a-zA-Z0-9-]",WC=[["\\s",1],["\\d",LC],[nd,DC]],UC=(e)=>{for(let[t,r]of WC)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},be=(e,t,r)=>{let n=UC(t),s=BC++;FC(e,s,t),Q[e]=s,Z[s]=t,VC[s]=n,qC[s]=new RegExp(t,r?"g":void 0),HC[s]=new RegExp(n,r?"g":void 0)};be("NUMERICIDENTIFIER","0|[1-9]\\d*");be("NUMERICIDENTIFIERLOOSE","\\d+");be("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${nd}*`);be("MAINVERSION",`(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})\\.(${Z[Q.NUMERICIDENTIFIER]})`);be("MAINVERSIONLOOSE",`(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})\\.(${Z[Q.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASEIDENTIFIER",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIER]})`);be("PRERELEASEIDENTIFIERLOOSE",`(?:${Z[Q.NONNUMERICIDENTIFIER]}|${Z[Q.NUMERICIDENTIFIERLOOSE]})`);be("PRERELEASE",`(?:-(${Z[Q.PRERELEASEIDENTIFIER]}(?:\\.${Z[Q.PRERELEASEIDENTIFIER]})*))`);be("PRERELEASELOOSE",`(?:-?(${Z[Q.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Z[Q.PRERELEASEIDENTIFIERLOOSE]})*))`);be("BUILDIDENTIFIER",`${nd}+`);be("BUILD",`(?:\\+(${Z[Q.BUILDIDENTIFIER]}(?:\\.${Z[Q.BUILDIDENTIFIER]})*))`);be("FULLPLAIN",`v?${Z[Q.MAINVERSION]}${Z[Q.PRERELEASE]}?${Z[Q.BUILD]}?`);be("FULL",`^${Z[Q.FULLPLAIN]}$`);be("LOOSEPLAIN",`[v=\\s]*${Z[Q.MAINVERSIONLOOSE]}${Z[Q.PRERELEASELOOSE]}?${Z[Q.BUILD]}?`);be("LOOSE",`^${Z[Q.LOOSEPLAIN]}$`);be("GTLT","((?:<|>)?=?)");be("XRANGEIDENTIFIERLOOSE",`${Z[Q.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);be("XRANGEIDENTIFIER",`${Z[Q.NUMERICIDENTIFIER]}|x|X|\\*`);be("XRANGEPLAIN",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:\\.(${Z[Q.XRANGEIDENTIFIER]})(?:${Z[Q.PRERELEASE]})?${Z[Q.BUILD]}?)?)?`);be("XRANGEPLAINLOOSE",`[v=\\s]*(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Z[Q.XRANGEIDENTIFIERLOOSE]})(?:${Z[Q.PRERELEASELOOSE]})?${Z[Q.BUILD]}?)?)?`);be("XRANGE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAIN]}$`);be("XRANGELOOSE",`^${Z[Q.GTLT]}\\s*${Z[Q.XRANGEPLAINLOOSE]}$`);be("COERCEPLAIN",`(^|[^\\d])(\\d{1,${rd}})(?:\\.(\\d{1,${rd}}))?(?:\\.(\\d{1,${rd}}))?`);be("COERCE",`${Z[Q.COERCEPLAIN]}(?:$|[^\\d])`);be("COERCEFULL",Z[Q.COERCEPLAIN]+`(?:${Z[Q.PRERELEASE]})?(?:${Z[Q.BUILD]})?(?:$|[^\\d])`);be("COERCERTL",Z[Q.COERCE],!0);be("COERCERTLFULL",Z[Q.COERCEFULL],!0);be("LONETILDE","(?:~>?)");be("TILDETRIM",`(\\s*)${Z[Q.LONETILDE]}\\s+`,!0);Hr.tildeTrimReplace="$1~";be("TILDE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAIN]}$`);be("TILDELOOSE",`^${Z[Q.LONETILDE]}${Z[Q.XRANGEPLAINLOOSE]}$`);be("LONECARET","(?:\\^)");be("CARETTRIM",`(\\s*)${Z[Q.LONECARET]}\\s+`,!0);Hr.caretTrimReplace="$1^";be("CARET",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAIN]}$`);be("CARETLOOSE",`^${Z[Q.LONECARET]}${Z[Q.XRANGEPLAINLOOSE]}$`);be("COMPARATORLOOSE",`^${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]})$|^$`);be("COMPARATOR",`^${Z[Q.GTLT]}\\s*(${Z[Q.FULLPLAIN]})$|^$`);be("COMPARATORTRIM",`(\\s*)${Z[Q.GTLT]}\\s*(${Z[Q.LOOSEPLAIN]}|${Z[Q.XRANGEPLAIN]})`,!0);Hr.comparatorTrimReplace="$1$2$3";be("HYPHENRANGE",`^\\s*(${Z[Q.XRANGEPLAIN]})\\s+-\\s+(${Z[Q.XRANGEPLAIN]})\\s*$`);be("HYPHENRANGELOOSE",`^\\s*(${Z[Q.XRANGEPLAINLOOSE]})\\s+-\\s+(${Z[Q.XRANGEPLAINLOOSE]})\\s*$`);be("STAR","(<|>)?=?\\s*\\*");be("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");be("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var al=C(function(CG,ob){var zC=Object.freeze({loose:!0}),GC=Object.freeze({}),KC=(e)=>{if(!e)return GC;if(typeof e!=="object")return zC;return e};ob.exports=KC});var sd=C(function(TG,cb){var ab=/^[0-9]+$/,lb=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=ab.test(e),n=ab.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},YC=(e,t)=>lb(t,e);cb.exports={compareIdentifiers:lb,rcompareIdentifiers:YC}});var ht=C(function(NG,db){var ll=uo(),{MAX_LENGTH:ub,MAX_SAFE_INTEGER:cl}=ai(),{safeRe:ul,t:dl}=li(),XC=al(),{compareIdentifiers:id}=sd(),ZC=(e,t)=>{let r=t.split(".");if(r.length>e.length)return!1;for(let n=0;n<r.length;n++)if(id(e[n],r[n])!==0)return!1;return!0};class Er{constructor(e,t){if(t=XC(t),e instanceof Er)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>ub)throw TypeError(`version is longer than ${ub} characters`);ll("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?ul[dl.LOOSE]:ul[dl.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>cl||this.major<0)throw TypeError("Invalid major version");if(this.minor>cl||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>cl||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<cl)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(ll("SemVer.compare",this.version,this.options,e),!(e instanceof Er)){if(typeof e==="string"&&e===this.version)return 0;e=new Er(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Er))e=new Er(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Er))e=new Er(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(ll("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return id(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Er))e=new Er(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(ll("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return id(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?ul[dl.PRERELEASELOOSE]:ul[dl.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(ZC(this.prerelease,t)){let i=this.prerelease[t.split(".").length];if(isNaN(i))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}db.exports=Er});var Dn=C(function(IG,pb){var fb=ht(),QC=(e,t,r=!1)=>{if(e instanceof fb)return e;try{return new fb(e,t)}catch(n){if(!r)return null;throw n}};pb.exports=QC});var hb=C(function(MG,mb){var eT=Dn(),tT=(e,t)=>{let r=eT(e,t);return r?r.version:null};mb.exports=tT});var yb=C(function(JG,gb){var rT=Dn(),nT=(e,t)=>{let r=rT(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};gb.exports=nT});var $b=C(function(DG,xb){var bb=ht(),sT=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new bb(e instanceof bb?e.version:e,r).inc(t,n,s).version}catch(i){return null}};xb.exports=sT});var Sb=C(function(LG,wb){var vb=Dn(),iT=(e,t)=>{let r=vb(e,null,!0),n=vb(t,null,!0),s=r.compare(n);if(s===0)return null;let i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(a.compareMain(o)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let u=l?"pre":"";if(r.major!==n.major)return u+"major";if(r.minor!==n.minor)return u+"minor";if(r.patch!==n.patch)return u+"patch";return"prerelease"};wb.exports=iT});var _b=C(function(FG,Eb){var oT=ht(),aT=(e,t)=>new oT(e,t).major;Eb.exports=aT});var jb=C(function(qG,Pb){var lT=ht(),cT=(e,t)=>new lT(e,t).minor;Pb.exports=cT});var Rb=C(function(HG,kb){var uT=ht(),dT=(e,t)=>new uT(e,t).patch;kb.exports=dT});var Ob=C(function(VG,Ab){var fT=Dn(),pT=(e,t)=>{let r=fT(e,t);return r&&r.prerelease.length?r.prerelease:null};Ab.exports=pT});var pr=C(function(BG,Tb){var Cb=ht(),mT=(e,t,r)=>new Cb(e,r).compare(new Cb(t,r));Tb.exports=mT});var Ib=C(function(WG,Nb){var hT=pr(),gT=(e,t,r)=>hT(t,e,r);Nb.exports=gT});var Jb=C(function(UG,Mb){var yT=pr(),bT=(e,t)=>yT(e,t,!0);Mb.exports=bT});var fl=C(function(zG,Lb){var Db=ht(),xT=(e,t,r)=>{let n=new Db(e,r),s=new Db(t,r);return n.compare(s)||n.compareBuild(s)};Lb.exports=xT});var qb=C(function(GG,Fb){var $T=fl(),vT=(e,t)=>e.sort((r,n)=>$T(r,n,t));Fb.exports=vT});var Vb=C(function(KG,Hb){var wT=fl(),ST=(e,t)=>e.sort((r,n)=>wT(n,r,t));Hb.exports=ST});var fo=C(function(YG,Bb){var ET=pr(),_T=(e,t,r)=>ET(e,t,r)>0;Bb.exports=_T});var pl=C(function(XG,Wb){var PT=pr(),jT=(e,t,r)=>PT(e,t,r)<0;Wb.exports=jT});var od=C(function(ZG,Ub){var kT=pr(),RT=(e,t,r)=>kT(e,t,r)===0;Ub.exports=RT});var ad=C(function(QG,zb){var AT=pr(),OT=(e,t,r)=>AT(e,t,r)!==0;zb.exports=OT});var ml=C(function(eK,Gb){var CT=pr(),TT=(e,t,r)=>CT(e,t,r)>=0;Gb.exports=TT});var hl=C(function(tK,Kb){var NT=pr(),IT=(e,t,r)=>NT(e,t,r)<=0;Kb.exports=IT});var ld=C(function(rK,Yb){var MT=od(),JT=ad(),DT=fo(),LT=ml(),FT=pl(),qT=hl(),HT=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return MT(e,r,n);case"!=":return JT(e,r,n);case">":return DT(e,r,n);case">=":return LT(e,r,n);case"<":return FT(e,r,n);case"<=":return qT(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};Yb.exports=HT});var Zb=C(function(nK,Xb){var VT=ht(),BT=Dn(),{safeRe:gl,t:yl}=li(),WT=(e,t)=>{if(e instanceof VT)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?gl[yl.COERCEFULL]:gl[yl.COERCE]);else{let l=t.includePrerelease?gl[yl.COERCERTLFULL]:gl[yl.COERCERTL],c;while((c=l.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||c.index+c[0].length!==r.index+r[0].length)r=c;l.lastIndex=c.index+c[1].length+c[2].length}l.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",i=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return BT(`${n}.${s}.${i}${o}${a}`,t)};Xb.exports=WT});var ex=C(function(sK,Qb){var UT=Dn(),zT=ai(),GT=ht(),KT=(e,t,r)=>{if(!zT.RELEASE_TYPES.includes(t))return null;let n=YT(e,r);return n&&XT(n,t)},YT=(e,t)=>{let r=e instanceof GT?e.version:e;return UT(r,t)},XT=(e,t)=>{if(ZT(t))return e.version;switch(e.prerelease=[],t){case"major":e.minor=0,e.patch=0;break;case"minor":e.patch=0;break}return e.format()},ZT=(e)=>e.startsWith("pre");Qb.exports=KT});var nx=C(function(iK,rx){class tx{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}rx.exports=tx});var mr=C(function(oK,ax){var QT=/\s+/g;class po{constructor(e,t){if(t=tN(t),e instanceof po)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new po(e.raw,t);if(e instanceof cd)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(QT," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!ix(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&uN(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(cN,"");let r=((this.options.includePrerelease&&aN)|(this.options.loose&&lN))+":"+e,n=sx.get(r);if(n)return n;let s=this.options.loose,i=s?Ot[gt.HYPHENRANGELOOSE]:Ot[gt.HYPHENRANGE];e=e.replace(i,vN(this.options.includePrerelease)),qe("hyphen replace",e),e=e.replace(Ot[gt.COMPARATORTRIM],sN),qe("comparator trim",e),e=e.replace(Ot[gt.TILDETRIM],iN),qe("tilde trim",e),e=e.replace(Ot[gt.CARETTRIM],oN),qe("caret trim",e);let o=e.split(" ").map((u)=>dN(u,this.options)).join(" ").split(/\s+/).map((u)=>$N(u,this.options));if(s)o=o.filter((u)=>(qe("loose invalid filter",u,this.options),!!u.match(Ot[gt.COMPARATORLOOSE])));qe("range list",o);let a=new Map,l=o.map((u)=>new cd(u,this.options));for(let u of l){if(ix(u))return[u];a.set(u.value,u)}if(a.size>1&&a.has(""))a.delete("");let c=[...a.values()];return sx.set(r,c),c}intersects(e,t){if(!(e instanceof po))throw TypeError("a Range is required");return this.set.some((r)=>ox(r,t)&&e.set.some((n)=>ox(n,t)&&r.every((s)=>n.every((i)=>s.intersects(i,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new rN(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(wN(this.set[t],e,this.options))return!0;return!1}}ax.exports=po;var eN=nx(),sx=new eN,tN=al(),cd=mo(),qe=uo(),rN=ht(),{safeRe:Ot,src:nN,t:gt,comparatorTrimReplace:sN,tildeTrimReplace:iN,caretTrimReplace:oN}=li(),{FLAG_INCLUDE_PRERELEASE:aN,FLAG_LOOSE:lN}=ai(),cN=new RegExp(nN[gt.BUILD],"g"),ix=(e)=>e.value==="<0.0.0-0",uN=(e)=>e.value==="",ox=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((i)=>s.intersects(i,t)),s=n.pop();return r},dN=(e,t)=>(e=e.replace(Ot[gt.BUILD],""),qe("comp",e,t),e=hN(e,t),qe("caret",e),e=pN(e,t),qe("tildes",e),e=yN(e,t),qe("xrange",e),e=xN(e,t),qe("stars",e),e),at=(e)=>!e||e.toLowerCase()==="x"||e==="*",fN=(e,t,r)=>at(e)&&!at(t)||at(t)&&r&&!at(r),pN=(e,t)=>e.trim().split(/\s+/).map((r)=>mN(r,t)).join(" "),mN=(e,t)=>{let r=t.loose?Ot[gt.TILDELOOSE]:Ot[gt.TILDE],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("tilde",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else if(l)qe("replaceTilde pr",l),c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;return qe("tilde return",c),c})},hN=(e,t)=>e.trim().split(/\s+/).map((r)=>gN(r,t)).join(" "),gN=(e,t)=>{qe("caret",e,t);let r=t.loose?Ot[gt.CARETLOOSE]:Ot[gt.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,i,o,a,l)=>{qe("caret",e,s,i,o,a,l);let c;if(at(i))c="";else if(at(o))c=`>=${i}.0.0${n} <${+i+1}.0.0-0`;else if(at(a))if(i==="0")c=`>=${i}.${o}.0${n} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.0${n} <${+i+1}.0.0-0`;else if(l)if(qe("replaceCaret pr",l),i==="0")if(o==="0")c=`>=${i}.${o}.${a}-${l} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a}-${l} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a}-${l} <${+i+1}.0.0-0`;else if(qe("no pr"),i==="0")if(o==="0")c=`>=${i}.${o}.${a} <${i}.${o}.${+a+1}-0`;else c=`>=${i}.${o}.${a} <${i}.${+o+1}.0-0`;else c=`>=${i}.${o}.${a} <${+i+1}.0.0-0`;return qe("caret return",c),c})},yN=(e,t)=>(qe("replaceXRanges",e,t),e.split(/\s+/).map((r)=>bN(r,t)).join(" ")),bN=(e,t)=>{e=e.trim();let r=t.loose?Ot[gt.XRANGELOOSE]:Ot[gt.XRANGE];return e.replace(r,(n,s,i,o,a,l)=>{if(qe("xRange",e,n,s,i,o,a,l),fN(i,o,a))return e;let c=at(i),u=c||at(o),p=u||at(a),g=p;if(s==="="&&g)s="";if(l=t.includePrerelease?"-0":"",c)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&g){if(u)o=0;if(a=0,s===">")if(s=">=",u)i=+i+1,o=0,a=0;else o=+o+1,a=0;else if(s==="<=")if(s="<",u)i=+i+1;else o=+o+1;if(s==="<")l="-0";n=`${s+i}.${o}.${a}${l}`}else if(u)n=`>=${i}.0.0${l} <${+i+1}.0.0-0`;else if(p)n=`>=${i}.${o}.0${l} <${i}.${+o+1}.0-0`;return qe("xRange return",n),n})},xN=(e,t)=>(qe("replaceStars",e,t),e.trim().replace(Ot[gt.STAR],"")),$N=(e,t)=>(qe("replaceGTE0",e,t),e.trim().replace(Ot[t.includePrerelease?gt.GTE0PRE:gt.GTE0],"")),vN=(e)=>(t,r,n,s,i,o,a,l,c,u,p,g)=>{if(at(n))r="";else if(at(s))r=`>=${n}.0.0${e?"-0":""}`;else if(at(i))r=`>=${n}.${s}.0${e?"-0":""}`;else if(o)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(at(c))l="";else if(at(u))l=`<${+c+1}.0.0-0`;else if(at(p))l=`<${c}.${+u+1}.0-0`;else if(g)l=`<=${c}.${u}.${p}-${g}`;else if(e)l=`<${c}.${u}.${+p+1}-0`;else l=`<=${l}`;return`${r} ${l}`.trim()},wN=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(qe(e[n].semver),e[n].semver===cd.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var mo=C(function(aK,px){var ho=Symbol("SemVer ANY");class bl{static get ANY(){return ho}constructor(e,t){if(t=lx(t),e instanceof bl)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),dd("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ho)this.value="";else this.value=this.operator+this.semver.version;dd("comp",this)}parse(e){let t=this.options.loose?cx[ux.COMPARATORLOOSE]:cx[ux.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=ho;else this.semver=new dx(r[2],this.options.loose)}toString(){return this.value}test(e){if(dd("Comparator.test",e,this.options.loose),this.semver===ho||e===ho)return!0;if(typeof e==="string")try{e=new dx(e,this.options)}catch(t){return!1}return ud(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof bl))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new fx(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new fx(this.value,t).test(e.semver)}if(t=lx(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(ud(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(ud(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}px.exports=bl;var lx=al(),{safeRe:cx,t:ux}=li(),ud=ld(),dd=uo(),dx=ht(),fx=mr()});var go=C(function(lK,mx){var SN=mr(),EN=(e,t,r)=>{try{t=new SN(t,r)}catch(n){return!1}return t.test(e)};mx.exports=EN});var gx=C(function(cK,hx){var _N=mr(),PN=(e,t)=>new _N(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));hx.exports=PN});var bx=C(function(uK,yx){var jN=ht(),kN=mr(),RN=(e,t,r)=>{let n=null,s=null,i=null;try{i=new kN(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===-1)n=o,s=new jN(n,r)}}),n};yx.exports=RN});var $x=C(function(dK,xx){var AN=ht(),ON=mr(),CN=(e,t,r)=>{let n=null,s=null,i=null;try{i=new ON(t,r)}catch(o){return null}return e.forEach((o)=>{if(i.test(o)){if(!n||s.compare(o)===1)n=o,s=new AN(n,r)}}),n};xx.exports=CN});var Sx=C(function(fK,wx){var fd=ht(),TN=mr(),vx=fo(),NN=(e,t)=>{e=new TN(e,t);let r=new fd("0.0.0");if(e.test(r))return r;if(r=new fd("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],i=null;if(s.forEach((o)=>{let a=new fd(o.semver.version);switch(o.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!i||vx(a,i))i=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||vx(r,i)))r=i}if(r&&e.test(r))return r;return null};wx.exports=NN});var _x=C(function(pK,Ex){var IN=mr(),MN=(e,t)=>{try{return new IN(e,t).range||"*"}catch(r){return null}};Ex.exports=MN});var xl=C(function(mK,Rx){var JN=ht(),kx=mo(),{ANY:DN}=kx,LN=mr(),FN=go(),Px=fo(),jx=pl(),qN=hl(),HN=ml(),VN=(e,t,r,n)=>{e=new JN(e,n),t=new LN(t,n);let s,i,o,a,l;switch(r){case">":s=Px,i=qN,o=jx,a=">",l=">=";break;case"<":s=jx,i=HN,o=Px,a="<",l="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(FN(e,t,n))return!1;for(let c=0;c<t.set.length;++c){let u=t.set[c],p=null,g=null;if(u.forEach((m)=>{if(m.semver===DN)m=new kx(">=0.0.0");if(p=p||m,g=g||m,s(m.semver,p.semver,n))p=m;else if(o(m.semver,g.semver,n))g=m}),p.operator===a||p.operator===l)return!1;if((!g.operator||g.operator===a)&&i(e,g.semver))return!1;else if(g.operator===l&&o(e,g.semver))return!1}return!0};Rx.exports=VN});var Ox=C(function(hK,Ax){var BN=xl(),WN=(e,t,r)=>BN(e,t,">",r);Ax.exports=WN});var Tx=C(function(gK,Cx){var UN=xl(),zN=(e,t,r)=>UN(e,t,"<",r);Cx.exports=zN});var Mx=C(function(yK,Ix){var Nx=mr(),GN=(e,t,r)=>(e=new Nx(e,r),t=new Nx(t,r),e.intersects(t,r));Ix.exports=GN});var Dx=C(function(bK,Jx){var KN=go(),YN=pr();Jx.exports=(e,t,r)=>{let n=[],s=null,i=null,o=e.sort((u,p)=>YN(u,p,r));for(let u of o)if(KN(u,t,r)){if(i=u,!s)s=u}else{if(i)n.push([s,i]);i=null,s=null}if(s)n.push([s,null]);let a=[];for(let[u,p]of n)if(u===p)a.push(u);else if(!p&&u===o[0])a.push("*");else if(!p)a.push(`>=${u}`);else if(u===o[0])a.push(`<=${p}`);else a.push(`${u} - ${p}`);let l=a.join(" || "),c=typeof t.raw==="string"?t.raw:String(t);return l.length<c.length?l:t}});var Bx=C(function(xK,Vx){var Lx=mr(),hd=mo(),{ANY:pd}=hd,md=go(),gd=pr(),XN=(e,t,r={})=>{if(e===t)return!0;e=new Lx(e,r),t=new Lx(t,r);let n=!1;e:for(let s of e.set){for(let i of t.set){let o=QN(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},ZN=[new hd(">=0.0.0-0")],Fx=[new hd(">=0.0.0")],QN=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===pd)if(t.length===1&&t[0].semver===pd)return!0;else if(r.includePrerelease)e=ZN;else e=Fx;if(t.length===1&&t[0].semver===pd)if(r.includePrerelease)return!0;else t=Fx;let n=new Set,s,i;for(let m of e)if(m.operator===">"||m.operator===">=")s=qx(s,m,r);else if(m.operator==="<"||m.operator==="<=")i=Hx(i,m,r);else n.add(m.semver);if(n.size>1)return null;let o;if(s&&i){if(o=gd(s.semver,i.semver,r),o>0)return null;else if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(let m of n){if(s&&!md(m,String(s),r))return null;if(i&&!md(m,String(i),r))return null;for(let b of t)if(!md(m,String(b),r))return!1;return!0}let a,l,c,u,p=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,g=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(p&&p.prerelease.length===1&&i.operator==="<"&&p.prerelease[0]===0)p=!1;for(let m of t){if(u=u||m.operator===">"||m.operator===">=",c=c||m.operator==="<"||m.operator==="<=",s){if(g){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===g.major&&m.semver.minor===g.minor&&m.semver.patch===g.patch)g=!1}if(m.operator===">"||m.operator===">="){if(a=qx(s,m,r),a===m&&a!==s)return!1}else if(s.operator===">="&&!m.test(s.semver))return!1}if(i){if(p){if(m.semver.prerelease&&m.semver.prerelease.length&&m.semver.major===p.major&&m.semver.minor===p.minor&&m.semver.patch===p.patch)p=!1}if(m.operator==="<"||m.operator==="<="){if(l=Hx(i,m,r),l===m&&l!==i)return!1}else if(i.operator==="<="&&!m.test(i.semver))return!1}if(!m.operator&&(i||s)&&o!==0)return!1}if(s&&c&&!i&&o!==0)return!1;if(i&&u&&!s&&o!==0)return!1;if(g||p)return!1;return!0},qx=(e,t,r)=>{if(!e)return t;let n=gd(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Hx=(e,t,r)=>{if(!e)return t;let n=gd(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};Vx.exports=XN});var Gx=C(function($K,zx){var yd=li(),Wx=ai(),eI=ht(),Ux=sd(),tI=Dn(),rI=hb(),nI=yb(),sI=$b(),iI=Sb(),oI=_b(),aI=jb(),lI=Rb(),cI=Ob(),uI=pr(),dI=Ib(),fI=Jb(),pI=fl(),mI=qb(),hI=Vb(),gI=fo(),yI=pl(),bI=od(),xI=ad(),$I=ml(),vI=hl(),wI=ld(),SI=Zb(),EI=ex(),_I=mo(),PI=mr(),jI=go(),kI=gx(),RI=bx(),AI=$x(),OI=Sx(),CI=_x(),TI=xl(),NI=Ox(),II=Tx(),MI=Mx(),JI=Dx(),DI=Bx();zx.exports={parse:tI,valid:rI,clean:nI,inc:sI,diff:iI,major:oI,minor:aI,patch:lI,prerelease:cI,compare:uI,rcompare:dI,compareLoose:fI,compareBuild:pI,sort:mI,rsort:hI,gt:gI,lt:yI,eq:bI,neq:xI,gte:$I,lte:vI,cmp:wI,coerce:SI,truncate:EI,Comparator:_I,Range:PI,satisfies:jI,toComparators:kI,maxSatisfying:RI,minSatisfying:AI,minVersion:OI,validRange:CI,outside:TI,gtr:NI,ltr:II,intersects:MI,simplifyRange:JI,subset:DI,SemVer:eI,re:yd.re,src:yd.src,tokens:yd.t,SEMVER_SPEC_VERSION:Wx.SEMVER_SPEC_VERSION,RELEASE_TYPES:Wx.RELEASE_TYPES,compareIdentifiers:Ux.compareIdentifiers,rcompareIdentifiers:Ux.rcompareIdentifiers}});var gn;var $l=q(()=>{gn={name:"sharp",description:"High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",version:"0.35.5",author:"Lovell Fuller <npm@lovell.info>",homepage:"https://sharp.pixelplumbing.com",contributors:["Pierre Inglebert <pierre.inglebert@gmail.com>","Jonathan Ong <jonathanrichardong@gmail.com>","Chanon Sajjamanochai <chanon.s@gmail.com>","Juliano Julio <julianojulio@gmail.com>","Daniel Gasienica <daniel@gasienica.ch>","Julian Walker <julian@fiftythree.com>","Amit Pitaru <pitaru.amit@gmail.com>","Brandon Aaron <hello.brandon@aaron.sh>","Andreas Lind <andreas@one.com>","Maurus Cuelenaere <mcuelenaere@gmail.com>","Linus Unnebäck <linus@folkdatorn.se>","Victor Mateevitsi <mvictoras@gmail.com>","Alaric Holloway <alaric.holloway@gmail.com>","Bernhard K. Weisshuhn <bkw@codingforce.com>","Chris Riley <criley@primedia.com>","David Carley <dacarley@gmail.com>","John Tobin <john@limelightmobileinc.com>","Kenton Gray <kentongray@gmail.com>","Felix Bünemann <Felix.Buenemann@gmail.com>","Samy Al Zahrani <samyalzahrany@gmail.com>","Chintan Thakkar <lemnisk8@gmail.com>","F. Orlando Galashan <frulo@gmx.de>","Kleis Auke Wolthuizen <info@kleisauke.nl>","Matt Hirsch <mhirsch@media.mit.edu>","Matthias Thoemmes <thoemmes@gmail.com>","Patrick Paskaris <patrick@paskaris.gr>","Jérémy Lal <kapouer@melix.org>","Rahul Nanwani <r.nanwani@gmail.com>","Alice Monday <alice0meta@gmail.com>","Kristo Jorgenson <kristo.jorgenson@gmail.com>","YvesBos <yves_bos@outlook.com>","Guy Maliar <guy@tailorbrands.com>","Nicolas Coden <nicolas@ncoden.fr>","Matt Parrish <matt.r.parrish@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Matthew McEachen <matthew+github@mceachen.org>","Jarda Kotěšovec <jarda.kotesovec@gmail.com>","Kenric D'Souza <kenric.dsouza@gmail.com>","Oleh Aleinyk <oleg.aleynik@gmail.com>","Marcel Bretschneider <marcel.bretschneider@gmail.com>","Andrea Bianco <andrea.bianco@unibas.ch>","Rik Heywood <rik@rik.org>","Thomas Parisot <hi@oncletom.io>","Nathan Graves <nathanrgraves+github@gmail.com>","Tom Lokhorst <tom@lokhorst.eu>","Espen Hovlandsdal <espen@hovlandsdal.com>","Sylvain Dumont <sylvain.dumont35@gmail.com>","Alun Davies <alun.owain.davies@googlemail.com>","Aidan Hoolachan <ajhoolachan21@gmail.com>","Axel Eirola <axel.eirola@iki.fi>","Freezy <freezy@xbmc.org>","Daiz <taneli.vatanen@gmail.com>","Julian Aubourg <j@ubourg.net>","Keith Belovay <keith@picthrive.com>","Michael B. Klein <mbklein@gmail.com>","Jordan Prudhomme <jordan@raboland.fr>","Ilya Ovdin <iovdin@gmail.com>","Andargor <andargor@yahoo.com>","Paul Neave <paul.neave@gmail.com>","Brendan Kennedy <brenwken@gmail.com>","Brychan Bennett-Odlum <git@brychan.io>","Edward Silverton <e.silverton@gmail.com>","Roman Malieiev <aromaleev@gmail.com>","Tomas Szabo <tomas.szabo@deftomat.com>","Robert O'Rourke <robert@o-rourke.org>","Guillermo Alfonso Varela Chouciño <guillevch@gmail.com>","Christian Flintrup <chr@gigahost.dk>","Manan Jadhav <manan@motionden.com>","Leon Radley <leon@radley.se>","alza54 <alza54@thiocod.in>","Jacob Smith <jacob@frende.me>","Michael Nutt <michael@nutt.im>","Brad Parham <baparham@gmail.com>","Taneli Vatanen <taneli.vatanen@gmail.com>","Joris Dugué <zaruike10@gmail.com>","Chris Banks <christopher.bradley.banks@gmail.com>","Ompal Singh <ompal.hitm09@gmail.com>","Brodan <christopher.hranj@gmail.com>","Ankur Parihar <ankur.github@gmail.com>","Brahim Ait elhaj <brahima@gmail.com>","Mart Jansink <m.jansink@gmail.com>","Lachlan Newman <lachnewman007@gmail.com>","Dennis Beatty <dennis@dcbeatty.com>","Ingvar Stepanyan <me@rreverser.com>","Don Denton <don@happycollision.com>","Dmytro Tiapukhin <cool.gegeg@gmail.com>","Florian Lefebvre <contact@florian-lefebvre.dev>"],scripts:{build:"node install/build.js","build:dist":"node scripts/build.mjs",clean:"rm -rf src/build/ test/fixtures/output.*",test:"npm run lint && npm run test-unit",lint:"npm run lint-cpp && npm run lint-js && npm run lint-types && npm run lint-publish","lint-cpp":"cpplint --quiet src/*.h src/*.cc","lint-js":"biome lint","lint-publish":"publint --strict","lint-types":"tsd --files ./test/types/sharp.test-d.{cts,mts}","test-leak":"./test/leak/leak.sh","test-unit":"node --experimental-test-coverage test/unit.mjs","package-from-local-build":"node npm/from-local-build.js","package-wasm-wrappers":"node npm/wasm-wrappers.js","package-release-notes":"node npm/release-notes.js","docs-build":"node docs/build.mjs","docs-serve":"cd docs && npm start","docs-publish":"cd docs && npm run build && npx firebase-tools deploy --project pixelplumbing --only hosting:pixelplumbing-sharp"},type:"commonjs",files:["dist","install","lib/index.d.ts","src/*.{cc,h,gyp}"],main:"./dist/index.cjs",module:"./dist/index.mjs",types:"./dist/index.d.mts",exports:{".":{import:{types:"./dist/index.d.mts",default:"./dist/index.mjs"},require:{types:"./dist/index.d.cts",default:"./dist/index.cjs"}}},sideEffects:!0,repository:{type:"git",url:"git+https://github.com/lovell/sharp.git"},keywords:["jpeg","png","webp","avif","tiff","gif","svg","jp2","dzi","image","resize","thumbnail","crop","embed","libvips","vips"],dependencies:{"@img/colour":"^1.1.0","detect-libc":"^2.1.2",semver:"^7.8.5"},optionalDependencies:{"@img/sharp-darwin-arm64":"0.35.5","@img/sharp-darwin-x64":"0.35.5","@img/sharp-freebsd-wasm32":"0.35.5","@img/sharp-libvips-darwin-arm64":"1.3.4","@img/sharp-libvips-darwin-x64":"1.3.4","@img/sharp-libvips-linux-arm":"1.3.4","@img/sharp-libvips-linux-arm64":"1.3.4","@img/sharp-libvips-linux-ppc64":"1.3.4","@img/sharp-libvips-linux-riscv64":"1.3.4","@img/sharp-libvips-linux-s390x":"1.3.4","@img/sharp-libvips-linux-x64":"1.3.4","@img/sharp-libvips-linuxmusl-arm64":"1.3.4","@img/sharp-libvips-linuxmusl-x64":"1.3.4","@img/sharp-linux-arm":"0.35.5","@img/sharp-linux-arm64":"0.35.5","@img/sharp-linux-ppc64":"0.35.5","@img/sharp-linux-riscv64":"0.35.5","@img/sharp-linux-s390x":"0.35.5","@img/sharp-linux-x64":"0.35.5","@img/sharp-linuxmusl-arm64":"0.35.5","@img/sharp-linuxmusl-x64":"0.35.5","@img/sharp-webcontainers-wasm32":"0.35.5","@img/sharp-win32-arm64":"0.35.5","@img/sharp-win32-ia32":"0.35.5","@img/sharp-win32-x64":"0.35.5"},peerDependenciesMeta:{"@types/node":{optional:!0}},devDependencies:{"@biomejs/biome":"^2.5.14","@cpplint/cli":"^0.1.0","@emnapi/runtime":"^1.11.3","@img/sharp-libvips-dev":"1.3.4","@img/sharp-libvips-dev-wasm32":"1.3.4","@img/sharp-libvips-win32-arm64":"1.3.4","@img/sharp-libvips-win32-ia32":"1.3.4","@img/sharp-libvips-win32-x64":"1.3.4","@types/node":"*",emnapi:"^1.11.3","exif-reader":"^2.0.3",icc:"^4.0.0","node-addon-api":"^8.9.2","node-gyp":"^12.4.0",publint:"^0.3.24","tar-fs":"^3.1.3",tsd:"^0.33.0",yauzl:"^3.4.0"},license:"Apache-2.0",engines:{node:">=20.9.0"},config:{libvips:">=8.18.7"},funding:{url:"https://opencollective.com/libvips"}}});import{spawnSync as yo}from"node:child_process";import{createHash as FI}from"node:crypto";var bo,xd,qI,Yx,HI,$d,VI=(e)=>{if(e instanceof Error)console.error(`sharp: Installation error: ${e.message}`);else console.log(`sharp: ${e}`)},Xx=()=>xd.default.isNonGlibcLinuxSync()?xd.default.familySync():"",BI=()=>`${process.platform}${Xx()}-${process.arch}`,ci=()=>{if(Zx())return"wasm32";let{npm_config_arch:e,npm_config_platform:t,npm_config_libc:r}=process.env,n=typeof r==="string"?r:Xx();return`${t||process.platform}${n}-${e||process.arch}`},WI=()=>{try{return Te(`@img/sharp-libvips-dev-${ci()}/include`)}catch{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/include");})()}catch{}}return""},UI=()=>{try{return (()=>{throw new Error("Cannot require module "+"@img/sharp-libvips-dev/cplusplus");})()}catch{}return""},zI=()=>{try{return Te(`@img/sharp-libvips-dev-${ci()}/lib`)}catch{try{return Te(`@img/sharp-libvips-${ci()}/lib`)}catch{}}return""},GI=()=>{if(process.release?.name==="node"&&process.versions){if(!bo.default.satisfies(process.versions.node,gn.engines.node))return{found:process.versions.node,expected:gn.engines.node}}},Zx=()=>{let{CC:e}=process.env;return Boolean(e?.endsWith("/emcc"))},KI=()=>{if(process.platform==="darwin"&&process.arch==="x64")return(yo("sysctl sysctl.proc_translated",$d).stdout||"").trim()==="sysctl.proc_translated: 1";return!1},Kx=(e)=>FI("sha512").update(e).digest("hex"),YI=()=>{try{let e=Kx(`imgsharp-libvips-${ci()}`),t=bo.default.coerce(gn.optionalDependencies[`@img/sharp-libvips-${ci()}`],{includePrerelease:!0}).version;return Kx(`${e}npm:${t}`).slice(0,10)}catch{}return""},XI=()=>yo(`node-gyp rebuild --directory=src ${Zx()?"--nodedir=emscripten":""}`,{...$d,stdio:"inherit"}).status,Qx=()=>{if(process.platform!=="win32")return(yo("pkg-config --modversion vips-cpp",{...$d,env:{...process.env,PKG_CONFIG_PATH:e$()}}).stdout||"").trim();else return""},ZI=()=>{try{let e=(yo("brew",["--prefix"],{encoding:"utf8"}).stdout||"").trim();if(e)return`${e}/lib/pkgconfig`}catch(e){}return},QI=()=>{try{let e=(yo("pkg-config",["--variable","pc_path","pkg-config"],{encoding:"utf8"}).stdout||"").trim();if(e)return e}catch(e){}return},e$=()=>{if(process.platform!=="win32")return[ZI(),QI(),process.env.PKG_CONFIG_PATH].filter(Boolean).join(":");else return""},bd=(e,t,r)=>{if(r)r(`Detected ${t}, skipping search for globally-installed libvips`);return e},e2=(e)=>{if(Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS)===!0)return bd(!1,"SHARP_IGNORE_GLOBAL_LIBVIPS",e);if(Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS)===!0)return bd(!0,"SHARP_FORCE_GLOBAL_LIBVIPS",e);if(KI())return bd(!1,"Rosetta",e);let t=Qx();return!!t&&bo.default.gte(t,Yx)},vl;var vd=q(()=>{$l();bo=Lt(Gx(),1),xd=Lt(ol(),1);/*!
332
332
  Copyright 2013 Lovell Fuller and others.
333
333
  SPDX-License-Identifier: Apache-2.0
334
- */kI=process.env.npm_package_config_libvips||gn.config.libvips,Fx=yo.default.coerce(kI).version,RI=["darwin-arm64","darwin-x64","freebsd-arm64","freebsd-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-wasm32","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],pd={encoding:"utf8",shell:!0},bl={minimumLibvipsVersion:Fx,prebuiltPlatforms:RI,buildPlatformArch:li,buildSharpLibvipsIncludeDir:CI,buildSharpLibvipsCPlusPlusDir:NI,buildSharpLibvipsLibDir:TI,isUnsupportedNodeRuntime:II,runtimePlatformArch:OI,log:AI,yarnLocator:JI,spawnRebuild:DI,globalLibvipsVersion:Vx,pkgConfigPath:Bx,useGlobalLibvips:qI}});import{createRequire as HI}from"node:module";var xl,lt,Ux,VI,Wx,BI,WI,yn,Je,Ln,Oe;var bo=q(()=>{md();yl();xl=Lt(nl(),1);/*!
334
+ */qI=process.env.npm_package_config_libvips||gn.config.libvips,Yx=bo.default.coerce(qI).version,HI=["darwin-arm64","darwin-x64","freebsd-arm64","freebsd-x64","linux-arm","linux-arm64","linux-ppc64","linux-riscv64","linux-s390x","linux-wasm32","linux-x64","linuxmusl-arm64","linuxmusl-x64","win32-arm64","win32-ia32","win32-x64"],$d={encoding:"utf8",shell:!0},vl={minimumLibvipsVersion:Yx,prebuiltPlatforms:HI,buildPlatformArch:ci,buildSharpLibvipsIncludeDir:WI,buildSharpLibvipsCPlusPlusDir:UI,buildSharpLibvipsLibDir:zI,isUnsupportedNodeRuntime:GI,runtimePlatformArch:BI,log:VI,yarnLocator:YI,spawnRebuild:XI,globalLibvipsVersion:Qx,pkgConfigPath:e$,useGlobalLibvips:e2}});import{createRequire as t2}from"node:module";var wl,lt,r$,r2,t$,n2,s2,yn,Je,Ln,Oe;var xo=q(()=>{vd();$l();wl=Lt(ol(),1);/*!
335
335
  Copyright 2013 Lovell Fuller and others.
336
336
  SPDX-License-Identifier: Apache-2.0
337
- */lt=HI(import.meta.url),{version:Ux}=gn,{runtimePlatformArch:VI,isUnsupportedNodeRuntime:Wx,prebuiltPlatforms:BI,minimumLibvipsVersion:WI}=bl,yn=VI(),Ln=[];try{Je=lt(`../src/build/Release/sharp-${yn}-${Ux}.node`)}catch(e){Ln.push(e)}if(!Je)try{Je=lt(`../src/build/Release/sharp-wasm32-${Ux}.node`)}catch(e){Ln.push(e)}if(!Je)try{switch(yn){case"darwin-arm64":Je=lt("@img/sharp-darwin-arm64/sharp.node");break;case"darwin-x64":Je=lt("@img/sharp-darwin-x64/sharp.node");break;case"linux-arm":Je=lt("@img/sharp-linux-arm/sharp.node");break;case"linux-arm64":Je=lt("@img/sharp-linux-arm64/sharp.node");break;case"linux-ppc64":Je=lt("@img/sharp-linux-ppc64/sharp.node");break;case"linux-riscv64":Je=lt("@img/sharp-linux-riscv64/sharp.node");break;case"linux-s390x":Je=lt("@img/sharp-linux-s390x/sharp.node");break;case"linux-x64":Je=lt("@img/sharp-linux-x64/sharp.node");break;case"linuxmusl-arm64":Je=lt("@img/sharp-linuxmusl-arm64/sharp.node");break;case"linuxmusl-x64":Je=lt("@img/sharp-linuxmusl-x64/sharp.node");break;case"win32-arm64":Je=lt("@img/sharp-win32-arm64/sharp.node");break;case"win32-ia32":Je=lt("@img/sharp-win32-ia32/sharp.node");break;case"win32-x64":Je=lt("@img/sharp-win32-x64/sharp.node");break;case"freebsd-arm64":case"freebsd-x64":Je=lt("@img/sharp-freebsd-wasm32/sharp.node");break;case"linux-wasm32":Je=lt("@img/sharp-webcontainers-wasm32/sharp.node");break}if(Je&&["linux-x64","linuxmusl-x64"].includes(yn)&&!Je._isUsingX64V2()){let e=Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");e.code="Unsupported CPU",Ln.push(e),Je=null}if(Je&&process.versions.electron&&yn.startsWith("linux"))process.emitWarning("Binaries provided by Electron for use on Linux may be incompatible with sharp - see https://sharp.pixelplumbing.com/install#electron-and-linux",{code:"SharpElectronLinux"})}catch(e){Ln.push(e)}if(!Je)try{Je=lt("@img/sharp-wasm32/sharp.node")}catch(e){Ln.push(e)}if(!Je){let[e,t,r]=["linux","darwin","win32"].map((i)=>yn.startsWith(i)),n=[`Could not load the "sharp" module using the ${yn} runtime`];Ln.forEach((i)=>{if(!i.code?.endsWith("MODULE_NOT_FOUND"))n.push(i.code?`${i.code}: ${i.message}`:i.message)});let s=Ln.map((i)=>i.message).join(" ");if(n.push("Possible solutions:"),Wx()){let{found:i,expected:o}=Wx();n.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(BI.includes(yn)&&!/libstdc\+\+\.so/.test(s)){let[i,o]=yn.split("-"),a=i.endsWith("musl")?" --libc=musl":"";n.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else n.push(`- Manually install libvips >= ${WI}`," See https://sharp.pixelplumbing.com/install#building-from-source","- Add WebAssembly-based dependencies:"," npm install sharp @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(s))try{let{config:i}=lt(`@img/sharp-libvips-${yn}/package`),o=`${xl.familySync()} ${xl.versionSync()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;n.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch(i){}if(e&&/\/snap\/core[0-9]{2}/.test(s))n.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node");if(t&&/Incompatible library version/.test(s))n.push("- Update Homebrew:"," brew update && brew upgrade vips");if(Ln.some((i)=>i.code==="ERR_DLOPEN_DISABLED"))n.push("- Run Node.js without using the --no-addons flag");if(r&&/The specified procedure could not be found/.test(s))n.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp");throw n.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),Error(n.join(`
338
- `))}Oe=Je});import UI from"node:util";import hd from"node:stream";function KI(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...n}=this.options;if(e.options=structuredClone(n),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")});return e}var zI,GI=(e)=>{ws.queue.emit("change",e)},ws=function(e,t){if(arguments.length===1&&!u.defined(e))throw Error("Invalid input");if(!(this instanceof ws))return new ws(e,t);return hd.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:0.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,trimMargin:0,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,typedArrayOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",keepGainMap:!1,withGainMap:!1,resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,webpExact:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:0,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,heifTune:"auto",jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:(r)=>{this.emit("warning",r),zI(r)},queueListener:GI},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this},Vr;var zx=q(()=>{Dr();bo();/*!
337
+ */lt=t2(import.meta.url),{version:r$}=gn,{runtimePlatformArch:r2,isUnsupportedNodeRuntime:t$,prebuiltPlatforms:n2,minimumLibvipsVersion:s2}=vl,yn=r2(),Ln=[];try{Je=lt(`../src/build/Release/sharp-${yn}-${r$}.node`)}catch(e){Ln.push(e)}if(!Je)try{Je=lt(`../src/build/Release/sharp-wasm32-${r$}.node`)}catch(e){Ln.push(e)}if(!Je)try{switch(yn){case"darwin-arm64":Je=lt("@img/sharp-darwin-arm64/sharp.node");break;case"darwin-x64":Je=lt("@img/sharp-darwin-x64/sharp.node");break;case"linux-arm":Je=lt("@img/sharp-linux-arm/sharp.node");break;case"linux-arm64":Je=lt("@img/sharp-linux-arm64/sharp.node");break;case"linux-ppc64":Je=lt("@img/sharp-linux-ppc64/sharp.node");break;case"linux-riscv64":Je=lt("@img/sharp-linux-riscv64/sharp.node");break;case"linux-s390x":Je=lt("@img/sharp-linux-s390x/sharp.node");break;case"linux-x64":Je=lt("@img/sharp-linux-x64/sharp.node");break;case"linuxmusl-arm64":Je=lt("@img/sharp-linuxmusl-arm64/sharp.node");break;case"linuxmusl-x64":Je=lt("@img/sharp-linuxmusl-x64/sharp.node");break;case"win32-arm64":Je=lt("@img/sharp-win32-arm64/sharp.node");break;case"win32-ia32":Je=lt("@img/sharp-win32-ia32/sharp.node");break;case"win32-x64":Je=lt("@img/sharp-win32-x64/sharp.node");break;case"freebsd-arm64":case"freebsd-x64":Je=lt("@img/sharp-freebsd-wasm32/sharp.node");break;case"linux-wasm32":Je=lt("@img/sharp-webcontainers-wasm32/sharp.node");break}if(Je&&["linux-x64","linuxmusl-x64"].includes(yn)&&!Je._isUsingX64V2()){let e=Error("Prebuilt binaries for Linux x64 require v2 microarchitecture");e.code="Unsupported CPU",Ln.push(e),Je=null}if(Je&&process.versions.electron&&yn.startsWith("linux"))process.emitWarning("Binaries provided by Electron for use on Linux may be incompatible with sharp - see https://sharp.pixelplumbing.com/install#electron-and-linux",{code:"SharpElectronLinux"})}catch(e){Ln.push(e)}if(!Je)try{Je=lt("@img/sharp-wasm32/sharp.node")}catch(e){Ln.push(e)}if(!Je){let[e,t,r]=["linux","darwin","win32"].map((i)=>yn.startsWith(i)),n=[`Could not load the "sharp" module using the ${yn} runtime`];Ln.forEach((i)=>{if(!i.code?.endsWith("MODULE_NOT_FOUND"))n.push(i.code?`${i.code}: ${i.message}`:i.message)});let s=Ln.map((i)=>i.message).join(" ");if(n.push("Possible solutions:"),t$()){let{found:i,expected:o}=t$();n.push("- Please upgrade Node.js:",` Found ${i}`,` Requires ${o}`)}else if(n2.includes(yn)&&!/libstdc\+\+\.so/.test(s)){let[i,o]=yn.split("-"),a=i.endsWith("musl")?" --libc=musl":"";n.push("- Ensure optional dependencies can be installed:"," npm install --include=optional sharp","- Ensure your package manager supports multi-platform installation:"," See https://sharp.pixelplumbing.com/install#cross-platform","- Add platform-specific dependencies:",` npm install --os=${i.replace("musl","")}${a} --cpu=${o} sharp`)}else n.push(`- Manually install libvips >= ${s2}`," See https://sharp.pixelplumbing.com/install#building-from-source","- Add WebAssembly-based dependencies:"," npm install sharp @img/sharp-wasm32");if(e&&/(symbol not found|CXXABI_)/i.test(s))try{let{config:i}=lt(`@img/sharp-libvips-${yn}/package`),o=`${wl.familySync()} ${wl.versionSync()}`,a=`${i.musl?"musl":"glibc"} ${i.musl||i.glibc}`;n.push("- Update your OS:",` Found ${o}`,` Requires ${a}`)}catch(i){}if(e&&/\/snap\/core[0-9]{2}/.test(s))n.push("- Remove the Node.js Snap, which does not support native modules"," snap remove node");if(t&&/Incompatible library version/.test(s))n.push("- Update Homebrew:"," brew update && brew upgrade vips");if(Ln.some((i)=>i.code==="ERR_DLOPEN_DISABLED"))n.push("- Run Node.js without using the --no-addons flag");if(r&&/The specified procedure could not be found/.test(s))n.push("- Using the canvas package on Windows?"," See https://sharp.pixelplumbing.com/install#canvas-and-windows","- Check for outdated versions of sharp in the dependency tree:"," npm ls sharp");throw n.push("- Consult the installation documentation:"," See https://sharp.pixelplumbing.com/install"),Error(n.join(`
338
+ `))}Oe=Je});import i2 from"node:util";import wd from"node:stream";function l2(){let e=this.constructor.call(),{debuglog:t,queueListener:r,...n}=this.options;if(e.options=structuredClone(n),e.options.debuglog=t,e.options.queueListener=r,this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),e.options.input.buffer=this.options.input.buffer,e.emit("finish")});return e}var o2,a2=(e)=>{Ss.queue.emit("change",e)},Ss=function(e,t){if(arguments.length===1&&!d.defined(e))throw Error("Invalid input");if(!(this instanceof Ss))return new Ss(e,t);return wd.Duplex.call(this),this.options={topOffsetPre:-1,leftOffsetPre:-1,widthPre:-1,heightPre:-1,topOffsetPost:-1,leftOffsetPost:-1,widthPost:-1,heightPost:-1,width:-1,height:-1,canvas:"crop",position:0,resizeBackground:[0,0,0,255],angle:0,rotationAngle:0,rotationBackground:[0,0,0,255],rotateBefore:!1,orientBefore:!1,flip:!1,flop:!1,extendTop:0,extendBottom:0,extendLeft:0,extendRight:0,extendBackground:[0,0,0,255],extendWith:"background",withoutEnlargement:!1,withoutReduction:!1,affineMatrix:[],affineBackground:[0,0,0,255],affineIdx:0,affineIdy:0,affineOdx:0,affineOdy:0,affineInterpolator:this.constructor.interpolators.bilinear,kernel:"lanczos3",fastShrinkOnLoad:!0,tint:[-1,0,0,0],flatten:!1,flattenBackground:[0,0,0],unflatten:!1,negate:!1,negateAlpha:!0,medianSize:0,blurSigma:0,precision:"integer",minAmpl:0.2,sharpenSigma:0,sharpenM1:1,sharpenM2:2,sharpenX1:2,sharpenY2:10,sharpenY3:20,threshold:0,thresholdGrayscale:!0,trimBackground:[],trimThreshold:-1,trimLineArt:!1,trimMargin:0,dilateWidth:0,erodeWidth:0,gamma:0,gammaOut:0,greyscale:!1,normalise:!1,normaliseLower:1,normaliseUpper:99,claheWidth:0,claheHeight:0,claheMaxSlope:3,brightness:1,saturation:1,hue:0,lightness:0,booleanBufferIn:null,booleanFileIn:"",joinChannelIn:[],extractChannel:-1,removeAlpha:!1,ensureAlpha:-1,colourspace:"srgb",colourspacePipeline:"last",composite:[],fileOut:"",formatOut:"input",streamOut:!1,typedArrayOut:!1,keepMetadata:0,withMetadataOrientation:-1,withMetadataDensity:0,withIccProfile:"",withExif:{},withExifMerge:!0,withXmp:"",keepGainMap:!1,withGainMap:!1,resolveWithObject:!1,loop:-1,delay:[],jpegQuality:80,jpegProgressive:!1,jpegChromaSubsampling:"4:2:0",jpegTrellisQuantisation:!1,jpegOvershootDeringing:!1,jpegOptimiseScans:!1,jpegOptimiseCoding:!0,jpegQuantisationTable:0,pngProgressive:!1,pngCompressionLevel:6,pngAdaptiveFiltering:!1,pngPalette:!1,pngQuality:100,pngEffort:7,pngBitdepth:8,pngDither:1,jp2Quality:80,jp2TileHeight:512,jp2TileWidth:512,jp2Lossless:!1,jp2ChromaSubsampling:"4:4:4",webpQuality:80,webpAlphaQuality:100,webpLossless:!1,webpNearLossless:!1,webpSmartSubsample:!1,webpSmartDeblock:!1,webpPreset:"default",webpEffort:4,webpMinSize:!1,webpMixed:!1,webpExact:!1,gifBitdepth:8,gifEffort:7,gifDither:1,gifInterFrameMaxError:0,gifInterPaletteMaxError:3,gifKeepDuplicateFrames:!1,gifReuse:!0,gifProgressive:!1,tiffQuality:80,tiffCompression:"jpeg",tiffBigtiff:!1,tiffPredictor:"horizontal",tiffPyramid:!1,tiffMiniswhite:!1,tiffBitdepth:0,tiffTile:!1,tiffTileHeight:256,tiffTileWidth:256,tiffXres:1,tiffYres:1,tiffResolutionUnit:"inch",heifQuality:50,heifLossless:!1,heifCompression:"av1",heifEffort:4,heifChromaSubsampling:"4:4:4",heifBitdepth:8,heifTune:"auto",jxlDistance:1,jxlDecodingTier:0,jxlEffort:7,jxlLossless:!1,rawDepth:"uchar",tileSize:256,tileOverlap:0,tileContainer:"fs",tileLayout:"dz",tileFormat:"last",tileDepth:"last",tileAngle:0,tileSkipBlanks:-1,tileBackground:[255,255,255,255],tileCentre:!1,tileId:"https://example.com/iiif",tileBasename:"",timeoutSeconds:0,linearA:[],linearB:[],pdfBackground:[255,255,255,255],debuglog:(r)=>{this.emit("warning",r),o2(r)},queueListener:a2},this.options.input=this._createInputDescriptor(e,t,{allowStream:!0}),this},Vr;var n$=q(()=>{Dr();xo();/*!
339
339
  Copyright 2013 Lovell Fuller and others.
340
340
  SPDX-License-Identifier: Apache-2.0
341
- */zI=UI.debuglog("sharp");Object.setPrototypeOf(ws.prototype,hd.Duplex.prototype);Object.setPrototypeOf(ws,hd.Duplex);Object.assign(ws.prototype,{clone:KI});Vr=ws});function Gx(e){let t=XI.filter((r)=>u.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function ZI(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(u.string(e))n.file=e;else if(u.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(u.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(u.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");n.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(u.plainObject(e)&&!u.defined(t)){if(t=e,Gx(t))n.buffer=[]}else if(!u.defined(e)&&!u.defined(t)&&u.object(r)&&r.allowStream)n.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map((s)=>this._createInputDescriptor(s));else throw Error("Recursive join is unsupported");else throw Error("Expected at least two images to join");else throw Error(`Unsupported input '${e}' of type ${typeof e}${u.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(u.object(t)){if(u.defined(t.failOn))if(u.string(t.failOn)&&u.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw u.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(u.defined(t.autoOrient))if(u.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw u.invalidParameterError("autoOrient","boolean",t.autoOrient);if(u.defined(t.density))if(u.number(t.density)&&u.inRange(t.density,1,1e5))n.density=t.density;else throw u.invalidParameterError("density","number between 1 and 100000",t.density);if(u.defined(t.ignoreIcc))if(u.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw u.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(u.defined(t.limitInputPixels))if(u.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(u.integer(t.limitInputPixels)&&u.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw u.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(u.defined(t.limitInputChannels))if(u.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(u.integer(t.limitInputChannels)&&u.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw u.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(u.defined(t.unlimited))if(u.bool(t.unlimited))n.unlimited=t.unlimited;else throw u.invalidParameterError("unlimited","boolean",t.unlimited);if(u.defined(t.sequentialRead))if(u.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw u.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(u.defined(t.raw)){if(u.object(t.raw)&&u.integer(t.raw.width)&&u.inRange(t.raw.width,1,1e8)&&u.integer(t.raw.height)&&u.inRange(t.raw.height,1,1e8)&&u.integer(t.raw.channels)&&u.inRange(t.raw.channels,1,4))switch(n.rawWidth=t.raw.width,n.rawHeight=t.raw.height,n.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:n.rawDepth="uchar";break;case Int8Array:n.rawDepth="char";break;case Uint16Array:n.rawDepth="ushort";break;case Int16Array:n.rawDepth="short";break;case Uint32Array:n.rawDepth="uint";break;case Int32Array:n.rawDepth="int";break;case Float32Array:n.rawDepth="float";break;case Float64Array:n.rawDepth="double";break;default:n.rawDepth="uchar";break}else throw Error("Expected width, height and channels for raw pixel input");if(n.rawPremultiplied=!1,u.defined(t.raw.premultiplied))if(u.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw u.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,u.defined(t.raw.pageHeight))if(u.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);n.rawPageHeight=t.raw.pageHeight}else throw u.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(u.defined(t.animated))if(u.bool(t.animated))n.pages=t.animated?-1:1;else throw u.invalidParameterError("animated","boolean",t.animated);if(u.defined(t.pages))if(u.integer(t.pages)&&u.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw u.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(u.defined(t.page))if(u.integer(t.page)&&u.inRange(t.page,0,1e5))n.page=t.page;else throw u.invalidParameterError("page","integer between 0 and 100000",t.page);if(u.object(t.openSlide)&&u.defined(t.openSlide.level))if(u.integer(t.openSlide.level)&&u.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw u.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(u.defined(t.level))if(u.integer(t.level)&&u.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw u.invalidParameterError("level","integer between 0 and 256",t.level);if(u.object(t.tiff)&&u.defined(t.tiff.subifd))if(u.integer(t.tiff.subifd)&&u.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw u.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(u.defined(t.subifd))if(u.integer(t.subifd)&&u.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw u.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(u.object(t.svg)){if(u.defined(t.svg.stylesheet))if(u.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw u.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(u.defined(t.svg.highBitdepth))if(u.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw u.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(u.object(t.pdf)&&u.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(u.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(u.object(t.jp2)&&u.defined(t.jp2.oneshot))if(u.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw u.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(u.defined(t.create))if(u.object(t.create)&&u.integer(t.create.width)&&u.inRange(t.create.width,1,1e8)&&u.integer(t.create.height)&&u.inRange(t.create.height,1,1e8)&&u.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,u.defined(t.create.pageHeight))if(u.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);n.createPageHeight=t.create.pageHeight}else throw u.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(u.defined(t.create.noise)){if(!u.object(t.create.noise))throw Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw Error("Only gaussian noise is supported at the moment");if(n.createNoiseType=t.create.noise.type,!u.inRange(t.create.channels,1,4))throw u.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,u.defined(t.create.noise.mean))if(u.number(t.create.noise.mean)&&u.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw u.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,u.defined(t.create.noise.sigma))if(u.number(t.create.noise.sigma)&&u.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw u.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(u.defined(t.create.background)){if(!u.inRange(t.create.channels,3,4))throw u.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);n.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error("Expected valid noise or background to create a new input image");delete n.buffer}else throw Error("Expected valid width, height and channels to create a new input image");if(u.defined(t.text))if(u.object(t.text)&&u.string(t.text.text)){if(n.textValue=t.text.text,u.defined(t.text.height)&&u.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(u.defined(t.text.font))if(u.string(t.text.font))n.textFont=t.text.font;else throw u.invalidParameterError("text.font","string",t.text.font);if(u.defined(t.text.fontfile))if(u.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw u.invalidParameterError("text.fontfile","string",t.text.fontfile);if(u.defined(t.text.width))if(u.integer(t.text.width)&&u.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw u.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(u.defined(t.text.height))if(u.integer(t.text.height)&&u.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw u.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(u.defined(t.text.align))if(u.string(t.text.align)&&u.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw u.invalidParameterError("text.align","valid alignment",t.text.align);if(u.defined(t.text.justify))if(u.bool(t.text.justify))n.textJustify=t.text.justify;else throw u.invalidParameterError("text.justify","boolean",t.text.justify);if(u.defined(t.text.dpi))if(u.integer(t.text.dpi)&&u.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw u.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(u.defined(t.text.rgba))if(u.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw u.invalidParameterError("text.rgba","bool",t.text.rgba);if(u.defined(t.text.spacing))if(u.integer(t.text.spacing)&&u.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw u.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(u.defined(t.text.wrap))if(u.string(t.text.wrap)&&u.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw u.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete n.buffer}else throw Error("Expected a valid string to create an image with text.");if(u.defined(t.join))if(u.defined(this.options.join)){if(u.defined(t.join.animated))if(u.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw u.invalidParameterError("join.animated","boolean",t.join.animated);if(u.defined(t.join.across))if(u.integer(t.join.across)&&u.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw u.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(u.defined(t.join.shim))if(u.integer(t.join.shim)&&u.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw u.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(u.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(u.defined(t.join.halign))if(u.string(t.join.halign)&&u.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw u.invalidParameterError("join.halign","valid alignment",t.join.halign);if(u.defined(t.join.valign))if(u.string(t.join.valign)&&u.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw u.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(u.defined(t))throw Error(`Invalid input options ${t}`);return n}function QI(e,t,r){if(Array.isArray(this.options.input.buffer))if(u.buffer(e))this.options.input.buffer.push(e),r();else r(Error("Non-Buffer data on Writable Stream"));else r(Error("Unexpected data on Writable Stream"))}function e2(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function t2(){return Array.isArray(this.options.input.buffer)}function r2(e){if(this.writableFinished)e();else this.once("finish",e)}function n2(e){let t=Error();if(u.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)})});else Oe.metadata(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.metadata(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})}function s2(e){let t=Error();if(u.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)})});else Oe.stats(this.options,(r,n)=>{if(r)e(u.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.stats(this.options,(s,i)=>{if(s)n(u.nativeError(s,t));else r(i)})})}var YI,XI,Kx=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:Gx,_createInputDescriptor:ZI,_write:QI,_flattenBufferIn:e2,_isStreamInput:t2,_whenStreamInFinished:r2,metadata:n2,stats:s2}),e.align=YI};var Yx=q(()=>{Dr();bo();/*!
341
+ */o2=i2.debuglog("sharp");Object.setPrototypeOf(Ss.prototype,wd.Duplex.prototype);Object.setPrototypeOf(Ss,wd.Duplex);Object.assign(Ss.prototype,{clone:l2});Vr=Ss});function s$(e){let t=u2.filter((r)=>d.defined(e[r])).map((r)=>[r,e[r]]);return t.length?Object.fromEntries(t):void 0}function d2(e,t,r){let n={autoOrient:!1,failOn:"warning",limitInputPixels:268402689,limitInputChannels:5,ignoreIcc:!1,unlimited:!1,sequentialRead:!0};if(d.string(e))n.file=e;else if(d.buffer(e)){if(e.length===0)throw Error("Input Buffer is empty");n.buffer=e}else if(d.arrayBuffer(e)){if(e.byteLength===0)throw Error("Input bit Array is empty");n.buffer=Buffer.from(e,0,e.byteLength)}else if(d.typedArray(e)){if(e.length===0)throw Error("Input Bit Array is empty");n.buffer=Buffer.from(e.buffer,e.byteOffset,e.byteLength)}else if(d.plainObject(e)&&!d.defined(t)){if(t=e,s$(t))n.buffer=[]}else if(!d.defined(e)&&!d.defined(t)&&d.object(r)&&r.allowStream)n.buffer=[];else if(Array.isArray(e))if(e.length>1)if(!this.options.joining)this.options.joining=!0,this.options.join=e.map((s)=>this._createInputDescriptor(s));else throw Error("Recursive join is unsupported");else throw Error("Expected at least two images to join");else throw Error(`Unsupported input '${e}' of type ${typeof e}${d.defined(t)?` when also providing options of type ${typeof t}`:""}`);if(d.object(t)){if(d.defined(t.failOn))if(d.string(t.failOn)&&d.inArray(t.failOn,["none","truncated","error","warning"]))n.failOn=t.failOn;else throw d.invalidParameterError("failOn","one of: none, truncated, error, warning",t.failOn);if(d.defined(t.autoOrient))if(d.bool(t.autoOrient))n.autoOrient=t.autoOrient;else throw d.invalidParameterError("autoOrient","boolean",t.autoOrient);if(d.defined(t.density))if(d.number(t.density)&&d.inRange(t.density,1,1e5))n.density=t.density;else throw d.invalidParameterError("density","number between 1 and 100000",t.density);if(d.defined(t.ignoreIcc))if(d.bool(t.ignoreIcc))n.ignoreIcc=t.ignoreIcc;else throw d.invalidParameterError("ignoreIcc","boolean",t.ignoreIcc);if(d.defined(t.limitInputPixels))if(d.bool(t.limitInputPixels))n.limitInputPixels=t.limitInputPixels?268402689:0;else if(d.integer(t.limitInputPixels)&&d.inRange(t.limitInputPixels,0,Number.MAX_SAFE_INTEGER))n.limitInputPixels=t.limitInputPixels;else throw d.invalidParameterError("limitInputPixels","positive integer",t.limitInputPixels);if(d.defined(t.limitInputChannels))if(d.bool(t.limitInputChannels))n.limitInputChannels=t.limitInputChannels?5:0;else if(d.integer(t.limitInputChannels)&&d.inRange(t.limitInputChannels,0,Number.MAX_SAFE_INTEGER))n.limitInputChannels=t.limitInputChannels;else throw d.invalidParameterError("limitInputChannels","positive integer",t.limitInputChannels);if(d.defined(t.unlimited))if(d.bool(t.unlimited))n.unlimited=t.unlimited;else throw d.invalidParameterError("unlimited","boolean",t.unlimited);if(d.defined(t.sequentialRead))if(d.bool(t.sequentialRead))n.sequentialRead=t.sequentialRead;else throw d.invalidParameterError("sequentialRead","boolean",t.sequentialRead);if(d.defined(t.raw)){if(d.object(t.raw)&&d.integer(t.raw.width)&&d.inRange(t.raw.width,1,1e8)&&d.integer(t.raw.height)&&d.inRange(t.raw.height,1,1e8)&&d.integer(t.raw.channels)&&d.inRange(t.raw.channels,1,4))switch(n.rawWidth=t.raw.width,n.rawHeight=t.raw.height,n.rawChannels=t.raw.channels,e.constructor){case Uint8Array:case Uint8ClampedArray:n.rawDepth="uchar";break;case Int8Array:n.rawDepth="char";break;case Uint16Array:n.rawDepth="ushort";break;case Int16Array:n.rawDepth="short";break;case Uint32Array:n.rawDepth="uint";break;case Int32Array:n.rawDepth="int";break;case Float32Array:n.rawDepth="float";break;case Float64Array:n.rawDepth="double";break;default:n.rawDepth="uchar";break}else throw Error("Expected width, height and channels for raw pixel input");if(n.rawPremultiplied=!1,d.defined(t.raw.premultiplied))if(d.bool(t.raw.premultiplied))n.rawPremultiplied=t.raw.premultiplied;else throw d.invalidParameterError("raw.premultiplied","boolean",t.raw.premultiplied);if(n.rawPageHeight=0,d.defined(t.raw.pageHeight))if(d.integer(t.raw.pageHeight)&&t.raw.pageHeight>0&&t.raw.pageHeight<=t.raw.height){if(t.raw.height%t.raw.pageHeight!==0)throw Error(`Expected raw.height ${t.raw.height} to be a multiple of raw.pageHeight ${t.raw.pageHeight}`);n.rawPageHeight=t.raw.pageHeight}else throw d.invalidParameterError("raw.pageHeight","positive integer",t.raw.pageHeight)}if(d.defined(t.animated))if(d.bool(t.animated))n.pages=t.animated?-1:1;else throw d.invalidParameterError("animated","boolean",t.animated);if(d.defined(t.pages))if(d.integer(t.pages)&&d.inRange(t.pages,-1,1e5))n.pages=t.pages;else throw d.invalidParameterError("pages","integer between -1 and 100000",t.pages);if(d.defined(t.page))if(d.integer(t.page)&&d.inRange(t.page,0,1e5))n.page=t.page;else throw d.invalidParameterError("page","integer between 0 and 100000",t.page);if(d.object(t.openSlide)&&d.defined(t.openSlide.level))if(d.integer(t.openSlide.level)&&d.inRange(t.openSlide.level,0,256))n.openSlideLevel=t.openSlide.level;else throw d.invalidParameterError("openSlide.level","integer between 0 and 256",t.openSlide.level);else if(d.defined(t.level))if(d.integer(t.level)&&d.inRange(t.level,0,256))n.openSlideLevel=t.level;else throw d.invalidParameterError("level","integer between 0 and 256",t.level);if(d.object(t.tiff)&&d.defined(t.tiff.subifd))if(d.integer(t.tiff.subifd)&&d.inRange(t.tiff.subifd,-1,1e5))n.tiffSubifd=t.tiff.subifd;else throw d.invalidParameterError("tiff.subifd","integer between -1 and 100000",t.tiff.subifd);else if(d.defined(t.subifd))if(d.integer(t.subifd)&&d.inRange(t.subifd,-1,1e5))n.tiffSubifd=t.subifd;else throw d.invalidParameterError("subifd","integer between -1 and 100000",t.subifd);if(d.object(t.svg)){if(d.defined(t.svg.stylesheet))if(d.string(t.svg.stylesheet))n.svgStylesheet=t.svg.stylesheet;else throw d.invalidParameterError("svg.stylesheet","string",t.svg.stylesheet);if(d.defined(t.svg.highBitdepth))if(d.bool(t.svg.highBitdepth))n.svgHighBitdepth=t.svg.highBitdepth;else throw d.invalidParameterError("svg.highBitdepth","boolean",t.svg.highBitdepth)}if(d.object(t.pdf)&&d.defined(t.pdf.background))n.pdfBackground=this._getBackgroundColourOption(t.pdf.background);else if(d.defined(t.pdfBackground))n.pdfBackground=this._getBackgroundColourOption(t.pdfBackground);if(d.object(t.jp2)&&d.defined(t.jp2.oneshot))if(d.bool(t.jp2.oneshot))n.jp2Oneshot=t.jp2.oneshot;else throw d.invalidParameterError("jp2.oneshot","boolean",t.jp2.oneshot);if(d.defined(t.create))if(d.object(t.create)&&d.integer(t.create.width)&&d.inRange(t.create.width,1,1e8)&&d.integer(t.create.height)&&d.inRange(t.create.height,1,1e8)&&d.integer(t.create.channels)){if(n.createWidth=t.create.width,n.createHeight=t.create.height,n.createChannels=t.create.channels,n.createPageHeight=0,d.defined(t.create.pageHeight))if(d.integer(t.create.pageHeight)&&t.create.pageHeight>0&&t.create.pageHeight<=t.create.height){if(t.create.height%t.create.pageHeight!==0)throw Error(`Expected create.height ${t.create.height} to be a multiple of create.pageHeight ${t.create.pageHeight}`);n.createPageHeight=t.create.pageHeight}else throw d.invalidParameterError("create.pageHeight","positive integer",t.create.pageHeight);if(d.defined(t.create.noise)){if(!d.object(t.create.noise))throw Error("Expected noise to be an object");if(t.create.noise.type!=="gaussian")throw Error("Only gaussian noise is supported at the moment");if(n.createNoiseType=t.create.noise.type,!d.inRange(t.create.channels,1,4))throw d.invalidParameterError("create.channels","number between 1 and 4",t.create.channels);if(n.createNoiseMean=128,d.defined(t.create.noise.mean))if(d.number(t.create.noise.mean)&&d.inRange(t.create.noise.mean,0,1e4))n.createNoiseMean=t.create.noise.mean;else throw d.invalidParameterError("create.noise.mean","number between 0 and 10000",t.create.noise.mean);if(n.createNoiseSigma=30,d.defined(t.create.noise.sigma))if(d.number(t.create.noise.sigma)&&d.inRange(t.create.noise.sigma,0,1e4))n.createNoiseSigma=t.create.noise.sigma;else throw d.invalidParameterError("create.noise.sigma","number between 0 and 10000",t.create.noise.sigma)}else if(d.defined(t.create.background)){if(!d.inRange(t.create.channels,3,4))throw d.invalidParameterError("create.channels","number between 3 and 4",t.create.channels);n.createBackground=this._getBackgroundColourOption(t.create.background)}else throw Error("Expected valid noise or background to create a new input image");delete n.buffer}else throw Error("Expected valid width, height and channels to create a new input image");if(d.defined(t.text))if(d.object(t.text)&&d.string(t.text.text)){if(n.textValue=t.text.text,d.defined(t.text.height)&&d.defined(t.text.dpi))throw Error("Expected only one of dpi or height");if(d.defined(t.text.font))if(d.string(t.text.font))n.textFont=t.text.font;else throw d.invalidParameterError("text.font","string",t.text.font);if(d.defined(t.text.fontfile))if(d.string(t.text.fontfile))n.textFontfile=t.text.fontfile;else throw d.invalidParameterError("text.fontfile","string",t.text.fontfile);if(d.defined(t.text.width))if(d.integer(t.text.width)&&d.inRange(t.text.width,1,1e6))n.textWidth=t.text.width;else throw d.invalidParameterError("text.width","integer between 1 and 1000000",t.text.width);if(d.defined(t.text.height))if(d.integer(t.text.height)&&d.inRange(t.text.height,1,1e6))n.textHeight=t.text.height;else throw d.invalidParameterError("text.height","integer between 1 and 1000000",t.text.height);if(d.defined(t.text.align))if(d.string(t.text.align)&&d.string(this.constructor.align[t.text.align]))n.textAlign=this.constructor.align[t.text.align];else throw d.invalidParameterError("text.align","valid alignment",t.text.align);if(d.defined(t.text.justify))if(d.bool(t.text.justify))n.textJustify=t.text.justify;else throw d.invalidParameterError("text.justify","boolean",t.text.justify);if(d.defined(t.text.dpi))if(d.integer(t.text.dpi)&&d.inRange(t.text.dpi,1,1e6))n.textDpi=t.text.dpi;else throw d.invalidParameterError("text.dpi","integer between 1 and 1000000",t.text.dpi);if(d.defined(t.text.rgba))if(d.bool(t.text.rgba))n.textRgba=t.text.rgba;else throw d.invalidParameterError("text.rgba","bool",t.text.rgba);if(d.defined(t.text.spacing))if(d.integer(t.text.spacing)&&d.inRange(t.text.spacing,-1e6,1e6))n.textSpacing=t.text.spacing;else throw d.invalidParameterError("text.spacing","integer between -1000000 and 1000000",t.text.spacing);if(d.defined(t.text.wrap))if(d.string(t.text.wrap)&&d.inArray(t.text.wrap,["word","char","word-char","none"]))n.textWrap=t.text.wrap;else throw d.invalidParameterError("text.wrap","one of: word, char, word-char, none",t.text.wrap);delete n.buffer}else throw Error("Expected a valid string to create an image with text.");if(d.defined(t.join))if(d.defined(this.options.join)){if(d.defined(t.join.animated))if(d.bool(t.join.animated))n.joinAnimated=t.join.animated;else throw d.invalidParameterError("join.animated","boolean",t.join.animated);if(d.defined(t.join.across))if(d.integer(t.join.across)&&d.inRange(t.join.across,1,1e6))n.joinAcross=t.join.across;else throw d.invalidParameterError("join.across","integer between 1 and 100000",t.join.across);if(d.defined(t.join.shim))if(d.integer(t.join.shim)&&d.inRange(t.join.shim,0,1e6))n.joinShim=t.join.shim;else throw d.invalidParameterError("join.shim","integer between 0 and 100000",t.join.shim);if(d.defined(t.join.background))n.joinBackground=this._getBackgroundColourOption(t.join.background);if(d.defined(t.join.halign))if(d.string(t.join.halign)&&d.string(this.constructor.align[t.join.halign]))n.joinHalign=this.constructor.align[t.join.halign];else throw d.invalidParameterError("join.halign","valid alignment",t.join.halign);if(d.defined(t.join.valign))if(d.string(t.join.valign)&&d.string(this.constructor.align[t.join.valign]))n.joinValign=this.constructor.align[t.join.valign];else throw d.invalidParameterError("join.valign","valid alignment",t.join.valign)}else throw Error("Expected input to be an array of images to join")}else if(d.defined(t))throw Error(`Invalid input options ${t}`);return n}function f2(e,t,r){if(Array.isArray(this.options.input.buffer))if(d.buffer(e))this.options.input.buffer.push(e),r();else r(Error("Non-Buffer data on Writable Stream"));else r(Error("Unexpected data on Writable Stream"))}function p2(){if(this._isStreamInput())this.options.input.buffer=Buffer.concat(this.options.input.buffer)}function m2(){return Array.isArray(this.options.input.buffer)}function h2(e){if(this.writableFinished)e();else this.once("finish",e)}function g2(e){let t=Error();if(d.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(r,n)=>{if(r)e(d.nativeError(r,t));else e(null,n)})});else Oe.metadata(this.options,(r,n)=>{if(r)e(d.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.metadata(this.options,(s,i)=>{if(s)n(d.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.metadata(this.options,(s,i)=>{if(s)n(d.nativeError(s,t));else r(i)})})}function y2(e){let t=Error();if(d.fn(e)){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(r,n)=>{if(r)e(d.nativeError(r,t));else e(null,n)})});else Oe.stats(this.options,(r,n)=>{if(r)e(d.nativeError(r,t));else e(null,n)});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.stats(this.options,(s,i)=>{if(s)n(d.nativeError(s,t));else r(i)})})});else return new Promise((r,n)=>{Oe.stats(this.options,(s,i)=>{if(s)n(d.nativeError(s,t));else r(i)})})}var c2,u2,i$=(e)=>{Object.assign(e.prototype,{_inputOptionsFromObject:s$,_createInputDescriptor:d2,_write:f2,_flattenBufferIn:p2,_isStreamInput:m2,_whenStreamInFinished:h2,metadata:g2,stats:y2}),e.align=c2};var o$=q(()=>{Dr();xo();/*!
342
342
  Copyright 2013 Lovell Fuller and others.
343
343
  SPDX-License-Identifier: Apache-2.0
344
- */YI={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},XI=["failOn","limitInputPixels","limitInputChannels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","openSlideLevel","pdfBackground","tiffSubifd"]});function yd(e){return e.angle%360!==0||e.rotationAngle!==0}function $l(e){return e.width!==-1||e.height!==-1}function a2(e,t,r){if($l(this.options))this.options.debuglog("ignoring previous resize options");if(this.options.widthPost!==-1)this.options.debuglog("operation order will be: extract, resize, extract");if(u.defined(e))if(u.object(e)&&!u.defined(r))r=e;else if(u.integer(e)&&u.inRange(e,1,1e8))this.options.width=e;else throw u.invalidParameterError("width","positive integer between 1 and 100000000",e);else this.options.width=-1;if(u.defined(t))if(u.integer(t)&&u.inRange(t,1,1e8))this.options.height=t;else throw u.invalidParameterError("height","positive integer between 1 and 100000000",t);else this.options.height=-1;if(u.object(r)){if(u.defined(r.width))if(u.integer(r.width)&&u.inRange(r.width,1,1e8))this.options.width=r.width;else throw u.invalidParameterError("width","positive integer between 1 and 100000000",r.width);if(u.defined(r.height))if(u.integer(r.height)&&u.inRange(r.height,1,1e8))this.options.height=r.height;else throw u.invalidParameterError("height","positive integer between 1 and 100000000",r.height);if(u.defined(r.fit)){let n=o2[r.fit];if(u.string(n))this.options.canvas=n;else throw u.invalidParameterError("fit","valid fit",r.fit)}if(u.defined(r.position)){let n=u.integer(r.position)?r.position:e$[r.position]||Qx[r.position]||Zx[r.position];if(u.integer(n)&&(u.inRange(n,0,8)||u.inRange(n,16,17)))this.options.position=n;else throw u.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),u.defined(r.kernel))if(u.string(gd[r.kernel]))this.options.kernel=gd[r.kernel];else throw u.invalidParameterError("kernel","valid kernel name",r.kernel);if(u.defined(r.withoutEnlargement))this._setBooleanOption("withoutEnlargement",r.withoutEnlargement);if(u.defined(r.withoutReduction))this._setBooleanOption("withoutReduction",r.withoutReduction);if(u.defined(r.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}if(yd(this.options)&&$l(this.options))this.options.rotateBefore=!0;return this}function l2(e){if(u.integer(e))if(u.inRange(e,1,1e8))this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else throw u.invalidParameterError("extend","integer between 1 and 100000000",e);else if(u.object(e)){if(u.defined(e.top))if(u.integer(e.top)&&u.inRange(e.top,0,1e8))this.options.extendTop=e.top;else throw u.invalidParameterError("top","integer between 0 and 100000000",e.top);if(u.defined(e.bottom))if(u.integer(e.bottom)&&u.inRange(e.bottom,0,1e8))this.options.extendBottom=e.bottom;else throw u.invalidParameterError("bottom","integer between 0 and 100000000",e.bottom);if(u.defined(e.left))if(u.integer(e.left)&&u.inRange(e.left,0,1e8))this.options.extendLeft=e.left;else throw u.invalidParameterError("left","integer between 0 and 100000000",e.left);if(u.defined(e.right))if(u.integer(e.right)&&u.inRange(e.right,0,1e8))this.options.extendRight=e.right;else throw u.invalidParameterError("right","integer between 0 and 100000000",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),u.defined(e.extendWith))if(u.string(Xx[e.extendWith]))this.options.extendWith=Xx[e.extendWith];else throw u.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw u.invalidParameterError("extend","integer or object",e);return this}function c2(e){let t=$l(this.options)||this.options.widthPre!==-1?"Post":"Pre";if(this.options[`width${t}`]!==-1)this.options.debuglog("ignoring previous extract options");if(["left","top","width","height"].forEach(function(r){let n=e[r];if(u.integer(n)&&u.inRange(n,0,1e8))this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw u.invalidParameterError(r,"integer between 0 and 100000000",n)},this),yd(this.options)&&!$l(this.options)){if(this.options.widthPre===-1||this.options.widthPost===-1)this.options.rotateBefore=!0}if(this.options.input.autoOrient)this.options.orientBefore=!0;return this}function u2(e){if(this.options.trimThreshold=10,u.defined(e))if(u.object(e)){if(u.defined(e.background))this._setBackgroundColourOption("trimBackground",e.background);if(u.defined(e.threshold))if(u.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw u.invalidParameterError("threshold","positive number",e.threshold);if(u.defined(e.lineArt))this._setBooleanOption("trimLineArt",e.lineArt);if(u.defined(e.margin))if(u.integer(e.margin)&&u.inRange(e.margin,0,1e7))this.options.trimMargin=e.margin;else throw u.invalidParameterError("margin","integer between 0 and 10000000",e.margin)}else throw u.invalidParameterError("trim","object",e);if(yd(this.options))this.options.rotateBefore=!0;return this}var Zx,Qx,Xx,e$,gd,i2,o2,t$=(e)=>{Object.assign(e.prototype,{resize:a2,extend:l2,extract:c2,trim:u2}),e.gravity=Zx,e.strategy=e$,e.kernel=gd,e.fit=i2,e.position=Qx};var r$=q(()=>{Dr();/*!
344
+ */c2={left:"low",top:"low",low:"low",center:"centre",centre:"centre",right:"high",bottom:"high",high:"high"},u2=["failOn","limitInputPixels","limitInputChannels","unlimited","animated","autoOrient","density","ignoreIcc","page","pages","sequentialRead","jp2","openSlide","pdf","raw","svg","tiff","openSlideLevel","pdfBackground","tiffSubifd"]});function Ed(e){return e.angle%360!==0||e.rotationAngle!==0}function Sl(e){return e.width!==-1||e.height!==-1}function $2(e,t,r){if(Sl(this.options))this.options.debuglog("ignoring previous resize options");if(this.options.widthPost!==-1)this.options.debuglog("operation order will be: extract, resize, extract");if(d.defined(e))if(d.object(e)&&!d.defined(r))r=e;else if(d.integer(e)&&d.inRange(e,1,1e8))this.options.width=e;else throw d.invalidParameterError("width","positive integer between 1 and 100000000",e);else this.options.width=-1;if(d.defined(t))if(d.integer(t)&&d.inRange(t,1,1e8))this.options.height=t;else throw d.invalidParameterError("height","positive integer between 1 and 100000000",t);else this.options.height=-1;if(d.object(r)){if(d.defined(r.width))if(d.integer(r.width)&&d.inRange(r.width,1,1e8))this.options.width=r.width;else throw d.invalidParameterError("width","positive integer between 1 and 100000000",r.width);if(d.defined(r.height))if(d.integer(r.height)&&d.inRange(r.height,1,1e8))this.options.height=r.height;else throw d.invalidParameterError("height","positive integer between 1 and 100000000",r.height);if(d.defined(r.fit)){let n=x2[r.fit];if(d.string(n))this.options.canvas=n;else throw d.invalidParameterError("fit","valid fit",r.fit)}if(d.defined(r.position)){let n=d.integer(r.position)?r.position:u$[r.position]||c$[r.position]||l$[r.position];if(d.integer(n)&&(d.inRange(n,0,8)||d.inRange(n,16,17)))this.options.position=n;else throw d.invalidParameterError("position","valid position/gravity/strategy",r.position)}if(this._setBackgroundColourOption("resizeBackground",r.background),d.defined(r.kernel))if(d.string(Sd[r.kernel]))this.options.kernel=Sd[r.kernel];else throw d.invalidParameterError("kernel","valid kernel name",r.kernel);if(d.defined(r.withoutEnlargement))this._setBooleanOption("withoutEnlargement",r.withoutEnlargement);if(d.defined(r.withoutReduction))this._setBooleanOption("withoutReduction",r.withoutReduction);if(d.defined(r.fastShrinkOnLoad))this._setBooleanOption("fastShrinkOnLoad",r.fastShrinkOnLoad)}if(Ed(this.options)&&Sl(this.options))this.options.rotateBefore=!0;return this}function v2(e){if(d.integer(e))if(d.inRange(e,1,1e8))this.options.extendTop=e,this.options.extendBottom=e,this.options.extendLeft=e,this.options.extendRight=e;else throw d.invalidParameterError("extend","integer between 1 and 100000000",e);else if(d.object(e)){if(d.defined(e.top))if(d.integer(e.top)&&d.inRange(e.top,0,1e8))this.options.extendTop=e.top;else throw d.invalidParameterError("top","integer between 0 and 100000000",e.top);if(d.defined(e.bottom))if(d.integer(e.bottom)&&d.inRange(e.bottom,0,1e8))this.options.extendBottom=e.bottom;else throw d.invalidParameterError("bottom","integer between 0 and 100000000",e.bottom);if(d.defined(e.left))if(d.integer(e.left)&&d.inRange(e.left,0,1e8))this.options.extendLeft=e.left;else throw d.invalidParameterError("left","integer between 0 and 100000000",e.left);if(d.defined(e.right))if(d.integer(e.right)&&d.inRange(e.right,0,1e8))this.options.extendRight=e.right;else throw d.invalidParameterError("right","integer between 0 and 100000000",e.right);if(this._setBackgroundColourOption("extendBackground",e.background),d.defined(e.extendWith))if(d.string(a$[e.extendWith]))this.options.extendWith=a$[e.extendWith];else throw d.invalidParameterError("extendWith","one of: background, copy, repeat, mirror",e.extendWith)}else throw d.invalidParameterError("extend","integer or object",e);return this}function w2(e){let t=Sl(this.options)||this.options.widthPre!==-1?"Post":"Pre";if(this.options[`width${t}`]!==-1)this.options.debuglog("ignoring previous extract options");if(["left","top","width","height"].forEach(function(r){let n=e[r];if(d.integer(n)&&d.inRange(n,0,1e8))this.options[r+(r==="left"||r==="top"?"Offset":"")+t]=n;else throw d.invalidParameterError(r,"integer between 0 and 100000000",n)},this),Ed(this.options)&&!Sl(this.options)){if(this.options.widthPre===-1||this.options.widthPost===-1)this.options.rotateBefore=!0}if(this.options.input.autoOrient)this.options.orientBefore=!0;return this}function S2(e){if(this.options.trimThreshold=10,d.defined(e))if(d.object(e)){if(d.defined(e.background))this._setBackgroundColourOption("trimBackground",e.background);if(d.defined(e.threshold))if(d.number(e.threshold)&&e.threshold>=0)this.options.trimThreshold=e.threshold;else throw d.invalidParameterError("threshold","positive number",e.threshold);if(d.defined(e.lineArt))this._setBooleanOption("trimLineArt",e.lineArt);if(d.defined(e.margin))if(d.integer(e.margin)&&d.inRange(e.margin,0,1e7))this.options.trimMargin=e.margin;else throw d.invalidParameterError("margin","integer between 0 and 10000000",e.margin)}else throw d.invalidParameterError("trim","object",e);if(Ed(this.options))this.options.rotateBefore=!0;return this}var l$,c$,a$,u$,Sd,b2,x2,d$=(e)=>{Object.assign(e.prototype,{resize:$2,extend:v2,extract:w2,trim:S2}),e.gravity=l$,e.strategy=u$,e.kernel=Sd,e.fit=b2,e.position=c$};var f$=q(()=>{Dr();/*!
345
345
  Copyright 2013 Lovell Fuller and others.
346
346
  SPDX-License-Identifier: Apache-2.0
347
- */Zx={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},Qx={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},Xx={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},e$={entropy:16,attention:17},gd={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},i2={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},o2={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"}});function d2(e){if(!Array.isArray(e))throw u.invalidParameterError("images to composite","array",e);return this.options.composite=e.map((t)=>{if(!u.object(t))throw u.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),n={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(u.defined(t.blend))if(u.string(bd[t.blend]))n.blend=bd[t.blend];else throw u.invalidParameterError("blend","valid blend name",t.blend);if(u.defined(t.tile))if(u.bool(t.tile))n.tile=t.tile;else throw u.invalidParameterError("tile","boolean",t.tile);if(u.defined(t.left))if(u.integer(t.left)&&u.inRange(t.left,-1e8,1e8))n.left=t.left;else throw u.invalidParameterError("left","integer between -100000000 and 100000000",t.left);if(u.defined(t.top))if(u.integer(t.top)&&u.inRange(t.top,-1e8,1e8))n.top=t.top;else throw u.invalidParameterError("top","integer between -100000000 and 100000000",t.top);if(u.defined(t.top)!==u.defined(t.left))throw Error("Expected both left and top to be set");else n.hasOffset=u.integer(t.top)&&u.integer(t.left);if(u.defined(t.gravity))if(u.integer(t.gravity)&&u.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(u.string(t.gravity)&&u.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw u.invalidParameterError("gravity","valid gravity",t.gravity);if(u.defined(t.premultiplied))if(u.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw u.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}var bd,n$=(e)=>{e.prototype.composite=d2,e.blend=bd};var s$=q(()=>{Dr();/*!
347
+ */l$={center:0,centre:0,north:1,east:2,south:3,west:4,northeast:5,southeast:6,southwest:7,northwest:8},c$={top:1,right:2,bottom:3,left:4,"right top":5,"right bottom":6,"left bottom":7,"left top":8},a$={background:"background",copy:"copy",repeat:"repeat",mirror:"mirror"},u$={entropy:16,attention:17},Sd={nearest:"nearest",linear:"linear",cubic:"cubic",mitchell:"mitchell",lanczos2:"lanczos2",lanczos3:"lanczos3",mks2013:"mks2013",mks2021:"mks2021"},b2={contain:"contain",cover:"cover",fill:"fill",inside:"inside",outside:"outside"},x2={contain:"embed",cover:"crop",fill:"ignore_aspect",inside:"max",outside:"min"}});function E2(e){if(!Array.isArray(e))throw d.invalidParameterError("images to composite","array",e);return this.options.composite=e.map((t)=>{if(!d.object(t))throw d.invalidParameterError("image to composite","object",t);let r=this._inputOptionsFromObject(t),n={input:this._createInputDescriptor(t.input,r,{allowStream:!1}),blend:"over",tile:!1,left:0,top:0,hasOffset:!1,gravity:0,premultiplied:!1};if(d.defined(t.blend))if(d.string(_d[t.blend]))n.blend=_d[t.blend];else throw d.invalidParameterError("blend","valid blend name",t.blend);if(d.defined(t.tile))if(d.bool(t.tile))n.tile=t.tile;else throw d.invalidParameterError("tile","boolean",t.tile);if(d.defined(t.left))if(d.integer(t.left)&&d.inRange(t.left,-1e8,1e8))n.left=t.left;else throw d.invalidParameterError("left","integer between -100000000 and 100000000",t.left);if(d.defined(t.top))if(d.integer(t.top)&&d.inRange(t.top,-1e8,1e8))n.top=t.top;else throw d.invalidParameterError("top","integer between -100000000 and 100000000",t.top);if(d.defined(t.top)!==d.defined(t.left))throw Error("Expected both left and top to be set");else n.hasOffset=d.integer(t.top)&&d.integer(t.left);if(d.defined(t.gravity))if(d.integer(t.gravity)&&d.inRange(t.gravity,0,8))n.gravity=t.gravity;else if(d.string(t.gravity)&&d.integer(this.constructor.gravity[t.gravity]))n.gravity=this.constructor.gravity[t.gravity];else throw d.invalidParameterError("gravity","valid gravity",t.gravity);if(d.defined(t.premultiplied))if(d.bool(t.premultiplied))n.premultiplied=t.premultiplied;else throw d.invalidParameterError("premultiplied","boolean",t.premultiplied);return n}),this}var _d,p$=(e)=>{e.prototype.composite=E2,e.blend=_d};var m$=q(()=>{Dr();/*!
348
348
  Copyright 2013 Lovell Fuller and others.
349
349
  SPDX-License-Identifier: Apache-2.0
350
- */bd={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"}});function f2(e,t){if(!u.defined(e))return this.autoOrient();if(this.options.angle||this.options.rotationAngle)this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0;if(u.integer(e)&&!(e%90))this.options.angle=e;else if(u.number(e)){if(this.options.rotationAngle=e,u.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw u.invalidParameterError("angle","numeric",e);return this}function p2(){return this.options.input.autoOrient=!0,this}function m2(e){return this.options.flip=u.bool(e)?e:!0,this}function h2(e){return this.options.flop=u.bool(e)?e:!0,this}function g2(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(u.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(u.number))this.options.affineMatrix=n;else throw u.invalidParameterError("matrix","1x4 or 2x2 array",e);if(u.defined(t))if(u.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),u.defined(t.idx))if(u.number(t.idx))this.options.affineIdx=t.idx;else throw u.invalidParameterError("options.idx","number",t.idx);if(u.defined(t.idy))if(u.number(t.idy))this.options.affineIdy=t.idy;else throw u.invalidParameterError("options.idy","number",t.idy);if(u.defined(t.odx))if(u.number(t.odx))this.options.affineOdx=t.odx;else throw u.invalidParameterError("options.odx","number",t.odx);if(u.defined(t.ody))if(u.number(t.ody))this.options.affineOdy=t.ody;else throw u.invalidParameterError("options.ody","number",t.ody);if(u.defined(t.interpolator))if(u.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw u.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw u.invalidParameterError("options","object",t);return this}function y2(e){if(u.plainObject(e)){if(u.number(e.sigma)&&u.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw u.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(u.defined(e.m1))if(u.number(e.m1)&&u.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw u.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(u.defined(e.m2))if(u.number(e.m2)&&u.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw u.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(u.defined(e.x1))if(u.number(e.x1)&&u.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw u.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(u.defined(e.y2))if(u.number(e.y2)&&u.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw u.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(u.defined(e.y3))if(u.number(e.y3)&&u.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw u.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function b2(e){if(!u.defined(e))this.options.medianSize=3;else if(u.integer(e)&&u.inRange(e,1,1000))this.options.medianSize=e;else throw u.invalidParameterError("size","integer between 1 and 1000",e);return this}function x2(e){let t;if(u.number(e))t=e;else if(u.plainObject(e)){if(!u.number(e.sigma))throw u.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(u.string(i$[e.precision]))this.options.precision=i$[e.precision];else throw u.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(u.number(e.minAmplitude)&&u.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw u.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!u.defined(e))this.options.blurSigma=-1;else if(u.bool(e))this.options.blurSigma=e?-1:0;else if(u.number(t)&&u.inRange(t,0.3,1000))this.options.blurSigma=t;else throw u.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function $2(e){if(!u.defined(e))this.options.dilateWidth=1;else if(u.integer(e)&&u.inRange(e,1,65536))this.options.dilateWidth=e;else throw u.invalidParameterError("width","integer between 1 and 65536",e);return this}function v2(e){if(!u.defined(e))this.options.erodeWidth=1;else if(u.integer(e)&&u.inRange(e,1,65536))this.options.erodeWidth=e;else throw u.invalidParameterError("width","integer between 1 and 65536",e);return this}function w2(e){if(this.options.flatten=u.bool(e)?e:!0,u.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function S2(){return this.options.unflatten=!0,this}function E2(e,t){if(!u.defined(e))this.options.gamma=2.2;else if(u.number(e)&&u.inRange(e,1,3))this.options.gamma=e;else throw u.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!u.defined(t))this.options.gammaOut=this.options.gamma;else if(u.number(t)&&u.inRange(t,1,3))this.options.gammaOut=t;else throw u.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function _2(e){if(this.options.negate=u.bool(e)?e:!0,u.plainObject(e)&&"alpha"in e)if(!u.bool(e.alpha))throw u.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function P2(e){if(u.plainObject(e)){if(u.defined(e.lower))if(u.number(e.lower)&&u.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw u.invalidParameterError("lower","number between 0 and 99",e.lower);if(u.defined(e.upper))if(u.number(e.upper)&&u.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw u.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw u.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function j2(e){return this.normalise(e)}function k2(e){if(u.plainObject(e)){if(u.integer(e.width)&&u.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw u.invalidParameterError("width","integer between 1 and 65536",e.width);if(u.integer(e.height)&&u.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw u.invalidParameterError("height","integer between 1 and 65536",e.height);if(u.defined(e.maxSlope))if(u.integer(e.maxSlope)&&u.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw u.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw u.invalidParameterError("options","plain object",e);return this}function R2(e){if(!u.object(e)||!Array.isArray(e.kernel)||!u.integer(e.width)||!u.integer(e.height)||!u.inRange(e.width,3,1001)||!u.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(u.number))throw Error("Invalid convolution kernel");if(!u.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!u.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function A2(e,t){if(!u.defined(e))this.options.threshold=128;else if(u.bool(e))this.options.threshold=e?128:0;else if(u.integer(e)&&u.inRange(e,0,255))this.options.threshold=e;else throw u.invalidParameterError("threshold","integer between 0 and 255",e);if(!u.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function O2(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),u.string(t)&&u.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw u.invalidParameterError("operator","one of: and, or, eor",t);return this}function C2(e,t){if(!u.defined(e)&&u.number(t))e=1;else if(u.number(e)&&!u.defined(t))t=0;if(!u.defined(e))this.options.linearA=[];else if(u.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&u.inRange(e.length,1,1e6)&&e.every(u.number))this.options.linearA=e;else throw u.invalidParameterError("a","number or array of numbers",e);if(!u.defined(t))this.options.linearB=[];else if(u.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&u.inRange(t.length,1,1e6)&&t.every(u.number))this.options.linearB=t;else throw u.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw Error("Expected a and b to be arrays of the same length");return this}function N2(e){if(!Array.isArray(e))throw u.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw u.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw u.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(u.number))throw u.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function T2(e){if(!u.plainObject(e))throw u.invalidParameterError("options","plain object",e);if("brightness"in e)if(u.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw u.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(u.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw u.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(u.integer(e.hue))this.options.hue=e.hue%360;else throw u.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(u.number(e.lightness))this.options.lightness=e.lightness;else throw u.invalidParameterError("lightness","number",e.lightness);return this}var i$,o$=(e)=>{Object.assign(e.prototype,{autoOrient:p2,rotate:f2,flip:m2,flop:h2,affine:g2,sharpen:y2,erode:v2,dilate:$2,median:b2,blur:x2,flatten:w2,unflatten:S2,gamma:E2,negate:_2,normalise:P2,normalize:j2,clahe:k2,convolve:R2,threshold:A2,boolean:O2,linear:C2,recomb:N2,modulate:T2})};var a$=q(()=>{Dr();/*!
350
+ */_d={clear:"clear",source:"source",over:"over",in:"in",out:"out",atop:"atop",dest:"dest","dest-over":"dest-over","dest-in":"dest-in","dest-out":"dest-out","dest-atop":"dest-atop",xor:"xor",add:"add",saturate:"saturate",multiply:"multiply",screen:"screen",overlay:"overlay",darken:"darken",lighten:"lighten","colour-dodge":"colour-dodge","color-dodge":"colour-dodge","colour-burn":"colour-burn","color-burn":"colour-burn","hard-light":"hard-light","soft-light":"soft-light",difference:"difference",exclusion:"exclusion"}});function _2(e,t){if(!d.defined(e))return this.autoOrient();if(this.options.angle||this.options.rotationAngle)this.options.debuglog("ignoring previous rotate options"),this.options.angle=0,this.options.rotationAngle=0;if(d.integer(e)&&!(e%90))this.options.angle=e;else if(d.number(e)){if(this.options.rotationAngle=e,d.object(t)&&t.background)this._setBackgroundColourOption("rotationBackground",t.background)}else throw d.invalidParameterError("angle","numeric",e);return this}function P2(){return this.options.input.autoOrient=!0,this}function j2(e){return this.options.flip=d.bool(e)?e:!0,this}function k2(e){return this.options.flop=d.bool(e)?e:!0,this}function R2(e,t){let n=Array.isArray(e)&&(e.length===4&&e.every(d.number)||e.length===2&&e.every((s)=>Array.isArray(s)&&s.length===2))?e.flat():[];if(n.length===4&&n.every(d.number))this.options.affineMatrix=n;else throw d.invalidParameterError("matrix","1x4 or 2x2 array",e);if(d.defined(t))if(d.object(t)){if(this._setBackgroundColourOption("affineBackground",t.background),d.defined(t.idx))if(d.number(t.idx))this.options.affineIdx=t.idx;else throw d.invalidParameterError("options.idx","number",t.idx);if(d.defined(t.idy))if(d.number(t.idy))this.options.affineIdy=t.idy;else throw d.invalidParameterError("options.idy","number",t.idy);if(d.defined(t.odx))if(d.number(t.odx))this.options.affineOdx=t.odx;else throw d.invalidParameterError("options.odx","number",t.odx);if(d.defined(t.ody))if(d.number(t.ody))this.options.affineOdy=t.ody;else throw d.invalidParameterError("options.ody","number",t.ody);if(d.defined(t.interpolator))if(d.inArray(t.interpolator,Object.values(this.constructor.interpolators)))this.options.affineInterpolator=t.interpolator;else throw d.invalidParameterError("options.interpolator","valid interpolator name",t.interpolator)}else throw d.invalidParameterError("options","object",t);return this}function A2(e){if(d.plainObject(e)){if(d.number(e.sigma)&&d.inRange(e.sigma,0.000001,10))this.options.sharpenSigma=e.sigma;else throw d.invalidParameterError("options.sigma","number between 0.000001 and 10",e.sigma);if(d.defined(e.m1))if(d.number(e.m1)&&d.inRange(e.m1,0,1e6))this.options.sharpenM1=e.m1;else throw d.invalidParameterError("options.m1","number between 0 and 1000000",e.m1);if(d.defined(e.m2))if(d.number(e.m2)&&d.inRange(e.m2,0,1e6))this.options.sharpenM2=e.m2;else throw d.invalidParameterError("options.m2","number between 0 and 1000000",e.m2);if(d.defined(e.x1))if(d.number(e.x1)&&d.inRange(e.x1,0,1e6))this.options.sharpenX1=e.x1;else throw d.invalidParameterError("options.x1","number between 0 and 1000000",e.x1);if(d.defined(e.y2))if(d.number(e.y2)&&d.inRange(e.y2,0,1e6))this.options.sharpenY2=e.y2;else throw d.invalidParameterError("options.y2","number between 0 and 1000000",e.y2);if(d.defined(e.y3))if(d.number(e.y3)&&d.inRange(e.y3,0,1e6))this.options.sharpenY3=e.y3;else throw d.invalidParameterError("options.y3","number between 0 and 1000000",e.y3)}else this.options.sharpenSigma=-1;return this}function O2(e){if(!d.defined(e))this.options.medianSize=3;else if(d.integer(e)&&d.inRange(e,1,1000))this.options.medianSize=e;else throw d.invalidParameterError("size","integer between 1 and 1000",e);return this}function C2(e){let t;if(d.number(e))t=e;else if(d.plainObject(e)){if(!d.number(e.sigma))throw d.invalidParameterError("options.sigma","number between 0.3 and 1000",t);if(t=e.sigma,"precision"in e)if(d.string(h$[e.precision]))this.options.precision=h$[e.precision];else throw d.invalidParameterError("precision","one of: integer, float, approximate",e.precision);if("minAmplitude"in e)if(d.number(e.minAmplitude)&&d.inRange(e.minAmplitude,0.001,1))this.options.minAmpl=e.minAmplitude;else throw d.invalidParameterError("minAmplitude","number between 0.001 and 1",e.minAmplitude)}if(!d.defined(e))this.options.blurSigma=-1;else if(d.bool(e))this.options.blurSigma=e?-1:0;else if(d.number(t)&&d.inRange(t,0.3,1000))this.options.blurSigma=t;else throw d.invalidParameterError("sigma","number between 0.3 and 1000",t);return this}function T2(e){if(!d.defined(e))this.options.dilateWidth=1;else if(d.integer(e)&&d.inRange(e,1,65536))this.options.dilateWidth=e;else throw d.invalidParameterError("width","integer between 1 and 65536",e);return this}function N2(e){if(!d.defined(e))this.options.erodeWidth=1;else if(d.integer(e)&&d.inRange(e,1,65536))this.options.erodeWidth=e;else throw d.invalidParameterError("width","integer between 1 and 65536",e);return this}function I2(e){if(this.options.flatten=d.bool(e)?e:!0,d.object(e))this._setBackgroundColourOption("flattenBackground",e.background);return this}function M2(){return this.options.unflatten=!0,this}function J2(e,t){if(!d.defined(e))this.options.gamma=2.2;else if(d.number(e)&&d.inRange(e,1,3))this.options.gamma=e;else throw d.invalidParameterError("gamma","number between 1.0 and 3.0",e);if(!d.defined(t))this.options.gammaOut=this.options.gamma;else if(d.number(t)&&d.inRange(t,1,3))this.options.gammaOut=t;else throw d.invalidParameterError("gammaOut","number between 1.0 and 3.0",t);return this}function D2(e){if(this.options.negate=d.bool(e)?e:!0,d.plainObject(e)&&"alpha"in e)if(!d.bool(e.alpha))throw d.invalidParameterError("alpha","should be boolean value",e.alpha);else this.options.negateAlpha=e.alpha;return this}function L2(e){if(d.plainObject(e)){if(d.defined(e.lower))if(d.number(e.lower)&&d.inRange(e.lower,0,99))this.options.normaliseLower=e.lower;else throw d.invalidParameterError("lower","number between 0 and 99",e.lower);if(d.defined(e.upper))if(d.number(e.upper)&&d.inRange(e.upper,1,100))this.options.normaliseUpper=e.upper;else throw d.invalidParameterError("upper","number between 1 and 100",e.upper)}if(this.options.normaliseLower>=this.options.normaliseUpper)throw d.invalidParameterError("range","lower to be less than upper",`${this.options.normaliseLower} >= ${this.options.normaliseUpper}`);return this.options.normalise=!0,this}function F2(e){return this.normalise(e)}function q2(e){if(d.plainObject(e)){if(d.integer(e.width)&&d.inRange(e.width,1,65536))this.options.claheWidth=e.width;else throw d.invalidParameterError("width","integer between 1 and 65536",e.width);if(d.integer(e.height)&&d.inRange(e.height,1,65536))this.options.claheHeight=e.height;else throw d.invalidParameterError("height","integer between 1 and 65536",e.height);if(d.defined(e.maxSlope))if(d.integer(e.maxSlope)&&d.inRange(e.maxSlope,0,100))this.options.claheMaxSlope=e.maxSlope;else throw d.invalidParameterError("maxSlope","integer between 0 and 100",e.maxSlope)}else throw d.invalidParameterError("options","plain object",e);return this}function H2(e){if(!d.object(e)||!Array.isArray(e.kernel)||!d.integer(e.width)||!d.integer(e.height)||!d.inRange(e.width,3,1001)||!d.inRange(e.height,3,1001)||e.height*e.width!==e.kernel.length||!e.kernel.every(d.number))throw Error("Invalid convolution kernel");if(!d.integer(e.scale))e.scale=e.kernel.reduce((t,r)=>t+r,0);if(e.scale<1)e.scale=1;if(!d.integer(e.offset))e.offset=0;return this.options.convKernel=e,this}function V2(e,t){if(!d.defined(e))this.options.threshold=128;else if(d.bool(e))this.options.threshold=e?128:0;else if(d.integer(e)&&d.inRange(e,0,255))this.options.threshold=e;else throw d.invalidParameterError("threshold","integer between 0 and 255",e);if(!d.object(t)||t.greyscale===!0||t.grayscale===!0)this.options.thresholdGrayscale=!0;else this.options.thresholdGrayscale=!1;return this}function B2(e,t,r){if(this.options.boolean=this._createInputDescriptor(e,r),d.string(t)&&d.inArray(t,["and","or","eor"]))this.options.booleanOp=t;else throw d.invalidParameterError("operator","one of: and, or, eor",t);return this}function W2(e,t){if(!d.defined(e)&&d.number(t))e=1;else if(d.number(e)&&!d.defined(t))t=0;if(!d.defined(e))this.options.linearA=[];else if(d.number(e))this.options.linearA=[e];else if(Array.isArray(e)&&d.inRange(e.length,1,1e6)&&e.every(d.number))this.options.linearA=e;else throw d.invalidParameterError("a","number or array of numbers",e);if(!d.defined(t))this.options.linearB=[];else if(d.number(t))this.options.linearB=[t];else if(Array.isArray(t)&&d.inRange(t.length,1,1e6)&&t.every(d.number))this.options.linearB=t;else throw d.invalidParameterError("b","number or array of numbers",t);if(this.options.linearA.length!==this.options.linearB.length)throw Error("Expected a and b to be arrays of the same length");return this}function U2(e){if(!Array.isArray(e))throw d.invalidParameterError("inputMatrix","array",e);let t=e.length;if(t!==3&&t!==4)throw d.invalidParameterError("inputMatrix","3x3 or 4x4 array",t);if(!e.every((n)=>Array.isArray(n)&&n.length===t))throw d.invalidParameterError("inputMatrix",`array of ${t} arrays of length ${t}`,e);let r=e.flat();if(!r.every(d.number))throw d.invalidParameterError("inputMatrix","array of numbers",r);return this.options.recombMatrix=r,this}function z2(e){if(!d.plainObject(e))throw d.invalidParameterError("options","plain object",e);if("brightness"in e)if(d.number(e.brightness)&&e.brightness>=0)this.options.brightness=e.brightness;else throw d.invalidParameterError("brightness","number above zero",e.brightness);if("saturation"in e)if(d.number(e.saturation)&&e.saturation>=0)this.options.saturation=e.saturation;else throw d.invalidParameterError("saturation","number above zero",e.saturation);if("hue"in e)if(d.integer(e.hue))this.options.hue=e.hue%360;else throw d.invalidParameterError("hue","number",e.hue);if("lightness"in e)if(d.number(e.lightness))this.options.lightness=e.lightness;else throw d.invalidParameterError("lightness","number",e.lightness);return this}var h$,g$=(e)=>{Object.assign(e.prototype,{autoOrient:P2,rotate:_2,flip:j2,flop:k2,affine:R2,sharpen:A2,erode:N2,dilate:T2,median:O2,blur:C2,flatten:I2,unflatten:M2,gamma:J2,negate:D2,normalise:L2,normalize:F2,clahe:q2,convolve:H2,threshold:V2,boolean:B2,linear:W2,recomb:U2,modulate:z2})};var y$=q(()=>{Dr();/*!
351
351
  Copyright 2013 Lovell Fuller and others.
352
352
  SPDX-License-Identifier: Apache-2.0
353
- */i$={integer:"integer",float:"float",approximate:"approximate"}});var p$=C(function(jK,f$){var{defineProperty:Sd,getOwnPropertyDescriptor:I2,getOwnPropertyNames:M2}=Object,J2=Object.prototype.hasOwnProperty,D2=(e,t)=>{for(var r in t)Sd(e,r,{get:t[r],enumerable:!0})},L2=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of M2(t))if(!J2.call(e,s)&&s!==r)Sd(e,s,{get:()=>t[s],enumerable:!(n=I2(t,s))||n.enumerable})}return e},F2=(e)=>L2(Sd({},"__esModule",{value:!0}),e),l$={};D2(l$,{default:()=>eM});f$.exports=F2(l$);var xd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in xd)Object.freeze(xd[e]);var Br=Object.freeze(xd),c$=Object.create(null);for(let e in Br)if(Object.hasOwn(Br,e))c$[Br[e]]=e;var Wt={to:{},get:{}};Wt.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=Wt.get.hsl(e),n="hsl";break}case"hwb":{r=Wt.get.hwb(e),n="hwb";break}default:{r=Wt.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};Wt.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,s=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/,o=[0,0,0,1],a,l,c;if(a=e.match(r)){c=a[2],a=a[1];for(l=0;l<3;l++){let d=l*2;o[l]=Number.parseInt(a.slice(d,d+2),16)}if(c)o[3]=Number.parseInt(c,16)/255}else if(a=e.match(t)){a=a[1],c=a[3];for(l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);if(c)o[3]=Number.parseInt(c+c,16)/255}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.toLowerCase().match(i)){if(a[1]==="transparent")return[0,0,0,0];if(!Object.hasOwn(Br,a[1]))return null;return o=Br[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=Fn(o[l],0,255);return o[3]=Fn(o[3],0,1),o};Wt.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Fn(Number.parseFloat(r[2]),0,100),o=Fn(Number.parseFloat(r[3]),0,100),a=Fn(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Wt.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Fn(Number.parseFloat(r[2]),0,100),o=Fn(Number.parseFloat(r[3]),0,100),a=Fn(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Wt.to.hex=function(...e){return"#"+vl(e[0])+vl(e[1])+vl(e[2])+(e[3]<1?vl(Math.round(e[3]*255)):"")};Wt.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};Wt.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};Wt.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};Wt.to.hwb=function(...e){let t="";if(e.length>=4&&e[3]!==1)t=", "+e[3];return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};Wt.to.keyword=function(...e){return c$[e.slice(0,3)]};function Fn(e,t,r){return Math.min(Math.max(t,e),r)}function vl(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var ci=Wt,u$={};for(let e of Object.keys(Br))u$[Br[e]]=e;var K={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},Ss=K,bn=0.008856451679035631;function di(e){let t=e>0.0031308?1.055*e**0.4166666666666667-0.055:e*12.92;return Math.min(Math.max(0,t),1)}function fi(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(K)){if(!("channels"in K[e]))throw Error("missing channels property: "+e);if(!("labels"in K[e]))throw Error("missing channel labels property: "+e);if(K[e].labels.length!==K[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=K[e];delete K[e].channels,delete K[e].labels,Object.defineProperty(K[e],"channels",{value:t}),Object.defineProperty(K[e],"labels",{value:r})}K.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(t,r,n),i=Math.max(t,r,n),o=i-s,a,l;switch(i){case s:{a=0;break}case t:{a=(r-n)/o;break}case r:{a=2+(n-t)/o;break}case n:{a=4+(t-r)/o;break}}if(a=Math.min(a*60,360),a<0)a+=360;let c=(s+i)/2;if(i===s)l=0;else if(c<=0.5)l=o/(i+s);else l=o/(2-i-s);return[a,l*100,c*100]};K.rgb.hsv=function(e){let t,r,n,s,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),d=c-Math.min(o,a,l),p=function(h){return(c-h)/6/d+0.5};if(d===0)s=0,i=0;else{switch(i=d/c,t=p(o),r=p(a),n=p(l),c){case o:{s=n-r;break}case a:{s=0.3333333333333333+t-n;break}case l:{s=0.6666666666666666+r-t;break}}if(s<0)s+=1;else if(s>1)s-=1}return[s*360,i*100,c*100]};K.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=K.rgb.hsl(e)[0],i=0.00392156862745098*Math.min(t,Math.min(r,n));return n=1-0.00392156862745098*Math.max(t,Math.max(r,n)),[s,i*100,n*100]};K.rgb.oklab=function(e){let t=fi(e[0]/255),r=fi(e[1]/255),n=fi(e[2]/255),s=Math.cbrt(0.4122214708*t+0.5363325363*r+0.0514459929*n),i=Math.cbrt(0.2119034982*t+0.6806995451*r+0.1073969566*n),o=Math.cbrt(0.0883024619*t+0.2817188376*r+0.6299787005*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};K.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-r,1-n),i=(1-t-s)/(1-s)||0,o=(1-r-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[i*100,o*100,a*100,s*100]};function q2(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}K.rgb.keyword=function(e){let t=u$[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(Br)){let i=Br[s],o=q2(e,i);if(o<r)r=o,n=s}return n};K.keyword.rgb=function(e){return[...Br[e]]};K.rgb.xyz=function(e){let t=fi(e[0]/255),r=fi(e[1]/255),n=fi(e[2]/255),s=t*0.4124564+r*0.3575761+n*0.1804375,i=t*0.2126729+r*0.7151522+n*0.072175,o=t*0.0193339+r*0.119192+n*0.9503041;return[s*100,i*100,o*100]};K.rgb.lab=function(e){let t=K.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>bn?s**0.3333333333333333:7.787*s+0.13793103448275862;let i=116*n-16,o=500*(r-n),a=200*(n-s);return[i,o,a]};K.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s,i;if(r===0)return i=n*255,[i,i,i];let o=n<0.5?n*(1+r):n+r-n*r,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++){if(s=t+0.3333333333333333*-(c-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;l[c]=i*255}return l};K.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=r,i=Math.max(n,0.01);n*=2,r*=n<=1?n:2-n,s*=i<=1?i:2-i;let o=(n+r)/2,a=n===0?2*s/(i+s):2*r/(n+r);return[t,a*100,o*100]};K.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,s=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),a=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,s){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};K.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=Math.max(n,0.01),i,o;o=(2-r)*n;let a=(2-r)*s;return i=r*s,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};K.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s=r+n,i;if(s>1)r/=s,n/=s;let o=Math.floor(6*t),a=1-n;if(i=6*t-o,(o&1)!==0)i=1-i;let l=r+i*(a-r),c,d,p;switch(o){default:case 6:case 0:{c=a,d=l,p=r;break}case 1:{c=l,d=a,p=r;break}case 2:{c=r,d=a,p=l;break}case 3:{c=r,d=l,p=a;break}case 4:{c=l,d=r,p=a;break}case 5:{c=a,d=r,p=l;break}}return[c*255,d*255,p*255]};K.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=e[3]/100,i=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,r*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[i*255,o*255,a*255]};K.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s,i,o;return s=t*3.2404542+r*-1.5371385+n*-0.4985314,i=t*-0.969266+r*1.8760108+n*0.041556,o=t*0.0556434+r*-0.2040259+n*1.0572252,s=di(s),i=di(i),o=di(o),[s*255,i*255,o*255]};K.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>bn?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862;let s=116*r-16,i=500*(t-r),o=200*(r-n);return[s,i,o]};K.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=Math.cbrt(0.8189330101*t+0.3618667424*r-0.1288597137*n),i=Math.cbrt(0.0329845436*t+0.9293118715*r+0.0361456387*n),o=Math.cbrt(0.0482003018*t+0.2643662691*r+0.633851707*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};K.oklab.oklch=function(e){return K.lab.lch(e)};K.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(0.999999998*t+0.396337792*r+0.215803758*n)**3,i=(1.000000008*t-0.105561342*r-0.063854175*n)**3,o=(1.000000055*t-0.089484182*r-1.291485538*n)**3,a=1.227013851*s-0.55779998*i+0.281256149*o,l=-0.040580178*s+1.11225687*i-0.071676679*o,c=-0.076381285*s-0.421481978*i+1.58616322*o;return[a*100,l*100,c*100]};K.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(t+0.3963377774*r+0.2158037573*n)**3,i=(t-0.1055613458*r-0.0638541728*n)**3,o=(t-0.0894841775*r-1.291485548*n)**3,a=di(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=di(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=di(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};K.oklch.oklab=function(e){return K.lch.lab(e)};K.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],s,i,o;i=(t+16)/116,s=r/500+i,o=i-n/200;let a=i**3,l=s**3,c=o**3;return i=a>bn?a:(i-0.13793103448275862)/7.787,s=l>bn?l:(s-0.13793103448275862)/7.787,o=c>bn?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};K.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],s;if(s=Math.atan2(n,r)*360/2/Math.PI,s<0)s+=360;let o=Math.sqrt(r*r+n*n);return[t,o,s]};K.lch.lab=function(e){let t=e[0],r=e[1],s=e[2]/360*2*Math.PI,i=r*Math.cos(s),o=r*Math.sin(s);return[t,i,o]};K.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?K.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(r/255));if(i===2)o+=60;return o};K.hsv.ansi16=function(e){return K.rgb.ansi16(K.hsv.rgb(e),e[2])};K.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];if(t>>4===r>>4&&r>>4===n>>4){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};K.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let r=(Math.trunc(e>50)+1)*0.5,n=(t&1)*r*255,s=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,s,i]};K.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[r,n,s]};K.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};K.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];if(t[0].length===3)r=[...r].map((a)=>a+a).join("");let n=Number.parseInt(r,16),s=n>>16&255,i=n>>8&255,o=n&255;return[s,i,o]};K.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),o=s-i,a,l=o<1?i/(1-o):0;if(o<=0)a=0;else if(s===t)a=(r-n)/o%6;else if(s===r)a=2+(n-t)/o;else a=4+(t-r)/o;return a/=6,a%=1,[a*360,o*100,l*100]};K.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<0.5?2*t*r:2*t*(1-r),s=0;if(n<1)s=(r-0.5*n)/(1-n);return[e[0],n*100,s*100]};K.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,s=0;if(n<1)s=(r-n)/(1-n);return[e[0],n*100,s*100]};K.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let s=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{s[0]=1,s[1]=o,s[2]=0;break}case 1:{s[0]=a,s[1]=1,s[2]=0;break}case 2:{s[0]=0,s[1]=1,s[2]=o;break}case 3:{s[0]=0,s[1]=a,s[2]=1;break}case 4:{s[0]=o,s[1]=0,s[2]=1;break}default:s[0]=1,s[1]=0,s[2]=a}return l=(1-r)*n,[(r*s[0]+l)*255,(r*s[1]+l)*255,(r*s[2]+l)*255]};K.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),s=0;if(n>0)s=t/n;return[e[0],s*100,n*100]};K.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+0.5*t,s=0;if(n>0&&n<0.5)s=t/(2*n);else if(n>=0.5&&n<1)s=t/(2*(1-n));return[e[0],s*100,n*100]};K.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};K.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,s=n-t,i=0;if(s<1)i=(n-s)/(1-s);return[e[0],s*100,i*100]};K.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};K.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};K.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};K.gray.hsl=function(e){return[0,0,e[0]]};K.gray.hsv=K.gray.hsl;K.gray.hwb=function(e){return[0,100,e[0]]};K.gray.cmyk=function(e){return[0,0,0,e[0]]};K.gray.lab=function(e){return[e[0],0,0]};K.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n};K.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function H2(){let e={},t=Object.keys(Ss);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function V2(e){let t=H2(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(Ss[n]);for(let{length:i}=s,o=0;o<i;o++){let a=s[o],l=t[a];if(l.distance===-1)l.distance=t[n].distance+1,l.parent=n,r.unshift(a)}}return t}function B2(e,t){return function(r){return t(e(r))}}function W2(e,t){let r=[t[e].parent,e],n=Ss[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=B2(Ss[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function U2(e){let t=V2(e),r={},n=Object.keys(t);for(let{length:s}=n,i=0;i<s;i++){let o=n[i];if(t[o].parent===null)continue;r[o]=W2(o,t)}return r}var z2=U2,ui={},G2=Object.keys(Ss);function K2(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;return e(r)};if("conversion"in e)t.conversion=e.conversion;return t}function Y2(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;let s=e(r);if(typeof s==="object")for(let{length:i}=s,o=0;o<i;o++)s[o]=Math.round(s[o]);return s};if("conversion"in e)t.conversion=e.conversion;return t}for(let e of G2){ui[e]={},Object.defineProperty(ui[e],"channels",{value:Ss[e].channels}),Object.defineProperty(ui[e],"labels",{value:Ss[e].labels});let t=z2(e),r=Object.keys(t);for(let n of r){let s=t[n];ui[e][n]=Y2(s),ui[e][n].raw=K2(s)}}var ar=ui,d$=["keyword","gray","hex"],$d={};for(let e of Object.keys(ar))$d[[...ar[e].labels].sort().join("")]=e;var vd={};function ft(e,t){if(!(this instanceof ft))return new ft(e,t);if(t&&t in d$)t=null;if(t&&!(t in ar))throw Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof ft)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=ci.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=ar[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]==="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=ar[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=wd(s,n),this.valpha=typeof e[n]==="number"?e[n]:1}else if(typeof e==="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let s=Object.keys(e);if("alpha"in e)s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha==="number"?e.alpha:0;let i=s.sort().join("");if(!(i in $d))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=$d[i];let{labels:o}=ar[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=wd(a)}if(vd[this.model]){n=ar[this.model].channels;for(r=0;r<n;r++){let s=vd[this.model][r];if(s)this.color[r]=s(this.color[r])}}if(this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze)Object.freeze(this)}ft.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in ci.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return ci.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e==="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return ci.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=ar[this.model],{labels:r}=ar[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];if(this.valpha!==1)e.alpha=this.valpha;return e},unitArray(){let e=this.rgb().color;if(e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1)e.push(this.valpha);return e},unitObject(){let e=this.rgb().object();if(e.r/=255,e.g/=255,e.b/=255,this.valpha!==1)e.alpha=this.valpha;return e},round(e){return e=Math.max(e||0,0),new ft([...this.color.map(Z2(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new ft([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:et("rgb",0,ct(255)),green:et("rgb",1,ct(255)),blue:et("rgb",2,ct(255)),hue:et(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:et("hsl",1,ct(100)),lightness:et("hsl",2,ct(100)),saturationv:et("hsv",1,ct(100)),value:et("hsv",2,ct(100)),chroma:et("hcg",1,ct(100)),gray:et("hcg",2,ct(100)),white:et("hwb",1,ct(100)),wblack:et("hwb",2,ct(100)),cyan:et("cmyk",0,ct(100)),magenta:et("cmyk",1,ct(100)),yellow:et("cmyk",2,ct(100)),black:et("cmyk",3,ct(100)),x:et("xyz",0,ct(95.047)),y:et("xyz",1,ct(100)),z:et("xyz",2,ct(108.833)),l:et("lab",0,ct(100)),a:et("lab",1),b:et("lab",2),keyword(e){if(e!==void 0)return new ft(e);return ar[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new ft(e);return ci.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new ft(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return ci.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,n]of e.entries()){let s=n/255;t[r]=s<=0.04045?s/12.92:((s+0.055)/1.055)**2.4}return 0.2126*t[0]+0.7152*t[1]+0.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();if(t>r)return(t+0.05)/(r+0.05);return(r+0.05)/(t+0.05)},level(e){let t=this.contrast(e);if(t>=7)return"AAA";return t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*0.3+e[1]*0.59+e[2]*0.11;return ft.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),n=this.rgb(),s=t===void 0?0.5:t,i=2*s-1,o=r.alpha()-n.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return ft.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue(),r.alpha()*s+n.alpha()*(1-s))}};for(let e of Object.keys(ar)){if(d$.includes(e))continue;let{channels:t}=ar[e];ft.prototype[e]=function(...r){if(this.model===e)return new ft(this);if(r.length>0)return new ft(r,e);return new ft([...Q2(ar[this.model][e].raw(this.color)),this.valpha],e)},ft[e]=function(...r){let n=r[0];if(typeof n==="number")n=wd(r,t);return new ft(n,e)}}function X2(e,t){return Number(e.toFixed(t))}function Z2(e){return function(t){return X2(t,e)}}function et(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(vd[n]||=[])[t]=r;return e=e[0],function(n){let s;if(n!==void 0){if(r)n=r(n);return s=this[e](),s.color[t]=n,s}if(s=this[e]().color[t],r)s=r(s);return s}}function ct(e){return function(t){return Math.max(0,Math.min(e,t))}}function Q2(e){return Array.isArray(e)?e:[e]}function wd(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var eM=ft});var h$=C(function(kK,m$){m$.exports=p$().default});function tM(e){return this._setBackgroundColourOption("tint",e),this}function rM(e){return this.options.greyscale=u.bool(e)?e:!0,this}function nM(e){return this.greyscale(e)}function sM(e){if(!u.string(e))throw u.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function iM(e){return this.pipelineColourspace(e)}function oM(e){if(!u.string(e))throw u.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function aM(e){return this.toColourspace(e)}function b$(e){if(u.object(e)||u.string(e)&&e.length>=3&&e.length<=200){let t=y$.default(e),r=t.red(),n=t.green(),s=t.blue(),i=Math.round(t.alpha()*255);for(let[o,a]of[["red",r],["green",n],["blue",s],["alpha",i]])if(!u.number(a))throw u.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw u.invalidParameterError("background","object or string",e)}function lM(e,t){if(u.defined(t))this.options[e]=b$(t)}var y$,g$,x$=(e)=>{Object.assign(e.prototype,{tint:tM,greyscale:rM,grayscale:nM,pipelineColourspace:sM,pipelineColorspace:iM,toColourspace:oM,toColorspace:aM,_getBackgroundColourOption:b$,_setBackgroundColourOption:lM}),e.colourspace=g$,e.colorspace=g$};var $$=q(()=>{Dr();y$=Lt(h$(),1);/*!
353
+ */h$={integer:"integer",float:"float",approximate:"approximate"}});var S$=C(function(WK,w$){var{defineProperty:Ad,getOwnPropertyDescriptor:G2,getOwnPropertyNames:K2}=Object,Y2=Object.prototype.hasOwnProperty,X2=(e,t)=>{for(var r in t)Ad(e,r,{get:t[r],enumerable:!0})},Z2=(e,t,r,n)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let s of K2(t))if(!Y2.call(e,s)&&s!==r)Ad(e,s,{get:()=>t[s],enumerable:!(n=G2(t,s))||n.enumerable})}return e},Q2=(e)=>Z2(Ad({},"__esModule",{value:!0}),e),b$={};X2(b$,{default:()=>pM});w$.exports=Q2(b$);var Pd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};for(let e in Pd)Object.freeze(Pd[e]);var Br=Object.freeze(Pd),x$=Object.create(null);for(let e in Br)if(Object.hasOwn(Br,e))x$[Br[e]]=e;var Ut={to:{},get:{}};Ut.get=function(e){let t=e.slice(0,3).toLowerCase(),r,n;switch(t){case"hsl":{r=Ut.get.hsl(e),n="hsl";break}case"hwb":{r=Ut.get.hwb(e),n="hwb";break}default:{r=Ut.get.rgb(e),n="rgb";break}}if(!r)return null;return{model:n,value:r}};Ut.get.rgb=function(e){if(!e)return null;let t=/^#([a-f\d]{3,4})$/i,r=/^#([a-f\d]{6})([a-f\d]{2})?$/i,n=/^rgba?\(\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)(?=[\s,])\s*(?:,\s*)?([+-]?(?:\d*\.)?\d+(?:e\d+)?)\s*(?:[\s,|/]\s*([+-]?(?:\d*\.)?\d+(?:e\d+)?)(%?)\s*)?\)$/i,s=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[\s,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/i,i=/^(\w+)$/,o=[0,0,0,1],a,l,c;if(a=e.match(r)){c=a[2],a=a[1];for(l=0;l<3;l++){let u=l*2;o[l]=Number.parseInt(a.slice(u,u+2),16)}if(c)o[3]=Number.parseInt(c,16)/255}else if(a=e.match(t)){a=a[1],c=a[3];for(l=0;l<3;l++)o[l]=Number.parseInt(a[l]+a[l],16);if(c)o[3]=Number.parseInt(c+c,16)/255}else if(a=e.match(n)){for(l=0;l<3;l++)o[l]=Number.parseFloat(a[l+1]);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.match(s)){for(l=0;l<3;l++)o[l]=Math.round(Number.parseFloat(a[l+1])*2.55);if(a[4])o[3]=a[5]?Number.parseFloat(a[4])*0.01:Number.parseFloat(a[4])}else if(a=e.toLowerCase().match(i)){if(a[1]==="transparent")return[0,0,0,0];if(!Object.hasOwn(Br,a[1]))return null;return o=Br[a[1]].slice(),o[3]=1,o}else return null;for(l=0;l<3;l++)o[l]=Fn(o[l],0,255);return o[3]=Fn(o[3],0,1),o};Ut.get.hsl=function(e){if(!e)return null;let t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Fn(Number.parseFloat(r[2]),0,100),o=Fn(Number.parseFloat(r[3]),0,100),a=Fn(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Ut.get.hwb=function(e){if(!e)return null;let t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*[\s,]\s*([+-]?[\d.]+)%\s*[\s,]\s*([+-]?[\d.]+)%\s*(?:[\s,]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:e[+-]?\d+)?)\s*)?\)$/i,r=e.match(t);if(r){let n=Number.parseFloat(r[4]),s=(Number.parseFloat(r[1])%360+360)%360,i=Fn(Number.parseFloat(r[2]),0,100),o=Fn(Number.parseFloat(r[3]),0,100),a=Fn(Number.isNaN(n)?1:n,0,1);return[s,i,o,a]}return null};Ut.to.hex=function(...e){return"#"+El(e[0])+El(e[1])+El(e[2])+(e[3]<1?El(Math.round(e[3]*255)):"")};Ut.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};Ut.to.rgb.percent=function(...e){let t=Math.round(e[0]/255*100),r=Math.round(e[1]/255*100),n=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+r+"%, "+n+"%)":"rgba("+t+"%, "+r+"%, "+n+"%, "+e[3]+")"};Ut.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};Ut.to.hwb=function(...e){let t="";if(e.length>=4&&e[3]!==1)t=", "+e[3];return"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};Ut.to.keyword=function(...e){return x$[e.slice(0,3)]};function Fn(e,t,r){return Math.min(Math.max(t,e),r)}function El(e){let t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}var ui=Ut,$$={};for(let e of Object.keys(Br))$$[Br[e]]=e;var Y={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},oklab:{channels:3,labels:["okl","oka","okb"]},lch:{channels:3,labels:"lch"},oklch:{channels:3,labels:["okl","okc","okh"]},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},Es=Y,bn=0.008856451679035631;function fi(e){let t=e>0.0031308?1.055*e**0.4166666666666667-0.055:e*12.92;return Math.min(Math.max(0,t),1)}function pi(e){return e>0.04045?((e+0.055)/1.055)**2.4:e/12.92}for(let e of Object.keys(Y)){if(!("channels"in Y[e]))throw Error("missing channels property: "+e);if(!("labels"in Y[e]))throw Error("missing channel labels property: "+e);if(Y[e].labels.length!==Y[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=Y[e];delete Y[e].channels,delete Y[e].labels,Object.defineProperty(Y[e],"channels",{value:t}),Object.defineProperty(Y[e],"labels",{value:r})}Y.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(t,r,n),i=Math.max(t,r,n),o=i-s,a,l;switch(i){case s:{a=0;break}case t:{a=(r-n)/o;break}case r:{a=2+(n-t)/o;break}case n:{a=4+(t-r)/o;break}}if(a=Math.min(a*60,360),a<0)a+=360;let c=(s+i)/2;if(i===s)l=0;else if(c<=0.5)l=o/(i+s);else l=o/(2-i-s);return[a,l*100,c*100]};Y.rgb.hsv=function(e){let t,r,n,s,i,o=e[0]/255,a=e[1]/255,l=e[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),p=function(g){return(c-g)/6/u+0.5};if(u===0)s=0,i=0;else{switch(i=u/c,t=p(o),r=p(a),n=p(l),c){case o:{s=n-r;break}case a:{s=0.3333333333333333+t-n;break}case l:{s=0.6666666666666666+r-t;break}}if(s<0)s+=1;else if(s>1)s-=1}return[s*360,i*100,c*100]};Y.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],s=Y.rgb.hsl(e)[0],i=0.00392156862745098*Math.min(t,Math.min(r,n));return n=1-0.00392156862745098*Math.max(t,Math.max(r,n)),[s,i*100,n*100]};Y.rgb.oklab=function(e){let t=pi(e[0]/255),r=pi(e[1]/255),n=pi(e[2]/255),s=Math.cbrt(0.4122214708*t+0.5363325363*r+0.0514459929*n),i=Math.cbrt(0.2119034982*t+0.6806995451*r+0.1073969566*n),o=Math.cbrt(0.0883024619*t+0.2817188376*r+0.6299787005*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};Y.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.min(1-t,1-r,1-n),i=(1-t-s)/(1-s)||0,o=(1-r-s)/(1-s)||0,a=(1-n-s)/(1-s)||0;return[i*100,o*100,a*100,s*100]};function eM(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}Y.rgb.keyword=function(e){let t=$$[e];if(t)return t;let r=Number.POSITIVE_INFINITY,n;for(let s of Object.keys(Br)){let i=Br[s],o=eM(e,i);if(o<r)r=o,n=s}return n};Y.keyword.rgb=function(e){return[...Br[e]]};Y.rgb.xyz=function(e){let t=pi(e[0]/255),r=pi(e[1]/255),n=pi(e[2]/255),s=t*0.4124564+r*0.3575761+n*0.1804375,i=t*0.2126729+r*0.7151522+n*0.072175,o=t*0.0193339+r*0.119192+n*0.9503041;return[s*100,i*100,o*100]};Y.rgb.lab=function(e){let t=Y.rgb.xyz(e),r=t[0],n=t[1],s=t[2];r/=95.047,n/=100,s/=108.883,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862,s=s>bn?s**0.3333333333333333:7.787*s+0.13793103448275862;let i=116*n-16,o=500*(r-n),a=200*(n-s);return[i,o,a]};Y.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s,i;if(r===0)return i=n*255,[i,i,i];let o=n<0.5?n*(1+r):n+r-n*r,a=2*n-o,l=[0,0,0];for(let c=0;c<3;c++){if(s=t+0.3333333333333333*-(c-1),s<0)s++;if(s>1)s--;if(6*s<1)i=a+(o-a)*6*s;else if(2*s<1)i=o;else if(3*s<2)i=a+(o-a)*(0.6666666666666666-s)*6;else i=a;l[c]=i*255}return l};Y.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=r,i=Math.max(n,0.01);n*=2,r*=n<=1?n:2-n,s*=i<=1?i:2-i;let o=(n+r)/2,a=n===0?2*s/(i+s):2*r/(n+r);return[t,a*100,o*100]};Y.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,s=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),a=255*n*(1-r*i),l=255*n*(1-r*(1-i));switch(n*=255,s){case 0:return[n,l,o];case 1:return[a,n,o];case 2:return[o,n,l];case 3:return[o,a,n];case 4:return[l,o,n];case 5:return[n,o,a]}};Y.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,s=Math.max(n,0.01),i,o;o=(2-r)*n;let a=(2-r)*s;return i=r*s,i/=a<=1?a:2-a,i=i||0,o/=2,[t,i*100,o*100]};Y.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,s=r+n,i;if(s>1)r/=s,n/=s;let o=Math.floor(6*t),a=1-n;if(i=6*t-o,(o&1)!==0)i=1-i;let l=r+i*(a-r),c,u,p;switch(o){default:case 6:case 0:{c=a,u=l,p=r;break}case 1:{c=l,u=a,p=r;break}case 2:{c=r,u=a,p=l;break}case 3:{c=r,u=l,p=a;break}case 4:{c=l,u=r,p=a;break}case 5:{c=a,u=r,p=l;break}}return[c*255,u*255,p*255]};Y.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=e[3]/100,i=1-Math.min(1,t*(1-s)+s),o=1-Math.min(1,r*(1-s)+s),a=1-Math.min(1,n*(1-s)+s);return[i*255,o*255,a*255]};Y.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s,i,o;return s=t*3.2404542+r*-1.5371385+n*-0.4985314,i=t*-0.969266+r*1.8760108+n*0.041556,o=t*0.0556434+r*-0.2040259+n*1.0572252,s=fi(s),i=fi(i),o=fi(o),[s*255,i*255,o*255]};Y.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>bn?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>bn?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>bn?n**0.3333333333333333:7.787*n+0.13793103448275862;let s=116*r-16,i=500*(t-r),o=200*(r-n);return[s,i,o]};Y.xyz.oklab=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=Math.cbrt(0.8189330101*t+0.3618667424*r-0.1288597137*n),i=Math.cbrt(0.0329845436*t+0.9293118715*r+0.0361456387*n),o=Math.cbrt(0.0482003018*t+0.2643662691*r+0.633851707*n),a=0.2104542553*s+0.793617785*i-0.0040720468*o,l=1.9779984951*s-2.428592205*i+0.4505937099*o,c=0.0259040371*s+0.7827717662*i-0.808675766*o;return[a*100,l*100,c*100]};Y.oklab.oklch=function(e){return Y.lab.lch(e)};Y.oklab.xyz=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(0.999999998*t+0.396337792*r+0.215803758*n)**3,i=(1.000000008*t-0.105561342*r-0.063854175*n)**3,o=(1.000000055*t-0.089484182*r-1.291485538*n)**3,a=1.227013851*s-0.55779998*i+0.281256149*o,l=-0.040580178*s+1.11225687*i-0.071676679*o,c=-0.076381285*s-0.421481978*i+1.58616322*o;return[a*100,l*100,c*100]};Y.oklab.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,s=(t+0.3963377774*r+0.2158037573*n)**3,i=(t-0.1055613458*r-0.0638541728*n)**3,o=(t-0.0894841775*r-1.291485548*n)**3,a=fi(4.0767416621*s-3.3077115913*i+0.2309699292*o),l=fi(-1.2684380046*s+2.6097574011*i-0.3413193965*o),c=fi(-0.0041960863*s-0.7034186147*i+1.707614701*o);return[a*255,l*255,c*255]};Y.oklch.oklab=function(e){return Y.lch.lab(e)};Y.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],s,i,o;i=(t+16)/116,s=r/500+i,o=i-n/200;let a=i**3,l=s**3,c=o**3;return i=a>bn?a:(i-0.13793103448275862)/7.787,s=l>bn?l:(s-0.13793103448275862)/7.787,o=c>bn?c:(o-0.13793103448275862)/7.787,s*=95.047,i*=100,o*=108.883,[s,i,o]};Y.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],s;if(s=Math.atan2(n,r)*360/2/Math.PI,s<0)s+=360;let o=Math.sqrt(r*r+n*n);return[t,o,s]};Y.lch.lab=function(e){let t=e[0],r=e[1],s=e[2]/360*2*Math.PI,i=r*Math.cos(s),o=r*Math.sin(s);return[t,i,o]};Y.rgb.ansi16=function(e,t=null){let[r,n,s]=e,i=t===null?Y.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(n/255)<<1|Math.round(r/255));if(i===2)o+=60;return o};Y.hsv.ansi16=function(e){return Y.rgb.ansi16(Y.hsv.rgb(e),e[2])};Y.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];if(t>>4===r>>4&&r>>4===n>>4){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};Y.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let r=(Math.trunc(e>50)+1)*0.5,n=(t&1)*r*255,s=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,s,i]};Y.ansi256.rgb=function(e){if(e=e[0],e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,s=t%6/5*255;return[r,n,s]};Y.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(r.length)+r};Y.hex.rgb=function(e){let t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let r=t[0];if(t[0].length===3)r=[...r].map((a)=>a+a).join("");let n=Number.parseInt(r,16),s=n>>16&255,i=n>>8&255,o=n&255;return[s,i,o]};Y.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,s=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),o=s-i,a,l=o<1?i/(1-o):0;if(o<=0)a=0;else if(s===t)a=(r-n)/o%6;else if(s===r)a=2+(n-t)/o;else a=4+(t-r)/o;return a/=6,a%=1,[a*360,o*100,l*100]};Y.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<0.5?2*t*r:2*t*(1-r),s=0;if(n<1)s=(r-0.5*n)/(1-n);return[e[0],n*100,s*100]};Y.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,s=0;if(n<1)s=(r-n)/(1-n);return[e[0],n*100,s*100]};Y.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let s=[0,0,0],i=t%1*6,o=i%1,a=1-o,l=0;switch(Math.floor(i)){case 0:{s[0]=1,s[1]=o,s[2]=0;break}case 1:{s[0]=a,s[1]=1,s[2]=0;break}case 2:{s[0]=0,s[1]=1,s[2]=o;break}case 3:{s[0]=0,s[1]=a,s[2]=1;break}case 4:{s[0]=o,s[1]=0,s[2]=1;break}default:s[0]=1,s[1]=0,s[2]=a}return l=(1-r)*n,[(r*s[0]+l)*255,(r*s[1]+l)*255,(r*s[2]+l)*255]};Y.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),s=0;if(n>0)s=t/n;return[e[0],s*100,n*100]};Y.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+0.5*t,s=0;if(n>0&&n<0.5)s=t/(2*n);else if(n>=0.5&&n<1)s=t/(2*(1-n));return[e[0],s*100,n*100]};Y.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};Y.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,s=n-t,i=0;if(s<1)i=(n-s)/(1-s);return[e[0],s*100,i*100]};Y.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};Y.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};Y.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};Y.gray.hsl=function(e){return[0,0,e[0]]};Y.gray.hsv=Y.gray.hsl;Y.gray.hwb=function(e){return[0,100,e[0]]};Y.gray.cmyk=function(e){return[0,0,0,e[0]]};Y.gray.lab=function(e){return[e[0],0,0]};Y.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(n.length)+n};Y.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function tM(){let e={},t=Object.keys(Es);for(let{length:r}=t,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function rM(e){let t=tM(),r=[e];t[e].distance=0;while(r.length>0){let n=r.pop(),s=Object.keys(Es[n]);for(let{length:i}=s,o=0;o<i;o++){let a=s[o],l=t[a];if(l.distance===-1)l.distance=t[n].distance+1,l.parent=n,r.unshift(a)}}return t}function nM(e,t){return function(r){return t(e(r))}}function sM(e,t){let r=[t[e].parent,e],n=Es[t[e].parent][e],s=t[e].parent;while(t[s].parent)r.unshift(t[s].parent),n=nM(Es[t[s].parent][s],n),s=t[s].parent;return n.conversion=r,n}function iM(e){let t=rM(e),r={},n=Object.keys(t);for(let{length:s}=n,i=0;i<s;i++){let o=n[i];if(t[o].parent===null)continue;r[o]=sM(o,t)}return r}var oM=iM,di={},aM=Object.keys(Es);function lM(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;return e(r)};if("conversion"in e)t.conversion=e.conversion;return t}function cM(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;let s=e(r);if(typeof s==="object")for(let{length:i}=s,o=0;o<i;o++)s[o]=Math.round(s[o]);return s};if("conversion"in e)t.conversion=e.conversion;return t}for(let e of aM){di[e]={},Object.defineProperty(di[e],"channels",{value:Es[e].channels}),Object.defineProperty(di[e],"labels",{value:Es[e].labels});let t=oM(e),r=Object.keys(t);for(let n of r){let s=t[n];di[e][n]=cM(s),di[e][n].raw=lM(s)}}var lr=di,v$=["keyword","gray","hex"],jd={};for(let e of Object.keys(lr))jd[[...lr[e].labels].sort().join("")]=e;var kd={};function ft(e,t){if(!(this instanceof ft))return new ft(e,t);if(t&&t in v$)t=null;if(t&&!(t in lr))throw Error("Unknown model: "+t);let r,n;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof ft)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==="string"){let s=ui.get(e);if(s===null)throw Error("Unable to parse color from string: "+e);this.model=s.model,n=lr[this.model].channels,this.color=s.value.slice(0,n),this.valpha=typeof s.value[n]==="number"?s.value[n]:1}else if(e.length>0){this.model=t||"rgb",n=lr[this.model].channels;let s=Array.prototype.slice.call(e,0,n);this.color=Rd(s,n),this.valpha=typeof e[n]==="number"?e[n]:1}else if(typeof e==="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let s=Object.keys(e);if("alpha"in e)s.splice(s.indexOf("alpha"),1),this.valpha=typeof e.alpha==="number"?e.alpha:0;let i=s.sort().join("");if(!(i in jd))throw Error("Unable to parse color from object: "+JSON.stringify(e));this.model=jd[i];let{labels:o}=lr[this.model],a=[];for(r=0;r<o.length;r++)a.push(e[o[r]]);this.color=Rd(a)}if(kd[this.model]){n=lr[this.model].channels;for(r=0;r<n;r++){let s=kd[this.model][r];if(s)this.color[r]=s(this.color[r])}}if(this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze)Object.freeze(this)}ft.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in ui.to?this:this.rgb();t=t.round(typeof e==="number"?e:1);let r=t.valpha===1?t.color:[...t.color,this.valpha];return ui.to[t.model](...r)},percentString(e){let t=this.rgb().round(typeof e==="number"?e:1),r=t.valpha===1?t.color:[...t.color,this.valpha];return ui.to.rgb.percent(...r)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=lr[this.model],{labels:r}=lr[this.model];for(let n=0;n<t;n++)e[r[n]]=this.color[n];if(this.valpha!==1)e.alpha=this.valpha;return e},unitArray(){let e=this.rgb().color;if(e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1)e.push(this.valpha);return e},unitObject(){let e=this.rgb().object();if(e.r/=255,e.g/=255,e.b/=255,this.valpha!==1)e.alpha=this.valpha;return e},round(e){return e=Math.max(e||0,0),new ft([...this.color.map(dM(e)),this.valpha],this.model)},alpha(e){if(e!==void 0)return new ft([...this.color,Math.max(0,Math.min(1,e))],this.model);return this.valpha},red:et("rgb",0,ct(255)),green:et("rgb",1,ct(255)),blue:et("rgb",2,ct(255)),hue:et(["hsl","hsv","hsl","hwb","hcg"],0,(e)=>(e%360+360)%360),saturationl:et("hsl",1,ct(100)),lightness:et("hsl",2,ct(100)),saturationv:et("hsv",1,ct(100)),value:et("hsv",2,ct(100)),chroma:et("hcg",1,ct(100)),gray:et("hcg",2,ct(100)),white:et("hwb",1,ct(100)),wblack:et("hwb",2,ct(100)),cyan:et("cmyk",0,ct(100)),magenta:et("cmyk",1,ct(100)),yellow:et("cmyk",2,ct(100)),black:et("cmyk",3,ct(100)),x:et("xyz",0,ct(95.047)),y:et("xyz",1,ct(100)),z:et("xyz",2,ct(108.833)),l:et("lab",0,ct(100)),a:et("lab",1),b:et("lab",2),keyword(e){if(e!==void 0)return new ft(e);return lr[this.model].keyword(this.color)},hex(e){if(e!==void 0)return new ft(e);return ui.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new ft(e);let t=this.rgb().round().color,r=Math.round(this.valpha*255).toString(16).toUpperCase();if(r.length===1)r="0"+r;return ui.to.hex(...t)+r},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[r,n]of e.entries()){let s=n/255;t[r]=s<=0.04045?s/12.92:((s+0.055)/1.055)**2.4}return 0.2126*t[0]+0.7152*t[1]+0.0722*t[2]},contrast(e){let t=this.luminosity(),r=e.luminosity();if(t>r)return(t+0.05)/(r+0.05);return(r+0.05)/(t+0.05)},level(e){let t=this.contrast(e);if(t>=7)return"AAA";return t>=4.5?"AA":""},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*0.3+e[1]*0.59+e[2]*0.11;return ft.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),r=t.color[0];return r=(r+e)%360,r=r<0?360+r:r,t.color[0]=r,t},mix(e,t){if(!e||!e.rgb)throw Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);let r=e.rgb(),n=this.rgb(),s=t===void 0?0.5:t,i=2*s-1,o=r.alpha()-n.alpha(),a=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,l=1-a;return ft.rgb(a*r.red()+l*n.red(),a*r.green()+l*n.green(),a*r.blue()+l*n.blue(),r.alpha()*s+n.alpha()*(1-s))}};for(let e of Object.keys(lr)){if(v$.includes(e))continue;let{channels:t}=lr[e];ft.prototype[e]=function(...r){if(this.model===e)return new ft(this);if(r.length>0)return new ft(r,e);return new ft([...fM(lr[this.model][e].raw(this.color)),this.valpha],e)},ft[e]=function(...r){let n=r[0];if(typeof n==="number")n=Rd(r,t);return new ft(n,e)}}function uM(e,t){return Number(e.toFixed(t))}function dM(e){return function(t){return uM(t,e)}}function et(e,t,r){e=Array.isArray(e)?e:[e];for(let n of e)(kd[n]||=[])[t]=r;return e=e[0],function(n){let s;if(n!==void 0){if(r)n=r(n);return s=this[e](),s.color[t]=n,s}if(s=this[e]().color[t],r)s=r(s);return s}}function ct(e){return function(t){return Math.max(0,Math.min(e,t))}}function fM(e){return Array.isArray(e)?e:[e]}function Rd(e,t){for(let r=0;r<t;r++)if(typeof e[r]!=="number")e[r]=0;return e}var pM=ft});var _$=C(function(UK,E$){E$.exports=S$().default});function mM(e){return this._setBackgroundColourOption("tint",e),this}function hM(e){return this.options.greyscale=d.bool(e)?e:!0,this}function gM(e){return this.greyscale(e)}function yM(e){if(!d.string(e))throw d.invalidParameterError("colourspace","string",e);return this.options.colourspacePipeline=e,this}function bM(e){return this.pipelineColourspace(e)}function xM(e){if(!d.string(e))throw d.invalidParameterError("colourspace","string",e);return this.options.colourspace=e,this}function $M(e){return this.toColourspace(e)}function k$(e){if(d.object(e)||d.string(e)&&e.length>=3&&e.length<=200){let t=j$.default(e),r=t.red(),n=t.green(),s=t.blue(),i=Math.round(t.alpha()*255);for(let[o,a]of[["red",r],["green",n],["blue",s],["alpha",i]])if(!d.number(a))throw d.invalidParameterError(`background.${o}`,"number",a);return[r,n,s,i]}else throw d.invalidParameterError("background","object or string",e)}function vM(e,t){if(d.defined(t))this.options[e]=k$(t)}var j$,P$,R$=(e)=>{Object.assign(e.prototype,{tint:mM,greyscale:hM,grayscale:gM,pipelineColourspace:yM,pipelineColorspace:bM,toColourspace:xM,toColorspace:$M,_getBackgroundColourOption:k$,_setBackgroundColourOption:vM}),e.colourspace=P$,e.colorspace=P$};var A$=q(()=>{Dr();j$=Lt(_$(),1);/*!
354
354
  Copyright 2013 Lovell Fuller and others.
355
355
  SPDX-License-Identifier: Apache-2.0
356
- */g$={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"}});function uM(){return this.options.removeAlpha=!0,this}function dM(e){if(u.defined(e))if(u.number(e)&&u.inRange(e,0,1))this.options.ensureAlpha=e;else throw u.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function fM(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e))e=t[e];if(u.integer(e)&&u.inRange(e,0,4))this.options.extractChannel=e;else throw u.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function pM(e,t){if(Array.isArray(e))e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this);else this.options.joinChannelIn.push(this._createInputDescriptor(e,t));return this}function mM(e){if(u.string(e)&&u.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw u.invalidParameterError("boolOp","one of: and, or, eor",e);return this}var cM,v$=(e)=>{Object.assign(e.prototype,{removeAlpha:uM,ensureAlpha:dM,extractChannel:fM,joinChannel:pM,bandbool:mM}),e.bool=cM};var w$=q(()=>{Dr();/*!
356
+ */P$={multiband:"multiband","b-w":"b-w",bw:"b-w",cmyk:"cmyk",srgb:"srgb"}});function SM(){return this.options.removeAlpha=!0,this}function EM(e){if(d.defined(e))if(d.number(e)&&d.inRange(e,0,1))this.options.ensureAlpha=e;else throw d.invalidParameterError("alpha","number between 0 and 1",e);else this.options.ensureAlpha=1;return this}function _M(e){let t={red:0,green:1,blue:2,alpha:3};if(Object.keys(t).includes(e))e=t[e];if(d.integer(e)&&d.inRange(e,0,4))this.options.extractChannel=e;else throw d.invalidParameterError("channel","integer or one of: red, green, blue, alpha",e);return this}function PM(e,t){if(Array.isArray(e))e.forEach(function(r){this.options.joinChannelIn.push(this._createInputDescriptor(r,t))},this);else this.options.joinChannelIn.push(this._createInputDescriptor(e,t));return this}function jM(e){if(d.string(e)&&d.inArray(e,["and","or","eor"]))this.options.bandBoolOp=e;else throw d.invalidParameterError("boolOp","one of: and, or, eor",e);return this}var wM,O$=(e)=>{Object.assign(e.prototype,{removeAlpha:SM,ensureAlpha:EM,extractChannel:_M,joinChannel:PM,bandbool:jM}),e.bool=wM};var C$=q(()=>{Dr();/*!
357
357
  Copyright 2013 Lovell Fuller and others.
358
358
  SPDX-License-Identifier: Apache-2.0
359
- */cM={and:"and",or:"or",eor:"eor"}});import Ed from"node:path";function gM(e,t){let r;if(!u.string(e))r=Error("Missing output file path");else if(u.string(this.options.input.file)&&Ed.resolve(this.options.input.file)===Ed.resolve(e))r=Error("Cannot use same file for input and output");else if(hM.test(Ed.extname(e))&&!this.constructor.format.jp2.output.file)r=E$();if(r)if(u.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function yM(e,t){if(u.object(e))this._setBooleanOption("resolveWithObject",e.resolveWithObject);else if(this.options.resolveWithObject)this.options.resolveWithObject=!1;this.options.fileOut="";let r=Error();return this._pipeline(u.fn(e)?e:t,r)}function bM(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function xM(e){if(u.number(e)&&e>0)this.options.withMetadataDensity=e;else throw u.invalidParameterError("density","positive number",e);return this.keepExif()}function $M(){return this.options.keepMetadata|=1,this}function vM(e){if(u.object(e))for(let[t,r]of Object.entries(e))if(u.object(r))for(let[n,s]of Object.entries(r))if(u.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw u.invalidParameterError(`${t}.${n}`,"string",s);else throw u.invalidParameterError(t,"object",r);else throw u.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function wM(e){return this.withExif(e),this.options.withExifMerge=!0,this}function SM(){return this.options.keepMetadata|=8,this}function EM(e,t){if(u.string(e))this.options.withIccProfile=e;else throw u.invalidParameterError("icc","string",e);if(this.keepIccProfile(),u.object(t)){if(u.defined(t.attach))if(u.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw u.invalidParameterError("attach","boolean",t.attach)}return this}function _M(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function PM(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function jM(){return this.options.keepMetadata|=2,this}function kM(e){if(u.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw u.invalidParameterError("xmp","non-empty string",e);return this}function RM(){return this.options.keepMetadata|=31,this}function AM(e){if(this.keepMetadata(),this.withIccProfile("srgb"),u.object(e)){if(u.defined(e.orientation))if(u.integer(e.orientation)&&u.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw u.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(u.defined(e.density))if(u.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw u.invalidParameterError("density","positive number",e.density);if(u.defined(e.icc))this.withIccProfile(e.icc);if(u.defined(e.exif))this.withExifMerge(e.exif)}return this}function OM(e,t){let r=S$.get((u.object(e)&&u.string(e.id)?e.id:e).toLowerCase());if(!r)throw u.invalidParameterError("format",`one of: ${[...S$.keys()].join(", ")}`,e);return this[r](t)}function CM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=u.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(u.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(u.defined(e.mozjpeg))if(u.bool(e.mozjpeg)){if(e.mozjpeg)this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3}else throw u.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=u.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(u.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(u.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=u.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(u.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=u.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(u.defined(s))if(u.integer(s)&&u.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw u.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function NM(e){if(u.object(e)){if(u.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(u.defined(e.compressionLevel))if(u.integer(e.compressionLevel)&&u.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw u.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(u.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(u.defined(t))if(u.integer(t)&&u.inRange(t,2,256))this.options.pngBitdepth=_$(t);else throw u.invalidParameterError("colours","integer between 2 and 256",t);if(u.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(u.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw u.invalidParameterError("quality","integer between 0 and 100",e.quality);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 10",e.effort);if(u.defined(e.dither))if(u.number(e.dither)&&u.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw u.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function TM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.alphaQuality))if(u.integer(e.alphaQuality)&&u.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw u.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(u.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(u.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(u.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(u.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(u.defined(e.preset))if(u.string(e.preset)&&u.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw u.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw u.invalidParameterError("effort","integer between 0 and 6",e.effort);if(u.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(u.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(u.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return _d(e,this.options),this._updateFormatOut("webp",e)}function IM(e){if(u.object(e)){if(u.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(u.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(u.defined(t))if(u.integer(t)&&u.inRange(t,2,256))this.options.gifBitdepth=_$(t);else throw u.invalidParameterError("colours","integer between 2 and 256",t);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 10",e.effort);if(u.defined(e.dither))if(u.number(e.dither)&&u.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw u.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(u.defined(e.interFrameMaxError))if(u.number(e.interFrameMaxError)&&u.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw u.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(u.defined(e.interPaletteMaxError))if(u.number(e.interPaletteMaxError)&&u.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw u.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(u.defined(e.keepDuplicateFrames))if(u.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw u.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return _d(e,this.options),this._updateFormatOut("gif",e)}function MM(e){if(!this.constructor.format.jp2.output.buffer)throw E$();if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.tileWidth))if(u.integer(e.tileWidth)&&u.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw u.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(u.defined(e.tileHeight))if(u.integer(e.tileHeight)&&u.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw u.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function _d(e,t){if(u.object(e)&&u.defined(e.loop))if(u.integer(e.loop)&&u.inRange(e.loop,0,65535))t.loop=e.loop;else throw u.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(u.object(e)&&u.defined(e.delay))if(u.integer(e.delay)&&u.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&u.inRange(e.delay.length,1,1e6)&&e.delay.every(u.integer)&&e.delay.every((r)=>u.inRange(r,0,65535)))t.delay=e.delay;else throw u.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function JM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.bitdepth))if(u.integer(e.bitdepth)&&u.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw u.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(u.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(u.defined(e.tileWidth))if(u.integer(e.tileWidth)&&u.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw u.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(u.defined(e.tileHeight))if(u.integer(e.tileHeight)&&u.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw u.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(u.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(u.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(u.defined(e.xres))if(u.number(e.xres)&&u.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw u.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(u.defined(e.yres))if(u.number(e.yres)&&u.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw u.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(u.defined(e.compression))if(u.string(e.compression)&&u.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw u.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(u.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(u.defined(e.predictor))if(u.string(e.predictor)&&u.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw u.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(u.defined(e.resolutionUnit))if(u.string(e.resolutionUnit)&&u.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw u.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function DM(e){return this.heif({...e,compression:"av1"})}function LM(e){if(u.object(e)){if(u.string(e.compression)&&u.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw u.invalidParameterError("compression","one of: av1, hevc",e.compression);if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.heifLossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw u.invalidParameterError("effort","integer between 0 and 9",e.effort);if(u.defined(e.chromaSubsampling))if(u.string(e.chromaSubsampling)&&u.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw u.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(u.defined(e.bitdepth))if(u.integer(e.bitdepth)&&u.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw u.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(u.defined(e.tune))if(u.string(e.tune)&&u.inArray(e.tune,["auto","iq","psnr","ssim"]))if(this.options.heifLossless&&e.tune==="iq")this.options.heifTune="ssim";else this.options.heifTune=e.tune;else throw u.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw u.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function FM(e){if(u.object(e)){if(u.defined(e.quality))if(u.integer(e.quality)&&u.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?0.1+(100-e.quality)*0.09:0.017666666666666667*e.quality*e.quality-1.15*e.quality+25;else throw u.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(u.defined(e.distance))if(u.number(e.distance)&&u.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw u.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(u.defined(e.decodingTier))if(u.integer(e.decodingTier)&&u.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw u.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(u.defined(e.lossless))if(u.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw u.invalidParameterError("lossless","boolean",e.lossless);if(u.defined(e.effort))if(u.integer(e.effort)&&u.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw u.invalidParameterError("effort","integer between 1 and 9",e.effort)}return _d(e,this.options),this._updateFormatOut("jxl",e)}function qM(e){if(u.object(e)){if(u.defined(e.depth))if(u.string(e.depth)&&u.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw u.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function HM(e){if(u.object(e)){if(u.defined(e.size))if(u.integer(e.size)&&u.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw u.invalidParameterError("size","integer between 1 and 8192",e.size);if(u.defined(e.overlap))if(u.integer(e.overlap)&&u.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw u.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw u.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(u.defined(e.container))if(u.string(e.container)&&u.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw u.invalidParameterError("container","one of: fs, zip",e.container);if(u.defined(e.layout))if(u.string(e.layout)&&u.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw u.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(u.defined(e.angle))if(u.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw u.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),u.defined(e.depth))if(u.string(e.depth)&&u.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw u.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(u.defined(e.skipBlanks))if(u.integer(e.skipBlanks)&&u.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw u.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(u.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=u.bool(e.center)?e.center:e.centre;if(u.defined(t))this._setBooleanOption("tileCentre",t);if(u.defined(e.id))if(u.string(e.id))this.options.tileId=e.id;else throw u.invalidParameterError("id","string",e.id);if(u.defined(e.basename))if(u.string(e.basename))this.options.tileBasename=e.basename;else throw u.invalidParameterError("basename","string",e.basename)}if(u.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw u.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function VM(e){if(!u.plainObject(e))throw u.invalidParameterError("options","object",e);if(u.integer(e.seconds)&&u.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw u.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function BM(e,t){if(!(u.object(t)&&t.force===!1))this.options.formatOut=e;return this}function WM(e,t){if(u.bool(t))this.options[e]=t;else throw u.invalidParameterError(e,"boolean",t)}function UM(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function zM(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)e(u.nativeError(r,t));else e(null,n,s)})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)e(u.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",u.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",u.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(s,i,o)=>{if(s)n(u.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{Oe.pipeline(this.options,(s,i,o)=>{if(s)n(u.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var S$,hM,E$=()=>Error("JP2 output requires libvips with support for OpenJPEG"),_$=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),P$=(e)=>{Object.assign(e.prototype,{toFile:gM,toBuffer:yM,toUint8Array:bM,withDensity:xM,keepExif:$M,withExif:vM,withExifMerge:wM,keepIccProfile:SM,withIccProfile:EM,keepGainMap:_M,withGainMap:PM,keepXmp:jM,withXmp:kM,keepMetadata:RM,withMetadata:AM,toFormat:OM,jpeg:CM,jp2:MM,png:NM,webp:TM,tiff:JM,avif:DM,heif:LM,jxl:FM,gif:IM,raw:qM,tile:HM,timeout:VM,_updateFormatOut:BM,_setBooleanOption:WM,_read:UM,_pipeline:zM})};var j$=q(()=>{Dr();bo();/*!
359
+ */wM={and:"and",or:"or",eor:"eor"}});import Od from"node:path";function RM(e,t){let r;if(!d.string(e))r=Error("Missing output file path");else if(d.string(this.options.input.file)&&Od.resolve(this.options.input.file)===Od.resolve(e))r=Error("Cannot use same file for input and output");else if(kM.test(Od.extname(e))&&!this.constructor.format.jp2.output.file)r=N$();if(r)if(d.fn(t))t(r);else return Promise.reject(r);else{this.options.fileOut=e;let n=Error();return this._pipeline(t,n)}return this}function AM(e,t){if(d.object(e))this._setBooleanOption("resolveWithObject",e.resolveWithObject);else if(this.options.resolveWithObject)this.options.resolveWithObject=!1;this.options.fileOut="";let r=Error();return this._pipeline(d.fn(e)?e:t,r)}function OM(){this.options.resolveWithObject=!0,this.options.typedArrayOut=!0;let e=Error();return this._pipeline(null,e)}function CM(e){if(d.number(e)&&e>0)this.options.withMetadataDensity=e;else throw d.invalidParameterError("density","positive number",e);return this.keepExif()}function TM(){return this.options.keepMetadata|=1,this}function NM(e){if(d.object(e))for(let[t,r]of Object.entries(e))if(d.object(r))for(let[n,s]of Object.entries(r))if(d.string(s))this.options.withExif[`exif-${t.toLowerCase()}-${n}`]=s;else throw d.invalidParameterError(`${t}.${n}`,"string",s);else throw d.invalidParameterError(t,"object",r);else throw d.invalidParameterError("exif","object",e);return this.options.withExifMerge=!1,this.keepExif()}function IM(e){return this.withExif(e),this.options.withExifMerge=!0,this}function MM(){return this.options.keepMetadata|=8,this}function JM(e,t){if(d.string(e))this.options.withIccProfile=e;else throw d.invalidParameterError("icc","string",e);if(this.keepIccProfile(),d.object(t)){if(d.defined(t.attach))if(d.bool(t.attach)){if(!t.attach)this.options.keepMetadata&=-9}else throw d.invalidParameterError("attach","boolean",t.attach)}return this}function DM(){return this.options.keepGainMap=!0,this.options.withGainMap=!1,this.options.keepMetadata|=32,this}function LM(){return this.options.withGainMap=!0,this.options.keepGainMap=!1,this.options.colourspace="scrgb",this}function FM(){return this.options.keepMetadata|=2,this}function qM(e){if(d.string(e)&&e.length>0)this.options.withXmp=e,this.options.keepMetadata|=2;else throw d.invalidParameterError("xmp","non-empty string",e);return this}function HM(){return this.options.keepMetadata|=31,this}function VM(e){if(this.keepMetadata(),this.withIccProfile("srgb"),d.object(e)){if(d.defined(e.orientation))if(d.integer(e.orientation)&&d.inRange(e.orientation,1,8))this.options.withMetadataOrientation=e.orientation;else throw d.invalidParameterError("orientation","integer between 1 and 8",e.orientation);if(d.defined(e.density))if(d.number(e.density)&&e.density>0)this.options.withMetadataDensity=e.density;else throw d.invalidParameterError("density","positive number",e.density);if(d.defined(e.icc))this.withIccProfile(e.icc);if(d.defined(e.exif))this.withExifMerge(e.exif)}return this}function BM(e,t){let r=T$.get((d.object(e)&&d.string(e.id)?e.id:e).toLowerCase());if(!r)throw d.invalidParameterError("format",`one of: ${[...T$.keys()].join(", ")}`,e);return this[r](t)}function WM(e){if(d.object(e)){if(d.defined(e.quality))if(d.integer(e.quality)&&d.inRange(e.quality,1,100))this.options.jpegQuality=e.quality;else throw d.invalidParameterError("quality","integer between 1 and 100",e.quality);if(d.defined(e.progressive))this._setBooleanOption("jpegProgressive",e.progressive);if(d.defined(e.chromaSubsampling))if(d.string(e.chromaSubsampling)&&d.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jpegChromaSubsampling=e.chromaSubsampling;else throw d.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);let t=d.bool(e.optimizeCoding)?e.optimizeCoding:e.optimiseCoding;if(d.defined(t))this._setBooleanOption("jpegOptimiseCoding",t);if(d.defined(e.mozjpeg))if(d.bool(e.mozjpeg)){if(e.mozjpeg)this.options.jpegTrellisQuantisation=!0,this.options.jpegOvershootDeringing=!0,this.options.jpegOptimiseScans=!0,this.options.jpegProgressive=!0,this.options.jpegQuantisationTable=3}else throw d.invalidParameterError("mozjpeg","boolean",e.mozjpeg);let r=d.bool(e.trellisQuantization)?e.trellisQuantization:e.trellisQuantisation;if(d.defined(r))this._setBooleanOption("jpegTrellisQuantisation",r);if(d.defined(e.overshootDeringing))this._setBooleanOption("jpegOvershootDeringing",e.overshootDeringing);let n=d.bool(e.optimizeScans)?e.optimizeScans:e.optimiseScans;if(d.defined(n)){if(this._setBooleanOption("jpegOptimiseScans",n),n)this.options.jpegProgressive=!0}let s=d.number(e.quantizationTable)?e.quantizationTable:e.quantisationTable;if(d.defined(s))if(d.integer(s)&&d.inRange(s,0,8))this.options.jpegQuantisationTable=s;else throw d.invalidParameterError("quantisationTable","integer between 0 and 8",s)}return this._updateFormatOut("jpeg",e)}function UM(e){if(d.object(e)){if(d.defined(e.progressive))this._setBooleanOption("pngProgressive",e.progressive);if(d.defined(e.compressionLevel))if(d.integer(e.compressionLevel)&&d.inRange(e.compressionLevel,0,9))this.options.pngCompressionLevel=e.compressionLevel;else throw d.invalidParameterError("compressionLevel","integer between 0 and 9",e.compressionLevel);if(d.defined(e.adaptiveFiltering))this._setBooleanOption("pngAdaptiveFiltering",e.adaptiveFiltering);let t=e.colours||e.colors;if(d.defined(t))if(d.integer(t)&&d.inRange(t,2,256))this.options.pngBitdepth=I$(t);else throw d.invalidParameterError("colours","integer between 2 and 256",t);if(d.defined(e.palette))this._setBooleanOption("pngPalette",e.palette);else if([e.quality,e.effort,e.colours,e.colors,e.dither].some(d.defined))this._setBooleanOption("pngPalette",!0);if(this.options.pngPalette){if(d.defined(e.quality))if(d.integer(e.quality)&&d.inRange(e.quality,0,100))this.options.pngQuality=e.quality;else throw d.invalidParameterError("quality","integer between 0 and 100",e.quality);if(d.defined(e.effort))if(d.integer(e.effort)&&d.inRange(e.effort,1,10))this.options.pngEffort=e.effort;else throw d.invalidParameterError("effort","integer between 1 and 10",e.effort);if(d.defined(e.dither))if(d.number(e.dither)&&d.inRange(e.dither,0,1))this.options.pngDither=e.dither;else throw d.invalidParameterError("dither","number between 0.0 and 1.0",e.dither)}}return this._updateFormatOut("png",e)}function zM(e){if(d.object(e)){if(d.defined(e.quality))if(d.integer(e.quality)&&d.inRange(e.quality,1,100))this.options.webpQuality=e.quality;else throw d.invalidParameterError("quality","integer between 1 and 100",e.quality);if(d.defined(e.alphaQuality))if(d.integer(e.alphaQuality)&&d.inRange(e.alphaQuality,0,100))this.options.webpAlphaQuality=e.alphaQuality;else throw d.invalidParameterError("alphaQuality","integer between 0 and 100",e.alphaQuality);if(d.defined(e.lossless))this._setBooleanOption("webpLossless",e.lossless);if(d.defined(e.nearLossless))this._setBooleanOption("webpNearLossless",e.nearLossless);if(d.defined(e.smartSubsample))this._setBooleanOption("webpSmartSubsample",e.smartSubsample);if(d.defined(e.smartDeblock))this._setBooleanOption("webpSmartDeblock",e.smartDeblock);if(d.defined(e.preset))if(d.string(e.preset)&&d.inArray(e.preset,["default","photo","picture","drawing","icon","text"]))this.options.webpPreset=e.preset;else throw d.invalidParameterError("preset","one of: default, photo, picture, drawing, icon, text",e.preset);if(d.defined(e.effort))if(d.integer(e.effort)&&d.inRange(e.effort,0,6))this.options.webpEffort=e.effort;else throw d.invalidParameterError("effort","integer between 0 and 6",e.effort);if(d.defined(e.minSize))this._setBooleanOption("webpMinSize",e.minSize);if(d.defined(e.mixed))this._setBooleanOption("webpMixed",e.mixed);if(d.defined(e.exact))this._setBooleanOption("webpExact",e.exact)}return Cd(e,this.options),this._updateFormatOut("webp",e)}function GM(e){if(d.object(e)){if(d.defined(e.reuse))this._setBooleanOption("gifReuse",e.reuse);if(d.defined(e.progressive))this._setBooleanOption("gifProgressive",e.progressive);let t=e.colours||e.colors;if(d.defined(t))if(d.integer(t)&&d.inRange(t,2,256))this.options.gifBitdepth=I$(t);else throw d.invalidParameterError("colours","integer between 2 and 256",t);if(d.defined(e.effort))if(d.integer(e.effort)&&d.inRange(e.effort,1,10))this.options.gifEffort=e.effort;else throw d.invalidParameterError("effort","integer between 1 and 10",e.effort);if(d.defined(e.dither))if(d.number(e.dither)&&d.inRange(e.dither,0,1))this.options.gifDither=e.dither;else throw d.invalidParameterError("dither","number between 0.0 and 1.0",e.dither);if(d.defined(e.interFrameMaxError))if(d.number(e.interFrameMaxError)&&d.inRange(e.interFrameMaxError,0,32))this.options.gifInterFrameMaxError=e.interFrameMaxError;else throw d.invalidParameterError("interFrameMaxError","number between 0.0 and 32.0",e.interFrameMaxError);if(d.defined(e.interPaletteMaxError))if(d.number(e.interPaletteMaxError)&&d.inRange(e.interPaletteMaxError,0,256))this.options.gifInterPaletteMaxError=e.interPaletteMaxError;else throw d.invalidParameterError("interPaletteMaxError","number between 0.0 and 256.0",e.interPaletteMaxError);if(d.defined(e.keepDuplicateFrames))if(d.bool(e.keepDuplicateFrames))this._setBooleanOption("gifKeepDuplicateFrames",e.keepDuplicateFrames);else throw d.invalidParameterError("keepDuplicateFrames","boolean",e.keepDuplicateFrames)}return Cd(e,this.options),this._updateFormatOut("gif",e)}function KM(e){if(!this.constructor.format.jp2.output.buffer)throw N$();if(d.object(e)){if(d.defined(e.quality))if(d.integer(e.quality)&&d.inRange(e.quality,1,100))this.options.jp2Quality=e.quality;else throw d.invalidParameterError("quality","integer between 1 and 100",e.quality);if(d.defined(e.lossless))if(d.bool(e.lossless))this.options.jp2Lossless=e.lossless;else throw d.invalidParameterError("lossless","boolean",e.lossless);if(d.defined(e.tileWidth))if(d.integer(e.tileWidth)&&d.inRange(e.tileWidth,1,32768))this.options.jp2TileWidth=e.tileWidth;else throw d.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(d.defined(e.tileHeight))if(d.integer(e.tileHeight)&&d.inRange(e.tileHeight,1,32768))this.options.jp2TileHeight=e.tileHeight;else throw d.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(d.defined(e.chromaSubsampling))if(d.string(e.chromaSubsampling)&&d.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.jp2ChromaSubsampling=e.chromaSubsampling;else throw d.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling)}return this._updateFormatOut("jp2",e)}function Cd(e,t){if(d.object(e)&&d.defined(e.loop))if(d.integer(e.loop)&&d.inRange(e.loop,0,65535))t.loop=e.loop;else throw d.invalidParameterError("loop","integer between 0 and 65535",e.loop);if(d.object(e)&&d.defined(e.delay))if(d.integer(e.delay)&&d.inRange(e.delay,0,65535))t.delay=[e.delay];else if(Array.isArray(e.delay)&&d.inRange(e.delay.length,1,1e6)&&e.delay.every(d.integer)&&e.delay.every((r)=>d.inRange(r,0,65535)))t.delay=e.delay;else throw d.invalidParameterError("delay","integer or an array of integers between 0 and 65535",e.delay)}function YM(e){if(d.object(e)){if(d.defined(e.quality))if(d.integer(e.quality)&&d.inRange(e.quality,1,100))this.options.tiffQuality=e.quality;else throw d.invalidParameterError("quality","integer between 1 and 100",e.quality);if(d.defined(e.bitdepth))if(d.integer(e.bitdepth)&&d.inArray(e.bitdepth,[1,2,4]))this.options.tiffBitdepth=e.bitdepth;else throw d.invalidParameterError("bitdepth","1, 2 or 4",e.bitdepth);if(d.defined(e.tile))this._setBooleanOption("tiffTile",e.tile);if(d.defined(e.tileWidth))if(d.integer(e.tileWidth)&&d.inRange(e.tileWidth,1,32768))this.options.tiffTileWidth=e.tileWidth;else throw d.invalidParameterError("tileWidth","integer between 1 and 32768",e.tileWidth);if(d.defined(e.tileHeight))if(d.integer(e.tileHeight)&&d.inRange(e.tileHeight,1,32768))this.options.tiffTileHeight=e.tileHeight;else throw d.invalidParameterError("tileHeight","integer between 1 and 32768",e.tileHeight);if(d.defined(e.miniswhite))this._setBooleanOption("tiffMiniswhite",e.miniswhite);if(d.defined(e.pyramid))this._setBooleanOption("tiffPyramid",e.pyramid);if(d.defined(e.xres))if(d.number(e.xres)&&d.inRange(e.xres,0.001,1e6))this.options.tiffXres=e.xres;else throw d.invalidParameterError("xres","number between 0.001 and 1000000",e.xres);if(d.defined(e.yres))if(d.number(e.yres)&&d.inRange(e.yres,0.001,1e6))this.options.tiffYres=e.yres;else throw d.invalidParameterError("yres","number between 0.001 and 1000000",e.yres);if(d.defined(e.compression))if(d.string(e.compression)&&d.inArray(e.compression,["none","jpeg","deflate","packbits","ccittfax4","lzw","webp","zstd","jp2k"]))this.options.tiffCompression=e.compression;else throw d.invalidParameterError("compression","one of: none, jpeg, deflate, packbits, ccittfax4, lzw, webp, zstd, jp2k",e.compression);if(d.defined(e.bigtiff))this._setBooleanOption("tiffBigtiff",e.bigtiff);if(d.defined(e.predictor))if(d.string(e.predictor)&&d.inArray(e.predictor,["none","horizontal","float"]))this.options.tiffPredictor=e.predictor;else throw d.invalidParameterError("predictor","one of: none, horizontal, float",e.predictor);if(d.defined(e.resolutionUnit))if(d.string(e.resolutionUnit)&&d.inArray(e.resolutionUnit,["inch","cm"]))this.options.tiffResolutionUnit=e.resolutionUnit;else throw d.invalidParameterError("resolutionUnit","one of: inch, cm",e.resolutionUnit)}return this._updateFormatOut("tiff",e)}function XM(e){return this.heif({...e,compression:"av1"})}function ZM(e){if(d.object(e)){if(d.string(e.compression)&&d.inArray(e.compression,["av1","hevc"]))this.options.heifCompression=e.compression;else throw d.invalidParameterError("compression","one of: av1, hevc",e.compression);if(d.defined(e.quality))if(d.integer(e.quality)&&d.inRange(e.quality,1,100))this.options.heifQuality=e.quality;else throw d.invalidParameterError("quality","integer between 1 and 100",e.quality);if(d.defined(e.lossless))if(d.bool(e.lossless))this.options.heifLossless=e.lossless;else throw d.invalidParameterError("lossless","boolean",e.lossless);if(d.defined(e.effort))if(d.integer(e.effort)&&d.inRange(e.effort,0,9))this.options.heifEffort=e.effort;else throw d.invalidParameterError("effort","integer between 0 and 9",e.effort);if(d.defined(e.chromaSubsampling))if(d.string(e.chromaSubsampling)&&d.inArray(e.chromaSubsampling,["4:2:0","4:4:4"]))this.options.heifChromaSubsampling=e.chromaSubsampling;else throw d.invalidParameterError("chromaSubsampling","one of: 4:2:0, 4:4:4",e.chromaSubsampling);if(d.defined(e.bitdepth))if(d.integer(e.bitdepth)&&d.inArray(e.bitdepth,[8,10,12]))this.options.heifBitdepth=e.bitdepth;else throw d.invalidParameterError("bitdepth","8, 10 or 12",e.bitdepth);if(d.defined(e.tune))if(d.string(e.tune)&&d.inArray(e.tune,["auto","iq","psnr","ssim"]))if(this.options.heifLossless&&e.tune==="iq")this.options.heifTune="ssim";else this.options.heifTune=e.tune;else throw d.invalidParameterError("tune","one of: auto, iq, psnr, ssim",e.tune)}else throw d.invalidParameterError("options","Object",e);return this._updateFormatOut("heif",e)}function QM(e){if(d.object(e)){if(d.defined(e.quality))if(d.integer(e.quality)&&d.inRange(e.quality,1,100))this.options.jxlDistance=e.quality>=30?0.1+(100-e.quality)*0.09:0.017666666666666667*e.quality*e.quality-1.15*e.quality+25;else throw d.invalidParameterError("quality","integer between 1 and 100",e.quality);else if(d.defined(e.distance))if(d.number(e.distance)&&d.inRange(e.distance,0,15))this.options.jxlDistance=e.distance;else throw d.invalidParameterError("distance","number between 0.0 and 15.0",e.distance);if(d.defined(e.decodingTier))if(d.integer(e.decodingTier)&&d.inRange(e.decodingTier,0,4))this.options.jxlDecodingTier=e.decodingTier;else throw d.invalidParameterError("decodingTier","integer between 0 and 4",e.decodingTier);if(d.defined(e.lossless))if(d.bool(e.lossless))this.options.jxlLossless=e.lossless;else throw d.invalidParameterError("lossless","boolean",e.lossless);if(d.defined(e.effort))if(d.integer(e.effort)&&d.inRange(e.effort,1,9))this.options.jxlEffort=e.effort;else throw d.invalidParameterError("effort","integer between 1 and 9",e.effort)}return Cd(e,this.options),this._updateFormatOut("jxl",e)}function eJ(e){if(d.object(e)){if(d.defined(e.depth))if(d.string(e.depth)&&d.inArray(e.depth,["char","uchar","short","ushort","int","uint","float","complex","double","dpcomplex"]))this.options.rawDepth=e.depth;else throw d.invalidParameterError("depth","one of: char, uchar, short, ushort, int, uint, float, complex, double, dpcomplex",e.depth)}return this._updateFormatOut("raw")}function tJ(e){if(d.object(e)){if(d.defined(e.size))if(d.integer(e.size)&&d.inRange(e.size,1,8192))this.options.tileSize=e.size;else throw d.invalidParameterError("size","integer between 1 and 8192",e.size);if(d.defined(e.overlap))if(d.integer(e.overlap)&&d.inRange(e.overlap,0,8192)){if(e.overlap>this.options.tileSize)throw d.invalidParameterError("overlap",`<= size (${this.options.tileSize})`,e.overlap);this.options.tileOverlap=e.overlap}else throw d.invalidParameterError("overlap","integer between 0 and 8192",e.overlap);if(d.defined(e.container))if(d.string(e.container)&&d.inArray(e.container,["fs","zip"]))this.options.tileContainer=e.container;else throw d.invalidParameterError("container","one of: fs, zip",e.container);if(d.defined(e.layout))if(d.string(e.layout)&&d.inArray(e.layout,["dz","google","iiif","iiif3","zoomify"]))this.options.tileLayout=e.layout;else throw d.invalidParameterError("layout","one of: dz, google, iiif, iiif3, zoomify",e.layout);if(d.defined(e.angle))if(d.integer(e.angle)&&!(e.angle%90))this.options.tileAngle=e.angle;else throw d.invalidParameterError("angle","positive/negative multiple of 90",e.angle);if(this._setBackgroundColourOption("tileBackground",e.background),d.defined(e.depth))if(d.string(e.depth)&&d.inArray(e.depth,["onepixel","onetile","one"]))this.options.tileDepth=e.depth;else throw d.invalidParameterError("depth","one of: onepixel, onetile, one",e.depth);if(d.defined(e.skipBlanks))if(d.integer(e.skipBlanks)&&d.inRange(e.skipBlanks,-1,65535))this.options.tileSkipBlanks=e.skipBlanks;else throw d.invalidParameterError("skipBlanks","integer between -1 and 255/65535",e.skipBlanks);else if(d.defined(e.layout)&&e.layout==="google")this.options.tileSkipBlanks=5;let t=d.bool(e.center)?e.center:e.centre;if(d.defined(t))this._setBooleanOption("tileCentre",t);if(d.defined(e.id))if(d.string(e.id))this.options.tileId=e.id;else throw d.invalidParameterError("id","string",e.id);if(d.defined(e.basename))if(d.string(e.basename))this.options.tileBasename=e.basename;else throw d.invalidParameterError("basename","string",e.basename)}if(d.inArray(this.options.formatOut,["jpeg","png","webp"]))this.options.tileFormat=this.options.formatOut;else if(this.options.formatOut!=="input")throw d.invalidParameterError("format","one of: jpeg, png, webp",this.options.formatOut);return this._updateFormatOut("dz")}function rJ(e){if(!d.plainObject(e))throw d.invalidParameterError("options","object",e);if(d.integer(e.seconds)&&d.inRange(e.seconds,0,3600))this.options.timeoutSeconds=e.seconds;else throw d.invalidParameterError("seconds","integer between 0 and 3600",e.seconds);return this}function nJ(e,t){if(!(d.object(t)&&t.force===!1))this.options.formatOut=e;return this}function sJ(e,t){if(d.bool(t))this.options[e]=t;else throw d.invalidParameterError(e,"boolean",t)}function iJ(){if(!this.options.streamOut){this.options.streamOut=!0;let e=Error();this._pipeline(void 0,e)}}function oJ(e,t){if(typeof e==="function"){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)e(d.nativeError(r,t));else e(null,n,s)})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)e(d.nativeError(r,t));else e(null,n,s)});return this}else if(this.options.streamOut){if(this._isStreamInput())this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",d.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))})});else Oe.pipeline(this.options,(r,n,s)=>{if(r)this.emit("error",d.nativeError(r,t));else this.emit("info",s),this.push(n);this.push(null),this.on("end",()=>this.emit("close"))});return this}else if(this._isStreamInput())return new Promise((r,n)=>{this._whenStreamInFinished(()=>{this._flattenBufferIn(),Oe.pipeline(this.options,(s,i,o)=>{if(s)n(d.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})});else return new Promise((r,n)=>{Oe.pipeline(this.options,(s,i,o)=>{if(s)n(d.nativeError(s,t));else if(this.options.resolveWithObject)r({data:i,info:o});else r(i)})})}var T$,kM,N$=()=>Error("JP2 output requires libvips with support for OpenJPEG"),I$=(e)=>1<<32-Math.clz32(Math.ceil(Math.log2(e))-1),M$=(e)=>{Object.assign(e.prototype,{toFile:RM,toBuffer:AM,toUint8Array:OM,withDensity:CM,keepExif:TM,withExif:NM,withExifMerge:IM,keepIccProfile:MM,withIccProfile:JM,keepGainMap:DM,withGainMap:LM,keepXmp:FM,withXmp:qM,keepMetadata:HM,withMetadata:VM,toFormat:BM,jpeg:WM,jp2:KM,png:UM,webp:zM,tiff:YM,avif:XM,heif:ZM,jxl:QM,gif:GM,raw:eJ,tile:tJ,timeout:rJ,_updateFormatOut:nJ,_setBooleanOption:sJ,_read:iJ,_pipeline:oJ})};var J$=q(()=>{Dr();xo();/*!
360
360
  Copyright 2013 Lovell Fuller and others.
361
361
  SPDX-License-Identifier: Apache-2.0
362
- */S$=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),hM=/\.(jp[2x]|j2[kc])$/i});import GM from"node:events";import{createRequire as KM}from"node:module";import{availableParallelism as YM}from"node:os";function R$(e){if(u.bool(e))if(e)return Oe.cache(50,20,100);else return Oe.cache(0,0,0);else if(u.object(e)){for(let t of["memory","files","items"]){let r=e[t];if(u.defined(r)&&!(u.integer(r)&&r>=0))throw u.invalidParameterError(t,"a positive integer",r)}return Oe.cache(e.memory,e.files,e.items)}else return Oe.cache()}function ZM(e){return Oe.concurrency(u.integer(e)?e:null)}function eJ(){return Oe.counters()}function tJ(e){return Oe.simd(u.bool(e)?e:null)}function rJ(e){if(u.object(e))if(Array.isArray(e.operation)&&e.operation.every(u.string))Oe.block(e.operation,!0);else throw u.invalidParameterError("operation","Array<string>",e.operation);else throw u.invalidParameterError("options","object",e)}function nJ(e){if(u.object(e))if(Array.isArray(e.operation)&&e.operation.every(u.string))Oe.block(e.operation,!1);else throw u.invalidParameterError("operation","Array<string>",e.operation);else throw u.invalidParameterError("options","object",e)}var xo,Pd,k$,jd,qn,XM,pi,QM,A$=(e)=>{e.cache=R$,e.concurrency=ZM,e.counters=eJ,e.simd=tJ,e.format=qn,e.interpolators=XM,e.versions=pi,e.queue=QM,e.block=rJ,e.unblock=nJ};var O$=q(()=>{Dr();md();bo();yl();xo=Lt(nl(),1);/*!
362
+ */T$=new Map([["heic","heif"],["heif","heif"],["avif","avif"],["jpeg","jpeg"],["jpg","jpeg"],["jpe","jpeg"],["tile","tile"],["dz","tile"],["png","png"],["raw","raw"],["tiff","tiff"],["tif","tiff"],["webp","webp"],["gif","gif"],["jp2","jp2"],["jpx","jp2"],["j2k","jp2"],["j2c","jp2"],["jxl","jxl"]]),kM=/\.(jp[2x]|j2[kc])$/i});import aJ from"node:events";import{createRequire as lJ}from"node:module";import{availableParallelism as cJ}from"node:os";function L$(e){if(d.bool(e))if(e)return Oe.cache(50,20,100);else return Oe.cache(0,0,0);else if(d.object(e)){for(let t of["memory","files","items"]){let r=e[t];if(d.defined(r)&&!(d.integer(r)&&r>=0))throw d.invalidParameterError(t,"a positive integer",r)}return Oe.cache(e.memory,e.files,e.items)}else return Oe.cache()}function dJ(e){return Oe.concurrency(d.integer(e)?e:null)}function pJ(){return Oe.counters()}function mJ(e){return Oe.simd(d.bool(e)?e:null)}function hJ(e){if(d.object(e))if(Array.isArray(e.operation)&&e.operation.every(d.string))Oe.block(e.operation,!0);else throw d.invalidParameterError("operation","Array<string>",e.operation);else throw d.invalidParameterError("options","object",e)}function gJ(e){if(d.object(e))if(Array.isArray(e.operation)&&e.operation.every(d.string))Oe.block(e.operation,!1);else throw d.invalidParameterError("operation","Array<string>",e.operation);else throw d.invalidParameterError("options","object",e)}var $o,Td,D$,Nd,qn,uJ,mi,fJ,F$=(e)=>{e.cache=L$,e.concurrency=dJ,e.counters=pJ,e.simd=mJ,e.format=qn,e.interpolators=uJ,e.versions=mi,e.queue=fJ,e.block=hJ,e.unblock=gJ};var q$=q(()=>{Dr();vd();xo();$l();$o=Lt(ol(),1);/*!
363
363
  Copyright 2013 Lovell Fuller and others.
364
364
  SPDX-License-Identifier: Apache-2.0
365
- */Pd=KM(import.meta.url),k$=bl.runtimePlatformArch(),jd=Oe.libvipsVersion(),qn=Oe.format();qn.heif.output.alias=["avif","heic"];qn.jpeg.output.alias=["jpe","jpg"];qn.tiff.output.alias=["tif"];qn.jp2.output.alias=["j2c","j2k","jp2","jpx"];XM={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},pi={vips:jd.semver};if(!jd.isGlobal)if(!jd.isWasm)try{pi=Pd(`@img/sharp-${k$}/versions`)}catch(e){try{pi=Pd(`@img/sharp-libvips-${k$}/versions`)}catch(t){}}else try{pi=Pd("@img/sharp-wasm32/versions")}catch(e){}pi.sharp=gn.version;if(pi.heif&&qn.heif)qn.heif.input.fileSuffix=[".avif"],qn.heif.output.alias=["avif"];R$(!0);if(!process.env.MALLOC_ARENA_MAX&&xo.default.familySync()===xo.default.GLIBC&&!Oe._isUsingJemalloc())Oe.concurrency(1);else if(xo.default.familySync()===xo.default.MUSL&&Oe.concurrency()===1024)Oe.concurrency(YM());QM=new GM.EventEmitter});var sJ;var C$=q(()=>{zx();Yx();r$();s$();a$();$$();w$();j$();O$();/*!
365
+ */Td=lJ(import.meta.url),D$=vl.runtimePlatformArch(),Nd=Oe.libvipsVersion(),qn=Oe.format();qn.heif.output.alias=["avif","heic"];qn.jpeg.output.alias=["jpe","jpg"];qn.tiff.output.alias=["tif"];qn.jp2.output.alias=["j2c","j2k","jp2","jpx"];uJ={nearest:"nearest",bilinear:"bilinear",bicubic:"bicubic",locallyBoundedBicubic:"lbb",nohalo:"nohalo",vertexSplitQuadraticBasisSpline:"vsqbs"},mi={vips:Nd.semver};if(!Nd.isGlobal)if(!Nd.isWasm)try{mi=Td(`@img/sharp-${D$}/versions`)}catch(e){try{mi=Td(`@img/sharp-libvips-${D$}/versions`)}catch(t){}}else try{mi=Td("@img/sharp-wasm32/versions")}catch(e){}mi.sharp=gn.version;if(mi.heif&&qn.heif)qn.heif.input.fileSuffix=[".avif"],qn.heif.output.alias=["avif"];L$(!0);if(!process.env.MALLOC_ARENA_MAX&&$o.default.familySync()===$o.default.GLIBC&&!Oe._isUsingJemalloc())Oe.concurrency(1);else if($o.default.familySync()===$o.default.MUSL&&Oe.concurrency()===1024)Oe.concurrency(cJ());fJ=new aJ.EventEmitter});var yJ;var H$=q(()=>{n$();o$();f$();m$();y$();A$();C$();J$();q$();/*!
366
366
  Copyright 2013 Lovell Fuller and others.
367
367
  SPDX-License-Identifier: Apache-2.0
368
- */Kx(Vr);t$(Vr);n$(Vr);o$(Vr);x$(Vr);v$(Vr);P$(Vr);A$(Vr);sJ=Vr});import{createHash as N$}from"node:crypto";import{existsSync as iJ,mkdirSync as oJ,readFileSync as aJ}from"node:fs";import{basename as lJ,extname as cJ,resolve as kd}from"node:path";import{createRequire as uJ}from"node:module";async function T$(){if(mi)return mi;try{let e=await Promise.resolve().then(() => (C$(),{}));return mi=sJ,mi}catch{}try{return mi=uJ(kd(process.cwd(),"package.json"))("sharp"),mi}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${Ee(e)}`,{cause:e})}}async function Rd(e){let r=await(await T$())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function $o(e){let t=aJ(e);return N$("md5").update(t).digest("hex").slice(0,8)}function Ad(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:fJ,widths:e.widths});return N$("md5").update(t).digest("hex").slice(0,8)}function pJ(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function I$(e,t,r){let n=await T$(),s=await Rd(e),i=$o(e),o=lJ(e,cJ(e)),a=kd(t,"_optimized");oJ(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,d=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!d.includes(s.width))d.push(s.width);if(d.length===0)d.push(s.width);d.sort((m,b)=>m-b);let p=[];for(let m of d)for(let b of r.formats){let g=pJ(o,m,i,b),y=`/${dJ}/${g}`,v=kd(a,g);if(l.push({absolutePath:v,format:b,outputPath:y,width:m}),iJ(v))continue;let j=r.quality[b]??80,S=n(e).resize(m).toFormat(b,{quality:j}).toFile(v).then(()=>{});p.push(S)}let h=4;for(let m=0;m<p.length;m+=h)await Promise.all(p.slice(m,m+h));return{contentHash:i,original:{format:s.format,height:s.height,width:s.width},variants:l}}function M$(e,t){return e.flatMap((r)=>r.format===t?[`${r.outputPath} ${r.width}w`]:[]).join(", ")}var mi=null,dJ="images/_optimized",fJ=2;var Od=q(()=>{rr()});import{existsSync as mJ,mkdirSync as hJ,readFileSync as gJ,rmSync as yJ,writeFileSync as bJ}from"node:fs";import{basename as xJ,resolve as Sl}from"node:path";import{execSync as $J}from"node:child_process";import{tmpdir as vJ}from"node:os";function SJ(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=$J("npm config get cache",{cwd:vJ(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:wJ}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function hi(e){if(wl===void 0)wl=SJ();if(wl)return Sl(wl,"jxsuite-images",xJ(e));return Sl(e,".cache/images")}function J$(e){let t=Sl(hi(e),"manifest.json");if(!mJ(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(gJ(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function D$(e,t,r={}){if(r.prune&&t.touched)EJ(t,t.touched);let n=hi(e);hJ(n,{recursive:!0}),bJ(Sl(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function EJ(e,t){let r=new Set,n=Object.entries(e.entries);for(let[s,i]of n)if(t.has(s))for(let o of i.manifest.variants??[])r.add(o.absolutePath);for(let[s,i]of n){if(t.has(s))continue;for(let o of i.manifest.variants??[])if(!r.has(o.absolutePath))yJ(o.absolutePath,{force:!0});delete e.entries[s]}}function L$(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function F$(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var wl,wJ=3000;var Cd=q(()=>{Od()});function Nd(e,t){if(!t||q$(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return q$(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var q$=(e)=>e!==void 0&&e!==null&&e!=="";import{existsSync as z$}from"node:fs";import{basename as _J,extname as G$,resolve as H$}from"node:path";async function jJ(e,t){let r=t.get(e);if(!r){let n=$o(e);try{let s=await Rd(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!V$)V$=!0,console.warn(`Could not read image dimensions (${Ee(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function B$(e,t,r,n){let s=t.quality.webp??80,i=e.startsWith("/")?"":"/",o=n?`?v=${n}`:"";return t.widths.filter((a)=>a<=r).toSorted((a,l)=>a-l).map((a)=>`/cdn-cgi/image/width=${a},quality=${s},fit=scale-down,format=auto${i}${e}${o} ${a}w`).join(", ")}async function kJ(e,t,r,n,s){let i=`${$o(e)}:${Ad(r)}`,o=L$(s,i);if(o){if(o.variants.every((c)=>z$(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${_J(e)}...`);let a=await I$(e,hi(n),r);return F$(s,i,t,a),a}function RJ(e){if(!e)return!0;if(e.includes("${"))return!0;if(PJ.some((t)=>e.startsWith(t)))return!0;if(K$.has(G$(e).toLowerCase()))return!0;return!1}function AJ(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let r=new URL(e);if(K$.has(G$(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function OJ(e,t,r){let n=r?.length?fa(r,e):null;if(n)return n;if(e.startsWith("/"))return H$(t,"public",e.slice(1));return H$(t,e)}async function Y$(e,t,r,n,s,i=[]){let o=new Map;return await X$(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function X$(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await JJ(e,t,r,n,s,i,o,a))return}if(T(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await HJ(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=Q$(e,a);for(let c of e.children){if(!Ft(c))continue;await X$(c,t,r,n,s,i,o,l)}}}async function Z$(e,t,r,n,s,i,o,a){if(!T(e)||t)return null;let l=AJ(e,r);if(!l&&RJ(e))return null;if(l)return{dims:null,sources:[],srcset:B$(e,r,1/0,null)};let c=OJ(e,n,a);if(!z$(c))return null;if(r.service==="cloudflare"){let g=await jJ(c,i),y=B$(e,r,g.width??1/0,g.hash);return{dims:g.width&&g.height?{height:g.height,width:g.width}:null,sources:[],srcset:y}}let d=o.get(c);if(!d)d=await kJ(c,e,r,n,s),o.set(c,d);let h=[...W$.filter((g)=>r.formats.includes(g)),...r.formats.filter((g)=>!W$.includes(g))].flatMap((g)=>{let y=M$(d.variants,g);return y===""?[]:[{srcset:y,type:CJ.get(g)??`image/${g}`}]}),m=d.original?.width&&d.original.height?{height:d.original.height,width:d.original.width}:null,b=r.picture!==!1&&h.length>1;return{dims:m,fallbackSrc:TJ(d.variants,r.formats),sources:b?h:[],srcset:h[0]?.srcset??""}}function TJ(e,t){let r=NJ.find((s)=>t.includes(s));if(r===void 0)return;let n;for(let s of e)if(s.format===r&&(n===void 0||s.width>n.width))n=s;return n?.outputPath}function U$(e){if(!T(e))return null;let t=IJ.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function Q$(e,t){let{style:r}=e;if(!F(r))return t;let n=U$(r.maxWidth)??U$(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function MJ(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function JJ(e,t,r,n,s,i,o,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;if(l.src===void 0&&T(e.src))l.src=e.src,delete e.src;let c=t.optimize?await Z$(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,d=Q$(e,a),p=l.sizes??MJ(d)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,l.sizes=p,c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,Nd(l,t.lazyLoad)),c&&c.sources.length>0)return DJ(e,c.sources,p),!0;return!1}function DJ(e,t,r){let n={...e.attributes},s=n.sizes??r;delete n.srcset,delete n.sizes;let i={attributes:n,tagName:"img"};if(e.style!==void 0)i.style=e.style,delete e.style;let o=t.map((a)=>{let l={};if(s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});o.push(i),e.tagName="picture",e.attributes={},e.children=o}async function HJ(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(LJ)){let d=c[0],p=c[1],h=(vo(p,"src")??"").replaceAll("&amp;","&"),m=FJ.test(p),b=t.optimize&&h!==""&&!m?await Z$(h,qJ.test(p),t,r,n,s,i,o):null,g="";if(b&&b.srcset!=="")g+=` srcset="${b.srcset}" sizes="${t.sizes}"`;if(b?.dims&&!/\bwidth=/.test(p)&&!/\bheight=/.test(p))g+=` width="${b.dims.width}" height="${b.dims.height}"`;let y=Nd({decoding:vo(p,"decoding"),fetchpriority:vo(p,"fetchpriority"),loading:vo(p,"loading")},t.lazyLoad);for(let[j,S]of Object.entries(y))g+=` ${j}="${S}"`;if(g==="")continue;let v=b&&b.sources.length>0?VJ(p,b.sources,t.sizes,g):`<img${p}${g}>`;a.push({match:d,replacement:v})}let l=e;for(let{match:c,replacement:d}of a)l=l.replace(c,d);return l}function VJ(e,t,r,n){let s=vo(e,"sizes")??r,i=n.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${i}></picture>`}function vo(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var K$,PJ,V$=!1,W$,CJ,NJ,IJ,LJ,FJ,qJ;var ev=q(()=>{Od();Cd();nr();ve();rr();K$=new Set([".svg",".gif"]),PJ=["http://","https://","data:","//"];W$=["avif","webp","jpeg","png"],CJ=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);NJ=["jpeg","png"];IJ=/^(\d+(?:\.\d+)?)(px|rem)$/;LJ=/<img\b([^>]*)>/gi,FJ=/\bsrcset="/,qJ=/\bdata-no-optimize\b/});import{createHash as BJ}from"node:crypto";import{existsSync as WJ}from"node:fs";import{join as tv}from"node:path";function zJ(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?tv(t,r,"index.html"):tv(t,r)}function Id(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function GJ(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return BJ("sha256").update(t,"utf8").digest("hex").slice(0,8)}function rv(e,t,r=""){let n=[],s=[],i=[...e.precache??[]],o=e.offlineFallback;if(o!==void 0&&!i.includes(o))i.push(o),n.push(`serviceWorker: "${o}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let h of i)if(!h.startsWith("/"))s.push(`serviceWorker.precache: "${h}" must be a site-absolute URL starting with /.`);else if(!WJ(zJ(h,t)))s.push(`serviceWorker.precache: "${h}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=i.map((h)=>Ie(r,h)),l=Ie(r,UJ),c=o===void 0?null:Ie(r,o),d=`jx-${GJ(e)}`,p=`/*
368
+ */i$(Vr);d$(Vr);p$(Vr);g$(Vr);R$(Vr);O$(Vr);M$(Vr);F$(Vr);yJ=Vr});import{createHash as V$}from"node:crypto";import{existsSync as bJ,mkdirSync as xJ,readFileSync as $J}from"node:fs";import{basename as vJ,extname as wJ,resolve as Id}from"node:path";import{createRequire as SJ}from"node:module";async function B$(){if(hi)return hi;try{let e=await Promise.resolve().then(() => (H$(),{}));return hi=yJ,hi}catch{}try{return hi=SJ(Id(process.cwd(),"package.json"))("sharp"),hi}catch(e){throw Error(`Sharp is required for image optimization but failed to load: ${we(e)}`,{cause:e})}}async function Md(e){let r=await(await B$())(e).metadata();return{format:r.format??"unknown",height:r.height??0,width:r.width??0}}function vo(e){let t=$J(e);return V$("md5").update(t).digest("hex").slice(0,8)}function Jd(e){let t=JSON.stringify({formats:e.formats,quality:e.quality,v:_J,widths:e.widths});return V$("md5").update(t).digest("hex").slice(0,8)}function PJ(e,t,r,n){return`${e}-${t}-${r}.${n}`}async function W$(e,t,r){let n=await B$(),s=await Md(e),i=vo(e),o=vJ(e,wJ(e)),a=Id(t,"_optimized");xJ(a,{recursive:!0});let l=[],c=r.widths.length>0?Math.max(...r.widths):s.width,u=r.widths.filter((m)=>m<=s.width);if(s.width<c&&!u.includes(s.width))u.push(s.width);if(u.length===0)u.push(s.width);u.sort((m,b)=>m-b);let p=[];for(let m of u)for(let b of r.formats){let h=PJ(o,m,i,b),y=`/${EJ}/${h}`,v=Id(a,h);if(l.push({absolutePath:v,format:b,outputPath:y,width:m}),bJ(v))continue;let j=r.quality[b]??80,S=n(e).resize(m).toFormat(b,{quality:j}).toFile(v).then(()=>{});p.push(S)}let g=4;for(let m=0;m<p.length;m+=g)await Promise.all(p.slice(m,m+g));return{contentHash:i,original:{format:s.format,height:s.height,width:s.width},variants:l}}function U$(e,t){return e.flatMap((r)=>r.format===t?[`${r.outputPath} ${r.width}w`]:[]).join(", ")}var hi=null,EJ="images/_optimized",_J=2;var Dd=q(()=>{nr()});import{existsSync as jJ,mkdirSync as kJ,readFileSync as RJ,rmSync as AJ,writeFileSync as OJ}from"node:fs";import{basename as CJ,resolve as Pl}from"node:path";import{execSync as TJ}from"node:child_process";import{tmpdir as NJ}from"node:os";function MJ(){let e=process.env.npm_config_cache??process.env.NPM_CONFIG_CACHE;if(e)return e;try{let t=TJ("npm config get cache",{cwd:NJ(),encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:IJ}).trim();return t&&t!=="undefined"?t:null}catch{return null}}function gi(e){if(_l===void 0)_l=MJ();if(_l)return Pl(_l,"jxsuite-images",CJ(e));return Pl(e,".cache/images")}function z$(e){let t=Pl(gi(e),"manifest.json");if(!jJ(t))return{entries:{},touched:new Set,version:1};try{let r=JSON.parse(RJ(t,"utf8"));return r.touched=new Set,r}catch{return{entries:{},touched:new Set,version:1}}}function G$(e,t,r={}){if(r.prune&&t.touched)JJ(t,t.touched);let n=gi(e);kJ(n,{recursive:!0}),OJ(Pl(n,"manifest.json"),JSON.stringify({entries:t.entries,version:t.version},null,2),"utf8")}function JJ(e,t){let r=new Set,n=Object.entries(e.entries);for(let[s,i]of n)if(t.has(s))for(let o of i.manifest.variants??[])r.add(o.absolutePath);for(let[s,i]of n){if(t.has(s))continue;for(let o of i.manifest.variants??[])if(!r.has(o.absolutePath))AJ(o.absolutePath,{force:!0});delete e.entries[s]}}function K$(e,t){e.touched?.add(t);let r=e.entries[t];if(!r)return null;return r.manifest}function Y$(e,t,r,n){e.touched?.add(t),e.entries[t]={manifest:n,source:r,timestamp:Date.now()}}var _l,IJ=3000;var Ld=q(()=>{Dd()});function Fd(e,t){if(!t||X$(e.loading))return{};if(String(e.fetchpriority??"").toLowerCase()==="high")return{};return X$(e.decoding)?{loading:"lazy"}:{decoding:"async",loading:"lazy"}}var X$=(e)=>e!==void 0&&e!==null&&e!=="";import{existsSync as nv}from"node:fs";import{basename as DJ,extname as sv,resolve as Z$}from"node:path";async function FJ(e,t){let r=t.get(e);if(!r){let n=vo(e);try{let s=await Md(e);r={width:s.width,height:s.height,hash:n}}catch(s){if(!Q$)Q$=!0,console.warn(`Could not read image dimensions (${we(s)}) — `+"emitting srcsets without width/height attributes.");r={width:null,height:null,hash:n}}t.set(e,r)}return r}function ev(e,t,r,n){let s=t.quality.webp??80,i=e.startsWith("/")?"":"/",o=n?`?v=${n}`:"";return t.widths.filter((a)=>a<=r).toSorted((a,l)=>a-l).map((a)=>`/cdn-cgi/image/width=${a},quality=${s},fit=scale-down,format=auto${i}${e}${o} ${a}w`).join(", ")}async function qJ(e,t,r,n,s){let i=`${vo(e)}:${Jd(r)}`,o=K$(s,i);if(o){if(o.variants.every((c)=>nv(c.absolutePath)))return o}if(!o)console.log(` Optimizing ${DJ(e)}...`);let a=await W$(e,gi(n),r);return Y$(s,i,t,a),a}function HJ(e){if(!e)return!0;if(e.includes("${"))return!0;if(LJ.some((t)=>e.startsWith(t)))return!0;if(iv.has(sv(e).toLowerCase()))return!0;return!1}function VJ(e,t){if(t.service!=="cloudflare")return!1;if(!t.remoteDomains?.length)return!1;if(!e.startsWith("https://"))return!1;if(e.includes("${"))return!1;try{let r=new URL(e);if(iv.has(sv(r.pathname).toLowerCase()))return!1;return t.remoteDomains.includes(r.hostname)}catch{return!1}}function BJ(e,t,r){let n=r?.length?pa(r,e):null;if(n)return n;if(e.startsWith("/"))return Z$(t,"public",e.slice(1));return Z$(t,e)}async function ov(e,t,r,n,s,i=[]){let o=new Map;return await av(e,t,r,n,s??new Map,o,i),{imageRefs:o}}async function av(e,t,r,n,s,i,o,a=null){if(e.tagName==="img"){if(await YJ(e,t,r,n,s,i,o,a))return}if(N(e.innerHTML)&&e.innerHTML.includes("<img"))e.innerHTML=await tD(e.innerHTML,t,r,n,s,i,o);if(Array.isArray(e.children)){let l=cv(e,a);for(let c of e.children){if(!qt(c))continue;await av(c,t,r,n,s,i,o,l)}}}async function lv(e,t,r,n,s,i,o,a){if(!N(e)||t)return null;let l=VJ(e,r);if(!l&&HJ(e))return null;if(l)return{dims:null,sources:[],srcset:ev(e,r,1/0,null)};let c=BJ(e,n,a);if(!nv(c))return null;if(r.service==="cloudflare"){let h=await FJ(c,i),y=ev(e,r,h.width??1/0,h.hash);return{dims:h.width&&h.height?{height:h.height,width:h.width}:null,sources:[],srcset:y}}let u=o.get(c);if(!u)u=await qJ(c,e,r,n,s),o.set(c,u);let g=[...tv.filter((h)=>r.formats.includes(h)),...r.formats.filter((h)=>!tv.includes(h))].flatMap((h)=>{let y=U$(u.variants,h);return y===""?[]:[{srcset:y,type:WJ.get(h)??`image/${h}`}]}),m=u.original?.width&&u.original.height?{height:u.original.height,width:u.original.width}:null,b=r.picture!==!1&&g.length>1;return{dims:m,fallbackSrc:zJ(u.variants,r.formats),sources:b?g:[],srcset:g[0]?.srcset??""}}function zJ(e,t){let r=UJ.find((s)=>t.includes(s));if(r===void 0)return;let n;for(let s of e)if(s.format===r&&(n===void 0||s.width>n.width))n=s;return n?.outputPath}function rv(e){if(!N(e))return null;let t=GJ.exec(e.trim());if(!t)return null;let r=Number(t[1]);return t[2]==="rem"?r*16:r}function cv(e,t){let{style:r}=e;if(!F(r))return t;let n=rv(r.maxWidth)??rv(r.width);if(n===null)return t;return t===null?n:Math.min(t,n)}function KJ(e){if(e===null)return;let t=Math.round(e);return`(max-width: ${t}px) 100vw, ${t}px`}async function YJ(e,t,r,n,s,i,o,a=null){if(!e.attributes)e.attributes={};let l=e.attributes;if(l.src===void 0&&N(e.src))l.src=e.src,delete e.src;let c=t.optimize?await lv(l.src,l["data-no-optimize"]!==void 0,t,r,n,s,i,o):null,u=cv(e,a),p=l.sizes??KJ(u)??t.sizes;if(c){if(c.srcset!==""){if(l.srcset=c.srcset,l.sizes=p,c.fallbackSrc!==void 0)l.src=c.fallbackSrc}if(c.dims&&l.width===void 0&&l.height===void 0)l.width=String(c.dims.width),l.height=String(c.dims.height)}if(Object.assign(l,Fd(l,t.lazyLoad)),c&&c.sources.length>0)return XJ(e,c.sources,p),!0;return!1}function XJ(e,t,r){let n={...e.attributes},s=n.sizes??r;delete n.srcset,delete n.sizes;let i={attributes:n,tagName:"img"};if(e.style!==void 0)i.style=e.style,delete e.style;let o=t.map((a)=>{let l={};if(s!=="")l.sizes=s;return l.srcset=a.srcset,l.type=a.type,{attributes:l,tagName:"source"}});o.push(i),e.tagName="picture",e.attributes={},e.children=o}async function tD(e,t,r,n,s,i,o){let a=[];for(let c of e.matchAll(ZJ)){let u=c[0],p=c[1],g=(wo(p,"src")??"").replaceAll("&amp;","&"),m=QJ.test(p),b=t.optimize&&g!==""&&!m?await lv(g,eD.test(p),t,r,n,s,i,o):null,h="";if(b&&b.srcset!=="")h+=` srcset="${b.srcset}" sizes="${t.sizes}"`;if(b?.dims&&!/\bwidth=/.test(p)&&!/\bheight=/.test(p))h+=` width="${b.dims.width}" height="${b.dims.height}"`;let y=Fd({decoding:wo(p,"decoding"),fetchpriority:wo(p,"fetchpriority"),loading:wo(p,"loading")},t.lazyLoad);for(let[j,S]of Object.entries(y))h+=` ${j}="${S}"`;if(h==="")continue;let v=b&&b.sources.length>0?rD(p,b.sources,t.sizes,h):`<img${p}${h}>`;a.push({match:u,replacement:v})}let l=e;for(let{match:c,replacement:u}of a)l=l.replace(c,u);return l}function rD(e,t,r,n){let s=wo(e,"sizes")??r,i=n.replace(/ srcset="[^"]*"/,"").replace(/ sizes="[^"]*"/,"");return`<picture>${t.map((a)=>`<source type="${a.type}" srcset="${a.srcset}" sizes="${s}">`).join("")}<img${e}${i}></picture>`}function wo(e,t){return new RegExp(`\\b${t}="([^"]*)"`,"i").exec(e)?.[1]}var iv,LJ,Q$=!1,tv,WJ,UJ,GJ,ZJ,QJ,eD;var uv=q(()=>{Dd();Ld();sr();$e();nr();iv=new Set([".svg",".gif"]),LJ=["http://","https://","data:","//"];tv=["avif","webp","jpeg","png"],WJ=new Map([["avif","image/avif"],["jpeg","image/jpeg"],["png","image/png"],["webp","image/webp"]]);UJ=["jpeg","png"];GJ=/^(\d+(?:\.\d+)?)(px|rem)$/;ZJ=/<img\b([^>]*)>/gi,QJ=/\bsrcset="/,eD=/\bdata-no-optimize\b/});import{createHash as nD}from"node:crypto";import{existsSync as sD}from"node:fs";import{join as dv}from"node:path";function oD(e,t){let r=e.replace(/^\//,"");return e.endsWith("/")||r===""?dv(t,r,"index.html"):dv(t,r)}function Hd(e){if(e===void 0)return null;if(e===!1)return!1;if(e===!0)return{};return e.enabled===!1?!1:e}function aD(e){let t=JSON.stringify({fallback:e.offlineFallback??null,precache:[...e.precache??[]].toSorted(),scope:e.scope??"/"});return nD("sha256").update(t,"utf8").digest("hex").slice(0,8)}function fv(e,t,r=""){let n=[],s=[],i=[...e.precache??[]],o=e.offlineFallback;if(o!==void 0&&!i.includes(o))i.push(o),n.push(`serviceWorker: "${o}" is the offline fallback but was not in \`precache\` — `+"added, since a page that was never cached cannot be served offline.");if(t!==void 0){for(let g of i)if(!g.startsWith("/"))s.push(`serviceWorker.precache: "${g}" must be a site-absolute URL starting with /.`);else if(!sD(oD(g,t)))s.push(`serviceWorker.precache: "${g}" is not a file this build produced — `+"`cache.addAll()` is all-or-nothing, so one bad entry stops the worker installing.")}let a=i.map((g)=>Ie(r,g)),l=Ie(r,iD),c=o===void 0?null:Ie(r,o),u=`jx-${aD(e)}`,p=`/*
369
369
  * Generated by @jxsuite/compiler — configure via \`serviceWorker\` in project.json.
370
370
  * Set \`"serviceWorker": false\` to replace this with a worker that removes itself.
371
371
  */
372
- const CACHE = ${JSON.stringify(d)};
372
+ const CACHE = ${JSON.stringify(u)};
373
373
  const PRECACHE = ${JSON.stringify(a)};
374
374
  const CACHE_FIRST = ${JSON.stringify(l)};
375
375
  const OFFLINE_FALLBACK = ${JSON.stringify(c)};
@@ -455,7 +455,7 @@ self.addEventListener("fetch", (event) => {
455
455
  })(),
456
456
  );
457
457
  });
458
- `;return{errors:s,path:Td,source:p,warnings:n}}function nv(){return{errors:[],path:Td,source:`/*
458
+ `;return{errors:s,path:qd,source:p,warnings:n}}function pv(){return{errors:[],path:qd,source:`/*
459
459
  * Generated by @jxsuite/compiler. This site had a service worker and no longer does.
460
460
  *
461
461
  * A worker is sticky: removing the file would leave every previous visitor running the old one
@@ -478,95 +478,95 @@ self.addEventListener("activate", (event) => {
478
478
  })(),
479
479
  );
480
480
  });
481
- `,warnings:[]}}function sv(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Ie(t,`/${Td}`)}',{scope:${JSON.stringify(Ie(t,e))}}).catch(function(){})})}`}var Td="sw.js",UJ="/images/_optimized/";var iv=q(()=>{nr()});import{mkdirSync as KJ,writeFileSync as YJ}from"node:fs";import{dirname as XJ,join as ZJ}from"node:path";function Hn(e,t,r){if(r!==void 0)e[t]=r}function ov(e){let t=e.manifest,r=[],n=[];if(t===void 0||t.enabled===!1)return{errors:r,files:[],warnings:n};let s=t.name??e.name??"Jx Site",i=as(e.url),o=[];for(let d of t.icons??[])o.push(T(d.src)?{...d,src:Ie(i,d.src)}:d);let a={display:t.display??"standalone",icons:o,name:s,short_name:t.shortName??s,start_url:Ie(i,t.startUrl??"/")};Hn(a,"description",t.description),Hn(a,"theme_color",t.themeColor),Hn(a,"background_color",t.backgroundColor),Hn(a,"scope",t.scope===void 0?void 0:Ie(i,t.scope)),Hn(a,"orientation",t.orientation),Hn(a,"lang",t.lang),Hn(a,"dir",t.dir),Hn(a,"categories",t.categories);let l=new Set(o.flatMap((d)=>(d.sizes??"").split(/\s+/).map((p)=>Math.trunc(Number(p.split("x")[0]))))),c=QJ.filter((d)=>!l.has(d));if(c.length>0)n.push(`manifest: no ${c.join("px and no ")}px icon declared — browsers will not offer to `+"install the site without one at each size.");return{errors:r,files:[{content:`${JSON.stringify(a,null,2)}
482
- `,path:"manifest.webmanifest"}],warnings:n}}function av(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let r=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)r.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return r}function lv(e,t){let r=e.securityTxt,n=[],s=[];if(r===void 0||r.enabled===!1)return{errors:n,files:[],warnings:s};let i=r.contact??[];if(i.length===0)n.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(r.expires===void 0)n.push("securityTxt: `expires` is required (RFC 9116 §2.5.5) — a security.txt with no expiry "+"never goes stale visibly, which is how they end up pointing at people who left.");else{let l=new Date(r.expires);if(Number.isNaN(l.getTime()))n.push(`securityTxt: \`expires\` is not a valid date: "${r.expires}".`);else if(l.getTime()<=t.getTime())n.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let o=[];for(let l of r.preferredLanguages??[]){let c=dr(l);if(c===null)n.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else o.push(c)}if(n.length>0)return{errors:n,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...i.map((l)=>`Contact: ${l}`),`Expires: ${new Date(r.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(r.encryption??[]).map((l)=>`Encryption: ${l}`),...(r.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...o.length>0?[`Preferred-Languages: ${o.join(", ")}`]:[],...r.canonical===void 0?[]:[`Canonical: ${r.canonical}`],...(r.policy??[]).map((l)=>`Policy: ${l}`),...(r.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:n,files:[{content:`${a.join(`
481
+ `,warnings:[]}}function mv(e,t=""){return`if('serviceWorker' in navigator){addEventListener('load',function(){navigator.serviceWorker.register('${Ie(t,`/${qd}`)}',{scope:${JSON.stringify(Ie(t,e))}}).catch(function(){})})}`}var qd="sw.js",iD="/images/_optimized/";var hv=q(()=>{sr()});import{mkdirSync as lD,writeFileSync as cD}from"node:fs";import{dirname as uD,join as dD}from"node:path";function Hn(e,t,r){if(r!==void 0)e[t]=r}function gv(e){let t=e.manifest,r=[],n=[];if(t===void 0||t.enabled===!1)return{errors:r,files:[],warnings:n};let s=t.name??e.name??"Jx Site",i=as(e.url),o=[];for(let u of t.icons??[])o.push(N(u.src)?{...u,src:Ie(i,u.src)}:u);let a={display:t.display??"standalone",icons:o,name:s,short_name:t.shortName??s,start_url:Ie(i,t.startUrl??"/")};Hn(a,"description",t.description),Hn(a,"theme_color",t.themeColor),Hn(a,"background_color",t.backgroundColor),Hn(a,"scope",t.scope===void 0?void 0:Ie(i,t.scope)),Hn(a,"orientation",t.orientation),Hn(a,"lang",t.lang),Hn(a,"dir",t.dir),Hn(a,"categories",t.categories);let l=new Set(o.flatMap((u)=>(u.sizes??"").split(/\s+/).map((p)=>Math.trunc(Number(p.split("x")[0]))))),c=fD.filter((u)=>!l.has(u));if(c.length>0)n.push(`manifest: no ${c.join("px and no ")}px icon declared — browsers will not offer to `+"install the site without one at each size.");return{errors:r,files:[{content:`${JSON.stringify(a,null,2)}
482
+ `,path:"manifest.webmanifest"}],warnings:n}}function yv(e){let t=e.manifest;if(t===void 0||t.enabled===!1)return[];let r=[{attributes:{href:"/manifest.webmanifest",rel:"manifest"},tagName:"link"}];if(t.themeColor!==void 0)r.push({attributes:{content:t.themeColor,name:"theme-color"},tagName:"meta"});return r}function bv(e,t){let r=e.securityTxt,n=[],s=[];if(r===void 0||r.enabled===!1)return{errors:n,files:[],warnings:s};let i=r.contact??[];if(i.length===0)n.push("securityTxt: at least one `contact` is required (RFC 9116 §2.5.3).");if(r.expires===void 0)n.push("securityTxt: `expires` is required (RFC 9116 §2.5.5) — a security.txt with no expiry "+"never goes stale visibly, which is how they end up pointing at people who left.");else{let l=new Date(r.expires);if(Number.isNaN(l.getTime()))n.push(`securityTxt: \`expires\` is not a valid date: "${r.expires}".`);else if(l.getTime()<=t.getTime())n.push(`securityTxt: \`expires\` is in the past (${l.toISOString()}) — an expired `+"security.txt tells a reporter not to trust what it says.")}let o=[];for(let l of r.preferredLanguages??[]){let c=dr(l);if(c===null)n.push(`securityTxt.preferredLanguages: "${l}" is not a well-formed language tag.`);else o.push(c)}if(n.length>0)return{errors:n,files:[],warnings:s};let a=["# Generated by @jxsuite/compiler — configure via securityTxt in project.json.",...i.map((l)=>`Contact: ${l}`),`Expires: ${new Date(r.expires).toISOString().replace(/\.\d{3}Z$/,"Z")}`,...(r.encryption??[]).map((l)=>`Encryption: ${l}`),...(r.acknowledgments??[]).map((l)=>`Acknowledgments: ${l}`),...o.length>0?[`Preferred-Languages: ${o.join(", ")}`]:[],...r.canonical===void 0?[]:[`Canonical: ${r.canonical}`],...(r.policy??[]).map((l)=>`Policy: ${l}`),...(r.hiring??[]).map((l)=>`Hiring: ${l}`)];return{errors:n,files:[{content:`${a.join(`
483
483
  `)}
484
- `,path:".well-known/security.txt"}],warnings:s}}function cv(e,t,r){let n=0,s=[];for(let i of e){let o=ZJ(t,i.path);if(r(o)){s.push(i.path);continue}KJ(XJ(o),{recursive:!0}),YJ(o,i.content,"utf8"),n+=1}return{skipped:s,written:n}}var QJ;var uv=q(()=>{nr();hs();ve();QJ=[192,512]});import{existsSync as eD,mkdirSync as Jd,readFileSync as tD,readdirSync as rD,writeFileSync as nD}from"node:fs";import{dirname as wo,join as sD,relative as iD,resolve as So}from"node:path";function oD(e){return e.endsWith("/")}function fv(e=Dd){let t={},r=[],n=[];for(let s of El)if(aD(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,n.push(s.assetPath);else t[s.specifier]=s.fallback,r.push(`Could not resolve "${s.specifier}" — the import map falls back to ${s.fallback}. Interactive pages will load it from a third party, and a \`default-src 'self'\` policy will block them.`);return{assetPaths:n,imports:t,warnings:r}}async function pv(e,t,r=Dd,n=!0){let s=[],i=0;for(let o of El){if(!e.assetPaths.includes(o.assetPath))continue;let a=So(t,o.assetPath.replace(/^\//,""));Jd(wo(a),{recursive:!0});try{await ms(`export * from ${JSON.stringify(o.specifier)};
485
- `,{outfile:a,resolveDir:r},{minify:n,target:"browser"}),i+=1}catch(l){s.push(`Bundling client runtime "${o.specifier}": ${Ee(l)}`)}}return{errors:s,written:i}}function Ld(e){return Object.entries(e).filter(([t,r])=>!oD(t)&&r.startsWith("/")).map(([,t])=>t)}function mv(e){let t=[];for(let r of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let n;try{n=JSON.parse(r[1])}catch{continue}let s=ee(n)?n.imports:void 0;if(!F(s))continue;let i=Object.entries(s).flatMap(([o,a])=>T(a)?[[o,a]]:[]);t.push(...Ld(Object.fromEntries(i)))}return t}function hv(e){return`<script type="importmap">
484
+ `,path:".well-known/security.txt"}],warnings:s}}function xv(e,t,r){let n=0,s=[];for(let i of e){let o=dD(t,i.path);if(r(o)){s.push(i.path);continue}lD(uD(o),{recursive:!0}),cD(o,i.content,"utf8"),n+=1}return{skipped:s,written:n}}var fD;var $v=q(()=>{sr();gs();$e();fD=[192,512]});import{existsSync as pD,mkdirSync as Bd,readFileSync as mD,readdirSync as hD,writeFileSync as gD}from"node:fs";import{dirname as So,join as yD,relative as bD,resolve as Eo}from"node:path";function xD(e){return e.endsWith("/")}function wv(e=Wd){let t={},r=[],n=[];for(let s of jl)if($D(s.specifier,e))t[s.specifier]=s.assetPath,t[`${s.specifier}/`]=s.assetDir,n.push(s.assetPath);else t[s.specifier]=s.fallback,r.push(`Could not resolve "${s.specifier}" — the import map falls back to ${s.fallback}. Interactive pages will load it from a third party, and a \`default-src 'self'\` policy will block them.`);return{assetPaths:n,imports:t,warnings:r}}async function Sv(e,t,r=Wd,n=!0){let s=[],i=0;for(let o of jl){if(!e.assetPaths.includes(o.assetPath))continue;let a=Eo(t,o.assetPath.replace(/^\//,""));Bd(So(a),{recursive:!0});try{await ms(`export * from ${JSON.stringify(o.specifier)};
485
+ `,{outfile:a,resolveDir:r},{minify:n,target:"browser"}),i+=1}catch(l){s.push(`Bundling client runtime "${o.specifier}": ${we(l)}`)}}return{errors:s,written:i}}function Ud(e){return Object.entries(e).filter(([t,r])=>!xD(t)&&r.startsWith("/")).map(([,t])=>t)}function Ev(e){let t=[];for(let r of e.matchAll(/<script type="importmap">([\s\S]*?)<\/script>/g)){let n;try{n=JSON.parse(r[1])}catch{continue}let s=z(n)?n.imports:void 0;if(!F(s))continue;let i=Object.entries(s).flatMap(([o,a])=>N(a)?[[o,a]]:[]);t.push(...Ud(Object.fromEntries(i)))}return t}function _v(e){return`<script type="importmap">
486
486
  {
487
487
  "imports": {
488
488
  ${Object.entries(e).map(([r,n])=>` ${JSON.stringify(r)}: ${JSON.stringify(n)}`).join(`,
489
489
  `)}
490
490
  }
491
491
  }
492
- </script>`}function aD(e,t){try{return ch(e,t),!0}catch{return!1}}async function gv(e,t=Dd,r=!0){let n=[],s=new Set,i=new Map,o=new Map,a=So(e,"assets"),l=0,c=async(p)=>{if(!o.has(p.specifier))o.set(p.specifier,await fh(p.specifier,t,{target:"browser"}));return o.get(p.specifier)},d=async(p)=>[...tD(p,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let p=0;p<dv;p++){let h=0,m=[];try{m=rD(a,{recursive:!0}).map(String).filter((b)=>b.endsWith(".js")).map((b)=>sD(a,b))}catch{return Md(e,i,n,l)}for(let b of m){let g=[];try{g=await d(b)}catch{continue}for(let y of g){let v=El.find((P)=>y.startsWith(`${P.specifier}/`));if(!v||s.has(y))continue;s.add(y);let j=y.slice(v.specifier.length+1),S=So(e,`${v.assetDir.replace(/^\//,"")}${j}`);Jd(wo(S),{recursive:!0});try{await ms(`export * from ${JSON.stringify(y)};
493
- `,{outfile:S,resolveDir:t},{minify:r,resolver:lD(v,S,await c(v),i),target:"browser"}),l+=1,h+=1}catch(P){n.push(`Bundling runtime subpath "${y}": ${Ee(P)}`)}}}if(h===0)return Md(e,i,n,l)}return n.push(`Runtime subpath resolution did not settle in ${dv} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Md(e,i,n,l)}function lD(e,t,r,n){return{filter:/.*/,resolve:({importer:s,path:i})=>{if(Uc(s))return;if(El.find((a)=>i===a.specifier||i.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:i};if(r===void 0||!i.startsWith("."))return;if(So(wo(s),i)!==r)return;return n.set(So(wo(t),i),e.specifier),{external:!0,path:i}}}}function Md(e,t,r,n){let s=n;for(let[i,o]of t){if(eD(i))continue;try{Jd(wo(i),{recursive:!0}),nD(i,`export * from ${JSON.stringify(o)};
494
- `,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${iD(e,i)}: ${Ee(a)}`)}}return{errors:r,written:s}}var El,Dd,dv=10;var yv=q(()=>{zc();Mr();ve();rr();El=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Ks,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Ys,specifier:"lit-html"}];Dd=import.meta.dirname});import{cpSync as _l,existsSync as xn,mkdirSync as Er,readFileSync as cD,readdirSync as uD,rmSync as dD,statSync as fD,writeFileSync as hr}from"node:fs";import{createHash as pD}from"node:crypto";import{basename as mD,dirname as Wr,join as Vn,relative as hD,resolve as Ye,sep as gD}from"node:path";async function vv(e,t={}){let{clean:r=!0,verbose:n=!1}=t,s=[],i=n?console.log.bind(console):()=>{};i("Loading project.json...");let{config:o}=Rn(e);if("contentTypes"in o)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 a=Ye(e,o.build.outDir),l=Ye(e,"pages"),c=Ye(e,"public"),d=o.build.trailingSlash??"always",p=o.build.minify!==!1,h=new Map,m=new Map,b=new Map,g=(J)=>{let H=J.toSorted(),ie=`/assets/elements-${pD("sha1").update(H.join("\x00")).digest("hex").slice(0,12)}.js`;return b.set(ie,H),ie},y=fv(),v=y.imports,j=new Set,S=bg(),{errors:P,i18n:E}=Gc(o);for(let J of P)s.push(J),console.error(J);for(let J of y.warnings)console.warn(J);let O=new Map,R=(J,H,V)=>{let ie=O.get(J);if(ie!==void 0&&ie.entryPath!==H)throw Error(`"${V}" and "${ie.specifier}" both map to ${J} — rename one`);O.set(J,{entryPath:H,specifier:V})},k=(J,H)=>{if(!lh(J))return J;try{let V=Wc(J,H??e,e);if(!os(J)&&!xn(V))return console.warn(`Sidecar "${J}" not found at ${V} — emitting unbundled`),J;let ie=os(J)?J:`./${hD(e,V)}`,Se=Pm(ie);return R(Se,V,J),h.set(Se,{entryPath:V,specifier:J}),Se}catch(V){return s.push(`Sidecar "${J}": ${Ee(V)}`),J}},I=(J)=>{let H=jm(J);try{let V=Wc(`npm:${J}`,e,e);return R(H,V,J),m.set(H,V),H}catch(V){return s.push(`$head specifier "${J}": ${Ee(V)}`),J}},D=await kn(e,o),M=D.formats;if(M.entries.length>0)i(` Registered ${M.entries.length} format(s): ${M.entries.map((J)=>J.name).join(", ")}`);let L=D.serverMounts().filter((J)=>{if(!J.project)return!0;let H=o[J.project.key];return F(H)&&Object.keys(H).length>0});if(L.length>0&&!o.build.adapter){let J=L.map((H)=>H.project?`"${H.project.key}"`:`"${H.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${J} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${bv}`)}if(r&&xn(a))dD(a,{force:!0,recursive:!0});if(Er(a,{recursive:!0}),!xn(l))throw Error(`pages/ directory not found in ${e}`);i("Discovering pages...");let W=await pg(l,M);i(` Found ${W.length} page(s)`),i("Loading project sections...");let se=await Ag(e,o,D),ue=Object.keys(se);if(ue.length>0)i(` Loaded ${ue.length} section(s): ${ue.join(", ")}`);let{errors:oe,mounts:Q}=await Cg(D,o,e);s.push(...oe);for(let J of oe)console.error(J);if(Q.length>0)i(` Mounted ${Q.length} asset dir(s): ${Q.map((J)=>J.urlPrefix).join(", ")}`);let ae=new Set,ke=await xD(D,o,e),le=(await gg(W,e,se,D,o,E)).map((J)=>Object.assign(J,{locale:Tr(J.urlPattern,E)}));i(` ${le.length} route(s) after expansion`);let z=0,te=Ye(e,"components"),Le=[],fe=new Map,Be=new Map,G=new Map;if(xn(te)){i("Compiling components...");let J=[".json",...M.documentExtensions("component")],H=uD(te).filter((ze)=>J.some((Te)=>ze.endsWith(Te))),V=Ye(a,"components");Er(V,{recursive:!0});let ie=new Map;for(let ze of H){let Te=Ye(te,ze);try{let{tagName:he}=await xs(Te,M);if(he)ie.set(Te,he)}catch{}}let Se=as(o.url),Or=Qa(Se);for(let ze of H)try{let Te=Ye(te,ze),he={formats:M,resolveElementPath:(ot,Zt)=>{let f=Zt?Ye(Zt,ot):Ye(ot),x=ie.get(f);return x?`./${x}.js`:ot.replace(/\.json$/,".js")},rewriteSrc:(ot,Zt)=>Ie(Se,k(ot,Zt)),serverBaseUrl:Or};if(o.$media)he.$media=o.$media;let xt=await Xa(Te,he);for(let ot of xt.files){let Zt=ot.tagName?`${ot.tagName}.js`:mD(ot.path);if(!Le.includes(ot.tagName))hr(Ye(V,Zt),ot.content,"utf8"),Le.push(ot.tagName),z+=1}let st=await xs(Te,M);if(st.tagName){Be.set(st.tagName,st),G.set(st.tagName,Te);let ot=ys(st,o.defaults),Zt=rg(st.tagName,st.style,st,o.$media??{},ot);if(Zt){if(ot===null)fe.set(st.tagName,Zt);Cu(Zt,Q,ae),hr(Ye(V,`${st.tagName}.css`),Zt,"utf8"),z+=1}}}catch(Te){let he=Ee(Te);s.push(`Error compiling component ${ze}: ${he}`),console.error(`Error compiling component ${ze}: ${he}`)}i(` Compiled ${Le.length} component(s): ${Le.join(", ")}`)}let We=[];for(let[J,H]of Be)We.push(...oo(H,G.get(J),e));if(o.state)We.push(...oo({state:o.state},Ye(e,"project.json"),e));let Xe=o.images.optimize&&o.images.service==="cloudflare",pt=o.images.optimize&&!Xe?J$(e):null,ut=Xe?new Map:null;if(Xe)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 Ue=o.url,bt=as(Ue),Mt=Boolean(Ue)&&o.build.sitemap!==!1,Xr=[],En=le.filter((J)=>!J.urlPattern.includes(":")&&!J.urlPattern.includes("*")),Ii=E===null?new Map:await fg(En,M),Jt=En.map((J)=>({translationKey:Ii.get(J.urlPattern),urlPattern:J.urlPattern})),Zr=cg(Jt,E,Ue,d),{conflicts:Mi,sets:Ts}=ju(Jt,E);for(let J of Mi){let[H,V]=J.urlPatterns,ie=J.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",Se=`${V} and ${H} are both the "${J.locale}" version of "${J.key}". A translation set names one URL per language, so ${V} is `+`dropped from it — it carries no alternates and no switcher. ${ie}`;if(J.declared)s.push(Se),console.error(Se);else console.warn(Se)}let ts=ag(le,E);if(ts.length>0)console.warn(`i18n.routing is "prefix-always", but ${ts.length} route(s) sit outside the locale tree and are served as "${E?.defaultLocale}": ${ts.slice(0,10).join(", ")}${ts.length>10?`, and ${ts.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(E!==null&&E.routing==="prefix-always"&&!o.build.adapter&&!le.some((J)=>J.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${E.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Is=new Set,ia=new Set;for(let J of le){let H=lg(J.urlPattern,E);if(H&&!Is.has(H.segment))Is.add(H.segment),console.warn(`Routes under /${H.segment}/ are served as "${E?.defaultLocale}" — `+`i18n.locales declares "${H.meant}", not "${H.segment}". Rename the directory to "${H.meant.toLowerCase()}" or declare the shorter tag.`);try{i(` Compiling ${J.urlPattern} ...`);let V=await yD(J,o,e,se,pt,Be,ut,M,D,k,Q,ke,I,{alternates:Zr.get(J.urlPattern)??[],i18n:E,translations:Ts.get(J.urlPattern)??[]},v,g);We.push(...V.serverEntries);for(let he of V.unregisteredRelations)if(!ia.has(he))ia.add(he),console.warn(`<link rel="${he}"> — "${he}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let ie=new Set;for(let[he,xt]of Be)if(Wa(xt))ie.add(he);if(Le.length>0)V.html=wD(V.html,Le,fe,ie,V.files.map((he)=>he.content).join(`
495
- `),v);for(let he of mv(V.html))j.add(he);Cu(V.html,Q,ae),xg(V.html,S);let Se=_v(J.urlPattern,a,d);Er(Wr(Se),{recursive:!0});let Or=!J.urlPattern.includes(":")&&!J.urlPattern.includes("*"),ze=!io(J.urlPattern)&&!ng(V.html);if(Mt&&!V.excludeFromSitemap&&ze&&Or){let he=Zr.get(J.urlPattern)??[];Xr.push({lastmod:T(J.sourceMtime)&&J.sourceMtime!==""?J.sourceMtime:PD(fD(J.sourcePath).mtime),loc:An(ri(J.urlPattern,d),Ue),...he.length>0&&{alternates:he}})}let Te=[];for(let he of M.withCapability("serialize")){if(!he.exportTarget||io(J.urlPattern))continue;try{let xt=await he.call("serialize",V.doc,{buildScope:(st)=>zs(st,null),componentDefs:Be,evaluateTemplate:(st,ot)=>{if(!pe(st))return;return wt(st,ot)??st},mode:"export"});if(xt){let st=Se.replace(/\.html$/,he.extensions[0]);Te.push({content:xt,path:st,type:he.mediaTypeEssence})}}catch(xt){s.push(`Error exporting ${he.name} for ${J.urlPattern}: ${Ee(xt)}`)}}for(let he of Te)if(he.type!==null)V.html=ig(V.html,{href:og(a,he.path),type:he.type});hr(Se,Om(V.html,bt),"utf8"),z+=1;for(let he of Te)hr(he.path,he.content,"utf8"),z+=1;for(let he of V.files){let xt=Ye(Wr(Se),he.path);Er(Wr(xt),{recursive:!0}),hr(xt,he.content,"utf8"),z+=1}}catch(V){let ie=`Error compiling ${J.urlPattern}: ${Ee(V)}`;s.push(ie),console.error(ie)}}if(pt&&o.images.optimize){D$(e,pt,{prune:s.length===0});let J=Ye(hi(e),"_optimized");if(xn(J)){let V=Ye(a,"images/_optimized");Er(V,{recursive:!0}),_l(J,V,{recursive:!0})}let H=Object.keys(pt.entries).length;if(H>0)i(` Optimized ${H} image(s)`)}let Qr=[];if(!o.build.adapter&&We.length>0){let H=`timing: "server" entries ${[...new Set(We.map(({exportName:V,declaredIn:ie})=>`${V} (${ie})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${bv}`;s.push(H),console.error(H)}if(o.build.adapter){let{adapter:J}=o.build;i("Generating site-wide server worker...");let{entries:H,errors:V}=Vg(We);Qr=H;for(let Te of V)s.push(Te),console.error(Te);let{mounts:ie,connectors:Se}=bD(L,D,o);if(ie.length>0)i(` Mounting ${ie.length} extension route(s): ${ie.map((Te)=>Te.basePath).join(", ")}`);let ze=J==="cloudflare-pages"&&Qr.length===0&&ie.length===0?null:Vu(Qr,{adapter:J,base:bt,connectors:Se,i18n:E,mounts:ie});if(ze){let Te=J==="cloudflare-pages"?"_worker.js":"worker.js";try{await ph(ze,{adapter:J,outfile:Ye(a,Te),projectRoot:e}),z+=1,i(` Generated dist/${Te} (bundled, ${Qr.length} server function(s))`)}catch(he){let xt=`Error bundling dist/${Te}: ${Ee(he)}`;s.push(xt),console.error(xt)}if(J==="cloudflare-pages")hr(Ye(a,"_routes.json"),`${JSON.stringify({exclude:[],include:(E&&E.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((he)=>Ie(bt,he)),version:1},null,2)}
496
- `,"utf8"),z+=1}}if(j.size>0){i(`Bundling ${j.size} client runtime module(s)...`);let J=await pv({...y,assetPaths:[...j]},a,void 0,p);z+=J.written;for(let H of J.errors)s.push(H),console.error(H)}if(m.size>0){i(`Copying ${m.size} package asset(s)...`);for(let[J,H]of m){let V=Ye(a,J.replace(/^\//,""));Er(Wr(V),{recursive:!0}),_l(H,V),z+=1,i(` ${H} → ${J}`)}}if(h.size>0){i(`Bundling ${h.size} client sidecar module(s)...`);for(let[J,H]of h)try{let V=Ye(a,J.replace(/^\//,""));Er(Wr(V),{recursive:!0}),await dh({entryPath:H.entryPath,outfile:V},{external:ah,minify:p,target:"browser"}),z+=1,i(` ${H.specifier} → ${J}`)}catch(V){let ie=`Error bundling sidecar "${H.specifier}": ${Ee(V)}`;s.push(ie),console.error(ie)}}if(b.size>0){i(`Bundling ${b.size} npm element set(s)...`);for(let[J,H]of b){let V=Ye(a,J.replace(/^\//,""));Er(Wr(V),{recursive:!0});try{await ms(`${H.map((ie)=>`import ${JSON.stringify(ie)};`).join(`
492
+ </script>`}function $D(e,t){try{return gh(e,t),!0}catch{return!1}}async function Pv(e,t=Wd,r=!0){let n=[],s=new Set,i=new Map,o=new Map,a=Eo(e,"assets"),l=0,c=async(p)=>{if(!o.has(p.specifier))o.set(p.specifier,await xh(p.specifier,t,{target:"browser"}));return o.get(p.specifier)},u=async(p)=>[...mD(p,"utf8").matchAll(/(?:from|import)\s*["']([^"']+)["']/g)].map((m)=>m[1]);for(let p=0;p<vv;p++){let g=0,m=[];try{m=hD(a,{recursive:!0}).map(String).filter((b)=>b.endsWith(".js")).map((b)=>yD(a,b))}catch{return Vd(e,i,n,l)}for(let b of m){let h=[];try{h=await u(b)}catch{continue}for(let y of h){let v=jl.find((_)=>y.startsWith(`${_.specifier}/`));if(!v||s.has(y))continue;s.add(y);let j=y.slice(v.specifier.length+1),S=Eo(e,`${v.assetDir.replace(/^\//,"")}${j}`);Bd(So(S),{recursive:!0});try{await ms(`export * from ${JSON.stringify(y)};
493
+ `,{outfile:S,resolveDir:t},{minify:r,resolver:vD(v,S,await c(v),i),target:"browser"}),l+=1,g+=1}catch(_){n.push(`Bundling runtime subpath "${y}": ${we(_)}`)}}}if(g===0)return Vd(e,i,n,l)}return n.push(`Runtime subpath resolution did not settle in ${vv} passes — a package subpath `+"graph this deep is more likely a cycle in the scan than a real dependency chain."),Vd(e,i,n,l)}function vD(e,t,r,n){return{filter:/.*/,resolve:({importer:s,path:i})=>{if(Kc(s))return;if(jl.find((a)=>i===a.specifier||i.startsWith(`${a.specifier}/`))!==void 0)return{external:!0,path:i};if(r===void 0||!i.startsWith("."))return;if(Eo(So(s),i)!==r)return;return n.set(Eo(So(t),i),e.specifier),{external:!0,path:i}}}}function Vd(e,t,r,n){let s=n;for(let[i,o]of t){if(pD(i))continue;try{Bd(So(i),{recursive:!0}),gD(i,`export * from ${JSON.stringify(o)};
494
+ `,"utf8"),s+=1}catch(a){r.push(`Writing shared core stub ${bD(e,i)}: ${we(a)}`)}}return{errors:r,written:s}}var jl,Wd,vv=10;var jv=q(()=>{Yc();Mr();$e();nr();jl=[{assetDir:"/assets/@vue/reactivity/",assetPath:"/assets/vue-reactivity.js",fallback:Ys,specifier:"@vue/reactivity"},{assetDir:"/assets/lit-html/",assetPath:"/assets/lit-html.js",fallback:Xs,specifier:"lit-html"}];Wd=import.meta.dirname});import{cpSync as kl,existsSync as xn,mkdirSync as _r,readFileSync as wD,readdirSync as SD,rmSync as ED,statSync as _D,writeFileSync as hr}from"node:fs";import{createHash as PD}from"node:crypto";import{basename as jD,dirname as Wr,join as Vn,relative as kD,resolve as Ye,sep as RD}from"node:path";async function Ov(e,t={}){let{clean:r=!0,verbose:n=!1}=t,s=[],i=n?console.log.bind(console):()=>{};i("Loading project.json...");let{config:o}=Rn(e);if("contentTypes"in o)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 a=Ye(e,o.build.outDir),l=Ye(e,"pages"),c=Ye(e,"public"),u=o.build.trailingSlash??"always",p=o.build.minify!==!1,g=new Map,m=new Map,b=new Map,h=(J)=>{let H=J.toSorted(),ie=`/assets/elements-${PD("sha1").update(H.join("\x00")).digest("hex").slice(0,12)}.js`;return b.set(ie,H),ie},y=wv(),v=y.imports,j=new Set,S=Ng(),{errors:_,i18n:E}=Zc(o);for(let J of _)s.push(J),console.error(J);for(let J of y.warnings)console.warn(J);let O=new Map,R=(J,H,V)=>{let ie=O.get(J);if(ie!==void 0&&ie.entryPath!==H)throw Error(`"${V}" and "${ie.specifier}" both map to ${J} — rename one`);O.set(J,{entryPath:H,specifier:V})},k=(J,H)=>{if(!hh(J))return J;try{let V=Gc(J,H??e,e);if(!os(J)&&!xn(V))return console.warn(`Sidecar "${J}" not found at ${V} — emitting unbundled`),J;let ie=os(J)?J:`./${kD(e,V)}`,Ee=Tm(ie);return R(Ee,V,J),g.set(Ee,{entryPath:V,specifier:J}),Ee}catch(V){return s.push(`Sidecar "${J}": ${we(V)}`),J}},I=(J)=>{let H=Nm(J);try{let V=Gc(`npm:${J}`,e,e);return R(H,V,J),m.set(H,V),H}catch(V){return s.push(`$head specifier "${J}": ${we(V)}`),J}},D=await kn(e,o),M=D.formats;if(M.entries.length>0)i(` Registered ${M.entries.length} format(s): ${M.entries.map((J)=>J.name).join(", ")}`);let L=D.serverMounts().filter((J)=>{if(!J.project)return!0;let H=o[J.project.key];return F(H)&&Object.keys(H).length>0});if(L.length>0&&!o.build.adapter){let J=L.map((H)=>H.project?`"${H.project.key}"`:`"${H.server.basePath}"`).join(", ");throw Error(`project.json declares dynamic section(s) ${J} served by extension mounts, but `+`build.adapter is "static". Dynamic tables need a server-capable adapter — ${kv}`)}if(r&&xn(a))ED(a,{force:!0,recursive:!0});if(_r(a,{recursive:!0}),!xn(l))throw Error(`pages/ directory not found in ${e}`);i("Discovering pages...");let W=await kg(l,M);i(` Found ${W.length} page(s)`),i("Loading project sections...");let se=await Ug(e,o,D),ue=Object.keys(se);if(ue.length>0)i(` Loaded ${ue.length} section(s): ${ue.join(", ")}`);let{errors:oe,mounts:ee}=await Gg(D,o,e);s.push(...oe);for(let J of oe)console.error(J);if(ee.length>0)i(` Mounted ${ee.length} asset dir(s): ${ee.map((J)=>J.urlPrefix).join(", ")}`);let ae=new Set,ke=await CD(D,o,e),le=(await Og(W,e,se,D,o,E,{errors:s})).map((J)=>Object.assign(J,{locale:vr(J.urlPattern,E)}));i(` ${le.length} route(s) after expansion`);let G=0,te=Ye(e,"components"),Le=[],fe=new Map,Be=new Map,K=new Map;if(xn(te)){i("Compiling components...");let J=[".json",...M.documentExtensions("component")],H=SD(te).filter((ze)=>J.some((Ne)=>ze.endsWith(Ne))),V=Ye(a,"components");_r(V,{recursive:!0});let ie=new Map;for(let ze of H){let Ne=Ye(te,ze);try{let{tagName:he}=await $s(Ne,M);if(he)ie.set(Ne,he)}catch{}}let Ee=as(o.url),Cr=nl(Ee);for(let ze of H)try{let Ne=Ye(te,ze),he={formats:M,resolveElementPath:(ot,Qt)=>{let f=Qt?Ye(Qt,ot):Ye(ot),x=ie.get(f);return x?`./${x}.js`:ot.replace(/\.json$/,".js")},rewriteSrc:(ot,Qt)=>Ie(Ee,k(ot,Qt)),serverBaseUrl:Cr};if(o.$media)he.$media=o.$media;let xt=await tl(Ne,he);for(let ot of xt.files){let Qt=ot.tagName?`${ot.tagName}.js`:jD(ot.path);if(!Le.includes(ot.tagName))hr(Ye(V,Qt),ot.content,"utf8"),Le.push(ot.tagName),G+=1}let st=await $s(Ne,M);if(st.tagName){Be.set(st.tagName,st),K.set(st.tagName,Ne);let ot=bs(st,o.defaults),Qt=pg(st.tagName,st.style,st,o.$media??{},ot);if(Qt){if(ot===null)fe.set(st.tagName,Qt);Fu(Qt,ee,ae),hr(Ye(V,`${st.tagName}.css`),Qt,"utf8"),G+=1}}}catch(Ne){let he=we(Ne);s.push(`Error compiling component ${ze}: ${he}`),console.error(`Error compiling component ${ze}: ${he}`)}i(` Compiled ${Le.length} component(s): ${Le.join(", ")}`)}let We=[];for(let[J,H]of Be)We.push(...ao(H,K.get(J),e));if(o.state)We.push(...ao({state:o.state},Ye(e,"project.json"),e));let Xe=o.images.optimize&&o.images.service==="cloudflare",pt=o.images.optimize&&!Xe?z$(e):null,ut=Xe?new Map:null;if(Xe)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 Ue=o.url,bt=as(Ue),Mt=Boolean(Ue)&&o.build.sitemap!==!1,Xr=[],En=le.filter((J)=>!J.urlPattern.includes(":")&&!J.urlPattern.includes("*")),Mi=E===null?new Map:await jg(En,M),Jt=En.map((J)=>({translationKey:Mi.get(J.urlPattern),urlPattern:J.urlPattern})),Zr=$g(Jt,E,Ue,u),{conflicts:Ji,sets:Is}=Ou(Jt,E);for(let J of Ji){let[H,V]=J.urlPatterns,ie=J.declared?"Give one of them a different $translationKey.":"Move one out of the locale tree, or give it its own $translationKey.",Ee=`${V} and ${H} are both the "${J.locale}" version of "${J.key}". A translation set names one URL per language, so ${V} is `+`dropped from it — it carries no alternates and no switcher. ${ie}`;if(J.declared)s.push(Ee),console.error(Ee);else console.warn(Ee)}let ts=bg(le,E);if(ts.length>0)console.warn(`i18n.routing is "prefix-always", but ${ts.length} route(s) sit outside the locale tree and are served as "${E?.defaultLocale}": ${ts.slice(0,10).join(", ")}${ts.length>10?`, and ${ts.length-10} more`:""}. Move them under a locale directory, or use "prefix-except-default".`);if(E!==null&&E.routing==="prefix-always"&&!o.build.adapter&&!le.some((J)=>J.urlPattern==="/"))console.warn('i18n.routing is "prefix-always" and no page claims "/", so the site root is a 404. '+'Locale negotiation answers "/" only when build.adapter is set — a static deployment has '+`no runtime to read Accept-Language. Add a redirect from "/" to "/${E.defaultLocale.toLowerCase()}/", set build.adapter, or use "prefix-except-default".`);let Ms=new Set,oa=new Set;for(let J of le){let H=xg(J.urlPattern,E);if(H&&!Ms.has(H.segment))Ms.add(H.segment),console.warn(`Routes under /${H.segment}/ are served as "${E?.defaultLocale}" — `+`i18n.locales declares "${H.meant}", not "${H.segment}". Rename the directory to "${H.meant.toLowerCase()}" or declare the shorter tag.`);try{i(` Compiling ${J.urlPattern} ...`);let V=await AD(J,o,e,se,pt,Be,ut,M,D,k,ee,ke,I,{alternates:Zr.get(J.urlPattern)??[],i18n:E,translations:Is.get(J.urlPattern)??[]},v,h);We.push(...V.serverEntries);for(let he of V.unregisteredRelations)if(!oa.has(he))oa.add(he),console.warn(`<link rel="${he}"> — "${he}" is not an IANA link relation, and a relation nobody recognizes does nothing. Check the spelling, or use an absolute `+"URI if it is an extension relation (RFC 8288 §2.1.2).");let ie=new Set;for(let[he,xt]of Be)if(Ua(xt))ie.add(he);if(Le.length>0)V.html=ID(V.html,Le,fe,ie,V.files.map((he)=>he.content).join(`
495
+ `),v);for(let he of Ev(V.html))j.add(he);Fu(V.html,ee,ae),Ig(V.html,S);let Ee=Iv(J.urlPattern,a,u);_r(Wr(Ee),{recursive:!0});let Cr=!J.urlPattern.includes(":")&&!J.urlPattern.includes("*"),ze=!oo(J.urlPattern)&&!mg(V.html);if(Mt&&!V.excludeFromSitemap&&ze&&Cr){let he=Zr.get(J.urlPattern)??[];Xr.push({lastmod:N(J.sourceMtime)&&J.sourceMtime!==""?J.sourceMtime:LD(_D(J.sourcePath).mtime),loc:An(ni(J.urlPattern,u),Ue),...he.length>0&&{alternates:he}})}let Ne=[];for(let he of M.withCapability("serialize")){if(!he.exportTarget||oo(J.urlPattern))continue;try{let xt=await he.call("serialize",V.doc,{buildScope:(st)=>Gs(st,null),componentDefs:Be,evaluateTemplate:(st,ot)=>{if(!pe(st))return;return wt(st,ot)??st},mode:"export"});if(xt){let st=Ee.replace(/\.html$/,he.extensions[0]);Ne.push({content:xt,path:st,type:he.mediaTypeEssence})}}catch(xt){s.push(`Error exporting ${he.name} for ${J.urlPattern}: ${we(xt)}`)}}for(let he of Ne)if(he.type!==null)V.html=gg(V.html,{href:yg(a,he.path),type:he.type});hr(Ee,Dm(V.html,bt),"utf8"),G+=1;for(let he of Ne)hr(he.path,he.content,"utf8"),G+=1;for(let he of V.files){let xt=Ye(Wr(Ee),he.path);_r(Wr(xt),{recursive:!0}),hr(xt,he.content,"utf8"),G+=1}}catch(V){let ie=`Error compiling ${J.urlPattern}: ${we(V)}`;s.push(ie),console.error(ie)}}if(pt&&o.images.optimize){G$(e,pt,{prune:s.length===0});let J=Ye(gi(e),"_optimized");if(xn(J)){let V=Ye(a,"images/_optimized");_r(V,{recursive:!0}),kl(J,V,{recursive:!0})}let H=Object.keys(pt.entries).length;if(H>0)i(` Optimized ${H} image(s)`)}let Qr=[];if(!o.build.adapter&&We.length>0){let H=`timing: "server" entries ${[...new Set(We.map(({exportName:V,declaredIn:ie})=>`${V} (${ie})`))].join(", ")} need a server-capable adapter, but `+`build.adapter is "static": a static deployment has nothing to serve /_jx/server — ${kv}`;s.push(H),console.error(H)}if(o.build.adapter){let{adapter:J}=o.build;i("Generating site-wide server worker...");let{entries:H,errors:V}=iy(We);Qr=H;for(let Ne of V)s.push(Ne),console.error(Ne);let{mounts:ie,connectors:Ee}=OD(L,D,o);if(ie.length>0)i(` Mounting ${ie.length} extension route(s): ${ie.map((Ne)=>Ne.basePath).join(", ")}`);let ze=J==="cloudflare-pages"&&Qr.length===0&&ie.length===0?null:Xu(Qr,{adapter:J,base:bt,connectors:Ee,i18n:E,mounts:ie});if(ze){let Ne=J==="cloudflare-pages"?"_worker.js":"worker.js";try{await $h(ze,{adapter:J,outfile:Ye(a,Ne),projectRoot:e}),G+=1,i(` Generated dist/${Ne} (bundled, ${Qr.length} server function(s))`)}catch(he){let xt=`Error bundling dist/${Ne}: ${we(he)}`;s.push(xt),console.error(xt)}if(J==="cloudflare-pages")hr(Ye(a,"_routes.json"),`${JSON.stringify({exclude:[],include:(E&&E.locales.length>1?["/","/_jx/*"]:["/_jx/*"]).map((he)=>Ie(bt,he)),version:1},null,2)}
496
+ `,"utf8"),G+=1}}if(j.size>0){i(`Bundling ${j.size} client runtime module(s)...`);let J=await Sv({...y,assetPaths:[...j]},a,void 0,p);G+=J.written;for(let H of J.errors)s.push(H),console.error(H)}if(m.size>0){i(`Copying ${m.size} package asset(s)...`);for(let[J,H]of m){let V=Ye(a,J.replace(/^\//,""));_r(Wr(V),{recursive:!0}),kl(H,V),G+=1,i(` ${H} → ${J}`)}}if(g.size>0){i(`Bundling ${g.size} client sidecar module(s)...`);for(let[J,H]of g)try{let V=Ye(a,J.replace(/^\//,""));_r(Wr(V),{recursive:!0}),await bh({entryPath:H.entryPath,outfile:V},{external:mh,minify:p,target:"browser"}),G+=1,i(` ${H.specifier} → ${J}`)}catch(V){let ie=`Error bundling sidecar "${H.specifier}": ${we(V)}`;s.push(ie),console.error(ie)}}if(b.size>0){i(`Bundling ${b.size} npm element set(s)...`);for(let[J,H]of b){let V=Ye(a,J.replace(/^\//,""));_r(Wr(V),{recursive:!0});try{await ms(`${H.map((ie)=>`import ${JSON.stringify(ie)};`).join(`
497
497
  `)}
498
- `,{outfile:V,resolveDir:e},{minify:p,target:"browser"}),z+=1,i(` ${H.length} element(s) → ${J}`)}catch(ie){let Se=`Error bundling npm $elements [${H.join(", ")}]: ${Ee(ie)}`;s.push(Se),console.error(Se)}}}if(j.size>0){let J=await gv(a,void 0,p);if(J.written>0)i(`Bundling ${J.written} runtime subpath module(s)...`);z+=J.written;for(let H of J.errors)s.push(H),console.error(H)}for(let J of D.emitters()){let H=J.project?.key,V=H?o[H]:void 0;if(H&&(V==null||F(V)&&Object.keys(V).length===0))continue;try{let ie=await J.call("emit",V??null,{projectConfig:o,root:e,routes:le,sections:se});for(let Se of ie??[]){let Or=Ye(a,Se.path.replace(/^\//,""));if(!Or.startsWith(a+gD))throw Error(`emit path escapes outDir: ${Se.path}`);Er(Wr(Or),{recursive:!0}),hr(Or,Se.content),z+=1,i(` ${J.name} emitted ${Se.path}`)}}catch(ie){let Se=`Error in ${J.name}.emit: ${Ee(ie)}`;s.push(Se),console.error(Se)}}if(o.redirects&&Object.keys(o.redirects).length>0){i("Generating redirects...");let J=new Set(le.map((V)=>V.urlPattern)),H=_D(o.redirects,a,{basePath:bt,compiledUrls:J,trailingSlash:o.build.trailingSlash});z+=H.files,s.push(...H.errors)}if(Mt)i(`Generating sitemap (${Xr.length} URL(s))...`),z+=kD(Xr,a);else if(!Ue&&o.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(ae.size>0){let{copied:J,missing:H}=Ng(ae,Q,a);z+=J,i(`Copying ${J} mounted asset(s)...`);for(let V of H)console.warn(`Referenced asset not found: ${V}`)}if(xn(c))i("Copying public/ assets..."),_l(c,a,{recursive:!0});if(Mt)z+=RD(a,Ue);{let J=[ov(o),lv(o,new Date)];for(let ie of J){for(let Se of ie.errors)s.push(Se),console.error(Se);for(let Se of ie.warnings)console.warn(Se)}let{skipped:H,written:V}=cv(J.flatMap((ie)=>ie.files),a,xn);z+=V;for(let ie of H)i(` ${ie} — kept the copy from public/`)}{let J=Id(o.serviceWorker);if(J!==null){let H=J===!1?nv():rv(J,a,bt);for(let V of H.warnings)console.warn(V);for(let V of H.errors)s.push(V),console.error(V);if(H.path!==null)hr(Vn(a,H.path),H.source,"utf8"),z+=1,i(J===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:J,rules:H}=Eg(o.build,S);s.push(...J);let V=Pg([...H,..._g(a)],bt);if(V.length>0){i("Writing response headers..."),z+=jg(a,V);let{adapter:ie,deploy:Se}=o.build;if(ie==="node"||ie==="bun")console.warn(`The "${ie}" 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(ie===void 0&&Se===void 0)if(xn(Ye(c,"CNAME")))console.warn("GitHub Pages ignores dist/_headers and serves its own Cache-Control: max-age=600, so the generated caching and security rules will not take effect. Deploy behind a host that reads _headers (Cloudflare Pages, Cloudflare Workers assets, Netlify) to apply them.");else i(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}z+=kg(a)}if(o.copy){i("Copying mapped files...");for(let[J,H]of Object.entries(o.copy)){if(!T(H))throw TypeError(`project.json copy["${J}"] must be a destination path string`);let V=Ye(e,J),ie=Ye(a,H);Er(Wr(ie),{recursive:!0}),_l(V,ie)}}if(i(`
499
- Build complete: ${le.length} routes, ${z} files`),s.length>0)i(` ${s.length} error(s)`);return{errors:s,files:z,routes:le.length,serverEntries:Qr}}async function yD(e,t,r,n,s,i,o,a,l,c,d,p,h,m,b,g){let y=as(t.url),v=await xs(e.sourcePath,a),j=await Lg(v,t,r),S=[...oo(v,e.sourcePath,r),...Fg(v,t,r).flatMap((fe)=>oo(fe.doc,fe.path,r))],P=Wg(v.$head??j._pageHead??[],v.description),E=j.$head??[],O=v.title??j._pageTitle??null;delete j._pageHead,delete j._pageTitle,Qg(j,t,e,r,m.i18n,m.translations);let R=ug({defaults:t.defaults,pageDir:T(v.$dir)?v.$dir:void 0,pageLang:T(v.$lang)?v.$lang:void 0,routeLocale:Tr(e.urlPattern,m.i18n)});await $y(j,e,r,{config:t,registerBundle:(fe)=>{c(fe,null)},registry:l,sections:n});let k=zs(j.state??{}),I=O??t.name;if(pe(I))I=wt(I,k)??I;let D=Fd(xv(P,k),h),M=Fd(xv(E,k),h);Eo(j,k);let L={counter:{n:0},media:{...t.$media,...j.$media},rules:[]},W={n:0};if(Wd(j,i,L,t.defaults,W),j.state){let fe=new Set;for(let[G,We]of Object.entries(j.state)){if(G==="$site"||G==="$page")continue;if(ee(We)&&We.timing==="compiler")delete j.state[G];else if(Array.isArray(We))fe.add(G)}let Be=!0;while(Be){Be=!1;let G={...j.state};for(let Xe of fe)delete G[Xe];let We=JSON.stringify({children:j.children,state:G});for(let Xe of fe)if(vD(We,Xe))fe.delete(Xe),Be=!0}for(let G of fe)delete j.state[G]}let se=Id(t.serviceWorker),ue=se===null||se===!1?[]:[{tagName:"script",textContent:sv(se.scope??"/",y)}],oe=[...av(t),...ue,...p,...Fd(t.$head??[],h)],Q=Ug(oe,M,D,{title:I,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!io(e.urlPattern)&&{pageUrl:ri(e.urlPattern,t.build.trailingSlash)}});if(t.$media)j.$media={...t.$media,...j.$media};if(Object.values(j.$media??{}).some((fe)=>wr(String(fe))!==null))Q.splice(2,0,{tagName:"script",textContent:Zs()});let ae=t.images;await Y$(j,ae,r,s,o??void 0,d);let ke={lang:R.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(fe)=>Ie(y,c(fe,Wr(e.sourcePath))),serverBaseUrl:Qa(y),title:I},U=b["@vue/reactivity"];if(U!==void 0)ke.reactivitySrc=U;let le=b["lit-html"];if(le!==void 0)ke.litHtmlSrc=le;let z=await Wu(j,ke);if(L.rules.length>0)z.html=z.html.replace("</head>",`<style>
500
- ${Ha(L.rules.join(`
498
+ `,{outfile:V,resolveDir:e},{minify:p,target:"browser"}),G+=1,i(` ${H.length} element(s) → ${J}`)}catch(ie){let Ee=`Error bundling npm $elements [${H.join(", ")}]: ${we(ie)}`;s.push(Ee),console.error(Ee)}}}if(j.size>0){let J=await Pv(a,void 0,p);if(J.written>0)i(`Bundling ${J.written} runtime subpath module(s)...`);G+=J.written;for(let H of J.errors)s.push(H),console.error(H)}for(let J of D.emitters()){let H=J.project?.key,V=H?o[H]:void 0;if(H&&(V==null||F(V)&&Object.keys(V).length===0))continue;try{let ie=await J.call("emit",V??null,{projectConfig:o,root:e,routes:le,sections:se});for(let Ee of ie??[]){let Cr=Ye(a,Ee.path.replace(/^\//,""));if(!Cr.startsWith(a+RD))throw Error(`emit path escapes outDir: ${Ee.path}`);_r(Wr(Cr),{recursive:!0}),hr(Cr,Ee.content),G+=1,i(` ${J.name} emitted ${Ee.path}`)}}catch(ie){let Ee=`Error in ${J.name}.emit: ${we(ie)}`;s.push(Ee),console.error(Ee)}}if(o.redirects&&Object.keys(o.redirects).length>0){i("Generating redirects...");let J=new Set(le.map((V)=>V.urlPattern)),H=DD(o.redirects,a,{basePath:bt,compiledUrls:J,trailingSlash:o.build.trailingSlash});G+=H.files,s.push(...H.errors)}if(Mt)i(`Generating sitemap (${Xr.length} URL(s))...`),G+=qD(Xr,a);else if(!Ue&&o.build.sitemap!==!1)console.warn("sitemap.xml skipped — set `url` in project.json to enable sitemap generation.");if(ae.size>0){let{copied:J,missing:H}=Kg(ae,ee,a);G+=J,i(`Copying ${J} mounted asset(s)...`);for(let V of H)console.warn(`Referenced asset not found: ${V}`)}if(xn(c))i("Copying public/ assets..."),kl(c,a,{recursive:!0});if(Mt)G+=HD(a,Ue);{let J=[gv(o),bv(o,new Date)];for(let ie of J){for(let Ee of ie.errors)s.push(Ee),console.error(Ee);for(let Ee of ie.warnings)console.warn(Ee)}let{skipped:H,written:V}=xv(J.flatMap((ie)=>ie.files),a,xn);G+=V;for(let ie of H)i(` ${ie} — kept the copy from public/`)}{let J=Hd(o.serviceWorker);if(J!==null){let H=J===!1?pv():fv(J,a,bt);for(let V of H.warnings)console.warn(V);for(let V of H.errors)s.push(V),console.error(V);if(H.path!==null)hr(Vn(a,H.path),H.source,"utf8"),G+=1,i(J===!1?" sw.js — tombstone (unregisters and clears)":" sw.js")}}{let{errors:J,rules:H}=Fg(o.build,S);s.push(...J);let V=Hg([...H,...qg(a)],bt);if(V.length>0){i("Writing response headers..."),G+=Vg(a,V);let{adapter:ie,deploy:Ee}=o.build;if(ie==="node"||ie==="bun")console.warn(`The "${ie}" 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(ie===void 0&&Ee===void 0)if(xn(Ye(c,"CNAME")))console.warn("GitHub Pages ignores dist/_headers and serves its own Cache-Control: max-age=600, so the generated caching and security rules will not take effect. Deploy behind a host that reads _headers (Cloudflare Pages, Cloudflare Workers assets, Netlify) to apply them.");else i(" note: _headers is read by Cloudflare Pages, Cloudflare Workers assets and Netlify; other static hosts ignore it and serve their own Cache-Control.")}G+=Bg(a)}if(o.copy){i("Copying mapped files...");for(let[J,H]of Object.entries(o.copy)){if(!N(H))throw TypeError(`project.json copy["${J}"] must be a destination path string`);let V=Ye(e,J),ie=Ye(a,H);_r(Wr(ie),{recursive:!0}),kl(V,ie)}}if(i(`
499
+ Build complete: ${le.length} routes, ${G} files`),s.length>0)i(` ${s.length} error(s)`);return{errors:s,files:G,routes:le.length,serverEntries:Qr}}async function AD(e,t,r,n,s,i,o,a,l,c,u,p,g,m,b,h){let y=as(t.url),v=await $s(e.sourcePath,a),j=await ty(v,t,r),S=[...ao(v,e.sourcePath,r),...ry(v,t,r).flatMap((fe)=>ao(fe.doc,fe.path,r))],_=ay(v.$head??j._pageHead??[],v.description),E=j.$head??[],O=v.title??j._pageTitle??null;delete j._pageHead,delete j._pageTitle,Eg(j,t,e,r,m.i18n,m.translations);let R=vg({defaults:t.defaults,pageDir:N(v.$dir)?v.$dir:void 0,pageLang:N(v.$lang)?v.$lang:void 0,routeLocale:vr(e.urlPattern,m.i18n)});if(e.pagedState&&j.state&&e.pagedState.key in j.state)j.state[e.pagedState.key]=e.pagedState.items;await Ka(j,e,r,{config:t,registerBundle:(fe)=>{c(fe,null)},registry:l,sections:n});let k=Gs(j.state??{}),I=O??t.name;if(pe(I))I=wt(I,k)??I;let D=zd(Rv(_,k),g),M=zd(Rv(E,k),g);_o(j,k);let L={counter:{n:0},media:{...t.$media,...j.$media},rules:[]},W={n:0};if(Zd(j,i,L,t.defaults,W),j.state){let fe=new Set;for(let[K,We]of Object.entries(j.state)){if(K==="$site"||K==="$page")continue;if(z(We)&&We.timing==="compiler")delete j.state[K];else if(Array.isArray(We))fe.add(K)}let Be=!0;while(Be){Be=!1;let K={...j.state};for(let Xe of fe)delete K[Xe];let We=JSON.stringify({children:j.children,state:K});for(let Xe of fe)if(ND(We,Xe))fe.delete(Xe),Be=!0}for(let K of fe)delete j.state[K]}let se=Hd(t.serviceWorker),ue=se===null||se===!1?[]:[{tagName:"script",textContent:mv(se.scope??"/",y)}],oe=[...yv(t),...ue,...p,...zd(t.$head??[],g)],ee=ly(oe,M,D,{title:I,charset:t.defaults.charset??"utf8",siteName:t.name,siteUrl:t.url,...m.alternates.length>0&&{alternates:m.alternates},...!oo(e.urlPattern)&&{pageUrl:ni(e.urlPattern,t.build.trailingSlash)}});if(t.$media)j.$media={...t.$media,...j.$media};if(Object.values(j.$media??{}).some((fe)=>Sr(String(fe))!==null))ee.splice(2,0,{tagName:"script",textContent:Qs()});let ae=t.images;await ov(j,ae,r,s,o??void 0,u);let ke={lang:R.lang,prePaintScheme:!1,projectStyle:t.style??null,rewriteSrc:(fe)=>Ie(y,c(fe,Wr(e.sourcePath))),serverBaseUrl:nl(y),title:I},U=b["@vue/reactivity"];if(U!==void 0)ke.reactivitySrc=U;let le=b["lit-html"];if(le!==void 0)ke.litHtmlSrc=le;let G=await Qu(j,ke);if(L.rules.length>0)G.html=G.html.replace("</head>",`<style>
500
+ ${Va(L.rules.join(`
501
501
  `))}
502
502
  </style>
503
- </head>`);z.html=ED(z.html,Q,R);let te=(fe)=>typeof fe==="string"&&!fe.startsWith("./")&&!fe.startsWith("../"),Le=[...new Set([...j.$elements??[],...v.$elements??[]].filter((fe)=>te(fe)))];if(Le.length>0)z.html=SD(z.html,g(Le));return{doc:j,excludeFromSitemap:v.$sitemap===!1,files:z.files,html:z.html,unregisteredRelations:Kg(Q),serverEntries:S}}function bD(e,t,r){if(e.length===0)return{connectors:[],mounts:[]};let n=as(r.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in r)s[c]=r[c]}let i=e.map((l)=>{let c=l.server,{module:d}=c;if(!T(d)||d==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let p=Ie(n,c.basePath);return{basePath:p,className:l.classDef.title??l.name,module:d,options:{basePath:p,sections:s},order:c.order??100}}),o=new Set;for(let l of Object.values(s)){if(!ee(l))continue;for(let c of Object.values(l)){let d=ee(c)?c.provider:void 0;if(T(d))o.add(d)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!o.has(c))continue;let{module:d}=l.connector;if(!T(d)||d==="")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:d,provider:c})}return{connectors:a,mounts:i}}async function xD(e,t,r){let n=[];for(let s of e.headProviders()){let i=s.project?.key,o=i===void 0?null:t[i];if(i!==void 0&&(o===void 0||o===null))continue;try{let a=await s.call("head",o??null,{projectConfig:t,root:r});n.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${Ee(a)}`)}}return n}function Bd(e,t){if(Array.isArray(e))return e.map((r)=>Bd(r,t));if(ee(e))return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Bd(n,t)]));if(pe(e))return wt(e,t)??e;return e}function xv(e,t){return e.map((r)=>{if(!F(r))return r;let n={...r};if(n.attributes){n.attributes={...n.attributes};for(let[s,i]of Object.entries(n.attributes))if(pe(i))n.attributes[s]=wt(i,t)??i}if(pe(n.textContent))n.textContent=wt(n.textContent,t)??n.textContent;else if(F(n.textContent))n.textContent=Bd(n.textContent,t);return n})}function Fd(e,t){return e.map((r)=>{if(!F(r)||!r.attributes)return r;let n={...r,attributes:{...r.attributes}};for(let s of["href","src"]){let i=n.attributes[s];if(T(i)&&$D(i))n.attributes[s]=t(i)}return n})}function $D(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function wv(e){return Pv(e).replaceAll("${","&#36;{")}function Sv(e){return e.replaceAll("${","$​{")}function Ev(e,t){if(!F(e))return e;let r={};for(let[n,s]of Object.entries(e))if(n==="children"&&Array.isArray(e.children))r.children=e.children.map((i)=>{if(T(i))return i;return Ev(i,t)});else if(n==="style"&&F(e.style)){let i={...e.style};for(let[o,a]of Object.entries(i))if(pe(a))i[o]=Pl(a,t)??a;r.style=i}else if(n==="attributes"&&F(e.attributes)){let i={...e.attributes};for(let[o,a]of Object.entries(i))if(pe(a)){let l=Pl(a,t);i[o]=T(l)&&l.includes("${")?Sv(l):l??a}r.attributes=i}else if(n==="$props"&&F(e.$props)){let i={...e.$props};for(let[o,a]of Object.entries(i))if(pe(a)){let l=Pl(a,t);i[o]=l!==null?l??null:a}r.$props=i}else if(pe(s)){let i=Pl(s,t);if(n==="textContent"&&T(i)&&i.includes("${"))r.innerHTML=wv(i);else r[n]=i??s}else r[n]=s;return r}function Pl(e,t){try{let r=t.$map,n=F(r)&&"item"in r?r.item:void 0,s=F(r)&&"index"in r?r.index:void 0,i=Ws(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",i)(t,r,n,s)}catch{return null}}function Eo(e,t){if(!F(e))return;if(pe(e.innerHTML)){let s=wt(e.innerHTML,t);if(s!=null)e.innerHTML=String(s).replaceAll("${","&#36;{")}let r=e.textContent;if(pe(r)){let s=wt(r,t);if(T(s)&&s.includes("${"))e.innerHTML=wv(s),delete e.textContent;else e.textContent=s??r}if(F(e.style)){for(let[s,i]of Object.entries(e.style))if(pe(i))e.style[s]=wt(i,t)??i}if(F(e.attributes)){for(let[s,i]of Object.entries(e.attributes))if(pe(i)){let o=wt(i,t);e.attributes[s]=T(o)&&o.includes("${")?Sv(o):o??i}}if(F(e.$props)){let s=e.$props;for(let[i,o]of Object.entries(s))if(pe(o))s[i]=wt(o,t)??o}let n=e.children;if(Qe(n)){let s=$v(n,t);if(s&&s.length>0){e.children=s;return}}if(pe(n)){let s=wt(n,t);if(Array.isArray(s)){let i=s;e.children=i;for(let o of i)Eo(o,t)}}else if(Array.isArray(e.children)){let s=0;while(s<e.children.length){let i=e.children[s];if(pe(i)){let o=wt(i,t);if(Array.isArray(o)){let a=o;e.children.splice(s,1,...a);for(let l of a)Eo(l,t);s+=a.length;continue}}if(Qe(i)){let o=$v(i,t);if(o&&o.length>0){e.children.splice(s,1,...o),s+=o.length;continue}}Eo(i,t),s+=1}}}function vD(e,t){let r=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);return new RegExp(String.raw`\bstate\.${r}\b|#/state/${r}(?=["/])`).test(e)}function $v(e,t){let r=e.items,n=Ce(r)?gu(r.$ref,t):r,s=e.map;if(!Array.isArray(n)||!s)return null;return n.map((o,a)=>{let l=Object.create(t);l.$map={index:a,item:o},l["$map/item"]=o,l["$map/index"]=a;let c=Ev(s,l);return Eo(c,l),c})}function Wd(e,t,r,n,s){if(!F(e))return;if(Array.isArray(e)){for(let a of e)Wd(a,t,r,n,s);return}if(Array.isArray(e.children))for(let a of e.children)Wd(a,t,r,n,s);let{tagName:i}=e;if(!T(i))return;let o=t.get(i);if(o){if(e.attributes){let{lifted:v,rest:j}=Eu(e.attributes);if(v)e.attributes=j,e.$props={...v,...e.$props}}let a=(v)=>{if(r&&F(v)&&!Array.isArray(v))Tn(v,r.rules,r.media,"",r.counter,"jxs");return Gs(v,{},null)},l=ys(o,n),c=e.$props||null,d={componentDefs:t,defaults:n,path:[{key:JSON.stringify(c??{}),tag:i}],slotIds:s},p=Wa(o),{children:h}=e,m=!l&&!p&&Nn(o.children)?wu(d):null,b=l?(Array.isArray(h)?h:[]).map((v)=>a(v)).join(`
504
- `):null,g=tg(o,c,l?null:Su(h,{},a,m),d);if(m!==null)e.attributes={...e.attributes,[to]:String(m)};e.innerHTML=l?`<template shadowrootmode="${l}"><link rel="stylesheet" href="/components/${i}.css">${g}</template>${b??""}`:g,delete e.children;let y=_u(o.style,Ba(o,c));if(Object.keys(y).length>0)e.style={...e.style,...y};if(!p&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,p)e.$static=!0;else e.$prerendered=!0}}function wD(e,t,r=new Map,n=new Set,s="",i={}){let o=(S)=>e.includes(`<${S}`),a=(S)=>s.includes(`<${S}`),l=t.filter((S)=>o(S)||a(S));if(l.length===0)return e;let c=l.flatMap((S)=>{let P=r.get(S);return P===void 0||P===""?[]:[P]}).join(`
505
- `),d=c===""?"":`<style>
506
- ${Ha(c)}
507
- </style>`,p=(S)=>{let P=S.filter(Boolean).join(`
508
- `);return P===""?e:e.replace("</head>",` ${P}
509
- </head>`)},h=l.filter((S)=>a(S)||!n.has(S));if(h.length===0)return p([d]);let m=hv(i),g=[...Ld(i),...h.map((S)=>`/components/${S}.js`)].map((S)=>`<link rel="modulepreload" href="${S}">`).join(`
510
- `),y=e.includes('<script type="importmap">'),v=p([y?"":m,g,d]),j=h.map((S)=>`<script type="module" src="/components/${S}.js"></script>`).join(`
503
+ </head>`);G.html=JD(G.html,ee,R);let te=(fe)=>typeof fe==="string"&&!fe.startsWith("./")&&!fe.startsWith("../"),Le=[...new Set([...j.$elements??[],...v.$elements??[]].filter((fe)=>te(fe)))];if(Le.length>0)G.html=MD(G.html,h(Le));return{doc:j,excludeFromSitemap:v.$sitemap===!1,files:G.files,html:G.html,unregisteredRelations:dy(ee),serverEntries:S}}function OD(e,t,r){if(e.length===0)return{connectors:[],mounts:[]};let n=as(r.url),s={};for(let l of t.projectContributions()){let{key:c}=l.project;if(c in r)s[c]=r[c]}let i=e.map((l)=>{let c=l.server,{module:u}=c;if(!N(u)||u==="")throw Error(`Extension class "${l.name}": server.module (a bare import specifier) is required to generate a deployable worker`);let p=Ie(n,c.basePath);return{basePath:p,className:l.classDef.title??l.name,module:u,options:{basePath:p,sections:s},order:c.order??100}}),o=new Set;for(let l of Object.values(s)){if(!z(l))continue;for(let c of Object.values(l)){let u=z(c)?c.provider:void 0;if(N(u))o.add(u)}}let a=[];for(let l of t.connectors()){let c=String(l.connector.provider);if(!o.has(c))continue;let{module:u}=l.connector;if(!N(u)||u==="")throw Error(`Connector class "${l.name}": connector.module (a bare import specifier) is required to generate a deployable worker`);a.push({className:l.classDef.title??l.name,module:u,provider:c})}return{connectors:a,mounts:i}}async function CD(e,t,r){let n=[];for(let s of e.headProviders()){let i=s.project?.key,o=i===void 0?null:t[i];if(i!==void 0&&(o===void 0||o===null))continue;try{let a=await s.call("head",o??null,{projectConfig:t,root:r});n.push(...a??[])}catch(a){console.warn(`${s.name} head capability failed: ${we(a)}`)}}return n}function Xd(e,t){if(Array.isArray(e))return e.map((r)=>Xd(r,t));if(z(e))return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Xd(n,t)]));if(pe(e))return wt(e,t)??e;return e}function Rv(e,t){return e.map((r)=>{if(!F(r))return r;let n={...r};if(n.attributes){n.attributes={...n.attributes};for(let[s,i]of Object.entries(n.attributes))if(pe(i))n.attributes[s]=wt(i,t)??i}if(pe(n.textContent))n.textContent=wt(n.textContent,t)??n.textContent;else if(F(n.textContent))n.textContent=Xd(n.textContent,t);return n})}function zd(e,t){return e.map((r)=>{if(!F(r)||!r.attributes)return r;let n={...r,attributes:{...r.attributes}};for(let s of["href","src"]){let i=n.attributes[s];if(N(i)&&TD(i))n.attributes[s]=t(i)}return n})}function TD(e){return!e.startsWith("/")&&!e.startsWith("./")&&!e.startsWith("../")&&!e.startsWith("http")&&!e.startsWith("data:")}function Cv(e){return Mv(e).replaceAll("${","&#36;{")}function Tv(e){return e.replaceAll("${","$​{")}function Nv(e,t){if(!F(e))return e;let r={};for(let[n,s]of Object.entries(e))if(n==="children"&&Array.isArray(e.children))r.children=e.children.map((i)=>{if(N(i))return i;return Nv(i,t)});else if(n==="style"&&F(e.style)){let i={...e.style};for(let[o,a]of Object.entries(i))if(pe(a))i[o]=Rl(a,t)??a;r.style=i}else if(n==="attributes"&&F(e.attributes)){let i={...e.attributes};for(let[o,a]of Object.entries(i))if(pe(a)){let l=Rl(a,t);i[o]=N(l)&&l.includes("${")?Tv(l):l??a}r.attributes=i}else if(n==="$props"&&F(e.$props)){let i={...e.$props};for(let[o,a]of Object.entries(i))if(pe(a)){let l=Rl(a,t);i[o]=l!==null?l??null:a}r.$props=i}else if(pe(s)){let i=Rl(s,t);if(n==="textContent"&&N(i)&&i.includes("${"))r.innerHTML=Cv(i);else r[n]=i??s}else r[n]=s;return r}function Rl(e,t){try{let r=t.$map,n=F(r)&&"item"in r?r.item:void 0,s=F(r)&&"index"in r?r.index:void 0,i=Us(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function("state","$map","item","index",i)(t,r,n,s)}catch{return null}}function _o(e,t){if(!F(e))return;if(pe(e.innerHTML)){let s=wt(e.innerHTML,t);if(s!=null)e.innerHTML=String(s).replaceAll("${","&#36;{")}let r=e.textContent;if(pe(r)){let s=wt(r,t);if(N(s)&&s.includes("${"))e.innerHTML=Cv(s),delete e.textContent;else e.textContent=s??r}if(F(e.style)){for(let[s,i]of Object.entries(e.style))if(pe(i))e.style[s]=wt(i,t)??i}if(F(e.attributes)){for(let[s,i]of Object.entries(e.attributes))if(pe(i)){let o=wt(i,t);e.attributes[s]=N(o)&&o.includes("${")?Tv(o):o??i}}if(F(e.$props)){let s=e.$props;for(let[i,o]of Object.entries(s))if(pe(o))s[i]=wt(o,t)??o}let n=e.children;if(Qe(n)){let s=Av(n,t);if(s&&s.length>0){e.children=s;return}}if(pe(n)){let s=wt(n,t);if(Array.isArray(s)){let i=s;e.children=i;for(let o of i)_o(o,t)}}else if(Array.isArray(e.children)){let s=0;while(s<e.children.length){let i=e.children[s];if(pe(i)){let o=wt(i,t);if(Array.isArray(o)){let a=o;e.children.splice(s,1,...a);for(let l of a)_o(l,t);s+=a.length;continue}}if(Qe(i)){let o=Av(i,t);if(o&&o.length>0){e.children.splice(s,1,...o),s+=o.length;continue}}_o(i,t),s+=1}}}function ND(e,t){let r=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);return new RegExp(String.raw`\bstate\.${r}\b|#/state/${r}(?=["/])`).test(e)}function Av(e,t){let r=e.items,n=Ce(r)?$u(r.$ref,t):r,s=e.map;if(!Array.isArray(n)||!s)return null;return n.map((o,a)=>{let l=Object.create(t);l.$map={index:a,item:o},l["$map/item"]=o,l["$map/index"]=a;let c=Nv(s,l);return _o(c,l),c})}function Zd(e,t,r,n,s){if(!F(e))return;if(Array.isArray(e)){for(let a of e)Zd(a,t,r,n,s);return}if(Array.isArray(e.children))for(let a of e.children)Zd(a,t,r,n,s);let{tagName:i}=e;if(!N(i))return;let o=t.get(i);if(o){if(e.attributes){let{lifted:v,rest:j}=ku(e.attributes);if(v)e.attributes=j,e.$props={...v,...e.$props}}let a=(v)=>{if(r&&F(v)&&!Array.isArray(v))Nn(v,r.rules,r.media,"",r.counter,"jxs");return Ks(v,{},null)},l=bs(o,n),c=e.$props||null,u={componentDefs:t,defaults:n,path:[{key:JSON.stringify(c??{}),tag:i}],slotIds:s},p=Ua(o),{children:g}=e,m=!l&&!p&&Tn(o.children)?Pu(u):null,b=l?(Array.isArray(g)?g:[]).map((v)=>a(v)).join(`
504
+ `):null,h=fg(o,c,l?null:ju(g,{},a,m),u);if(m!==null)e.attributes={...e.attributes,[ro]:String(m)};e.innerHTML=l?`<template shadowrootmode="${l}"><link rel="stylesheet" href="/components/${i}.css">${h}</template>${b??""}`:h,delete e.children;let y=Ru(o.style,Wa(o,c));if(Object.keys(y).length>0)e.style={...e.style,...y};if(!p&&e.$props&&Object.keys(e.$props).length>0)e.attributes={...e.attributes,"data-jx-props":JSON.stringify(e.$props)};if(delete e.$props,p)e.$static=!0;else e.$prerendered=!0}}function ID(e,t,r=new Map,n=new Set,s="",i={}){let o=(S)=>e.includes(`<${S}`),a=(S)=>s.includes(`<${S}`),l=t.filter((S)=>o(S)||a(S));if(l.length===0)return e;let c=l.flatMap((S)=>{let _=r.get(S);return _===void 0||_===""?[]:[_]}).join(`
505
+ `),u=c===""?"":`<style>
506
+ ${Va(c)}
507
+ </style>`,p=(S)=>{let _=S.filter(Boolean).join(`
508
+ `);return _===""?e:e.replace("</head>",` ${_}
509
+ </head>`)},g=l.filter((S)=>a(S)||!n.has(S));if(g.length===0)return p([u]);let m=_v(i),h=[...Ud(i),...g.map((S)=>`/components/${S}.js`)].map((S)=>`<link rel="modulepreload" href="${S}">`).join(`
510
+ `),y=e.includes('<script type="importmap">'),v=p([y?"":m,h,u]),j=g.map((S)=>`<script type="module" src="/components/${S}.js"></script>`).join(`
511
511
  `);return v.replace("</body>",` ${j}
512
- </body>`)}function SD(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
513
- </body>`)}function ED(e,t,r){let n=zg(t),s=/<head>([\s\S]*?)<\/head>/i,i=e.match(s),o="";if(i){let l=i[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)o+=`
512
+ </body>`)}function MD(e,t){return e.replace("</body>",` <script type="module" src="${t}"></script>
513
+ </body>`)}function JD(e,t,r){let n=cy(t),s=/<head>([\s\S]*?)<\/head>/i,i=e.match(s),o="";if(i){let l=i[1].match(/<style>[\s\S]*?<\/style>/gi);if(l)o+=`
514
514
  ${l.join(`
515
515
  `)}`;let c=i[1].match(/<script[\s\S]*?<\/script>/gi);if(c)o+=`
516
516
  ${c.join(`
517
517
  `)}`}let a=e;if(s.test(a))a=a.replace(s,`<head>
518
518
  ${n}${o}
519
- </head>`);return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,`lang="${r.lang}"`):l.replace("<html",`<html lang="${r.lang}"`);if(r.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${r.dir}"`):c.replace("<html",`<html dir="${r.dir}"`);return c}),a}function _v(e,t,r){if(e==="/")return Vn(t,"index.html");if(io(e))return Vn(t,"404.html");let n=e.replace(/^\//,"");if(r==="always")return Vn(t,n,"index.html");return Vn(t,`${n}.html`)}function _D(e,t,r={}){let n=0,s=[],i=[],o=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...r.compiledUrls??[]].map((c)=>o(c))),l=r.trailingSlash??"always";for(let[c,d]of Object.entries(e)){let p=T(d)?d:d.destination,h=!T(d)&&"rewrite"in d&&d.rewrite,m=h?200:!T(d)&&("status"in d)?d.status??301:301;if(!h&&!qd.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...qd.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let b=r.basePath??"";if(i.push(`${Ie(b,c)} ${Ie(b,p)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(o(c)))console.warn(`The ${h?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(h)continue;let g=qd.get(String(m));if(!g.html)continue;let y=_v(c,t,l),v=g.canonical?`
520
- <link rel="canonical" href="${Hd(p)}">`:`
519
+ </head>`);return a=a.replace(/<html\s[^>]*>/i,(l)=>{let c=/lang=/.test(l)?l.replace(/lang="[^"]*"/,`lang="${r.lang}"`):l.replace("<html",`<html lang="${r.lang}"`);if(r.dir!==void 0)c=/\sdir=/.test(c)?c.replace(/\sdir="[^"]*"/,` dir="${r.dir}"`):c.replace("<html",`<html dir="${r.dir}"`);return c}),a}function Iv(e,t,r){if(e==="/")return Vn(t,"index.html");if(oo(e))return Vn(t,"404.html");let n=e.replace(/^\//,"");if(r==="always")return Vn(t,n,"index.html");return Vn(t,`${n}.html`)}function DD(e,t,r={}){let n=0,s=[],i=[],o=(c)=>c.length>1&&c.endsWith("/")?c.slice(0,-1):c,a=new Set([...r.compiledUrls??[]].map((c)=>o(c))),l=r.trailingSlash??"always";for(let[c,u]of Object.entries(e)){let p=N(u)?u:u.destination,g=!N(u)&&"rewrite"in u&&u.rewrite,m=g?200:!N(u)&&("status"in u)?u.status??301:301;if(!g&&!Gd.has(String(m))){s.push(`Redirect "${c}" has status ${m}, which is not an RFC 9110 §15.4 redirection `+`status. Use one of ${[...Gd.keys()].join(", ")}, or { destination, rewrite: true } for a proxy.`);continue}let b=r.basePath??"";if(i.push(`${Ie(b,c)} ${Ie(b,p)} ${m}`),c.includes(":")||c.includes("*"))continue;if(a.has(o(c)))console.warn(`The ${g?"rewrite":"redirect"} "${c}" collides with a compiled page at the same route — `+"remove one or the other.");if(g)continue;let h=Gd.get(String(m));if(!h.html)continue;let y=Iv(c,t,l),v=h.canonical?`
520
+ <link rel="canonical" href="${Kd(p)}">`:`
521
521
  <meta name="robots" content="noindex">`,j=`<!DOCTYPE html>
522
522
  <html>
523
523
  <head>
524
524
  <meta charset="utf-8">
525
- <meta http-equiv="refresh" content="0;url=${Hd(p)}">${v}
525
+ <meta http-equiv="refresh" content="0;url=${Kd(p)}">${v}
526
526
  <title>Redirecting...</title>
527
527
  </head>
528
528
  <body>
529
- <p>Redirecting to <a href="${Hd(p)}">${Pv(p)}</a>...</p>
529
+ <p>Redirecting to <a href="${Kd(p)}">${Mv(p)}</a>...</p>
530
530
  </body>
531
- </html>`;Er(Wr(y),{recursive:!0}),hr(y,j,"utf8"),n+=1}if(i.length>0)hr(Vn(t,"_redirects"),`${i.join(`
531
+ </html>`;_r(Wr(y),{recursive:!0}),hr(y,j,"utf8"),n+=1}if(i.length>0)hr(Vn(t,"_redirects"),`${i.join(`
532
532
  `)}
533
- `,"utf8"),n+=1;return{errors:s,files:n}}function Pv(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Hd(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function Vd(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function PD(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function kD(e,t){if(e.length===0)return 0;let r=e.map((i)=>{let o=(i.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${Vd(a.hreflang)}" href="${Vd(a.href)}"/>`).join(`
533
+ `,"utf8"),n+=1;return{errors:s,files:n}}function Mv(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")}function Kd(e){return String(e).replaceAll("&","&amp;").replaceAll('"',"&quot;").replaceAll("<","&lt;")}function Yd(e){return String(e).replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function LD(e){return e.toISOString().replace(/\.\d{3}Z$/,"Z")}function qD(e,t){if(e.length===0)return 0;let r=e.map((i)=>{let o=(i.alternates??[]).map((a)=>` <xhtml:link rel="alternate" hreflang="${Yd(a.hreflang)}" href="${Yd(a.href)}"/>`).join(`
534
534
  `);return` <url>
535
- <loc>${Vd(i.loc)}</loc>
535
+ <loc>${Yd(i.loc)}</loc>
536
536
  <lastmod>${i.lastmod}</lastmod>
537
537
  ${o===""?"":`${o}
538
538
  `} </url>`}).join(`
539
539
  `),s=`<?xml version="1.0" encoding="UTF-8"?>
540
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${jD}"`:""}>
540
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((i)=>(i.alternates?.length??0)>0)?` xmlns:xhtml="${FD}"`:""}>
541
541
  ${r}
542
542
  </urlset>
543
- `;return hr(Vn(t,"sitemap.xml"),s,"utf8"),1}function RD(e,t){let r=Vn(e,"robots.txt"),n=xn(r),s=n?cD(r,"utf8"):`User-agent: *
543
+ `;return hr(Vn(t,"sitemap.xml"),s,"utf8"),1}function HD(e,t){let r=Vn(e,"robots.txt"),n=xn(r),s=n?wD(r,"utf8"):`User-agent: *
544
544
  Allow: /
545
545
  `;if(/^Sitemap:/im.test(s))return 0;if(!s.endsWith(`
546
546
  `))s+=`
547
547
  `;return s+=`
548
548
  Sitemap: ${An("/sitemap.xml",t)}
549
- `,hr(r,s,"utf8"),n?0:1}var bv='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',qd,jD="http://www.w3.org/1999/xhtml";var jv=q(()=>{ve();rr();nr();Cm();zc();Hi();yg();Rg();nn();Og();Tg();qg();Bg();Gg();Yg();ey();xy();lo();Bu();Mr();Us();vy();ev();Ou();iv();Pu();uv();ku();yv();Cd();qd=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as AD}from"node:module";import{join as OD}from"node:path";import{spawn as CD}from"node:child_process";function ND(e){try{return AD(OD(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 kv(e,t,r=CD,n=process){let i=[ND(e),"--root",e];if(t!==void 0)i.push("--port",String(t));let o=r("bun",i,{stdio:"inherit"});return o.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);n.exitCode=1}),n.on("SIGINT",()=>{o.kill("SIGINT")}),n.on("SIGTERM",()=>{o.kill("SIGTERM")}),o.on("exit",(a)=>{n.exitCode=a??0}),o}var Rv=()=>{};import{createServer as TD}from"node:http";import{existsSync as jl,readFileSync as Av,statSync as ID}from"node:fs";import{extname as MD,join as Ud,normalize as JD,resolve as Ov,sep as DD}from"node:path";function FD(e,t){let r=JD(t).replaceAll("\\","/"),n=Ov(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+DD))return null;if(jl(n)){if(ID(n).isDirectory()){let i=Ud(n,"index.html");return jl(i)?i:null}return n}let s=Ud(n,"index.html");return jl(s)?s:null}function Cv(e,t){let r=Ov(e),n=TD((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=FD(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":LD.get(MD(a).toLowerCase())??"application/octet-stream"}),i.end(Av(a));return}let l=Ud(r,"404.html");if(jl(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(Av(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var LD;var Nv=q(()=>{jc();LD=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",...pm}))});var _o="https://jxsuite.com/schema/project/fields/v2",Es="https://jxsuite.com/schema/document/paths/v2",Tv,Iv,Po,zd;var kl=q(()=>{Tv={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"},Iv={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"},Po=[{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"},{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"}],zd={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function qD(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:Lv,$defs:{Fields:{$id:_o,anyOf:[{$ref:`${Mv}#/$defs/JxFieldSchema`},{$ref:`${Mv}#/$defs/RelationshipRef`},...n.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...r.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function ko(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;Gd(s,o);let a=0,l=async(d)=>{let p=jo(d),h=i.get(p);if(h!==void 0)return h;let m;try{m=structuredClone(await t(p))}catch(v){throw Error(`bundleSchema: cannot load $ref target "${p}": ${GD(v)}`,{cause:v})}let b=T(m.$id)&&Bn(m.$id)?m.$id:null;a+=b===null?1:0;let g=b??`urn:jx:bundled:${a}`;if(i.set(p,g),o.has(g))return g;o.add(g),m.$id=g,await c(m,zD(p),!0);let y=s.$defs??={};return y[g]=m,g},c=async(d,p,h=!1)=>{if(Array.isArray(d)){for(let y of d)await c(y,p);return}if(!ee(d))return;let m=d,b=p;if(!h&&T(m.$id)&&Bn(m.$id))b=null;let g=m.$ref;if(T(g)&&b!==null&&!g.startsWith("#")&&!Bn(g)){let y=g.indexOf("#"),v=y===-1?g:g.slice(0,y),j=y===-1?"":g.slice(y);if(v){let S=await l(`${b}/${v}`);m.$ref=`${S}${j}`}}for(let y of Object.values(m))await c(y,b)};await c(s,jo(r),!0);for(let d of n)await l(`${jo(r)}/${d}`);return s}function WD(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*Jv(e,t){for(let r of HD){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(ee(i))yield[i,`${t}/${r}/${s}`]}else if(ee(n))yield[n,`${t}/${r}`]}for(let r of VD){let n=e[r];if(!ee(n))continue;for(let[s,i]of Object.entries(n))if(ee(i))yield[i,`${t}/${r}/${WD(s)}`]}for(let r of BD){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(ee(i))yield[i,`${t}/${r}/${s}`]}}function UD(e,t){let r=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(r.startsWith("//")){let i=r.indexOf("/",2);r=i===-1?"":r.slice(i+1)}r=r.replace(/^schema\//,"");let n=r.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=n;for(let i=2;t.has(s);i+=1)s=`${n}-${i}`;return t.add(s),s}function Ro(e){let t=structuredClone(e);if(ee(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!Bn(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=ee(l)&&T(l.$id)?l.$id:a;o[Bn(a)?UD(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(T(a)&&Bn(a)&&!r.has(a))r.set(a,o);for(let[l,c]of Jv(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(T(l)&&Bn(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(T(c)){let d=c.indexOf("#"),p=d===-1?c:c.slice(0,d),h=d===-1?"":c.slice(d+1);if(p===""){if(h.startsWith("/"))i.$ref=`${a}${h}`}else{let m=r.get(p);if(m!==void 0)i.$ref=h?`${m}${h}`:m}}for(let[d]of Jv(i,a))s(d,a)};return s(t,"#"),t}function Gd(e,t){if(Array.isArray(e)){for(let n of e)Gd(n,t);return}if(!ee(e))return;let r=e;if(T(r.$id)&&Bn(r.$id))t.add(r.$id);for(let n of Object.values(r))Gd(n,t)}function Bn(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function jo(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),n=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(n.length>0&&n.at(-1)!=="..")n.pop();else if(!r)n.push("..");continue}n.push(s)}return(r?"/":"")+n.join("/")}function zD(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function GD(e){return e instanceof Error?e.message:String(e)}function KD(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:Lv,$defs:{PathsValue:{$id:Es,anyOf:[...Po,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function Fv(e){let{baseDir:t,coreDocumentRef:r,coreProjectRef:n,extensions:s,loadJson:i}=e,o=[],a=[],l=[],c=[];for(let h of s){if(h.project)o.push(h.project);if(h.document){let m=await Dv(h.document,i,t);if(a.push(...m),m.length>0)l.push(h.document)}if(h.fields)c.push(...await Dv(h.fields,i,t)),o.push(h.fields)}let d=qD({corePath:n,fieldSchemaRefs:c,fragments:o}),p=KD({corePath:r,pathsValueRefs:a});return{document:Ro(await ko(p,i,t,l)),project:Ro(await ko(d,i,t))}}async function Dv(e,t,r){let n;try{n=await t(jo(`${jo(r)}/${e}`))}catch{return[]}let{$id:s}=n;if(!T(s)||!n.$defs)return[];return Object.keys(n.$defs).map((i)=>`${s}#/$defs/${i}`)}var Mv="https://jxsuite.com/schema/project/core/v2",Lv="Generated by `jx schema` from project.json#/extensions — do not edit.",HD,VD,BD;var qv=q(()=>{kl();ve();kl();HD=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],VD=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],BD=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as Bv,readFileSync as YD,statSync as Hv,writeFileSync as Rl}from"node:fs";import{createRequire as Yd}from"node:module";import{dirname as XD,isAbsolute as ZD,relative as Xd,resolve as $n,sep as Zd}from"node:path";async function Wv(e){let{config:t}=Rn(e),r=await kn(e,t),n=$n(e),{document:s,project:i}=await Fv({baseDir:n,coreDocumentRef:Vv(e,eL),coreProjectRef:Vv(e,QD),extensions:r.extensions.map((o)=>({document:o.schemas.document&&Kd(e,o,o.schemas.document),fields:o.schemas.fields&&Kd(e,o,o.schemas.fields),project:o.schemas.project&&Kd(e,o,o.schemas.project)})),loadJson:Gv(n)});return{documentSchema:s,projectSchema:i}}async function Uv(e){let{documentSchema:t,projectSchema:r}=await Wv(e),n=$n(e,"project.schema.json"),s=$n(e,"document.schema.json");return Rl(n,`${JSON.stringify(r,null,2)}
550
- `,"utf8"),Rl(s,`${JSON.stringify(t,null,2)}
551
- `,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function zv(e,t={}){let{write:r=!0}=t,n=$n(e),s=$n(n,"project.json"),i=$n(n,"project.schema.json"),o=$n(n,"document.schema.json"),a=(g)=>{if(!Bv(g))return!0;try{return Hv(s).mtimeMs>Hv(g).mtimeMs}catch{return!1}},c=a(i)||a(o)?await Wv(n):null;if(c&&r)Rl(i,`${JSON.stringify(c.projectSchema,null,2)}
552
- `,"utf8"),Rl(o,`${JSON.stringify(c.documentSchema,null,2)}
553
- `,"utf8");let d=Gv(n),p=c?.projectSchema??Ao(i),h=c?.documentSchema??Ao(o),m=Ro(await ko(p,d,n));return{document:Ro(await ko(h,d,n)),project:m}}function Ao(e){let t=JSON.parse(YD(e,"utf8"));if(!ee(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function rL(e){return e.startsWith(tL)&&e.endsWith(".json")}function nL(e,t){try{return Yd(import.meta.url).resolve(e)}catch(r){throw Error(`Schema ref "${t}" names the core schema "${e}", which must resolve from the host workspace and does not. The project's own copy is deliberately not consulted, so the host install is missing "${e.split("/").slice(0,2).join("/")}" — check that `+"the package ships with this build",{cause:r})}}function Gv(e){return async(t)=>{let r=$n(t),n=Xd(e,r);if(n.startsWith("..")||ZD(n))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=n.split(Zd).join("/"),i="node_modules/",o=s.lastIndexOf(i),a=o===-1?null:s.slice(o+i.length);if(a!==null&&rL(a))return Ao(nL(a,t));if(Bv(r))return Ao(r);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=Cc(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 Ao(l)}}function Vv(e,t){let r=null;try{r=Yd($n(e,"package.json")).resolve(t)}catch{try{r=Yd(import.meta.url).resolve(t)}catch{r=null}}let n=`./node_modules/${t}`;return r?Kv(e,r,n):n}function Kd(e,t,r){let n=Xd(XD(t.manifestPath),r).split(Zd).join("/"),s=`./node_modules/${t.specifier}/${n}`;return Kv(e,r,s)}function Kv(e,t,r){let n=Xd(e,t).split(Zd).join("/");if(n.startsWith(".."))return r;return n.startsWith("./")?n:`./${n}`}var QD="@jxsuite/schema/schemas/project.core.schema.json",eL="@jxsuite/schema/schema.json",tL="@jxsuite/schema/";var Qd=q(()=>{qv();ve();nn();Hi()});var Qv=C(function(BY,Zv){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",Yv=Ne("fs").promises,Xv=Ne("path");async function sL({folder:e=__dirname}={}){let t={},r=await Yv.readdir(e);for(let n of r)if(n.endsWith(".json")&&n!=="package.json"){let s=await Yv.readFile(Xv.join(e,n),"utf8");t[Xv.basename(n,".json")]=JSON.parse(s)}return t}Zv.exports={listAll:sL}});var rw=C(function(WY,tw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",iL=Ne("fs").promises,oL=Ne("path");async function ew({folder:e=__dirname}={}){let t=await iL.readFile(oL.join(e,"css.json"),"utf8");return JSON.parse(t)}async function aL({folder:e=__dirname}={}){let t=await ew(e),r={};for(let[n,s]of Object.entries(t)){r[n]={};for(let i of s){let o=i.name,a=null;if(i.for)a=s.find((l)=>l!==i&&l.name===i.name);if(a)o+=" for "+i.for[0];if(r[n][o]=i,i.descriptors){let l=i.descriptors;i.descriptors={};for(let c of l)i.descriptors[c.name]=c}}}return r}tw.exports={listAll:ew,index:aL}});var nw=C(function(Al,ef){(function(e,t){typeof Al=="object"&&typeof ef=="object"?ef.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Al=="object"?Al.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,x)=>{for(var w in x)e.o(x,w)&&!e.o(f,w)&&Object.defineProperty(f,w,{enumerable:!0,get:x[w]})},o:(f,x)=>Object.prototype.hasOwnProperty.call(f,x),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function r(f,x,w,_,A,{level:B="error",autofix:Y,ruleName:de}={}){function ce(Qt){return Qt>0?f.slice(x,x+Qt):f.slice(Math.max(x+Qt,0),x)}function ge(Qt,{precedes:rs}={}){let en=Qt.map((Li)=>Li.trivia+Li.value).join(""),Di=f[x];return Di.type==="eof"?en:rs?en+Di.trivia:en.slice(Di.trivia.length)}let _e=f[x].type!=="eof"?f[x].line:f.length>1?f[x-1].line:1,Ae=function(Qt){let rs=Qt.split(`
554
- `);return rs[rs.length-1]}(ge(ce(-5),{precedes:!0})),jt=ce(5),Dt=ge(jt),Ji=Ae+Dt.split(`
549
+ `,hr(r,s,"utf8"),n?0:1}var kv='set build.adapter to "cloudflare-workers", "cloudflare-pages", "node", or "bun".',Gd,FD="http://www.w3.org/1999/xhtml";var Jv=q(()=>{$e();nr();sr();Lm();Yc();Vi();Tg();Wg();nn();zg();Yg();ny();oy();uy();fy();Nu();Oy();co();Zu();Mr();zs();Mu();uv();Lu();hv();Au();$v();Cu();jv();Ld();Gd=new Map([["301",{canonical:!0,html:!0,why:""}],["302",{canonical:!1,html:!0,why:""}],["303",{canonical:!1,html:!0,why:""}],["307",{canonical:!1,html:!1,why:"307 preserves the request method and body; a meta-refresh silently converts POST to GET"}],["308",{canonical:!1,html:!1,why:"308 preserves the request method and body; a meta-refresh silently converts POST to GET"}]])});import{createRequire as VD}from"node:module";import{join as BD}from"node:path";import{spawn as WD}from"node:child_process";function UD(e){try{return VD(BD(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 Dv(e,t,r=WD,n=process){let i=[UD(e),"--root",e];if(t!==void 0)i.push("--port",String(t));let o=r("bun",i,{stdio:"inherit"});return o.on("error",(a)=>{if(a.code==="ENOENT")console.error("The Jx dev server runs on Bun, which was not found on your PATH. Install it from https://bun.sh and retry.");else console.error(`Failed to start the dev server: ${a.message}`);n.exitCode=1}),n.on("SIGINT",()=>{o.kill("SIGINT")}),n.on("SIGTERM",()=>{o.kill("SIGTERM")}),o.on("exit",(a)=>{n.exitCode=a??0}),o}var Lv=()=>{};import{createServer as zD}from"node:http";import{existsSync as Al,readFileSync as Fv,statSync as GD}from"node:fs";import{extname as KD,join as Qd,normalize as YD,resolve as qv,sep as XD}from"node:path";function QD(e,t){let r=YD(t).replaceAll("\\","/"),n=qv(e,`.${r.startsWith("/")?r:`/${r}`}`);if(n!==e&&!n.startsWith(e+XD))return null;if(Al(n)){if(GD(n).isDirectory()){let i=Qd(n,"index.html");return Al(i)?i:null}return n}let s=Qd(n,"index.html");return Al(s)?s:null}function Hv(e,t){let r=qv(e),n=zD((s,i)=>{let o=new URL(s.url??"/","http://localhost"),a=QD(r,decodeURIComponent(o.pathname));if(a){i.writeHead(200,{"Content-Type":ZD.get(KD(a).toLowerCase())??"application/octet-stream"}),i.end(Fv(a));return}let l=Qd(r,"404.html");if(Al(l)){i.writeHead(404,{"Content-Type":"text/html; charset=utf-8"}),i.end(Fv(l));return}i.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),i.end("Not found")});return n.listen(t),n}var ZD;var Vv=q(()=>{Ac();ZD=new Map(Object.entries({".avif":"image/avif",".css":"text/css; charset=utf-8",".gif":"image/gif",".html":"text/html; charset=utf-8",".ico":"image/x-icon",".jpeg":"image/jpeg",".jpg":"image/jpeg",".js":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".png":"image/png",".svg":"image/svg+xml",".txt":"text/plain; charset=utf-8",".webp":"image/webp",".woff2":"font/woff2",".xml":"application/xml; charset=utf-8",...$m}))});var Po="https://jxsuite.com/schema/project/fields/v2",_s="https://jxsuite.com/schema/document/paths/v2",Bv,Wv,jo,ef;var Ol=q(()=>{Bv={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"},Wv={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"},jo=[{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"}],ef={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});function eL(e){let{corePath:t,fragments:r,fieldSchemaRefs:n=[]}=e;return{$comment:Kv,$defs:{Fields:{$id:Po,anyOf:[{$ref:`${Uv}#/$defs/JxFieldSchema`},{$ref:`${Uv}#/$defs/RelationshipRef`},...n.map((s)=>({$ref:s}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t},...r.map((s)=>({$ref:s}))],type:"object",unevaluatedProperties:!1}}async function Ro(e,t,r,n=[]){let s=structuredClone(e),i=new Map,o=new Set;tf(s,o);let a=0,l=async(u)=>{let p=ko(u),g=i.get(p);if(g!==void 0)return g;let m;try{m=structuredClone(await t(p))}catch(v){throw Error(`bundleSchema: cannot load $ref target "${p}": ${aL(v)}`,{cause:v})}let b=N(m.$id)&&Bn(m.$id)?m.$id:null;a+=b===null?1:0;let h=b??`urn:jx:bundled:${a}`;if(i.set(p,h),o.has(h))return h;o.add(h),m.$id=h,await c(m,oL(p),!0);let y=s.$defs??={};return y[h]=m,h},c=async(u,p,g=!1)=>{if(Array.isArray(u)){for(let y of u)await c(y,p);return}if(!z(u))return;let m=u,b=p;if(!g&&N(m.$id)&&Bn(m.$id))b=null;let h=m.$ref;if(N(h)&&b!==null&&!h.startsWith("#")&&!Bn(h)){let y=h.indexOf("#"),v=y===-1?h:h.slice(0,y),j=y===-1?"":h.slice(y);if(v){let S=await l(`${b}/${v}`);m.$ref=`${S}${j}`}}for(let y of Object.values(m))await c(y,b)};await c(s,ko(r),!0);for(let u of n)await l(`${ko(r)}/${u}`);return s}function sL(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function*zv(e,t){for(let r of tL){let n=e[r];if(Array.isArray(n)){for(let[s,i]of n.entries())if(z(i))yield[i,`${t}/${r}/${s}`]}else if(z(n))yield[n,`${t}/${r}`]}for(let r of rL){let n=e[r];if(!z(n))continue;for(let[s,i]of Object.entries(n))if(z(i))yield[i,`${t}/${r}/${sL(s)}`]}for(let r of nL){let n=e[r];if(!Array.isArray(n))continue;for(let[s,i]of n.entries())if(z(i))yield[i,`${t}/${r}/${s}`]}}function iL(e,t){let r=e.replace(/^[a-zA-Z][a-zA-Z\d+.-]*:/,"");if(r.startsWith("//")){let i=r.indexOf("/",2);r=i===-1?"":r.slice(i+1)}r=r.replace(/^schema\//,"");let n=r.split(/[^a-zA-Z0-9]+/).filter(Boolean).join("-")||"resource",s=n;for(let i=2;t.has(s);i+=1)s=`${n}-${i}`;return t.add(s),s}function Ao(e){let t=structuredClone(e);if(z(t.$defs)){let i=new Set(Object.keys(t.$defs).filter((a)=>!Bn(a))),o={};for(let[a,l]of Object.entries(t.$defs)){let c=z(l)&&N(l.$id)?l.$id:a;o[Bn(a)?iL(c,i):a]=l}t.$defs=o}let r=new Map,n=(i,o)=>{let{$id:a}=i;if(N(a)&&Bn(a)&&!r.has(a))r.set(a,o);for(let[l,c]of zv(i,o))n(l,c)};n(t,"#");let s=(i,o)=>{let a=o,{$id:l}=i;if(N(l)&&Bn(l)){if(a=r.get(l)??o,a!=="#")delete i.$id}let c=i.$ref;if(N(c)){let u=c.indexOf("#"),p=u===-1?c:c.slice(0,u),g=u===-1?"":c.slice(u+1);if(p===""){if(g.startsWith("/"))i.$ref=`${a}${g}`}else{let m=r.get(p);if(m!==void 0)i.$ref=g?`${m}${g}`:m}}for(let[u]of zv(i,a))s(u,a)};return s(t,"#"),t}function tf(e,t){if(Array.isArray(e)){for(let n of e)tf(n,t);return}if(!z(e))return;let r=e;if(N(r.$id)&&Bn(r.$id))t.add(r.$id);for(let n of Object.values(r))tf(n,t)}function Bn(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)}function ko(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),n=[];for(let s of t.split("/")){if(s===""||s===".")continue;if(s===".."){if(n.length>0&&n.at(-1)!=="..")n.pop();else if(!r)n.push("..");continue}n.push(s)}return(r?"/":"")+n.join("/")}function oL(e){let t=e.lastIndexOf("/");if(t===-1)return".";return t===0?"/":e.slice(0,t)}function aL(e){return e instanceof Error?e.message:String(e)}function lL(e){let{corePath:t,pathsValueRefs:r}=e;return{$comment:Kv,$defs:{PathsValue:{$id:_s,anyOf:[...jo,...r.map((n)=>({$ref:n}))]}},$schema:"https://json-schema.org/draft/2020-12/schema",allOf:[{$ref:t}]}}async function Yv(e){let{baseDir:t,coreDocumentRef:r,coreProjectRef:n,extensions:s,loadJson:i}=e,o=[],a=[],l=[],c=[];for(let g of s){if(g.project)o.push(g.project);if(g.document){let m=await Gv(g.document,i,t);if(a.push(...m),m.length>0)l.push(g.document)}if(g.fields)c.push(...await Gv(g.fields,i,t)),o.push(g.fields)}let u=eL({corePath:n,fieldSchemaRefs:c,fragments:o}),p=lL({corePath:r,pathsValueRefs:a});return{document:Ao(await Ro(p,i,t,l)),project:Ao(await Ro(u,i,t))}}async function Gv(e,t,r){let n;try{n=await t(ko(`${ko(r)}/${e}`))}catch{return[]}let{$id:s}=n;if(!N(s)||!n.$defs)return[];return Object.keys(n.$defs).map((i)=>`${s}#/$defs/${i}`)}var Uv="https://jxsuite.com/schema/project/core/v2",Kv="Generated by `jx schema` from project.json#/extensions — do not edit.",tL,rL,nL;var Xv=q(()=>{Ol();$e();Ol();tL=["additionalItems","additionalProperties","contains","contentSchema","else","if","items","not","propertyNames","then","unevaluatedItems","unevaluatedProperties"],rL=["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"],nL=["allOf","anyOf","oneOf","prefixItems"]});import{existsSync as ew,readFileSync as cL,statSync as Zv,writeFileSync as Cl}from"node:fs";import{createRequire as nf}from"node:module";import{dirname as uL,isAbsolute as dL,relative as sf,resolve as $n,sep as of}from"node:path";async function tw(e){let{config:t}=Rn(e),r=await kn(e,t),n=$n(e),{document:s,project:i}=await Yv({baseDir:n,coreDocumentRef:Qv(e,pL),coreProjectRef:Qv(e,fL),extensions:r.extensions.map((o)=>({document:o.schemas.document&&rf(e,o,o.schemas.document),fields:o.schemas.fields&&rf(e,o,o.schemas.fields),project:o.schemas.project&&rf(e,o,o.schemas.project)})),loadJson:sw(n)});return{documentSchema:s,projectSchema:i}}async function rw(e){let{documentSchema:t,projectSchema:r}=await tw(e),n=$n(e,"project.schema.json"),s=$n(e,"document.schema.json");return Cl(n,`${JSON.stringify(r,null,2)}
550
+ `,"utf8"),Cl(s,`${JSON.stringify(t,null,2)}
551
+ `,"utf8"),{documentSchemaPath:s,projectSchemaPath:n}}async function nw(e,t={}){let{write:r=!0}=t,n=$n(e),s=$n(n,"project.json"),i=$n(n,"project.schema.json"),o=$n(n,"document.schema.json"),a=(h)=>{if(!ew(h))return!0;try{return Zv(s).mtimeMs>Zv(h).mtimeMs}catch{return!1}},c=a(i)||a(o)?await tw(n):null;if(c&&r)Cl(i,`${JSON.stringify(c.projectSchema,null,2)}
552
+ `,"utf8"),Cl(o,`${JSON.stringify(c.documentSchema,null,2)}
553
+ `,"utf8");let u=sw(n),p=c?.projectSchema??Oo(i),g=c?.documentSchema??Oo(o),m=Ao(await Ro(p,u,n));return{document:Ao(await Ro(g,u,n)),project:m}}function Oo(e){let t=JSON.parse(cL(e,"utf8"));if(!z(t))throw TypeError(`Schema file "${e}" is not a JSON object`);return t}function hL(e){return e.startsWith(mL)&&e.endsWith(".json")}function gL(e,t){try{return nf(import.meta.url).resolve(e)}catch(r){throw Error(`Schema ref "${t}" names the core schema "${e}", which must resolve from the host workspace and does not. The project's own copy is deliberately not consulted, so the host install is missing "${e.split("/").slice(0,2).join("/")}" — check that `+"the package ships with this build",{cause:r})}}function sw(e){return async(t)=>{let r=$n(t),n=sf(e,r);if(n.startsWith("..")||dL(n))throw Error(`Schema ref "${t}" escapes the project root ${e}`);let s=n.split(of).join("/"),i="node_modules/",o=s.lastIndexOf(i),a=o===-1?null:s.slice(o+i.length);if(a!==null&&hL(a))return Oo(gL(a,t));if(ew(r))return Oo(r);if(a===null)throw Error(`Schema ref "${t}" does not exist`);let l;try{l=Ic(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 Oo(l)}}function Qv(e,t){let r=null;try{r=nf($n(e,"package.json")).resolve(t)}catch{try{r=nf(import.meta.url).resolve(t)}catch{r=null}}let n=`./node_modules/${t}`;return r?iw(e,r,n):n}function rf(e,t,r){let n=sf(uL(t.manifestPath),r).split(of).join("/"),s=`./node_modules/${t.specifier}/${n}`;return iw(e,r,s)}function iw(e,t,r){let n=sf(e,t).split(of).join("/");if(n.startsWith(".."))return r;return n.startsWith("./")?n:`./${n}`}var fL="@jxsuite/schema/schemas/project.core.schema.json",pL="@jxsuite/schema/schema.json",mL="@jxsuite/schema/";var af=q(()=>{Xv();$e();nn();Vi()});var cw=C(function(lX,lw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/elements",ow=Te("fs").promises,aw=Te("path");async function yL({folder:e=__dirname}={}){let t={},r=await ow.readdir(e);for(let n of r)if(n.endsWith(".json")&&n!=="package.json"){let s=await ow.readFile(aw.join(e,n),"utf8");t[aw.basename(n,".json")]=JSON.parse(s)}return t}lw.exports={listAll:yL}});var fw=C(function(cX,dw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/css",bL=Te("fs").promises,xL=Te("path");async function uw({folder:e=__dirname}={}){let t=await bL.readFile(xL.join(e,"css.json"),"utf8");return JSON.parse(t)}async function $L({folder:e=__dirname}={}){let t=await uw(e),r={};for(let[n,s]of Object.entries(t)){r[n]={};for(let i of s){let o=i.name,a=null;if(i.for)a=s.find((l)=>l!==i&&l.name===i.name);if(a)o+=" for "+i.for[0];if(r[n][o]=i,i.descriptors){let l=i.descriptors;i.descriptors={};for(let c of l)i.descriptors[c.name]=c}}}return r}dw.exports={listAll:uw,index:$L}});var pw=C(function(Tl,lf){(function(e,t){typeof Tl=="object"&&typeof lf=="object"?lf.exports=t():typeof define=="function"&&define.amd?define([],t):typeof Tl=="object"?Tl.WebIDL2=t():e.WebIDL2=t()})(globalThis,()=>(()=>{var e={d:(f,x)=>{for(var w in x)e.o(x,w)&&!e.o(f,w)&&Object.defineProperty(f,w,{enumerable:!0,get:x[w]})},o:(f,x)=>Object.prototype.hasOwnProperty.call(f,x),r:(f)=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(f,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(f,"__esModule",{value:!0})}},t={};function r(f,x,w,P,A,{level:B="error",autofix:X,ruleName:de}={}){function ce(er){return er>0?f.slice(x,x+er):f.slice(Math.max(x+er,0),x)}function ge(er,{precedes:rs}={}){let en=er.map((Fi)=>Fi.trivia+Fi.value).join(""),Li=f[x];return Li.type==="eof"?en:rs?en+Li.trivia:en.slice(Li.trivia.length)}let _e=f[x].type!=="eof"?f[x].line:f.length>1?f[x-1].line:1,Ae=function(er){let rs=er.split(`
554
+ `);return rs[rs.length-1]}(ge(ce(-5),{precedes:!0})),jt=ce(5),Dt=ge(jt),Di=Ae+Dt.split(`
555
555
  `)[0]+`
556
- `+(" ".repeat(Ae.length)+"^"),Ec=A==="Syntax"?"since":"inside",Hp=`${A} error at line ${_e}${f.name?` in ${f.name}`:""}${w&&w.name?`, ${Ec} \`${w.partial?"partial ":""}${function(Qt){let rs=[Qt];for(;Qt&&Qt.parent;){let{parent:en}=Qt;rs.unshift(en),Qt=en}return rs.map((en)=>function(Di,Li){let Vp=Di;return Li&&(Vp+=` ${Li}`),Vp}(en.type,en.name)).join(" -> ")}(w)}\``:""}:
557
- ${Ji}`;return{message:`${Hp} ${_}`,bareMessage:_,context:Hp,line:_e,sourceName:f.name,level:B,ruleName:de,autofix:Y,input:Dt,tokens:jt}}function n(f,x,w,_){return r(f,x,w,_,"Syntax")}function s(f,x,w,_,A={}){return A.ruleName=w,r(x.source,f.index,x,_,"Validation",A)}e.r(t),e.d(t,{WebIDLParseError:()=>Ue,parse:()=>Or,validate:()=>Zt,write:()=>xt});class i{constructor({source:f,tokens:x}){Object.defineProperties(this,{source:{value:f},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let w=Object.getOwnPropertyDescriptors(x);for(let[_,A]of Object.entries(w))(A.enumerable||A.get)&&(f[_]=this[_]);x=Object.getPrototypeOf(x)}return f}}function o(f,x,{useNullableInner:w}={}){if(!f.union){let _=x.unique.get(f.idlType);if(!_)return;if(_.type==="typedef"){let{typedefIncludesDictionary:A}=x.cache;if(A.has(_))return A.get(_);x.cache.typedefIncludesDictionary.set(_,void 0);let B=o(_.idlType,x);if(x.cache.typedefIncludesDictionary.set(_,B),B)return{reference:f,dictionary:B.dictionary}}if(_.type==="dictionary"&&(w||!f.nullable))return{reference:f,dictionary:_}}for(let _ of f.subtype){let A=o(_,x);if(A)return _.union?A:{reference:_,dictionary:A.dictionary}}}function a(f,x){if(x.cache.dictionaryIncludesRequiredField.has(f))return x.cache.dictionaryIncludesRequiredField.get(f);x.cache.dictionaryIncludesRequiredField.set(f,void 0);let w=f.members.some((_)=>_.required);if(!w&&f.inheritance){let _=x.unique.get(f.inheritance);_?a(_,x)&&(w=!0):w=!0}return x.cache.dictionaryIncludesRequiredField.set(f,w),w}class l extends Array{constructor({source:f,tokens:x}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(f,x){return()=>{let w=f.consumeKind(x);if(w)return new c({source:f.source,tokens:{value:w}})}}get value(){return M(this.tokens.value.value)}write(f){return f.ts.wrap([f.token(this.tokens.value),f.token(this.tokens.separator)])}}class d extends c{static parse(f){let x=f.consumeKind("eof");if(x)return new d({source:f.source,tokens:{value:x}})}get type(){return"eof"}}function p(f,x){return L(f,{parser:c.parser(f,x),listName:x+" list"})}let h=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function b(f){for(let x of h){let w=p(f,x);if(w.length)return w}f.error("Expected identifiers, strings, decimals, or integers but none found")}class g extends i{static parse(f){let x={assign:f.consume("=")},w=te(new g({source:f.source,tokens:x}));if(w.list=[],x.assign){if(x.asterisk=f.consume("*"),x.asterisk)return w.this;x.secondaryName=f.consumeKind(...h)}return x.open=f.consume("("),x.open?(w.list=w.rhsIsList?b(f):oe(f),x.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&f.error("No right hand side to extended attribute assignment"),w.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:x}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((w)=>x==="identifier-list"?f.identifier(w,this.parent):w.write(f)),f.token(this.tokens.close)])}}class y extends i{static parse(f){let x=f.consumeKind("identifier");if(x)return new y({source:f.source,tokens:{name:x},params:g.parse(f)})}constructor({source:f,tokens:x,params:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"params",{value:w})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:x,list:w}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?w:this.params.tokens.secondaryName?M(x.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:x}=this.params;return!x||f?[]:x}*validate(f){let{name:x}=this;if(x==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(x)){let _=`\`[${x}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(x)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",_,{level:"warning",autofix:(w=this,()=>{let{name:A}=w;w.tokens.name.value=m.get(A),A==="TreatNullAs"&&(w.params.tokens={})})})}var w;for(let _ of this.arguments)yield*_.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 v extends l{static parse(f){let x={};x.open=f.consume("[");let w=new v({source:f.source,tokens:x});return x.open?(w.push(...L(f,{parser:y.parse,listName:"extended attribute"})),x.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),w.length||(f.unconsume(x.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),w):w}*validate(f){for(let x of this)yield*x.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((x)=>x.write(f)),f.token(this.tokens.close)]):""}}function j(f,x){let w=f.consume("?");w&&(x.tokens.nullable=w),f.probe("?")&&f.error("Can't nullable more than once")}function S(f,x){let w=function(_,A){let B=_.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!B)return;let Y=te(new P({source:_.source,tokens:{base:B}}));switch(Y.tokens.open=_.consume("<")||_.error(`No opening bracket after ${B.value}`),B.value){case"Promise":{_.probe("[")&&_.error("Promise type cannot have extended attribute");let de=ae(_,A)||_.error("Missing Promise subtype");Y.subtype.push(de);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let de=Q(_,A)||_.error(`Missing ${B.value} subtype`);Y.subtype.push(de);break}case"record":{_.probe("[")&&_.error("Record key cannot have extended attribute");let de=_.consume(...Be)||_.error(`Record key must be one of: ${Be.join(", ")}`),ce=new P({source:_.source,tokens:{base:de}});ce.tokens.separator=_.consume(",")||_.error("Missing comma after record key type"),ce.type=A;let ge=Q(_,A)||_.error("Error parsing generic type record");Y.subtype.push(ce,ge);break}}return Y.idlType||_.error(`Error parsing generic type ${B.value}`),Y.tokens.close=_.consume(">")||_.error(`Missing closing bracket after ${B.value}`),Y.this}(f,x)||ue(f);if(!w){let _=f.consumeKind("identifier")||f.consume(...Be,...fe);if(!_)return;w=new P({source:f.source,tokens:{base:_}}),f.probe("<")&&f.error(`Unsupported generic type ${_.value}`)}return w.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),w.type=x||null,j(f,w),w.nullable&&w.idlType==="any"&&f.error("Type `any` cannot be made nullable"),w}class P extends i{static parse(f,x){return S(f,x)||function(w,_){let A={};if(A.open=w.consume("("),!A.open)return;let B=te(new P({source:w.source,tokens:A}));for(B.type=_||null;;){let Y=Q(w,_)||w.error("No type after open parenthesis or 'or' in union type");Y.idlType==="any"&&w.error("Type `any` cannot be included in a union type"),Y.generic==="Promise"&&w.error("Type `Promise` cannot be included in a union type"),B.subtype.push(Y);let de=w.consume("or");if(!de)break;Y.tokens.separator=de}return B.idlType.length<2&&w.error("At least two types are expected in a union type but found less"),A.close=w.consume(")")||w.error("Unterminated union type"),j(w,B),B.this}(f,x)}constructor({source:f,tokens:x}){super({source:f,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new v({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 M([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 A of[this.extAttrs,this.parent?.extAttrs])for(let B of A){if(B.name!=="AllowShared")continue;let Y="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",Y,{autofix:E(this,B,A)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(x=this,()=>{x.tokens.base.value="undefined"})});var x;let w=!this.union&&f.unique.get(this.idlType),_=this.union?this:w&&w.type==="typedef"?w.idlType:void 0;if(_&&this.nullable){let{reference:A}=o(_,f)||{};if(A){let B=(this.union?A:this).tokens.base;yield s(B,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let A of this.subtype)yield*A.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((A)=>A.write(f)),f.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,w=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],_=f.reference(f.ts.wrap([...w,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(x.trivia),_])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function E(f,x,w){return()=>{let _=w.indexOf(x);w.splice(_,1),!w.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends i{static parse(f){let x=f.consume("=");if(!x)return null;let w=W(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),_=[w];if(w.value==="["){let A=f.consume("]")||f.error("Default sequence value must be empty");_.push(A)}else if(w.value==="{"){let A=f.consume("}")||f.error("Default dictionary value must be empty");_.push(A)}return new O({source:f.source,tokens:{assign:x},expression:_})}constructor({source:f,tokens:x,expression:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"expression",{value:w})}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((x)=>f.token(x))])}}class R extends i{static parse(f){let x=f.position,w={},_=te(new R({source:f.source,tokens:w}));return _.extAttrs=v.parse(f),w.optional=f.consume("optional"),_.idlType=Q(f,"argument-type"),_.idlType?(w.optional||(w.variadic=f.consume("...")),w.name=f.consumeKind("identifier")||f.consume(...G),w.name?(_.default=w.optional?O.parse(f):null,_.this):f.unconsume(x)):f.unconsume(x)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let x=o(this.idlType,f,{useNullableInner:!0});if(x){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:k(this)})}else if(this.parent&&!a(x.dictionary,f)&&function(_){let A=_.parent.arguments||_.parent.list,B=A.indexOf(_);return!A.slice(B+1).some((de)=>!de.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(w=this,()=>{let A=z(w.idlType);w.tokens.optional={...A,type:"optional",value:"optional"},A.trivia=" ",k(w)()})})}var w}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function k(f){return()=>{f.default=O.parse(new ut(" = {}"))}}class I extends i{static parse(f,{special:x,regular:w}={}){let _={special:x},A=te(new I({source:f.source,tokens:_}));return x&&x.value==="stringifier"&&(_.termination=f.consume(";"),_.termination)?(A.arguments=[],A):(x||w||(_.special=f.consume("getter","setter","deleter")),A.idlType=ae(f)||f.error("Missing return type"),_.name=f.consumeKind("identifier")||f.consume("includes"),_.open=f.consume("(")||f.error("Invalid operation"),A.arguments=oe(f),_.close=f.consume(")")||f.error("Unterminated operation"),_.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),A.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?M(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 x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this,w=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((_)=>_.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:x}),...w,f.token(this.tokens.termination)]),{data:this,parent:x})}}class D extends i{static parse(f,{special:x,noInherit:w=!1,readonly:_=!1}={}){let A=f.position,B={special:x},Y=te(new D({source:f.source,tokens:B}));if(x||w||(B.special=f.consume("inherit")),Y.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),B.readonly=f.consume("readonly"),_&&!B.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),B.base=f.consume("attribute"),B.base)return Y.idlType=Q(f,"attribute-type")||f.error("Attribute lacks a type"),B.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),B.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),Y.this;f.unconsume(A)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return M(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 x=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",x)}{let{reference:x}=o(this.idlType,f)||{};if(x){let w=(this.idlType.union?x:this.idlType).tokens.base;yield s(w,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(x,w){if(x.union)return!1;if(x.extAttrs.some((A)=>A.name==="EnforceRange"))return!0;let _=w.unique.get(x.idlType);return _?.type==="typedef"&&_.idlType.extAttrs.some((A)=>A.name==="EnforceRange")}(this.idlType,f)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:x}=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:x}),f.token(this.tokens.termination)]),{data:this,parent:x})}}function M(f){return f.startsWith("_")?f.slice(1):f}function L(f,{parser:x,allowDangler:w,listName:_="list"}){let A=x(f);if(!A)return[];A.tokens.separator=f.consume(",");let B=[A];for(;A.tokens.separator;){let Y=x(f);if(!Y){w||f.error(`Trailing comma in ${_}`);break}if(Y.tokens.separator=f.consume(","),B.push(Y),!Y.tokens.separator)break}return B}function W(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function se({type:f,value:x}){switch(f){case"decimal":case"integer":return{type:"number",value:x};case"string":return{type:"string",value:x.slice(1,-1)}}switch(x){case"true":case"false":return{type:"boolean",value:x==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:x.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:x}}}function ue(f){let{source:x}=f,w=function(){let A=f.consume("unsigned"),B=f.consume("short","long");if(B){let Y=f.consume("long");return new P({source:x,tokens:{prefix:A,base:B,postfix:Y}})}A&&f.error("Failed to parse integer type")}()||function(){let A=f.consume("unrestricted"),B=f.consume("float","double");if(B)return new P({source:x,tokens:{prefix:A,base:B}});A&&f.error("Failed to parse float type")}();if(w)return w;let _=f.consume("bigint","boolean","byte","octet","undefined");return _?new P({source:x,tokens:{base:_}}):void 0}function oe(f){return L(f,{parser:R.parse,listName:"arguments list"})}function Q(f,x){let w=v.parse(f),_=P.parse(f,x);return _&&(te(_).extAttrs=w),_}function ae(f,x){let w=P.parse(f,x||"return-type");if(w)return w;let _=f.consume("void");if(_){let A=new P({source:f.source,tokens:{base:_}});return A.type="return-type",A}}function ke(f){let x=f.consume("stringifier");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("Unterminated stringifier")}function U(f){let x=f.split(`
558
- `);if(x.length){let w=x[x.length-1].match(/^\s+/);if(w)return w[0]}return""}function le(f){return()=>{if(f.extAttrs.length){let x=new ut("Exposed=Window,"),w=y.parse(x);w.tokens.separator=x.consume(",");let _=f.extAttrs[0];/^\s/.test(_.tokens.name.trivia)||(_.tokens.name.trivia=` ${_.tokens.name.trivia}`),f.extAttrs.unshift(w)}else{te(f).extAttrs=v.parse(new ut("[Exposed=Window]"));let x=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=x,f.tokens.base.trivia=`
559
- ${U(x)}`}}}function z(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return z(f.idlType);return Object.values(f.tokens).sort((x,w)=>x.index-w.index)[0]}function te(f,x){if(x||(x=f),!f)return f;return new Proxy(f,{get(w,_){let A=w[_];return Array.isArray(A)&&_!=="source"?te(A,w):A},set(w,_,A){if(w[_]=A,!A)return!0;if(Array.isArray(A))for(let B of A)B.parent!==void 0&&(B.parent=x);else A.parent!==void 0&&(A.parent=x);return!0}})}let Le={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},fe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Be=["ByteString","DOMString","USVString"],G=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],We=["-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(G,Be,fe),Xe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],pt=["_constructor","toString","_toString"];class ut{constructor(f){this.source=function(x){let w=[],_=0,A="",B=1,Y=0;for(;_<x.length;){let ce=x.charAt(_),ge=-1;if(/[\t\n\r ]/.test(ce)?ge=de("whitespace",{noFlushTrivia:!0}):ce==="/"&&(ge=de("comment",{noFlushTrivia:!0})),ge!==-1){let _e=w.pop().value;B+=(_e.match(/\n/g)||[]).length,A+=_e,Y-=1}else if(/[-0-9.A-Z_a-z]/.test(ce)){if(ge=de("decimal"),ge===-1&&(ge=de("integer")),ge===-1){ge=de("identifier");let _e=w.length-1,Ae=w[_e];if(ge!==-1){if(pt.includes(Ae.value)){let jt=`${M(Ae.value)} is a reserved identifier and must not be used.`;throw new Ue(n(w,_e,null,jt))}We.includes(Ae.value)&&(Ae.type="inline")}}}else ce==='"'&&(ge=de("string"));for(let _e of Xe)if(x.startsWith(_e,_)){w.push({type:"inline",value:_e,trivia:A,line:B,index:Y}),A="",_+=_e.length,ge=_;break}if(ge===-1&&(ge=de("other")),ge===-1)throw Error("Token stream not progressing");_=ge,Y+=1}return w.push({type:"eof",value:"",trivia:A,line:B,index:Y}),w;function de(ce,{noFlushTrivia:ge}={}){let _e=Le[ce];_e.lastIndex=_;let Ae=_e.exec(x);return Ae?(w.push({type:ce,value:Ae[0],trivia:A,line:B,index:Y}),ge||(A=""),_e.lastIndex):-1}}(f),this.position=0}error(f){throw new Ue(n(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 x of f){if(!this.probeKind(x))continue;let w=this.source[this.position];return this.position++,w}}consume(...f){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let w of f)if(x.value===w)return this.position++,x}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class Ue extends Error{constructor({message:f,bareMessage:x,context:w,line:_,sourceName:A,input:B,tokens:Y}){super(f),this.name="WebIDLParseError",this.bareMessage=x,this.context=w,this.line=_,this.sourceName=A,this.input=B,this.tokens=Y}}class bt extends c{static parse(f){let x=f.consumeKind("string");if(x)return new bt({source:f.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:x}=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:x}),'"']),{data:this,parent:x}),f.token(this.tokens.separator)])}}class Mt extends i{static parse(f){let x={};if(x.base=f.consume("enum"),!x.base)return;x.name=f.consumeKind("identifier")||f.error("No name for enum");let w=te(new Mt({source:f.source,tokens:x}));return f.current=w.this,x.open=f.consume("{")||f.error("Bodyless enum"),w.values=L(f,{parser:bt.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),x.close=f.consume("}")||f.error("Unexpected value in enum"),w.values.length||f.error("No value in enum"),x.termination=f.consume(";")||f.error("No semicolon after enum"),w.this}get type(){return"enum"}get name(){return M(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((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Xr extends i{static parse(f){let x=f.consumeKind("identifier");if(!x)return;let w={target:x};if(w.includes=f.consume("includes"),w.includes)return w.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),w.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Xr({source:f.source,tokens:w});f.unconsume(x.index)}get type(){return"includes"}get target(){return M(this.tokens.target.value)}get includes(){return M(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 En extends i{static parse(f){let x={},w=te(new En({source:f.source,tokens:x}));if(x.base=f.consume("typedef"),x.base)return w.idlType=Q(f,"typedef-type")||f.error("Typedef lacks a type"),x.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=w.this,x.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),w.this}get type(){return"typedef"}get name(){return M(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 Ii extends i{static parse(f,x){let w={base:x},_=te(new Ii({source:f.source,tokens:w}));return w.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=_.this,w.assign=f.consume("=")||f.error("Callback lacks an assignment"),_.idlType=ae(f)||f.error("Callback lacks a return type"),w.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),_.arguments=oe(f),w.close=f.consume(")")||f.error("Unterminated callback"),w.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),_.this}get type(){return"callback"}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let x of this.arguments)if(yield*x.validate(f),x.idlType.generic==="async_sequence")yield s(x.tokens.name,x,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(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((x)=>x.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Jt extends i{static parse(f,x,{inheritable:w,allowedMembers:_}){let{tokens:A,type:B}=x;for(A.name=f.consumeKind("identifier")||f.error(`Missing name in ${B}`),f.current=x,x=te(x),w&&Object.assign(A,function(Y){let de=Y.consume(":");return de?{colon:de,inheritance:Y.consumeKind("identifier")||Y.error("Inheritance lacks a type")}:{}}(f)),A.open=f.consume("{")||f.error(`Bodyless ${B}`),x.members=[];;){if(A.close=f.consume("}"),A.close)return A.termination=f.consume(";")||f.error(`Missing semicolon after ${B}`),x.this;let Y=v.parse(f),de;for(let[ce,...ge]of _)if(de=te(ce(f,...ge)),de)break;de||f.error("Unknown member"),de.extAttrs=Y,x.members.push(de.this)}}get partial(){return!!this.tokens.partial}get name(){return M(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?M(this.tokens.inheritance.value):null}*validate(f){for(let x of this.members)x.validate&&(yield*x.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((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Zr extends i{static parse(f){let x={};if(x.base=f.consume("const"),!x.base)return;let w=ue(f);if(!w){let A=f.consumeKind("identifier")||f.error("Const lacks a type");w=new P({source:f.source,tokens:{base:A}})}f.probe("?")&&f.error("Unexpected nullable constant type"),w.type="const-type",x.name=f.consumeKind("identifier")||f.error("Const lacks a name"),x.assign=f.consume("=")||f.error("Const lacks value assignment"),x.value=W(f)||f.error("Const lacks a value"),x.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let _=new Zr({source:f.source,tokens:x});return te(_).idlType=w,_}get type(){return"const"}get name(){return M(this.tokens.name.value)}get value(){return se(this.tokens.value)}write(f){let{parent:x}=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:x}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:x})}}class Mi extends i{static parse(f){let x=f.position,w=te(new Mi({source:f.source,tokens:{}})),{tokens:_}=w;if(_.readonly=f.consume("readonly"),_.readonly||(_.async=f.consume("async")),_.base=_.readonly?f.consume("maplike","setlike"):_.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!_.base)return void f.unconsume(x);let{type:A}=w,B=A==="maplike",Y=B||A==="iterable"||A==="async_iterable",de=A==="async_iterable"||w.async&&A==="iterable";_.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${A} declaration`);let ce=Q(f)||f.error(`Missing a type argument in ${A} declaration`);return w.idlType=[ce],w.arguments=[],Y&&(ce.tokens.separator=f.consume(","),ce.tokens.separator?w.idlType.push(Q(f)):B&&f.error(`Missing second type argument in ${A} declaration`)),_.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${A} declaration`),f.probe("(")&&(de?(_.argsOpen=f.consume("("),w.arguments.push(...oe(f)),_.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),_.termination=f.consume(";")||f.error(`Missing semicolon after ${A} declaration`),w.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(x=this,()=>{let _=x.tokens.async;x.tokens.base={..._,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let w of this.idlType)yield*w.validate(f);for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((x)=>x.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Ts extends i{static parse(f){let x=f.consume("constructor");if(!x)return;let w={base:x};w.open=f.consume("(")||f.error("No argument list in constructor");let _=oe(f);w.close=f.consume(")")||f.error("Unterminated constructor"),w.termination=f.consume(";")||f.error("No semicolon after constructor");let A=new Ts({source:f.source,tokens:w});return te(A).arguments=_,A}get type(){return"constructor"}*validate(f){for(let x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:x})}}function ts(f){let x=f.consume("static");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("No body in static member")}class Is extends Jt{static parse(f,x,{extMembers:w=[],partial:_=null}={}){let A={partial:_,base:x};return Jt.parse(f,new Is({source:f.source,tokens:A}),{inheritable:!_,allowedMembers:[...w,[Zr.parse],[Ts.parse],[ts],[ke],[Mi.parse],[D.parse],[I.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((w)=>w.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});let x=this.extAttrs.filter((w)=>w.name==="Constructor");for(let w of x)yield s(w.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:ia(this,w)});if(this.extAttrs.some((w)=>w.name==="Global")){let w=this.extAttrs.filter((A)=>A.name==="LegacyFactoryFunction");for(let A of w)yield s(A.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let _=this.members.filter((A)=>A.type==="constructor");for(let A of _)yield s(A.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(w,_){let A=function(ge){let _e=ce(ge);return{statics:new Set(_e.filter((Ae)=>Ae.special==="static").map((Ae)=>Ae.name)),nonstatics:new Set(_e.filter((Ae)=>Ae.special!=="static").map((Ae)=>Ae.name))}}(_),B=w.partials.get(_.name)||[],Y=w.mixinMap.get(_.name)||[];for(let ge of[...B,...Y]){let _e=ce(ge),Ae=_e.filter((Dt)=>Dt.special==="static"),jt=_e.filter((Dt)=>Dt.special!=="static");yield*de(Ae,A.statics,ge,_),yield*de(jt,A.nonstatics,ge,_),Ae.forEach((Dt)=>A.statics.add(Dt.name)),jt.forEach((Dt)=>A.nonstatics.add(Dt.name))}function*de(ge,_e,Ae,jt){for(let Dt of ge){let{name:Ji}=Dt;if(Ji&&_e.has(Ji)){let Ec=`The ${Dt.special==="static"?"static ":""}operation "${Ji}" has already been defined for the base interface "${jt.name}" either in itself or in a mixin`;yield s(Dt.tokens.name,Ae,"no-cross-overload",Ec)}}}function ce(ge){return ge.members.filter(({type:_e})=>_e==="operation")}}(f,this))}}function ia(f,x){return f=te(f),()=>{let w=U(f.extAttrs.tokens.open.trivia),_=f.members.length?U(z(f.members[0]).trivia):function(_e){let Ae=U(_e),jt=Ae.includes("\t")?"\t":" ";return Ae+jt}(w),A=Ts.parse(new ut(`
560
- ${_}constructor();`));A.extAttrs=new v({source:f.source,tokens:{}}),te(A).arguments=x.arguments;let B=function(_e,Ae){let jt=_e.slice().reverse().findIndex(Ae);return jt===-1?jt:_e.length-jt-1}(f.members,(_e)=>_e.type==="constructor");f.members.splice(B+1,0,A);let{close:Y}=f.tokens;Y.trivia.includes(`
561
- `)||(Y.trivia+=`
562
- ${w}`);let{extAttrs:de}=f,ce=de.indexOf(x),ge=de.splice(ce,1);de.length?de.length===ce?de[ce-1].tokens.separator=void 0:de[ce].tokens.name.trivia.trim()||(de[ce].tokens.name.trivia=ge[0].tokens.name.trivia):de.tokens.open=de.tokens.close=void 0}}class Qr extends Jt{static parse(f,x,{extMembers:w=[],partial:_}={}){let A={partial:_,base:x};if(A.mixin=f.consume("mixin"),A.mixin)return Jt.parse(f,new Qr({source:f.source,tokens:A}),{allowedMembers:[...w,[Zr.parse],[ke],[D.parse,{noInherit:!0}],[I.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class J extends i{static parse(f){let x={},w=te(new J({source:f.source,tokens:x}));return w.extAttrs=v.parse(f),x.required=f.consume("required"),w.idlType=Q(f,"dictionary-type")||f.error("Dictionary member lacks a type"),x.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),w.default=O.parse(f),x.required&&w.default&&f.error("Required member must not have a default"),x.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),w.this}get type(){return"field"}get name(){return M(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:x}=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:x}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:x})}}class H extends Jt{static parse(f,{extMembers:x=[],partial:w}={}){let _={partial:w};if(_.base=f.consume("dictionary"),_.base)return Jt.parse(f,new H({source:f.source,tokens:_}),{inheritable:!w,allowedMembers:[...x,[J.parse]]})}get type(){return"dictionary"}}class V extends Jt{static parse(f,{extMembers:x=[],partial:w}={}){let _={partial:w};if(_.base=f.consume("namespace"),_.base)return Jt.parse(f,new V({source:f.source,tokens:_}),{allowedMembers:[...x,[D.parse,{noInherit:!0,readonly:!0}],[Zr.parse],[I.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((x)=>x.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});yield*super.validate(f)}}class ie extends Jt{static parse(f,x,{extMembers:w=[]}={}){let _={callback:x};if(_.base=f.consume("interface"),_.base)return Jt.parse(f,new ie({source:f.source,tokens:_}),{allowedMembers:[...w,[Zr.parse],[I.parse,{regular:!0}]]})}get type(){return"callback interface"}}function Se(f,x){let w=f.source;function _(ce){f.error(ce)}function A(...ce){return f.consume(...ce)}function B(ce){let ge=A("interface");if(ge)return Qr.parse(f,ge,{...ce,...x?.extensions?.mixin})||Is.parse(f,ge,{...ce,...x?.extensions?.interface})||_("Interface has no proper body")}function Y(){if(x.productions)for(let ce of x.productions){let ge=ce(f);if(ge)return ge}return function(){let ce=A("callback");if(ce)return f.probe("interface")?ie.parse(f,ce,{...x?.extensions?.callbackInterface}):Ii.parse(f,ce)}()||B()||function(){let ce=A("partial");if(ce)return H.parse(f,{partial:ce,...x?.extensions?.dictionary})||B({partial:ce})||V.parse(f,{partial:ce,...x?.extensions?.namespace})||_("Partial doesn't apply to anything")}()||H.parse(f,x?.extensions?.dictionary)||Mt.parse(f)||En.parse(f)||Xr.parse(f)||V.parse(f,x?.extensions?.namespace)}let de=function(){if(!w.length)return[];let ce=[];for(;;){let _e=v.parse(f),Ae=Y();if(!Ae){_e.length&&_("Stray extended attributes");break}te(Ae).extAttrs=_e,ce.push(Ae)}let ge=d.parse(f);return x.concrete&&ce.push(ge),ce}();return f.position<w.length&&_("Unrecognised tokens"),de}function Or(f,x={}){let w=new ut(f);return x.sourceName!==void 0&&(w.source.name=x.sourceName),Se(w,x)}function ze(f){return f}let Te={wrap:(f)=>f.join(""),trivia:ze,name:ze,reference:ze,type:ze,generic:ze,nameless:ze,inheritance:ze,definition:ze,extendedAttribute:ze,extendedAttributeReference:ze};class he{constructor(f){this.ts=Object.assign({},Te,f)}reference(f,{unescaped:x,context:w}){return x||(x=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,x,w)}token(f,x=ze,...w){if(!f)return"";let _=x(f.value,...w);return this.ts.wrap([this.ts.trivia(f.trivia),_])}reference_token(f,x){return this.token(f,this.reference.bind(this),{context:x})}name_token(f,x){return this.token(f,this.ts.name,x)}identifier(f,x){return this.ts.wrap([this.reference_token(f.tokens.value,x),this.token(f.tokens.separator)])}}function xt(f,{templates:x=Te}={}){x=Object.assign({},Te,x);let w=new he(x);return x.wrap(f.map((_)=>_.write(w)))}function st(f,x){let w=new Map,_=f.filter((A)=>A.type==="includes");for(let A of _){let B=x.get(A.includes);if(!B)continue;let Y=w.get(A.target);Y?Y.push(B):w.set(A.target,[B])}return w}function*ot(f){let x=function(w){let _=new Map,A=new Set,B=new Map;for(let Y of w)if(Y.partial){let de=B.get(Y.name);de?de.push(Y):B.set(Y.name,[Y])}else Y.name&&(_.has(Y.name)?A.add(Y):_.set(Y.name,Y));return{all:w,unique:_,partials:B,duplicates:A,mixinMap:st(w,_),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let w of x.all)w.validate&&(yield*w.validate(x));yield*function*({unique:w,duplicates:_}){for(let A of _){let{name:B}=A,Y=`The name "${B}" of type "${w.get(B).type}" was already seen`;yield s(A.tokens.name,A,"no-duplicate",Y)}}(x)}function Zt(f){return[...ot((x=f,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var cw=C(function(UY,lw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",sw=Ne("fs").promises,iw=Ne("path"),lL=nw();class ow{constructor(e,t){this.filename=t,this.shortname=iw.basename(t,".idl"),this.path=iw.join(e,t)}async text(){return await sw.readFile(this.path,"utf8")}async parse(){let e=await this.text();return lL.parse(e)}}async function aw({folder:e=__dirname}={}){let t={},r=await sw.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new ow(e,n);t[s.shortname]=s}return t}async function cL(e){let t=await aw(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}lw.exports={listAll:aw,parseAll:cL}});var uw,dw;var fw=q(()=>{uw={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."},dw={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var pw;var mw=q(()=>{pw={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 hw,gw,yw;var bw=q(()=>{hw={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},gw={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},yw={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var xw;var $w=q(()=>{xw={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 vw,ww;var Sw=q(()=>{vw={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"},ww={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 Ew;var _w=q(()=>{Ew={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Pw,jw,kw,Rw,Aw,Ow,Cw,Nw,Tw;var Iw=q(()=>{Pw={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},jw={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},kw={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Rw={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Aw={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Ow={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},Cw={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Nw={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"},Tw={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Ol;var Mw=q(()=>{Ol={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 Jw,Dw;var Lw=q(()=>{Jw={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Dw={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 Fw,qw,Hw,Vw,Bw,tf;var Ww=q(()=>{Fw={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},qw={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"},Hw={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Vw={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"},Bw={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"},tf={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 Uw;var zw=q(()=>{Uw={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 Gw;var Kw=q(()=>{Gw={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive. First parameter is always state (the reactive scope).',properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: an opaque JS source string (first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → JS string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var Yw,Xw;var Zw=q(()=>{Yw={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"}]},Xw={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 Qw;var e0=q(()=>{Qw={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 t0;var r0=q(()=>{t0={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var n0,s0,i0,o0,a0,l0,c0,u0,d0,f0,p0,m0,h0,g0,y0,b0,x0;var $0=q(()=>{eu();n0={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"},s0={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."},i0={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."},o0={enum:["!","-"]},a0={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},l0={const:"?:"},c0={const:"switch"},u0={const:"call"},d0={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"]},f0={enum:["=","+=","-=","*=","/="]},p0={enum:["pop","shift"]},m0={enum:["push","unshift"]},h0={const:"splice"},g0={const:"reduce"},y0={enum:["map","filter"]},b0={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 "+`${Sh()}) — 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"},x0={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 v0,w0,S0,E0;var _0=q(()=>{v0={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"}]},w0={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},S0={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},E0={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 uL,rf,nf,sf,of,af,lf,cf,uf,df,P0;var j0=q(()=>{uL=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],rf={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"},nf={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"},sf={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},of={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:uL,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"},af={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"},lf={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"},cf={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"},uf={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"},df={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"},P0={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var k0;var R0=q(()=>{k0={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 Cl;var A0=q(()=>{Cl={description:"Image optimization configuration for the project.",properties:{formats:{items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" runs Sharp at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var dL,ff;var O0=q(()=>{hs();dL=[301,302,303,307,308],ff={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:_a,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:_a,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:_a,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:[...dL],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function fL(){return C0??=pL(),C0}async function pL(){let[e,t,r]=await Promise.all([T0.listAll(),I0.default.listAll(),M0.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let d of c)if(!d.obsolete)n.add(d.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let d of c.styleDeclaration??[])i.add(d);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let d of c){if(d.type!=="interface"&&d.type!=="interface mixin")continue;if(!d.members)continue;for(let p of d.members)if(p.type==="attribute"&&p.name?.startsWith("on")&&p.idlType?.idlType==="EventHandler")a.add(p.name)}let l=[...a].toSorted();return{cssProps:o,eventHandlers:l,tagExamples:s}}function mL(e){let t={};for(let r of e)t[r]={description:`Event handler for the "${r.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function hL(e){let t={...Ol.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function gL(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await fL();return{$defs:{DefsMap:S0,TypeDefEntry:E0,StateMap:w0,StateEntry:v0,TypedStateDef:Uw,PureTypeDef:t0,FunctionDef:Gw,ClassDef:P0,ClassParameterDef:rf,ClassFieldDef:nf,ClassConstructorDef:sf,ClassMethodDef:of,FormatDef:af,ProjectBlockDef:lf,ServerBlockDef:cf,ConnectorBlockDef:uf,StudioHints:df,ExternalClassDef:Qw,ExpressionPointer:n0,ExpressionLiteral:s0,ExpressionOperand:i0,UnaryOperator:o0,BinaryOperator:a0,ConditionalOperator:l0,SwitchOperator:c0,CallOperator:u0,PureMethod:d0,AssignmentOperator:f0,NoArgMethod:p0,OneArgMethod:m0,SpliceMethod:h0,ReduceMethod:g0,MapFilterMethod:y0,ExpressionNode:b0,ExpressionEntry:x0,Statement:Yw,StatementList:Xw,ElementDef:{...tf,properties:{...tf.properties,...mL(r)}},ChildrenValue:Dw,ArrayNamespace:Jw,SwitchDef:Vw,SwitchNode:Bw,StyleObject:{...Ol,properties:hL(t)},AttributesObject:Fw,PropsObject:qw,RefObject:Nw,AnyRef:Cw,InternalRef:Pw,StateRef:jw,ExternalRef:kw,ExternalComponentRef:Tw,GlobalRef:Rw,ParentRef:Aw,MapRef:Ow,ElementPropertyValue:Hw,StringOrRef:hw,BoolOrRef:gw,NumberOrRef:yw,CemParameter:vw,CemEvent:ww,TagName:{...pw,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:uw,ElementTagName:dw,JsonSchemaType:Ew,HeadEntry:xw,ImageConfig:Cl,PathsValue:{$id:Es,anyOf:[...Po,zd],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:Es,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function yL(){return{$defs:{ImageConfig:Cl,StyleObject:J0},$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:ff.properties,title:"Jx Project",type:"object"}}function bL(){return{$defs:{ImageConfig:Cl,JxFieldSchema:Tv,RelationshipRef:Iv,StyleObject:J0},$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:ff.properties,title:"Jx Project Core",type:"object"}}function xL(){return{$id:_o,$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 $L(){return{$id:Es,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...Po,zd],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 vL(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...k0}}function pf(){return{$defs:{ClassConstructorDef:sf,ClassFieldDef:nf,ClassMethodDef:of,ClassParameterDef:rf,ConnectorBlockDef:uf,FormatDef:af,ProjectBlockDef:lf,ServerBlockDef:cf,StudioHints:df},$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 wL(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await gL(),a=yL(),l=pf(),c=bL(),d=vL(),p=xL(),h=$L(),m=JSON.stringify(o,null,2),b=JSON.stringify(a,null,2),g=JSON.stringify(l,null,2),y=JSON.stringify(c,null,2),v=JSON.stringify(d,null,2),j=JSON.stringify(p,null,2),S=JSON.stringify(h,null,2),[P]=process.argv.slice(2);if(P)r(P,m,"utf8"),console.error(`Jx component schema written to ${P}`);else{r(n(i,"schema.json"),m,"utf8"),r(n(i,"project-schema.json"),b,"utf8"),r(n(i,"class-schema.json"),g,"utf8"),t(n(i,"schemas"),{recursive:!0}),r(n(i,"schemas","project.core.schema.json"),y,"utf8"),r(n(i,"schemas","project.fields.schema.json"),j,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),v,"utf8");let E=Bun.spawnSync(["bunx","oxfmt",n(i,"schemas","project.core.schema.json"),n(i,"schemas","project.fields.schema.json"),n(i,"schemas","document.paths.schema.json")],{cwd:i});if(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 T0,I0,M0,C0=null,J0,N0,DX;var D0=q(()=>{fw();mw();bw();$w();Sw();_w();Iw();Mw();Lw();Ww();zw();Kw();Zw();e0();r0();$0();_0();j0();R0();kl();A0();O0();T0=Lt(Qv(),1),I0=Lt(rw(),1),M0=Lt(cw(),1);J0={...Ol,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,N0]=process.argv,DX=N0?.endsWith("schema.ts")?wL(N0):void 0});var Co=C(function(q0){Object.defineProperty(q0,"__esModule",{value:!0});q0.regexpCode=q0.getEsmExportName=q0.getProperty=q0.safeStringify=q0.stringify=q0.strConcat=q0.addCodeArg=q0.str=q0._=q0.nil=q0._Code=q0.Name=q0.IDENTIFIER=q0._CodeOrName=void 0;class Nl{}q0._CodeOrName=Nl;q0.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class gi extends Nl{constructor(e){super();if(!q0.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}}}q0.Name=gi;class _r extends Nl{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof gi)t[r.str]=(t[r.str]||0)+1;return t},{})}}q0._Code=_r;q0.nil=new _r("");function L0(e,...t){let r=[e[0]],n=0;while(n<t.length)hf(r,t[n]),r.push(e[++n]);return new _r(r)}q0._=L0;var mf=new _r("+");function F0(e,...t){let r=[Oo(e[0])],n=0;while(n<t.length)r.push(mf),hf(r,t[n]),r.push(mf,Oo(e[++n]));return SL(r),new _r(r)}q0.str=F0;function hf(e,t){if(t instanceof _r)e.push(...t._items);else if(t instanceof gi)e.push(t);else e.push(PL(t))}q0.addCodeArg=hf;function SL(e){let t=1;while(t<e.length-1){if(e[t]===mf){let r=EL(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function EL(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof gi||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 gi))return`"${e}${t.slice(1)}`;return}function _L(e,t){return t.emptyStr()?e:e.emptyStr()?t:F0`${e}${t}`}q0.strConcat=_L;function PL(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Oo(Array.isArray(e)?e.join(","):e)}function jL(e){return new _r(Oo(e))}q0.stringify=jL;function Oo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}q0.safeStringify=Oo;function kL(e){return typeof e=="string"&&q0.IDENTIFIER.test(e)?new _r(`.${e}`):L0`[${e}]`}q0.getProperty=kL;function RL(e){if(typeof e=="string"&&q0.IDENTIFIER.test(e))return new _r(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}q0.getEsmExportName=RL;function AL(e){return new _r(e.toString())}q0.regexpCode=AL});var xf=C(function(W0){Object.defineProperty(W0,"__esModule",{value:!0});W0.ValueScope=W0.ValueScopeName=W0.Scope=W0.varKinds=W0.UsedValueState=void 0;var Ut=Co();class V0 extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Il;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Il||(W0.UsedValueState=Il={}));W0.varKinds={const:new Ut.Name("const"),let:new Ut.Name("let"),var:new Ut.Name("var")};class yf{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof Ut.Name?e:this.name(e)}name(e){return new Ut.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}W0.Scope=yf;class bf extends Ut.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=Ut._`.${new Ut.Name(t)}[${r}]`}}W0.ValueScopeName=bf;var VL=Ut._`\n`;class B0 extends yf{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?VL:Ut.nil}}get(){return this._scope}name(e){return new bf(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[s];if(o){let c=o.get(i);if(c)return c}else o=this._values[s]=new Map;o.set(i,n);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:s,itemIndex:l}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return Ut._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let s=Ut.nil;for(let i in e){let o=e[i];if(!o)continue;let a=r[i]=r[i]||new Map;o.forEach((l)=>{if(a.has(l))return;a.set(l,Il.Started);let c=t(l);if(c){let d=this.opts.es5?W0.varKinds.var:W0.varKinds.const;s=Ut._`${s}${d} ${l} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(l))s=Ut._`${s}${c}${this.opts._n}`;else throw new V0(l);a.set(l,Il.Completed)})}return s}}W0.ValueScope=B0});var ye=C(function(zt){Object.defineProperty(zt,"__esModule",{value:!0});zt.or=zt.and=zt.not=zt.CodeGen=zt.operators=zt.varKinds=zt.ValueScopeName=zt.ValueScope=zt.Scope=zt.Name=zt.regexpCode=zt.stringify=zt.getProperty=zt.nil=zt.strConcat=zt.str=zt._=void 0;var je=Co(),Pr=xf(),Wn=Co();Object.defineProperty(zt,"_",{enumerable:!0,get:function(){return Wn._}});Object.defineProperty(zt,"str",{enumerable:!0,get:function(){return Wn.str}});Object.defineProperty(zt,"strConcat",{enumerable:!0,get:function(){return Wn.strConcat}});Object.defineProperty(zt,"nil",{enumerable:!0,get:function(){return Wn.nil}});Object.defineProperty(zt,"getProperty",{enumerable:!0,get:function(){return Wn.getProperty}});Object.defineProperty(zt,"stringify",{enumerable:!0,get:function(){return Wn.stringify}});Object.defineProperty(zt,"regexpCode",{enumerable:!0,get:function(){return Wn.regexpCode}});Object.defineProperty(zt,"Name",{enumerable:!0,get:function(){return Wn.Name}});var ql=xf();Object.defineProperty(zt,"Scope",{enumerable:!0,get:function(){return ql.Scope}});Object.defineProperty(zt,"ValueScope",{enumerable:!0,get:function(){return ql.ValueScope}});Object.defineProperty(zt,"ValueScopeName",{enumerable:!0,get:function(){return ql.ValueScopeName}});Object.defineProperty(zt,"varKinds",{enumerable:!0,get:function(){return ql.varKinds}});zt.operators={GT:new je._Code(">"),GTE:new je._Code(">="),LT:new je._Code("<"),LTE:new je._Code("<="),EQ:new je._Code("==="),NEQ:new je._Code("!=="),NOT:new je._Code("!"),OR:new je._Code("||"),AND:new je._Code("&&"),ADD:new je._Code("+")};class Un{optimizeNodes(){return this}optimizeNames(e,t){return this}}class z0 extends Un{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?Pr.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=bi(this.rhs,e,t);return this}get names(){return this.rhs instanceof je._CodeOrName?this.rhs.names:{}}}class wf extends Un{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof je.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=bi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof je.Name?{}:{...this.lhs.names};return Fl(e,this.rhs)}}class G0 extends wf{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class K0 extends Un{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class Y0 extends Un{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class X0 extends Un{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Z0 extends Un{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=bi(this.code,e,t),this}get names(){return this.code instanceof je._CodeOrName?this.code.names:{}}}class Hl extends Un{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let s=r[n];if(s.optimizeNames(e,t))continue;zL(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>_s(e,t.names),{})}}class zn extends Hl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class Q0 extends Hl{}class No extends zn{}No.kind="else";class vn extends zn{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new No(r):r}if(t){if(e===!1)return t instanceof vn?t:t.nodes;if(this.nodes.length)return this;return new vn(sS(e),t instanceof vn?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=bi(this.condition,e,t),this}get names(){let e=super.names;if(Fl(e,this.condition),this.else)_s(e,this.else.names);return e}}vn.kind="if";class yi extends zn{}yi.kind="for";class eS extends yi{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=bi(this.iteration,e,t),this}get names(){return _s(super.names,this.iteration.names)}}class tS extends yi{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?Pr.varKinds.var:this.varKind,{name:r,from:n,to:s}=this;return`for(${t} ${r}=${n}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=Fl(super.names,this.from);return Fl(e,this.to)}}class $f extends yi{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=bi(this.iterable,e,t),this}get names(){return _s(super.names,this.iterable.names)}}class Ml extends zn{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Ml.kind="func";class Jl extends Hl{render(e){return"return "+super.render(e)}}Jl.kind="return";class rS extends zn{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)_s(e,this.catch.names);if(this.finally)_s(e,this.finally.names);return e}}class Dl extends zn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Dl.kind="catch";class Ll extends zn{render(e){return"finally"+super.render(e)}}Ll.kind="finally";class nS{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
563
- `:""},this._extScope=e,this._scope=new Pr.Scope({parent:e}),this._nodes=[new Q0]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let s=this._scope.toName(t);if(r!==void 0&&n)this._constants[s.str]=r;return this._leafNode(new z0(e,s,r)),s}const(e,t,r){return this._def(Pr.varKinds.const,e,t,r)}let(e,t,r){return this._def(Pr.varKinds.let,e,t,r)}var(e,t,r){return this._def(Pr.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new wf(e,t,r))}add(e,t){return this._leafNode(new G0(e,zt.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==je.nil)this._leafNode(new Z0(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),je.addCodeArg(t,n)}return t.push("}"),new je._Code(t)}if(e,t,r){if(this._blockNode(new vn(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new vn(e))}else(){return this._elseNode(new No)}endIf(){return this._endBlockNode(vn,No)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new eS(e),t)}forRange(e,t,r,n,s=this.opts.es5?Pr.varKinds.var:Pr.varKinds.let){let i=this._scope.toName(e);return this._for(new tS(s,i,t,r),()=>n(i))}forOf(e,t,r,n=Pr.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof je.Name?t:this.var("_arr",t);return this.forRange("_i",0,je._`${i}.length`,(o)=>{this.var(s,je._`${i}[${o}]`),r(s)})}return this._for(new $f("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?Pr.varKinds.var:Pr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,je._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new $f("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(yi)}label(e){return this._leafNode(new K0(e))}break(e){return this._leafNode(new Y0(e))}return(e){let t=new Jl;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Jl)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new rS;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new Dl(s),t(s)}if(r)this._currNode=n.finally=new Ll,this.code(r);return this._endBlockNode(Dl,Ll)}throw(e){return this._leafNode(new X0(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=je.nil,r,n){if(this._blockNode(new Ml(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Ml)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof vn))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}}zt.CodeGen=nS;function _s(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Fl(e,t){return t instanceof je._CodeOrName?_s(e,t.names):e}function bi(e,t,r){if(e instanceof je.Name)return n(e);if(!s(e))return e;return new je._Code(e._items.reduce((i,o)=>{if(o instanceof je.Name)o=n(o);if(o instanceof je._Code)i.push(...o._items);else i.push(o);return i},[]));function n(i){let o=r[i.str];if(o===void 0||t[i.str]!==1)return i;return delete t[i.str],o}function s(i){return i instanceof je._Code&&i._items.some((o)=>o instanceof je.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function zL(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function sS(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:je._`!${vf(e)}`}zt.not=sS;var GL=iS(zt.operators.AND);function KL(...e){return e.reduce(GL)}zt.and=KL;var YL=iS(zt.operators.OR);function XL(...e){return e.reduce(YL)}zt.or=XL;function iS(e){return(t,r)=>t===je.nil?r:r===je.nil?t:je._`${vf(t)} ${e} ${vf(r)}`}function vf(e){return e instanceof je.Name?e:je._`(${e})`}});var we=C(function(mS){Object.defineProperty(mS,"__esModule",{value:!0});mS.checkStrictMode=mS.getErrorPath=mS.Type=mS.useFunc=mS.setEvaluated=mS.evaluatedPropsToName=mS.mergeEvaluated=mS.eachItem=mS.unescapeJsonPointer=mS.escapeJsonPointer=mS.escapeFragment=mS.unescapeFragment=mS.schemaRefOrVal=mS.schemaHasRulesButRef=mS.schemaHasRules=mS.checkUnknownRules=mS.alwaysValidSchema=mS.toHash=void 0;var De=ye(),tF=Co();function rF(e){let t={};for(let r of e)t[r]=!0;return t}mS.toHash=rF;function nF(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return cS(e,t),!uS(t,e.self.RULES.all)}mS.alwaysValidSchema=nF;function cS(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let s=n.RULES.keywords;for(let i in t)if(!s[i])pS(e,`unknown keyword: "${i}"`)}mS.checkUnknownRules=cS;function uS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}mS.schemaHasRules=uS;function sF(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}mS.schemaHasRulesButRef=sF;function iF({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return De._`${r}`}return De._`${e}${t}${De.getProperty(n)}`}mS.schemaRefOrVal=iF;function oF(e){return dS(decodeURIComponent(e))}mS.unescapeFragment=oF;function aF(e){return encodeURIComponent(Ef(e))}mS.escapeFragment=aF;function Ef(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}mS.escapeJsonPointer=Ef;function dS(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}mS.unescapeJsonPointer=dS;function lF(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}mS.eachItem=lF;function aS({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof De.Name?(i instanceof De.Name?e(s,i,o):t(s,i,o),o):i instanceof De.Name?(t(s,o,i),i):r(i,o);return a===De.Name&&!(l instanceof De.Name)?n(s,l):l}}mS.mergeEvaluated={props:aS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>{e.if(De._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,De._`${r} || {}`).code(De._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,De._`${r} || {}`),_f(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:fS}),items:aS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,De._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>e.assign(r,t===!0?!0:De._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function fS(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",De._`{}`);if(t!==void 0)_f(e,r,t);return r}mS.evaluatedPropsToName=fS;function _f(e,t,r){Object.keys(r).forEach((n)=>e.assign(De._`${t}${De.getProperty(n)}`,!0))}mS.setEvaluated=_f;var lS={};function cF(e,t){return e.scopeValue("func",{ref:t,code:lS[t.code]||(lS[t.code]=new tF._Code(t.code))})}mS.useFunc=cF;var Sf;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Sf||(mS.Type=Sf={}));function uF(e,t,r){if(e instanceof De.Name){let n=t===Sf.Num;return r?n?De._`"[" + ${e} + "]"`:De._`"['" + ${e} + "']"`:n?De._`"/" + ${e}`:De._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?De.getProperty(e).toString():"/"+Ef(e)}mS.getErrorPath=uF;function pS(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}mS.checkStrictMode=pS});var gr=C(function(gS){Object.defineProperty(gS,"__esModule",{value:!0});var St=ye(),kF={data:new St.Name("data"),valCxt:new St.Name("valCxt"),instancePath:new St.Name("instancePath"),parentData:new St.Name("parentData"),parentDataProperty:new St.Name("parentDataProperty"),rootData:new St.Name("rootData"),dynamicAnchors:new St.Name("dynamicAnchors"),vErrors:new St.Name("vErrors"),errors:new St.Name("errors"),this:new St.Name("this"),self:new St.Name("self"),scope:new St.Name("scope"),json:new St.Name("json"),jsonPos:new St.Name("jsonPos"),jsonLen:new St.Name("jsonLen"),jsonPart:new St.Name("jsonPart")};gS.default=kF});var To=C(function($S){Object.defineProperty($S,"__esModule",{value:!0});$S.extendErrors=$S.resetErrorsCount=$S.reportExtraError=$S.reportError=$S.keyword$DataError=$S.keywordError=void 0;var Re=ye(),Bl=we(),Ct=gr();$S.keywordError={message:({keyword:e})=>Re.str`must pass "${e}" keyword validation`};$S.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Re.str`"${e}" keyword must be ${t} ($data)`:Re.str`"${e}" keyword is invalid ($data)`};function AF(e,t=$S.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=xS(e,t,r);if(n!==null&&n!==void 0?n:o||a)yS(i,l);else bS(s,Re._`[${l}]`)}$S.reportError=AF;function OF(e,t=$S.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=xS(e,t,r);if(yS(s,a),!(i||o))bS(n,Ct.default.vErrors)}$S.reportExtraError=OF;function CF(e,t){e.assign(Ct.default.errors,t),e.if(Re._`${Ct.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Re._`${Ct.default.vErrors}.length`,t),()=>e.assign(Ct.default.vErrors,null)))}$S.resetErrorsCount=CF;function NF({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:i}){if(s===void 0)throw Error("ajv implementation error");let o=e.name("err");e.forRange("i",s,Ct.default.errors,(a)=>{if(e.const(o,Re._`${Ct.default.vErrors}[${a}]`),e.if(Re._`${o}.instancePath === undefined`,()=>e.assign(Re._`${o}.instancePath`,Re.strConcat(Ct.default.instancePath,i.errorPath))),e.assign(Re._`${o}.schemaPath`,Re.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(Re._`${o}.schema`,r),e.assign(Re._`${o}.data`,n)})}$S.extendErrors=NF;function yS(e,t){let r=e.const("err",t);e.if(Re._`${Ct.default.vErrors} === null`,()=>e.assign(Ct.default.vErrors,Re._`[${r}]`),Re._`${Ct.default.vErrors}.push(${r})`),e.code(Re._`${Ct.default.errors}++`)}function bS(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(Re._`new ${e.ValidationError}(${t})`);else r.assign(Re._`${n}.errors`,t),r.return(!1)}var Ps={keyword:new Re.Name("keyword"),schemaPath:new Re.Name("schemaPath"),params:new Re.Name("params"),propertyName:new Re.Name("propertyName"),message:new Re.Name("message"),schema:new Re.Name("schema"),parentSchema:new Re.Name("parentSchema")};function xS(e,t,r){let{createErrors:n}=e.it;if(n===!1)return Re._`{}`;return TF(e,t,r)}function TF(e,t,r={}){let{gen:n,it:s}=e,i=[IF(s,r),MF(e,r)];return JF(e,t,i),n.object(...i)}function IF({errorPath:e},{instancePath:t}){let r=t?Re.str`${e}${Bl.getErrorPath(t,Bl.Type.Str)}`:e;return[Ct.default.instancePath,Re.strConcat(Ct.default.instancePath,r)]}function MF({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:Re.str`${t}/${e}`;if(r)s=Re.str`${s}${Bl.getErrorPath(r,Bl.Type.Str)}`;return[Ps.schemaPath,s]}function JF(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:d,schemaPath:p}=a;if(n.push([Ps.keyword,s],[Ps.params,typeof t=="function"?t(e):t||Re._`{}`]),l.messages)n.push([Ps.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([Ps.schema,o],[Ps.parentSchema,Re._`${d}${p}`],[Ct.default.data,i]);if(c)n.push([Ps.propertyName,c])}});var _S=C(function(SS){Object.defineProperty(SS,"__esModule",{value:!0});SS.boolOrEmptySchema=SS.topBoolOrEmptySchema=void 0;var HF=To(),VF=ye(),BF=gr(),WF={message:"boolean schema is false"};function UF(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)wS(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(BF.default.data);else t.assign(VF._`${n}.errors`,null),t.return(!0)}SS.topBoolOrEmptySchema=UF;function zF(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),wS(e);else r.var(t,!0)}SS.boolOrEmptySchema=zF;function wS(e,t){let{gen:r,data:n}=e;HF.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},WF,void 0,t)}});var jf=C(function(PS){Object.defineProperty(PS,"__esModule",{value:!0});PS.getRules=PS.isJSONType=void 0;var KF=["string","number","integer","boolean","null","object","array"],YF=new Set(KF);function XF(e){return typeof e=="string"&&YF.has(e)}PS.isJSONType=XF;function ZF(){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:{}}}PS.getRules=ZF});var kf=C(function(AS){Object.defineProperty(AS,"__esModule",{value:!0});AS.shouldUseRule=AS.shouldUseGroup=AS.schemaHasRulesForType=void 0;function eq({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&kS(e,n)}AS.schemaHasRulesForType=eq;function kS(e,t){return t.rules.some((r)=>RS(e,r))}AS.shouldUseGroup=kS;function RS(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}AS.shouldUseRule=RS});var Io=C(function(IS){Object.defineProperty(IS,"__esModule",{value:!0});IS.reportTypeError=IS.checkDataTypes=IS.checkDataType=IS.coerceAndCheckDataType=IS.getJSONTypes=IS.getSchemaTypes=IS.DataType=void 0;var nq=jf(),sq=kf(),iq=To(),xe=ye(),CS=we(),xi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(xi||(IS.DataType=xi={}));function oq(e){let t=NS(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}IS.getSchemaTypes=oq;function NS(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(nq.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}IS.getJSONTypes=NS;function aq(e,t){let{gen:r,data:n,opts:s}=e,i=lq(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&sq.schemaHasRulesForType(e,t[0]));if(o){let a=Af(t,n,s.strictNumbers,xi.Wrong);r.if(a,()=>{if(i.length)cq(e,t,i);else Of(e)})}return o}IS.coerceAndCheckDataType=aq;var TS=new Set(["string","number","integer","boolean","null"]);function lq(e,t){return t?e.filter((r)=>TS.has(r)||t==="array"&&r==="array"):[]}function cq(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",xe._`typeof ${s}`),a=n.let("coerced",xe._`undefined`);if(i.coerceTypes==="array")n.if(xe._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,xe._`${s}[0]`).assign(o,xe._`typeof ${s}`).if(Af(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(xe._`${a} !== undefined`);for(let c of r)if(TS.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),Of(e),n.endIf(),n.if(xe._`${a} !== undefined`,()=>{n.assign(s,a),uq(e,a)});function l(c){switch(c){case"string":n.elseIf(xe._`${o} == "number" || ${o} == "boolean"`).assign(a,xe._`"" + ${s}`).elseIf(xe._`${s} === null`).assign(a,xe._`""`);return;case"number":n.elseIf(xe._`${o} == "boolean" || ${s} === null
556
+ `+(" ".repeat(Ae.length)+"^"),jc=A==="Syntax"?"since":"inside",Kp=`${A} error at line ${_e}${f.name?` in ${f.name}`:""}${w&&w.name?`, ${jc} \`${w.partial?"partial ":""}${function(er){let rs=[er];for(;er&&er.parent;){let{parent:en}=er;rs.unshift(en),er=en}return rs.map((en)=>function(Li,Fi){let Yp=Li;return Fi&&(Yp+=` ${Fi}`),Yp}(en.type,en.name)).join(" -> ")}(w)}\``:""}:
557
+ ${Di}`;return{message:`${Kp} ${P}`,bareMessage:P,context:Kp,line:_e,sourceName:f.name,level:B,ruleName:de,autofix:X,input:Dt,tokens:jt}}function n(f,x,w,P){return r(f,x,w,P,"Syntax")}function s(f,x,w,P,A={}){return A.ruleName=w,r(x.source,f.index,x,P,"Validation",A)}e.r(t),e.d(t,{WebIDLParseError:()=>Ue,parse:()=>Cr,validate:()=>Qt,write:()=>xt});class i{constructor({source:f,tokens:x}){Object.defineProperties(this,{source:{value:f},tokens:{value:x,writable:!0},parent:{value:null,writable:!0},this:{value:this}})}toJSON(){let f={type:void 0,name:void 0,inheritance:void 0},x=this;for(;x!==Object.prototype;){let w=Object.getOwnPropertyDescriptors(x);for(let[P,A]of Object.entries(w))(A.enumerable||A.get)&&(f[P]=this[P]);x=Object.getPrototypeOf(x)}return f}}function o(f,x,{useNullableInner:w}={}){if(!f.union){let P=x.unique.get(f.idlType);if(!P)return;if(P.type==="typedef"){let{typedefIncludesDictionary:A}=x.cache;if(A.has(P))return A.get(P);x.cache.typedefIncludesDictionary.set(P,void 0);let B=o(P.idlType,x);if(x.cache.typedefIncludesDictionary.set(P,B),B)return{reference:f,dictionary:B.dictionary}}if(P.type==="dictionary"&&(w||!f.nullable))return{reference:f,dictionary:P}}for(let P of f.subtype){let A=o(P,x);if(A)return P.union?A:{reference:P,dictionary:A.dictionary}}}function a(f,x){if(x.cache.dictionaryIncludesRequiredField.has(f))return x.cache.dictionaryIncludesRequiredField.get(f);x.cache.dictionaryIncludesRequiredField.set(f,void 0);let w=f.members.some((P)=>P.required);if(!w&&f.inheritance){let P=x.unique.get(f.inheritance);P?a(P,x)&&(w=!0):w=!0}return x.cache.dictionaryIncludesRequiredField.set(f,w),w}class l extends Array{constructor({source:f,tokens:x}){super(),Object.defineProperties(this,{source:{value:f},tokens:{value:x},parent:{value:null,writable:!0}})}}class c extends i{static parser(f,x){return()=>{let w=f.consumeKind(x);if(w)return new c({source:f.source,tokens:{value:w}})}}get value(){return M(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 x=f.consumeKind("eof");if(x)return new u({source:f.source,tokens:{value:x}})}get type(){return"eof"}}function p(f,x){return L(f,{parser:c.parser(f,x),listName:x+" list"})}let g=["identifier","decimal","integer","string"],m=new Map([...["NoInterfaceObject","LenientSetter","LenientThis","TreatNonObjectAsNull","Unforgeable"].map((f)=>[f,`Legacy${f}`]),["NamedConstructor","LegacyFactoryFunction"],["OverrideBuiltins","LegacyOverrideBuiltIns"],["TreatNullAs","LegacyNullToEmptyString"]]);function b(f){for(let x of g){let w=p(f,x);if(w.length)return w}f.error("Expected identifiers, strings, decimals, or integers but none found")}class h extends i{static parse(f){let x={assign:f.consume("=")},w=te(new h({source:f.source,tokens:x}));if(w.list=[],x.assign){if(x.asterisk=f.consume("*"),x.asterisk)return w.this;x.secondaryName=f.consumeKind(...g)}return x.open=f.consume("("),x.open?(w.list=w.rhsIsList?b(f):oe(f),x.close=f.consume(")")||f.error("Unexpected token in extended attribute argument list")):x.assign&&!x.secondaryName&&f.error("No right hand side to extended attribute assignment"),w.this}get rhsIsList(){return this.tokens.assign&&!this.tokens.asterisk&&!this.tokens.secondaryName}get rhsType(){return this.rhsIsList?this.list[0].tokens.value.type+"-list":this.tokens.asterisk?"*":this.tokens.secondaryName?this.tokens.secondaryName.type:null}write(f){let{rhsType:x}=this;return f.ts.wrap([f.token(this.tokens.assign),f.token(this.tokens.asterisk),f.reference_token(this.tokens.secondaryName,this.parent),f.token(this.tokens.open),...this.list.map((w)=>x==="identifier-list"?f.identifier(w,this.parent):w.write(f)),f.token(this.tokens.close)])}}class y extends i{static parse(f){let x=f.consumeKind("identifier");if(x)return new y({source:f.source,tokens:{name:x},params:h.parse(f)})}constructor({source:f,tokens:x,params:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"params",{value:w})}get type(){return"extended-attribute"}get name(){return this.tokens.name.value}get rhs(){let{rhsType:f,tokens:x,list:w}=this.params;if(!f)return null;return{type:f,value:this.params.rhsIsList?w:this.params.tokens.secondaryName?M(x.secondaryName.value):null}}get arguments(){let{rhsIsList:f,list:x}=this.params;return!x||f?[]:x}*validate(f){let{name:x}=this;if(x==="LegacyNoInterfaceObject")yield s(this.tokens.name,this,"no-nointerfaceobject","`[LegacyNoInterfaceObject]` extended attribute is an undesirable feature that may be removed from Web IDL in the future. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/609) for more information.",{level:"warning"});else if(m.has(x)){let P=`\`[${x}]\` extended attribute is a legacy feature that is now renamed to \`[${m.get(x)}]\`. Refer to the [relevant upstream PR](https://github.com/whatwg/webidl/pull/870) for more information.`;yield s(this.tokens.name,this,"renamed-legacy",P,{level:"warning",autofix:(w=this,()=>{let{name:A}=w;w.tokens.name.value=m.get(A),A==="TreatNullAs"&&(w.params.tokens={})})})}var w;for(let P of this.arguments)yield*P.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 v extends l{static parse(f){let x={};x.open=f.consume("[");let w=new v({source:f.source,tokens:x});return x.open?(w.push(...L(f,{parser:y.parse,listName:"extended attribute"})),x.close=f.consume("]")||f.error("Expected a closing token for the extended attribute list"),w.length||(f.unconsume(x.close.index),f.error("An extended attribute list must not be empty")),f.probe("[")&&f.error("Illegal double extended attribute lists, consider merging them"),w):w}*validate(f){for(let x of this)yield*x.validate(f)}write(f){return this.length?f.ts.wrap([f.token(this.tokens.open),...this.map((x)=>x.write(f)),f.token(this.tokens.close)]):""}}function j(f,x){let w=f.consume("?");w&&(x.tokens.nullable=w),f.probe("?")&&f.error("Can't nullable more than once")}function S(f,x){let w=function(P,A){let B=P.consume("FrozenArray","ObservableArray","Promise","async_sequence","sequence","record");if(!B)return;let X=te(new _({source:P.source,tokens:{base:B}}));switch(X.tokens.open=P.consume("<")||P.error(`No opening bracket after ${B.value}`),B.value){case"Promise":{P.probe("[")&&P.error("Promise type cannot have extended attribute");let de=ae(P,A)||P.error("Missing Promise subtype");X.subtype.push(de);break}case"async_sequence":case"sequence":case"FrozenArray":case"ObservableArray":{let de=ee(P,A)||P.error(`Missing ${B.value} subtype`);X.subtype.push(de);break}case"record":{P.probe("[")&&P.error("Record key cannot have extended attribute");let de=P.consume(...Be)||P.error(`Record key must be one of: ${Be.join(", ")}`),ce=new _({source:P.source,tokens:{base:de}});ce.tokens.separator=P.consume(",")||P.error("Missing comma after record key type"),ce.type=A;let ge=ee(P,A)||P.error("Error parsing generic type record");X.subtype.push(ce,ge);break}}return X.idlType||P.error(`Error parsing generic type ${B.value}`),X.tokens.close=P.consume(">")||P.error(`Missing closing bracket after ${B.value}`),X.this}(f,x)||ue(f);if(!w){let P=f.consumeKind("identifier")||f.consume(...Be,...fe);if(!P)return;w=new _({source:f.source,tokens:{base:P}}),f.probe("<")&&f.error(`Unsupported generic type ${P.value}`)}return w.generic==="Promise"&&f.probe("?")&&f.error("Promise type cannot be nullable"),w.type=x||null,j(f,w),w.nullable&&w.idlType==="any"&&f.error("Type `any` cannot be made nullable"),w}class _ extends i{static parse(f,x){return S(f,x)||function(w,P){let A={};if(A.open=w.consume("("),!A.open)return;let B=te(new _({source:w.source,tokens:A}));for(B.type=P||null;;){let X=ee(w,P)||w.error("No type after open parenthesis or 'or' in union type");X.idlType==="any"&&w.error("Type `any` cannot be included in a union type"),X.generic==="Promise"&&w.error("Type `Promise` cannot be included in a union type"),B.subtype.push(X);let de=w.consume("or");if(!de)break;X.tokens.separator=de}return B.idlType.length<2&&w.error("At least two types are expected in a union type but found less"),A.close=w.consume(")")||w.error("Unterminated union type"),j(w,B),B.this}(f,x)}constructor({source:f,tokens:x}){super({source:f,tokens:x}),Object.defineProperty(this,"subtype",{value:[],writable:!0}),this.extAttrs=new v({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 M([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 A of[this.extAttrs,this.parent?.extAttrs])for(let B of A){if(B.name!=="AllowShared")continue;let X="`[AllowShared] BufferSource` is now replaced with AllowSharedBufferSource.";yield s(this.tokens.base,this,"migrate-allowshared",X,{autofix:E(this,B,A)})}if(this.idlType==="void")yield s(this.tokens.base,this,"replace-void","`void` is now replaced by `undefined`. Refer to the [relevant GitHub issue](https://github.com/whatwg/webidl/issues/60) for more information.",{autofix:(x=this,()=>{x.tokens.base.value="undefined"})});var x;let w=!this.union&&f.unique.get(this.idlType),P=this.union?this:w&&w.type==="typedef"?w.idlType:void 0;if(P&&this.nullable){let{reference:A}=o(P,f)||{};if(A){let B=(this.union?A:this).tokens.base;yield s(B,this,"no-nullable-union-dict","Nullable union cannot include a dictionary type.")}}else for(let A of this.subtype)yield*A.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((A)=>A.write(f)),f.token(this.tokens.close)]);let x=this.tokens.prefix||this.tokens.base,w=this.tokens.prefix?[this.tokens.prefix.value,f.ts.trivia(this.tokens.base.trivia)]:[],P=f.reference(f.ts.wrap([...w,this.tokens.base.value,f.token(this.tokens.postfix)]),{unescaped:this.idlType,context:this});return f.ts.wrap([f.ts.trivia(x.trivia),P])})(),f.token(this.tokens.nullable),f.token(this.tokens.separator)])}}function E(f,x,w){return()=>{let P=w.indexOf(x);w.splice(P,1),!w.length&&f.tokens.base.trivia.match(/^\s$/)&&(f.tokens.base.trivia=""),f.tokens.base.value="AllowSharedBufferSource"}}class O extends i{static parse(f){let x=f.consume("=");if(!x)return null;let w=W(f)||f.consumeKind("string")||f.consume("null","[","{")||f.error("No value for default"),P=[w];if(w.value==="["){let A=f.consume("]")||f.error("Default sequence value must be empty");P.push(A)}else if(w.value==="{"){let A=f.consume("}")||f.error("Default dictionary value must be empty");P.push(A)}return new O({source:f.source,tokens:{assign:x},expression:P})}constructor({source:f,tokens:x,expression:w}){super({source:f,tokens:x}),w.parent=this,Object.defineProperty(this,"expression",{value:w})}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((x)=>f.token(x))])}}class R extends i{static parse(f){let x=f.position,w={},P=te(new R({source:f.source,tokens:w}));return P.extAttrs=v.parse(f),w.optional=f.consume("optional"),P.idlType=ee(f,"argument-type"),P.idlType?(w.optional||(w.variadic=f.consume("...")),w.name=f.consumeKind("identifier")||f.consume(...K),w.name?(P.default=w.optional?O.parse(f):null,P.this):f.unconsume(x)):f.unconsume(x)}get type(){return"argument"}get optional(){return!!this.tokens.optional}get variadic(){return!!this.tokens.variadic}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f),yield*this.idlType.validate(f);let x=o(this.idlType,f,{useNullableInner:!0});if(x){if(this.idlType.nullable)yield s(this.tokens.name,this,"no-nullable-dict-arg","Dictionary arguments cannot be nullable.");else if(this.optional){if(!this.default)yield s(this.tokens.name,this,"dict-arg-default","Optional dictionary arguments must have a default value of `{}`.",{autofix:k(this)})}else if(this.parent&&!a(x.dictionary,f)&&function(P){let A=P.parent.arguments||P.parent.list,B=A.indexOf(P);return!A.slice(B+1).some((de)=>!de.optional)}(this))yield s(this.tokens.name,this,"dict-arg-optional","Dictionary argument must be optional if it has no required fields",{autofix:(w=this,()=>{let A=G(w.idlType);w.tokens.optional={...A,type:"optional",value:"optional"},A.trivia=" ",k(w)()})})}var w}write(f){return f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.optional),f.ts.type(this.idlType.write(f)),f.token(this.tokens.variadic),f.name_token(this.tokens.name,{data:this}),this.default?this.default.write(f):"",f.token(this.tokens.separator)])}}function k(f){return()=>{f.default=O.parse(new ut(" = {}"))}}class I extends i{static parse(f,{special:x,regular:w}={}){let P={special:x},A=te(new I({source:f.source,tokens:P}));return x&&x.value==="stringifier"&&(P.termination=f.consume(";"),P.termination)?(A.arguments=[],A):(x||w||(P.special=f.consume("getter","setter","deleter")),A.idlType=ae(f)||f.error("Missing return type"),P.name=f.consumeKind("identifier")||f.consume("includes"),P.open=f.consume("(")||f.error("Invalid operation"),A.arguments=oe(f),P.close=f.consume(")")||f.error("Unterminated operation"),P.termination=f.consume(";")||f.error("Unterminated operation, expected `;`"),A.this)}get type(){return"operation"}get name(){let{name:f}=this.tokens;return f?M(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 x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this,w=this.idlType?[f.ts.type(this.idlType.write(f)),f.name_token(this.tokens.name,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((P)=>P.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:x}),...w,f.token(this.tokens.termination)]),{data:this,parent:x})}}class D extends i{static parse(f,{special:x,noInherit:w=!1,readonly:P=!1}={}){let A=f.position,B={special:x},X=te(new D({source:f.source,tokens:B}));if(x||w||(B.special=f.consume("inherit")),X.special==="inherit"&&f.probe("readonly")&&f.error("Inherited attributes cannot be read-only"),B.readonly=f.consume("readonly"),P&&!B.readonly&&f.probe("attribute")&&f.error("Attributes must be readonly in this context"),B.base=f.consume("attribute"),B.base)return X.idlType=ee(f,"attribute-type")||f.error("Attribute lacks a type"),B.name=f.consumeKind("identifier")||f.consume("async","required")||f.error("Attribute lacks a name"),B.termination=f.consume(";")||f.error("Unterminated attribute, expected `;`"),X.this;f.unconsume(A)}get type(){return"attribute"}get special(){return this.tokens.special?this.tokens.special.value:""}get readonly(){return!!this.tokens.readonly}get name(){return M(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 x=`Attributes cannot accept ${this.idlType.generic} types.`;yield s(this.tokens.name,this,"attr-invalid-type",x)}{let{reference:x}=o(this.idlType,f)||{};if(x){let w=(this.idlType.union?x:this.idlType).tokens.base;yield s(w,this,"attr-invalid-type","Attributes cannot accept dictionary types.")}}if(this.readonly&&function(x,w){if(x.union)return!1;if(x.extAttrs.some((A)=>A.name==="EnforceRange"))return!0;let P=w.unique.get(x.idlType);return P?.type==="typedef"&&P.idlType.extAttrs.some((A)=>A.name==="EnforceRange")}(this.idlType,f)){let x=this.idlType.tokens.base;yield s(x,this,"attr-invalid-type","Readonly attributes cannot accept [EnforceRange] extended attribute.")}}write(f){let{parent:x}=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:x}),f.token(this.tokens.termination)]),{data:this,parent:x})}}function M(f){return f.startsWith("_")?f.slice(1):f}function L(f,{parser:x,allowDangler:w,listName:P="list"}){let A=x(f);if(!A)return[];A.tokens.separator=f.consume(",");let B=[A];for(;A.tokens.separator;){let X=x(f);if(!X){w||f.error(`Trailing comma in ${P}`);break}if(X.tokens.separator=f.consume(","),B.push(X),!X.tokens.separator)break}return B}function W(f){return f.consumeKind("decimal","integer")||f.consume("true","false","Infinity","-Infinity","NaN")}function se({type:f,value:x}){switch(f){case"decimal":case"integer":return{type:"number",value:x};case"string":return{type:"string",value:x.slice(1,-1)}}switch(x){case"true":case"false":return{type:"boolean",value:x==="true"};case"Infinity":case"-Infinity":return{type:"Infinity",negative:x.startsWith("-")};case"[":return{type:"sequence",value:[]};case"{":return{type:"dictionary"};default:return{type:x}}}function ue(f){let{source:x}=f,w=function(){let A=f.consume("unsigned"),B=f.consume("short","long");if(B){let X=f.consume("long");return new _({source:x,tokens:{prefix:A,base:B,postfix:X}})}A&&f.error("Failed to parse integer type")}()||function(){let A=f.consume("unrestricted"),B=f.consume("float","double");if(B)return new _({source:x,tokens:{prefix:A,base:B}});A&&f.error("Failed to parse float type")}();if(w)return w;let P=f.consume("bigint","boolean","byte","octet","undefined");return P?new _({source:x,tokens:{base:P}}):void 0}function oe(f){return L(f,{parser:R.parse,listName:"arguments list"})}function ee(f,x){let w=v.parse(f),P=_.parse(f,x);return P&&(te(P).extAttrs=w),P}function ae(f,x){let w=_.parse(f,x||"return-type");if(w)return w;let P=f.consume("void");if(P){let A=new _({source:f.source,tokens:{base:P}});return A.type="return-type",A}}function ke(f){let x=f.consume("stringifier");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("Unterminated stringifier")}function U(f){let x=f.split(`
558
+ `);if(x.length){let w=x[x.length-1].match(/^\s+/);if(w)return w[0]}return""}function le(f){return()=>{if(f.extAttrs.length){let x=new ut("Exposed=Window,"),w=y.parse(x);w.tokens.separator=x.consume(",");let P=f.extAttrs[0];/^\s/.test(P.tokens.name.trivia)||(P.tokens.name.trivia=` ${P.tokens.name.trivia}`),f.extAttrs.unshift(w)}else{te(f).extAttrs=v.parse(new ut("[Exposed=Window]"));let x=f.tokens.base.trivia;f.extAttrs.tokens.open.trivia=x,f.tokens.base.trivia=`
559
+ ${U(x)}`}}}function G(f){if(f.extAttrs.length)return f.extAttrs.tokens.open;if(f.type==="operation"&&!f.special)return G(f.idlType);return Object.values(f.tokens).sort((x,w)=>x.index-w.index)[0]}function te(f,x){if(x||(x=f),!f)return f;return new Proxy(f,{get(w,P){let A=w[P];return Array.isArray(A)&&P!=="source"?te(A,w):A},set(w,P,A){if(w[P]=A,!A)return!0;if(Array.isArray(A))for(let B of A)B.parent!==void 0&&(B.parent=x);else A.parent!==void 0&&(A.parent=x);return!0}})}let Le={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},fe=["ArrayBuffer","SharedArrayBuffer","DataView","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","Uint8ClampedArray","BigInt64Array","BigUint64Array","Float16Array","Float32Array","Float64Array","any","object","symbol"],Be=["ByteString","DOMString","USVString"],K=["async","attribute","callback","const","constructor","deleter","dictionary","enum","getter","includes","inherit","interface","iterable","maplike","namespace","partial","required","setlike","setter","static","stringifier","typedef","unrestricted"],We=["-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(K,Be,fe),Xe=["(",")",",","...",":",";","<","=",">","?","*","[","]","{","}"],pt=["_constructor","toString","_toString"];class ut{constructor(f){this.source=function(x){let w=[],P=0,A="",B=1,X=0;for(;P<x.length;){let ce=x.charAt(P),ge=-1;if(/[\t\n\r ]/.test(ce)?ge=de("whitespace",{noFlushTrivia:!0}):ce==="/"&&(ge=de("comment",{noFlushTrivia:!0})),ge!==-1){let _e=w.pop().value;B+=(_e.match(/\n/g)||[]).length,A+=_e,X-=1}else if(/[-0-9.A-Z_a-z]/.test(ce)){if(ge=de("decimal"),ge===-1&&(ge=de("integer")),ge===-1){ge=de("identifier");let _e=w.length-1,Ae=w[_e];if(ge!==-1){if(pt.includes(Ae.value)){let jt=`${M(Ae.value)} is a reserved identifier and must not be used.`;throw new Ue(n(w,_e,null,jt))}We.includes(Ae.value)&&(Ae.type="inline")}}}else ce==='"'&&(ge=de("string"));for(let _e of Xe)if(x.startsWith(_e,P)){w.push({type:"inline",value:_e,trivia:A,line:B,index:X}),A="",P+=_e.length,ge=P;break}if(ge===-1&&(ge=de("other")),ge===-1)throw Error("Token stream not progressing");P=ge,X+=1}return w.push({type:"eof",value:"",trivia:A,line:B,index:X}),w;function de(ce,{noFlushTrivia:ge}={}){let _e=Le[ce];_e.lastIndex=P;let Ae=_e.exec(x);return Ae?(w.push({type:ce,value:Ae[0],trivia:A,line:B,index:X}),ge||(A=""),_e.lastIndex):-1}}(f),this.position=0}error(f){throw new Ue(n(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 x of f){if(!this.probeKind(x))continue;let w=this.source[this.position];return this.position++,w}}consume(...f){if(!this.probeKind("inline"))return;let x=this.source[this.position];for(let w of f)if(x.value===w)return this.position++,x}consumeIdentifier(f){if(this.probeKind("identifier")&&this.source[this.position].value===f)return this.consumeKind("identifier")}unconsume(f){this.position=f}}class Ue extends Error{constructor({message:f,bareMessage:x,context:w,line:P,sourceName:A,input:B,tokens:X}){super(f),this.name="WebIDLParseError",this.bareMessage=x,this.context=w,this.line=P,this.sourceName=A,this.input=B,this.tokens=X}}class bt extends c{static parse(f){let x=f.consumeKind("string");if(x)return new bt({source:f.source,tokens:{value:x}})}get type(){return"enum-value"}get value(){return super.value.slice(1,-1)}write(f){let{parent:x}=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:x}),'"']),{data:this,parent:x}),f.token(this.tokens.separator)])}}class Mt extends i{static parse(f){let x={};if(x.base=f.consume("enum"),!x.base)return;x.name=f.consumeKind("identifier")||f.error("No name for enum");let w=te(new Mt({source:f.source,tokens:x}));return f.current=w.this,x.open=f.consume("{")||f.error("Bodyless enum"),w.values=L(f,{parser:bt.parse,allowDangler:!0,listName:"enumeration"}),f.probeKind("string")&&f.error("No comma between enum values"),x.close=f.consume("}")||f.error("Unexpected value in enum"),w.values.length||f.error("No value in enum"),x.termination=f.consume(";")||f.error("No semicolon after enum"),w.this}get type(){return"enum"}get name(){return M(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((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Xr extends i{static parse(f){let x=f.consumeKind("identifier");if(!x)return;let w={target:x};if(w.includes=f.consume("includes"),w.includes)return w.mixin=f.consumeKind("identifier")||f.error("Incomplete includes statement"),w.termination=f.consume(";")||f.error("No terminating ; for includes statement"),new Xr({source:f.source,tokens:w});f.unconsume(x.index)}get type(){return"includes"}get target(){return M(this.tokens.target.value)}get includes(){return M(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 En extends i{static parse(f){let x={},w=te(new En({source:f.source,tokens:x}));if(x.base=f.consume("typedef"),x.base)return w.idlType=ee(f,"typedef-type")||f.error("Typedef lacks a type"),x.name=f.consumeKind("identifier")||f.error("Typedef lacks a name"),f.current=w.this,x.termination=f.consume(";")||f.error("Unterminated typedef, expected `;`"),w.this}get type(){return"typedef"}get name(){return M(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 Mi extends i{static parse(f,x){let w={base:x},P=te(new Mi({source:f.source,tokens:w}));return w.name=f.consumeKind("identifier")||f.error("Callback lacks a name"),f.current=P.this,w.assign=f.consume("=")||f.error("Callback lacks an assignment"),P.idlType=ae(f)||f.error("Callback lacks a return type"),w.open=f.consume("(")||f.error("Callback lacks parentheses for arguments"),P.arguments=oe(f),w.close=f.consume(")")||f.error("Unterminated callback"),w.termination=f.consume(";")||f.error("Unterminated callback, expected `;`"),P.this}get type(){return"callback"}get name(){return M(this.tokens.name.value)}*validate(f){yield*this.extAttrs.validate(f);for(let x of this.arguments)if(yield*x.validate(f),x.idlType.generic==="async_sequence")yield s(x.tokens.name,x,"async-sequence-idl-to-js","async_sequence types cannot be returned as a callback argument.");yield*this.idlType.validate(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((x)=>x.write(f)),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Jt extends i{static parse(f,x,{inheritable:w,allowedMembers:P}){let{tokens:A,type:B}=x;for(A.name=f.consumeKind("identifier")||f.error(`Missing name in ${B}`),f.current=x,x=te(x),w&&Object.assign(A,function(X){let de=X.consume(":");return de?{colon:de,inheritance:X.consumeKind("identifier")||X.error("Inheritance lacks a type")}:{}}(f)),A.open=f.consume("{")||f.error(`Bodyless ${B}`),x.members=[];;){if(A.close=f.consume("}"),A.close)return A.termination=f.consume(";")||f.error(`Missing semicolon after ${B}`),x.this;let X=v.parse(f),de;for(let[ce,...ge]of P)if(de=te(ce(f,...ge)),de)break;de||f.error("Unknown member"),de.extAttrs=X,x.members.push(de.this)}}get partial(){return!!this.tokens.partial}get name(){return M(this.tokens.name.value)}get inheritance(){return this.tokens.inheritance?M(this.tokens.inheritance.value):null}*validate(f){for(let x of this.members)x.validate&&(yield*x.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((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this})}}class Zr extends i{static parse(f){let x={};if(x.base=f.consume("const"),!x.base)return;let w=ue(f);if(!w){let A=f.consumeKind("identifier")||f.error("Const lacks a type");w=new _({source:f.source,tokens:{base:A}})}f.probe("?")&&f.error("Unexpected nullable constant type"),w.type="const-type",x.name=f.consumeKind("identifier")||f.error("Const lacks a name"),x.assign=f.consume("=")||f.error("Const lacks value assignment"),x.value=W(f)||f.error("Const lacks a value"),x.termination=f.consume(";")||f.error("Unterminated const, expected `;`");let P=new Zr({source:f.source,tokens:x});return te(P).idlType=w,P}get type(){return"const"}get name(){return M(this.tokens.name.value)}get value(){return se(this.tokens.value)}write(f){let{parent:x}=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:x}),f.token(this.tokens.assign),f.token(this.tokens.value),f.token(this.tokens.termination)]),{data:this,parent:x})}}class Ji extends i{static parse(f){let x=f.position,w=te(new Ji({source:f.source,tokens:{}})),{tokens:P}=w;if(P.readonly=f.consume("readonly"),P.readonly||(P.async=f.consume("async")),P.base=P.readonly?f.consume("maplike","setlike"):P.async?f.consume("iterable"):f.consume("iterable","async_iterable","maplike","setlike"),!P.base)return void f.unconsume(x);let{type:A}=w,B=A==="maplike",X=B||A==="iterable"||A==="async_iterable",de=A==="async_iterable"||w.async&&A==="iterable";P.open=f.consume("<")||f.error(`Missing less-than sign \`<\` in ${A} declaration`);let ce=ee(f)||f.error(`Missing a type argument in ${A} declaration`);return w.idlType=[ce],w.arguments=[],X&&(ce.tokens.separator=f.consume(","),ce.tokens.separator?w.idlType.push(ee(f)):B&&f.error(`Missing second type argument in ${A} declaration`)),P.close=f.consume(">")||f.error(`Missing greater-than sign \`>\` in ${A} declaration`),f.probe("(")&&(de?(P.argsOpen=f.consume("("),w.arguments.push(...oe(f)),P.argsClose=f.consume(")")||f.error("Unterminated async iterable argument list")):f.error("Arguments are only allowed for `async iterable`")),P.termination=f.consume(";")||f.error(`Missing semicolon after ${A} declaration`),w.this}get type(){return this.tokens.base.value}get readonly(){return!!this.tokens.readonly}get async(){return!!this.tokens.async}*validate(f){if(this.async&&this.type==="iterable")yield s(this.tokens.async,this,"obsolete-async-iterable-syntax","`async iterable` is now changed to `async_iterable`.",{autofix:(x=this,()=>{let P=x.tokens.async;x.tokens.base={...P,type:"async_iterable",value:"async_iterable"},delete x.tokens.async})});var x;for(let w of this.idlType)yield*w.validate(f);for(let w of this.arguments)yield*w.validate(f)}write(f){return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.readonly),f.token(this.tokens.async),f.token(this.tokens.base,f.ts.generic),f.token(this.tokens.open),f.ts.wrap(this.idlType.map((x)=>x.write(f))),f.token(this.tokens.close),f.token(this.tokens.argsOpen),f.ts.wrap(this.arguments.map((x)=>x.write(f))),f.token(this.tokens.argsClose),f.token(this.tokens.termination)]),{data:this,parent:this.parent})}}class Is extends i{static parse(f){let x=f.consume("constructor");if(!x)return;let w={base:x};w.open=f.consume("(")||f.error("No argument list in constructor");let P=oe(f);w.close=f.consume(")")||f.error("Unterminated constructor"),w.termination=f.consume(";")||f.error("No semicolon after constructor");let A=new Is({source:f.source,tokens:w});return te(A).arguments=P,A}get type(){return"constructor"}*validate(f){for(let x of this.arguments)yield*x.validate(f)}write(f){let{parent:x}=this;return f.ts.definition(f.ts.wrap([this.extAttrs.write(f),f.token(this.tokens.base,f.ts.nameless,{data:this,parent:x}),f.token(this.tokens.open),f.ts.wrap(this.arguments.map((w)=>w.write(f))),f.token(this.tokens.close),f.token(this.tokens.termination)]),{data:this,parent:x})}}function ts(f){let x=f.consume("static");if(!x)return;return D.parse(f,{special:x})||I.parse(f,{special:x})||f.error("No body in static member")}class Ms extends Jt{static parse(f,x,{extMembers:w=[],partial:P=null}={}){let A={partial:P,base:x};return Jt.parse(f,new Ms({source:f.source,tokens:A}),{inheritable:!P,allowedMembers:[...w,[Zr.parse],[Is.parse],[ts],[ke],[Ji.parse],[D.parse],[I.parse]]})}get type(){return"interface"}*validate(f){if(yield*this.extAttrs.validate(f),!this.partial&&this.extAttrs.every((w)=>w.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Interfaces must have `[Exposed]` extended attribute. To fix, add, for example, `[Exposed=Window]`. Please also consider carefully if your interface should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});let x=this.extAttrs.filter((w)=>w.name==="Constructor");for(let w of x)yield s(w.tokens.name,this,"constructor-member","Constructors should now be represented as a `constructor()` operation on the interface instead of `[Constructor]` extended attribute. Refer to the [WebIDL spec section on constructor operations](https://heycam.github.io/webidl/#idl-constructors) for more information.",{autofix:oa(this,w)});if(this.extAttrs.some((w)=>w.name==="Global")){let w=this.extAttrs.filter((A)=>A.name==="LegacyFactoryFunction");for(let A of w)yield s(A.tokens.name,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have factory functions.");let P=this.members.filter((A)=>A.type==="constructor");for(let A of P)yield s(A.tokens.base,this,"no-constructible-global","Interfaces marked as `[Global]` cannot have constructors.")}yield*super.validate(f),this.partial||(yield*function*(w,P){let A=function(ge){let _e=ce(ge);return{statics:new Set(_e.filter((Ae)=>Ae.special==="static").map((Ae)=>Ae.name)),nonstatics:new Set(_e.filter((Ae)=>Ae.special!=="static").map((Ae)=>Ae.name))}}(P),B=w.partials.get(P.name)||[],X=w.mixinMap.get(P.name)||[];for(let ge of[...B,...X]){let _e=ce(ge),Ae=_e.filter((Dt)=>Dt.special==="static"),jt=_e.filter((Dt)=>Dt.special!=="static");yield*de(Ae,A.statics,ge,P),yield*de(jt,A.nonstatics,ge,P),Ae.forEach((Dt)=>A.statics.add(Dt.name)),jt.forEach((Dt)=>A.nonstatics.add(Dt.name))}function*de(ge,_e,Ae,jt){for(let Dt of ge){let{name:Di}=Dt;if(Di&&_e.has(Di)){let jc=`The ${Dt.special==="static"?"static ":""}operation "${Di}" has already been defined for the base interface "${jt.name}" either in itself or in a mixin`;yield s(Dt.tokens.name,Ae,"no-cross-overload",jc)}}}function ce(ge){return ge.members.filter(({type:_e})=>_e==="operation")}}(f,this))}}function oa(f,x){return f=te(f),()=>{let w=U(f.extAttrs.tokens.open.trivia),P=f.members.length?U(G(f.members[0]).trivia):function(_e){let Ae=U(_e),jt=Ae.includes("\t")?"\t":" ";return Ae+jt}(w),A=Is.parse(new ut(`
560
+ ${P}constructor();`));A.extAttrs=new v({source:f.source,tokens:{}}),te(A).arguments=x.arguments;let B=function(_e,Ae){let jt=_e.slice().reverse().findIndex(Ae);return jt===-1?jt:_e.length-jt-1}(f.members,(_e)=>_e.type==="constructor");f.members.splice(B+1,0,A);let{close:X}=f.tokens;X.trivia.includes(`
561
+ `)||(X.trivia+=`
562
+ ${w}`);let{extAttrs:de}=f,ce=de.indexOf(x),ge=de.splice(ce,1);de.length?de.length===ce?de[ce-1].tokens.separator=void 0:de[ce].tokens.name.trivia.trim()||(de[ce].tokens.name.trivia=ge[0].tokens.name.trivia):de.tokens.open=de.tokens.close=void 0}}class Qr extends Jt{static parse(f,x,{extMembers:w=[],partial:P}={}){let A={partial:P,base:x};if(A.mixin=f.consume("mixin"),A.mixin)return Jt.parse(f,new Qr({source:f.source,tokens:A}),{allowedMembers:[...w,[Zr.parse],[ke],[D.parse,{noInherit:!0}],[I.parse,{regular:!0}]]})}get type(){return"interface mixin"}}class J extends i{static parse(f){let x={},w=te(new J({source:f.source,tokens:x}));return w.extAttrs=v.parse(f),x.required=f.consume("required"),w.idlType=ee(f,"dictionary-type")||f.error("Dictionary member lacks a type"),x.name=f.consumeKind("identifier")||f.error("Dictionary member lacks a name"),w.default=O.parse(f),x.required&&w.default&&f.error("Required member must not have a default"),x.termination=f.consume(";")||f.error("Unterminated dictionary member, expected `;`"),w.this}get type(){return"field"}get name(){return M(this.tokens.name.value)}get required(){return!!this.tokens.required}*validate(f){yield*this.idlType.validate(f)}write(f){let{parent:x}=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:x}),this.default?this.default.write(f):"",f.token(this.tokens.termination)]),{data:this,parent:x})}}class H extends Jt{static parse(f,{extMembers:x=[],partial:w}={}){let P={partial:w};if(P.base=f.consume("dictionary"),P.base)return Jt.parse(f,new H({source:f.source,tokens:P}),{inheritable:!w,allowedMembers:[...x,[J.parse]]})}get type(){return"dictionary"}}class V extends Jt{static parse(f,{extMembers:x=[],partial:w}={}){let P={partial:w};if(P.base=f.consume("namespace"),P.base)return Jt.parse(f,new V({source:f.source,tokens:P}),{allowedMembers:[...x,[D.parse,{noInherit:!0,readonly:!0}],[Zr.parse],[I.parse,{regular:!0}]]})}get type(){return"namespace"}*validate(f){if(!this.partial&&this.extAttrs.every((x)=>x.name!=="Exposed"))yield s(this.tokens.name,this,"require-exposed","Namespaces must have [Exposed] extended attribute. To fix, add, for example, [Exposed=Window]. Please also consider carefully if your namespace should also be exposed in a Worker scope. Refer to the [WebIDL spec section on Exposed](https://heycam.github.io/webidl/#Exposed) for more information.",{autofix:le(this)});yield*super.validate(f)}}class ie extends Jt{static parse(f,x,{extMembers:w=[]}={}){let P={callback:x};if(P.base=f.consume("interface"),P.base)return Jt.parse(f,new ie({source:f.source,tokens:P}),{allowedMembers:[...w,[Zr.parse],[I.parse,{regular:!0}]]})}get type(){return"callback interface"}}function Ee(f,x){let w=f.source;function P(ce){f.error(ce)}function A(...ce){return f.consume(...ce)}function B(ce){let ge=A("interface");if(ge)return Qr.parse(f,ge,{...ce,...x?.extensions?.mixin})||Ms.parse(f,ge,{...ce,...x?.extensions?.interface})||P("Interface has no proper body")}function X(){if(x.productions)for(let ce of x.productions){let ge=ce(f);if(ge)return ge}return function(){let ce=A("callback");if(ce)return f.probe("interface")?ie.parse(f,ce,{...x?.extensions?.callbackInterface}):Mi.parse(f,ce)}()||B()||function(){let ce=A("partial");if(ce)return H.parse(f,{partial:ce,...x?.extensions?.dictionary})||B({partial:ce})||V.parse(f,{partial:ce,...x?.extensions?.namespace})||P("Partial doesn't apply to anything")}()||H.parse(f,x?.extensions?.dictionary)||Mt.parse(f)||En.parse(f)||Xr.parse(f)||V.parse(f,x?.extensions?.namespace)}let de=function(){if(!w.length)return[];let ce=[];for(;;){let _e=v.parse(f),Ae=X();if(!Ae){_e.length&&P("Stray extended attributes");break}te(Ae).extAttrs=_e,ce.push(Ae)}let ge=u.parse(f);return x.concrete&&ce.push(ge),ce}();return f.position<w.length&&P("Unrecognised tokens"),de}function Cr(f,x={}){let w=new ut(f);return x.sourceName!==void 0&&(w.source.name=x.sourceName),Ee(w,x)}function ze(f){return f}let Ne={wrap:(f)=>f.join(""),trivia:ze,name:ze,reference:ze,type:ze,generic:ze,nameless:ze,inheritance:ze,definition:ze,extendedAttribute:ze,extendedAttributeReference:ze};class he{constructor(f){this.ts=Object.assign({},Ne,f)}reference(f,{unescaped:x,context:w}){return x||(x=f.startsWith("_")?f.slice(1):f),this.ts.reference(f,x,w)}token(f,x=ze,...w){if(!f)return"";let P=x(f.value,...w);return this.ts.wrap([this.ts.trivia(f.trivia),P])}reference_token(f,x){return this.token(f,this.reference.bind(this),{context:x})}name_token(f,x){return this.token(f,this.ts.name,x)}identifier(f,x){return this.ts.wrap([this.reference_token(f.tokens.value,x),this.token(f.tokens.separator)])}}function xt(f,{templates:x=Ne}={}){x=Object.assign({},Ne,x);let w=new he(x);return x.wrap(f.map((P)=>P.write(w)))}function st(f,x){let w=new Map,P=f.filter((A)=>A.type==="includes");for(let A of P){let B=x.get(A.includes);if(!B)continue;let X=w.get(A.target);X?X.push(B):w.set(A.target,[B])}return w}function*ot(f){let x=function(w){let P=new Map,A=new Set,B=new Map;for(let X of w)if(X.partial){let de=B.get(X.name);de?de.push(X):B.set(X.name,[X])}else X.name&&(P.has(X.name)?A.add(X):P.set(X.name,X));return{all:w,unique:P,partials:B,duplicates:A,mixinMap:st(w,P),cache:{typedefIncludesDictionary:new WeakMap,dictionaryIncludesRequiredField:new WeakMap}}}(f);for(let w of x.all)w.validate&&(yield*w.validate(x));yield*function*({unique:w,duplicates:P}){for(let A of P){let{name:B}=A,X=`The name "${B}" of type "${w.get(B).type}" was already seen`;yield s(A.tokens.name,A,"no-duplicate",X)}}(x)}function Qt(f){return[...ot((x=f,x.flat?x.flat():[].concat(...x)))];var x}return t})())});var xw=C(function(uX,bw){var __dirname="/home/runner/work/jx/jx/node_modules/@webref/idl",mw=Te("fs").promises,hw=Te("path"),vL=pw();class gw{constructor(e,t){this.filename=t,this.shortname=hw.basename(t,".idl"),this.path=hw.join(e,t)}async text(){return await mw.readFile(this.path,"utf8")}async parse(){let e=await this.text();return vL.parse(e)}}async function yw({folder:e=__dirname}={}){let t={},r=await mw.readdir(e);for(let n of r)if(n.endsWith(".idl")){let s=new gw(e,n);t[s.shortname]=s}return t}async function wL(e){let t=await yw(e);for(let[r,n]of Object.entries(t))t[r]=await n.parse();return t}bw.exports={listAll:yw,parseAll:wL}});var $w,vw;var ww=q(()=>{$w={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."},vw={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var Sw;var Ew=q(()=>{Sw={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 _w,Pw,jw;var kw=q(()=>{_w={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Pw={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},jw={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var Rw;var Aw=q(()=>{Rw={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 Ow,Cw;var Tw=q(()=>{Ow={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"},Cw={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 Nw;var Iw=q(()=>{Nw={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Mw,Jw,Dw,Lw,Fw,qw,Hw,Vw,Bw;var Ww=q(()=>{Mw={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Jw={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Dw={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Lw={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Fw={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},qw={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done"],pattern:String.raw`^\$map/(item|index)(/.*)?$`,type:"string"},Hw={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Vw={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"},Bw={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Nl;var Uw=q(()=>{Nl={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 zw,Gw;var Kw=q(()=>{zw={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item. A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Gw={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 Yw,Xw,Zw,Qw,e0,cf;var t0=q(()=>{Yw={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Xw={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"},Zw={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Qw={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"},e0={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"},cf={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 r0;var n0=q(()=>{r0={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 s0;var i0=q(()=>{s0={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive. First parameter is always state (the reactive scope).',properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: an opaque JS source string (first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → JS string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var o0,a0;var l0=q(()=>{o0={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"}]},a0={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 c0;var u0=q(()=>{c0={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 d0;var f0=q(()=>{d0={description:"A reusable JSON Schema type definition for tooling only. No function, no runtime artifact. Referenced from state entries via $ref. Naming convention: PascalCase.",not:{anyOf:[{required:["default"]},{required:["$prototype"]}]},properties:{description:{type:"string"},enum:{type:"array"},examples:{type:"array"},items:{},maxLength:{minimum:0,type:"integer"},maximum:{type:"number"},minLength:{minimum:0,type:"integer"},minimum:{type:"number"},pattern:{type:"string"},properties:{type:"object"},required:{items:{type:"string"},type:"array"},type:{$ref:"#/$defs/JsonSchemaType"}},required:["type"],type:"object"}});var p0,m0,h0,g0,y0,b0,x0,$0,v0,w0,S0,E0,_0,P0,j0,k0,R0;var A0=q(()=>{su();p0={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"},m0={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."},h0={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."},g0={enum:["!","-"]},y0={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},b0={const:"?:"},x0={const:"switch"},$0={const:"call"},v0={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"]},w0={enum:["=","+=","-=","*=","/="]},S0={enum:["pop","shift"]},E0={enum:["push","unshift"]},_0={const:"splice"},P0={const:"reduce"},j0={enum:["map","filter"]},k0={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 "+`${Nh()}) — 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"},R0={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 O0,C0,T0,N0;var I0=q(()=>{O0={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"}]},C0={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},T0={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},N0={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 SL,uf,df,ff,pf,mf,hf,gf,yf,bf,M0;var J0=q(()=>{SL=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],uf={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"},df={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"},ff={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},pf={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:SL,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"},mf={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"},hf={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"},gf={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"},yf={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"},bf={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"},M0={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});var D0;var L0=q(()=>{D0={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 Il;var F0=q(()=>{Il={description:"Image optimization configuration for the project.",properties:{formats:{items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" runs Sharp at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var EL,xf;var q0=q(()=>{gs();EL=[301,302,303,307,308],xf={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"Global type definitions available to all pages.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:"utf8",description:"Default charset for the page.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},layout:{default:null,description:"Default layout file path applied to all pages. Set to null to render pages without a layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{type:"null"}]},shadow:{default:!1,description:"Default shadow-DOM mode for every component (spec.md §16.6). Off unless set: a "+"shadow root isolates component styles from the page and replaces the <slot> emulation with real slot distribution. A component's own `$shadow` overrides this in both directions.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]}},type:"object"},extensions:{description:"Extension packages: bare package names (resolved project-first through the package exports map) or relative paths. Each must export jx-extension.json.",examples:[["@jxsuite/parser"]],items:{type:"string"},type:"array"},manifest:{additionalProperties:!1,description:'W3C Web App Manifest, emitted as manifest.webmanifest with a <link rel="manifest"> on every page. Absent means no manifest: it is a claim that a site is meant to be installed, and most are not.',properties:{backgroundColor:{type:"string"},categories:{items:{type:"string"},type:"array"},description:{type:"string"},dir:{enum:["ltr","rtl","auto"],type:"string"},display:{default:"standalone",enum:["fullscreen","standalone","minimal-ui","browser"],type:"string"},enabled:{default:!0,type:"boolean"},icons:{description:"Icons at 192px and 512px are what browsers require before offering to install the site; the build warns when either is missing.",items:{additionalProperties:!1,properties:{purpose:{type:"string"},sizes:{examples:["192x192"],type:"string"},src:{type:"string"},type:{type:"string"}},required:["src"],type:"object"},type:"array"},lang:{type:"string"},name:{description:"Defaults to the project name.",type:"string"},orientation:{type:"string"},scope:{type:"string"},shortName:{type:"string"},startUrl:{default:"/",type:"string"},themeColor:{type:"string"}},type:"object"},serviceWorker:{default:!1,description:"W3C Service Worker, emitted as sw.js. Off unless declared — a worker is sticky, so it "+"is the one output that can keep breaking visitors after a deploy tries to fix them. **Turning it off means `false`, not deleting the key**: `false` emits a tombstone at the same URL that unregisters the old worker and clears its caches, and a 404 there is not an instruction to stop. HTML is always network-first; only the content-addressed /images/_optimized/* is served cache-first.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{enabled:{default:!0,type:"boolean"},offlineFallback:{description:"Page served for a failed navigation. Added to `precache` if not already there.",type:"string"},precache:{description:"Site-absolute URLs fetched at install time. Each must be a file this build produces; one that is not fails the build, because a single unreachable entry stops the worker installing at all.",items:{pattern:"^/",type:"string"},type:"array"},scope:{default:"/",type:"string"}},type:"object"}]},securityTxt:{additionalProperties:!1,description:"RFC 9116 security.txt, emitted at .well-known/security.txt. `expires` is required by "+"§2.5.5 and an absent or past value is a build error — an expired file advertises a "+"reporting channel while telling the reporter not to trust it. A hand-placed public/.well-known/security.txt shadows this, which is how a clearsigned file ships.",properties:{acknowledgments:{items:{type:"string"},type:"array"},canonical:{type:"string"},contact:{description:"At least one mailto:, https: or tel: URI (§2.5.3).",items:{type:"string"},type:"array"},enabled:{default:!0,type:"boolean"},encryption:{items:{type:"string"},type:"array"},expires:{format:"date-time",type:"string"},hiring:{items:{type:"string"},type:"array"},policy:{items:{type:"string"},type:"array"},preferredLanguages:{description:"BCP 47 tags, validated and canonicalized like i18n.locales.",items:{pattern:Pa,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:Pa,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Pa,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:[...EL],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});function _L(){return H0??=PL(),H0}async function PL(){let[e,t,r]=await Promise.all([B0.listAll(),W0.default.listAll(),U0.default.parseAll()]),n=new Set;for(let{elements:c}of Object.values(e))for(let u of c)if(!u.obsolete)n.add(u.name);let s=[...n].toSorted(),i=new Set;for(let c of t.properties)for(let u of c.styleDeclaration??[])i.add(u);let o=[...i].toSorted(),a=new Set;for(let c of Object.values(r))for(let u of c){if(u.type!=="interface"&&u.type!=="interface mixin")continue;if(!u.members)continue;for(let p of u.members)if(p.type==="attribute"&&p.name?.startsWith("on")&&p.idlType?.idlType==="EventHandler")a.add(p.name)}let l=[...a].toSorted();return{cssProps:o,eventHandlers:l,tagExamples:s}}function jL(e){let t={};for(let r of e)t[r]={description:`Event handler for the "${r.slice(2)}" event.`,oneOf:[{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/ExpressionEntry"},{$ref:"#/$defs/FunctionDef"}]};return t}function kL(e){let t={...Nl.properties};for(let r of e)t[r]={oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"}]};return t}async function RL(){let{tagExamples:e,cssProps:t,eventHandlers:r}=await _L();return{$defs:{DefsMap:T0,TypeDefEntry:N0,StateMap:C0,StateEntry:O0,TypedStateDef:r0,PureTypeDef:d0,FunctionDef:s0,ClassDef:M0,ClassParameterDef:uf,ClassFieldDef:df,ClassConstructorDef:ff,ClassMethodDef:pf,FormatDef:mf,ProjectBlockDef:hf,ServerBlockDef:gf,ConnectorBlockDef:yf,StudioHints:bf,ExternalClassDef:c0,ExpressionPointer:p0,ExpressionLiteral:m0,ExpressionOperand:h0,UnaryOperator:g0,BinaryOperator:y0,ConditionalOperator:b0,SwitchOperator:x0,CallOperator:$0,PureMethod:v0,AssignmentOperator:w0,NoArgMethod:S0,OneArgMethod:E0,SpliceMethod:_0,ReduceMethod:P0,MapFilterMethod:j0,ExpressionNode:k0,ExpressionEntry:R0,Statement:o0,StatementList:a0,ElementDef:{...cf,properties:{...cf.properties,...jL(r)}},ChildrenValue:Gw,ArrayNamespace:zw,SwitchDef:Qw,SwitchNode:e0,StyleObject:{...Nl,properties:kL(t)},AttributesObject:Yw,PropsObject:Xw,RefObject:Vw,AnyRef:Hw,InternalRef:Mw,StateRef:Jw,ExternalRef:Dw,ExternalComponentRef:Bw,GlobalRef:Lw,ParentRef:Fw,MapRef:qw,ElementPropertyValue:Zw,StringOrRef:_w,BoolOrRef:Pw,NumberOrRef:jw,CemParameter:Ow,CemEvent:Cw,TagName:{...Sw,examples:[...e,"my-counter","todo-app","user-card"]},TagExpression:$w,ElementTagName:vw,JsonSchemaType:Nw,HeadEntry:Rw,ImageConfig:Il,PathsValue:{$id:_s,anyOf:[...jo,ef],description:"Default $paths source union: the core shapes, plus a catch-all for source shapes contributed by extensions this schema cannot see. The project's generated document.schema.json replaces this with the exact set its extensions provide."}},$id:"https://jxsuite.com/schema/v1",$schema:"https://json-schema.org/draft/2020-12/schema",additionalProperties:{$ref:"#/$defs/ElementPropertyValue"},description:"Schema for Jx component files. A Jx document is a JSON object that declaratively describes a reactive web component: its structure (DOM tree), styling, type definitions ($defs), runtime state, and inline or external functions. Reactivity is powered by @vue/reactivity.",properties:{$defs:{$ref:"#/$defs/DefsMap",description:"Pure JSON Schema type definitions for this component. "+"All entries are reusable type schemas — no runtime artifacts are produced. "+"Referenced from state entries via $ref. Naming convention: PascalCase."},$elements:{description:"Custom element dependencies. Items are either $ref objects pointing to JX element definitions, or bare npm package name strings for web component libraries.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{description:"npm package specifier (must declare customElements in package.json)",type:"string"}]},type:"array"},$head:{description:"Page-level <head> entries. Array of head entries for meta tags, link tags, script tags, etc. Merged with layout and site-level $head entries.",items:{$ref:"#/$defs/HeadEntry"},type:"array"},$id:{description:"Component identifier string. Used by tooling and the builder.",examples:["Counter","TodoApp","UserCard"],type:"string"},$dir:{description:"Base direction for this page's <html> element, overriding `defaults.dir`. Right-to-left content renders left-to-right without it.",enum:["ltr","rtl","auto"],type:"string"},$lang:{description:"Language tag for this page's <html> element, overriding `defaults.lang` "+"(site-architecture.md §8.4).",examples:["en","fr","ar-EG"],type:"string"},$translationKey:{description:"This page's identity across languages, overriding the one its path implies "+"(site-architecture.md §13.5). Two routes are translations when their keys match; "+"the default key is the path with the locale prefix removed, which is right whenever "+"the paths are parallel and wrong for a localized slug — /fr-ca/a-propos/ shares "+"nothing with /about/ until one of them says so.",examples:["about","blog/hello-world"],type:"string"},$layout:{description:"Layout reference for pages. String path to a layout JSON file, or false to opt out of the default layout.",examples:["./layouts/base.json"],oneOf:[{type:"string"},{const:!1,type:"boolean"}]},$shadow:{description:"Render this component into a shadow root instead of the light DOM (spec.md §16.6). "+"Off unless set: a shadow root isolates the component's styles from the page and replaces the <slot> emulation with real slot distribution, so it changes how the "+"component composes. Overrides `defaults.shadow` in both directions — `false` opts "+"one component out of a project that opted in.",oneOf:[{enum:["open","closed"],type:"string"},{const:!1,type:"boolean"}]},$sitemap:{description:"Set false to exclude this page from sitemap.xml (site-architecture.md §8.4.1). "+"Every other page with a URL is included.",type:"boolean"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Keys use the CSS custom property -- prefix. Pure color-scheme queries (e.g. "--dark": "(prefers-color-scheme: dark)") are dual-emitted so a data-color-scheme attribute on the root element forces the scheme '+"regardless of the OS preference (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$paths:{$ref:_s,description:"Dynamic route source for a page: expands one page per entry at build time. One of the core shapes (explicit `values`, a `$ref` data file, or a bare array of parameter objects) or a source shape contributed by an enabled extension, such as the parser's `contentType`."},$schema:{description:"URI identifying the Jx dialect version. Enables schema-aware IDE tooling.",examples:["https://jxsuite.com/schema/v1"],type:"string"},attributes:{$ref:"#/$defs/AttributesObject"},cases:{additionalProperties:{oneOf:[{$ref:"#/$defs/ElementDef"},{$ref:"#/$defs/ExternalComponentRef"}]},description:"Switch cases object. Maps case values to element definitions or external component refs. Used alongside $switch for dynamic component rendering.",type:"object"},children:{$ref:"#/$defs/ChildrenValue"},imports:{additionalProperties:{type:"string"},description:"Import map: $prototype names to .class.json file paths. Allows state entries to reference external classes by name without $src.",type:"object"},observedAttributes:{description:"HTML attributes the custom element watches for changes. Follows the Web Components observedAttributes convention.",items:{type:"string"},type:"array"},state:{$ref:"#/$defs/StateMap",description:"Runtime variables for this component. All entries are reactive by default. Entry shape is determined by value type: "+"scalar/array → reactive property, string with ${} → computed, "+"object with $prototype → function or data source, "+"object with type and default → typed reactive property."},style:{$ref:"#/$defs/StyleObject"},tagName:{$ref:"#/$defs/TagName"},title:{$ref:"#/$defs/StringOrRef",description:"Page title. Can be a static string or a template string with ${} expressions."}},title:"Jx Document",type:"object"}}function AL(){return{$defs:{ImageConfig:Il,StyleObject:z0},$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:xf.properties,title:"Jx Project",type:"object"}}function OL(){return{$defs:{ImageConfig:Il,JxFieldSchema:Bv,RelationshipRef:Wv,StyleObject:z0},$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:xf.properties,title:"Jx Project Core",type:"object"}}function CL(){return{$id:Po,$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 TL(){return{$id:_s,$schema:"https://json-schema.org/draft/2020-12/schema",anyOf:[...jo,ef],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 NL(){return{$id:"https://jxsuite.com/schema/extension-manifest/v1",$schema:"https://json-schema.org/draft/2020-12/schema",title:"Jx Extension Manifest",...D0}}function $f(){return{$defs:{ClassConstructorDef:ff,ClassFieldDef:df,ClassMethodDef:pf,ClassParameterDef:uf,ConnectorBlockDef:yf,FormatDef:mf,ProjectBlockDef:hf,ServerBlockDef:gf,StudioHints:bf},$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 IL(e){let{mkdirSync:t,writeFileSync:r}=await import("node:fs"),{resolve:n,dirname:s}=await import("node:path"),i=s(n(e,"..")),o=await RL(),a=AL(),l=$f(),c=OL(),u=NL(),p=CL(),g=TL(),m=JSON.stringify(o,null,2),b=JSON.stringify(a,null,2),h=JSON.stringify(l,null,2),y=JSON.stringify(c,null,2),v=JSON.stringify(u,null,2),j=JSON.stringify(p,null,2),S=JSON.stringify(g,null,2),[_]=process.argv.slice(2);if(_)r(_,m,"utf8"),console.error(`Jx component schema written to ${_}`);else{r(n(i,"schema.json"),m,"utf8"),r(n(i,"project-schema.json"),b,"utf8"),r(n(i,"class-schema.json"),h,"utf8"),t(n(i,"schemas"),{recursive:!0}),r(n(i,"schemas","project.core.schema.json"),y,"utf8"),r(n(i,"schemas","project.fields.schema.json"),j,"utf8"),r(n(i,"schemas","document.paths.schema.json"),S,"utf8"),r(n(i,"extension-manifest.schema.json"),v,"utf8");let E=Bun.spawnSync(["bunx","oxfmt",n(i,"schemas","project.core.schema.json"),n(i,"schemas","project.fields.schema.json"),n(i,"schemas","document.paths.schema.json")],{cwd:i});if(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 B0,W0,U0,H0=null,z0,V0,rZ;var G0=q(()=>{ww();Ew();kw();Aw();Tw();Iw();Ww();Uw();Kw();t0();n0();i0();l0();u0();f0();A0();I0();J0();L0();Ol();F0();q0();B0=Lt(cw(),1),W0=Lt(fw(),1),U0=Lt(xw(),1);z0={...Nl,additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]}};[,V0]=process.argv,rZ=V0?.endsWith("schema.ts")?IL(V0):void 0});var To=C(function(X0){Object.defineProperty(X0,"__esModule",{value:!0});X0.regexpCode=X0.getEsmExportName=X0.getProperty=X0.safeStringify=X0.stringify=X0.strConcat=X0.addCodeArg=X0.str=X0._=X0.nil=X0._Code=X0.Name=X0.IDENTIFIER=X0._CodeOrName=void 0;class Ml{}X0._CodeOrName=Ml;X0.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class yi extends Ml{constructor(e){super();if(!X0.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}}}X0.Name=yi;class Pr extends Ml{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof yi)t[r.str]=(t[r.str]||0)+1;return t},{})}}X0._Code=Pr;X0.nil=new Pr("");function K0(e,...t){let r=[e[0]],n=0;while(n<t.length)wf(r,t[n]),r.push(e[++n]);return new Pr(r)}X0._=K0;var vf=new Pr("+");function Y0(e,...t){let r=[Co(e[0])],n=0;while(n<t.length)r.push(vf),wf(r,t[n]),r.push(vf,Co(e[++n]));return ML(r),new Pr(r)}X0.str=Y0;function wf(e,t){if(t instanceof Pr)e.push(...t._items);else if(t instanceof yi)e.push(t);else e.push(LL(t))}X0.addCodeArg=wf;function ML(e){let t=1;while(t<e.length-1){if(e[t]===vf){let r=JL(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function JL(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof yi||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 yi))return`"${e}${t.slice(1)}`;return}function DL(e,t){return t.emptyStr()?e:e.emptyStr()?t:Y0`${e}${t}`}X0.strConcat=DL;function LL(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Co(Array.isArray(e)?e.join(","):e)}function FL(e){return new Pr(Co(e))}X0.stringify=FL;function Co(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}X0.safeStringify=Co;function qL(e){return typeof e=="string"&&X0.IDENTIFIER.test(e)?new Pr(`.${e}`):K0`[${e}]`}X0.getProperty=qL;function HL(e){if(typeof e=="string"&&X0.IDENTIFIER.test(e))return new Pr(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}X0.getEsmExportName=HL;function VL(e){return new Pr(e.toString())}X0.regexpCode=VL});var Pf=C(function(tS){Object.defineProperty(tS,"__esModule",{value:!0});tS.ValueScope=tS.ValueScopeName=tS.Scope=tS.varKinds=tS.UsedValueState=void 0;var zt=To();class Q0 extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Dl;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Dl||(tS.UsedValueState=Dl={}));tS.varKinds={const:new zt.Name("const"),let:new zt.Name("let"),var:new zt.Name("var")};class Ef{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof zt.Name?e:this.name(e)}name(e){return new zt.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}tS.Scope=Ef;class _f extends zt.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=zt._`.${new zt.Name(t)}[${r}]`}}tS.ValueScopeName=_f;var rF=zt._`\n`;class eS extends Ef{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?rF:zt.nil}}get(){return this._scope}name(e){return new _f(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(r=t.key)!==null&&r!==void 0?r:t.ref,o=this._values[s];if(o){let c=o.get(i);if(c)return c}else o=this._values[s]=new Map;o.set(i,n);let a=this._scope[s]||(this._scope[s]=[]),l=a.length;return a[l]=t.ref,n.setValue(t,{property:s,itemIndex:l}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return zt._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let s=zt.nil;for(let i in e){let o=e[i];if(!o)continue;let a=r[i]=r[i]||new Map;o.forEach((l)=>{if(a.has(l))return;a.set(l,Dl.Started);let c=t(l);if(c){let u=this.opts.es5?tS.varKinds.var:tS.varKinds.const;s=zt._`${s}${u} ${l} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(l))s=zt._`${s}${c}${this.opts._n}`;else throw new Q0(l);a.set(l,Dl.Completed)})}return s}}tS.ValueScope=eS});var ye=C(function(Gt){Object.defineProperty(Gt,"__esModule",{value:!0});Gt.or=Gt.and=Gt.not=Gt.CodeGen=Gt.operators=Gt.varKinds=Gt.ValueScopeName=Gt.ValueScope=Gt.Scope=Gt.Name=Gt.regexpCode=Gt.stringify=Gt.getProperty=Gt.nil=Gt.strConcat=Gt.str=Gt._=void 0;var je=To(),jr=Pf(),Wn=To();Object.defineProperty(Gt,"_",{enumerable:!0,get:function(){return Wn._}});Object.defineProperty(Gt,"str",{enumerable:!0,get:function(){return Wn.str}});Object.defineProperty(Gt,"strConcat",{enumerable:!0,get:function(){return Wn.strConcat}});Object.defineProperty(Gt,"nil",{enumerable:!0,get:function(){return Wn.nil}});Object.defineProperty(Gt,"getProperty",{enumerable:!0,get:function(){return Wn.getProperty}});Object.defineProperty(Gt,"stringify",{enumerable:!0,get:function(){return Wn.stringify}});Object.defineProperty(Gt,"regexpCode",{enumerable:!0,get:function(){return Wn.regexpCode}});Object.defineProperty(Gt,"Name",{enumerable:!0,get:function(){return Wn.Name}});var Bl=Pf();Object.defineProperty(Gt,"Scope",{enumerable:!0,get:function(){return Bl.Scope}});Object.defineProperty(Gt,"ValueScope",{enumerable:!0,get:function(){return Bl.ValueScope}});Object.defineProperty(Gt,"ValueScopeName",{enumerable:!0,get:function(){return Bl.ValueScopeName}});Object.defineProperty(Gt,"varKinds",{enumerable:!0,get:function(){return Bl.varKinds}});Gt.operators={GT:new je._Code(">"),GTE:new je._Code(">="),LT:new je._Code("<"),LTE:new je._Code("<="),EQ:new je._Code("==="),NEQ:new je._Code("!=="),NOT:new je._Code("!"),OR:new je._Code("||"),AND:new je._Code("&&"),ADD:new je._Code("+")};class Un{optimizeNodes(){return this}optimizeNames(e,t){return this}}class nS extends Un{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?jr.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=xi(this.rhs,e,t);return this}get names(){return this.rhs instanceof je._CodeOrName?this.rhs.names:{}}}class Rf extends Un{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof je.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=xi(this.rhs,e,t),this}get names(){let e=this.lhs instanceof je.Name?{}:{...this.lhs.names};return Vl(e,this.rhs)}}class sS extends Rf{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class iS extends Un{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class oS extends Un{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class aS extends Un{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class lS extends Un{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=xi(this.code,e,t),this}get names(){return this.code instanceof je._CodeOrName?this.code.names:{}}}class Wl extends Un{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let s=r[n];if(s.optimizeNames(e,t))continue;oF(e,s.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Ps(e,t.names),{})}}class zn extends Wl{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class cS extends Wl{}class No extends zn{}No.kind="else";class vn extends zn{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new No(r):r}if(t){if(e===!1)return t instanceof vn?t:t.nodes;if(this.nodes.length)return this;return new vn(mS(e),t instanceof vn?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=xi(this.condition,e,t),this}get names(){let e=super.names;if(Vl(e,this.condition),this.else)Ps(e,this.else.names);return e}}vn.kind="if";class bi extends zn{}bi.kind="for";class uS extends bi{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=xi(this.iteration,e,t),this}get names(){return Ps(super.names,this.iteration.names)}}class dS extends bi{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?jr.varKinds.var:this.varKind,{name:r,from:n,to:s}=this;return`for(${t} ${r}=${n}; ${r}<${s}; ${r}++)`+super.render(e)}get names(){let e=Vl(super.names,this.from);return Vl(e,this.to)}}class jf extends bi{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=xi(this.iterable,e,t),this}get names(){return Ps(super.names,this.iterable.names)}}class Ll extends zn{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Ll.kind="func";class Fl extends Wl{render(e){return"return "+super.render(e)}}Fl.kind="return";class fS extends zn{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Ps(e,this.catch.names);if(this.finally)Ps(e,this.finally.names);return e}}class ql extends zn{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}ql.kind="catch";class Hl extends zn{render(e){return"finally"+super.render(e)}}Hl.kind="finally";class pS{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
563
+ `:""},this._extScope=e,this._scope=new jr.Scope({parent:e}),this._nodes=[new cS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let s=this._scope.toName(t);if(r!==void 0&&n)this._constants[s.str]=r;return this._leafNode(new nS(e,s,r)),s}const(e,t,r){return this._def(jr.varKinds.const,e,t,r)}let(e,t,r){return this._def(jr.varKinds.let,e,t,r)}var(e,t,r){return this._def(jr.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Rf(e,t,r))}add(e,t){return this._leafNode(new sS(e,Gt.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==je.nil)this._leafNode(new lS(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),je.addCodeArg(t,n)}return t.push("}"),new je._Code(t)}if(e,t,r){if(this._blockNode(new vn(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new vn(e))}else(){return this._elseNode(new No)}endIf(){return this._endBlockNode(vn,No)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new uS(e),t)}forRange(e,t,r,n,s=this.opts.es5?jr.varKinds.var:jr.varKinds.let){let i=this._scope.toName(e);return this._for(new dS(s,i,t,r),()=>n(i))}forOf(e,t,r,n=jr.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=t instanceof je.Name?t:this.var("_arr",t);return this.forRange("_i",0,je._`${i}.length`,(o)=>{this.var(s,je._`${i}[${o}]`),r(s)})}return this._for(new jf("of",n,s,t),()=>r(s))}forIn(e,t,r,n=this.opts.es5?jr.varKinds.var:jr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,je._`Object.keys(${t})`,r);let s=this._scope.toName(e);return this._for(new jf("in",n,s,t),()=>r(s))}endFor(){return this._endBlockNode(bi)}label(e){return this._leafNode(new iS(e))}break(e){return this._leafNode(new oS(e))}return(e){let t=new Fl;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Fl)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new fS;if(this._blockNode(n),this.code(e),t){let s=this.name("e");this._currNode=n.catch=new ql(s),t(s)}if(r)this._currNode=n.finally=new Hl,this.code(r);return this._endBlockNode(ql,Hl)}throw(e){return this._leafNode(new aS(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=je.nil,r,n){if(this._blockNode(new Ll(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Ll)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof vn))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}}Gt.CodeGen=pS;function Ps(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Vl(e,t){return t instanceof je._CodeOrName?Ps(e,t.names):e}function xi(e,t,r){if(e instanceof je.Name)return n(e);if(!s(e))return e;return new je._Code(e._items.reduce((i,o)=>{if(o instanceof je.Name)o=n(o);if(o instanceof je._Code)i.push(...o._items);else i.push(o);return i},[]));function n(i){let o=r[i.str];if(o===void 0||t[i.str]!==1)return i;return delete t[i.str],o}function s(i){return i instanceof je._Code&&i._items.some((o)=>o instanceof je.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function oF(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function mS(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:je._`!${kf(e)}`}Gt.not=mS;var aF=hS(Gt.operators.AND);function lF(...e){return e.reduce(aF)}Gt.and=lF;var cF=hS(Gt.operators.OR);function uF(...e){return e.reduce(cF)}Gt.or=uF;function hS(e){return(t,r)=>t===je.nil?r:r===je.nil?t:je._`${kf(t)} ${e} ${kf(r)}`}function kf(e){return e instanceof je.Name?e:je._`(${e})`}});var Se=C(function(ES){Object.defineProperty(ES,"__esModule",{value:!0});ES.checkStrictMode=ES.getErrorPath=ES.Type=ES.useFunc=ES.setEvaluated=ES.evaluatedPropsToName=ES.mergeEvaluated=ES.eachItem=ES.unescapeJsonPointer=ES.escapeJsonPointer=ES.escapeFragment=ES.unescapeFragment=ES.schemaRefOrVal=ES.schemaHasRulesButRef=ES.schemaHasRules=ES.checkUnknownRules=ES.alwaysValidSchema=ES.toHash=void 0;var De=ye(),mF=To();function hF(e){let t={};for(let r of e)t[r]=!0;return t}ES.toHash=hF;function gF(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return xS(e,t),!$S(t,e.self.RULES.all)}ES.alwaysValidSchema=gF;function xS(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let s=n.RULES.keywords;for(let i in t)if(!s[i])SS(e,`unknown keyword: "${i}"`)}ES.checkUnknownRules=xS;function $S(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}ES.schemaHasRules=$S;function yF(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}ES.schemaHasRulesButRef=yF;function bF({topSchemaRef:e,schemaPath:t},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return De._`${r}`}return De._`${e}${t}${De.getProperty(n)}`}ES.schemaRefOrVal=bF;function xF(e){return vS(decodeURIComponent(e))}ES.unescapeFragment=xF;function $F(e){return encodeURIComponent(Of(e))}ES.escapeFragment=$F;function Of(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}ES.escapeJsonPointer=Of;function vS(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}ES.unescapeJsonPointer=vS;function vF(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}ES.eachItem=vF;function yS({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(s,i,o,a)=>{let l=o===void 0?i:o instanceof De.Name?(i instanceof De.Name?e(s,i,o):t(s,i,o),o):i instanceof De.Name?(t(s,o,i),i):r(i,o);return a===De.Name&&!(l instanceof De.Name)?n(s,l):l}}ES.mergeEvaluated={props:yS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>{e.if(De._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,De._`${r} || {}`).code(De._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,De._`${r} || {}`),Cf(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:wS}),items:yS({mergeNames:(e,t,r)=>e.if(De._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,De._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(De._`${r} !== true`,()=>e.assign(r,t===!0?!0:De._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function wS(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",De._`{}`);if(t!==void 0)Cf(e,r,t);return r}ES.evaluatedPropsToName=wS;function Cf(e,t,r){Object.keys(r).forEach((n)=>e.assign(De._`${t}${De.getProperty(n)}`,!0))}ES.setEvaluated=Cf;var bS={};function wF(e,t){return e.scopeValue("func",{ref:t,code:bS[t.code]||(bS[t.code]=new mF._Code(t.code))})}ES.useFunc=wF;var Af;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Af||(ES.Type=Af={}));function SF(e,t,r){if(e instanceof De.Name){let n=t===Af.Num;return r?n?De._`"[" + ${e} + "]"`:De._`"['" + ${e} + "']"`:n?De._`"/" + ${e}`:De._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?De.getProperty(e).toString():"/"+Of(e)}ES.getErrorPath=SF;function SS(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}ES.checkStrictMode=SS});var gr=C(function(PS){Object.defineProperty(PS,"__esModule",{value:!0});var St=ye(),qF={data:new St.Name("data"),valCxt:new St.Name("valCxt"),instancePath:new St.Name("instancePath"),parentData:new St.Name("parentData"),parentDataProperty:new St.Name("parentDataProperty"),rootData:new St.Name("rootData"),dynamicAnchors:new St.Name("dynamicAnchors"),vErrors:new St.Name("vErrors"),errors:new St.Name("errors"),this:new St.Name("this"),self:new St.Name("self"),scope:new St.Name("scope"),json:new St.Name("json"),jsonPos:new St.Name("jsonPos"),jsonLen:new St.Name("jsonLen"),jsonPart:new St.Name("jsonPart")};PS.default=qF});var Io=C(function(AS){Object.defineProperty(AS,"__esModule",{value:!0});AS.extendErrors=AS.resetErrorsCount=AS.reportExtraError=AS.reportError=AS.keyword$DataError=AS.keywordError=void 0;var Re=ye(),zl=Se(),Ct=gr();AS.keywordError={message:({keyword:e})=>Re.str`must pass "${e}" keyword validation`};AS.keyword$DataError={message:({keyword:e,schemaType:t})=>t?Re.str`"${e}" keyword must be ${t} ($data)`:Re.str`"${e}" keyword is invalid ($data)`};function VF(e,t=AS.keywordError,r,n){let{it:s}=e,{gen:i,compositeRule:o,allErrors:a}=s,l=RS(e,t,r);if(n!==null&&n!==void 0?n:o||a)jS(i,l);else kS(s,Re._`[${l}]`)}AS.reportError=VF;function BF(e,t=AS.keywordError,r){let{it:n}=e,{gen:s,compositeRule:i,allErrors:o}=n,a=RS(e,t,r);if(jS(s,a),!(i||o))kS(n,Ct.default.vErrors)}AS.reportExtraError=BF;function WF(e,t){e.assign(Ct.default.errors,t),e.if(Re._`${Ct.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(Re._`${Ct.default.vErrors}.length`,t),()=>e.assign(Ct.default.vErrors,null)))}AS.resetErrorsCount=WF;function UF({gen:e,keyword:t,schemaValue:r,data:n,errsCount:s,it:i}){if(s===void 0)throw Error("ajv implementation error");let o=e.name("err");e.forRange("i",s,Ct.default.errors,(a)=>{if(e.const(o,Re._`${Ct.default.vErrors}[${a}]`),e.if(Re._`${o}.instancePath === undefined`,()=>e.assign(Re._`${o}.instancePath`,Re.strConcat(Ct.default.instancePath,i.errorPath))),e.assign(Re._`${o}.schemaPath`,Re.str`${i.errSchemaPath}/${t}`),i.opts.verbose)e.assign(Re._`${o}.schema`,r),e.assign(Re._`${o}.data`,n)})}AS.extendErrors=UF;function jS(e,t){let r=e.const("err",t);e.if(Re._`${Ct.default.vErrors} === null`,()=>e.assign(Ct.default.vErrors,Re._`[${r}]`),Re._`${Ct.default.vErrors}.push(${r})`),e.code(Re._`${Ct.default.errors}++`)}function kS(e,t){let{gen:r,validateName:n,schemaEnv:s}=e;if(s.$async)r.throw(Re._`new ${e.ValidationError}(${t})`);else r.assign(Re._`${n}.errors`,t),r.return(!1)}var js={keyword:new Re.Name("keyword"),schemaPath:new Re.Name("schemaPath"),params:new Re.Name("params"),propertyName:new Re.Name("propertyName"),message:new Re.Name("message"),schema:new Re.Name("schema"),parentSchema:new Re.Name("parentSchema")};function RS(e,t,r){let{createErrors:n}=e.it;if(n===!1)return Re._`{}`;return zF(e,t,r)}function zF(e,t,r={}){let{gen:n,it:s}=e,i=[GF(s,r),KF(e,r)];return YF(e,t,i),n.object(...i)}function GF({errorPath:e},{instancePath:t}){let r=t?Re.str`${e}${zl.getErrorPath(t,zl.Type.Str)}`:e;return[Ct.default.instancePath,Re.strConcat(Ct.default.instancePath,r)]}function KF({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let s=n?t:Re.str`${t}/${e}`;if(r)s=Re.str`${s}${zl.getErrorPath(r,zl.Type.Str)}`;return[js.schemaPath,s]}function YF(e,{params:t,message:r},n){let{keyword:s,data:i,schemaValue:o,it:a}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:p}=a;if(n.push([js.keyword,s],[js.params,typeof t=="function"?t(e):t||Re._`{}`]),l.messages)n.push([js.message,typeof r=="function"?r(e):r]);if(l.verbose)n.push([js.schema,o],[js.parentSchema,Re._`${u}${p}`],[Ct.default.data,i]);if(c)n.push([js.propertyName,c])}});var IS=C(function(TS){Object.defineProperty(TS,"__esModule",{value:!0});TS.boolOrEmptySchema=TS.topBoolOrEmptySchema=void 0;var tq=Io(),rq=ye(),nq=gr(),sq={message:"boolean schema is false"};function iq(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)CS(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(nq.default.data);else t.assign(rq._`${n}.errors`,null),t.return(!0)}TS.topBoolOrEmptySchema=iq;function oq(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),CS(e);else r.var(t,!0)}TS.boolOrEmptySchema=oq;function CS(e,t){let{gen:r,data:n}=e;tq.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},sq,void 0,t)}});var Nf=C(function(MS){Object.defineProperty(MS,"__esModule",{value:!0});MS.getRules=MS.isJSONType=void 0;var lq=["string","number","integer","boolean","null","object","array"],cq=new Set(lq);function uq(e){return typeof e=="string"&&cq.has(e)}MS.isJSONType=uq;function dq(){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:{}}}MS.getRules=dq});var If=C(function(FS){Object.defineProperty(FS,"__esModule",{value:!0});FS.shouldUseRule=FS.shouldUseGroup=FS.schemaHasRulesForType=void 0;function pq({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&DS(e,n)}FS.schemaHasRulesForType=pq;function DS(e,t){return t.rules.some((r)=>LS(e,r))}FS.shouldUseGroup=DS;function LS(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}FS.shouldUseRule=LS});var Mo=C(function(WS){Object.defineProperty(WS,"__esModule",{value:!0});WS.reportTypeError=WS.checkDataTypes=WS.checkDataType=WS.coerceAndCheckDataType=WS.getJSONTypes=WS.getSchemaTypes=WS.DataType=void 0;var gq=Nf(),yq=If(),bq=Io(),xe=ye(),HS=Se(),$i;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})($i||(WS.DataType=$i={}));function xq(e){let t=VS(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}WS.getSchemaTypes=xq;function VS(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(gq.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}WS.getJSONTypes=VS;function $q(e,t){let{gen:r,data:n,opts:s}=e,i=vq(t,s.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&yq.schemaHasRulesForType(e,t[0]));if(o){let a=Jf(t,n,s.strictNumbers,$i.Wrong);r.if(a,()=>{if(i.length)wq(e,t,i);else Df(e)})}return o}WS.coerceAndCheckDataType=$q;var BS=new Set(["string","number","integer","boolean","null"]);function vq(e,t){return t?e.filter((r)=>BS.has(r)||t==="array"&&r==="array"):[]}function wq(e,t,r){let{gen:n,data:s,opts:i}=e,o=n.let("dataType",xe._`typeof ${s}`),a=n.let("coerced",xe._`undefined`);if(i.coerceTypes==="array")n.if(xe._`${o} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,xe._`${s}[0]`).assign(o,xe._`typeof ${s}`).if(Jf(t,s,i.strictNumbers),()=>n.assign(a,s)));n.if(xe._`${a} !== undefined`);for(let c of r)if(BS.has(c)||c==="array"&&i.coerceTypes==="array")l(c);n.else(),Df(e),n.endIf(),n.if(xe._`${a} !== undefined`,()=>{n.assign(s,a),Sq(e,a)});function l(c){switch(c){case"string":n.elseIf(xe._`${o} == "number" || ${o} == "boolean"`).assign(a,xe._`"" + ${s}`).elseIf(xe._`${s} === null`).assign(a,xe._`""`);return;case"number":n.elseIf(xe._`${o} == "boolean" || ${s} === null
564
564
  || (${o} == "string" && ${s} && ${s} == +${s})`).assign(a,xe._`+${s}`);return;case"integer":n.elseIf(xe._`${o} === "boolean" || ${s} === null
565
565
  || (${o} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,xe._`+${s}`);return;case"boolean":n.elseIf(xe._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf(xe._`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf(xe._`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf(xe._`${o} === "string" || ${o} === "number"
566
- || ${o} === "boolean" || ${s} === null`).assign(a,xe._`[${s}]`)}}}function uq({gen:e,parentData:t,parentDataProperty:r},n){e.if(xe._`${t} !== undefined`,()=>e.assign(xe._`${t}[${r}]`,n))}function Rf(e,t,r,n=xi.Correct){let s=n===xi.Correct?xe.operators.EQ:xe.operators.NEQ,i;switch(e){case"null":return xe._`${t} ${s} null`;case"array":i=xe._`Array.isArray(${t})`;break;case"object":i=xe._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(xe._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return xe._`typeof ${t} ${s} ${e}`}return n===xi.Correct?i:xe.not(i);function o(a=xe.nil){return xe.and(xe._`typeof ${t} == "number"`,a,r?xe._`isFinite(${t})`:xe.nil)}}IS.checkDataType=Rf;function Af(e,t,r,n){if(e.length===1)return Rf(e[0],t,r,n);let s,i=CS.toHash(e);if(i.array&&i.object){let o=xe._`typeof ${t} != "object"`;s=i.null?o:xe._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=xe.nil;if(i.number)delete i.integer;for(let o in i)s=xe.and(s,Rf(o,t,r,n));return s}IS.checkDataTypes=Af;var dq={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?xe._`{type: ${e}}`:xe._`{type: ${t}}`};function Of(e){let t=fq(e);iq.reportError(t,dq)}IS.reportTypeError=Of;function fq(e){let{gen:t,data:r,schema:n}=e,s=CS.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var FS=C(function(DS){Object.defineProperty(DS,"__esModule",{value:!0});DS.assignDefaults=void 0;var $i=ye(),xq=we();function $q(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)JS(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>JS(e,i,s.default))}DS.assignDefaults=$q;function JS(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=$i._`${i}${$i.getProperty(t)}`;if(s){xq.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=$i._`${a} === undefined`;if(o.useDefaults==="empty")l=$i._`${l} || ${a} === null || ${a} === ""`;n.if(l,$i._`${a} = ${$i.stringify(r)}`)}});var yr=C(function(VS){Object.defineProperty(VS,"__esModule",{value:!0});VS.validateUnion=VS.validateArray=VS.usePattern=VS.callValidateCode=VS.schemaProperties=VS.allSchemaProperties=VS.noPropertyInData=VS.propertyInData=VS.isOwnProperty=VS.hasPropFunc=VS.reportMissingProp=VS.checkMissingProp=VS.checkReportMissingProp=void 0;var He=ye(),Cf=we(),Gn=gr(),vq=we();function wq(e,t){let{gen:r,data:n,it:s}=e;r.if(Tf(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:He._`${t}`},!0),e.error()})}VS.checkReportMissingProp=wq;function Sq({gen:e,data:t,it:{opts:r}},n,s){return He.or(...n.map((i)=>He.and(Tf(e,t,i,r.ownProperties),He._`${s} = ${i}`)))}VS.checkMissingProp=Sq;function Eq(e,t){e.setParams({missingProperty:t},!0),e.error()}VS.reportMissingProp=Eq;function qS(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:He._`Object.prototype.hasOwnProperty`})}VS.hasPropFunc=qS;function Nf(e,t,r){return He._`${qS(e)}.call(${t}, ${r})`}VS.isOwnProperty=Nf;function _q(e,t,r,n){let s=He._`${t}${He.getProperty(r)} !== undefined`;return n?He._`${s} && ${Nf(e,t,r)}`:s}VS.propertyInData=_q;function Tf(e,t,r,n){let s=He._`${t}${He.getProperty(r)} === undefined`;return n?He.or(s,He.not(Nf(e,t,r))):s}VS.noPropertyInData=Tf;function HS(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}VS.allSchemaProperties=HS;function Pq(e,t){return HS(t).filter((r)=>!Cf.alwaysValidSchema(e,t[r]))}VS.schemaProperties=Pq;function jq({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let d=c?He._`${e}, ${t}, ${n}${s}`:t,p=[[Gn.default.instancePath,He.strConcat(Gn.default.instancePath,i)],[Gn.default.parentData,o.parentData],[Gn.default.parentDataProperty,o.parentDataProperty],[Gn.default.rootData,Gn.default.rootData]];if(o.opts.dynamicRef)p.push([Gn.default.dynamicAnchors,Gn.default.dynamicAnchors]);let h=He._`${d}, ${r.object(...p)}`;return l!==He.nil?He._`${a}.call(${l}, ${h})`:He._`${a}(${h})`}VS.callValidateCode=jq;var kq=He._`new RegExp`;function Rq({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:He._`${s.code==="new RegExp"?kq:vq.useFunc(e,s)}(${r}, ${n})`})}VS.usePattern=Rq;function Aq(e){let{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return o(()=>t.assign(a,!1)),a}return t.var(i,!0),o(()=>t.break()),i;function o(a){let l=t.const("len",He._`${r}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Cf.Type.Num},i),t.if(He.not(i),a)})}}VS.validateArray=Aq;function Oq(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>Cf.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let d=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,He._`${o} || ${a}`),!e.mergeValidEvaluated(d,a))t.if(He.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}VS.validateUnion=Oq});var KS=C(function(zS){Object.defineProperty(zS,"__esModule",{value:!0});zS.validateKeywordUsage=zS.validSchemaType=zS.funcKeywordCode=zS.macroKeywordCode=void 0;var Nt=ye(),js=gr(),Bq=yr(),Wq=To();function Uq(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=US(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:Nt.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}zS.macroKeywordCode=Uq;function zq(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;Kq(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,d=US(n,s,c),p=n.let("valid");e.block$data(p,h),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function h(){if(t.errors===!1){if(g(),t.modifying)WS(e);y(()=>e.error())}else{let v=t.async?m():b();if(t.modifying)WS(e);y(()=>Gq(e,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>g(Nt._`await `),(j)=>n.assign(p,!1).if(Nt._`${j} instanceof ${l.ValidationError}`,()=>n.assign(v,Nt._`${j}.errors`),()=>n.throw(j))),v}function b(){let v=Nt._`${d}.errors`;return n.assign(v,null),g(Nt.nil),v}function g(v=t.async?Nt._`await `:Nt.nil){let j=l.opts.passContext?js.default.this:js.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,Nt._`${v}${Bq.callValidateCode(e,d,j,S)}`,t.modifying)}function y(v){var j;n.if(Nt.not((j=t.valid)!==null&&j!==void 0?j:p),v)}}zS.funcKeywordCode=zq;function WS(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Nt._`${n.parentData}[${n.parentDataProperty}]`))}function Gq(e,t){let{gen:r}=e;r.if(Nt._`Array.isArray(${t})`,()=>{r.assign(js.default.vErrors,Nt._`${js.default.vErrors} === null ? ${t} : ${js.default.vErrors}.concat(${t})`).assign(js.default.errors,Nt._`${js.default.vErrors}.length`),Wq.extendErrors(e)},()=>e.error())}function Kq({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function US(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:Nt.stringify(r)})}function Yq(e,t,r=!1){return!t.length||t.some((n)=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}zS.validSchemaType=Yq;function Xq({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw Error("ajv implementation error");let o=s.dependencies;if(o===null||o===void 0?void 0:o.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw Error(l)}}}zS.validateKeywordUsage=Xq});var QS=C(function(XS){Object.defineProperty(XS,"__esModule",{value:!0});XS.extendSubschemaMode=XS.extendSubschemaData=XS.getSubschema=void 0;var Ur=ye(),YS=we();function t5(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Ur._`${e.schemaPath}${Ur.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Ur._`${e.schemaPath}${Ur.getProperty(t)}${Ur.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${YS.escapeFragment(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}XS.getSubschema=t5;function r5(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:d,opts:p}=t,h=a.let("data",Ur._`${t.data}${Ur.getProperty(r)}`,!0);l(h),e.errorPath=Ur.str`${c}${YS.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=Ur._`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Ur.Name?s:a.let("data",s,!0);if(l(c),o!==void 0)e.propertyName=o}if(i)e.dataTypes=i;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}XS.extendSubschemaData=r5;function n5(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){if(n!==void 0)e.compositeRule=n;if(s!==void 0)e.createErrors=s;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}XS.extendSubschemaMode=n5});var If=C(function(fZ,e1){e1.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var r1=C(function(pZ,t1){var Kn=t1.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Wl(t,n,s,e,"",e)};Kn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Kn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Kn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Kn.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 Wl(e,t,r,n,s,i,o,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,a,l,c);for(var d in n){var p=n[d];if(Array.isArray(p)){if(d in Kn.arrayKeywords)for(var h=0;h<p.length;h++)Wl(e,t,r,p[h],s+"/"+d+"/"+h,i,s,d,n,h)}else if(d in Kn.propsKeywords){if(p&&typeof p=="object")for(var m in p)Wl(e,t,r,p[m],s+"/"+d+"/"+o5(m),i,s,d,n,m)}else if(d in Kn.keywords||e.allKeys&&!(d in Kn.skipKeywords))Wl(e,t,r,p,s+"/"+d,i,s,d,n)}r(n,s,i,o,a,l,c)}}function o5(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Mo=C(function(o1){Object.defineProperty(o1,"__esModule",{value:!0});o1.getSchemaRefs=o1.resolveUrl=o1.normalizeId=o1._getFullPath=o1.getFullPath=o1.inlineRef=void 0;var a5=we(),l5=If(),c5=r1(),u5=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function d5(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Mf(e);if(!t)return!1;return n1(e)<=t}o1.inlineRef=d5;var f5=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Mf(e){for(let t in e){if(f5.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Mf))return!0;if(typeof r=="object"&&Mf(r))return!0}return!1}function n1(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,u5.has(r))continue;if(typeof e[r]=="object")a5.eachItem(e[r],(n)=>t+=n1(n));if(t===1/0)return 1/0}return t}function s1(e,t="",r){if(r!==!1)t=vi(t);let n=e.parse(t);return i1(e,n)}o1.getFullPath=s1;function i1(e,t){return e.serialize(t).split("#")[0]+"#"}o1._getFullPath=i1;var p5=/#\/?$/;function vi(e){return e?e.replace(p5,""):""}o1.normalizeId=vi;function m5(e,t,r){return r=vi(r),e.resolve(t,r)}o1.resolveUrl=m5;var h5=/^[a-z_][-a-z0-9._]*$/i;function g5(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=vi(e[r]||t),i={"":s},o=s1(n,s,!1),a={},l=new Set;return c5(e,{allKeys:!0},(p,h,m,b)=>{if(b===void 0)return;let g=o+h,y=i[b];if(typeof p[r]=="string")y=v.call(this,p[r]);j.call(this,p.$anchor),j.call(this,p.$dynamicAnchor),i[h]=y;function v(S){let P=this.opts.uriResolver.resolve;if(S=vi(y?P(y,S):S),l.has(S))throw d(S);l.add(S);let E=this.refs[S];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")c(p,E.schema,S);else if(S!==vi(g))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=g;return S}function j(S){if(typeof S=="string"){if(!h5.test(S))throw Error(`invalid anchor "${S}"`);v.call(this,`#${S}`)}}}),a;function c(p,h,m){if(h!==void 0&&!l5(p,h))throw d(m)}function d(p){return Error(`reference "${p}" resolves to more than one schema`)}}o1.getSchemaRefs=g5});var wi=C(function(w1){Object.defineProperty(w1,"__esModule",{value:!0});w1.getData=w1.KeywordCxt=w1.validateFunctionCode=void 0;var d1=_S(),f1=Io(),Jf=kf(),Ul=Io(),w5=FS(),Jo=KS(),Df=QS(),ne=ye(),me=gr(),S5=Mo(),wn=we(),Do=To();function E5(e){if(h1(e)){if(g1(e),m1(e)){j5(e);return}}p1(e,()=>d1.topBoolOrEmptySchema(e))}w1.validateFunctionCode=E5;function p1({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,ne._`${me.default.data}, ${me.default.valCxt}`,n.$async,()=>{e.code(ne._`"use strict"; ${l1(r,s)}`),P5(e,s),e.code(i)});else e.func(t,ne._`${me.default.data}, ${_5(s)}`,n.$async,()=>e.code(l1(r,s)).code(i))}function _5(e){return ne._`{${me.default.instancePath}="", ${me.default.parentData}, ${me.default.parentDataProperty}, ${me.default.rootData}=${me.default.data}${e.dynamicRef?ne._`, ${me.default.dynamicAnchors}={}`:ne.nil}}={}`}function P5(e,t){e.if(me.default.valCxt,()=>{if(e.var(me.default.instancePath,ne._`${me.default.valCxt}.${me.default.instancePath}`),e.var(me.default.parentData,ne._`${me.default.valCxt}.${me.default.parentData}`),e.var(me.default.parentDataProperty,ne._`${me.default.valCxt}.${me.default.parentDataProperty}`),e.var(me.default.rootData,ne._`${me.default.valCxt}.${me.default.rootData}`),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`${me.default.valCxt}.${me.default.dynamicAnchors}`)},()=>{if(e.var(me.default.instancePath,ne._`""`),e.var(me.default.parentData,ne._`undefined`),e.var(me.default.parentDataProperty,ne._`undefined`),e.var(me.default.rootData,me.default.data),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`{}`)})}function j5(e){let{schema:t,opts:r,gen:n}=e;p1(e,()=>{if(r.$comment&&t.$comment)b1(e);if(C5(e),n.let(me.default.vErrors,null),n.let(me.default.errors,0),r.unevaluated)k5(e);y1(e),I5(e)});return}function k5(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",ne._`${r}.evaluated`),t.if(ne._`${e.evaluated}.dynamicProps`,()=>t.assign(ne._`${e.evaluated}.props`,ne._`undefined`)),t.if(ne._`${e.evaluated}.dynamicItems`,()=>t.assign(ne._`${e.evaluated}.items`,ne._`undefined`))}function l1(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?ne._`/*# sourceURL=${r} */`:ne.nil}function R5(e,t){if(h1(e)){if(g1(e),m1(e)){A5(e,t);return}}d1.boolOrEmptySchema(e,t)}function m1({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function h1(e){return typeof e.schema!="boolean"}function A5(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)b1(e);N5(e),T5(e);let i=n.const("_errs",me.default.errors);y1(e,i),n.var(t,ne._`${i} === ${me.default.errors}`)}function g1(e){wn.checkUnknownRules(e),O5(e)}function y1(e,t){if(e.opts.jtd)return c1(e,[],!1,t);let r=f1.getSchemaTypes(e.schema),n=f1.coerceAndCheckDataType(e,r);c1(e,r,!n,t)}function O5(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&wn.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function C5(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)wn.checkStrictMode(e,"default is ignored in the schema root")}function N5(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=S5.resolveUrl(e.opts.uriResolver,e.baseId,t)}function T5(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function b1({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(ne._`${me.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=ne.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(ne._`${me.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function I5(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(ne._`${me.default.errors} === 0`,()=>t.return(me.default.data),()=>t.throw(ne._`new ${s}(${me.default.vErrors})`));else{if(t.assign(ne._`${n}.errors`,me.default.vErrors),i.unevaluated)M5(e);t.return(ne._`${me.default.errors} === 0`)}}function M5({gen:e,evaluated:t,props:r,items:n}){if(r instanceof ne.Name)e.assign(ne._`${t}.props`,r);if(n instanceof ne.Name)e.assign(ne._`${t}.items`,n)}function c1(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:d}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!wn.schemaHasRulesButRef(i,d))){s.block(()=>$1(e,"$ref",d.all.$ref.definition));return}if(!l.jtd)J5(e,t);s.block(()=>{for(let h of d.rules)p(h);p(d.post)});function p(h){if(!Jf.shouldUseGroup(i,h))return;if(h.type){if(s.if(Ul.checkDataType(h.type,o,l.strictNumbers)),u1(e,h),t.length===1&&t[0]===h.type&&r)s.else(),Ul.reportTypeError(e);s.endIf()}else u1(e,h);if(!a)s.if(ne._`${me.default.errors} === ${n||0}`)}}function u1(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)w5.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(Jf.shouldUseRule(n,i))$1(e,i.keyword,i.definition,t.type)})}function J5(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(D5(e,t),!e.opts.allowUnionTypes)L5(e,t);F5(e,e.dataTypes)}function D5(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!x1(e.dataTypes,r))Lf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),H5(e,t)}function L5(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Lf(e,"use allowUnionTypes to allow union type keyword")}function F5(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&Jf.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>q5(t,o)))Lf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function q5(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function x1(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function H5(e,t){let r=[];for(let n of e.dataTypes)if(x1(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Lf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,wn.checkStrictMode(e,t,e.opts.strictTypes)}class Ff{constructor(e,t,r){if(Jo.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=wn.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",v1(this.$data,e));else if(this.schemaCode=this.schemaValue,!Jo.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",me.default.errors)}result(e,t,r){this.failResult(ne.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(ne.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(ne._`${t} !== undefined && (${ne.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Do.reportExtraError:Do.reportError)(this,this.def.error,t)}$dataError(){Do.reportError(this,this.def.$dataError||Do.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Do.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=ne.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=ne.nil,t=ne.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(ne.or(ne._`${n} === undefined`,t)),e!==ne.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return ne.or(i(),o());function i(){if(r.length){if(!(t instanceof ne.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return ne._`${Ul.checkDataTypes(a,t,s.opts.strictNumbers,Ul.DataType.Wrong)}`}return ne.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return ne._`!${a}(${t})`}return ne.nil}}subschema(e,t){let r=Df.getSubschema(this.it,e);Df.extendSubschemaData(r,this.it,e),Df.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return R5(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=wn.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=wn.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,ne.Name)),!0}}w1.KeywordCxt=Ff;function $1(e,t,r,n){let s=new Ff(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)Jo.funcKeywordCode(s,r);else if("macro"in r)Jo.macroKeywordCode(s,r);else if(r.compile||r.validate)Jo.funcKeywordCode(s,r)}var V5=/^\/(?:[^~]|~0|~1)*$/,B5=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function v1(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return me.default.rootData;if(e[0]==="/"){if(!V5.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=me.default.rootData}else{let c=B5.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let d=+c[1];if(s=c[2],s==="#"){if(d>=t)throw Error(l("property/index",d));return n[t-d]}if(d>t)throw Error(l("data",d));if(i=r[t-d],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=ne._`${i}${ne.getProperty(wn.unescapeJsonPointer(c))}`,o=ne._`${o} && ${i}`;return o;function l(c,d){return`Cannot access ${c} ${d} levels up, current level is ${t}`}}w1.getData=v1});var Lo=C(function(_1){Object.defineProperty(_1,"__esModule",{value:!0});class E1 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}_1.default=E1});var Si=C(function(j1){Object.defineProperty(j1,"__esModule",{value:!0});var qf=Mo();class P1 extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=qf.resolveUrl(e,t,r),this.missingSchema=qf.normalizeId(qf.getFullPath(e,this.missingRef))}}j1.default=P1});var qo=C(function(A1){Object.defineProperty(A1,"__esModule",{value:!0});A1.resolveSchema=A1.getCompilingSchema=A1.resolveRef=A1.compileSchema=A1.SchemaEnv=void 0;var jr=ye(),K5=Lo(),ks=gr(),kr=Mo(),k1=we(),Y5=wi();class Fo{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:kr.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}A1.SchemaEnv=Fo;function Vf(e){let t=R1.call(this,e);if(t)return t;let r=kr.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new jr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:K5.default,code:jr._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:ks.default.data,parentData:ks.default.parentData,parentDataProperty:ks.default.parentDataProperty,dataNames:[ks.default.data],dataPathArr:[jr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:jr.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:jr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:jr._`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),Y5.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(d=`${o.scopeRefs(ks.default.scope)}return ${p}`,this.opts.code.process)d=this.opts.code.process(d,e);let m=Function(`${ks.default.self}`,`${ks.default.scope}`,d)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:l,validateCode:p,scopeValues:o._values};if(this.opts.unevaluated){let{props:b,items:g}=c;if(m.evaluated={props:b instanceof jr.Name?void 0:b,items:g instanceof jr.Name?void 0:g,dynamicProps:b instanceof jr.Name,dynamicItems:g instanceof jr.Name},m.source)m.source.evaluated=jr.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,d)this.logger.error("Error compiling schema, function code:",d);throw p}finally{this._compilations.delete(e)}}A1.compileSchema=Vf;function X5(e,t,r){var n;r=kr.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=e3.call(this,e,r);if(i===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(o)i=new Fo({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=Z5.call(this,i)}A1.resolveRef=X5;function Z5(e){if(kr.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Vf.call(this,e)}function R1(e){for(let t of this._compilations)if(Q5(t,e))return t}A1.getCompilingSchema=R1;function Q5(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function e3(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||zl.call(this,e,t)}function zl(e,t){let r=this.opts.uriResolver.parse(t),n=kr._getFullPath(this.opts.uriResolver,r),s=kr.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Hf.call(this,r,e);let i=kr.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=zl.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Hf.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)Vf.call(this,o);if(i===kr.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=kr.resolveUrl(this.opts.uriResolver,s,c);return new Fo({schema:a,schemaId:l,root:e,baseId:s})}return Hf.call(this,r,o)}A1.resolveSchema=zl;var t3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Hf(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let l=r[k1.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!t3.has(a)&&c)t=kr.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!k1.schemaHasRulesButRef(r,this.RULES)){let a=kr.resolveUrl(this.opts.uriResolver,t,r.$ref);i=zl.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new Fo({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var C1=C(function(xZ,o3){o3.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 Kf=C(function($Z,F1){var a3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Wf=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),l3=RegExp.prototype.test.bind(/^\d*$/u),Rs=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Uf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),T1=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),zf=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),c3=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Gt=Array(256);for(let t=0;t<256;t++)Gt[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Et(e){if(e<2048)return Gt[192|e>>6]+Gt[128|e&63];if(e<65536)return Gt[224|e>>12]+Gt[128|e>>6&63]+Gt[128|e&63];return Gt[240|e>>18]+Gt[128|e>>12&63]+Gt[128|e>>6&63]+Gt[128|e&63]}function u3(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var d3=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),f3=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),p3=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),m3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function h3(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(p3(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&Rs(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function N1(e){let t=-1,r=0,n=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(s++,s>r)r=s,t=n}else n=-1,s=0;if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function g3(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let s=r.concat(n),i=0;for(let a=0;a<s.length;a++){let l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&n.length===0||!Wf(l))return;i+=2;continue}if(!d3(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return N1(s)}if(i>=8)return;let o=s.slice(0,r.length);for(let a=i;a<8;a++)o.push("0");for(let a=r.length;a<s.length;a++)o.push(s[a]);return N1(o)}function Bf(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&f3(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(y3(n,":")<2)return{host:e,isIPV6:!1,error:t};let s="",i=n.indexOf("%");if(i!==-1){let a=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(s=n.slice(i+a),!h3(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=g3(n);if(o===void 0)return{host:e,isIPV6:!1,error:!0};return{host:o+(s?"%"+s:""),escapedHost:o+(s?"%25"+s:""),isIPV6:!0}}function y3(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function I1(e){let t=e,r=[],n=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(s===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function b3(e){if(e===""||e[0]==="/")return I1(e);let t=e.split("/"),r=t.length-1,n=[],s=!1;for(let i=0;i<=r;i++){let o=t[i];if(o==="."||o===".."){if(o==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");s=i===r}else n.push(o)}if(s&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var x3={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},$3=/[@/?#:]/g,v3=/[@/?#]/g;function M1(e,t){let r=t?v3:$3;return r.lastIndex=0,e.replace(r,(n)=>x3[n])}function J1(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&Uf(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function w3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&Uf(o))t+=o;else t+="%"+i;r+=2;continue}}if(T1(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=L1(s)?n:Gt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function S3(e,t=!1){let r="",n=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let i=e[s];if(i==="%"&&s+2<e.length){let o=e.slice(s+1,s+3);if(Rs(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(T1(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=Gt[o];else if(o<55296||o>57343)r+=Et(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=Et(65536+(o-55296<<10)+(a-56320)),s++;else r+=Et(65533)}else r+=Et(65533)}}return r}function Gf(e,t){let r="";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Rs(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Gt[i];else if(i<55296||i>57343)r+=Et(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=Et(65536+(i-55296<<10)+(o-56320)),n++;else r+=Et(65533)}else r+=Et(65533)}}return r}function D1(e){return Gf(e,c3)}function E3(e){return Gf(e,zf)}function _3(e){return Gf(e,zf)}function L1(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 P3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(Rs(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(Uf(o))t+=o;else t+="%"+i;r+=2;continue}}if(zf(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=L1(s)?n:Gt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function j3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Rs(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function k3(e){let t=[];if(e.userinfo!==void 0)t.push(D1(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Wf(r)){let n=Bf(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=J1(r,!0),n=Bf(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=M1(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!l3(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}F1.exports={nonSimpleDomain:m3,recomposeAuthority:k3,reescapeHostDelimiters:M1,normalizePercentEncoding:J1,normalizePathEncoding:w3,serializePathEncoding:S3,normalizeQueryFragmentEncoding:P3,encodeUserinfo:D1,encodeQuery:E3,encodeFragment:_3,escapePreservingEscapes:j3,removeDotSegments:I1,removeDotSegmentsRelative:b3,isIPv4:Wf,isUUID:a3,normalizeIPv6:Bf,stringArrayToHexStripped:u3}});var W1=C(function(vZ,B1){var{isUUID:R3}=Kf(),A3=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,O3=["http","https","ws","wss","urn","urn:uuid"];function C3(e){return O3.indexOf(e)!==-1}function Yf(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 q1(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function H1(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 N3(e){return e.secure=Yf(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function T3(e){if(e.port===(Yf(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function I3(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(A3);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,i=Xf(s);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function M3(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,i=Xf(s);if(i)e=i.serialize(e,t);let o=e,a=e.nss;return o.path=`${n||t.nid}:${a}`,t.skipEscape=!0,o}function J3(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!R3(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function D3(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var V1={scheme:"http",domainHost:!0,parse:q1,serialize:H1},L3={scheme:"https",domainHost:V1.domainHost,parse:q1,serialize:H1},Gl={scheme:"ws",domainHost:!0,parse:N3,serialize:T3},F3={scheme:"wss",domainHost:Gl.domainHost,parse:Gl.parse,serialize:Gl.serialize},q3={scheme:"urn",parse:I3,serialize:M3,skipNormalize:!0},H3={scheme:"urn:uuid",parse:J3,serialize:D3,skipNormalize:!0},Kl={http:V1,https:L3,ws:Gl,wss:F3,urn:q3,"urn:uuid":H3};Object.setPrototypeOf(Kl,null);function Xf(e){return e&&(Kl[e]||Kl[e.toLowerCase()])||void 0}B1.exports={wsIsSecure:Yf,SCHEMES:Kl,isValidSchemeName:C3,getSchemeHandler:Xf}});var iE=C(function(wZ,Ql){var{normalizeIPv6:Y1,removeDotSegments:Vo,removeDotSegmentsRelative:X1,recomposeAuthority:V3,normalizePercentEncoding:Zf,normalizePathEncoding:B3,serializePathEncoding:U1,normalizeQueryFragmentEncoding:z1,encodeQuery:W3,encodeFragment:U3,reescapeHostDelimiters:z3,isIPv4:Z1,nonSimpleDomain:G3}=Kf(),{SCHEMES:Q1,getSchemeHandler:Qf}=W1(),eE=/^[A-Za-z][A-Za-z0-9+.-]*$/u,K3=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function G1(e){let t=String(e);if(!eE.test(t))throw TypeError("URI scheme is malformed.");return t}function Y3(e,t){if(typeof e==="string")e=iH(e,t);else if(typeof e==="object")e=Xl(As(e,t),t);return e}function X3(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=Yl(e,n),{parsed:d,malformedAuthorityOrPort:p,malformedPercentEncoding:h,malformedSchemeSpecific:m,malformedHost:b,malformedScheme:g}=Yl(t,n);if(i||p||o||h||a||m||l||b||c||g)throw Error(s.error||d.error||"URI is malformed.");let y=tE(s,d,n,!0),v=Qf(r&&r.scheme||y.scheme),j=y.host,S=j!==void 0&&j!==""&&(Z1(j)||Y1(j).isIPV6);if(nE(y,r||{},v,S))throw Error("URI host is malformed.");rE(y,r||{},v,S);let P=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(y.error&&!P)throw Error(y.error);return n.skipEscape=!0,As(y,n)}function tE(e,t,r,n){let s={};if(!n)e=Xl(As(e,r),r),t=Xl(As(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Vo(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=Vo(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=Vo(t.path);else{let i=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(i&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!i&&s.path[0]!=="/"?X1(s.path):Vo(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 Z3(e,t,r){let n=K1(e,r),s=K1(t,r);return n!==void 0&&s!==void 0&&n===s}function As(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),s=[];if(r.scheme)r.scheme=G1(r.scheme);let i=Qf(n.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!o,l=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=U1(r.path,l);else r.path=Zf(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=G1(r.scheme),s.push(r.scheme,":");let c=V3(r);if(c!==void 0){if(n.reference!=="suffix")s.push("//");if(s.push(c),r.path&&r.path[0]!=="/")s.push("/")}if(r.path!==void 0){let d=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))d=a&&d[0]!=="/"?X1(d):Vo(d);if(a)d=U1(d,!0);if(c===void 0&&d[0]==="/"&&d[1]==="/")d="/%2F"+d.slice(2);s.push(d)}if(r.query!==void 0)s.push("?",W3(r.query));if(r.fragment!==void 0)s.push("#",U3(r.fragment));return s.join("")}var Q3=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,eH=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,tH=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function rH(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 Ho(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 Zl(e){return e[0]==="["&&e[e.length-1]==="]"}function nH(e){let t=e[4];return Ho(e[3])||t!==void 0&&!Zl(t)&&Ho(t)||Ho(e[6])||Ho(e[7])||Ho(e[8])}function rE(e,t,r,n){if(nE(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Zl(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&G3(e.host)){let s;try{s=new URL("http://"+e.host)}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}if(!sH(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function nE(e,t,r,n){return Boolean(e.host&&n===!1&&!Zl(e.host)&&(t.domainHost||r&&r.domainHost)&&K3.test(e.host))}function sH(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Yl(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,d=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(eH);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let h=e.match(tH);if(h!==null){let b=h[1],g=b.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",s=!0;else if(b.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(Q3);if(m){if(n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],n.scheme!==void 0)if(eE.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=nH(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let b=rH(n,m);if(b!==void 0)n.error=n.error||b,s=!0;if(n.host)if(Z1(n.host)===!1){let v=Zl(n.host),j=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=Y1(n.host);if(d=S.isIPV6||S.isIPVFuture===!0,l=j&&(!v||S.error===!0),n.host=d?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else d=!0;if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path)n.reference="same-document";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let g=Qf(r.scheme||n.scheme);if(!l)a=rE(n,r,g,d);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let y=d?n.host:Zf(n.host,!0);if(!d)y=Zf(y.toLowerCase());n.host=d||r.scheme!=="null"?z3(y,d):y}if(!g||g&&!g.skipNormalize){if(n.path)n.path=B3(n.path);if(n.query)n.query=z1(n.query);if(n.fragment)n.fragment=z1(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===Q1.urn&&n.nid===void 0)o=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}}function Xl(e,t){return Yl(e,t).parsed}function iH(e,t){return sE(e,t).normalized}function sE(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=Yl(e,t);return{normalized:n||s||i||o||a?e:As(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function K1(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:As(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=sE(r,t);return s||i||o||a||l?void 0:n}var ep={SCHEMES:Q1,normalize:Y3,resolve:X3,resolveComponent:tE,equal:Z3,serialize:As,parse:Xl};Ql.exports=ep;Ql.exports.default=ep;Ql.exports.fastUri=ep});var lE=C(function(aE){Object.defineProperty(aE,"__esModule",{value:!0});var oE=iE();oE.code='require("ajv/dist/runtime/uri").default';aE.default=oE});var np=C(function(Sn){Object.defineProperty(Sn,"__esModule",{value:!0});Sn.CodeGen=Sn.Name=Sn.nil=Sn.stringify=Sn.str=Sn._=Sn.KeywordCxt=void 0;var aH=wi();Object.defineProperty(Sn,"KeywordCxt",{enumerable:!0,get:function(){return aH.KeywordCxt}});var Ei=ye();Object.defineProperty(Sn,"_",{enumerable:!0,get:function(){return Ei._}});Object.defineProperty(Sn,"str",{enumerable:!0,get:function(){return Ei.str}});Object.defineProperty(Sn,"stringify",{enumerable:!0,get:function(){return Ei.stringify}});Object.defineProperty(Sn,"nil",{enumerable:!0,get:function(){return Ei.nil}});Object.defineProperty(Sn,"Name",{enumerable:!0,get:function(){return Ei.Name}});Object.defineProperty(Sn,"CodeGen",{enumerable:!0,get:function(){return Ei.CodeGen}});var lH=Lo(),pE=Si(),cH=jf(),Wo=qo(),uH=ye(),Bo=Mo(),ec=Io(),rp=we(),cE=C1(),dH=lE(),mE=(e,t)=>new RegExp(e,t);mE.code="new RegExp";var fH=["removeAdditional","useDefaults","coerceTypes"],pH=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),mH={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."},hH={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},uE=200;function gH(e){var t,r,n,s,i,o,a,l,c,d,p,h,m,b,g,y,v,j,S,P,E,O,R,k,I;let D=e.strict,M=(t=e.code)===null||t===void 0?void 0:t.optimize,L=M===!0||M===void 0?1:M||0,W=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:mE,se=(s=e.uriResolver)!==null&&s!==void 0?s:dH.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:D)!==null&&o!==void 0?o:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&l!==void 0?l:!0,strictTypes:(d=(c=e.strictTypes)!==null&&c!==void 0?c:D)!==null&&d!==void 0?d:"log",strictTuples:(h=(p=e.strictTuples)!==null&&p!==void 0?p:D)!==null&&h!==void 0?h:"log",strictRequired:(b=(m=e.strictRequired)!==null&&m!==void 0?m:D)!==null&&b!==void 0?b:!1,code:e.code?{...e.code,optimize:L,regExp:W}:{optimize:L,regExp:W},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:uE,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:uE,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(P=e.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(k=e.unicodeRegExp)!==null&&k!==void 0?k:!0,int32range:(I=e.int32range)!==null&&I!==void 0?I:!0,uriResolver:se}}class tc{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,...gH(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new uH.ValueScope({scope:{},prefixes:pH,es5:t,lines:r}),this.logger=wH(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=cH.getRules(),dE.call(this,mH,e,"NOT SUPPORTED"),dE.call(this,hH,e,"DEPRECATED","warn"),this._metaOpts=$H.call(this),e.formats)bH.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)xH.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);yH.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=cE;if(r==="id")n={...cE},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(c,d){await s.call(this,c.$schema);let p=this._addSchema(c,d);return p.validate||i.call(this,p)}async function s(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function i(c){try{return this._compileSchemaEnv(c)}catch(d){if(!(d instanceof pE.default))throw d;return o.call(this,d),await a.call(this,d.missingSchema),i.call(this,c)}}function o({missingSchema:c,missingRef:d}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${d} cannot be resolved`)}async function a(c){let d=await l.call(this,c);if(!this.refs[c])await s.call(this,d.$schema);if(!this.refs[c])this.addSchema(d,c,t)}async function l(c){let d=this._loading[c];if(d)return d;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,n);return this}let s;if(typeof e==="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw Error(`schema ${i} must be string`)}return t=Bo.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return n}getSchema(e){let t;while(typeof(t=fE.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new Wo.SchemaEnv({schema:{},schemaId:r});if(t=Wo.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=fE.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Bo.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(EH.call(this,r,t),!t)return rp.eachItem(r,(s)=>tp.call(this,s)),this;PH.call(this,t);let n={...t,type:ec.getJSONTypes(t.type),schemaType:ec.getJSONTypes(t.schemaType)};return rp.eachItem(r,n.type.length===0?(s)=>tp.call(this,s,n):(s)=>n.type.forEach((i)=>tp.call(this,s,n,i))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((s)=>s.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,s)=>n+t+s)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let s=n.split("/").slice(1),i=e;for(let o of s)i=i[o];for(let o in r){let a=r[o];if(typeof a!="object")continue;let{$data:l}=a.definition,c=i[o];if(l&&c)i[o]=hE(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:o}=this.opts;if(typeof e=="object")i=e[o];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Bo.normalizeId(i||r);let l=Bo.getSchemaRefs.call(this,e,r);if(a=new Wo.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:l}),this._cache.set(a.schema,a),s&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Wo.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{Wo.compileSchema.call(this,e)}finally{this.opts=t}}}tc.ValidationError=lH.default;tc.MissingRefError=pE.default;Sn.default=tc;function dE(e,t,r,n="error"){for(let s in e){let i=s;if(i in t)this.logger[n](`${r}: option ${s}. ${e[i]}`)}}function fE(e){return e=Bo.normalizeId(e),this.schemas[e]||this.refs[e]}function yH(){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 bH(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function xH(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function $H(){let e={...this.opts};for(let t of fH)delete e[t];return e}var vH={log(){},warn(){},error(){}};function wH(e){if(e===!1)return vH;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 SH=/^[a-z_$][a-z0-9_$:-]*$/i;function EH(e,t){let{RULES:r}=this;if(rp.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!SH.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function tp(e,t,r){var n;let s=t===null||t===void 0?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=s?i.post:i.rules.find(({type:l})=>l===r);if(!o)o={type:r,rules:[]},i.rules.push(o);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:ec.getJSONTypes(t.type),schemaType:ec.getJSONTypes(t.schemaType)}};if(t.before)_H.call(this,o,a,t.before);else o.rules.push(a);i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((l)=>this.addKeyword(l))}function _H(e,t,r){let n=e.rules.findIndex((s)=>s.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function PH(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=hE(t);e.validateSchema=this.compile(t,!0)}var jH={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function hE(e){return{anyOf:[e,jH]}}});var yE=C(function(gE){Object.defineProperty(gE,"__esModule",{value:!0});var AH={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};gE.default=AH});var sc=C(function(vE){Object.defineProperty(vE,"__esModule",{value:!0});vE.callRef=vE.getValidate=void 0;var CH=Si(),bE=yr(),Kt=ye(),_i=gr(),xE=qo(),rc=we(),NH={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:l}=n,{root:c}=i;if((r==="#"||r==="#/")&&s===c.baseId)return p();let d=xE.resolveRef.call(l,c,s,r);if(d===void 0)throw new CH.default(n.opts.uriResolver,s,r);if(d instanceof xE.SchemaEnv)return h(d);return m(d);function p(){if(i===c)return nc(e,o,i,i.$async);let b=t.scopeValue("root",{ref:c});return nc(e,Kt._`${b}.validate`,c,c.$async)}function h(b){let g=$E(e,b);nc(e,g,b,b.$async)}function m(b){let g=t.scopeValue("schema",a.code.source===!0?{ref:b,code:Kt.stringify(b)}:{ref:b}),y=t.name("valid"),v=e.subschema({schema:b,dataTypes:[],schemaPath:Kt.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function $E(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Kt._`${r.scopeValue("wrapper",{ref:t})}.validate`}vE.getValidate=$E;function nc(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?_i.default.this:Kt.nil;if(n)d();else p();function d(){if(!a.$async)throw Error("async schema referenced by sync schema");let b=s.let("valid");s.try(()=>{if(s.code(Kt._`await ${bE.callValidateCode(e,t,c)}`),m(t),!o)s.assign(b,!0)},(g)=>{if(s.if(Kt._`!(${g} instanceof ${i.ValidationError})`,()=>s.throw(g)),h(g),!o)s.assign(b,!1)}),e.ok(b)}function p(){e.result(bE.callValidateCode(e,t,c),()=>m(t),()=>h(t))}function h(b){let g=Kt._`${b}.errors`;s.assign(_i.default.vErrors,Kt._`${_i.default.vErrors} === null ? ${g} : ${_i.default.vErrors}.concat(${g})`),s.assign(_i.default.errors,Kt._`${_i.default.vErrors}.length`)}function m(b){var g;if(!i.opts.unevaluated)return;let y=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=rc.mergeEvaluated.props(s,y.props,i.props)}else{let v=s.var("props",Kt._`${b}.evaluated.props`);i.props=rc.mergeEvaluated.props(s,v,i.props,Kt.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=rc.mergeEvaluated.items(s,y.items,i.items)}else{let v=s.var("items",Kt._`${b}.evaluated.items`);i.items=rc.mergeEvaluated.items(s,v,i.items,Kt.Name)}}}vE.callRef=nc;vE.default=NH});var sp=C(function(SE){Object.defineProperty(SE,"__esModule",{value:!0});var MH=yE(),JH=sc(),DH=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",MH.default,JH.default];SE.default=DH});var _E=C(function(EE){Object.defineProperty(EE,"__esModule",{value:!0});var oc=ye(),Yn=oc.operators,ic={maximum:{okStr:"<=",ok:Yn.LTE,fail:Yn.GT},minimum:{okStr:">=",ok:Yn.GTE,fail:Yn.LT},exclusiveMaximum:{okStr:"<",ok:Yn.LT,fail:Yn.GTE},exclusiveMinimum:{okStr:">",ok:Yn.GT,fail:Yn.LTE}},FH={message:({keyword:e,schemaCode:t})=>oc.str`must be ${ic[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>oc._`{comparison: ${ic[e].okStr}, limit: ${t}}`},qH={keyword:Object.keys(ic),type:"number",schemaType:"number",$data:!0,error:FH,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(oc._`${r} ${ic[t].fail} ${n} || isNaN(${r})`)}};EE.default=qH});var jE=C(function(PE){Object.defineProperty(PE,"__esModule",{value:!0});var Uo=ye(),VH={message:({schemaCode:e})=>Uo.str`must be multiple of ${e}`,params:({schemaCode:e})=>Uo._`{multipleOf: ${e}}`},BH={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:VH,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?Uo._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:Uo._`${o} !== parseInt(${o})`;e.fail$data(Uo._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};PE.default=BH});var AE=C(function(RE){Object.defineProperty(RE,"__esModule",{value:!0});function kE(e){let t=e.length,r=0,n=0,s;while(n<t)if(r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t){if(s=e.charCodeAt(n),(s&64512)===56320)n++}return r}RE.default=kE;kE.code='require("ajv/dist/runtime/ucs2length").default'});var CE=C(function(OE){Object.defineProperty(OE,"__esModule",{value:!0});var Os=ye(),zH=we(),GH=AE(),KH={message({keyword:e,schemaCode:t}){return Os.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Os._`{limit: ${e}}`},YH={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:KH,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?Os.operators.GT:Os.operators.LT,o=s.opts.unicode===!1?Os._`${r}.length`:Os._`${zH.useFunc(e.gen,GH.default)}(${r})`;e.fail$data(Os._`${o} ${i} ${n}`)}};OE.default=YH});var TE=C(function(NE){Object.defineProperty(NE,"__esModule",{value:!0});var ZH=yr(),QH=we(),Pi=ye(),eV={message:({schemaCode:e})=>Pi.str`must match pattern "${e}"`,params:({schemaCode:e})=>Pi._`{pattern: ${e}}`},tV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:eV,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?Pi._`new RegExp`:QH.useFunc(t,l),d=t.let("valid");t.try(()=>t.assign(d,Pi._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(d,!1)),e.fail$data(Pi._`!${d}`)}else{let l=ZH.usePattern(e,s);e.fail$data(Pi._`!${l}.test(${r})`)}}};NE.default=tV});var ME=C(function(IE){Object.defineProperty(IE,"__esModule",{value:!0});var zo=ye(),nV={message({keyword:e,schemaCode:t}){return zo.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>zo._`{limit: ${e}}`},sV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:nV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?zo.operators.GT:zo.operators.LT;e.fail$data(zo._`Object.keys(${r}).length ${s} ${n}`)}};IE.default=sV});var DE=C(function(JE){Object.defineProperty(JE,"__esModule",{value:!0});var Ko=yr(),Go=ye(),oV=we(),aV={message:({params:{missingProperty:e}})=>Go.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Go._`{missingProperty: ${e}}`},lV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:aV,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:a}=o;if(!i&&r.length===0)return;let l=r.length>=a.loopRequired;if(o.allErrors)c();else d();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:b}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!b.has(g)){let y=o.schemaEnv.baseId+o.errSchemaPath,v=`required property "${g}" is not defined at "${y}" (strictRequired)`;oV.checkStrictMode(o,v,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Go.nil,p);else for(let m of r)Ko.checkReportMissingProp(e,m)}function d(){let m=t.let("missing");if(l||i){let b=t.let("valid",!0);e.block$data(b,()=>h(m,b)),e.ok(b)}else t.if(Ko.checkMissingProp(e,r,m)),Ko.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Ko.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function h(m,b){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(b,Ko.propertyInData(t,s,m,a.ownProperties)),t.if(Go.not(b),()=>{e.error(),t.break()})},Go.nil)}}};JE.default=lV});var FE=C(function(LE){Object.defineProperty(LE,"__esModule",{value:!0});var Yo=ye(),uV={message({keyword:e,schemaCode:t}){return Yo.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Yo._`{limit: ${e}}`},dV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:uV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Yo.operators.GT:Yo.operators.LT;e.fail$data(Yo._`${r}.length ${s} ${n}`)}};LE.default=dV});var ac=C(function(HE){Object.defineProperty(HE,"__esModule",{value:!0});var qE=If();qE.code='require("ajv/dist/runtime/equal").default';HE.default=qE});var BE=C(function(VE){Object.defineProperty(VE,"__esModule",{value:!0});var ip=Io(),yt=ye(),mV=we(),hV=ac(),gV={message:({params:{i:e,j:t}})=>yt.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>yt._`{i: ${e}, j: ${t}}`},yV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:gV,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=e;if(!n&&!s)return;let l=t.let("valid"),c=i.items?ip.getSchemaTypes(i.items):[];e.block$data(l,d,yt._`${o} === false`),e.ok(l);function d(){let b=t.let("i",yt._`${r}.length`),g=t.let("j");e.setParams({i:b,j:g}),t.assign(l,!0),t.if(yt._`${b} > 1`,()=>(p()?h:m)(b,g))}function p(){return c.length>0&&!c.some((b)=>b==="object"||b==="array")}function h(b,g){let y=t.name("item"),v=ip.checkDataTypes(c,y,a.opts.strictNumbers,ip.DataType.Wrong),j=t.const("indices",yt._`{}`);t.for(yt._`;${b}--;`,()=>{if(t.let(y,yt._`${r}[${b}]`),t.if(v,yt._`continue`),c.length>1)t.if(yt._`typeof ${y} == "string"`,yt._`${y} += "_"`);t.if(yt._`typeof ${j}[${y}] == "number"`,()=>{t.assign(g,yt._`${j}[${y}]`),e.error(),t.assign(l,!1).break()}).code(yt._`${j}[${y}] = ${b}`)})}function m(b,g){let y=mV.useFunc(t,hV.default),v=t.name("outer");t.label(v).for(yt._`;${b}--;`,()=>t.for(yt._`${g} = ${b}; ${g}--;`,()=>t.if(yt._`${y}(${r}[${b}], ${r}[${g}])`,()=>{e.error(),t.assign(l,!1).break(v)})))}}};VE.default=yV});var UE=C(function(WE){Object.defineProperty(WE,"__esModule",{value:!0});var op=ye(),xV=we(),$V=ac(),vV={message:"must be equal to constant",params:({schemaCode:e})=>op._`{allowedValue: ${e}}`},wV={keyword:"const",$data:!0,error:vV,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(op._`!${xV.useFunc(t,$V.default)}(${r}, ${s})`);else e.fail(op._`${i} !== ${r}`)}};WE.default=wV});var GE=C(function(zE){Object.defineProperty(zE,"__esModule",{value:!0});var Xo=ye(),EV=we(),_V=ac(),PV={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Xo._`{allowedValues: ${e}}`},jV={keyword:"enum",schemaType:"array",$data:!0,error:PV,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=o.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=EV.useFunc(t,_V.default),d;if(a||n)d=t.let("valid"),e.block$data(d,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);d=Xo.or(...s.map((b,g)=>h(m,g)))}e.pass(d);function p(){t.assign(d,!1),t.forOf("v",i,(m)=>t.if(Xo._`${c()}(${r}, ${m})`,()=>t.assign(d,!0).break()))}function h(m,b){let g=s[b];return typeof g==="object"&&g!==null?Xo._`${c()}(${r}, ${m}[${b}])`:Xo._`${r} === ${g}`}}};zE.default=jV});var ap=C(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});var RV=_E(),AV=jE(),OV=CE(),CV=TE(),NV=ME(),TV=DE(),IV=FE(),MV=BE(),JV=UE(),DV=GE(),LV=[RV.default,AV.default,OV.default,CV.default,NV.default,TV.default,IV.default,MV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},JV.default,DV.default];KE.default=LV});var cp=C(function(XE){Object.defineProperty(XE,"__esModule",{value:!0});XE.validateAdditionalItems=void 0;var Cs=ye(),lp=we(),qV={message:({params:{len:e}})=>Cs.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Cs._`{limit: ${e}}`},HV={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:qV,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){lp.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}YE(e,n)}};function YE(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",Cs._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Cs._`${a} <= ${t.length}`);else if(typeof n=="object"&&!lp.alwaysValidSchema(o,n)){let c=r.var("valid",Cs._`${a} <= ${t.length}`);r.if(Cs.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(d)=>{if(e.subschema({keyword:i,dataProp:d,dataPropType:lp.Type.Num},c),!o.allErrors)r.if(Cs.not(c),()=>r.break())})}}XE.validateAdditionalItems=YE;XE.default=HV});var up=C(function(t_){Object.defineProperty(t_,"__esModule",{value:!0});t_.validateTuple=void 0;var QE=ye(),lc=we(),BV=yr(),WV={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return e_(e,"additionalItems",t);if(r.items=!0,lc.alwaysValidSchema(r,t))return;e.ok(BV.validateArray(e))}};function e_(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(d(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=lc.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",QE._`${i}.length`);r.forEach((p,h)=>{if(lc.alwaysValidSchema(a,p))return;n.if(QE._`${c} > ${h}`,()=>e.subschema({keyword:o,schemaProp:h,dataProp:h},l)),e.ok(l)});function d(p){let{opts:h,errSchemaPath:m}=a,b=r.length,g=b===p.minItems&&(b===p.maxItems||p[t]===!1);if(h.strictTuples&&!g){let y=`"${o}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;lc.checkStrictMode(a,y,h.strictTuples)}}}t_.validateTuple=e_;t_.default=WV});var s_=C(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});var zV=up(),GV={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>zV.validateTuple(e,"items")};n_.default=GV});var a_=C(function(o_){Object.defineProperty(o_,"__esModule",{value:!0});var i_=ye(),YV=we(),XV=yr(),ZV=cp(),QV={message:({params:{len:e}})=>i_.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>i_._`{limit: ${e}}`},e4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:QV,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,YV.alwaysValidSchema(n,t))return;if(s)ZV.validateAdditionalItems(e,s);else e.ok(XV.validateArray(e))}};o_.default=e4});var c_=C(function(l_){Object.defineProperty(l_,"__esModule",{value:!0});var br=ye(),cc=we(),r4={message:({params:{min:e,max:t}})=>t===void 0?br.str`must contain at least ${e} valid item(s)`:br.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?br._`{minContains: ${e}}`:br._`{minContains: ${e}, maxContains: ${t}}`},n4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:r4,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e,o,a,{minContains:l,maxContains:c}=n;if(i.opts.next)o=l===void 0?1:l,a=c;else o=1;let d=t.const("len",br._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){cc.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){cc.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(cc.alwaysValidSchema(i,r)){let g=br._`${d} >= ${o}`;if(a!==void 0)g=br._`${g} && ${d} <= ${a}`;e.pass(g);return}i.items=!0;let p=t.name("valid");if(a===void 0&&o===1)m(p,()=>t.if(p,()=>t.break()));else if(o===0){if(t.let(p,!0),a!==void 0)t.if(br._`${s}.length > 0`,h)}else t.let(p,!1),h();e.result(p,()=>e.reset());function h(){let g=t.name("_valid"),y=t.let("count",0);m(g,()=>t.if(g,()=>b(y)))}function m(g,y){t.forRange("i",0,d,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:cc.Type.Num,compositeRule:!0},g),y()})}function b(g){if(t.code(br._`${g}++`),a===void 0)t.if(br._`${g} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(br._`${g} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(br._`${g} >= ${o}`,()=>t.assign(p,!0))}}};l_.default=n4});var uc=C(function(f_){Object.defineProperty(f_,"__esModule",{value:!0});f_.validateSchemaDeps=f_.validatePropertyDeps=f_.error=void 0;var dp=ye(),i4=we(),Zo=yr();f_.error={message:({params:{property:e,depsCount:t,deps:r}})=>dp.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>dp._`{property: ${e},
566
+ || ${o} === "boolean" || ${s} === null`).assign(a,xe._`[${s}]`)}}}function Sq({gen:e,parentData:t,parentDataProperty:r},n){e.if(xe._`${t} !== undefined`,()=>e.assign(xe._`${t}[${r}]`,n))}function Mf(e,t,r,n=$i.Correct){let s=n===$i.Correct?xe.operators.EQ:xe.operators.NEQ,i;switch(e){case"null":return xe._`${t} ${s} null`;case"array":i=xe._`Array.isArray(${t})`;break;case"object":i=xe._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o(xe._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return xe._`typeof ${t} ${s} ${e}`}return n===$i.Correct?i:xe.not(i);function o(a=xe.nil){return xe.and(xe._`typeof ${t} == "number"`,a,r?xe._`isFinite(${t})`:xe.nil)}}WS.checkDataType=Mf;function Jf(e,t,r,n){if(e.length===1)return Mf(e[0],t,r,n);let s,i=HS.toHash(e);if(i.array&&i.object){let o=xe._`typeof ${t} != "object"`;s=i.null?o:xe._`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else s=xe.nil;if(i.number)delete i.integer;for(let o in i)s=xe.and(s,Mf(o,t,r,n));return s}WS.checkDataTypes=Jf;var Eq={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?xe._`{type: ${e}}`:xe._`{type: ${t}}`};function Df(e){let t=_q(e);bq.reportError(t,Eq)}WS.reportTypeError=Df;function _q(e){let{gen:t,data:r,schema:n}=e,s=HS.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}});var YS=C(function(GS){Object.defineProperty(GS,"__esModule",{value:!0});GS.assignDefaults=void 0;var vi=ye(),Cq=Se();function Tq(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let s in r)zS(e,s,r[s].default);else if(t==="array"&&Array.isArray(n))n.forEach((s,i)=>zS(e,i,s.default))}GS.assignDefaults=Tq;function zS(e,t,r){let{gen:n,compositeRule:s,data:i,opts:o}=e;if(r===void 0)return;let a=vi._`${i}${vi.getProperty(t)}`;if(s){Cq.checkStrictMode(e,`default is ignored for: ${a}`);return}let l=vi._`${a} === undefined`;if(o.useDefaults==="empty")l=vi._`${l} || ${a} === null || ${a} === ""`;n.if(l,vi._`${a} = ${vi.stringify(r)}`)}});var yr=C(function(QS){Object.defineProperty(QS,"__esModule",{value:!0});QS.validateUnion=QS.validateArray=QS.usePattern=QS.callValidateCode=QS.schemaProperties=QS.allSchemaProperties=QS.noPropertyInData=QS.propertyInData=QS.isOwnProperty=QS.hasPropFunc=QS.reportMissingProp=QS.checkMissingProp=QS.checkReportMissingProp=void 0;var He=ye(),Lf=Se(),Gn=gr(),Nq=Se();function Iq(e,t){let{gen:r,data:n,it:s}=e;r.if(qf(r,n,t,s.opts.ownProperties),()=>{e.setParams({missingProperty:He._`${t}`},!0),e.error()})}QS.checkReportMissingProp=Iq;function Mq({gen:e,data:t,it:{opts:r}},n,s){return He.or(...n.map((i)=>He.and(qf(e,t,i,r.ownProperties),He._`${s} = ${i}`)))}QS.checkMissingProp=Mq;function Jq(e,t){e.setParams({missingProperty:t},!0),e.error()}QS.reportMissingProp=Jq;function XS(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:He._`Object.prototype.hasOwnProperty`})}QS.hasPropFunc=XS;function Ff(e,t,r){return He._`${XS(e)}.call(${t}, ${r})`}QS.isOwnProperty=Ff;function Dq(e,t,r,n){let s=He._`${t}${He.getProperty(r)} !== undefined`;return n?He._`${s} && ${Ff(e,t,r)}`:s}QS.propertyInData=Dq;function qf(e,t,r,n){let s=He._`${t}${He.getProperty(r)} === undefined`;return n?He.or(s,He.not(Ff(e,t,r))):s}QS.noPropertyInData=qf;function ZS(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}QS.allSchemaProperties=ZS;function Lq(e,t){return ZS(t).filter((r)=>!Lf.alwaysValidSchema(e,t[r]))}QS.schemaProperties=Lq;function Fq({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:i},it:o},a,l,c){let u=c?He._`${e}, ${t}, ${n}${s}`:t,p=[[Gn.default.instancePath,He.strConcat(Gn.default.instancePath,i)],[Gn.default.parentData,o.parentData],[Gn.default.parentDataProperty,o.parentDataProperty],[Gn.default.rootData,Gn.default.rootData]];if(o.opts.dynamicRef)p.push([Gn.default.dynamicAnchors,Gn.default.dynamicAnchors]);let g=He._`${u}, ${r.object(...p)}`;return l!==He.nil?He._`${a}.call(${l}, ${g})`:He._`${a}(${g})`}QS.callValidateCode=Fq;var qq=He._`new RegExp`;function Hq({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:s}=t.code,i=s(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:He._`${s.code==="new RegExp"?qq:Nq.useFunc(e,s)}(${r}, ${n})`})}QS.usePattern=Hq;function Vq(e){let{gen:t,data:r,keyword:n,it:s}=e,i=t.name("valid");if(s.allErrors){let a=t.let("valid",!0);return o(()=>t.assign(a,!1)),a}return t.var(i,!0),o(()=>t.break()),i;function o(a){let l=t.const("len",He._`${r}.length`);t.forRange("i",0,l,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Lf.Type.Num},i),t.if(He.not(i),a)})}}QS.validateArray=Vq;function Bq(e){let{gen:t,schema:r,keyword:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((l)=>Lf.alwaysValidSchema(s,l))&&!s.opts.unevaluated)return;let o=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let u=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(o,He._`${o} || ${a}`),!e.mergeValidEvaluated(u,a))t.if(He.not(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}QS.validateUnion=Bq});var i1=C(function(n1){Object.defineProperty(n1,"__esModule",{value:!0});n1.validateKeywordUsage=n1.validSchemaType=n1.funcKeywordCode=n1.macroKeywordCode=void 0;var Tt=ye(),ks=gr(),n5=yr(),s5=Io();function i5(e,t){let{gen:r,keyword:n,schema:s,parentSchema:i,it:o}=e,a=t.macro.call(o.self,s,i,o),l=r1(r,n,a);if(o.opts.validateSchema!==!1)o.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:Tt.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}n1.macroKeywordCode=i5;function o5(e,t){var r;let{gen:n,keyword:s,schema:i,parentSchema:o,$data:a,it:l}=e;l5(l,t);let c=!a&&t.compile?t.compile.call(l.self,i,o,l):t.validate,u=r1(n,s,c),p=n.let("valid");e.block$data(p,g),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function g(){if(t.errors===!1){if(h(),t.modifying)t1(e);y(()=>e.error())}else{let v=t.async?m():b();if(t.modifying)t1(e);y(()=>a5(e,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>h(Tt._`await `),(j)=>n.assign(p,!1).if(Tt._`${j} instanceof ${l.ValidationError}`,()=>n.assign(v,Tt._`${j}.errors`),()=>n.throw(j))),v}function b(){let v=Tt._`${u}.errors`;return n.assign(v,null),h(Tt.nil),v}function h(v=t.async?Tt._`await `:Tt.nil){let j=l.opts.passContext?ks.default.this:ks.default.self,S=!(("compile"in t)&&!a||t.schema===!1);n.assign(p,Tt._`${v}${n5.callValidateCode(e,u,j,S)}`,t.modifying)}function y(v){var j;n.if(Tt.not((j=t.valid)!==null&&j!==void 0?j:p),v)}}n1.funcKeywordCode=o5;function t1(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,Tt._`${n.parentData}[${n.parentDataProperty}]`))}function a5(e,t){let{gen:r}=e;r.if(Tt._`Array.isArray(${t})`,()=>{r.assign(ks.default.vErrors,Tt._`${ks.default.vErrors} === null ? ${t} : ${ks.default.vErrors}.concat(${t})`).assign(ks.default.errors,Tt._`${ks.default.vErrors}.length`),s5.extendErrors(e)},()=>e.error())}function l5({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function r1(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:Tt.stringify(r)})}function c5(e,t,r=!1){return!t.length||t.some((n)=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}n1.validSchemaType=c5;function u5({schema:e,opts:t,self:r,errSchemaPath:n},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw Error("ajv implementation error");let o=s.dependencies;if(o===null||o===void 0?void 0:o.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(s.validateSchema){if(!s.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw Error(l)}}}n1.validateKeywordUsage=u5});var c1=C(function(a1){Object.defineProperty(a1,"__esModule",{value:!0});a1.extendSubschemaMode=a1.extendSubschemaData=a1.getSubschema=void 0;var Ur=ye(),o1=Se();function m5(e,{keyword:t,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Ur._`${e.schemaPath}${Ur.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Ur._`${e.schemaPath}${Ur.getProperty(t)}${Ur.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${o1.escapeFragment(r)}`}}if(n!==void 0){if(s===void 0||i===void 0||o===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:o,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}a1.getSubschema=m5;function h5(e,t,{dataProp:r,dataPropType:n,data:s,dataTypes:i,propertyName:o}){if(s!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:u,opts:p}=t,g=a.let("data",Ur._`${t.data}${Ur.getProperty(r)}`,!0);l(g),e.errorPath=Ur.str`${c}${o1.getErrorPath(r,n,p.jsPropertySyntax)}`,e.parentDataProperty=Ur._`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(s!==void 0){let c=s instanceof Ur.Name?s:a.let("data",s,!0);if(l(c),o!==void 0)e.propertyName=o}if(i)e.dataTypes=i;function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}a1.extendSubschemaData=h5;function g5(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:i}){if(n!==void 0)e.compositeRule=n;if(s!==void 0)e.createErrors=s;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}a1.extendSubschemaMode=g5});var Hf=C(function(AZ,u1){u1.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,s,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=n;s--!==0;){var o=i[s];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var f1=C(function(OZ,d1){var Kn=d1.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};Gl(t,n,s,e,"",e)};Kn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Kn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Kn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Kn.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 Gl(e,t,r,n,s,i,o,a,l,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,s,i,o,a,l,c);for(var u in n){var p=n[u];if(Array.isArray(p)){if(u in Kn.arrayKeywords)for(var g=0;g<p.length;g++)Gl(e,t,r,p[g],s+"/"+u+"/"+g,i,s,u,n,g)}else if(u in Kn.propsKeywords){if(p&&typeof p=="object")for(var m in p)Gl(e,t,r,p[m],s+"/"+u+"/"+x5(m),i,s,u,n,m)}else if(u in Kn.keywords||e.allKeys&&!(u in Kn.skipKeywords))Gl(e,t,r,p,s+"/"+u,i,s,u,n)}r(n,s,i,o,a,l,c)}}function x5(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Jo=C(function(g1){Object.defineProperty(g1,"__esModule",{value:!0});g1.getSchemaRefs=g1.resolveUrl=g1.normalizeId=g1._getFullPath=g1.getFullPath=g1.inlineRef=void 0;var $5=Se(),v5=Hf(),w5=f1(),S5=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function E5(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Vf(e);if(!t)return!1;return p1(e)<=t}g1.inlineRef=E5;var _5=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Vf(e){for(let t in e){if(_5.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Vf))return!0;if(typeof r=="object"&&Vf(r))return!0}return!1}function p1(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,S5.has(r))continue;if(typeof e[r]=="object")$5.eachItem(e[r],(n)=>t+=p1(n));if(t===1/0)return 1/0}return t}function m1(e,t="",r){if(r!==!1)t=wi(t);let n=e.parse(t);return h1(e,n)}g1.getFullPath=m1;function h1(e,t){return e.serialize(t).split("#")[0]+"#"}g1._getFullPath=h1;var P5=/#\/?$/;function wi(e){return e?e.replace(P5,""):""}g1.normalizeId=wi;function j5(e,t,r){return r=wi(r),e.resolve(t,r)}g1.resolveUrl=j5;var k5=/^[a-z_][-a-z0-9._]*$/i;function R5(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=wi(e[r]||t),i={"":s},o=m1(n,s,!1),a={},l=new Set;return w5(e,{allKeys:!0},(p,g,m,b)=>{if(b===void 0)return;let h=o+g,y=i[b];if(typeof p[r]=="string")y=v.call(this,p[r]);j.call(this,p.$anchor),j.call(this,p.$dynamicAnchor),i[g]=y;function v(S){let _=this.opts.uriResolver.resolve;if(S=wi(y?_(y,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(p,E.schema,S);else if(S!==wi(h))if(S[0]==="#")c(p,a[S],S),a[S]=p;else this.refs[S]=h;return S}function j(S){if(typeof S=="string"){if(!k5.test(S))throw Error(`invalid anchor "${S}"`);v.call(this,`#${S}`)}}}),a;function c(p,g,m){if(g!==void 0&&!v5(p,g))throw u(m)}function u(p){return Error(`reference "${p}" resolves to more than one schema`)}}g1.getSchemaRefs=R5});var Si=C(function(C1){Object.defineProperty(C1,"__esModule",{value:!0});C1.getData=C1.KeywordCxt=C1.validateFunctionCode=void 0;var v1=IS(),w1=Mo(),Bf=If(),Kl=Mo(),I5=YS(),Do=i1(),Wf=c1(),ne=ye(),me=gr(),M5=Jo(),wn=Se(),Lo=Io();function J5(e){if(_1(e)){if(P1(e),E1(e)){F5(e);return}}S1(e,()=>v1.topBoolOrEmptySchema(e))}C1.validateFunctionCode=J5;function S1({gen:e,validateName:t,schema:r,schemaEnv:n,opts:s},i){if(s.code.es5)e.func(t,ne._`${me.default.data}, ${me.default.valCxt}`,n.$async,()=>{e.code(ne._`"use strict"; ${b1(r,s)}`),L5(e,s),e.code(i)});else e.func(t,ne._`${me.default.data}, ${D5(s)}`,n.$async,()=>e.code(b1(r,s)).code(i))}function D5(e){return ne._`{${me.default.instancePath}="", ${me.default.parentData}, ${me.default.parentDataProperty}, ${me.default.rootData}=${me.default.data}${e.dynamicRef?ne._`, ${me.default.dynamicAnchors}={}`:ne.nil}}={}`}function L5(e,t){e.if(me.default.valCxt,()=>{if(e.var(me.default.instancePath,ne._`${me.default.valCxt}.${me.default.instancePath}`),e.var(me.default.parentData,ne._`${me.default.valCxt}.${me.default.parentData}`),e.var(me.default.parentDataProperty,ne._`${me.default.valCxt}.${me.default.parentDataProperty}`),e.var(me.default.rootData,ne._`${me.default.valCxt}.${me.default.rootData}`),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`${me.default.valCxt}.${me.default.dynamicAnchors}`)},()=>{if(e.var(me.default.instancePath,ne._`""`),e.var(me.default.parentData,ne._`undefined`),e.var(me.default.parentDataProperty,ne._`undefined`),e.var(me.default.rootData,me.default.data),t.dynamicRef)e.var(me.default.dynamicAnchors,ne._`{}`)})}function F5(e){let{schema:t,opts:r,gen:n}=e;S1(e,()=>{if(r.$comment&&t.$comment)k1(e);if(W5(e),n.let(me.default.vErrors,null),n.let(me.default.errors,0),r.unevaluated)q5(e);j1(e),G5(e)});return}function q5(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",ne._`${r}.evaluated`),t.if(ne._`${e.evaluated}.dynamicProps`,()=>t.assign(ne._`${e.evaluated}.props`,ne._`undefined`)),t.if(ne._`${e.evaluated}.dynamicItems`,()=>t.assign(ne._`${e.evaluated}.items`,ne._`undefined`))}function b1(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?ne._`/*# sourceURL=${r} */`:ne.nil}function H5(e,t){if(_1(e)){if(P1(e),E1(e)){V5(e,t);return}}v1.boolOrEmptySchema(e,t)}function E1({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function _1(e){return typeof e.schema!="boolean"}function V5(e,t){let{schema:r,gen:n,opts:s}=e;if(s.$comment&&r.$comment)k1(e);U5(e),z5(e);let i=n.const("_errs",me.default.errors);j1(e,i),n.var(t,ne._`${i} === ${me.default.errors}`)}function P1(e){wn.checkUnknownRules(e),B5(e)}function j1(e,t){if(e.opts.jtd)return x1(e,[],!1,t);let r=w1.getSchemaTypes(e.schema),n=w1.coerceAndCheckDataType(e,r);x1(e,r,!n,t)}function B5(e){let{schema:t,errSchemaPath:r,opts:n,self:s}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&wn.schemaHasRulesButRef(t,s.RULES))s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function W5(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)wn.checkStrictMode(e,"default is ignored in the schema root")}function U5(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=M5.resolveUrl(e.opts.uriResolver,e.baseId,t)}function z5(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function k1({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:s}){let i=r.$comment;if(s.$comment===!0)e.code(ne._`${me.default.self}.logger.log(${i})`);else if(typeof s.$comment=="function"){let o=ne.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(ne._`${me.default.self}.opts.$comment(${i}, ${o}, ${a}.schema)`)}}function G5(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:s,opts:i}=e;if(r.$async)t.if(ne._`${me.default.errors} === 0`,()=>t.return(me.default.data),()=>t.throw(ne._`new ${s}(${me.default.vErrors})`));else{if(t.assign(ne._`${n}.errors`,me.default.vErrors),i.unevaluated)K5(e);t.return(ne._`${me.default.errors} === 0`)}}function K5({gen:e,evaluated:t,props:r,items:n}){if(r instanceof ne.Name)e.assign(ne._`${t}.props`,r);if(n instanceof ne.Name)e.assign(ne._`${t}.items`,n)}function x1(e,t,r,n){let{gen:s,schema:i,data:o,allErrors:a,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!wn.schemaHasRulesButRef(i,u))){s.block(()=>A1(e,"$ref",u.all.$ref.definition));return}if(!l.jtd)Y5(e,t);s.block(()=>{for(let g of u.rules)p(g);p(u.post)});function p(g){if(!Bf.shouldUseGroup(i,g))return;if(g.type){if(s.if(Kl.checkDataType(g.type,o,l.strictNumbers)),$1(e,g),t.length===1&&t[0]===g.type&&r)s.else(),Kl.reportTypeError(e);s.endIf()}else $1(e,g);if(!a)s.if(ne._`${me.default.errors} === ${n||0}`)}}function $1(e,t){let{gen:r,schema:n,opts:{useDefaults:s}}=e;if(s)I5.assignDefaults(e,t.type);r.block(()=>{for(let i of t.rules)if(Bf.shouldUseRule(n,i))A1(e,i.keyword,i.definition,t.type)})}function Y5(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(X5(e,t),!e.opts.allowUnionTypes)Z5(e,t);Q5(e,e.dataTypes)}function X5(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!R1(e.dataTypes,r))Uf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),t3(e,t)}function Z5(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Uf(e,"use allowUnionTypes to allow union type keyword")}function Q5(e,t){let r=e.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&Bf.shouldUseRule(e.schema,s)){let{type:i}=s.definition;if(i.length&&!i.some((o)=>e3(t,o)))Uf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function e3(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function R1(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function t3(e,t){let r=[];for(let n of e.dataTypes)if(R1(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Uf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,wn.checkStrictMode(e,t,e.opts.strictTypes)}class zf{constructor(e,t,r){if(Do.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=wn.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",O1(this.$data,e));else if(this.schemaCode=this.schemaValue,!Do.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",me.default.errors)}result(e,t,r){this.failResult(ne.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(ne.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(ne._`${t} !== undefined && (${ne.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Lo.reportExtraError:Lo.reportError)(this,this.def.error,t)}$dataError(){Lo.reportError(this,this.def.$dataError||Lo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Lo.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=ne.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=ne.nil,t=ne.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:s,def:i}=this;if(r.if(ne.or(ne._`${n} === undefined`,t)),e!==ne.nil)r.assign(e,!0);if(s.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==ne.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:s}=this;return ne.or(i(),o());function i(){if(r.length){if(!(t instanceof ne.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return ne._`${Kl.checkDataTypes(a,t,s.opts.strictNumbers,Kl.DataType.Wrong)}`}return ne.nil}function o(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return ne._`!${a}(${t})`}return ne.nil}}subschema(e,t){let r=Wf.getSubschema(this.it,e);Wf.extendSubschemaData(r,this.it,e),Wf.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return H5(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=wn.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=wn.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,ne.Name)),!0}}C1.KeywordCxt=zf;function A1(e,t,r,n){let s=new zf(e,r,t);if("code"in r)r.code(s,n);else if(s.$data&&r.validate)Do.funcKeywordCode(s,r);else if("macro"in r)Do.macroKeywordCode(s,r);else if(r.compile||r.validate)Do.funcKeywordCode(s,r)}var r3=/^\/(?:[^~]|~0|~1)*$/,n3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O1(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let s,i;if(e==="")return me.default.rootData;if(e[0]==="/"){if(!r3.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=me.default.rootData}else{let c=n3.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(s=c[2],s==="#"){if(u>=t)throw Error(l("property/index",u));return n[t-u]}if(u>t)throw Error(l("data",u));if(i=r[t-u],!s)return i}let o=i,a=s.split("/");for(let c of a)if(c)i=ne._`${i}${ne.getProperty(wn.unescapeJsonPointer(c))}`,o=ne._`${o} && ${i}`;return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}C1.getData=O1});var Fo=C(function(I1){Object.defineProperty(I1,"__esModule",{value:!0});class N1 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}I1.default=N1});var Ei=C(function(J1){Object.defineProperty(J1,"__esModule",{value:!0});var Gf=Jo();class M1 extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Gf.resolveUrl(e,t,r),this.missingSchema=Gf.normalizeId(Gf.getFullPath(e,this.missingRef))}}J1.default=M1});var Ho=C(function(F1){Object.defineProperty(F1,"__esModule",{value:!0});F1.resolveSchema=F1.getCompilingSchema=F1.resolveRef=F1.compileSchema=F1.SchemaEnv=void 0;var kr=ye(),l3=Fo(),Rs=gr(),Rr=Jo(),D1=Se(),c3=Si();class qo{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:Rr.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}F1.SchemaEnv=qo;function Yf(e){let t=L1.call(this,e);if(t)return t;let r=Rr.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:i}=this.opts,o=new kr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:i}),a;if(e.$async)a=o.scopeValue("Error",{ref:l3.default,code:kr._`require("ajv/dist/runtime/validation_error").default`});let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:Rs.default.data,parentData:Rs.default.parentData,parentDataProperty:Rs.default.parentDataProperty,dataNames:[Rs.default.data],dataPathArr:[kr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:kr.stringify(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:kr.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:kr._`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),c3.validateFunctionCode(c),o.optimize(this.opts.code.optimize);let p=o.toString();if(u=`${o.scopeRefs(Rs.default.scope)}return ${p}`,this.opts.code.process)u=this.opts.code.process(u,e);let m=Function(`${Rs.default.self}`,`${Rs.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:l,validateCode:p,scopeValues:o._values};if(this.opts.unevaluated){let{props:b,items:h}=c;if(m.evaluated={props:b instanceof kr.Name?void 0:b,items:h instanceof kr.Name?void 0:h,dynamicProps:b instanceof kr.Name,dynamicItems:h instanceof kr.Name},m.source)m.source.evaluated=kr.stringify(m.evaluated)}return e.validate=m,e}catch(p){if(delete e.validate,delete e.validateName,u)this.logger.error("Error compiling schema, function code:",u);throw p}finally{this._compilations.delete(e)}}F1.compileSchema=Yf;function u3(e,t,r){var n;r=Rr.resolveUrl(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=p3.call(this,e,r);if(i===void 0){let o=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(o)i=new qo({schema:o,schemaId:a,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=d3.call(this,i)}F1.resolveRef=u3;function d3(e){if(Rr.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Yf.call(this,e)}function L1(e){for(let t of this._compilations)if(f3(t,e))return t}F1.getCompilingSchema=L1;function f3(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function p3(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Yl.call(this,e,t)}function Yl(e,t){let r=this.opts.uriResolver.parse(t),n=Rr._getFullPath(this.opts.uriResolver,r),s=Rr.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===s)return Kf.call(this,r,e);let i=Rr.normalizeId(n),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let a=Yl.call(this,e,o);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Kf.call(this,r,a)}if(typeof(o===null||o===void 0?void 0:o.schema)!=="object")return;if(!o.validate)Yf.call(this,o);if(i===Rr.normalizeId(t)){let{schema:a}=o,{schemaId:l}=this.opts,c=a[l];if(c)s=Rr.resolveUrl(this.opts.uriResolver,s,c);return new qo({schema:a,schemaId:l,root:e,baseId:s})}return Kf.call(this,r,o)}F1.resolveSchema=Yl;var m3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Kf(e,{baseId:t,schema:r,root:n}){var s;if(((s=e.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let l=r[D1.unescapeFragment(a)];if(l===void 0)return;r=l;let c=typeof r==="object"&&r[this.opts.schemaId];if(!m3.has(a)&&c)t=Rr.resolveUrl(this.opts.uriResolver,t,c)}let i;if(typeof r!="boolean"&&r.$ref&&!D1.schemaHasRulesButRef(r,this.RULES)){let a=Rr.resolveUrl(this.opts.uriResolver,t,r.$ref);i=Yl.call(this,n,a)}let{schemaId:o}=this.opts;if(i=i||new qo({schema:r,schemaId:o,root:n,baseId:t}),i.schema!==i.root.schema)return i;return}});var H1=C(function(JZ,x3){x3.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 rp=C(function(DZ,Y1){var $3=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Zf=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),v3=RegExp.prototype.test.bind(/^\d*$/u),As=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Qf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),B1=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ep=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),w3=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Kt=Array(256);for(let t=0;t<256;t++)Kt[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function Et(e){if(e<2048)return Kt[192|e>>6]+Kt[128|e&63];if(e<65536)return Kt[224|e>>12]+Kt[128|e>>6&63]+Kt[128|e&63];return Kt[240|e>>18]+Kt[128|e>>12&63]+Kt[128|e>>6&63]+Kt[128|e&63]}function S3(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var E3=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),_3=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),P3=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),j3=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function k3(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(P3(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&As(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function V1(e){let t=-1,r=0,n=-1,s=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(s++,s>r)r=s,t=n}else n=-1,s=0;if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function R3(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let s=r.concat(n),i=0;for(let a=0;a<s.length;a++){let l=s[a];if(l==="")return;if(l.indexOf(".")!==-1){if(a!==s.length-1||t!==-1&&n.length===0||!Zf(l))return;i+=2;continue}if(!E3(l))return;s[a]=parseInt(l,16).toString(16),i++}if(t===-1){if(i!==8)return;return V1(s)}if(i>=8)return;let o=s.slice(0,r.length);for(let a=i;a<8;a++)o.push("0");for(let a=r.length;a<s.length;a++)o.push(s[a]);return V1(o)}function Xf(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&_3(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(A3(n,":")<2)return{host:e,isIPV6:!1,error:t};let s="",i=n.indexOf("%");if(i!==-1){let a=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(s=n.slice(i+a),!k3(s))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let o=R3(n);if(o===void 0)return{host:e,isIPV6:!1,error:!0};return{host:o+(s?"%"+s:""),escapedHost:o+(s?"%25"+s:""),isIPV6:!0}}function A3(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function W1(e){let t=e,r=[],n=-1,s=0;while(s=t.length){if(s===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(s===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(s===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function O3(e){if(e===""||e[0]==="/")return W1(e);let t=e.split("/"),r=t.length-1,n=[],s=!1;for(let i=0;i<=r;i++){let o=t[i];if(o==="."||o===".."){if(o==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");s=i===r}else n.push(o)}if(s&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var C3={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},T3=/[@/?#:]/g,N3=/[@/?#]/g;function U1(e,t){let r=t?N3:T3;return r.lastIndex=0,e.replace(r,(n)=>C3[n])}function z1(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(As(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(t&&Qf(o))r+=o;else r+="%"+i;n+=2;continue}}r+=e[n]}return r}function I3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(As(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(o!=="."&&Qf(o))t+=o;else t+="%"+i;r+=2;continue}}if(B1(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=K1(s)?n:Kt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function M3(e,t=!1){let r="",n=t&&e[0]!=="/";for(let s=0;s<e.length;s++){let i=e[s];if(i==="%"&&s+2<e.length){let o=e.slice(s+1,s+3);if(As(o)){r+="%"+o.toUpperCase(),s+=2;continue}}if(i==="/")n=!1;if(B1(i)&&(i!==":"||!n))r+=i;else{let o=e.charCodeAt(s);if(o<128)r+=Kt[o];else if(o<55296||o>57343)r+=Et(o);else if(o<=56319&&s+1<e.length){let a=e.charCodeAt(s+1);if(a>=56320&&a<=57343)r+=Et(65536+(o-55296<<10)+(a-56320)),s++;else r+=Et(65533)}else r+=Et(65533)}}return r}function tp(e,t){let r="";for(let n=0;n<e.length;n++){let s=e[n];if(s==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(As(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(s))r+=s;else{let i=e.charCodeAt(n);if(i<128)r+=Kt[i];else if(i<55296||i>57343)r+=Et(i);else if(i<=56319&&n+1<e.length){let o=e.charCodeAt(n+1);if(o>=56320&&o<=57343)r+=Et(65536+(i-55296<<10)+(o-56320)),n++;else r+=Et(65533)}else r+=Et(65533)}}return r}function G1(e){return tp(e,w3)}function J3(e){return tp(e,ep)}function D3(e){return tp(e,ep)}function K1(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 L3(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let s=e.slice(r+1,r+3);if(As(s)){let i=s.toUpperCase(),o=String.fromCharCode(parseInt(i,16));if(Qf(o))t+=o;else t+="%"+i;r+=2;continue}}if(ep(n))t+=n;else{let s=e.charCodeAt(r);if(s<128)t+=K1(s)?n:Kt[s];else if(s<55296||s>57343)t+=Et(s);else if(s<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343)t+=Et(65536+(s-55296<<10)+(i-56320)),r++;else t+=Et(65533)}else t+=Et(65533)}}return t}function F3(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(As(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function q3(e){let t=[];if(e.userinfo!==void 0)t.push(G1(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!Zf(r)){let n=Xf(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=z1(r,!0),n=Xf(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=U1(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!v3(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Y1.exports={nonSimpleDomain:j3,recomposeAuthority:q3,reescapeHostDelimiters:U1,normalizePercentEncoding:z1,normalizePathEncoding:I3,serializePathEncoding:M3,normalizeQueryFragmentEncoding:L3,encodeUserinfo:G1,encodeQuery:J3,encodeFragment:D3,escapePreservingEscapes:F3,removeDotSegments:W1,removeDotSegmentsRelative:O3,isIPv4:Zf,isUUID:$3,normalizeIPv6:Xf,stringArrayToHexStripped:S3}});var tE=C(function(LZ,eE){var{isUUID:H3}=rp(),V3=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,B3=["http","https","ws","wss","urn","urn:uuid"];function W3(e){return B3.indexOf(e)!==-1}function np(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 X1(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function Z1(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 U3(e){return e.secure=np(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function z3(e){if(e.port===(np(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function G3(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(V3);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=`${n}:${t.nid||e.nid}`,i=sp(s);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function K3(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),s=`${r}:${t.nid||n}`,i=sp(s);if(i)e=i.serialize(e,t);let o=e,a=e.nss;return o.path=`${n||t.nid}:${a}`,t.skipEscape=!0,o}function Y3(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!H3(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function X3(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Q1={scheme:"http",domainHost:!0,parse:X1,serialize:Z1},Z3={scheme:"https",domainHost:Q1.domainHost,parse:X1,serialize:Z1},Xl={scheme:"ws",domainHost:!0,parse:U3,serialize:z3},Q3={scheme:"wss",domainHost:Xl.domainHost,parse:Xl.parse,serialize:Xl.serialize},eH={scheme:"urn",parse:G3,serialize:K3,skipNormalize:!0},tH={scheme:"urn:uuid",parse:Y3,serialize:X3,skipNormalize:!0},Zl={http:Q1,https:Z3,ws:Xl,wss:Q3,urn:eH,"urn:uuid":tH};Object.setPrototypeOf(Zl,null);function sp(e){return e&&(Zl[e]||Zl[e.toLowerCase()])||void 0}eE.exports={wsIsSecure:np,SCHEMES:Zl,isValidSchemeName:W3,getSchemeHandler:sp}});var hE=C(function(FZ,rc){var{normalizeIPv6:oE,removeDotSegments:Bo,removeDotSegmentsRelative:aE,recomposeAuthority:rH,normalizePercentEncoding:ip,normalizePathEncoding:nH,serializePathEncoding:rE,normalizeQueryFragmentEncoding:nE,encodeQuery:sH,encodeFragment:iH,reescapeHostDelimiters:oH,isIPv4:lE,nonSimpleDomain:aH}=rp(),{SCHEMES:cE,getSchemeHandler:op}=tE(),uE=/^[A-Za-z][A-Za-z0-9+.-]*$/u,lH=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function sE(e){let t=String(e);if(!uE.test(t))throw TypeError("URI scheme is malformed.");return t}function cH(e,t){if(typeof e==="string")e=bH(e,t);else if(typeof e==="object")e=ec(Os(e,t),t);return e}function uH(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:s,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:l,malformedScheme:c}=Ql(e,n),{parsed:u,malformedAuthorityOrPort:p,malformedPercentEncoding:g,malformedSchemeSpecific:m,malformedHost:b,malformedScheme:h}=Ql(t,n);if(i||p||o||g||a||m||l||b||c||h)throw Error(s.error||u.error||"URI is malformed.");let y=dE(s,u,n,!0),v=op(r&&r.scheme||y.scheme),j=y.host,S=j!==void 0&&j!==""&&(lE(j)||oE(j).isIPV6);if(pE(y,r||{},v,S))throw Error("URI host is malformed.");fE(y,r||{},v,S);let _=j&&j.indexOf("%")!==-1&&!/\P{ASCII}/u.test(j);if(y.error&&!_)throw Error(y.error);return n.skipEscape=!0,Os(y,n)}function dE(e,t,r,n){let s={};if(!n)e=ec(Os(e,r),r),t=ec(Os(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)s.scheme=t.scheme,s.userinfo=t.userinfo,s.host=t.host,s.port=t.port,s.path=Bo(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=Bo(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=Bo(t.path);else{let i=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(i&&!e.path)s.path="/"+t.path;else if(!e.path)s.path=t.path;else s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;s.path=e.scheme===void 0&&!i&&s.path[0]!=="/"?aE(s.path):Bo(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 dH(e,t,r){let n=iE(e,r),s=iE(t,r);return n!==void 0&&s!==void 0&&n===s}function Os(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),s=[];if(r.scheme)r.scheme=sE(r.scheme);let i=op(n.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,n);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!o,l=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=rE(r.path,l);else r.path=ip(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=sE(r.scheme),s.push(r.scheme,":");let c=rH(r);if(c!==void 0){if(n.reference!=="suffix")s.push("//");if(s.push(c),r.path&&r.path[0]!=="/")s.push("/")}if(r.path!==void 0){let u=r.path;if(!n.absolutePath&&(!i||!i.absolutePath))u=a&&u[0]!=="/"?aE(u):Bo(u);if(a)u=rE(u,!0);if(c===void 0&&u[0]==="/"&&u[1]==="/")u="/%2F"+u.slice(2);s.push(u)}if(r.query!==void 0)s.push("?",sH(r.query));if(r.fragment!==void 0)s.push("#",iH(r.fragment));return s.join("")}var fH=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,pH=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,mH=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function hH(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 Vo(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 tc(e){return e[0]==="["&&e[e.length-1]==="]"}function gH(e){let t=e[4];return Vo(e[3])||t!==void 0&&!tc(t)&&Vo(t)||Vo(e[6])||Vo(e[7])||Vo(e[8])}function fE(e,t,r,n){if(pE(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!tc(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&aH(e.host)){let s;try{s=new URL("http://"+e.host)}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}if(!yH(s))return e.error=e.error||"URI host is malformed.",!0;e.host=s.hostname}return!1}function pE(e,t,r,n){return Boolean(e.host&&n===!1&&!tc(e.host)&&(t.domainHost||r&&r.domainHost)&&lH.test(e.host))}function yH(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function Ql(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1,i=!1,o=!1,a=!1,l=!1,c=!1,u=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let p=e.match(pH);if(p!==null&&p[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",s=!0;let g=e.match(mH);if(g!==null){let b=g[1],h=b.replace(/[\t\n\r]/g,"");if(h.length>=2){if(h.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",s=!0;else if(b.length!==h.length)n.error=n.error||"URI authority introducer must not contain whitespace.",s=!0}}let m=e.match(fH);if(m){if(n.scheme=m[1],n.userinfo=m[3],n.host=m[4],n.port=parseInt(m[5],10),n.path=m[6]||"",n.query=m[7],n.fragment=m[8],n.scheme!==void 0)if(uE.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(i=gH(m),i)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=m[5];let b=hH(n,m);if(b!==void 0)n.error=n.error||b,s=!0;if(n.host)if(lE(n.host)===!1){let v=tc(n.host),j=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,S=oE(n.host);if(u=S.isIPV6||S.isIPVFuture===!0,l=j&&(!v||S.error===!0),n.host=u?S.host:S.host.toLowerCase(),l)n.error=n.error||"URI host is malformed.",s=!0}else u=!0;if(n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path)n.reference="same-document";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let h=op(r.scheme||n.scheme);if(!l)a=fE(n,r,h,u);if(e.indexOf("%")!==-1&&n.host!==void 0&&!l){let y=u?n.host:ip(n.host,!0);if(!u)y=ip(y.toLowerCase());n.host=u||r.scheme!=="null"?oH(y,u):y}if(!h||h&&!h.skipNormalize){if(n.path)n.path=nH(n.path);if(n.query)n.query=nE(n.query);if(n.fragment)n.fragment=nE(n.fragment)}if(h&&h.parse){if(h.parse(n,r),h===cE.urn&&n.nid===void 0)o=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:c}}function ec(e,t){return Ql(e,t).parsed}function bH(e,t){return mE(e,t).normalized}function mE(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}=Ql(e,t);return{normalized:n||s||i||o||a?e:Os(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:a}}function iE(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:Os(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:l}=mE(r,t);return s||i||o||a||l?void 0:n}var ap={SCHEMES:cE,normalize:cH,resolve:uH,resolveComponent:dE,equal:dH,serialize:Os,parse:ec};rc.exports=ap;rc.exports.default=ap;rc.exports.fastUri=ap});var bE=C(function(yE){Object.defineProperty(yE,"__esModule",{value:!0});var gE=hE();gE.code='require("ajv/dist/runtime/uri").default';yE.default=gE});var up=C(function(Sn){Object.defineProperty(Sn,"__esModule",{value:!0});Sn.CodeGen=Sn.Name=Sn.nil=Sn.stringify=Sn.str=Sn._=Sn.KeywordCxt=void 0;var $H=Si();Object.defineProperty(Sn,"KeywordCxt",{enumerable:!0,get:function(){return $H.KeywordCxt}});var _i=ye();Object.defineProperty(Sn,"_",{enumerable:!0,get:function(){return _i._}});Object.defineProperty(Sn,"str",{enumerable:!0,get:function(){return _i.str}});Object.defineProperty(Sn,"stringify",{enumerable:!0,get:function(){return _i.stringify}});Object.defineProperty(Sn,"nil",{enumerable:!0,get:function(){return _i.nil}});Object.defineProperty(Sn,"Name",{enumerable:!0,get:function(){return _i.Name}});Object.defineProperty(Sn,"CodeGen",{enumerable:!0,get:function(){return _i.CodeGen}});var vH=Fo(),SE=Ei(),wH=Nf(),Uo=Ho(),SH=ye(),Wo=Jo(),nc=Mo(),cp=Se(),xE=H1(),EH=bE(),EE=(e,t)=>new RegExp(e,t);EE.code="new RegExp";var _H=["removeAdditional","useDefaults","coerceTypes"],PH=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),jH={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."},kH={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},$E=200;function RH(e){var t,r,n,s,i,o,a,l,c,u,p,g,m,b,h,y,v,j,S,_,E,O,R,k,I;let D=e.strict,M=(t=e.code)===null||t===void 0?void 0:t.optimize,L=M===!0||M===void 0?1:M||0,W=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:EE,se=(s=e.uriResolver)!==null&&s!==void 0?s:EH.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:D)!==null&&o!==void 0?o:!0,strictNumbers:(l=(a=e.strictNumbers)!==null&&a!==void 0?a:D)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:D)!==null&&u!==void 0?u:"log",strictTuples:(g=(p=e.strictTuples)!==null&&p!==void 0?p:D)!==null&&g!==void 0?g:"log",strictRequired:(b=(m=e.strictRequired)!==null&&m!==void 0?m:D)!==null&&b!==void 0?b:!1,code:e.code?{...e.code,optimize:L,regExp:W}:{optimize:L,regExp:W},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:$E,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:$E,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(j=e.messages)!==null&&j!==void 0?j:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(_=e.schemaId)!==null&&_!==void 0?_:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(O=e.validateSchema)!==null&&O!==void 0?O:!0,validateFormats:(R=e.validateFormats)!==null&&R!==void 0?R:!0,unicodeRegExp:(k=e.unicodeRegExp)!==null&&k!==void 0?k:!0,int32range:(I=e.int32range)!==null&&I!==void 0?I:!0,uriResolver:se}}class sc{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,...RH(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new SH.ValueScope({scope:{},prefixes:PH,es5:t,lines:r}),this.logger=IH(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=wH.getRules(),vE.call(this,jH,e,"NOT SUPPORTED"),vE.call(this,kH,e,"DEPRECATED","warn"),this._metaOpts=TH.call(this),e.formats)OH.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)CH.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);AH.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=xE;if(r==="id")n={...xE},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(c,u){await s.call(this,c.$schema);let p=this._addSchema(c,u);return p.validate||i.call(this,p)}async function s(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function i(c){try{return this._compileSchemaEnv(c)}catch(u){if(!(u instanceof SE.default))throw u;return o.call(this,u),await a.call(this,u.missingSchema),i.call(this,c)}}function o({missingSchema:c,missingRef:u}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${u} cannot be resolved`)}async function a(c){let u=await l.call(this,c);if(!this.refs[c])await s.call(this,u.$schema);if(!this.refs[c])this.addSchema(u,c,t)}async function l(c){let u=this._loading[c];if(u)return u;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,n);return this}let s;if(typeof e==="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw Error(`schema ${i} must be string`)}return t=Wo.normalizeId(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw Error(s)}return n}getSchema(e){let t;while(typeof(t=wE.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new Uo.SchemaEnv({schema:{},schemaId:r});if(t=Uo.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=wE.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Wo.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(JH.call(this,r,t),!t)return cp.eachItem(r,(s)=>lp.call(this,s)),this;LH.call(this,t);let n={...t,type:nc.getJSONTypes(t.type),schemaType:nc.getJSONTypes(t.schemaType)};return cp.eachItem(r,n.type.length===0?(s)=>lp.call(this,s,n):(s)=>n.type.forEach((i)=>lp.call(this,s,n,i))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((s)=>s.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,s)=>n+t+s)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let s=n.split("/").slice(1),i=e;for(let o of s)i=i[o];for(let o in r){let a=r[o];if(typeof a!="object")continue;let{$data:l}=a.definition,c=i[o];if(l&&c)i[o]=_E(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:o}=this.opts;if(typeof e=="object")i=e[o];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Wo.normalizeId(i||r);let l=Wo.getSchemaRefs.call(this,e,r);if(a=new Uo.SchemaEnv({schema:e,schemaId:o,meta:t,baseId:r,localRefs:l}),this._cache.set(a.schema,a),s&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Uo.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{Uo.compileSchema.call(this,e)}finally{this.opts=t}}}sc.ValidationError=vH.default;sc.MissingRefError=SE.default;Sn.default=sc;function vE(e,t,r,n="error"){for(let s in e){let i=s;if(i in t)this.logger[n](`${r}: option ${s}. ${e[i]}`)}}function wE(e){return e=Wo.normalizeId(e),this.schemas[e]||this.refs[e]}function AH(){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 OH(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function CH(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function TH(){let e={...this.opts};for(let t of _H)delete e[t];return e}var NH={log(){},warn(){},error(){}};function IH(e){if(e===!1)return NH;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var MH=/^[a-z_$][a-z0-9_$:-]*$/i;function JH(e,t){let{RULES:r}=this;if(cp.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!MH.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function lp(e,t,r){var n;let s=t===null||t===void 0?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=s?i.post:i.rules.find(({type:l})=>l===r);if(!o)o={type:r,rules:[]},i.rules.push(o);if(i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:nc.getJSONTypes(t.type),schemaType:nc.getJSONTypes(t.schemaType)}};if(t.before)DH.call(this,o,a,t.before);else o.rules.push(a);i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((l)=>this.addKeyword(l))}function DH(e,t,r){let n=e.rules.findIndex((s)=>s.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function LH(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=_E(t);e.validateSchema=this.compile(t,!0)}var FH={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function _E(e){return{anyOf:[e,FH]}}});var jE=C(function(PE){Object.defineProperty(PE,"__esModule",{value:!0});var VH={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};PE.default=VH});var ac=C(function(OE){Object.defineProperty(OE,"__esModule",{value:!0});OE.callRef=OE.getValidate=void 0;var WH=Ei(),kE=yr(),Yt=ye(),Pi=gr(),RE=Ho(),ic=Se(),UH={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:s,schemaEnv:i,validateName:o,opts:a,self:l}=n,{root:c}=i;if((r==="#"||r==="#/")&&s===c.baseId)return p();let u=RE.resolveRef.call(l,c,s,r);if(u===void 0)throw new WH.default(n.opts.uriResolver,s,r);if(u instanceof RE.SchemaEnv)return g(u);return m(u);function p(){if(i===c)return oc(e,o,i,i.$async);let b=t.scopeValue("root",{ref:c});return oc(e,Yt._`${b}.validate`,c,c.$async)}function g(b){let h=AE(e,b);oc(e,h,b,b.$async)}function m(b){let h=t.scopeValue("schema",a.code.source===!0?{ref:b,code:Yt.stringify(b)}:{ref:b}),y=t.name("valid"),v=e.subschema({schema:b,dataTypes:[],schemaPath:Yt.nil,topSchemaRef:h,errSchemaPath:r},y);e.mergeEvaluated(v),e.ok(y)}}};function AE(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Yt._`${r.scopeValue("wrapper",{ref:t})}.validate`}OE.getValidate=AE;function oc(e,t,r,n){let{gen:s,it:i}=e,{allErrors:o,schemaEnv:a,opts:l}=i,c=l.passContext?Pi.default.this:Yt.nil;if(n)u();else p();function u(){if(!a.$async)throw Error("async schema referenced by sync schema");let b=s.let("valid");s.try(()=>{if(s.code(Yt._`await ${kE.callValidateCode(e,t,c)}`),m(t),!o)s.assign(b,!0)},(h)=>{if(s.if(Yt._`!(${h} instanceof ${i.ValidationError})`,()=>s.throw(h)),g(h),!o)s.assign(b,!1)}),e.ok(b)}function p(){e.result(kE.callValidateCode(e,t,c),()=>m(t),()=>g(t))}function g(b){let h=Yt._`${b}.errors`;s.assign(Pi.default.vErrors,Yt._`${Pi.default.vErrors} === null ? ${h} : ${Pi.default.vErrors}.concat(${h})`),s.assign(Pi.default.errors,Yt._`${Pi.default.vErrors}.length`)}function m(b){var h;if(!i.opts.unevaluated)return;let y=(h=r===null||r===void 0?void 0:r.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps){if(y.props!==void 0)i.props=ic.mergeEvaluated.props(s,y.props,i.props)}else{let v=s.var("props",Yt._`${b}.evaluated.props`);i.props=ic.mergeEvaluated.props(s,v,i.props,Yt.Name)}if(i.items!==!0)if(y&&!y.dynamicItems){if(y.items!==void 0)i.items=ic.mergeEvaluated.items(s,y.items,i.items)}else{let v=s.var("items",Yt._`${b}.evaluated.items`);i.items=ic.mergeEvaluated.items(s,v,i.items,Yt.Name)}}}OE.callRef=oc;OE.default=UH});var dp=C(function(TE){Object.defineProperty(TE,"__esModule",{value:!0});var KH=jE(),YH=ac(),XH=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",KH.default,YH.default];TE.default=XH});var IE=C(function(NE){Object.defineProperty(NE,"__esModule",{value:!0});var cc=ye(),Yn=cc.operators,lc={maximum:{okStr:"<=",ok:Yn.LTE,fail:Yn.GT},minimum:{okStr:">=",ok:Yn.GTE,fail:Yn.LT},exclusiveMaximum:{okStr:"<",ok:Yn.LT,fail:Yn.GTE},exclusiveMinimum:{okStr:">",ok:Yn.GT,fail:Yn.LTE}},QH={message:({keyword:e,schemaCode:t})=>cc.str`must be ${lc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>cc._`{comparison: ${lc[e].okStr}, limit: ${t}}`},eV={keyword:Object.keys(lc),type:"number",schemaType:"number",$data:!0,error:QH,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(cc._`${r} ${lc[t].fail} ${n} || isNaN(${r})`)}};NE.default=eV});var JE=C(function(ME){Object.defineProperty(ME,"__esModule",{value:!0});var zo=ye(),rV={message:({schemaCode:e})=>zo.str`must be multiple of ${e}`,params:({schemaCode:e})=>zo._`{multipleOf: ${e}}`},nV={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:rV,code(e){let{gen:t,data:r,schemaCode:n,it:s}=e,i=s.opts.multipleOfPrecision,o=t.let("res"),a=i?zo._`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:zo._`${o} !== parseInt(${o})`;e.fail$data(zo._`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};ME.default=nV});var FE=C(function(LE){Object.defineProperty(LE,"__esModule",{value:!0});function DE(e){let t=e.length,r=0,n=0,s;while(n<t)if(r++,s=e.charCodeAt(n++),s>=55296&&s<=56319&&n<t){if(s=e.charCodeAt(n),(s&64512)===56320)n++}return r}LE.default=DE;DE.code='require("ajv/dist/runtime/ucs2length").default'});var HE=C(function(qE){Object.defineProperty(qE,"__esModule",{value:!0});var Cs=ye(),oV=Se(),aV=FE(),lV={message({keyword:e,schemaCode:t}){return Cs.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Cs._`{limit: ${e}}`},cV={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lV,code(e){let{keyword:t,data:r,schemaCode:n,it:s}=e,i=t==="maxLength"?Cs.operators.GT:Cs.operators.LT,o=s.opts.unicode===!1?Cs._`${r}.length`:Cs._`${oV.useFunc(e.gen,aV.default)}(${r})`;e.fail$data(Cs._`${o} ${i} ${n}`)}};qE.default=cV});var BE=C(function(VE){Object.defineProperty(VE,"__esModule",{value:!0});var dV=yr(),fV=Se(),ji=ye(),pV={message:({schemaCode:e})=>ji.str`must match pattern "${e}"`,params:({schemaCode:e})=>ji._`{pattern: ${e}}`},mV={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:pV,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e,a=o.opts.unicodeRegExp?"u":"";if(n){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?ji._`new RegExp`:fV.useFunc(t,l),u=t.let("valid");t.try(()=>t.assign(u,ji._`${c}(${i}, ${a}).test(${r})`),()=>t.assign(u,!1)),e.fail$data(ji._`!${u}`)}else{let l=dV.usePattern(e,s);e.fail$data(ji._`!${l}.test(${r})`)}}};VE.default=mV});var UE=C(function(WE){Object.defineProperty(WE,"__esModule",{value:!0});var Go=ye(),gV={message({keyword:e,schemaCode:t}){return Go.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Go._`{limit: ${e}}`},yV={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:gV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxProperties"?Go.operators.GT:Go.operators.LT;e.fail$data(Go._`Object.keys(${r}).length ${s} ${n}`)}};WE.default=yV});var GE=C(function(zE){Object.defineProperty(zE,"__esModule",{value:!0});var Yo=yr(),Ko=ye(),xV=Se(),$V={message:({params:{missingProperty:e}})=>Ko.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Ko._`{missingProperty: ${e}}`},vV={keyword:"required",type:"object",schemaType:"array",$data:!0,error:$V,code(e){let{gen:t,schema:r,schemaCode:n,data:s,$data:i,it:o}=e,{opts:a}=o;if(!i&&r.length===0)return;let l=r.length>=a.loopRequired;if(o.allErrors)c();else u();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:b}=e.it;for(let h of r)if((m===null||m===void 0?void 0:m[h])===void 0&&!b.has(h)){let y=o.schemaEnv.baseId+o.errSchemaPath,v=`required property "${h}" is not defined at "${y}" (strictRequired)`;xV.checkStrictMode(o,v,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Ko.nil,p);else for(let m of r)Yo.checkReportMissingProp(e,m)}function u(){let m=t.let("missing");if(l||i){let b=t.let("valid",!0);e.block$data(b,()=>g(m,b)),e.ok(b)}else t.if(Yo.checkMissingProp(e,r,m)),Yo.reportMissingProp(e,m),t.else()}function p(){t.forOf("prop",n,(m)=>{e.setParams({missingProperty:m}),t.if(Yo.noPropertyInData(t,s,m,a.ownProperties),()=>e.error())})}function g(m,b){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(b,Yo.propertyInData(t,s,m,a.ownProperties)),t.if(Ko.not(b),()=>{e.error(),t.break()})},Ko.nil)}}};zE.default=vV});var YE=C(function(KE){Object.defineProperty(KE,"__esModule",{value:!0});var Xo=ye(),SV={message({keyword:e,schemaCode:t}){return Xo.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Xo._`{limit: ${e}}`},EV={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:SV,code(e){let{keyword:t,data:r,schemaCode:n}=e,s=t==="maxItems"?Xo.operators.GT:Xo.operators.LT;e.fail$data(Xo._`${r}.length ${s} ${n}`)}};KE.default=EV});var uc=C(function(ZE){Object.defineProperty(ZE,"__esModule",{value:!0});var XE=Hf();XE.code='require("ajv/dist/runtime/equal").default';ZE.default=XE});var e_=C(function(QE){Object.defineProperty(QE,"__esModule",{value:!0});var fp=Mo(),yt=ye(),jV=Se(),kV=uc(),RV={message:({params:{i:e,j:t}})=>yt.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>yt._`{i: ${e}, j: ${t}}`},AV={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:RV,code(e){let{gen:t,data:r,$data:n,schema:s,parentSchema:i,schemaCode:o,it:a}=e;if(!n&&!s)return;let l=t.let("valid"),c=i.items?fp.getSchemaTypes(i.items):[];e.block$data(l,u,yt._`${o} === false`),e.ok(l);function u(){let b=t.let("i",yt._`${r}.length`),h=t.let("j");e.setParams({i:b,j:h}),t.assign(l,!0),t.if(yt._`${b} > 1`,()=>(p()?g:m)(b,h))}function p(){return c.length>0&&!c.some((b)=>b==="object"||b==="array")}function g(b,h){let y=t.name("item"),v=fp.checkDataTypes(c,y,a.opts.strictNumbers,fp.DataType.Wrong),j=t.const("indices",yt._`{}`);t.for(yt._`;${b}--;`,()=>{if(t.let(y,yt._`${r}[${b}]`),t.if(v,yt._`continue`),c.length>1)t.if(yt._`typeof ${y} == "string"`,yt._`${y} += "_"`);t.if(yt._`typeof ${j}[${y}] == "number"`,()=>{t.assign(h,yt._`${j}[${y}]`),e.error(),t.assign(l,!1).break()}).code(yt._`${j}[${y}] = ${b}`)})}function m(b,h){let y=jV.useFunc(t,kV.default),v=t.name("outer");t.label(v).for(yt._`;${b}--;`,()=>t.for(yt._`${h} = ${b}; ${h}--;`,()=>t.if(yt._`${y}(${r}[${b}], ${r}[${h}])`,()=>{e.error(),t.assign(l,!1).break(v)})))}}};QE.default=AV});var r_=C(function(t_){Object.defineProperty(t_,"__esModule",{value:!0});var pp=ye(),CV=Se(),TV=uc(),NV={message:"must be equal to constant",params:({schemaCode:e})=>pp._`{allowedValue: ${e}}`},IV={keyword:"const",$data:!0,error:NV,code(e){let{gen:t,data:r,$data:n,schemaCode:s,schema:i}=e;if(n||i&&typeof i=="object")e.fail$data(pp._`!${CV.useFunc(t,TV.default)}(${r}, ${s})`);else e.fail(pp._`${i} !== ${r}`)}};t_.default=IV});var s_=C(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});var Zo=ye(),JV=Se(),DV=uc(),LV={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Zo._`{allowedValues: ${e}}`},FV={keyword:"enum",schemaType:"array",$data:!0,error:LV,code(e){let{gen:t,data:r,$data:n,schema:s,schemaCode:i,it:o}=e;if(!n&&s.length===0)throw Error("enum must have non-empty array");let a=s.length>=o.opts.loopEnum,l,c=()=>l!==null&&l!==void 0?l:l=JV.useFunc(t,DV.default),u;if(a||n)u=t.let("valid"),e.block$data(u,p);else{if(!Array.isArray(s))throw Error("ajv implementation error");let m=t.const("vSchema",i);u=Zo.or(...s.map((b,h)=>g(m,h)))}e.pass(u);function p(){t.assign(u,!1),t.forOf("v",i,(m)=>t.if(Zo._`${c()}(${r}, ${m})`,()=>t.assign(u,!0).break()))}function g(m,b){let h=s[b];return typeof h==="object"&&h!==null?Zo._`${c()}(${r}, ${m}[${b}])`:Zo._`${r} === ${h}`}}};n_.default=FV});var mp=C(function(i_){Object.defineProperty(i_,"__esModule",{value:!0});var HV=IE(),VV=JE(),BV=HE(),WV=BE(),UV=UE(),zV=GE(),GV=YE(),KV=e_(),YV=r_(),XV=s_(),ZV=[HV.default,VV.default,BV.default,WV.default,UV.default,zV.default,GV.default,KV.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},YV.default,XV.default];i_.default=ZV});var gp=C(function(a_){Object.defineProperty(a_,"__esModule",{value:!0});a_.validateAdditionalItems=void 0;var Ts=ye(),hp=Se(),e4={message:({params:{len:e}})=>Ts.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ts._`{limit: ${e}}`},t4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:e4,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){hp.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}o_(e,n)}};function o_(e,t){let{gen:r,schema:n,data:s,keyword:i,it:o}=e;o.items=!0;let a=r.const("len",Ts._`${s}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(Ts._`${a} <= ${t.length}`);else if(typeof n=="object"&&!hp.alwaysValidSchema(o,n)){let c=r.var("valid",Ts._`${a} <= ${t.length}`);r.if(Ts.not(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,a,(u)=>{if(e.subschema({keyword:i,dataProp:u,dataPropType:hp.Type.Num},c),!o.allErrors)r.if(Ts.not(c),()=>r.break())})}}a_.validateAdditionalItems=o_;a_.default=t4});var yp=C(function(d_){Object.defineProperty(d_,"__esModule",{value:!0});d_.validateTuple=void 0;var c_=ye(),dc=Se(),n4=yr(),s4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return u_(e,"additionalItems",t);if(r.items=!0,dc.alwaysValidSchema(r,t))return;e.ok(n4.validateArray(e))}};function u_(e,t,r=e.schema){let{gen:n,parentSchema:s,data:i,keyword:o,it:a}=e;if(u(s),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=dc.mergeEvaluated.items(n,r.length,a.items);let l=n.name("valid"),c=n.const("len",c_._`${i}.length`);r.forEach((p,g)=>{if(dc.alwaysValidSchema(a,p))return;n.if(c_._`${c} > ${g}`,()=>e.subschema({keyword:o,schemaProp:g,dataProp:g},l)),e.ok(l)});function u(p){let{opts:g,errSchemaPath:m}=a,b=r.length,h=b===p.minItems&&(b===p.maxItems||p[t]===!1);if(g.strictTuples&&!h){let y=`"${o}" is ${b}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;dc.checkStrictMode(a,y,g.strictTuples)}}}d_.validateTuple=u_;d_.default=s4});var m_=C(function(p_){Object.defineProperty(p_,"__esModule",{value:!0});var o4=yp(),a4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>o4.validateTuple(e,"items")};p_.default=a4});var y_=C(function(g_){Object.defineProperty(g_,"__esModule",{value:!0});var h_=ye(),c4=Se(),u4=yr(),d4=gp(),f4={message:({params:{len:e}})=>h_.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>h_._`{limit: ${e}}`},p4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:f4,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:s}=r;if(n.items=!0,c4.alwaysValidSchema(n,t))return;if(s)d4.validateAdditionalItems(e,s);else e.ok(u4.validateArray(e))}};g_.default=p4});var x_=C(function(b_){Object.defineProperty(b_,"__esModule",{value:!0});var br=ye(),fc=Se(),h4={message:({params:{min:e,max:t}})=>t===void 0?br.str`must contain at least ${e} valid item(s)`:br.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?br._`{minContains: ${e}}`:br._`{minContains: ${e}, maxContains: ${t}}`},g4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:h4,code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e,o,a,{minContains:l,maxContains:c}=n;if(i.opts.next)o=l===void 0?1:l,a=c;else o=1;let u=t.const("len",br._`${s}.length`);if(e.setParams({min:o,max:a}),a===void 0&&o===0){fc.checkStrictMode(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){fc.checkStrictMode(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(fc.alwaysValidSchema(i,r)){let h=br._`${u} >= ${o}`;if(a!==void 0)h=br._`${h} && ${u} <= ${a}`;e.pass(h);return}i.items=!0;let p=t.name("valid");if(a===void 0&&o===1)m(p,()=>t.if(p,()=>t.break()));else if(o===0){if(t.let(p,!0),a!==void 0)t.if(br._`${s}.length > 0`,g)}else t.let(p,!1),g();e.result(p,()=>e.reset());function g(){let h=t.name("_valid"),y=t.let("count",0);m(h,()=>t.if(h,()=>b(y)))}function m(h,y){t.forRange("i",0,u,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:fc.Type.Num,compositeRule:!0},h),y()})}function b(h){if(t.code(br._`${h}++`),a===void 0)t.if(br._`${h} >= ${o}`,()=>t.assign(p,!0).break());else if(t.if(br._`${h} > ${a}`,()=>t.assign(p,!1).break()),o===1)t.assign(p,!0);else t.if(br._`${h} >= ${o}`,()=>t.assign(p,!0))}}};b_.default=g4});var pc=C(function(w_){Object.defineProperty(w_,"__esModule",{value:!0});w_.validateSchemaDeps=w_.validatePropertyDeps=w_.error=void 0;var bp=ye(),b4=Se(),Qo=yr();w_.error={message:({params:{property:e,depsCount:t,deps:r}})=>bp.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>bp._`{property: ${e},
567
567
  missingProperty: ${n},
568
568
  depsCount: ${t},
569
- deps: ${r}}`};var o4={keyword:"dependencies",type:"object",schemaType:"object",error:f_.error,code(e){let[t,r]=a4(e);u_(e,t),d_(e,r)}};function a4({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n]}return[t,r]}function u_(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let a=t[o];if(a.length===0)continue;let l=Zo.propertyInData(r,n,o,s.opts.ownProperties);if(e.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),s.allErrors)r.if(l,()=>{for(let c of a)Zo.checkReportMissingProp(e,c)});else r.if(dp._`${l} && (${Zo.checkMissingProp(e,a,i)})`),Zo.reportMissingProp(e,i),r.else()}}f_.validatePropertyDeps=u_;function d_(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(i4.alwaysValidSchema(i,t[a]))continue;r.if(Zo.propertyInData(r,n,a,i.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o)}}f_.validateSchemaDeps=d_;f_.default=o4});var y_=C(function(g_){Object.defineProperty(g_,"__esModule",{value:!0});var h_=ye(),u4=we(),d4={message:"property name must be valid",params:({params:e})=>h_._`{propertyName: ${e.propertyName}}`},f4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:d4,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(u4.alwaysValidSchema(s,r))return;let i=t.name("valid");t.forIn("key",n,(o)=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if(h_.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};g_.default=f4});var fp=C(function(b_){Object.defineProperty(b_,"__esModule",{value:!0});var dc=yr(),Rr=ye(),m4=gr(),fc=we(),h4={message:"must NOT have additional properties",params:({params:e})=>Rr._`{additionalProperty: ${e.additionalProperty}}`},g4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:h4,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&fc.alwaysValidSchema(o,r))return;let c=dc.allSchemaProperties(n.properties),d=dc.allSchemaProperties(n.patternProperties);p(),e.ok(Rr._`${i} === ${m4.default.errors}`);function p(){t.forIn("key",s,(y)=>{if(!c.length&&!d.length)b(y);else t.if(h(y),()=>b(y))})}function h(y){let v;if(c.length>8){let j=fc.schemaRefOrVal(o,n.properties,"properties");v=dc.isOwnProperty(t,j,y)}else if(c.length)v=Rr.or(...c.map((j)=>Rr._`${y} === ${j}`));else v=Rr.nil;if(d.length)v=Rr.or(v,...d.map((j)=>Rr._`${dc.usePattern(e,j)}.test(${y})`));return Rr.not(v)}function m(y){t.code(Rr._`delete ${s}[${y}]`)}function b(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){m(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!fc.alwaysValidSchema(o,r)){let v=t.name("valid");if(l.removeAdditional==="failing")g(y,v,!1),t.if(Rr.not(v),()=>{e.reset(),m(y)});else if(g(y,v),!a)t.if(Rr.not(v),()=>t.break())}}function g(y,v,j){let S={keyword:"additionalProperties",dataProp:y,dataPropType:fc.Type.Str};if(j===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,v)}}};b_.default=g4});var w_=C(function(v_){Object.defineProperty(v_,"__esModule",{value:!0});var b4=wi(),$_=yr(),pp=we(),x_=fp(),x4={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;if(i.opts.removeAdditional==="all"&&n.additionalProperties===void 0)x_.default.code(new b4.KeywordCxt(i,x_.default,"additionalProperties"));let o=$_.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=pp.mergeEvaluated.props(t,pp.toHash(o),i.props);let a=o.filter((p)=>!pp.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))d(p);else{if(t.if($_.propertyInData(t,s,p,i.opts.ownProperties)),d(p),!i.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(l)}function c(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};v_.default=x4});var j_=C(function(P_){Object.defineProperty(P_,"__esModule",{value:!0});var S_=yr(),pc=ye(),E_=we(),__=we(),v4={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=S_.allSchemaProperties(r),l=a.filter((g)=>E_.alwaysValidSchema(i,r[g]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&s.properties,d=t.name("valid");if(i.props!==!0&&!(i.props instanceof pc.Name))i.props=__.evaluatedPropsToName(t,i.props);let{props:p}=i;h();function h(){for(let g of a){if(c)m(g);if(i.allErrors)b(g);else t.var(d,!0),b(g),t.if(d)}}function m(g){for(let y in c)if(new RegExp(g).test(y))E_.checkStrictMode(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function b(g){t.forIn("key",n,(y)=>{t.if(pc._`${S_.usePattern(e,g)}.test(${y})`,()=>{let v=l.includes(g);if(!v)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:__.Type.Str},d);if(i.opts.unevaluated&&p!==!0)t.assign(pc._`${p}[${y}]`,!0);else if(!v&&!i.allErrors)t.if(pc.not(d),()=>t.break())})})}}};P_.default=v4});var R_=C(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});var S4=we(),E4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(S4.alwaysValidSchema(n,r)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};k_.default=E4});var O_=C(function(A_){Object.defineProperty(A_,"__esModule",{value:!0});var P4=yr(),j4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:P4.validateUnion,error:{message:"must match a schema in anyOf"}};A_.default=j4});var N_=C(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});var mc=ye(),R4=we(),A4={message:"must match exactly one schema in oneOf",params:({params:e})=>mc._`{passingSchemas: ${e.passing}}`},O4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:A4,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((d,p)=>{let h;if(R4.alwaysValidSchema(s,d))t.var(l,!0);else h=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if(mc._`${l} && ${o}`).assign(o,!1).assign(a,mc._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),h)e.mergeEvaluated(h,mc.Name)})})}}};C_.default=O4});var I_=C(function(T_){Object.defineProperty(T_,"__esModule",{value:!0});var N4=we(),T4={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((i,o)=>{if(N4.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};T_.default=T4});var L_=C(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var hc=ye(),J_=we(),M4={message:({params:e})=>hc.str`must match "${e.ifClause}" schema`,params:({params:e})=>hc._`{failingKeyword: ${e.ifClause}}`},J4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:M4,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)J_.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=M_(n,"then"),i=M_(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,c("then",d),c("else",d))}else if(s)t.if(a,c("then"));else t.if(hc.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function c(d,p){return()=>{let h=e.subschema({keyword:d},a);if(t.assign(o,a),e.mergeValidEvaluated(h,o),p)t.assign(p,hc._`${d}`);else e.setParams({ifClause:d})}}}};function M_(e,t){let r=e.schema[t];return r!==void 0&&!J_.alwaysValidSchema(e,r)}D_.default=J4});var q_=C(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});var L4=we(),F4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)L4.checkStrictMode(r,`"${e}" without "if" is ignored`)}};F_.default=F4});var mp=C(function(H_){Object.defineProperty(H_,"__esModule",{value:!0});var H4=cp(),V4=s_(),B4=up(),W4=a_(),U4=c_(),z4=uc(),G4=y_(),K4=fp(),Y4=w_(),X4=j_(),Z4=R_(),Q4=O_(),eB=N_(),tB=I_(),rB=L_(),nB=q_();function sB(e=!1){let t=[Z4.default,Q4.default,eB.default,tB.default,rB.default,nB.default,G4.default,K4.default,z4.default,Y4.default,X4.default];if(e)t.push(V4.default,W4.default);else t.push(H4.default,B4.default);return t.push(U4.default),t}H_.default=sB});var gp=C(function(W_){Object.defineProperty(W_,"__esModule",{value:!0});W_.dynamicAnchor=void 0;var hp=ye(),oB=gr(),V_=qo(),aB=sc(),lB={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>B_(e,e.schema)};function B_(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=hp._`${oB.default.dynamicAnchors}${hp.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:cB(e);r.if(hp._`!${s}`,()=>r.assign(s,i))}W_.dynamicAnchor=B_;function cB(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:i,localRefs:o,meta:a}=t.root,{schemaId:l}=n.opts,c=new V_.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return V_.compileSchema.call(n,c),aB.getValidate(e,c)}W_.default=lB});var yp=C(function(Y_){Object.defineProperty(Y_,"__esModule",{value:!0});Y_.dynamicRef=void 0;var G_=ye(),dB=gr(),z_=sc(),fB={keyword:"$dynamicRef",schemaType:"string",code:(e)=>K_(e,e.schema)};function K_(e,t){let{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw Error(`"${n}" only supports hash fragment reference`);let i=t.slice(1);if(s.allErrors)o();else{let l=r.let("valid",!1);o(l),e.ok(l)}function o(l){if(s.schemaEnv.root.dynamicAnchors[i]){let c=r.let("_v",G_._`${dB.default.dynamicAnchors}${G_.getProperty(i)}`);r.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>r.block(()=>{z_.callRef(e,l),r.let(c,!0)}):()=>z_.callRef(e,l)}}Y_.dynamicRef=K_;Y_.default=fB});var Q_=C(function(Z_){Object.defineProperty(Z_,"__esModule",{value:!0});var mB=gp(),hB=we(),gB={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)mB.dynamicAnchor(e,"");else hB.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};Z_.default=gB});var tP=C(function(eP){Object.defineProperty(eP,"__esModule",{value:!0});var bB=yp(),xB={keyword:"$recursiveRef",schemaType:"string",code:(e)=>bB.dynamicRef(e,e.schema)};eP.default=xB});var nP=C(function(rP){Object.defineProperty(rP,"__esModule",{value:!0});var vB=gp(),wB=yp(),SB=Q_(),EB=tP(),_B=[vB.default,wB.default,SB.default,EB.default];rP.default=_B});var oP=C(function(iP){Object.defineProperty(iP,"__esModule",{value:!0});var sP=uc(),jB={keyword:"dependentRequired",type:"object",schemaType:"object",error:sP.error,code:(e)=>sP.validatePropertyDeps(e)};iP.default=jB});var lP=C(function(aP){Object.defineProperty(aP,"__esModule",{value:!0});var RB=uc(),AB={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>RB.validateSchemaDeps(e)};aP.default=AB});var uP=C(function(cP){Object.defineProperty(cP,"__esModule",{value:!0});var CB=we(),NB={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)CB.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};cP.default=NB});var fP=C(function(dP){Object.defineProperty(dP,"__esModule",{value:!0});var IB=oP(),MB=lP(),JB=uP(),DB=[IB.default,MB.default,JB.default];dP.default=DB});var hP=C(function(mP){Object.defineProperty(mP,"__esModule",{value:!0});var Xn=ye(),pP=we(),FB=gr(),qB={message:"must NOT have unevaluated properties",params:({params:e})=>Xn._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},HB={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:qB,code(e){let{gen:t,schema:r,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:o,props:a}=i;if(a instanceof Xn.Name)t.if(Xn._`${a} !== true`,()=>t.forIn("key",n,(p)=>t.if(c(a,p),()=>l(p))));else if(a!==!0)t.forIn("key",n,(p)=>a===void 0?l(p):t.if(d(a,p),()=>l(p)));i.props=!0,e.ok(Xn._`${s} === ${FB.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!pP.alwaysValidSchema(i,r)){let h=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:pP.Type.Str},h),!o)t.if(Xn.not(h),()=>t.break())}}function c(p,h){return Xn._`!${p} || !${p}[${h}]`}function d(p,h){let m=[];for(let b in p)if(p[b]===!0)m.push(Xn._`${h} !== ${b}`);return Xn.and(...m)}}};mP.default=HB});var bP=C(function(yP){Object.defineProperty(yP,"__esModule",{value:!0});var Ns=ye(),gP=we(),BB={message:({params:{len:e}})=>Ns.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ns._`{limit: ${e}}`},WB={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:BB,code(e){let{gen:t,schema:r,data:n,it:s}=e,i=s.items||0;if(i===!0)return;let o=t.const("len",Ns._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(Ns._`${o} > ${i}`);else if(typeof r=="object"&&!gP.alwaysValidSchema(s,r)){let l=t.var("valid",Ns._`${o} <= ${i}`);t.if(Ns.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(d)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:d,dataPropType:gP.Type.Num},l),!s.allErrors)t.if(Ns.not(l),()=>t.break())})}}};yP.default=WB});var $P=C(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});var zB=hP(),GB=bP(),KB=[zB.default,GB.default];xP.default=KB});var wP=C(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});var rt=ye(),XB={message:({schemaCode:e})=>rt.str`must match format "${e}"`,params:({schemaCode:e})=>rt._`{format: ${e}}`},ZB={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:XB,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:d,self:p}=a;if(!l.validateFormats)return;if(s)h();else m();function h(){let b=r.scopeValue("formats",{ref:p.formats,code:l.code.formats}),g=r.const("fDef",rt._`${b}[${o}]`),y=r.let("fType"),v=r.let("format");r.if(rt._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,rt._`${g}.type || "string"`).assign(v,rt._`${g}.validate`),()=>r.assign(y,rt._`"string"`).assign(v,g)),e.fail$data(rt.or(j(),S()));function j(){if(l.strictSchema===!1)return rt.nil;return rt._`${o} && !${v}`}function S(){let P=d.$async?rt._`(${g}.async ? await ${v}(${n}) : ${v}(${n}))`:rt._`${v}(${n})`,E=rt._`(typeof ${v} == "function" ? ${P} : ${v}.test(${n}))`;return rt._`${v} && ${v} !== true && ${y} === ${t} && !${E}`}}function m(){let b=p.formats[i];if(!b){j();return}if(b===!0)return;let[g,y,v]=S(b);if(g===t)e.pass(P());function j(){if(l.strictSchema===!1){p.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(E){let O=E instanceof RegExp?rt.regexpCode(E):l.code.formats?rt._`${l.code.formats}${rt.getProperty(i)}`:void 0,R=r.scopeValue("formats",{key:i,ref:E,code:O});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,rt._`${R}.validate`];return["string",E,R]}function P(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!d.$async)throw Error("async format in sync schema");return rt._`await ${v}(${n})`}return typeof y=="function"?rt._`${v}(${n})`:rt._`${v}.test(${n})`}}}};vP.default=ZB});var bp=C(function(SP){Object.defineProperty(SP,"__esModule",{value:!0});var eW=wP(),tW=[eW.default];SP.default=tW});var xp=C(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});EP.contentVocabulary=EP.metadataVocabulary=void 0;EP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];EP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var kP=C(function(jP){Object.defineProperty(jP,"__esModule",{value:!0});var sW=sp(),iW=ap(),oW=mp(),aW=nP(),lW=fP(),cW=$P(),uW=bp(),PP=xp(),dW=[aW.default,sW.default,iW.default,(0,oW.default)(!0),uW.default,PP.metadataVocabulary,PP.contentVocabulary,lW.default,cW.default];jP.default=dW});var CP=C(function(AP){Object.defineProperty(AP,"__esModule",{value:!0});AP.DiscrError=void 0;var RP;(function(e){e.Tag="tag",e.Mapping="mapping"})(RP||(AP.DiscrError=RP={}))});var vp=C(function(TP){Object.defineProperty(TP,"__esModule",{value:!0});var ji=ye(),$p=CP(),NP=qo(),pW=Si(),mW=we(),hW={message:({params:{discrError:e,tagName:t}})=>e===$p.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>ji._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},gW={keyword:"discriminator",type:"object",schemaType:"object",error:hW,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!o)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",ji._`${r}${ji.getProperty(a)}`);t.if(ji._`typeof ${c} == "string"`,()=>d(),()=>e.error(!1,{discrError:$p.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function d(){let m=h();t.if(!1);for(let b in m)t.elseIf(ji._`${c} === ${b}`),t.assign(l,p(m[b]));t.else(),e.error(!1,{discrError:$p.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(m){let b=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},b);return e.mergeEvaluated(g,ji.Name),b}function h(){var m;let b={},g=v(s),y=!0;for(let P=0;P<o.length;P++){let E=o[P];if((E===null||E===void 0?void 0:E.$ref)&&!mW.schemaHasRulesButRef(E,i.self.RULES)){let R=E.$ref;if(E=NP.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,R),E instanceof NP.SchemaEnv)E=E.schema;if(E===void 0)throw new pW.default(i.opts.uriResolver,i.baseId,R)}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}"`);y=y&&(g||v(E)),j(O,P)}if(!y)throw Error(`discriminator: "${a}" must be required`);return b;function v({required:P}){return Array.isArray(P)&&P.includes(a)}function j(P,E){if(P.const)S(P.const,E);else if(P.enum)for(let O of P.enum)S(O,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(P,E){if(typeof P!="string"||P in b)throw Error(`discriminator: "${a}" values must be unique strings`);b[P]=E}}}};TP.default=gW});var IP=C(function(kQ,bW){bW.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 MP=C(function(RQ,xW){xW.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 JP=C(function(AQ,$W){$W.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 DP=C(function(OQ,vW){vW.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 LP=C(function(CQ,wW){wW.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 FP=C(function(NQ,SW){SW.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 qP=C(function(TQ,EW){EW.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 HP=C(function(IQ,_W){_W.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 BP=C(function(VP){Object.defineProperty(VP,"__esModule",{value:!0});var PW=IP(),jW=MP(),kW=JP(),RW=DP(),AW=LP(),OW=FP(),CW=qP(),NW=HP(),TW=["/properties"];function IW(e){return[PW,jW,kW,RW,AW,t(this,OW),CW,t(this,NW)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,TW):n}}VP.default=IW});var Ep=C(function(Yt,Sp){Object.defineProperty(Yt,"__esModule",{value:!0});Yt.MissingRefError=Yt.ValidationError=Yt.CodeGen=Yt.Name=Yt.nil=Yt.stringify=Yt.str=Yt._=Yt.KeywordCxt=Yt.Ajv2020=void 0;var JW=np(),DW=kP(),LW=vp(),FW=BP(),wp="https://json-schema.org/draft/2020-12/schema";class Qo extends JW.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),DW.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(LW.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;FW.default.call(this,e),this.refs["http://json-schema.org/schema"]=wp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wp)?wp:void 0)}}Yt.Ajv2020=Qo;Sp.exports=Yt=Qo;Sp.exports.Ajv2020=Qo;Object.defineProperty(Yt,"__esModule",{value:!0});Yt.default=Qo;var qW=wi();Object.defineProperty(Yt,"KeywordCxt",{enumerable:!0,get:function(){return qW.KeywordCxt}});var ki=ye();Object.defineProperty(Yt,"_",{enumerable:!0,get:function(){return ki._}});Object.defineProperty(Yt,"str",{enumerable:!0,get:function(){return ki.str}});Object.defineProperty(Yt,"stringify",{enumerable:!0,get:function(){return ki.stringify}});Object.defineProperty(Yt,"nil",{enumerable:!0,get:function(){return ki.nil}});Object.defineProperty(Yt,"Name",{enumerable:!0,get:function(){return ki.Name}});Object.defineProperty(Yt,"CodeGen",{enumerable:!0,get:function(){return ki.CodeGen}});var HW=Lo();Object.defineProperty(Yt,"ValidationError",{enumerable:!0,get:function(){return HW.default}});var VW=Si();Object.defineProperty(Yt,"MissingRefError",{enumerable:!0,get:function(){return VW.default}})});import{existsSync as yc,readFileSync as UW}from"node:fs";import{createRequire as WP}from"node:module";import{isAbsolute as zW,relative as GW,resolve as gc}from"node:path";import{fileURLToPath as UP,pathToFileURL as KW}from"node:url";function ea(e){return JSON.parse(UW(e,"utf8"))}async function zP(e){let t=gc(e),r=gc(t,"project.json"),n=gc(t,"project.schema.json");if(!yc(r))throw Error(`project.json not found in ${t}`);if(!yc(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"project.json#/extensions");let s=ea(r),i=ea(n);i.$id=KW(n).href;let o;try{({default:o}=await Promise.resolve().then(() => Lt(Ep(),1)))}catch(d){throw Error("Project validation requires ajv: bun add ajv",{cause:d})}let l=await new o({allErrors:!0,loadSchema:(d)=>YW(d,t),strict:!1}).compileAsync(i),c=l(s);return{errors:l.errors??null,valid:c}}async function YW(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let r=UP(e),n=GW(t,r);if(n.startsWith("..")||zW(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if(yc(r))return ea(r);let s=n.split("\\").join("/"),i="node_modules/",o=s.lastIndexOf(i);if(o===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(o+i.length),l="@jxsuite/schema/",c;try{c=WP(gc(t,"package.json")).resolve(a)}catch(d){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:d});try{c=WP(import.meta.url).resolve(a)}catch(p){let h=UP(new URL(`../${a.slice(l.length)}`,import.meta.url));if(yc(h))return ea(h);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:p})}}return ea(c)}var GP=()=>{};function Gr(e){return ee(e.attributes)?e.attributes:{}}function _t(e,t){let r=Gr(e)[t];return T(r)?r:null}function nt(e){return T(e.tagName)?e.tagName.toLowerCase():""}function It(e,t="the popover"){let r=T(e.id)?e.id:_t(e,"id");if(r)return`#${r}`;let n=nt(e);return n===""?t:`the <${n}>`}function QW(e){let t=Gr(e).popover;return T(t)?t:null}function YP(e){let t=new Set,r=new Set;for(let n of e){let s=n!==null&&T(n.tagName)?n.tagName:"";if(n===null||!s.includes("-"))continue;if(_p(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&eU.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function _p(e){return"popover"in Gr(e)||"popover"in e}function ta(e,t){return _p(e)||(t?.popoverTags?.has(nt(e))??!1)}function Zn(e){if(T(e.id)&&e.id!=="")return e.id;let t=_t(e,"id");return t===""?null:t}function*zr(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=ta(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(F(c))yield*zr(c,[...t,"children",l],s,n)}else if(ee(i)&&Ft(i.map))yield*zr(i.map,[...t,"children","map"],s,n);let o=Ft(e.map)?e.map:null;if(o)yield*zr(o,[...t,"map"],s,n);let a=ee(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(F(c))yield*zr(c,[...t,"cases",l],s,n)}function Pp(e,t){let r=[];for(let{node:n}of zr(e,[],null,t)){if(!ta(n,t))continue;let s=Zn(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function bc(e){return e.startsWith("@")}function XP(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function Tt(e,t){let r=e?.[t];if(r===void 0||is(r)||Array.isArray(r))return null;return String(r)}function ZP(e){for(let[t,r]of Object.entries(e??{})){if(!is(r))continue;if(XP(t)&&t.includes(":popover-open")&&Tt(r,"display")!==null)return!0;if(bc(t)&&ZP(r))return!0}return!1}function QP(e){for(let[t,r]of Object.entries(e??{})){if(!is(r))continue;if(XP(t)&&t.includes(":popover-open"))return!0;if(bc(t)&&QP(r))return!0}return!1}function rU(e){return tU.some((t)=>Tt(e,t)!==null)}function nU(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if(bc(r)&&is(n)&&Tt(n,"display")!==null)t.push(r);return t}function ej(e){if(!e)return[];let t=[],r=Tt(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if(bc(n)&&is(s))t.push(...ej(s));return t}function sU(e){if(!e)return!1;if(Tt(e,"positionAnchor")!==null||Tt(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(Tt(e,t)??"").includes("anchor("))}function iU(e){if(!e)return!1;if(Tt(e,"positionArea")!==null||Tt(e,"position-area")!==null||Tt(e,"positionTryFallbacks")!==null||Tt(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function tj(e,t){let r=[...zr(e,[],null,t)],n=Pp(e,t),s=r.some(({node:a})=>ta(a,t)),i=new Set;for(let{node:a}of r)if(KP.has(nt(a))){let l=_t(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(...oU(l,c,a,n,s,t)),_p(l))o.push(...aU(l,c,i));return o}function oU(e,t,r,n,s,i){let o=[],a=nt(e),l=_t(e,"popovertarget"),c=KP.has(a)||(i?.invokerTags?.has(a)??!1);if(l!==null&&!c)return o.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${Ve}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),o;if(l!==null){if(s&&!n.includes(l)){let d=n.length>0?`The popovers here are: ${n.map((p)=>`"${p}"`).join(", ")}. `:"";o.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${d}A target that names nothing does nothing, silently. ${Ve}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&Zn(r)!==null&&Zn(r)!==l)o.push({detail:`This control is inside ${It(r)} but targets "${l}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${Ve}`,message:`A control inside ${It(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let d=_t(e,"href")??(T(e.href)?e.href:null),p=_t(e,"target")==="_blank",h=d!==null&&d.includes("#");if(p||h){let m=p?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";o.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${Ve}`,message:`A link inside ${It(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function aU(e,t,r){let n=[],{style:s}=e,i=It(e),o=QW(e);if(o!==null&&o!==""&&!ZW.some((c)=>c===o))n.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${Ve}`,fix:"mode",message:`${i} declares popover="${o}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if($t(Gr(e).popover))n.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${Ve}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=Tt(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")n.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${Ve}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of nU(s))n.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${Ve}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(Tt(s,"visibility")!==null)n.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${Ve}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!QP(s))n.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${Ve}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!ZP(s)&&a===null&&rU(s))n.push({detail:`${i} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${Ve}`,fix:"open-display",message:`${i} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of ej(s))if(c.includes("display")&&!c.includes("overlay")){n.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${Ve}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(sU(s)&&!iU(s))n.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${Ve}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=Zn(e);if(l!==null&&!r.has(l))n.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var ZW,KP,eU,tU,Ve="See docs/framework/concepts/overlays.";var xc=q(()=>{ve();ZW=["auto","manual","hint"],KP=new Set(["button","input"]);eU=["popovertarget","popovertargetaction","command","commandfor"];tU=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function Ci(e,t){let r=Gr(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(Ce(n)||ee(n))return{kind:"bound"};if(T(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function Ai(e,t){let r=Ci(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Pt(e,t){return Ci(e,t).kind!=="absent"}function Qn(e){let t=Ci(e,"role");if(t.kind==="bound")return Oi;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function $c(e){let t=Ci(e,"id");if(t.kind==="bound")return Oi;return t.kind==="text"&&t.text!==""?t.text:null}function xr(e,t){let r=Ci(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function vc(e){let t=e.textContent;if(T(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(xr(e,"aria-label")||Pt(e,"aria-labelledby"))return!0;if(nt(e)==="img"&&(xr(e,"alt")||xr(e,"title")))return!0;if(nt(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let s of r)if(T(s)){if(s.trim()!=="")return!0}else if(F(s)&&vc(s))return!0}else if(r!=null)return!0;if(ee(e.map))return!0;return(ee(e.cases)?Object.values(e.cases):[]).some((s)=>Ft(s)&&vc(s))}function*Ri(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,Qn(e)],i=[...n,nt(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(F(l))yield*Ri(l,[...t,"children",a],s,i)}else if(ee(o)&&Ft(o.map))yield*Ri(o.map,[...t,"children","map"],s,i);if(Ft(e.map))yield*Ri(e.map,[...t,"map"],s,i);if(ee(e.cases)){for(let[a,l]of Object.entries(e.cases))if(F(l))yield*Ri(l,[...t,"cases",a],s,i)}}function pU(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${lU}`,message:r,path:t,rule:e,severity:i}}function rj(e,t,r){if(r.includes("label"))return!0;if(e===Oi||t.bound)return!0;return e!==null&&t.ids.has(e)}function mU(e,t){let{node:r,path:n,tags:s}=e,i=nt(r),o=Qn(r);if(o==="bound")return null;if(xr(r,"aria-label")||Pt(r,"aria-labelledby")||xr(r,"title"))return null;let l=It(r,"the control"),c=(p)=>Kr("interactive-unnamed",n,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${p}`,"4.1.2"),d=hU(r,i,t,s);if(d==="named"||d==="exempt")return null;if(o!==null&&cU.has(o))return vc(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&uU.has(o))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(o!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Pt(r,"href"))return vc(r)?null:c("Give it text content, or an aria-label.");if(d==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(d==="unnamed-value")return c("Give it a value, or an aria-label.");if(d==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function hU(e,t,r,n){if(t==="area"){if(!Pt(e,"href"))return"none";return xr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return rj($c(e),r,n)||xr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Ai(e,"type")??"text").toLowerCase();if(s==="hidden"||Pt(e,"type")&&Ai(e,"type")===null)return"exempt";if(dU.has(s))return xr(e,"value")?"named":"unnamed-value";if(s==="image")return xr(e,"alt")?"named":"unnamed-alt";return rj($c(e),r,n)||xr(e,"placeholder")?"named":"unnamed"}function yU(e){let{node:t,path:r,tags:n}=e,s=nt(t);if(!s.includes("-")||!n.some((i)=>gU.has(i)))return null;return Kr("custom-element-in-select",r,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function bU(e){let{node:t,path:r}=e;if(nt(t)!=="img")return null;let n=Qn(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(Pt(t,"alt")||xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Kr("img-alt-missing",r,`${It(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 $U(e,t){let{node:r,path:n}=e,s=[];for(let i of xU){let o=Ai(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",n,`${It(r,"the element")} points ${i} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function vU(e,t,r){for(let n of nj.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===Oi&&s.ids.size>0)return!0;if(e!==null&&e!==Oi&&s.ids.has(e))return!0}return!1}function wU(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=Qn(r);if(o===null||o==="bound"||n.length===0||pU(i))return null;if(s.includes("bound")||vU($c(r),o,t))return null;let a=It(r,"the element");if(o==="tab"&&!s.includes("tablist"))return Kr("tab-outside-tablist",n,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((o==="menuitem"||o==="menuitemcheckbox"||o==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Kr("menuitem-outside-menu",n,`${a} is a ${o} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(o==="option"&&!s.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return Kr("option-outside-listbox",n,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function SU(e){let t=[];for(let{node:r}of Ri(e)){if(Qn(r)!=="tab")continue;let n=Ci(r,"aria-selected");if(n.kind==="bound")return null;t.push(n.kind==="other"&&n.isTrue||n.kind==="text"&&n.text==="true")}return t}function EU(e){let{node:t,path:r}=e;if(Qn(t)!=="tablist")return null;let n=SU(t);if(n===null||n.length===0||n.includes(!0))return null;return Kr("tablist-none-selected",r,`${It(t,"the tablist")} has ${n.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function _U(e){let{node:t,path:r}=e,n=Qn(t);if(!(nt(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",r,`${It(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 jU(e){let{node:t,path:r}=e;if(!Pt(t,"aria-activedescendant"))return null;let n=nt(t);if(PU.has(n)||n==="a"&&Pt(t,"href")||Pt(t,"tabIndex")||Pt(t,"tabindex")||Pt(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",r,`${It(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 sj(e){let t=[...Ri(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=Qn(a);if(l!==null&&fU.has(l)){let d=s.get(l)??{bound:!1,ids:new Set},p=Ai(a,"aria-owns");if(p===null)d.bound||=Pt(a,"aria-owns");else for(let h of p.split(/\s+/))if(h!=="")d.ids.add(h);s.set(l,d)}let c=$c(a);if(c===Oi)i=!0;else if(c!==null)r.add(c);if(nt(a)==="label"){let d=Ai(a,"for")??Ai(a,"htmlFor");if(d===null)n.bound||=Pt(a,"for")||Pt(a,"htmlFor");else n.ids.add(d)}}let o=[];for(let a of t){let l=[mU(a,n),bU(a),wU(a,s),yU(a),EU(a),_U(a),jU(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...$U(a,r))}return o}var lU="See docs/framework/concepts/accessibility.",Oi="bound",cU,uU,dU,nj,fU,gU,xU,PU;var ij=q(()=>{ve();xc();cU=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),uU=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),dU=new Set(["button","reset","submit"]),nj=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),fU=new Set([...nj.values()].flat());gU=new Set(["select","jx-select"]);xU=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];PU=new Set(["button","input","select","textarea"])});function jp(e){return nt(e)==="dialog"}function oj(e){return e.startsWith("--")}function TU(e){let t=[];for(let{node:r}of zr(e)){let n=Zn(r);if(jp(r)&&n!==null&&!t.includes(n))t.push(n)}return t}function IU(e){let t=e.oncommand;return t!==void 0&&t!==null}function MU(e,t){for(let{node:r}of zr(e)){if(r===e)continue;let n=nt(r);if(n==="button"){let s=_t(r,"command"),i=_t(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&_t(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function lj(e,t){let r=[...zr(e,[],null,t)],n=TU(e),s=Pp(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let d=Zn(c);if(d!==null&&!o.has(d))o.set(d,c);if(nt(c)==="button"){let p=_t(c,"commandfor"),h=_t(c,"command");if(p!==null){let m=a.get(p)??new Set;m.add(h??""),a.set(p,m)}}}let l=[];for(let{node:c,path:d}of r)if(l.push(...JU(c,d,o,n,s,i,t)),jp(c))l.push(...DU(c,d,a));return l}function JU(e,t,r,n,s,i,o){let a=[],l=nt(e),c=o?.invokerTags?.has(l)??!1,d=_t(e,"command"),p=_t(e,"commandfor");if(!(d!==null||p!==null||("command"in Gr(e))||("commandfor"in Gr(e))))return a;let m=It(e,"the element");if(!NU.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. ${Ve}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(d!==null&&!OU.has(d)&&!oj(d))return a.push({detail:`\`command\` is an enumerated attribute taking ${aj.map((b)=>`\`${b}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ve}`,message:`${m} declares command="${d}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(p!==null){let b=r.get(p),g=n.includes(p),y=s.includes(p);if(!b&&i){let v=[...n,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${v}. A commandfor that names nothing does nothing, silently. ${Ve}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(d!==null&&b){if(kU.has(d)&&!jp(b))a.push({detail:`\`${d}\` acts on a <dialog>, and "${p}" is ${y?"a popover":`a <${nt(b)||"element"}>`}. The click is ignored. ${y?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${Ve}`,message:`${m} sends ${d} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(RU.has(d)&&!ta(b,o))a.push({detail:`\`${d}\` acts on a popover, and "${p}" is ${g?"a dialog":`a <${nt(b)||"element"}>`} that declares no \`popover\`. The click is ignored. ${g?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ve}`,message:`${m} sends ${d} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(oj(d)&&!IU(b))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${p}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${Ve}`,message:`${m} sends ${d} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function DU(e,t,r){let n=[],s=It(e,"the dialog"),i=Zn(e),{style:o}=e,a=_t(e,"closedby");if(a!==null&&!CU.has(a))n.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${Ve}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Tt(o,"display")!==null)n.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${Ve}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=i===null?void 0:r.get(i),c=_t(e,"open")!==null||Gr(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)n.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!MU(e,i))n.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${Ve}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var aj,kU,RU,AU,OU,CU,NU;var cj=q(()=>{ve();xc();aj=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],kU=new Set(["show-modal","close","request-close"]),RU=new Set(["toggle-popover","show-popover","hide-popover"]),AU=["any","closerequest","none"],OU=new Set(aj),CU=new Set(AU),NU=new Set(["button"])});var xj=C(function(yj){Object.defineProperty(yj,"__esModule",{value:!0});yj.formatNames=yj.fastFormats=yj.fullFormats=void 0;function Yr(e,t){return{validate:e,compare:t}}yj.fullFormats={date:Yr(pj,Op),time:Yr(Rp(!0),Cp),"date-time":Yr(uj(!0),hj),"iso-time":Yr(Rp(),mj),"iso-date-time":Yr(uj(),gj),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:BU,"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:XU,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:WU,int32:{type:"number",validate:GU},int64:{type:"number",validate:KU},float:{type:"number",validate:fj},double:{type:"number",validate:fj},password:!0,binary:!0};yj.fastFormats={...yj.fullFormats,date:Yr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Op),time:Yr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Cp),"date-time":Yr(/^\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,hj),"iso-time":Yr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,mj),"iso-date-time":Yr(/^\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,gj),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};yj.formatNames=Object.keys(yj.fullFormats);function LU(e){return e%4===0&&(e%100!==0||e%400===0)}var FU=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,qU=[0,31,28,31,30,31,30,31,31,30,31,30,31];function pj(e){let t=FU.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],s=+t[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&LU(r)?29:qU[n])}function Op(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var kp=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Rp(e){return function(r){let n=kp.exec(r);if(!n)return!1;let s=+n[1],i=+n[2],o=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),d=+(n[7]||0);if(c>23||d>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-d*l,h=s-c*l-(p<0?1:0);return(h===23||h===-1)&&(p===59||p===-1)&&o<61}}function Cp(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function mj(e,t){if(!(e&&t))return;let r=kp.exec(e),n=kp.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Ap=/t|\s/i;function uj(e){let t=Rp(e);return function(n){let s=n.split(Ap);return s.length===2&&pj(s[0])&&t(s[1])}}function hj(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function gj(e,t){if(!(e&&t))return;let[r,n]=e.split(Ap),[s,i]=t.split(Ap),o=Op(r,s);if(o===void 0)return;return o||Cp(n,i)}var HU=/\/|:/,VU=/^(?:[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 BU(e){return HU.test(e)&&VU.test(e)}var dj=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function WU(e){return dj.lastIndex=0,dj.test(e)}var UU=-2147483648,zU=2147483647;function GU(e){return Number.isInteger(e)&&e<=zU&&e>=UU}function KU(e){return Number.isInteger(e)}function fj(){return!0}var YU=/[^\\]\\Z/;function XU(e){if(YU.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var wj=C(function(vj){Object.defineProperty(vj,"__esModule",{value:!0});var QU=sp(),e6=ap(),t6=mp(),r6=bp(),$j=xp(),n6=[QU.default,e6.default,(0,t6.default)(),r6.default,$j.metadataVocabulary,$j.contentVocabulary];vj.default=n6});var Sj=C(function(oee,i6){i6.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 _j=C(function(Xt,Tp){Object.defineProperty(Xt,"__esModule",{value:!0});Xt.MissingRefError=Xt.ValidationError=Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=Xt.Ajv=void 0;var o6=np(),a6=wj(),l6=vp(),Ej=Sj(),c6=["/properties"],wc="http://json-schema.org/draft-07/schema";class ra extends o6.default{_addVocabularies(){if(super._addVocabularies(),a6.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(l6.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Ej,c6):Ej;this.addMetaSchema(e,wc,!1),this.refs["http://json-schema.org/schema"]=wc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(wc)?wc:void 0)}}Xt.Ajv=ra;Tp.exports=Xt=ra;Tp.exports.Ajv=ra;Object.defineProperty(Xt,"__esModule",{value:!0});Xt.default=ra;var u6=wi();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return u6.KeywordCxt}});var Ni=ye();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Ni._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Ni.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Ni.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Ni.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Ni.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Ni.CodeGen}});var d6=Lo();Object.defineProperty(Xt,"ValidationError",{enumerable:!0,get:function(){return d6.default}});var f6=Si();Object.defineProperty(Xt,"MissingRefError",{enumerable:!0,get:function(){return f6.default}})});var jj=C(function(Pj){Object.defineProperty(Pj,"__esModule",{value:!0});Pj.formatLimitDefinition=void 0;var h6=_j(),Ar=ye(),es=Ar.operators,Sc={formatMaximum:{okStr:"<=",ok:es.LTE,fail:es.GT},formatMinimum:{okStr:">=",ok:es.GTE,fail:es.LT},formatExclusiveMaximum:{okStr:"<",ok:es.LT,fail:es.GTE},formatExclusiveMinimum:{okStr:">",ok:es.GT,fail:es.LTE}},g6={message:({keyword:e,schemaCode:t})=>Ar.str`should be ${Sc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ar._`{comparison: ${Sc[e].okStr}, limit: ${t}}`};Pj.formatLimitDefinition={keyword:Object.keys(Sc),type:"string",schemaType:"string",$data:!0,error:g6,code(e){let{gen:t,data:r,schemaCode:n,keyword:s,it:i}=e,{opts:o,self:a}=i;if(!o.validateFormats)return;let l=new h6.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else d();function c(){let h=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",Ar._`${h}[${l.schemaCode}]`);e.fail$data(Ar.or(Ar._`typeof ${m} != "object"`,Ar._`${m} instanceof RegExp`,Ar._`typeof ${m}.compare != "function"`,p(m)))}function d(){let h=l.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${h}" does not define "compare" function`);let b=t.scopeValue("formats",{key:h,ref:m,code:o.code.formats?Ar._`${o.code.formats}${Ar.getProperty(h)}`:void 0});e.fail$data(p(b))}function p(h){return Ar._`${h}.compare(${r}, ${n}) ${Sc[s].fail} 0`}},dependencies:["format"]};var y6=(e)=>(e.addKeyword(Pj.formatLimitDefinition),e);Pj.default=y6});var Oj=C(function(na,Aj){Object.defineProperty(na,"__esModule",{value:!0});var Ti=xj(),x6=jj(),Mp=ye(),kj=new Mp.Name("fullFormats"),$6=new Mp.Name("fastFormats"),Jp=(e,t={keywords:!0})=>{if(Array.isArray(t))return Rj(e,t,Ti.fullFormats,kj),e;let[r,n]=t.mode==="fast"?[Ti.fastFormats,$6]:[Ti.fullFormats,kj],s=t.formats||Ti.formatNames;if(Rj(e,s,r,n),t.keywords)(0,x6.default)(e);return e};Jp.get=(e,t="full")=>{let n=(t==="fast"?Ti.fastFormats:Ti.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Rj(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=Mp._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}Aj.exports=na=Jp;Object.defineProperty(na,"__esModule",{value:!0});na.default=Jp});import{existsSync as Nj,readFileSync as Tj,readdirSync as Ij,statSync as Mj}from"node:fs";import{createRequire as v6}from"node:module";import{join as Jj,relative as Dp,resolve as Lp}from"node:path";async function _6(){try{let{default:e}=await Promise.resolve().then(() => Lt(Ep(),1)),{default:t}=await Promise.resolve().then(() => Lt(Oj(),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 Dj(e,t={}){let r=Lp(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let P=Lp(r,S);if(!Nj(P))continue;i+=1;let E=sa(P),O=j6(E);if(O.length>0)n.push({errors:O.map(({reason:R,ref:k})=>({message:`$ref "${k}" ${R} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:S})}if(n.length>0)return{checked:i,issues:n,lint:s,valid:!1};let o=await zP(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:"project.json"});let{addFormats:a,Ajv:l}=await _6(),{document:c}=await zv(r,{write:!1}),d=new l({allErrors:!0,ownProperties:!0,strict:!1});a(d);let p=d.compile(c),h=YP(Cj(r).flatMap((S)=>{try{return[JSON.parse(Tj(S,"utf8"))]}catch{return[]}}));for(let S of w6)for(let P of qj(Lp(r,S))){if(P.endsWith(".class.json"))continue;i+=1;let E=sa(P);if(p(E))s.push(...P6(E,Dp(r,P),h));else n.push({errors:p.errors??[],file:Dp(r,P)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let b=m.compile(pf());for(let S of Cj(r)){i+=1;let P=sa(S);if(!b(P))n.push({errors:b.errors??[],file:Dp(r,S)})}let{config:g}=Rn(r),y=await kn(r,g),v=v6(import.meta.url);for(let S of y.extensions)for(let P of["project","document","fields"]){let E=S.schemas[P];if(!E)continue;i+=1;let O=new l({allErrors:!0,ownProperties:!0,strict:!1});a(O);for(let R of E6){let k=v.resolve(R);O.addSchema(sa(k))}try{O.compile(sa(E))}catch(R){n.push({errors:[{message:R instanceof Error?R.message:String(R)}],file:`${S.specifier} (${P} fragment)`})}}let j=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!j}}function sa(e){return JSON.parse(Tj(e,"utf8"))}function P6(e,t,r){let n=[];for(let s of tj(e,r))n.push({...Fp(s),file:t,source:"popover"});for(let s of lj(e,r))n.push({...Fp(s),file:t,source:"dialog"});for(let s of sj(e))n.push({...Fp(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function Fp(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function Lj(e){return e.lint.map((t)=>{let r=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${r}]`})}function j6(e){let t=[],r=new Set,n=(i)=>{let o=e;for(let a of i.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!F(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!ee(i)||r.has(i))return;r.add(i);let o=i.$ref;if(T(o)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(o))t.push({reason:"is an absolute URI editors resolve over the network",ref:o});else if(!o.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:o});else if(o.length>1&&!o.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:o});else if(o.length>1&&!n(o.slice(1)))t.push({reason:"points at no node in this document",ref:o})}for(let[a,l]of Object.entries(i)){if(!k6.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(ee(l)){if(s(l),Fj.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function qj(e){if(!Nj(e))return[];let t=[];for(let r of Ij(e)){let n=Jj(e,r);if(Mj(n).isDirectory())t.push(...qj(n));else if(r.endsWith(".json"))t.push(n)}return t.toSorted()}function Cj(e){let t=[],r=(n)=>{for(let s of Ij(n)){if(S6.has(s))continue;let i=Jj(n,s);if(Mj(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function Hj(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=ee(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var w6,S6,E6,Fj,k6;var Vj=q(()=>{D0();GP();ij();cj();xc();ve();nn();Hi();Qd();w6=["components","pages","layouts"],S6=new Set(["node_modules","dist",".git"]),E6=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];Fj=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),k6=new Set([...Fj,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});rr();import{relative as qp,resolve as Bj}from"node:path";async function R6(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
569
+ deps: ${r}}`};var x4={keyword:"dependencies",type:"object",schemaType:"object",error:w_.error,code(e){let[t,r]=$4(e);$_(e,t),v_(e,r)}};function $4({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n]}return[t,r]}function $_(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let a=t[o];if(a.length===0)continue;let l=Qo.propertyInData(r,n,o,s.opts.ownProperties);if(e.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),s.allErrors)r.if(l,()=>{for(let c of a)Qo.checkReportMissingProp(e,c)});else r.if(bp._`${l} && (${Qo.checkMissingProp(e,a,i)})`),Qo.reportMissingProp(e,i),r.else()}}w_.validatePropertyDeps=$_;function v_(e,t=e.schema){let{gen:r,data:n,keyword:s,it:i}=e,o=r.name("valid");for(let a in t){if(b4.alwaysValidSchema(i,t[a]))continue;r.if(Qo.propertyInData(r,n,a,i.opts.ownProperties),()=>{let l=e.subschema({keyword:s,schemaProp:a},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o)}}w_.validateSchemaDeps=v_;w_.default=x4});var j_=C(function(P_){Object.defineProperty(P_,"__esModule",{value:!0});var __=ye(),S4=Se(),E4={message:"property name must be valid",params:({params:e})=>__._`{propertyName: ${e.propertyName}}`},_4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:E4,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(S4.alwaysValidSchema(s,r))return;let i=t.name("valid");t.forIn("key",n,(o)=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if(__.not(i),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(i)}};P_.default=_4});var xp=C(function(k_){Object.defineProperty(k_,"__esModule",{value:!0});var mc=yr(),Ar=ye(),j4=gr(),hc=Se(),k4={message:"must NOT have additional properties",params:({params:e})=>Ar._`{additionalProperty: ${e.additionalProperty}}`},R4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:k4,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:i,it:o}=e;if(!i)throw Error("ajv implementation error");let{allErrors:a,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&hc.alwaysValidSchema(o,r))return;let c=mc.allSchemaProperties(n.properties),u=mc.allSchemaProperties(n.patternProperties);p(),e.ok(Ar._`${i} === ${j4.default.errors}`);function p(){t.forIn("key",s,(y)=>{if(!c.length&&!u.length)b(y);else t.if(g(y),()=>b(y))})}function g(y){let v;if(c.length>8){let j=hc.schemaRefOrVal(o,n.properties,"properties");v=mc.isOwnProperty(t,j,y)}else if(c.length)v=Ar.or(...c.map((j)=>Ar._`${y} === ${j}`));else v=Ar.nil;if(u.length)v=Ar.or(v,...u.map((j)=>Ar._`${mc.usePattern(e,j)}.test(${y})`));return Ar.not(v)}function m(y){t.code(Ar._`delete ${s}[${y}]`)}function b(y){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){m(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!hc.alwaysValidSchema(o,r)){let v=t.name("valid");if(l.removeAdditional==="failing")h(y,v,!1),t.if(Ar.not(v),()=>{e.reset(),m(y)});else if(h(y,v),!a)t.if(Ar.not(v),()=>t.break())}}function h(y,v,j){let S={keyword:"additionalProperties",dataProp:y,dataPropType:hc.Type.Str};if(j===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,v)}}};k_.default=R4});var C_=C(function(O_){Object.defineProperty(O_,"__esModule",{value:!0});var O4=Si(),A_=yr(),$p=Se(),R_=xp(),C4={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:i}=e;if(i.opts.removeAdditional==="all"&&n.additionalProperties===void 0)R_.default.code(new O4.KeywordCxt(i,R_.default,"additionalProperties"));let o=A_.allSchemaProperties(r);for(let p of o)i.definedProperties.add(p);if(i.opts.unevaluated&&o.length&&i.props!==!0)i.props=$p.mergeEvaluated.props(t,$p.toHash(o),i.props);let a=o.filter((p)=>!$p.alwaysValidSchema(i,r[p]));if(a.length===0)return;let l=t.name("valid");for(let p of a){if(c(p))u(p);else{if(t.if(A_.propertyInData(t,s,p,i.opts.ownProperties)),u(p),!i.allErrors)t.else().var(l,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(l)}function c(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function u(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},l)}}};O_.default=C4});var J_=C(function(M_){Object.defineProperty(M_,"__esModule",{value:!0});var T_=yr(),gc=ye(),N_=Se(),I_=Se(),N4={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:i}=e,{opts:o}=i,a=T_.allSchemaProperties(r),l=a.filter((h)=>N_.alwaysValidSchema(i,r[h]));if(a.length===0||l.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&s.properties,u=t.name("valid");if(i.props!==!0&&!(i.props instanceof gc.Name))i.props=I_.evaluatedPropsToName(t,i.props);let{props:p}=i;g();function g(){for(let h of a){if(c)m(h);if(i.allErrors)b(h);else t.var(u,!0),b(h),t.if(u)}}function m(h){for(let y in c)if(new RegExp(h).test(y))N_.checkStrictMode(i,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function b(h){t.forIn("key",n,(y)=>{t.if(gc._`${T_.usePattern(e,h)}.test(${y})`,()=>{let v=l.includes(h);if(!v)e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:I_.Type.Str},u);if(i.opts.unevaluated&&p!==!0)t.assign(gc._`${p}[${y}]`,!0);else if(!v&&!i.allErrors)t.if(gc.not(u),()=>t.break())})})}}};M_.default=N4});var L_=C(function(D_){Object.defineProperty(D_,"__esModule",{value:!0});var M4=Se(),J4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(M4.alwaysValidSchema(n,r)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};D_.default=J4});var q_=C(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});var L4=yr(),F4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:L4.validateUnion,error:{message:"must match a schema in anyOf"}};F_.default=F4});var V_=C(function(H_){Object.defineProperty(H_,"__esModule",{value:!0});var yc=ye(),H4=Se(),V4={message:"must match exactly one schema in oneOf",params:({params:e})=>yc._`{passingSchemas: ${e.passing}}`},B4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:V4,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let i=r,o=t.let("valid",!1),a=t.let("passing",null),l=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((u,p)=>{let g;if(H4.alwaysValidSchema(s,u))t.var(l,!0);else g=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},l);if(p>0)t.if(yc._`${l} && ${o}`).assign(o,!1).assign(a,yc._`[${a}, ${p}]`).else();t.if(l,()=>{if(t.assign(o,!0),t.assign(a,p),g)e.mergeEvaluated(g,yc.Name)})})}}};H_.default=B4});var W_=C(function(B_){Object.defineProperty(B_,"__esModule",{value:!0});var U4=Se(),z4={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((i,o)=>{if(U4.alwaysValidSchema(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:o},s);e.ok(s),e.mergeEvaluated(a)})}};B_.default=z4});var K_=C(function(G_){Object.defineProperty(G_,"__esModule",{value:!0});var bc=ye(),z_=Se(),K4={message:({params:e})=>bc.str`must match "${e.ifClause}" schema`,params:({params:e})=>bc._`{failingKeyword: ${e.ifClause}}`},Y4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:K4,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)z_.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=U_(n,"then"),i=U_(n,"else");if(!s&&!i)return;let o=t.let("valid",!0),a=t.name("_valid");if(l(),e.reset(),s&&i){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(a,c("then",u),c("else",u))}else if(s)t.if(a,c("then"));else t.if(bc.not(a),c("else"));e.pass(o,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(u)}function c(u,p){return()=>{let g=e.subschema({keyword:u},a);if(t.assign(o,a),e.mergeValidEvaluated(g,o),p)t.assign(p,bc._`${u}`);else e.setParams({ifClause:u})}}}};function U_(e,t){let r=e.schema[t];return r!==void 0&&!z_.alwaysValidSchema(e,r)}G_.default=Y4});var X_=C(function(Y_){Object.defineProperty(Y_,"__esModule",{value:!0});var Z4=Se(),Q4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Z4.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Y_.default=Q4});var vp=C(function(Z_){Object.defineProperty(Z_,"__esModule",{value:!0});var tB=gp(),rB=m_(),nB=yp(),sB=y_(),iB=x_(),oB=pc(),aB=j_(),lB=xp(),cB=C_(),uB=J_(),dB=L_(),fB=q_(),pB=V_(),mB=W_(),hB=K_(),gB=X_();function yB(e=!1){let t=[dB.default,fB.default,pB.default,mB.default,hB.default,gB.default,aB.default,lB.default,oB.default,cB.default,uB.default];if(e)t.push(rB.default,sB.default);else t.push(tB.default,nB.default);return t.push(iB.default),t}Z_.default=yB});var Sp=C(function(tP){Object.defineProperty(tP,"__esModule",{value:!0});tP.dynamicAnchor=void 0;var wp=ye(),xB=gr(),Q_=Ho(),$B=ac(),vB={keyword:"$dynamicAnchor",schemaType:"string",code:(e)=>eP(e,e.schema)};function eP(e,t){let{gen:r,it:n}=e;n.schemaEnv.root.dynamicAnchors[t]=!0;let s=wp._`${xB.default.dynamicAnchors}${wp.getProperty(t)}`,i=n.errSchemaPath==="#"?n.validateName:wB(e);r.if(wp._`!${s}`,()=>r.assign(s,i))}tP.dynamicAnchor=eP;function wB(e){let{schemaEnv:t,schema:r,self:n}=e.it,{root:s,baseId:i,localRefs:o,meta:a}=t.root,{schemaId:l}=n.opts,c=new Q_.SchemaEnv({schema:r,schemaId:l,root:s,baseId:i,localRefs:o,meta:a});return Q_.compileSchema.call(n,c),$B.getValidate(e,c)}tP.default=vB});var Ep=C(function(oP){Object.defineProperty(oP,"__esModule",{value:!0});oP.dynamicRef=void 0;var sP=ye(),EB=gr(),nP=ac(),_B={keyword:"$dynamicRef",schemaType:"string",code:(e)=>iP(e,e.schema)};function iP(e,t){let{gen:r,keyword:n,it:s}=e;if(t[0]!=="#")throw Error(`"${n}" only supports hash fragment reference`);let i=t.slice(1);if(s.allErrors)o();else{let l=r.let("valid",!1);o(l),e.ok(l)}function o(l){if(s.schemaEnv.root.dynamicAnchors[i]){let c=r.let("_v",sP._`${EB.default.dynamicAnchors}${sP.getProperty(i)}`);r.if(c,a(c,l),a(s.validateName,l))}else a(s.validateName,l)()}function a(l,c){return c?()=>r.block(()=>{nP.callRef(e,l),r.let(c,!0)}):()=>nP.callRef(e,l)}}oP.dynamicRef=iP;oP.default=_B});var cP=C(function(lP){Object.defineProperty(lP,"__esModule",{value:!0});var jB=Sp(),kB=Se(),RB={keyword:"$recursiveAnchor",schemaType:"boolean",code(e){if(e.schema)jB.dynamicAnchor(e,"");else kB.checkStrictMode(e.it,"$recursiveAnchor: false is ignored")}};lP.default=RB});var dP=C(function(uP){Object.defineProperty(uP,"__esModule",{value:!0});var OB=Ep(),CB={keyword:"$recursiveRef",schemaType:"string",code:(e)=>OB.dynamicRef(e,e.schema)};uP.default=CB});var pP=C(function(fP){Object.defineProperty(fP,"__esModule",{value:!0});var NB=Sp(),IB=Ep(),MB=cP(),JB=dP(),DB=[NB.default,IB.default,MB.default,JB.default];fP.default=DB});var gP=C(function(hP){Object.defineProperty(hP,"__esModule",{value:!0});var mP=pc(),FB={keyword:"dependentRequired",type:"object",schemaType:"object",error:mP.error,code:(e)=>mP.validatePropertyDeps(e)};hP.default=FB});var bP=C(function(yP){Object.defineProperty(yP,"__esModule",{value:!0});var HB=pc(),VB={keyword:"dependentSchemas",type:"object",schemaType:"object",code:(e)=>HB.validateSchemaDeps(e)};yP.default=VB});var $P=C(function(xP){Object.defineProperty(xP,"__esModule",{value:!0});var WB=Se(),UB={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:e,parentSchema:t,it:r}){if(t.contains===void 0)WB.checkStrictMode(r,`"${e}" without "contains" is ignored`)}};xP.default=UB});var wP=C(function(vP){Object.defineProperty(vP,"__esModule",{value:!0});var GB=gP(),KB=bP(),YB=$P(),XB=[GB.default,KB.default,YB.default];vP.default=XB});var _P=C(function(EP){Object.defineProperty(EP,"__esModule",{value:!0});var Xn=ye(),SP=Se(),QB=gr(),eW={message:"must NOT have unevaluated properties",params:({params:e})=>Xn._`{unevaluatedProperty: ${e.unevaluatedProperty}}`},tW={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:eW,code(e){let{gen:t,schema:r,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:o,props:a}=i;if(a instanceof Xn.Name)t.if(Xn._`${a} !== true`,()=>t.forIn("key",n,(p)=>t.if(c(a,p),()=>l(p))));else if(a!==!0)t.forIn("key",n,(p)=>a===void 0?l(p):t.if(u(a,p),()=>l(p)));i.props=!0,e.ok(Xn._`${s} === ${QB.default.errors}`);function l(p){if(r===!1){if(e.setParams({unevaluatedProperty:p}),e.error(),!o)t.break();return}if(!SP.alwaysValidSchema(i,r)){let g=t.name("valid");if(e.subschema({keyword:"unevaluatedProperties",dataProp:p,dataPropType:SP.Type.Str},g),!o)t.if(Xn.not(g),()=>t.break())}}function c(p,g){return Xn._`!${p} || !${p}[${g}]`}function u(p,g){let m=[];for(let b in p)if(p[b]===!0)m.push(Xn._`${g} !== ${b}`);return Xn.and(...m)}}};EP.default=tW});var kP=C(function(jP){Object.defineProperty(jP,"__esModule",{value:!0});var Ns=ye(),PP=Se(),nW={message:({params:{len:e}})=>Ns.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Ns._`{limit: ${e}}`},sW={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:nW,code(e){let{gen:t,schema:r,data:n,it:s}=e,i=s.items||0;if(i===!0)return;let o=t.const("len",Ns._`${n}.length`);if(r===!1)e.setParams({len:i}),e.fail(Ns._`${o} > ${i}`);else if(typeof r=="object"&&!PP.alwaysValidSchema(s,r)){let l=t.var("valid",Ns._`${o} <= ${i}`);t.if(Ns.not(l),()=>a(l,i)),e.ok(l)}s.items=!0;function a(l,c){t.forRange("i",c,o,(u)=>{if(e.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:PP.Type.Num},l),!s.allErrors)t.if(Ns.not(l),()=>t.break())})}}};jP.default=sW});var AP=C(function(RP){Object.defineProperty(RP,"__esModule",{value:!0});var oW=_P(),aW=kP(),lW=[oW.default,aW.default];RP.default=lW});var CP=C(function(OP){Object.defineProperty(OP,"__esModule",{value:!0});var rt=ye(),uW={message:({schemaCode:e})=>rt.str`must match format "${e}"`,params:({schemaCode:e})=>rt._`{format: ${e}}`},dW={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:uW,code(e,t){let{gen:r,data:n,$data:s,schema:i,schemaCode:o,it:a}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:p}=a;if(!l.validateFormats)return;if(s)g();else m();function g(){let b=r.scopeValue("formats",{ref:p.formats,code:l.code.formats}),h=r.const("fDef",rt._`${b}[${o}]`),y=r.let("fType"),v=r.let("format");r.if(rt._`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,rt._`${h}.type || "string"`).assign(v,rt._`${h}.validate`),()=>r.assign(y,rt._`"string"`).assign(v,h)),e.fail$data(rt.or(j(),S()));function j(){if(l.strictSchema===!1)return rt.nil;return rt._`${o} && !${v}`}function S(){let _=u.$async?rt._`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:rt._`${v}(${n})`,E=rt._`(typeof ${v} == "function" ? ${_} : ${v}.test(${n}))`;return rt._`${v} && ${v} !== true && ${y} === ${t} && !${E}`}}function m(){let b=p.formats[i];if(!b){j();return}if(b===!0)return;let[h,y,v]=S(b);if(h===t)e.pass(_());function j(){if(l.strictSchema===!1){p.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function S(E){let O=E instanceof RegExp?rt.regexpCode(E):l.code.formats?rt._`${l.code.formats}${rt.getProperty(i)}`:void 0,R=r.scopeValue("formats",{key:i,ref:E,code:O});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,rt._`${R}.validate`];return["string",E,R]}function _(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!u.$async)throw Error("async format in sync schema");return rt._`await ${v}(${n})`}return typeof y=="function"?rt._`${v}(${n})`:rt._`${v}.test(${n})`}}}};OP.default=dW});var _p=C(function(TP){Object.defineProperty(TP,"__esModule",{value:!0});var pW=CP(),mW=[pW.default];TP.default=mW});var Pp=C(function(NP){Object.defineProperty(NP,"__esModule",{value:!0});NP.contentVocabulary=NP.metadataVocabulary=void 0;NP.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];NP.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var DP=C(function(JP){Object.defineProperty(JP,"__esModule",{value:!0});var yW=dp(),bW=mp(),xW=vp(),$W=pP(),vW=wP(),wW=AP(),SW=_p(),MP=Pp(),EW=[$W.default,yW.default,bW.default,(0,xW.default)(!0),SW.default,MP.metadataVocabulary,MP.contentVocabulary,vW.default,wW.default];JP.default=EW});var HP=C(function(FP){Object.defineProperty(FP,"__esModule",{value:!0});FP.DiscrError=void 0;var LP;(function(e){e.Tag="tag",e.Mapping="mapping"})(LP||(FP.DiscrError=LP={}))});var kp=C(function(BP){Object.defineProperty(BP,"__esModule",{value:!0});var ki=ye(),jp=HP(),VP=Ho(),PW=Ei(),jW=Se(),kW={message:({params:{discrError:e,tagName:t}})=>e===jp.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>ki._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},RW={keyword:"discriminator",type:"object",schemaType:"object",error:kW,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:i}=e,{oneOf:o}=s;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!o)throw Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",ki._`${r}${ki.getProperty(a)}`);t.if(ki._`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:jp.DiscrError.Tag,tag:c,tagName:a})),e.ok(l);function u(){let m=g();t.if(!1);for(let b in m)t.elseIf(ki._`${c} === ${b}`),t.assign(l,p(m[b]));t.else(),e.error(!1,{discrError:jp.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(m){let b=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:m},b);return e.mergeEvaluated(h,ki.Name),b}function g(){var m;let b={},h=v(s),y=!0;for(let _=0;_<o.length;_++){let E=o[_];if((E===null||E===void 0?void 0:E.$ref)&&!jW.schemaHasRulesButRef(E,i.self.RULES)){let R=E.$ref;if(E=VP.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,R),E instanceof VP.SchemaEnv)E=E.schema;if(E===void 0)throw new PW.default(i.opts.uriResolver,i.baseId,R)}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}"`);y=y&&(h||v(E)),j(O,_)}if(!y)throw Error(`discriminator: "${a}" must be required`);return b;function v({required:_}){return Array.isArray(_)&&_.includes(a)}function j(_,E){if(_.const)S(_.const,E);else if(_.enum)for(let O of _.enum)S(O,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(_,E){if(typeof _!="string"||_ in b)throw Error(`discriminator: "${a}" values must be unique strings`);b[_]=E}}}};BP.default=RW});var WP=C(function(UQ,OW){OW.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 UP=C(function(zQ,CW){CW.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 zP=C(function(GQ,TW){TW.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 GP=C(function(KQ,NW){NW.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 KP=C(function(YQ,IW){IW.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 YP=C(function(XQ,MW){MW.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 XP=C(function(ZQ,JW){JW.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 ZP=C(function(QQ,DW){DW.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 ej=C(function(QP){Object.defineProperty(QP,"__esModule",{value:!0});var LW=WP(),FW=UP(),qW=zP(),HW=GP(),VW=KP(),BW=YP(),WW=XP(),UW=ZP(),zW=["/properties"];function GW(e){return[LW,FW,qW,HW,VW,t(this,BW),WW,t(this,UW)].forEach((r)=>this.addMetaSchema(r,void 0,!1)),this;function t(r,n){return e?r.$dataMetaSchema(n,zW):n}}QP.default=GW});var Op=C(function(Xt,Ap){Object.defineProperty(Xt,"__esModule",{value:!0});Xt.MissingRefError=Xt.ValidationError=Xt.CodeGen=Xt.Name=Xt.nil=Xt.stringify=Xt.str=Xt._=Xt.KeywordCxt=Xt.Ajv2020=void 0;var YW=up(),XW=DP(),ZW=kp(),QW=ej(),Rp="https://json-schema.org/draft/2020-12/schema";class ea extends YW.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){if(super._addVocabularies(),XW.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(ZW.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:t}=this.opts;if(!t)return;QW.default.call(this,e),this.refs["http://json-schema.org/schema"]=Rp}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Rp)?Rp:void 0)}}Xt.Ajv2020=ea;Ap.exports=Xt=ea;Ap.exports.Ajv2020=ea;Object.defineProperty(Xt,"__esModule",{value:!0});Xt.default=ea;var eU=Si();Object.defineProperty(Xt,"KeywordCxt",{enumerable:!0,get:function(){return eU.KeywordCxt}});var Ri=ye();Object.defineProperty(Xt,"_",{enumerable:!0,get:function(){return Ri._}});Object.defineProperty(Xt,"str",{enumerable:!0,get:function(){return Ri.str}});Object.defineProperty(Xt,"stringify",{enumerable:!0,get:function(){return Ri.stringify}});Object.defineProperty(Xt,"nil",{enumerable:!0,get:function(){return Ri.nil}});Object.defineProperty(Xt,"Name",{enumerable:!0,get:function(){return Ri.Name}});Object.defineProperty(Xt,"CodeGen",{enumerable:!0,get:function(){return Ri.CodeGen}});var tU=Fo();Object.defineProperty(Xt,"ValidationError",{enumerable:!0,get:function(){return tU.default}});var rU=Ei();Object.defineProperty(Xt,"MissingRefError",{enumerable:!0,get:function(){return rU.default}})});import{existsSync as $c,readFileSync as iU}from"node:fs";import{createRequire as tj}from"node:module";import{isAbsolute as oU,relative as aU,resolve as xc}from"node:path";import{fileURLToPath as rj,pathToFileURL as lU}from"node:url";function ta(e){return JSON.parse(iU(e,"utf8"))}async function nj(e){let t=xc(e),r=xc(t,"project.json"),n=xc(t,"project.schema.json");if(!$c(r))throw Error(`project.json not found in ${t}`);if(!$c(n))throw Error(`project.schema.json not found in ${t} — run \`jx schema\` to generate it from `+"project.json#/extensions");let s=ta(r),i=ta(n);i.$id=lU(n).href;let o;try{({default:o}=await Promise.resolve().then(() => Lt(Op(),1)))}catch(u){throw Error("Project validation requires ajv: bun add ajv",{cause:u})}let l=await new o({allErrors:!0,loadSchema:(u)=>cU(u,t),strict:!1}).compileAsync(i),c=l(s);return{errors:l.errors??null,valid:c}}async function cU(e,t){if(!e.startsWith("file:"))throw Error(`Cannot resolve schema ref "${e}": only project-relative file refs are loadable (canonical URIs must resolve from already-loaded fragments)`);let r=rj(e),n=aU(t,r);if(n.startsWith("..")||oU(n))throw Error(`Schema ref "${e}" escapes the project root ${t}`);if($c(r))return ta(r);let s=n.split("\\").join("/"),i="node_modules/",o=s.lastIndexOf(i);if(o===-1)throw Error(`Schema ref "${e}" does not exist`);let a=s.slice(o+i.length),l="@jxsuite/schema/",c;try{c=tj(xc(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=tj(import.meta.url).resolve(a)}catch(p){let g=rj(new URL(`../${a.slice(l.length)}`,import.meta.url));if($c(g))return ta(g);throw Error(`Schema ref "${e}" does not exist and "${a}" is not resolvable from the project or this host's core`,{cause:p})}}return ta(c)}var sj=()=>{};function Gr(e){return z(e.attributes)?e.attributes:{}}function _t(e,t){let r=Gr(e)[t];return N(r)?r:null}function nt(e){return N(e.tagName)?e.tagName.toLowerCase():""}function It(e,t="the popover"){let r=N(e.id)?e.id:_t(e,"id");if(r)return`#${r}`;let n=nt(e);return n===""?t:`the <${n}>`}function fU(e){let t=Gr(e).popover;return N(t)?t:null}function oj(e){let t=new Set,r=new Set;for(let n of e){let s=n!==null&&N(n.tagName)?n.tagName:"";if(n===null||!s.includes("-"))continue;if(Cp(n))t.add(s);let i=n.observedAttributes;if(Array.isArray(i)&&pU.every((o)=>i.includes(o)))r.add(s)}return{invokerTags:r,popoverTags:t}}function Cp(e){return"popover"in Gr(e)||"popover"in e}function ra(e,t){return Cp(e)||(t?.popoverTags?.has(nt(e))??!1)}function Zn(e){if(N(e.id)&&e.id!=="")return e.id;let t=_t(e,"id");return t===""?null:t}function*zr(e,t=[],r=null,n){yield{enclosing:r,node:e,path:t};let s=ra(e,n)?e:r,{children:i}=e;if(Array.isArray(i)){for(let[l,c]of i.entries())if(F(c))yield*zr(c,[...t,"children",l],s,n)}else if(z(i)&&qt(i.map))yield*zr(i.map,[...t,"children","map"],s,n);let o=qt(e.map)?e.map:null;if(o)yield*zr(o,[...t,"map"],s,n);let a=z(e.cases)?e.cases:{};for(let[l,c]of Object.entries(a))if(F(c))yield*zr(c,[...t,"cases",l],s,n)}function Tp(e,t){let r=[];for(let{node:n}of zr(e,[],null,t)){if(!ra(n,t))continue;let s=Zn(n);if(s!==null&&!r.includes(s))r.push(s)}return r}function vc(e){return e.startsWith("@")}function aj(e){return e.startsWith(":")||e.startsWith("&")||e.startsWith(".")||e.startsWith("[")}function Nt(e,t){let r=e?.[t];if(r===void 0||is(r)||Array.isArray(r))return null;return String(r)}function lj(e){for(let[t,r]of Object.entries(e??{})){if(!is(r))continue;if(aj(t)&&t.includes(":popover-open")&&Nt(r,"display")!==null)return!0;if(vc(t)&&lj(r))return!0}return!1}function cj(e){for(let[t,r]of Object.entries(e??{})){if(!is(r))continue;if(aj(t)&&t.includes(":popover-open"))return!0;if(vc(t)&&cj(r))return!0}return!1}function hU(e){return mU.some((t)=>Nt(e,t)!==null)}function gU(e){if(!e)return[];let t=[];for(let[r,n]of Object.entries(e))if(vc(r)&&is(n)&&Nt(n,"display")!==null)t.push(r);return t}function uj(e){if(!e)return[];let t=[],r=Nt(e,"transition");if(r!==null)t.push(r);for(let[n,s]of Object.entries(e))if(vc(n)&&is(s))t.push(...uj(s));return t}function yU(e){if(!e)return!1;if(Nt(e,"positionAnchor")!==null||Nt(e,"position-anchor")!==null)return!0;return["top","left","right","bottom","inset","insetBlockStart","insetInlineStart"].some((t)=>(Nt(e,t)??"").includes("anchor("))}function bU(e){if(!e)return!1;if(Nt(e,"positionArea")!==null||Nt(e,"position-area")!==null||Nt(e,"positionTryFallbacks")!==null||Nt(e,"position-try-fallbacks")!==null)return!0;return Object.keys(e).some((t)=>t.startsWith("@supports"))}function dj(e,t){let r=[...zr(e,[],null,t)],n=Tp(e,t),s=r.some(({node:a})=>ra(a,t)),i=new Set;for(let{node:a}of r)if(ij.has(nt(a))){let l=_t(a,"popovertarget");if(l!==null)i.add(l)}let o=[];for(let{enclosing:a,node:l,path:c}of r)if(o.push(...xU(l,c,a,n,s,t)),Cp(l))o.push(...$U(l,c,i));return o}function xU(e,t,r,n,s,i){let o=[],a=nt(e),l=_t(e,"popovertarget"),c=ij.has(a)||(i?.invokerTags?.has(a)??!1);if(l!==null&&!c)return o.push({detail:"`popovertarget` and `popovertargetaction` come from the `PopoverTargetAttributes` IDL mixin, which HTML includes into `HTMLButtonElement` and `HTMLInputElement` and into nothing else. Elsewhere they parse and do nothing. A link inside an open popover "+"dismisses it by navigating away, which is why this looks like it works — but it does "+`not for a new tab or a same-page fragment. Remove both attributes. ${Ve}`,fix:"invoker",message:`<${a||"element"}> carries popovertarget, which only <button> and <input> support.`,path:t,rule:"invoker-not-button",severity:"error"}),o;if(l!==null){if(s&&!n.includes(l)){let u=n.length>0?`The popovers here are: ${n.map((p)=>`"${p}"`).join(", ")}. `:"";o.push({detail:`No element in this document declares \`popover\` with the id "${l}". ${u}A target that names nothing does nothing, silently. ${Ve}`,message:`popovertarget="${l}" names no popover in this document.`,path:t,rule:"target-missing",severity:"error"})}else if(r!==null&&Zn(r)!==null&&Zn(r)!==l)o.push({detail:`This control is inside ${It(r)} but targets "${l}". Dismissing a different popover leaves the one the reader is looking at open. This is usually a copy-paste between two panels in the same file. ${Ve}`,message:`A control inside ${It(r)} targets "${l}" instead.`,path:t,rule:"target-mismatch",severity:"warn"})}if(a==="a"&&r!==null&&l===null){let u=_t(e,"href")??(N(e.href)?e.href:null),p=_t(e,"target")==="_blank",g=u!==null&&u.includes("#");if(p||g){let m=p?"it opens a new tab, so the panel stays open on the page behind it. ":"it is a same-document fragment, so the page scrolls behind the open panel. ";o.push({detail:`A link inside a panel normally dismisses it by navigating away. This one does not: ${m}`+"There is no declarative fix — a link cannot carry `popovertarget`. Move it out of the "+`panel, make it a <button>, or accept it deliberately. ${Ve}`,message:`A link inside ${It(r)} does not dismiss it.`,path:t,rule:"link-does-not-dismiss",severity:"warn"})}}return o}function $U(e,t,r){let n=[],{style:s}=e,i=It(e),o=fU(e);if(o!==null&&o!==""&&!dU.some((c)=>c===o))n.push({detail:"`popover` is an enumerated attribute taking `auto`, `manual` or `hint`. Anything else falls back to the invalid-value default `manual`, which gives up light dismiss and gives "+`up Escape — so the panel opens and there is no way to close it. Write "auto". ${Ve}`,fix:"mode",message:`${i} declares popover="${o}", which is not one of auto, manual or hint.`,path:t,rule:"invalid-mode",severity:"error"});else if($t(Gr(e).popover))n.push({detail:`\`popover\` carries its value in its text, so a boolean is not the right shape. Written as \`true\` it reaches two of the compiler's emitters as \`popover="true"\`, which is not one of the three keywords, so HTML falls back to \`manual\`: no light dismiss, no Escape, and the trigger stops toggling. Write "auto". ${Ve}`,fix:"mode",message:`${i} writes popover as a boolean.`,path:t,rule:"invalid-mode",severity:"error"});let a=Nt(s,"display");if(a!==null&&a!=="revert"&&a!=="revert-layer")n.push({detail:"A closed popover is hidden by the browser's own `[popover]:not(:popover-open) { display: none }`. That rule is UA-origin, so any author `display` beats it at any specificity, and "+"the panel is laid out on every page whether it is open or not — usually parked off the "+`side of the viewport by the transform meant to animate it, so nothing looks wrong until you scroll sideways. \`display\` belongs in \`:popover-open\` and nowhere else. ${Ve}`,fix:"display",message:`${i} sets display in its base rule.`,path:t,rule:"base-display",severity:"error"});for(let c of gU(s))n.push({detail:`The same defect as a base \`display\`, arriving through \`${c}\` and therefore only at `+"one width — which is what makes it hard to see. Gate the TRIGGER on a breakpoint, never "+`the panel: the popover mechanism is what hides the panel. ${Ve}`,fix:"display",message:`${i} sets display inside ${c}.`,path:t,rule:"breakpoint-display",severity:"error"});if(Nt(s,"visibility")!==null)n.push({detail:`A second hiding mechanism the browser already provides. Once \`display\` leaves the base rule this one only adds a frame of flicker on open, and it hides the element from assistive technology in a way \`display: none\` already did. ${Ve}`,fix:"display",message:`${i} also hides itself with visibility.`,path:t,rule:"base-visibility",severity:"warn"});if(!cj(s))n.push({detail:"Nothing changes when it opens, so no transition on it can run and — if `display` is not "+"in the base rule — the panel has no `display` at all while open. This is usually a panel "+`that was styled before it was made a popover. ${Ve}`,message:`${i} has no :popover-open rule.`,path:t,rule:"no-open-rule",severity:"warn"});else if(!lj(s)&&a===null&&hU(s))n.push({detail:`${i} declares flex or grid properties, but neither its base rule nor its `+"`:popover-open` rule sets a `display` for them to apply to — and the base rule must not "+`(that is what keeps the closed panel hidden). So it opens with the UA's \`display: block\` and the layout silently does nothing. Put \`display: flex\` in \`:popover-open\`. ${Ve}`,fix:"open-display",message:`${i} is laid out with flex or grid but never sets display.`,path:t,rule:"no-open-display",severity:"error"});for(let c of uj(s))if(c.includes("display")&&!c.includes("overlay")){n.push({detail:"`display …allow-discrete` keeps the box alive while it animates out; `overlay "+"…allow-discrete` is what keeps it in the TOP LAYER for those same milliseconds. "+`Without it the panel drops behind the page content and the backdrop disappears a frame early, so the exit reads as a flicker rather than an animation. ${Ve}`,message:`${i} transitions display but not overlay.`,path:t,rule:"cut-exit",severity:"warn"});break}if(yU(s)&&!bU(s))n.push({detail:"When `anchor()` does not resolve, every inset it feeds computes to `auto` — and a "+`\`position: fixed\` box with four \`auto\` insets falls back to its STATIC position, which for a panel declared inside a header is in the middle of the header. Use \`position-area\` with \`position-try-fallbacks\`, or add a \`@supports\` block that positions it without anchors. ${Ve}`,message:`${i} is anchor-positioned with no fallback.`,path:t,rule:"unsafe-anchor",severity:"warn"});let l=Zn(e);if(l!==null&&!r.has(l))n.push({detail:`No \`<button>\` or \`<input>\` in this document names it with \`popovertarget\`. If it is opened from another file or from a function that calls \`showPopover()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${i} has no invoker in this document.`,path:t,rule:"no-invoker",severity:"warn"});return n}var dU,ij,pU,mU,Ve="See docs/framework/concepts/overlays.";var wc=q(()=>{$e();dU=["auto","manual","hint"],ij=new Set(["button","input"]);pU=["popovertarget","popovertargetaction","command","commandfor"];mU=["flexDirection","flex-direction","alignItems","align-items","justifyContent","justify-content","flexWrap","flex-wrap","gridTemplateColumns","grid-template-columns","gridTemplateRows","grid-template-rows","gap"]});function Ti(e,t){let r=Gr(e),n=t in r?r[t]:e[t];if(n===void 0||n===null)return{kind:"absent"};if(Ce(n)||z(n))return{kind:"bound"};if(N(n))return n.includes("${")?{kind:"bound"}:{kind:"text",text:n};return{isTrue:n===!0,kind:"other"}}function Oi(e,t){let r=Ti(e,t);return r.kind==="text"&&r.text.trim()!==""?r.text:null}function Pt(e,t){return Ti(e,t).kind!=="absent"}function Qn(e){let t=Ti(e,"role");if(t.kind==="bound")return Ci;return t.kind==="text"?t.text.trim().toLowerCase().split(/\s+/)[0]:null}function Sc(e){let t=Ti(e,"id");if(t.kind==="bound")return Ci;return t.kind==="text"&&t.text!==""?t.text:null}function xr(e,t){let r=Ti(e,t);return r.kind==="bound"||r.kind==="text"&&r.text.trim()!==""}function Ec(e){let t=e.textContent;if(N(t)){if(t.trim()!=="")return!0}else if(t!==void 0&&t!==null)return!0;if(xr(e,"aria-label")||Pt(e,"aria-labelledby"))return!0;if(nt(e)==="img"&&(xr(e,"alt")||xr(e,"title")))return!0;if(nt(e)==="slot")return!0;let{children:r}=e;if(Array.isArray(r)){for(let s of r)if(N(s)){if(s.trim()!=="")return!0}else if(F(s)&&Ec(s))return!0}else if(r!=null)return!0;if(z(e.map))return!0;return(z(e.cases)?Object.values(e.cases):[]).some((s)=>qt(s)&&Ec(s))}function*Ai(e,t=[],r=[],n=[]){yield{node:e,path:t,roles:r,tags:n};let s=[...r,Qn(e)],i=[...n,nt(e)],{children:o}=e;if(Array.isArray(o)){for(let[a,l]of o.entries())if(F(l))yield*Ai(l,[...t,"children",a],s,i)}else if(z(o)&&qt(o.map))yield*Ai(o.map,[...t,"children","map"],s,i);if(qt(e.map))yield*Ai(e.map,[...t,"map"],s,i);if(z(e.cases)){for(let[a,l]of Object.entries(e.cases))if(F(l))yield*Ai(l,[...t,"cases",a],s,i)}}function PU(e){return e.some((t)=>t.includes("-"))}function Kr(e,t,r,n,s,i="error"){return{criterion:s,detail:`${n} ${vU}`,message:r,path:t,rule:e,severity:i}}function fj(e,t,r){if(r.includes("label"))return!0;if(e===Ci||t.bound)return!0;return e!==null&&t.ids.has(e)}function jU(e,t){let{node:r,path:n,tags:s}=e,i=nt(r),o=Qn(r);if(o==="bound")return null;if(xr(r,"aria-label")||Pt(r,"aria-labelledby")||xr(r,"title"))return null;let l=It(r,"the control"),c=(p)=>Kr("interactive-unnamed",n,`${l} has no accessible name.`,`A control with no name is announced as its role alone, so a reader hears "button" and nothing else. ${p}`,"4.1.2"),u=kU(r,i,t,s);if(u==="named"||u==="exempt")return null;if(o!==null&&wU.has(o))return Ec(r)?null:c("Give it text content, or an aria-label.");if(o!==null&&SU.has(o))return c("Give it an aria-label, or aria-labelledby naming its visible label.");if(o!==null)return null;if(i==="button"||i==="summary"||i==="a"&&Pt(r,"href"))return Ec(r)?null:c("Give it text content, or an aria-label.");if(u==="unnamed")return c("Give it a <label for> naming its id, or an aria-label.");if(u==="unnamed-value")return c("Give it a value, or an aria-label.");if(u==="unnamed-alt")return c("Give it an alt, or an aria-label.");return null}function kU(e,t,r,n){if(t==="area"){if(!Pt(e,"href"))return"none";return xr(e,"alt")?"named":"unnamed-alt"}if(t==="select"||t==="textarea")return fj(Sc(e),r,n)||xr(e,"placeholder")?"named":"unnamed";if(t!=="input")return"none";let s=(Oi(e,"type")??"text").toLowerCase();if(s==="hidden"||Pt(e,"type")&&Oi(e,"type")===null)return"exempt";if(EU.has(s))return xr(e,"value")?"named":"unnamed-value";if(s==="image")return xr(e,"alt")?"named":"unnamed-alt";return fj(Sc(e),r,n)||xr(e,"placeholder")?"named":"unnamed"}function AU(e){let{node:t,path:r,tags:n}=e,s=nt(t);if(!s.includes("-")||!n.some((i)=>RU.has(i)))return null;return Kr("custom-element-in-select",r,`<${s}> is a custom element inside a <select>.`,'A <select> builds its own rows: an element it does not know is not in select.options, so it cannot be picked, cannot be reached with the arrow keys, and fires no change event — while role="option" on it still makes the accessibility tree read as though it could. Every row of a <select> is a native <option>; a listbox whose rows are jx-option elements is a jx-listbox.',"4.1.2")}function OU(e){let{node:t,path:r}=e;if(nt(t)!=="img")return null;let n=Qn(t);if(n==="bound"||n==="presentation"||n==="none")return null;if(Pt(t,"alt")||xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Kr("img-alt-missing",r,`${It(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 TU(e,t){let{node:r,path:n}=e,s=[];for(let i of CU){let o=Oi(r,i);if(o===null)continue;for(let a of o.split(/\s+/))if(a!==""&&!t.has(a))s.push(Kr("aria-target-missing",n,`${It(r,"the element")} points ${i} at #${a}, which nothing in this document has as its id.`,"A reference to an id that is not in the document is silently dropped, so the relationship it declares does not exist. Name an element that is here, or give that element the id.","1.3.1"))}return s}function NU(e,t,r){for(let n of pj.get(t)??[]){let s=r.get(n);if(s===void 0)continue;if(s.bound)return!0;if(e===Ci&&s.ids.size>0)return!0;if(e!==null&&e!==Ci&&s.ids.has(e))return!0}return!1}function IU(e,t){let{node:r,path:n,roles:s,tags:i}=e,o=Qn(r);if(o===null||o==="bound"||n.length===0||PU(i))return null;if(s.includes("bound")||NU(Sc(r),o,t))return null;let a=It(r,"the element");if(o==="tab"&&!s.includes("tablist"))return Kr("tab-outside-tablist",n,`${a} is a tab outside any tablist.`,'A tab is announced with its position in a tablist, so one with no tablist ancestor has no place to be counted in. Put the tabs in a container with role="tablist".',"1.3.1");if((o==="menuitem"||o==="menuitemcheckbox"||o==="menuitemradio")&&!s.includes("menu")&&!s.includes("menubar"))return Kr("menuitem-outside-menu",n,`${a} is a ${o} outside any menu.`,'A menu item is owned by a menu, and is announced as one of its items. Put it in a container with role="menu" or role="menubar".',"1.3.1");if(o==="option"&&!s.includes("listbox")&&!i.includes("select")&&!i.includes("datalist"))return Kr("option-outside-listbox",n,`${a} is an option outside any listbox.`,'An option is owned by a listbox, and is announced as one of its choices. Put it in a container with role="listbox", or in a <select>.',"1.3.1");return null}function MU(e){let t=[];for(let{node:r}of Ai(e)){if(Qn(r)!=="tab")continue;let n=Ti(r,"aria-selected");if(n.kind==="bound")return null;t.push(n.kind==="other"&&n.isTrue||n.kind==="text"&&n.text==="true")}return t}function JU(e){let{node:t,path:r}=e;if(Qn(t)!=="tablist")return null;let n=MU(t);if(n===null||n.length===0||n.includes(!0))return null;return Kr("tablist-none-selected",r,`${It(t,"the tablist")} has ${n.length} tab(s) and none is selected.`,'A tablist always has a current tab, and aria-selected="true" is how it is announced. Mark the tab whose panel is showing.',"4.1.2","warn")}function DU(e){let{node:t,path:r}=e,n=Qn(t);if(!(nt(t)==="dialog"||n==="dialog"||n==="alertdialog")||n==="bound")return null;if(xr(t,"aria-label")||Pt(t,"aria-labelledby"))return null;return Kr("dialog-unnamed",r,`${It(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 FU(e){let{node:t,path:r}=e;if(!Pt(t,"aria-activedescendant"))return null;let n=nt(t);if(LU.has(n)||n==="a"&&Pt(t,"href")||Pt(t,"tabIndex")||Pt(t,"tabindex")||Pt(t,"contenteditable"))return null;return Kr("activedescendant-not-focusable",r,`${It(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 mj(e){let t=[...Ai(e)],r=new Set,n={bound:!1,ids:new Set},s=new Map,i=!1;for(let{node:a}of t){let l=Qn(a);if(l!==null&&_U.has(l)){let u=s.get(l)??{bound:!1,ids:new Set},p=Oi(a,"aria-owns");if(p===null)u.bound||=Pt(a,"aria-owns");else for(let g of p.split(/\s+/))if(g!=="")u.ids.add(g);s.set(l,u)}let c=Sc(a);if(c===Ci)i=!0;else if(c!==null)r.add(c);if(nt(a)==="label"){let u=Oi(a,"for")??Oi(a,"htmlFor");if(u===null)n.bound||=Pt(a,"for")||Pt(a,"htmlFor");else n.ids.add(u)}}let o=[];for(let a of t){let l=[jU(a,n),OU(a),IU(a,s),AU(a),JU(a),DU(a),FU(a)];for(let c of l)if(c)o.push(c);if(!i)o.push(...TU(a,r))}return o}var vU="See docs/framework/concepts/accessibility.",Ci="bound",wU,SU,EU,pj,_U,RU,CU,LU;var hj=q(()=>{$e();wc();wU=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]),SU=new Set(["combobox","listbox","searchbox","slider","spinbutton","textbox"]),EU=new Set(["button","reset","submit"]),pj=new Map([["menuitem",["menu","menubar"]],["menuitemcheckbox",["menu","menubar"]],["menuitemradio",["menu","menubar"]],["option",["listbox"]],["tab",["tablist"]]]),_U=new Set([...pj.values()].flat());RU=new Set(["select","jx-select"]);CU=["aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];LU=new Set(["button","input","select","textarea"])});function Np(e){return nt(e)==="dialog"}function gj(e){return e.startsWith("--")}function zU(e){let t=[];for(let{node:r}of zr(e)){let n=Zn(r);if(Np(r)&&n!==null&&!t.includes(n))t.push(n)}return t}function GU(e){let t=e.oncommand;return t!==void 0&&t!==null}function KU(e,t){for(let{node:r}of zr(e)){if(r===e)continue;let n=nt(r);if(n==="button"){let s=_t(r,"command"),i=_t(r,"commandfor");if(s!==null&&(s==="close"||s==="request-close")&&(i===null||i===t))return!0}if(n==="form"&&_t(r,"method")?.toLowerCase()==="dialog")return!0}return!1}function bj(e,t){let r=[...zr(e,[],null,t)],n=zU(e),s=Tp(e,t),i=n.length>0||s.length>0,o=new Map,a=new Map;for(let{node:c}of r){let u=Zn(c);if(u!==null&&!o.has(u))o.set(u,c);if(nt(c)==="button"){let p=_t(c,"commandfor"),g=_t(c,"command");if(p!==null){let m=a.get(p)??new Set;m.add(g??""),a.set(p,m)}}}let l=[];for(let{node:c,path:u}of r)if(l.push(...YU(c,u,o,n,s,i,t)),Np(c))l.push(...XU(c,u,a));return l}function YU(e,t,r,n,s,i,o){let a=[],l=nt(e),c=o?.invokerTags?.has(l)??!1,u=_t(e,"command"),p=_t(e,"commandfor");if(!(u!==null||p!==null||("command"in Gr(e))||("commandfor"in Gr(e))))return a;let m=It(e,"the element");if(!UU.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. ${Ve}`,fix:"invoker",message:`<${l||"element"}> carries command/commandfor, which only <button> supports.`,path:t,rule:"invoker-not-button",severity:"error"}),a;if(u!==null&&!BU.has(u)&&!gj(u))return a.push({detail:`\`command\` is an enumerated attribute taking ${yj.map((b)=>`\`${b}\``).join(", ")}, or a custom command starting with \`--\`. Anything else is the invalid-value state, and a button in that state does nothing when clicked. ${Ve}`,message:`${m} declares command="${u}", which is not a built-in or --custom command.`,path:t,rule:"command-invalid",severity:"error"}),a;if(p!==null){let b=r.get(p),h=n.includes(p),y=s.includes(p);if(!b&&i){let v=[...n,...s].map((j)=>`"${j}"`).join(", ");return a.push({detail:`No element in this document has the id "${p}". The dialogs and popovers here are: ${v}. A commandfor that names nothing does nothing, silently. ${Ve}`,message:`commandfor="${p}" names nothing in this document.`,path:t,rule:"command-target-missing",severity:"error"}),a}if(u!==null&&b){if(qU.has(u)&&!Np(b))a.push({detail:`\`${u}\` acts on a <dialog>, and "${p}" is ${y?"a popover":`a <${nt(b)||"element"}>`}. The click is ignored. ${y?"Use `toggle-popover`, `show-popover` or `hide-popover` for a popover.":"Point it at a dialog, or make the target one."} ${Ve}`,message:`${m} sends ${u} to "${p}", which is not a dialog.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(HU.has(u)&&!ra(b,o))a.push({detail:`\`${u}\` acts on a popover, and "${p}" is ${h?"a dialog":`a <${nt(b)||"element"}>`} that declares no \`popover\`. The click is ignored. ${h?"Use `show-modal`, `close` or `request-close` for a dialog.":"Give the target a `popover` attribute, or point the button elsewhere."} ${Ve}`,message:`${m} sends ${u} to "${p}", which is not a popover.`,path:t,rule:"command-target-mismatch",severity:"error"});else if(gj(u)&&!GU(b))a.push({detail:`A custom command is a \`CommandEvent\` dispatched at its target, and "${p}" has no `+"`oncommand` handler to answer it — so the click does nothing. Add one that switches on "+`\`event#/command\`, or use a built-in command. ${Ve}`,message:`${m} sends ${u} to "${p}", which handles no command.`,path:t,rule:"custom-command-unhandled",severity:"warn"})}}return a}function XU(e,t,r){let n=[],s=It(e,"the dialog"),i=Zn(e),{style:o}=e,a=_t(e,"closedby");if(a!==null&&!WU.has(a))n.push({detail:`\`closedby\` is an enumerated attribute taking \`any\` (light dismiss and Escape), \`closerequest\` (Escape only, the default for a modal) or \`none\`. Anything else is the invalid-value default, \`auto\`, which is the same as leaving it out. ${Ve}`,message:`${s} declares closedby="${a}", which is not any, closerequest or none.`,path:t,rule:"dialog-closedby-invalid",severity:"error"});if(Nt(o,"display")!==null)n.push({detail:`A closed dialog is hidden by the browser's own \`dialog:not([open]) { display: none }\`. That rule is UA-origin, so any author \`display\` beats it, and the dialog is laid out on every page whether or not anyone opened it. \`display\` belongs in the \`&[open]\` rule and nowhere else. ${Ve}`,fix:"display",message:`${s} sets display in its base rule.`,path:t,rule:"dialog-display",severity:"error"});let l=i===null?void 0:r.get(i),c=_t(e,"open")!==null||Gr(e).open===!0||e.open===!0;if(i!==null&&!l?.has("show-modal")&&!c)n.push({detail:`No <button> in this document opens it with \`command="show-modal"\`. If it is opened from another file or from a function that calls \`showModal()\`, this is fine; otherwise there is no way for a reader to open it. ${Ve}`,message:`${s} has no invoker in this document.`,path:t,rule:"dialog-no-invoker",severity:"warn"});if(l?.has("show-modal")&&a==="none"&&!KU(e,i))n.push({detail:`A modal dialog makes everything outside it inert, so the only ways out are the ones it offers: \`closedby="none"\` turns off Escape and light dismiss, and nothing inside it closes it. A reader who opens it cannot leave. Add a <button command="close"> inside, or drop \`closedby="none"\`. ${Ve}`,message:`${s} opens modally, closes on nothing, and has no close button.`,path:t,rule:"modal-without-close",severity:"error"});return n}var yj,qU,HU,VU,BU,WU,UU;var xj=q(()=>{$e();wc();yj=["toggle-popover","show-popover","hide-popover","show-modal","close","request-close"],qU=new Set(["show-modal","close","request-close"]),HU=new Set(["toggle-popover","show-popover","hide-popover"]),VU=["any","closerequest","none"],BU=new Set(yj),WU=new Set(VU),UU=new Set(["button"])});var Rj=C(function(jj){Object.defineProperty(jj,"__esModule",{value:!0});jj.formatNames=jj.fastFormats=jj.fullFormats=void 0;function Yr(e,t){return{validate:e,compare:t}}jj.fullFormats={date:Yr(Sj,Dp),time:Yr(Mp(!0),Lp),"date-time":Yr($j(!0),_j),"iso-time":Yr(Mp(),Ej),"iso-date-time":Yr($j(),Pj),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:n6,"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:u6,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:s6,int32:{type:"number",validate:a6},int64:{type:"number",validate:l6},float:{type:"number",validate:wj},double:{type:"number",validate:wj},password:!0,binary:!0};jj.fastFormats={...jj.fullFormats,date:Yr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Dp),time:Yr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Lp),"date-time":Yr(/^\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,_j),"iso-time":Yr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Ej),"iso-date-time":Yr(/^\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,Pj),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};jj.formatNames=Object.keys(jj.fullFormats);function ZU(e){return e%4===0&&(e%100!==0||e%400===0)}var QU=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,e6=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Sj(e){let t=QU.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],s=+t[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&ZU(r)?29:e6[n])}function Dp(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Ip=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Mp(e){return function(r){let n=Ip.exec(r);if(!n)return!1;let s=+n[1],i=+n[2],o=+n[3],a=n[4],l=n[5]==="-"?-1:1,c=+(n[6]||0),u=+(n[7]||0);if(c>23||u>59||e&&!a)return!1;if(s<=23&&i<=59&&o<60)return!0;let p=i-u*l,g=s-c*l-(p<0?1:0);return(g===23||g===-1)&&(p===59||p===-1)&&o<61}}function Lp(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function Ej(e,t){if(!(e&&t))return;let r=Ip.exec(e),n=Ip.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var Jp=/t|\s/i;function $j(e){let t=Mp(e);return function(n){let s=n.split(Jp);return s.length===2&&Sj(s[0])&&t(s[1])}}function _j(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function Pj(e,t){if(!(e&&t))return;let[r,n]=e.split(Jp),[s,i]=t.split(Jp),o=Dp(r,s);if(o===void 0)return;return o||Lp(n,i)}var t6=/\/|:/,r6=/^(?:[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 n6(e){return t6.test(e)&&r6.test(e)}var vj=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function s6(e){return vj.lastIndex=0,vj.test(e)}var i6=-2147483648,o6=2147483647;function a6(e){return Number.isInteger(e)&&e<=o6&&e>=i6}function l6(e){return Number.isInteger(e)}function wj(){return!0}var c6=/[^\\]\\Z/;function u6(e){if(c6.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Cj=C(function(Oj){Object.defineProperty(Oj,"__esModule",{value:!0});var f6=dp(),p6=mp(),m6=vp(),h6=_p(),Aj=Pp(),g6=[f6.default,p6.default,(0,m6.default)(),h6.default,Aj.metadataVocabulary,Aj.contentVocabulary];Oj.default=g6});var Tj=C(function(Eee,b6){b6.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 Ij=C(function(Zt,qp){Object.defineProperty(Zt,"__esModule",{value:!0});Zt.MissingRefError=Zt.ValidationError=Zt.CodeGen=Zt.Name=Zt.nil=Zt.stringify=Zt.str=Zt._=Zt.KeywordCxt=Zt.Ajv=void 0;var x6=up(),$6=Cj(),v6=kp(),Nj=Tj(),w6=["/properties"],_c="http://json-schema.org/draft-07/schema";class na extends x6.default{_addVocabularies(){if(super._addVocabularies(),$6.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(v6.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Nj,w6):Nj;this.addMetaSchema(e,_c,!1),this.refs["http://json-schema.org/schema"]=_c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_c)?_c:void 0)}}Zt.Ajv=na;qp.exports=Zt=na;qp.exports.Ajv=na;Object.defineProperty(Zt,"__esModule",{value:!0});Zt.default=na;var S6=Si();Object.defineProperty(Zt,"KeywordCxt",{enumerable:!0,get:function(){return S6.KeywordCxt}});var Ni=ye();Object.defineProperty(Zt,"_",{enumerable:!0,get:function(){return Ni._}});Object.defineProperty(Zt,"str",{enumerable:!0,get:function(){return Ni.str}});Object.defineProperty(Zt,"stringify",{enumerable:!0,get:function(){return Ni.stringify}});Object.defineProperty(Zt,"nil",{enumerable:!0,get:function(){return Ni.nil}});Object.defineProperty(Zt,"Name",{enumerable:!0,get:function(){return Ni.Name}});Object.defineProperty(Zt,"CodeGen",{enumerable:!0,get:function(){return Ni.CodeGen}});var E6=Fo();Object.defineProperty(Zt,"ValidationError",{enumerable:!0,get:function(){return E6.default}});var _6=Ei();Object.defineProperty(Zt,"MissingRefError",{enumerable:!0,get:function(){return _6.default}})});var Jj=C(function(Mj){Object.defineProperty(Mj,"__esModule",{value:!0});Mj.formatLimitDefinition=void 0;var k6=Ij(),Or=ye(),es=Or.operators,Pc={formatMaximum:{okStr:"<=",ok:es.LTE,fail:es.GT},formatMinimum:{okStr:">=",ok:es.GTE,fail:es.LT},formatExclusiveMaximum:{okStr:"<",ok:es.LT,fail:es.GTE},formatExclusiveMinimum:{okStr:">",ok:es.GT,fail:es.LTE}},R6={message:({keyword:e,schemaCode:t})=>Or.str`should be ${Pc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Or._`{comparison: ${Pc[e].okStr}, limit: ${t}}`};Mj.formatLimitDefinition={keyword:Object.keys(Pc),type:"string",schemaType:"string",$data:!0,error:R6,code(e){let{gen:t,data:r,schemaCode:n,keyword:s,it:i}=e,{opts:o,self:a}=i;if(!o.validateFormats)return;let l=new k6.KeywordCxt(i,a.RULES.all.format.definition,"format");if(l.$data)c();else u();function c(){let g=t.scopeValue("formats",{ref:a.formats,code:o.code.formats}),m=t.const("fmt",Or._`${g}[${l.schemaCode}]`);e.fail$data(Or.or(Or._`typeof ${m} != "object"`,Or._`${m} instanceof RegExp`,Or._`typeof ${m}.compare != "function"`,p(m)))}function u(){let g=l.schema,m=a.formats[g];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${s}": format "${g}" does not define "compare" function`);let b=t.scopeValue("formats",{key:g,ref:m,code:o.code.formats?Or._`${o.code.formats}${Or.getProperty(g)}`:void 0});e.fail$data(p(b))}function p(g){return Or._`${g}.compare(${r}, ${n}) ${Pc[s].fail} 0`}},dependencies:["format"]};var A6=(e)=>(e.addKeyword(Mj.formatLimitDefinition),e);Mj.default=A6});var qj=C(function(sa,Fj){Object.defineProperty(sa,"__esModule",{value:!0});var Ii=Rj(),C6=Jj(),Vp=ye(),Dj=new Vp.Name("fullFormats"),T6=new Vp.Name("fastFormats"),Bp=(e,t={keywords:!0})=>{if(Array.isArray(t))return Lj(e,t,Ii.fullFormats,Dj),e;let[r,n]=t.mode==="fast"?[Ii.fastFormats,T6]:[Ii.fullFormats,Dj],s=t.formats||Ii.formatNames;if(Lj(e,s,r,n),t.keywords)(0,C6.default)(e);return e};Bp.get=(e,t="full")=>{let n=(t==="fast"?Ii.fastFormats:Ii.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function Lj(e,t,r,n){var s,i;(s=(i=e.opts.code).formats)!==null&&s!==void 0||(i.formats=Vp._`require("ajv-formats/dist/formats").${n}`);for(let o of t)e.addFormat(o,r[o])}Fj.exports=sa=Bp;Object.defineProperty(sa,"__esModule",{value:!0});sa.default=Bp});import{existsSync as Vj,readFileSync as Bj,readdirSync as Wj,statSync as Uj}from"node:fs";import{createRequire as N6}from"node:module";import{join as zj,relative as Wp,resolve as Up}from"node:path";async function D6(){try{let{default:e}=await Promise.resolve().then(() => Lt(Op(),1)),{default:t}=await Promise.resolve().then(() => Lt(qj(),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 Gj(e,t={}){let r=Up(e),n=[],s=[],i=0;for(let S of["project.schema.json","document.schema.json"]){let _=Up(r,S);if(!Vj(_))continue;i+=1;let E=ia(_),O=F6(E);if(O.length>0)n.push({errors:O.map(({reason:R,ref:k})=>({message:`$ref "${k}" ${R} — committed entry documents must be self-contained `+"single-resource schemas; regenerate with `jx schema`"})),file:S})}if(n.length>0)return{checked:i,issues:n,lint:s,valid:!1};let o=await nj(r);if(i+=1,!o.valid)n.push({errors:o.errors??[],file:"project.json"});let{addFormats:a,Ajv:l}=await D6(),{document:c}=await nw(r,{write:!1}),u=new l({allErrors:!0,ownProperties:!0,strict:!1});a(u);let p=u.compile(c),g=oj(Hj(r).flatMap((S)=>{try{return[JSON.parse(Bj(S,"utf8"))]}catch{return[]}}));for(let S of I6)for(let _ of Xj(Up(r,S))){if(_.endsWith(".class.json"))continue;i+=1;let E=ia(_);if(p(E))s.push(...L6(E,Wp(r,_),g));else n.push({errors:p.errors??[],file:Wp(r,_)})}let m=new l({allErrors:!0,ownProperties:!0,strict:!1});a(m);let b=m.compile($f());for(let S of Hj(r)){i+=1;let _=ia(S);if(!b(_))n.push({errors:b.errors??[],file:Wp(r,S)})}let{config:h}=Rn(r),y=await kn(r,h),v=N6(import.meta.url);for(let S of y.extensions)for(let _ of["project","document","fields"]){let E=S.schemas[_];if(!E)continue;i+=1;let O=new l({allErrors:!0,ownProperties:!0,strict:!1});a(O);for(let R of J6){let k=v.resolve(R);O.addSchema(ia(k))}try{O.compile(ia(E))}catch(R){n.push({errors:[{message:R instanceof Error?R.message:String(R)}],file:`${S.specifier} (${_} fragment)`})}}let j=t.strict===!0&&s.some((S)=>S.severity==="error");return{checked:i,issues:n,lint:s,valid:n.length===0&&!j}}function ia(e){return JSON.parse(Bj(e,"utf8"))}function L6(e,t,r){let n=[];for(let s of dj(e,r))n.push({...zp(s),file:t,source:"popover"});for(let s of bj(e,r))n.push({...zp(s),file:t,source:"dialog"});for(let s of mj(e))n.push({...zp(s),criterion:s.criterion,file:t,source:"accessibility"});return n}function zp(e){return{detail:e.detail,message:e.message,path:e.path,rule:e.rule,severity:e.severity}}function Kj(e){return e.lint.map((t)=>{let r=t.criterion===void 0?`${t.source}/${t.rule}`:`${t.source}/${t.rule}, WCAG ${t.criterion}`;return`${t.file}: ${t.severity}: ${t.message} [${r}]`})}function F6(e){let t=[],r=new Set,n=(i)=>{let o=e;for(let a of i.slice(1).split("/")){if(a==="")continue;let l=a.replaceAll("~1","/").replaceAll("~0","~");if(!F(o))return!1;if(o=o[l],o===void 0)return!1}return!0},s=(i)=>{if(!z(i)||r.has(i))return;r.add(i);let o=i.$ref;if(N(o)){if(/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(o))t.push({reason:"is an absolute URI editors resolve over the network",ref:o});else if(!o.startsWith("#"))t.push({reason:"is a relative path only Node module resolution can follow",ref:o});else if(o.length>1&&!o.startsWith("#/"))t.push({reason:"is an $anchor reference, which has no root-pointer form",ref:o});else if(o.length>1&&!n(o.slice(1)))t.push({reason:"points at no node in this document",ref:o})}for(let[a,l]of Object.entries(i)){if(!q6.has(a))continue;if(Array.isArray(l))for(let c of l)s(c);else if(z(l)){if(s(l),Yj.has(a))for(let c of Object.values(l))s(c)}}};return s(e),t}function Xj(e){if(!Vj(e))return[];let t=[];for(let r of Wj(e)){let n=zj(e,r);if(Uj(n).isDirectory())t.push(...Xj(n));else if(r.endsWith(".json"))t.push(n)}return t.toSorted()}function Hj(e){let t=[],r=(n)=>{for(let s of Wj(n)){if(M6.has(s))continue;let i=zj(n,s);if(Uj(i).isDirectory())r(i);else if(s.endsWith(".class.json"))t.push(i)}};return r(e),t.toSorted()}function Zj(e){let t=[];for(let r of e.issues){t.push(`${r.file}:`);for(let n of r.errors){let s=z(n)?n:{},{instancePath:i,message:o}=s;t.push(` - ${i||"/"}: ${o??JSON.stringify(n)}`)}}return t}var I6,M6,J6,Yj,q6;var Qj=q(()=>{G0();sj();hj();xj();wc();$e();nn();Vi();af();I6=["components","pages","layouts"],M6=new Set(["node_modules","dist",".git"]),J6=["@jxsuite/schema/schemas/project.core.schema.json","@jxsuite/schema/schemas/project.fields.schema.json","@jxsuite/schema/schemas/document.paths.schema.json"];Yj=new Set(["$defs","definitions","dependencies","dependentSchemas","patternProperties","properties"]),q6=new Set([...Yj,"additionalItems","additionalProperties","allOf","anyOf","contains","contentSchema","else","if","items","not","oneOf","prefixItems","propertyNames","then","unevaluatedItems","unevaluatedProperties"])});nr();import{relative as Gp,resolve as ek}from"node:path";async function H6(){let e=process.argv.slice(2),[t]=e;if(!t||t==="--help"||t==="-h")console.log(`Usage: jx <command> [options]
570
570
 
571
571
  Commands:
572
572
  build [root] Build a Jx site to dist/
@@ -582,8 +582,8 @@ Options:
582
582
  --port <n> dev/preview: port to listen on (default 3000 / 4173)
583
583
  --dry-run db push: print the statements without executing them
584
584
  --connection db push: restrict to one connection name
585
- --strict validate: fail on an overlay or accessibility lint error, not only a schema error`),process.exit(0);let r=t==="db",n=r?e[1]:null,s=e.slice(r?2:1),i=new Set,o=[],a,l;for(let p=0;p<s.length;p+=1){let h=s[p];if(h==="--connection")p+=1,a=s[p];else if(h==="--port"){p+=1;let m=Math.trunc(Number(s[p]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(h.startsWith("--"))i.add(h);else o.push(h)}let[c]=o,d=Bj(c??".");if(r){if(n!=="push")console.error(`Unknown db subcommand: ${n??"(none)"}
586
- Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() => _m());let m={dryRun:p};if(a!==void 0)m.connection=a;let{results:b,bindingsPatched:g,wranglerPath:y}=await Em(d,m);for(let v of b){let j=v.applied?"applied":"dry-run";console.log(`${v.connection} (${v.provider}) — ${v.tables.length} table(s), ${v.statements.length} statement(s) [${j}]`);for(let S of v.statements)console.log(` ${S}`);for(let S of v.warnings)console.warn(` warning: ${S}`)}if(g&&y)console.log(`Updated bindings in ${qp(d,y)}`)}catch(h){console.error(`db push failed: ${Ee(h)}`),process.exit(1)}return}if(t==="build"){let p=i.has("--verbose"),h=!i.has("--no-clean");console.log(`Building site from ${d}...`);try{await Promise.resolve().then(() => jv());let b=await vv(d,{clean:h,verbose:p});if(b.errors.length>0){console.error(`
587
- Build completed with ${b.errors.length} error(s):`);for(let g of b.errors)console.error(` - ${g}`);process.exit(1)}console.log(`
588
- Done: ${b.routes} routes → ${b.files} files`)}catch(m){console.error(`Build failed: ${Ee(m)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => Rv());kv(d,l)}catch(p){console.error(Ee(p)),process.exit(1)}else if(t==="preview"){let{existsSync:p}=await import("node:fs"),h=Bj(d,"dist");if(!p(h))console.error(`No build output at ${h} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => Nv());let b=l??4173;Cv(h,b),console.log(`Previewing ${h} at http://localhost:${b}`)}else if(t==="schema")try{await Promise.resolve().then(() => Qd());let{projectSchemaPath:h,documentSchemaPath:m}=await Uv(d);console.log(`Wrote ${qp(d,h)}`),console.log(`Wrote ${qp(d,m)}`)}catch(p){console.error(`Schema generation failed: ${Ee(p)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => Vj());let b=await Dj(d,{strict:i.has("--strict")}),g=Lj(b);if(b.valid){console.log(`Project is valid (${b.checked} files checked in ${d})`);for(let y of g)console.log(y)}else{console.error(`Project is INVALID (${d}):`);for(let y of[...Hj(b),...g])console.error(y);process.exit(1)}}catch(p){console.error(`Validation failed: ${Ee(p)}`),process.exit(1)}else console.error(`Unknown command: ${t}
589
- Run "jx --help" for usage.`),process.exit(1)}var Oee=R6();export{Oee as ready};
585
+ --strict validate: fail on an overlay or accessibility lint error, not only a schema error`),process.exit(0);let r=t==="db",n=r?e[1]:null,s=e.slice(r?2:1),i=new Set,o=[],a,l;for(let p=0;p<s.length;p+=1){let g=s[p];if(g==="--connection")p+=1,a=s[p];else if(g==="--port"){p+=1;let m=Math.trunc(Number(s[p]??""));if(Number.isFinite(m)&&m>=0)l=m}else if(g.startsWith("--"))i.add(g);else o.push(g)}let[c]=o,u=ek(c??".");if(r){if(n!=="push")console.error(`Unknown db subcommand: ${n??"(none)"}
586
+ Usage: jx db push [root] [--dry-run] [--connection <name>]`),process.exit(1);let p=i.has("--dry-run");try{await Promise.resolve().then(() => Cm());let m={dryRun:p};if(a!==void 0)m.connection=a;let{results:b,bindingsPatched:h,wranglerPath:y}=await Om(u,m);for(let v of b){let j=v.applied?"applied":"dry-run";console.log(`${v.connection} (${v.provider}) — ${v.tables.length} table(s), ${v.statements.length} statement(s) [${j}]`);for(let S of v.statements)console.log(` ${S}`);for(let S of v.warnings)console.warn(` warning: ${S}`)}if(h&&y)console.log(`Updated bindings in ${Gp(u,y)}`)}catch(g){console.error(`db push failed: ${we(g)}`),process.exit(1)}return}if(t==="build"){let p=i.has("--verbose"),g=!i.has("--no-clean");console.log(`Building site from ${u}...`);try{await Promise.resolve().then(() => Jv());let b=await Ov(u,{clean:g,verbose:p});if(b.errors.length>0){console.error(`
587
+ Build completed with ${b.errors.length} error(s):`);for(let h of b.errors)console.error(` - ${h}`);process.exit(1)}console.log(`
588
+ Done: ${b.routes} routes → ${b.files} files`)}catch(m){console.error(`Build failed: ${we(m)}`),process.exit(1)}}else if(t==="dev")try{await Promise.resolve().then(() => Lv());Dv(u,l)}catch(p){console.error(we(p)),process.exit(1)}else if(t==="preview"){let{existsSync:p}=await import("node:fs"),g=ek(u,"dist");if(!p(g))console.error(`No build output at ${g} — run \`jx build\` first.`),process.exit(1);await Promise.resolve().then(() => Vv());let b=l??4173;Hv(g,b),console.log(`Previewing ${g} at http://localhost:${b}`)}else if(t==="schema")try{await Promise.resolve().then(() => af());let{projectSchemaPath:g,documentSchemaPath:m}=await rw(u);console.log(`Wrote ${Gp(u,g)}`),console.log(`Wrote ${Gp(u,m)}`)}catch(p){console.error(`Schema generation failed: ${we(p)}`),process.exit(1)}else if(t==="validate")try{await Promise.resolve().then(() => Qj());let b=await Gj(u,{strict:i.has("--strict")}),h=Kj(b);if(b.valid){console.log(`Project is valid (${b.checked} files checked in ${u})`);for(let y of h)console.log(y)}else{console.error(`Project is INVALID (${u}):`);for(let y of[...Zj(b),...h])console.error(y);process.exit(1)}}catch(p){console.error(`Validation failed: ${we(p)}`),process.exit(1)}else console.error(`Unknown command: ${t}
589
+ Run "jx --help" for usage.`),process.exit(1)}var Kee=H6();export{Kee as ready};