@jxsuite/compiler 9.1.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +258 -242
- package/dist/compiler.js +181 -158
- package/package.json +9 -8
- package/src/compiler.ts +13 -8
- package/src/shadow.ts +6 -33
- package/src/shared.ts +1301 -176
- package/src/site/base-path.ts +88 -2
- package/src/site/client-runtime.ts +13 -14
- package/src/site/image-transform.ts +122 -29
- package/src/site/site-build.ts +248 -93
- package/src/targets/compile-client.ts +143 -37
- package/src/targets/compile-element.ts +388 -48
- package/src/targets/compile-pack.ts +234 -0
- package/src/targets/compile-static.ts +15 -3
package/dist/compiler.js
CHANGED
|
@@ -1,193 +1,219 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function
|
|
3
|
-
`)n[
|
|
4
|
-
`)r(
|
|
5
|
-
`){if(e.charAt(
|
|
1
|
+
import{createRequire as rf}from"node:module";var Xp=Object.create;var{getPrototypeOf:Zp,defineProperty:ba,getOwnPropertyNames:Qp}=Object;var $a=Object.prototype.hasOwnProperty;function ef(e){return this[e]}var tf,nf,Iy=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?tf??=new WeakMap:nf??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?Xp(Zp(e)):{};let i=t||!e||!e.__esModule||!$a.call(e,"default")?ba(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let l of Qp(e))if(!$a.call(i,l))ba(i,l,{get:ef.bind(e,l),enumerable:!0})}if(r)s.set(e,i);return i};var Ly=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var v=(e,t,n)=>()=>{if(e)try{t=e(e=0)}catch(r){n=[r]}if(n)throw n[0];return t};var Vy=rf(import.meta.url);function y(e){return typeof e==="string"}function Y(e){return typeof e==="number"}function le(e){return typeof e==="boolean"}function je(e){return typeof e==="function"}function j(e){return typeof e==="object"&&e!==null}function A(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function _(e){return A(e)&&typeof e.$ref==="string"}function me(e){return A(e)&&e.$prototype==="Function"}function Ne(e){return A(e)&&A(e.$expression)}function Qe(e){return Ne(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function et(e){return me(e)&&Array.isArray(e.body)}function ct(e){return A(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function ut(e){return A(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Dr(e){return A(e)&&!e.$prototype&&!e.$expression&&"default"in e}function Et(e){if(!A(e))return!1;for(let t of Object.keys(e))if(!mo.has(t))return!1;return!0}function Ea(e){if(!A(e))return!1;for(let t of Object.keys(e))if(mo.has(t))return!0;return!1}function Q(e){return A(e)&&e.$prototype==="Array"}function va(e){return(Array.isArray(e)?e:[e]).some((n)=>Q(n))}function Ja(e){return A(e)&&e.$prototype==="Class"}function Be(e){return A(e)}function B(e){return typeof e==="string"&&e.includes("${")}function Oa(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(Mt(e))}function go(e){return e.$prototype==="Function"||y(e.role)&&e.role!=="field"}function Mt(e){if(!/[/'"`]/u.test(e))return e;let t=_r.get(e);if(t!==void 0)return t;let n=Ca(e);if(_r.size>=ja)_r.clear();return _r.set(e,n),n}function Aa(e){if(!e.includes("${"))return sf;let t=Mr.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];Ca(e.slice(r),s);let o=-1;for(let l=0;l<s.length;l+=2){let c=r+(s[l]??0),a=s[l+1]??-1;if(a===-1){o=c;break}n.push(Sa(e,c,r+a))}if(o===-1)break;let i=of(e,o);if(i===-1)r=o+2;else n.push(Sa(e,o,i)),r=i}if(Mr.size>=ja)Mr.clear();return Mr.set(e,n),n}function Sa(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function of(e,t){let n=0;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s==="{")n+=1;else if(s==="}"){if(n-=1,n===0)return r+1}}return-1}function lf(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function wa(e,t){let n=!1;for(let r=t+1;r<e.length;r+=1){let s=e.charAt(r);if(s===`
|
|
2
|
+
`)return-1;if(s==="\\")r+=1;else if(s==="[")n=!0;else if(s==="]")n=!1;else if(s==="/"&&!n)return r+1}return-1}function Ca(e,t){let n=e.split(""),r=(a)=>{if(n[a]!==void 0&&n[a]!==`
|
|
3
|
+
`)n[a]=" "},s=[],o=t!==void 0,i="",l=-1,c=0;while(c<e.length){let a=e.charAt(c);if(o)if(a==="\\")r(c),r(c+1),c+=2;else if(a==="`"&&!(t&&s.length===0))o=!1,i=a,c+=1;else if(a==="$"&&e.charAt(c+1)==="{"){if(s.length===0)t?.push(c,-1);s.push(0),o=!1,i="{",c+=2}else r(c),c+=1;else if(a==="/"&&e.charAt(c+1)==="/")while(c<e.length&&e.charAt(c)!==`
|
|
4
|
+
`)r(c),c+=1;else if(a==="/"&&e.charAt(c+1)==="*"){let u=e.indexOf("*/",c+2),f=u===-1?e.length:u+2;for(;c<f;c+=1)r(c)}else if(a==="'"||a==='"'){c+=1;while(c<e.length&&e.charAt(c)!==a&&e.charAt(c)!==`
|
|
5
|
+
`){if(e.charAt(c)==="\\")r(c),c+=1;r(c),c+=1}i=a,c+=1}else if(a==="`")o=!0,c+=1;else if(t&&a==="/"&&af.has(i)&&!lf(e,i,l)&&wa(e,c)>0){let u=wa(e,c);for(c+=1;c<u-1;c+=1)r(c);i="/",c=u}else{let u=s.length-1;if(u>=0&&a==="{")s[u]=(s[u]??0)+1;else if(u>=0&&a==="}")if(s[u]===0){if(s.pop(),o=!0,t&&s.length===0)t[t.length-1]=c+1}else s[u]=(s[u]??1)-1;if(a.trim()!=="")i=a,l=c;c+=1}}return n.join("")}function cf(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Ir(e){if(!e)return[];return e.map((t)=>y(t)?t:t.name)}function uf(e){return typeof e==="string"}function qe(e){if(typeof e!=="object"||e===null||Array.isArray(e)||!A(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 A(t.cases)&&Object.values(t.cases).every((n)=>y(n))&&typeof t.default==="string";return!1}function Yt(e){if(uf(e))return[e];if(!qe(e))return[];let t=e.$expression;if(t.operator==="?:")return[...new Set([t.value,t.initial])];return[...new Set([...Object.values(t.cases),t.default])]}function Xt(e){return e.startsWith("#")}function Zt(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}var mo,_r,ja=2048,sf,Mr,af;var K=v(()=>{mo=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);_r=new Map;sf=[],Mr=new Map;af=new Set("(,=:[!&|?{;+-*%<>~^")});function pf(e,t){let n=e.slice(0,t),r=n.split(`
|
|
6
6
|
`).length;return{column:t-n.lastIndexOf(`
|
|
7
|
-
`),line:r}}function
|
|
7
|
+
`),line:r}}function yo(e,t,n,r){return{...pf(e,t),kind:n,message:r,offset:t}}function ff(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function ka(e){for(let t of[e,`return async function () {
|
|
8
8
|
${e}
|
|
9
|
-
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function
|
|
9
|
+
}`])try{return Reflect.construct(Function,[t])!==null}catch{}return!1}function Pa(e){xo=e,Lr=null}function mf(e,t){if(!Lr){if(!xo)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Lr=xo()}return Lr(e,t)}function _a(e,t,n){return mf(e,(r)=>{let s=ff(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(yo(e,s,"unsupported",`\`${o}\` is TypeScript that has to be compiled rather than erased. ${t} may use only types that can be removed: no enum, value namespace or parameter property`))})}function gf(e){return Mt(e).includes("<")||!ka(e)}function hf(e){let t=ho.get(e);if(t)return t;if(!gf(e)){let i={code:e,problems:[]};return ho.set(e,i),i}let n=[],r=_a(e,"A function body",n),s=Mt(r);for(let i of s.matchAll(df)){let l=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(yo(e,l,"unsupported",`A function body cannot ${i[3]??"import"}. Move code that needs a module into one of its own, named by $src`))}if(r!==e&&n.length===0&&ka(e)){let i=[...e].findIndex((l,c)=>l!==r[c]);n.push(yo(e,Math.max(i,0),"meaning","This was already JavaScript, and reading it as TypeScript changes it: `a < b > (c)` is a generic call in TypeScript and two comparisons in JavaScript. Add parentheses if a comparison is meant"))}let o={code:r,problems:n};return ho.set(e,o),o}function qy(e){let t=Na.get(e);if(t)return t;let n=[],s={code:_a(e,"A script",n),problems:n};return Na.set(e,s),s}function yf(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function Ra(e,t,n){if(y(e))return Ta(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>y(r)))return Ta(e.join(`
|
|
10
10
|
`),t,n).split(`
|
|
11
|
-
`);return e}function
|
|
12
|
-
${e.text}`}function sp(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([l,a])=>`${l}: ${a}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function op(e){let t=Object.keys(e).filter((r)=>Cn(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function ip(e){let n=Fs(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function Lt(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(g)=>g,transposeSelector:o=(g)=>g,resolveValue:i}=t,l=[],a=(g)=>g!==null&&typeof g==="object"&&!Array.isArray(g)&&!Y(g),c=(g,x)=>{if(a(x))return[x];if(!jn(g)||!Array.isArray(x)||x.length===0)return[];return x.every((w)=>a(w))?x:[]},u=(g,x,w,O)=>{if(x===void 0||x===null)return null;if(Y(x))return w?i?.(g,x,O)??null:null;if(E(x))return null;let A=String(x);if(B(A))return w?i?.(g,A,O)??null:null;return s(A)},p=(g,x,w=!0,O="self")=>{let A=[];for(let[T,_]of Object.entries(g)){if(c(T,_).length>0)continue;if(x&&(T.startsWith("@")||dt(T)))continue;if(T.startsWith("$"))continue;let G=u(T,_,w,O);if(G!==null)A.push([Ws(T),G])}return A},d=(g)=>b(g)&&g!==""?{description:g}:{},f=(g,x,w,O,A)=>{if(w.length===0)return;let T=x;if(T!==null){let N=o(T);if(N===null)return;T=N}let _=na(g,T,w),G={text:_,conditions:[...g],selector:T,declarations:w,target:O,key:dr(_)};l.push({...G,...d(A)})},y=(g,x,w)=>{let O=g.slice(10).trim();if(O==="")return;let A=[];for(let[_,G]of Object.entries(x)){if(!a(G))continue;let N=p(G,!0,!1,"unscoped");if(N.length>0)A.push({declarations:N,selector:_.trim()})}if(A.length===0)return;let T=sp(w,O,A);l.push({blocks:A,conditions:[...w],declarations:[],key:dr(T),selector:null,target:"unscoped",text:T,...d(x.$description)})},h=(g,x,w,O,A)=>{if(g==="@--")return;if(jn(g)){f([...O,g],null,p(x,!1,!0,"unscoped"),"unscoped",x.$description);return}if(Cn(g)){y(g,x,O);return}let T=ea(g,r),_=T===null?g:`@media ${T}`,G=T===null?null:rt(T);if(G!==null&&w!==null){let{auto:N,forced:H}=Vs(w,G);m(x,N,[...O,_],A),m(op(x),H,O,A);return}m(x,w,[...O,_],A)};function m(g,x,w,O){f(w,x,p(g,!0,!0,O),O,g.$description);for(let[A,T]of Object.entries(g))for(let _ of c(A,T))if(A.startsWith("@"))h(A,_,x,w,O);else if(x!==null)m(_,ta(x,A),w,ip(A)?O:"descendant")}return m(e,n,[],"self"),l}var tp,Ie="data-color-scheme",gr="jx-color-scheme";var Tn=S(()=>{q();tp=new Set(["all","print","screen","speech"])});function oa(){return`the Intl helpers ${Bs.join(", ")}`}var ze="en-US",Hs="UTC",ra,Bs,sa;var qs=S(()=>{ra=[{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."}],Bs=ra.map((e)=>e.path),sa=Object.fromEntries(ra.map((e)=>[e.path,e.params.indexOf("locale")]))});function ap(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function Se(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Ke(e){if(e==="")return[];return e.split("/").map((t)=>ap(t))}function de(e,t){let n=e;for(let r of Ke(t))n=n?.[r];return n}function W(e,t){let n=e;for(let r of Ke(t))n+=Us.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function ia(e,t){let n=e;for(let[r,s]of Ke(t).entries()){let o=r===0?"":"?.";n+=Us.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function st(e){return Us.test(e)?e:JSON.stringify(e)}function aa(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Us;var Ft=S(()=>{Us=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function zs(e){let t=e.$map;return E(t)?t:void 0}function xr(e){return E(e)&&!Array.isArray(e)&&"operator"in e}function Vt(e){return E(e)&&!Array.isArray(e)&&"$ref"in e}function pp(e,t,n){let r=sa[e];if(r===void 0||r<0||t[r]!=null)return t;let s=de(n.$page,"locale");if(!b(s)||s==="")return t;let o=[...t];return o[r]=s,o}function ma(){return globalThis.window??globalThis}function ga(e){return e.startsWith("window#/")&&cp.has(e.slice(8))}function Ge(e){return pa.has(e)}function hr(e){if(Array.isArray(e))return e.some((t)=>hr(t));if(e===void 0||!xr(e))return!1;return Ge(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>hr(t))||Object.values(e.cases??{}).some((t)=>hr(t))}function Rn(e){return et(e)&&!hr(e.$expression)}function Ks(e,t){if(Array.isArray(e)){for(let n of e)Ks(n,t);return}if(e===void 0||!E(e))return;if(Vt(e)){if(!fp.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Ke(n)[0]??"")}return}if(xr(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Ks(r,t)}}function eo(e){let t=new Set;return Ks(e.$expression,t),[...t]}function to(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Rn(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(eo(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function te(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>dp)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function Q(e,t,n,r,s){if(e===null||e===void 0)return e;if(xr(e))return Ne(e,t,n,r,s);if(Vt(e)){let o=yr(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return ha(e,t,n,r,s);return s?.report(s.path??[],e),e}function ha(e,t,n,r,s){return e.map((o,i)=>Q(o,t,n,r,te(s,i)))}function mp(e,t,n,r){let s=(o)=>{if(!e.slice(o.length).includes("/"))return t;return yr(e.slice(0,e.lastIndexOf("/")),t,n,r)};if(e.startsWith("#/state/"))return s("#/state/");if(e.startsWith("parent#/"))return s("parent#/");if(e.startsWith("$map/")||e.startsWith("$args/"))return e.split("/").length>2?yr(e.slice(0,e.lastIndexOf("/")),t,n,r):void 0;return}function yr(e,t,n,r){if(e==="$reduce/acc")return r?.acc;if(e.startsWith("$reduce/"))return r?.acc;if(e.startsWith("$args/")){let s=e.slice(6).split("/"),o=r?.args?.[s[0]];return s.length>1?de(o,s.slice(1).join("/")):o}if(e.startsWith("event#/")){let s=e.slice(7);return de(n,s)}if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,l=zs(t);if(o==="item")i=r?.item??l?.item??t["$map/item"];else if(o==="index")i=r?.index??l?.index??t["$map/index"];else i=l?.[o]??t[`$map/${o}`];return s.length>2?de(i,s.slice(2).join("/")):i}if(e.startsWith("#/state/"))return de(t,e.slice(8));if(e.startsWith("parent#/"))return de(t,e.slice(8));if(e.startsWith("window#/"))return de(ma(),e.slice(8));if(e.startsWith("document#/"))return de(globalThis.document,e.slice(10));return de(t,e)??null}function gp(e,t,n,r){if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s,i,l=zs(t);if(o==="item")i=r?.item??l?.item??t["$map/item"];else if(o==="index")i=r?.index??l?.index??t["$map/index"];else i=l?.[o]??t[`$map/${o}`];if(s.length>2){let a=s.slice(2),c=a.pop(),u=a.length>0?de(i,a.join("/")):i;return{key:c,obj:u}}return{key:o==="item"?"$map/item":"$map/index",obj:zs(t)??t}}if(e.startsWith("#/state/")){let s=e.slice(8);if(s.indexOf("/")===-1)return{key:s,obj:t};let i=Ke(s),l=i.pop(),a=t;for(let c of i)a=a[c];return{key:l,obj:a}}return{key:e,obj:t}}function Ne(e,t,n,r,s){let o=hp(e,t,n,r,s);return s?.report(s.path??[],o),o}function ca(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function hp(e,t,n,r,s){let{operator:o,target:i,value:l,initial:a}=e;if(!lp.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Gs.has(o)&&!("value"in e)){let c=Q(i,t,n,r,te(s,"target"));if(o==="!")return!c;if(o==="-")return-c}if(o==="call"){let c=Vt(i)?i.$ref:void 0;if(!b(c))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>la)throw Error(`$expression: call depth exceeded (${la})`);let p=Array.isArray(l)?l.map((f,y)=>Q(f,t,n,r,te(s,["value",y]))):[];if(c.startsWith("window#/")){if(!ga(c))throw Error(`$expression: "${c}" is not a blessed pure global`);let f=c.slice(8),y=up.get(f);if(y)return y(...pp(f,p,t));let h=ma(),m=de(h,f),g=f.lastIndexOf("/"),x=g===-1?h:de(h,f.slice(0,g));return m.apply(x,p)}let d=yr(c,t,n,r);if(Ae(d))return d.apply(mp(c,t,n,r),p);if(E(d)&&"$expression"in d){let f=d,y={};for(let[h,m]of(f.parameters??[]).entries()){let g=b(m)?m:m?.name??"";if(!g)continue;y[g]=p[h]===void 0&&E(m)&&"default"in m?m.default:p[h]}return Ne(f.$expression,t,n,{args:y,callDepth:u})}throw TypeError(`$expression: call target "${c}" is not callable`)}if(Zs.has(o)){if(o==="?:"){let f=Q(i,t,n,r,te(s,"target"));if(s){let y=Q(l,t,n,r,te(s,"value")),h=Q(a,t,n,r,te(s,"initial"));return f?y:h}return f?Q(l,t,n,r):Q(a,t,n,r)}let c=Q(i,t,n,r,te(s,"target")),u=String(c),p=e.cases??{},d=Object.hasOwn(p,u);if(s){let f;for(let[h,m]of Object.entries(p)){let g=Q(m,t,n,r,te(s,["cases",h]));if(h===u)f=g}let y=Q(e.default,t,n,r,te(s,"default"));return d?f:y}return d?Q(p[u],t,n,r):Q(e.default,t,n,r)}if(Ys.has(o)){let c=Q(i,t,n,r,te(s,"target")),u=Q(l,t,n,r,te(s,"value"));switch(o){case"===":return c===u;case"!==":return c!==u;case"&&":return c&&u;case"||":return c||u;case"??":return c??u;default:return ca(o,c,u)}}if(fa.has(o)){let c=Q(l,t,n,r,te(s,"value")),{obj:u,key:p}=gp(i.$ref,t,n,r);u[p]=o==="="?c:ca(o.slice(0,-1),u[p],c);return}if(da.has(o)){let c=Q(i,t,n,r,te(s,"target"));switch(o){case"push":return c.push(Q(l,t,n,r,te(s,"value")));case"unshift":return c.unshift(Q(l,t,n,r,te(s,"value")));case"pop":return c.pop();case"shift":return c.shift();case"splice":{let u=Q(l,t,n,r,te(s,"value"));return c.splice(...u)}default:break}}if(Qs.has(o)){let c=Q(i,t,n,r,te(s,"target")),u=l===void 0?[]:Array.isArray(l)?ha(l,t,n,r,te(s,"value")):[Q(l,t,n,r,te(s,"value"))],p=de(c,o);if(!Ae(p))return;return p.apply(c,u)}if(Xs.has(o)){let c=Q(i,t,n,r,te(s,"target")),u=l;if(o==="reduce"){let p=Q(a,t,n,r,te(s,"initial"));for(let[d,f]of c.entries())p=Ne(u,t,n,{acc:p,index:d,item:f},d===0?te(s,"value"):void 0);return p}if(o==="map")return c.map((p,d)=>Ne(u,t,n,{...r,index:d,item:p},d===0?te(s,"value"):void 0));if(o==="filter")return c.filter((p,d)=>Ne(u,t,n,{...r,index:d,item:p},d===0?te(s,"value"):void 0))}return}function re(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(xr(e))return Je(e,t);if(Vt(e))return no(e.$ref,t);if(Array.isArray(e))return e.map((n)=>re(n,t)).join(", ");return JSON.stringify(e)}function yp(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function no(e,t){let n=t.statePrefix??"state",r=t.eventParam??"event";if(e==="$reduce/acc")return"_acc";if(e.startsWith("$reduce/"))return"_acc";if(e.startsWith("$args/"))return W("_args",e.slice(6));if(e.startsWith("event#/"))return W(r,e.slice(7));if(e.startsWith("$map/")){let s=e.split("/"),[,o]=s;if(o==="item")return s.length>2?W("_item",s.slice(2).join("/")):"_item";if(o==="index")return"_index";return`_${o}`}if(e.startsWith("#/state/"))return W(n,e.slice(8));if(e.startsWith("parent#/"))return W(n,e.slice(8));if(e.startsWith("window#/"))return W("window",e.slice(8));if(e.startsWith("document#/"))return W("document",e.slice(10));return W(n,e)}function ua(e,t){if(Vt(e))return no(e.$ref,t);return re(e,t)}function xp(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(ze)})`,o=JSON.stringify(Hs);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function Je(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(Gs.has(n)&&!("value"in e)){let i=re(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(Vt(r)?r.$ref:void 0)??"",l=Array.isArray(s)?s.map((a)=>re(a,t)):[];if(i.startsWith("window#/")){if(!ga(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let a=xp(i.slice(8),l,t);if(a)return a;return`window.${i.slice(8).replaceAll("/",".")}(${l.join(", ")})`}if(i.startsWith("#/state/")){let a=i.slice(8),c=t.formulaParams?.[a];if(c){let u=c.map((p,d)=>`${JSON.stringify(p)}: ${l[d]??"undefined"}`).join(", ");return`${yp(a)}(${t.statePrefix??"state"}, { ${u} })`}}return`${no(i,t)}(${l.join(", ")})`}if(Zs.has(n)){if(n==="?:"){let c=re(r,t),u=re(s,t),p=re(o,t);return`(${c} ? ${u} : ${p})`}let i=re(r,t),l=Object.entries(e.cases??{}).map(([c,u])=>`_d === ${JSON.stringify(c)} ? ${re(u,t)} : `).join(""),a="default"in e?re(e.default,t):"undefined";return`((_d) => ${l}${a})(String(${i}))`}if(Ys.has(n)){let i=re(r,t),l=re(s,t);return`(${i} ${n} ${l})`}if(fa.has(n)){let i=ua(r,t),l=re(s,t);return`${i} ${n} ${l}`}if(da.has(n)){let i=ua(r,t);switch(n){case"push":return`${i}.push(${re(s,t)})`;case"unshift":return`${i}.unshift(${re(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let l=Array.isArray(s)?s.map((a)=>re(a,t)).join(", "):re(s,t);return`${i}.splice(${l})`}default:break}}if(Qs.has(n)){let i=re(r,t),l=s===void 0?"":Array.isArray(s)?s.map((a)=>re(a,t)).join(", "):re(s,t);return`(${i})?.${n}?.(${l})`}if(Xs.has(n)){let i=re(r,t),l=Je(s,t);if(n==="reduce"){let a=re(o,t);return`${i}.reduce((_acc, _item, _index) => ${l}, ${a})`}if(n==="map")return`${i}.map((_item, _index) => ${l})`;if(n==="filter")return`${i}.filter((_item, _index) => ${l})`}return"undefined"}function Wt(e,t,n,r){return Q(e,t,n,r)}function ot(e,t={}){return re(e,t)}var pa,Gs,Ys,fa,da,Xs,Zs,Qs,lp,cp,up,fp,la=64,dp=64;var Ht=S(()=>{qs();q();Ft();pa=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Gs=new Set(["!","-"]),Ys=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),fa=new Set(["=","+=","-=","*=","/="]),da=new Set(["push","pop","shift","unshift","splice"]),Xs=new Set(["reduce","map","filter"]),Zs=new Set(["?:","switch"]),Qs=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"]),lp=new Set([...pa,...Gs,...Ys,...Xs,...Zs,...Qs,"call"]),cp=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",...Bs]),up=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??ze,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??ze,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??ze,{timeZone:Hs,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??ze,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??ze,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??ze,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??ze,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??ze,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);fp=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function $p(e){return e.startsWith(ya)}function gh(e){let t=e;if($p(t))t=t.slice(ya.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${ro}${t}.js`}function hh(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${ro}${n}`:`${ro}${n}.${t}`}function xa(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function $a(e){let t=xa(e);return t.startsWith("/")?t:`/${t}`}function bp(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function yh(e,t){let n=t.split("#")[0].split("?")[0];if(!n.startsWith("/"))return null;let r;try{r=decodeURIComponent(n)}catch{return null}if(/%2e|%2f/i.test(r))return null;for(let s of bp(e,"urlPrefix")){let o=$a(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let l=r.slice(o.length+1).split("/");if(l.some((c)=>c===""||c==="."||c===".."))return null;let{filter:a}=s;if(a&&!a(l.join("/")))return null;return`${xa(s.dir)}/${l.join("/")}`}return null}function xh(e,t){let n=new Set;for(let r of t){let s=$a(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${Sp}]+`,"g");for(let i of e.matchAll(o)){let l=i[0].split("#")[0].split("?")[0];if(!l.endsWith("/"))n.add(l)}}return[...n].filter(Boolean)}function wp(e){let t=[],n=0;while(n<e.length){while(n<e.length&&(/\s/.test(e[n])||e[n]===","))n+=1;if(n>=e.length)break;let r=n;while(n<e.length&&!/\s/.test(e[n]))n+=1;let s=e.slice(r,n);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(n<e.length&&/\s/.test(e[n]))n+=1;let o=n;while(n<e.length&&e[n]!==",")n+=1;let i=e.slice(o,n).trim();if(n+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:i,url:s})}return t}function Ep(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function $h(e){if(!b(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let n=t.replace(/\/+$/,"");if(n===""||n==="/")return"";return n.startsWith("/")?n:`/${n}`}function so(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function bh(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var ya="npm:",ro="/assets/",Sp;var oo=S(()=>{q();Sp=String.raw`"'\s<>()\\`});function ba(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 Jp(e){return(E(e)||Ae(e))&&"then"in e&&Ae(e.then)}async function Bt(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=ba(o);switch(i.kind){case"expression":{let l=Ne(i.node,t,n,s);if(Jp(l))await l;break}case"if":{let l=i.node,a=Wt(l.if,t,n,s)?l.then:l.else;if(Array.isArray(a))await Bt(a,t,n,r);break}case"switch":{let l=i.node,a=String(Wt(l.$switch,t,n,s)),c=l.cases??{},u=Object.hasOwn(c,a)?c[a]:l.default;if(Array.isArray(u))await Bt(u,t,n,r);break}case"dispatch":{let l=i.node,a=Ae(r.target)?r.target():r.target,c=n?.currentTarget??a;if(!c)break;let u={};if("detail"in l)u.detail=Wt(l.detail,t,n,s);if(l.bubbles!==void 0)u.bubbles=l.bubbles;if(l.composed!==void 0)u.composed=l.composed;c.dispatchEvent(new CustomEvent(l.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function ke(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=ba(s);switch(o.kind){case"expression":{r.push(`${n}${Je(o.node,t)};`);break}case"if":{let i=o.node,l=ot(i.if,t),a={...t,indent:`${n} `};if(r.push(`${n}if (${l}) {`,ke(i.then??[],a)),i.else)r.push(`${n}} else {`,ke(i.else,a));r.push(`${n}}`);break}case"switch":{let i=o.node,l=ot(i.$switch,t),a={...t,indent:`${n} `};r.push(`${n}switch (String(${l})) {`);for(let[c,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(c)}: {`,ke(u,a),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,ke(i.default,a),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,l=t.eventParam??"event",a=t.dispatchTarget??`(${l} && ${l}.currentTarget)`,c=[];if("detail"in i)c.push(`detail: ${ot(i.detail,t)}`);if(i.bubbles!==void 0)c.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)c.push(`composed: ${JSON.stringify(i.composed)}`);let u=c.length>0?`, { ${c.join(", ")} }`:"";r.push(`${n}${a}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
|
|
13
|
-
`)}var $r=S(()=>{q();Ht()});var io=S(()=>{q()});function uo(e){if(e===vp)return"client";if(e===Op)return"server";return null}function jp(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function wa(e,t){return`${co}${jp(e)}#${t}`}function Ea(e){return e.startsWith(co)}function Ja(e){if(!Ea(e))return null;let t=e.slice(co.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function ao(e,t){if(Array.isArray(e)){let r=e.map((s)=>ao(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!C(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&b(s)){let i=uo(s);o=i===null?s:wa(t,i)}else if(r!=="$script")o=ao(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function po(e,t){return ao(e,t)}function Np(e){return Ap.test(e)&&!Cp.test(e)}function Sa(e){return uo(e)==="client"||Ja(e)?.side==="client"}function lo(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())lo(s,[...t,r],n);return n}if(!C(e))return n;if(b(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")lo(s,[...t,r],n);return n}function Tp(e){let t=e.at(-1);return b(t)?`"${t}"`:"this entry"}function Ah(e){let t=lo(e,[],[]),n=t.some((s)=>!s.lazy&&Sa(s.src)),r=[];for(let s of t){let o=Tp(s.path);if(!s.lazy&&Np(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&Sa(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var co="jx-script:",vp="#client",Op="#server",Ap,Cp;var fo=S(()=>{q();Ap=/^\.{1,2}\//u,Cp=/\.json$/iu});function _p(e){for(let t of Object.keys(e))if(kp.has(t))return!0;return!1}function br(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Fi(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function Oa(){return[...va].toSorted()}function gt(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||va.has(n))return String(t);return t?"":null}function ja(e,t,n,r){let s=t.replaceAll(/-([a-z])/g,(i,l)=>l.toUpperCase());if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(be(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?ne(o)?0:"":i;return}e[s]=ne(o)?Number(n):n}function mo(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(b(r)&&B(r)){t.set(n,void 0);continue}if(E(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(Dp.some((s)=>(s in r))){t.set(n,void 0);continue}if(_p(r))continue}t.set(n,r)}return t}var kp,mt,va,Zh,Dp,go=32,Sr,wr="jx-slot",ho="data-jx-slots",yo="jx.slot.group",Qh;var Pn=S(()=>{Tn();Ht();Ft();q();On();oo();$r();io();fo();io();Tn();kp=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);mt=new Set(["$schema","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","name","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),va=new Set(["contenteditable","draggable","spellcheck"]);Zh=Object.freeze({emptyRow:!0});Dp=["$expression","$prototype","$ref","$src"],Sr=/^[\t\n\f\r ]+$/u,Qh=(()=>{let e=Symbol.for(yo),t=globalThis;return t[e]??=new WeakMap,t[e]})()});var Mp,Ip;var Aa=S(()=>{Mp={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."},Ip={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var Lp;var Ca=S(()=>{Lp={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 Fp,Vp,Wp;var Na=S(()=>{Fp={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Vp={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},Wp={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var Hp;var Ta=S(()=>{Hp={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 Bp,qp;var Ra=S(()=>{Bp={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"},qp={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 Up;var Pa=S(()=>{Up={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" encodes variants at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var zp;var ka=S(()=>{zp={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Kp,Gp,Yp,Xp,Zp,Qp,ef,tf,nf;var _a=S(()=>{Kp={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Gp={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Yp={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Xp={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Zp={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Qp={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"},ef={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},tf={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"},nf={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var rf;var Da=S(()=>{rf={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 sf,of;var Ma=S(()=>{sf={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"},of={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 af,lf,cf,uf,pf,ff;var Ia=S(()=>{af={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},lf={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"},cf={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},uf={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"},pf={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"},ff={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 df;var La=S(()=>{df={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 mf;var Fa=S(()=>{mf={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var gf,hf;var Va=S(()=>{gf={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"}]},hf={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 xo,yf;var Wa=S(()=>{xo=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],yf={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 xf;var Ha=S(()=>{xf={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 $f,bf,Sf,wf,Ef,Jf,vf,Of,jf,Af,Cf,Nf,Tf,Rf,Pf,kf,_f;var Ba=S(()=>{qs();$f={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"},bf={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."},Sf={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."},wf={enum:["!","-"]},Ef={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},Jf={const:"?:"},vf={const:"switch"},Of={const:"call"},jf={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"]},Af={enum:["=","+=","-=","*=","/="]},Cf={enum:["pop","shift"]},Nf={enum:["push","unshift"]},Tf={const:"splice"},Rf={const:"reduce"},Pf={enum:["map","filter"]},kf={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 "+`${oa()}) — 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"},_f={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 Df,Mf,If,Lf;var qa=S(()=>{Df={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"}]},Mf={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},If={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Lf={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 Ua,Ff,Vf,Wf,Hf,Bf,qf,Uf,zf,Kf,Gf;var za=S(()=>{Ua=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],Ff={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"},Vf={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"},Wf={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},Hf={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:Ua,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"},Bf={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"},qf={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"},Uf={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"},zf={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"},Kf={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"},Gf={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});function qt(e){if(!b(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Jy(e){let t=qt(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&Yf.has(r)?"rtl":"ltr"}function vy(e){let t=qt(e);if(t===null)return b(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Oy(e){let t=e.i18n,n=[];if(!E(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let l of r){let a=qt(l);if(a===null){n.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(a))s.push(a)}let o=qt(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&qt(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!s.includes(o))s.unshift(o);let i=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:Xf;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function jy(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=qt(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var Yf,Er="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",Xf="prefix-except-default";var Ka=S(()=>{q();Yf=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});var Ga,Zf;var Ya=S(()=>{Ka();Ga=[301,302,303,307,308],Zf={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:Er,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:Er,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Er,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:[...Ga],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});var Qf;var Xa=S(()=>{Qf={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 Ry="https://jxsuite.com/schema/project/fields/v2",Py="https://jxsuite.com/schema/document/paths/v2",ed,td,ky,_y;var Za=S(()=>{ed={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"},td={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"},ky=[{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"}],_y={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});var Qa=S(()=>{Aa();Ca();Na();Ta();Ra();Pa();ka();_a();Da();Ma();Ia();La();Fa();Va();Wa();Ha();Ba();qa();za();Ya();Xa();Za()});function el(e,t,n){let r=e.$description;if(b(r))(Object.keys(t).length>0?t:n).$description=r}function tl(e,t,n,r,s=nd,o={}){let i=[],l=(d,f)=>{let y={mediaQueries:t,scope:f,transposeValue:n};if(r)y.resolveValue=(h,m)=>r(h,m,f);for(let h of Lt(d,y))i.push(o.comments===!0?Nn(h):h.text)},a={},c={},u=[],p=[];for(let[d,f]of Object.entries(e)){if(E(f)&&!Array.isArray(f)){if(d.startsWith("@"))u.push([d,f]);else if(!d.startsWith("--"))p.push([d,f]);continue}if(dt(d)||d.startsWith("@")||d.startsWith("$"))continue;if(d.startsWith("--")||d==="colorScheme"||d==="color-scheme")a[d]=f;else c[d]=f}el(e,a,c),l(a,s.root),l(c,s.body);for(let[d,f]of p)if(d.startsWith("&"))l({[d]:f},s.root);else l(f,d);for(let[d,f]of u){if(jn(d)||Cn(d)){l({[d]:f},null);continue}let y={},h={},m=[];for(let[g,x]of Object.entries(f)){if(E(x)&&!Array.isArray(x)){if(!g.startsWith("@"))m.push([g,x]);continue}if(g.startsWith("$"))continue;if(g.startsWith("--"))y[g]=x;else h[g]=x}el(f,y,h),l({[d]:y},s.root),l({[d]:h},s.body);for(let[g,x]of m)l({[d]:x},g)}if(Object.values(t).some((d)=>rt(d)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Ie}="light"]) { color-scheme: light }`,`${s.root}:where([${Ie}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
14
|
-
`)}var
|
|
15
|
-
`)}function
|
|
16
|
-
`)}function
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
`);return e}function Ta(e,t,n){let{code:r,problems:s}=hf(e),[o,...i]=s.filter((l)=>l.kind==="unsupported");if(o)throw new Ma(t,[o,...i]);for(let l of s)n.push({...t,problem:l});return r}function bo(e,t,n){if(Array.isArray(e))return e.map((i,l)=>bo(i,{...t,pointer:`${t.pointer}/${l}`},n));if(!A(e))return e;let r=go(e),s=[],o={set:(i,l)=>{s.push([i,l])}};for(let[i,l]of Object.entries(e)){let c={...t,pointer:`${t.pointer}/${yf(i)}`};if(r&&i==="body")o.set(i,Ra(l,c,n));else if(r&&(i==="getter"||i==="setter")&&A(l)){let a={...l};if(l.body!==void 0)a.body=Ra(l.body,{...c,pointer:`${c.pointer}/body`},n);o.set(i,a)}else o.set(i,bo(l,c,n))}return Object.fromEntries(s)}function $o(e,t,n=[]){return bo(e,{path:t,pointer:""},n)}function Da(e,t,n=[]){return $o(e,t,n)}var df,ho,Lr=null,xo=null,Na,Ma;var So=v(()=>{K();df=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;ho=new Map;Na=new Map;Ma=class Ma extends Error{problems;site;constructor(e,t){let[n]=t;super(`${e.path}${e.pointer}: ${n.message} (line ${n.line}, column ${n.column})`);this.name="EraseError",this.problems=t,this.site=e}}});import{createRequire as xf}from"node:module";var Ia=v(()=>{So();So();Pa(()=>xf(import.meta.url)("ts-blank-space").default)});function Fa(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!La.has(s))La.add(s),console.warn(`Warning: ${s}`)}}function Fn(e,t){let n=[],r=$o(e,t,n);return Fa(n),r}function Va(e,t){let n=[],r=Da(e,t,n);return Fa(n),r}var La;var Fr=v(()=>{Ia();La=new Set});function bf(e){let t=new Set,n=new Set,r=(o)=>{if(o.startsWith("#/state/"))t.add(o.slice(8).split("/")[0])},s=(o)=>{if(y(o)){for(let i of o.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*\(/gu))t.add(i[1]);return}if(Array.isArray(o)){if(!n.has(o)){n.add(o);for(let i of o)s(i)}return}if(!A(o)||n.has(o))return;if(n.add(o),o.operator==="call"&&_(o.target))r(o.target.$ref);if(o.$prototype==="Array"){for(let i of[o.filter,o.sort])if(_(i))r(i.$ref)}for(let[i,l]of Object.entries(o)){if(i==="$defs")continue;if(i.startsWith("on")&&_(l))r(l.$ref);s(l)}};s(e);for(let o of wo)if(A(e.state)&&o in e.state)t.add(o);return t}function Eo(e){return"body"in e&&"$src"in e}function Vn(e){return Ir(e.parameters??e.arguments).length>0}function tt(e){let t=["state"];for(let n of Ir(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function $f(e,t,n){if(et(t))return"callable";if(Ir(t.parameters??t.arguments).length>0)return"callable";if(y(t.body))return Oa(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function nt(e){let t=new Map,n=null,r=()=>n??=bf(e);for(let[s,o]of Object.entries(e.state??{}))if(me(o))t.set(s,$f(s,o,r));return t}var wo;var Qt=v(()=>{K();wo=new Set(["onMount","onUnmount","onAdopted"])});function Re(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function Ha(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return Sf.has(n.toLowerCase())?n:e.slice(1)}return null}function Wn(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function Hn(e){return e.startsWith("@keyframes")}function Ba(e,t){let n=[];for(let r of en(e))for(let s of en(t))n.push(vo(r,s));return n.join(", ")}function vo(e,t){let n=Ef(e,t);if(n!==null)return n;let r=Ya(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function qa(e,t){let n=0,r=null;for(let s=t;s<e.length;s+=1){let o=e[s];if(o==="\\")s+=1;else if(r)r=o===r?null:r;else if(o==='"'||o==="'")r=o;else if(o==="(")n+=1;else if(o===")"){if(n-=1,n===0)return s+1}}return-1}function Ua(e){if(e.endsWith(":host"))return{inner:"",prefix:e.slice(0,-5)};let t=e.lastIndexOf(":host(");if(t===-1||qa(e,t+5)!==e.length)return null;return{inner:e.slice(t+6,-1),prefix:e.slice(0,t)}}function za(e){if(!e.startsWith(":host"))return null;let t=e.slice(5);if(t.startsWith("(")){let n=qa(t,0);return n===-1?null:{inner:t.slice(1,n-1),rest:t.slice(n)}}return/^[\w-]/u.test(t)?null:{inner:null,rest:t}}function Ka(e){let t=0,n=null;for(let r=0;r<e.length;r+=1){let s=e[r];if(s==="\\")r+=1;else if(n)n=s===n?null:n;else if(s==='"'||s==="'")n=s;else if(s==="("||s==="[")t+=1;else if(s===")"||s==="]")t-=1;else if(t===0){if(/[\s>+~]/u.test(s)||e.startsWith("::",r))return r;if(s===":"&&wf.test(e.slice(r)))return r}}return e.length}function Ef(e,t){let n=Ua(e);if(n===null||!jo(t))return null;let r=Wr(t);if(r.length>1||r.length===1&&r[0]!==0)return null;let s=r.length===1?t.slice(1):t,o=Ka(s);if(o===0)return`${e}${s}`;return`${n.prefix}:host(${n.inner}${s.slice(0,o)})${s.slice(o)}`}function Jf(e,t,n){let r=za(e);if(r===null)return n==="shadow"&&vf.test(e)?e:vo(t,e);let{inner:s,rest:o}=r;if(n==="light")return`${t}${s??""}${o}`;let l=`${Ua(t)?.prefix??""}:host${s===null?"":`(${s})`}`;if(o==="")return l;return/^[\s>+~]/u.test(o)?`${l}${o}`:vo(l,o)}function Ga(e,t,n){let r=[];for(let s of en(t))for(let o of en(e))r.push(Jf(o,s,n));return r.join(", ")}function Of(e){return en(e).every((t)=>{let n=za(t);if(n===null)return jo(t);let r=Ka(n.rest);return n.rest.slice(r).replace(/^::?[\w-]+(?:\([^)]*\))?/u,"")===""})}function Wr(e){let t=[],n=null,r=0;for(let s=0;s<e.length;s+=1){let o=e[s];if(n){if(o==="\\")s+=1;else if(o===n)n=null;continue}if(o==="\\")s+=1;else if(o==='"'||o==="'")n=o;else if(o==="[")r+=1;else if(o==="]")r=Math.max(0,r-1);else if(o==="&"&&r===0)t.push(s)}return t}function Ya(e,t){return Wr(e).length>0?jf(e,t):null}function jf(e,t){let n="",r=0;for(let s of Wr(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function en(e){let t=[],n=0,r=null,s=0;for(let i=0;i<e.length;i+=1){let l=e[i];if(r){if(l==="\\")i+=1;else if(l===r)r=null;continue}if(l==='"'||l==="'")r=l;else if(l==="("||l==="[")n+=1;else if(l===")"||l==="]")n=Math.max(0,n-1);else if(l===","&&n===0)t.push(e.slice(s,i)),s=i+1}t.push(e.slice(s));let o=t.flatMap((i)=>{let l=i.trim();return l===""?[]:[l]});return o.length>0?o:[e]}function pt(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Jo(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${Ue}]))`,forced:`${e}:where([${Ue}="${t}"])`};return{auto:`:where(:root:not([${Ue}])) ${e}`,forced:`:where(:root[${Ue}="${t}"]) ${e}`}}function Bn(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function Oo(e){return e.startsWith("--")?e:Re(e)}function Vr(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Xa(e,t,n){let r=n.map(([o,i])=>`${o}: ${i}`).join("; "),s=t===null?r:`${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function qn(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
|
|
12
|
+
${e.text}`}function Af(e,t,n){let r=n.map(({selector:o,declarations:i})=>`${o} { ${i.map(([l,c])=>`${l}: ${c}`).join("; ")} }`).join(" "),s=`@keyframes ${t} { ${r} }`;for(let o=e.length-1;o>=0;o-=1)s=`${e[o]} { ${s} }`;return s}function Cf(e){let t=Object.keys(e).filter((r)=>Hn(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function jo(e){let n=Wr(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function tn(e,t={}){let{scope:n=null,mediaQueries:r={},transposeValue:s=(S)=>S,transposeSelector:o=(S)=>S,resolveValue:i,host:l,shadowTree:c=!1}=t,a=[],u=(S)=>S!==null&&typeof S==="object"&&!Array.isArray(S)&&!_(S),f=(S,E)=>{if(u(E))return[E];if(!Wn(S)||!Array.isArray(E)||E.length===0)return[];return E.every((J)=>u(J))?E:[]},p=(S,E,J,M)=>{if(E===void 0||E===null)return null;if(_(E))return J?i?.(S,E,M)??null:null;if(j(E))return null;let k=String(E);if(B(k))return J?i?.(S,k,M)??null:null;return s(k)},d=(S,E,J=!0,M="self")=>{let k=[];for(let[P,R]of Object.entries(S)){if(f(P,R).length>0)continue;if(E&&(P.startsWith("@")||Bn(P)))continue;if(P.startsWith("$"))continue;let H=p(P,R,J,M);if(H!==null)k.push([Oo(P),H])}return k},x=(S)=>y(S)&&S!==""?{description:S}:{},w=(S,E,J,M,k)=>{if(J.length===0)return;let P=E;if(P!==null){let O=o(P);if(O===null)return;P=O}let R=Xa(S,P,J),H={text:R,conditions:[...S],selector:P,declarations:J,target:M,key:Vr(R)};a.push({...H,...x(k)})},g=(S,E,J)=>{let M=S.slice(10).trim();if(M==="")return;let k=[];for(let[R,H]of Object.entries(E)){if(!u(H))continue;let O=d(H,!0,!1,"unscoped");if(O.length>0)k.push({declarations:O,selector:R.trim()})}if(k.length===0)return;let P=Af(J,M,k);a.push({blocks:k,conditions:[...J],declarations:[],key:Vr(P),selector:null,target:"unscoped",text:P,...x(E.$description)})},m=(S,E,J,M,k,P)=>{if(S==="@--")return;if(Wn(S)){w([...M,S],null,d(E,!1,!0,"unscoped"),"unscoped",E.$description);return}if(Hn(S)){g(S,E,M);return}let R=Ha(S,r),H=R===null?S:`@media ${R}`,O=R===null?null:pt(R);if(O!==null&&J!==null&&!c){let{auto:T,forced:de}=Jo(J,O);b(E,T,[...M,H],k,P),b(Cf(E),de,M,k,P);return}b(E,J,[...M,H],k,P)};function b(S,E,J,M,k){w(J,E,d(S,!0,!0,M),M,S.$description);for(let[P,R]of Object.entries(S))for(let H of f(P,R))if(P.startsWith("@"))m(P,H,E,J,M,k);else if(E!==null&&k&&l!==void 0)b(H,Ga(P,E,l),J,Of(P)?M:"descendant",!1);else if(E!==null)b(H,Ba(E,P),J,jo(P)?M:"descendant",!1)}return b(e,n,[],"self",!0),a}function Wa(e){return e===!1||e==="open"||e==="closed"}function ft(e,t){let n=e?.$shadow;if(Wa(n))return n===!1?null:n;let r=t?.shadow;return Wa(r)&&r!==!1?r:null}var Sf,wf,vf,Ue="data-color-scheme",Hr="jx-color-scheme";var Un=v(()=>{K();Sf=new Set(["all","print","screen","speech"]);wf=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;vf=/^::(?:slotted|part)\(/u});function el(){return`the Intl helpers ${Co.join(", ")}`}var rt="en-US",Ao="UTC",Za,Co,Qa;var No=v(()=>{Za=[{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."}],Co=Za.map((e)=>e.path),Qa=Object.fromEntries(Za.map((e)=>[e.path,e.params.indexOf("locale")]))});function Nf(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function xe(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Ce(e){return e.startsWith("#/$map/")?e.slice(2):e}function Ie(e){if(e==="")return[];return e.split("/").map((t)=>Nf(t))}function be(e,t){let n=e;for(let r of Ie(t))n=n?.[r];return n}function U(e,t){let n=e;for(let r of Ie(t))n+=Ro.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function tl(e,t){let n=e;for(let[r,s]of Ie(t).entries()){let o=r===0?"":"?.";n+=Ro.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function dt(e){return Ro.test(e)?e:JSON.stringify(e)}function nl(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var Ro;var nn=v(()=>{Ro=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function To(e){let t=e.$map;return j(t)?t:void 0}function Ur(e){return j(e)&&!Array.isArray(e)&&"operator"in e}function rn(e){return j(e)&&!Array.isArray(e)&&"$ref"in e}function Pf(e,t,n){let r=Qa[e];if(r===void 0||r<0||t[r]!=null)return t;let s=be(n.$page,"locale");if(!y(s)||s==="")return t;let o=[...t];return o[r]=s,o}function cl(){return globalThis.window??globalThis}function ul(e){return e.startsWith("window#/")&&Tf.has(e.slice(8))}function ze(e){return il.has(e)}function Br(e){if(Array.isArray(e))return e.some((t)=>Br(t));if(e===void 0||!Ur(e))return!1;return ze(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>Br(t))||Object.values(e.cases??{}).some((t)=>Br(t))}function zn(e){return Qe(e)&&!Br(e.$expression)}function ko(e,t){if(Array.isArray(e)){for(let n of e)ko(n,t);return}if(e===void 0||!j(e))return;if(rn(e)){if(!_f.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Ie(n)[0]??"")}return}if(Ur(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])ko(r,t)}}function Lo(e){let t=new Set;return ko(e.$expression,t),[...t]}function Fo(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&zn(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Lo(s).some((o)=>!t.has(o)))t.delete(r),n=!1}return Object.fromEntries(t)}function ae(e,t){if(!e)return;let n=(e.depth??0)+1;if(n>Mf)return;return{depth:n,path:[...e.path??[],...Array.isArray(t)?t:[t]],report:e.report}}function se(e,t,n,r,s){if(e===null||e===void 0)return e;if(Ur(e))return _e(e,t,n,r,s);if(rn(e)){let o=qr(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return pl(e,t,n,r,s);return s?.report(s.path??[],e),e}function pl(e,t,n,r,s){return e.map((o,i)=>se(o,t,n,r,ae(s,i)))}function Df(e,t,n,r){let s=Ce(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return qr(s.slice(0,s.lastIndexOf("/")),t,n,r)};if(s.startsWith("#/state/"))return o("#/state/");if(s.startsWith("parent#/"))return o("parent#/");if(s.startsWith("$map/")||s.startsWith("$args/"))return s.split("/").length>2?qr(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function qr(e,t,n,r){let s=Ce(e);if(s==="$reduce/acc")return r?.acc;if(s.startsWith("$reduce/"))return r?.acc;if(s.startsWith("$args/")){let o=s.slice(6).split("/"),i=r?.args?.[o[0]];return o.length>1?be(i,o.slice(1).join("/")):i}if(s.startsWith("event#/")){let o=s.slice(7);return be(n,o)}if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,l,c=To(t);if(i==="item")l=r?.item??c?.item??t["$map/item"];else if(i==="index")l=r?.index??c?.index??t["$map/index"];else l=c?.[i]??t[`$map/${i}`];return o.length>2?be(l,o.slice(2).join("/")):l}if(s.startsWith("#/state/"))return be(t,s.slice(8));if(s.startsWith("parent#/"))return be(t,s.slice(8));if(s.startsWith("window#/"))return be(cl(),s.slice(8));if(s.startsWith("document#/"))return be(globalThis.document,s.slice(10));return be(t,s)??null}function If(e,t,n,r){let s=Ce(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,l,c=To(t);if(i==="item")l=r?.item??c?.item??t["$map/item"];else if(i==="index")l=r?.index??c?.index??t["$map/index"];else l=c?.[i]??t[`$map/${i}`];if(o.length>2){let a=o.slice(2),u=a.pop(),f=a.length>0?be(l,a.join("/")):l;return{key:u,obj:f}}return{key:i==="item"?"$map/item":"$map/index",obj:To(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let l=Ie(o),c=l.pop(),a=t;for(let u of l)a=a[u];return{key:c,obj:a}}return{key:s,obj:t}}function _e(e,t,n,r,s){let o=Lf(e,t,n,r,s);return s?.report(s.path??[],o),o}function sl(e,t,n){switch(e){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"<":return t<n;case"<=":return t<=n;case">":return t>n;default:return t>=n}}function Lf(e,t,n,r,s){let{operator:o,target:i,value:l,initial:c}=e;if(!Rf.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Po.has(o)&&!("value"in e)){let a=se(i,t,n,r,ae(s,"target"));if(o==="!")return!a;if(o==="-")return-a}if(o==="call"){let a=rn(i)?i.$ref:void 0;if(!y(a))throw TypeError("$expression: call target must be a $ref pointer");let u=(r?.callDepth??0)+1;if(u>rl)throw Error(`$expression: call depth exceeded (${rl})`);let f=Array.isArray(l)?l.map((d,x)=>se(d,t,n,r,ae(s,["value",x]))):[];if(a.startsWith("window#/")){if(!ul(a))throw Error(`$expression: "${a}" is not a blessed pure global`);let d=a.slice(8),x=kf.get(d);if(x)return x(...Pf(d,f,t));let w=cl(),g=be(w,d),m=d.lastIndexOf("/"),b=m===-1?w:be(w,d.slice(0,m));return g.apply(b,f)}let p=qr(a,t,n,r);if(je(p))return p.apply(Df(a,t,n,r),f);if(j(p)&&"$expression"in p){let d=p,x={};for(let[w,g]of(d.parameters??[]).entries()){let m=y(g)?g:g?.name??"";if(!m)continue;x[m]=f[w]===void 0&&j(g)&&"default"in g?g.default:f[w]}return _e(d.$expression,t,n,{args:x,callDepth:u})}throw TypeError(`$expression: call target "${a}" is not callable`)}if(Do.has(o)){if(o==="?:"){let d=se(i,t,n,r,ae(s,"target"));if(s){let x=se(l,t,n,r,ae(s,"value")),w=se(c,t,n,r,ae(s,"initial"));return d?x:w}return d?se(l,t,n,r):se(c,t,n,r)}let a=se(i,t,n,r,ae(s,"target")),u=String(a),f=e.cases??{},p=Object.hasOwn(f,u);if(s){let d;for(let[w,g]of Object.entries(f)){let m=se(g,t,n,r,ae(s,["cases",w]));if(w===u)d=m}let x=se(e.default,t,n,r,ae(s,"default"));return p?d:x}return p?se(f[u],t,n,r):se(e.default,t,n,r)}if(_o.has(o)){let a=se(i,t,n,r,ae(s,"target")),u=se(l,t,n,r,ae(s,"value"));switch(o){case"===":return a===u;case"!==":return a!==u;case"&&":return a&&u;case"||":return a||u;case"??":return a??u;default:return sl(o,a,u)}}if(al.has(o)){let a=se(l,t,n,r,ae(s,"value")),{obj:u,key:f}=If(i.$ref,t,n,r);u[f]=o==="="?a:sl(o.slice(0,-1),u[f],a);return}if(ll.has(o)){let a=se(i,t,n,r,ae(s,"target"));switch(o){case"push":return a.push(se(l,t,n,r,ae(s,"value")));case"unshift":return a.unshift(se(l,t,n,r,ae(s,"value")));case"pop":return a.pop();case"shift":return a.shift();case"splice":{let u=se(l,t,n,r,ae(s,"value"));return a.splice(...u)}default:break}}if(Io.has(o)){let a=se(i,t,n,r,ae(s,"target")),u=l===void 0?[]:Array.isArray(l)?pl(l,t,n,r,ae(s,"value")):[se(l,t,n,r,ae(s,"value"))],f=be(a,o);if(!je(f))return;return f.apply(a,u)}if(Mo.has(o)){let a=se(i,t,n,r,ae(s,"target")),u=l;if(o==="reduce"){let f=se(c,t,n,r,ae(s,"initial"));for(let[p,d]of a.entries())f=_e(u,t,n,{acc:f,index:p,item:d},p===0?ae(s,"value"):void 0);return f}if(o==="map")return a.map((f,p)=>_e(u,t,n,{...r,index:p,item:f},p===0?ae(s,"value"):void 0));if(o==="filter")return a.filter((f,p)=>_e(u,t,n,{...r,index:p,item:f},p===0?ae(s,"value"):void 0))}return}function ce(e,t){if(e===null)return"null";if(e===void 0)return"undefined";if(Ur(e))return Te(e,t);if(rn(e))return Vo(e.$ref,t);if(Array.isArray(e))return e.map((n)=>ce(n,t)).join(", ");return JSON.stringify(e)}function Ff(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function Vo(e,t){let n=Ce(e),r=t.statePrefix??"state",s=t.eventParam??"event";if(n==="$reduce/acc")return"_acc";if(n.startsWith("$reduce/"))return"_acc";if(n.startsWith("$args/"))return U("_args",n.slice(6));if(n.startsWith("event#/"))return U(s,n.slice(7));if(n.startsWith("$map/")){let o=n.split("/"),[,i]=o;if(i==="item")return o.length>2?U("_item",o.slice(2).join("/")):"_item";if(i==="index")return"_index";return`_${i}`}if(n.startsWith("#/state/"))return U(r,n.slice(8));if(n.startsWith("parent#/"))return U(r,n.slice(8));if(n.startsWith("window#/"))return U("window",n.slice(8));if(n.startsWith("document#/"))return U("document",n.slice(10));return U(r,n)}function ol(e,t){if(rn(e))return Vo(e.$ref,t);return ce(e,t)}function Vf(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(rt)})`,o=JSON.stringify(Ao);switch(e){case"Intl/formatNumber":return`new Intl.NumberFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/formatDate":return`new Intl.DateTimeFormat(${r(1)} ?? ${s}, {timeZone: ${o}, ...${r(2)}}).format(new Date(${r(0)}))`;case"Intl/formatRelativeTime":return`new Intl.RelativeTimeFormat(${r(2)} ?? ${s}, ${r(3)}).format(${r(0)}, ${r(1)})`;case"Intl/formatList":return`new Intl.ListFormat(${r(1)} ?? ${s}, ${r(2)}).format(${r(0)})`;case"Intl/plural":return`new Intl.PluralRules(${r(1)} ?? ${s}, ${r(2)}).select(${r(0)})`;case"Intl/compare":return`new Intl.Collator(${r(2)} ?? ${s}, ${r(3)}).compare(${r(0)}, ${r(1)})`;case"Intl/displayName":return`new Intl.DisplayNames(${r(2)} ?? ${s}, {...${r(3)}, type: ${r(1)} ?? 'language'}).of(${r(0)})`;case"Intl/segment":return`[...new Intl.Segmenter(${r(2)} ?? ${s}, {granularity: ${r(1)} ?? 'grapheme'}).segment(${r(0)})].map((p) => p.segment)`;default:return null}}function Te(e,t={}){let{operator:n,target:r,value:s,initial:o}=e;if(Po.has(n)&&!("value"in e)){let i=ce(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(rn(r)?r.$ref:void 0)??"",l=Array.isArray(s)?s.map((c)=>ce(c,t)):[];if(i.startsWith("window#/")){if(!ul(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let c=Vf(i.slice(8),l,t);if(c)return c;return`window.${i.slice(8).replaceAll("/",".")}(${l.join(", ")})`}if(i.startsWith("#/state/")){let c=i.slice(8),a=t.formulaParams?.[c];if(a){let u=a.map((f,p)=>`${JSON.stringify(f)}: ${l[p]??"undefined"}`).join(", ");return`${Ff(c)}(${t.statePrefix??"state"}, { ${u} })`}}return`${Vo(i,t)}(${l.join(", ")})`}if(Do.has(n)){if(n==="?:"){let a=ce(r,t),u=ce(s,t),f=ce(o,t);return`(${a} ? ${u} : ${f})`}let i=ce(r,t),l=Object.entries(e.cases??{}).map(([a,u])=>`_d === ${JSON.stringify(a)} ? ${ce(u,t)} : `).join(""),c="default"in e?ce(e.default,t):"undefined";return`((_d) => ${l}${c})(String(${i}))`}if(_o.has(n)){let i=ce(r,t),l=ce(s,t);return`(${i} ${n} ${l})`}if(al.has(n)){let i=ol(r,t),l=ce(s,t);return`${i} ${n} ${l}`}if(ll.has(n)){let i=ol(r,t);switch(n){case"push":return`${i}.push(${ce(s,t)})`;case"unshift":return`${i}.unshift(${ce(s,t)})`;case"pop":return`${i}.pop()`;case"shift":return`${i}.shift()`;case"splice":{let l=Array.isArray(s)?s.map((c)=>ce(c,t)).join(", "):ce(s,t);return`${i}.splice(${l})`}default:break}}if(Io.has(n)){let i=ce(r,t),l=s===void 0?"":Array.isArray(s)?s.map((c)=>ce(c,t)).join(", "):ce(s,t);return`(${i})?.${n}?.(${l})`}if(Mo.has(n)){let i=ce(r,t),l=Te(s,t);if(n==="reduce"){let c=ce(o,t);return`${i}.reduce((_acc, _item, _index) => ${l}, ${c})`}if(n==="map")return`${i}.map((_item, _index) => ${l})`;if(n==="filter")return`${i}.filter((_item, _index) => ${l})`}return"undefined"}function sn(e,t,n,r){return se(e,t,n,r)}function mt(e,t={}){return ce(e,t)}var il,Po,_o,al,ll,Mo,Do,Io,Rf,Tf,kf,_f,rl=64,Mf=64;var on=v(()=>{No();K();nn();il=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Po=new Set(["!","-"]),_o=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),al=new Set(["=","+=","-=","*=","/="]),ll=new Set(["push","pop","shift","unshift","splice"]),Mo=new Set(["reduce","map","filter"]),Do=new Set(["?:","switch"]),Io=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"]),Rf=new Set([...il,...Po,..._o,...Mo,...Do,...Io,"call"]),Tf=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",...Co]),kf=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??rt,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??rt,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??rt,{timeZone:Ao,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??rt,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??rt,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??rt,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??rt,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??rt,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);_f=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function Wf(e){return e.startsWith(fl)}function px(e){let t=e;if(Wf(t))t=t.slice(fl.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Wo}${t}.js`}function fx(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Wo}${n}`:`${Wo}${n}.${t}`}function dl(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function ml(e){let t=dl(e);return t.startsWith("/")?t:`/${t}`}function Hf(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function dx(e,t){let n=t.split("#")[0].split("?")[0];if(!n.startsWith("/"))return null;let r;try{r=decodeURIComponent(n)}catch{return null}if(/%2e|%2f/i.test(r))return null;for(let s of Hf(e,"urlPrefix")){let o=ml(s.urlPrefix);if(!r.startsWith(`${o}/`))continue;let l=r.slice(o.length+1).split("/");if(l.some((a)=>a===""||a==="."||a===".."))return null;let{filter:c}=s;if(c&&!c(l.join("/")))return null;return`${dl(s.dir)}/${l.join("/")}`}return null}function mx(e,t){let n=new Set;for(let r of t){let s=ml(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${Bf}]+`,"g");for(let i of e.matchAll(o)){let l=i[0].split("#")[0].split("?")[0];if(!l.endsWith("/"))n.add(l)}}return[...n].filter(Boolean)}function qf(e){let t=[],n=0;while(n<e.length){while(n<e.length&&(/\s/.test(e[n])||e[n]===","))n+=1;if(n>=e.length)break;let r=n;while(n<e.length&&!/\s/.test(e[n]))n+=1;let s=e.slice(r,n);if(s.endsWith(",")){t.push({descriptor:"",url:s.replace(/,+$/,"")});continue}while(n<e.length&&/\s/.test(e[n]))n+=1;let o=n;while(n<e.length&&e[n]!==",")n+=1;let i=e.slice(o,n).trim();if(n+=1,s=s.replace(/,+$/,""),s!=="")t.push({descriptor:i,url:s})}return t}function Uf(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function gx(e){if(!y(e)||e==="")return"";let t;try{({pathname:t}=new URL(e))}catch{return""}let n=t.replace(/\/+$/,"");if(n===""||n==="/")return"";return n.startsWith("/")?n:`/${n}`}function Ho(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function hx(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var fl="npm:",Wo="/assets/",Bf;var Bo=v(()=>{K();Bf=String.raw`"'\s<>()\\`});function gl(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 zf(e){return(j(e)||je(e))&&"then"in e&&je(e.then)}async function an(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=gl(o);switch(i.kind){case"expression":{let l=_e(i.node,t,n,s);if(zf(l))await l;break}case"if":{let l=i.node,c=sn(l.if,t,n,s)?l.then:l.else;if(Array.isArray(c))await an(c,t,n,r);break}case"switch":{let l=i.node,c=String(sn(l.$switch,t,n,s)),a=l.cases??{},u=Object.hasOwn(a,c)?a[c]:l.default;if(Array.isArray(u))await an(u,t,n,r);break}case"dispatch":{let l=i.node,c=je(r.target)?r.target():r.target,a=n?.currentTarget??c;if(!a)break;let u={};if("detail"in l)u.detail=sn(l.detail,t,n,s);if(l.bubbles!==void 0)u.bubbles=l.bubbles;if(l.composed!==void 0)u.composed=l.composed;a.dispatchEvent(new CustomEvent(l.dispatchEvent,u));break}case"stopPropagation":{n?.stopPropagation();break}case"preventDefault":{n?.preventDefault();break}default:break}}}function Le(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=gl(s);switch(o.kind){case"expression":{r.push(`${n}${Te(o.node,t)};`);break}case"if":{let i=o.node,l=mt(i.if,t),c={...t,indent:`${n} `};if(r.push(`${n}if (${l}) {`,Le(i.then??[],c)),i.else)r.push(`${n}} else {`,Le(i.else,c));r.push(`${n}}`);break}case"switch":{let i=o.node,l=mt(i.$switch,t),c={...t,indent:`${n} `};r.push(`${n}switch (String(${l})) {`);for(let[a,u]of Object.entries(i.cases??{}))r.push(`${n} case ${JSON.stringify(a)}: {`,Le(u,c),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Le(i.default,c),`${n} }`);r.push(`${n}}`);break}case"dispatch":{let i=o.node,l=t.eventParam??"event",c=t.dispatchTarget??`(${l} && ${l}.currentTarget)`,a=[];if("detail"in i)a.push(`detail: ${mt(i.detail,t)}`);if(i.bubbles!==void 0)a.push(`bubbles: ${JSON.stringify(i.bubbles)}`);if(i.composed!==void 0)a.push(`composed: ${JSON.stringify(i.composed)}`);let u=a.length>0?`, { ${a.join(", ")} }`:"";r.push(`${n}${c}?.dispatchEvent(new CustomEvent(${JSON.stringify(i.dispatchEvent)}${u}));`);break}case"stopPropagation":{r.push(`${n}${t.eventParam??"event"}?.stopPropagation();`);break}case"preventDefault":{r.push(`${n}${t.eventParam??"event"}?.preventDefault();`);break}default:break}}return r.join(`
|
|
13
|
+
`)}var zr=v(()=>{K();on()});var qo=v(()=>{K()});function Go(e){if(e===Kf)return"client";if(e===Gf)return"server";return null}function Yf(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function yl(e,t){return`${Ko}${Yf(e)}#${t}`}function xl(e){return e.startsWith(Ko)}function bl(e){if(!xl(e))return null;let t=e.slice(Ko.length),n=t.lastIndexOf("#");if(n<=0)return null;let r=t.slice(n+1);if(r!=="client"&&r!=="server")return null;return{path:t.slice(0,n),side:r}}function Uo(e,t){if(Array.isArray(e)){let r=e.map((s)=>Uo(s,t));return r.some((s,o)=>s!==e[o])?r:e}if(!A(e))return e;let n=null;for(let[r,s]of Object.entries(e)){let o=s;if(r==="$src"&&y(s)){let i=Go(s);o=i===null?s:yl(t,i)}else if(r!=="$script")o=Uo(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function Yo(e,t){return Uo(e,t)}function Qf(e){return Xf.test(e)&&!Zf.test(e)}function hl(e){return Go(e)==="client"||bl(e)?.side==="client"}function zo(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())zo(s,[...t,r],n);return n}if(!A(e))return n;if(y(e.$src))n.push({lazy:e.$lazy===!0,path:t,src:e.$src});for(let[r,s]of Object.entries(e))if(r!=="$script")zo(s,[...t,r],n);return n}function ed(e){let t=e.at(-1);return y(t)?`"${t}"`:"this entry"}function vx(e){let t=zo(e,[],[]),n=t.some((s)=>!s.lazy&&hl(s.src)),r=[];for(let s of t){let o=ed(s.path);if(!s.lazy&&Qf(s.src))r.push({detail:'A module only this document uses can be the document\'s own script: move the code into the client script (the server script for a `timing: "server"` entry) and name it with `$src: "#client"` or `$src: "#server"`. A module several documents import stays a file, and this one keeps working as it is.',message:`${o} imports ${s.src}, which the document could carry as its own script`,path:s.path,rule:"relative-src"});else if(s.lazy&&n&&hl(s.src))r.push({detail:"A document has one client script, and another entry imports it as the page loads, so `$lazy` defers nothing here. Move this export to a `$src` module of its own to load it on its first call.",message:`${o} is $lazy, but the script it is in loads with the page`,path:s.path,rule:"lazy-shares-script"})}return r}var Ko="jx-script:",Kf="#client",Gf="#server",Xf,Zf;var Xo=v(()=>{K();Xf=/^\.{1,2}\//u,Zf=/\.json$/iu});function od(e){for(let t of Object.keys(e))if(sd.has(t))return!0;return!1}function Kr(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Aa(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function wl(){return[...Sl].toSorted()}function st(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||Sl.has(n))return String(t);return t?"":null}function El(e,t,n){if(!Array.isArray(e))return[];let r=e;if(je(t))r=r.filter(t);if(je(n))r=[...r].toSorted(n);return r}function vl(e,t,n,r){let s=Zt(t);if(r?.has(s)&&r.get(s)===void 0)return;let o=e[s];if(le(o)){e[s]=n!==null&&n!=="false";return}if(n===null){let i=r?.get(s);e[s]=i===void 0?Y(o)?0:"":i;return}e[s]=Y(o)?Number(n):n}function Zo(e){let t=$l.get(e);if(t)return t;let n=new Set,r=nt(e);for(let[s,o]of Object.entries(e.state??{}))if(y(o)?B(o):Ne(o)?!Qe(o)&&!ze(o.$expression.operator):r.get(s)==="computed")n.add(s);return $l.set(e,n),n}function Jl(e){let t=e.state??{},n=Zo(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function Qo(e){let t=new Map;for(let[n,r]of Object.entries(e.state??{})){if(y(r)&&B(r)){t.set(n,void 0);continue}if(j(r)&&!Array.isArray(r)){if("default"in r){t.set(n,r.default);continue}if(id.some((s)=>(s in r))){t.set(n,void 0);continue}if(od(r))continue}t.set(n,r)}return t}var sd,Ke,Sl,Gx,$l,id,ei=32,Gr,Yr="jx-slot",ti="data-jx-slots",ni="jx.slot.group",Yx;var Kn=v(()=>{Un();on();nn();K();Qt();Bo();zr();qo();Xo();qo();Un();sd=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);Ke=new Set(["$schema","$shadow","formAssociated","formValue","$id","$defs","state","$ref","$props","$elements","$title","$description","$switch","$prototype","$src","$export","$script","$media","$map","timing","default","description","body","parameters","arguments","tagName","children","style","attributes","items","map","filter","sort","cases","observedAttributes"]),Sl=new Set(["contenteditable","draggable","spellcheck"]);Gx=Object.freeze({emptyRow:!0});$l=new WeakMap;id=["$expression","$prototype","$ref","$src"],Gr=/^[\t\n\f\r ]+$/u,Yx=(()=>{let e=Symbol.for(ni),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function cd(){if(!Gn){Gn=new Map;for(let[e,t,n]of ld){let r=Gn.get(e);if(!r)r=new Map,Gn.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return Gn}function jl(e,t){return Ol??=new Map(ad),Ol.get(t)??cd().get(t)?.get(e.toLowerCase())??null}function ri(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return ud.has(e.toLowerCase());return t==="text"&&pd.has(e.toLowerCase())}var h=(e,t={})=>({attribute:e,kind:"text",...t}),D=(e,t={})=>({attribute:e,kind:"boolean",...t}),Xr,ad,ld,Ol,Gn,ud,pd;var Al=v(()=>{Xr={live:!0},ad=[["accessKey",h("accesskey")],["ariaAtomic",h("aria-atomic")],["ariaAutoComplete",h("aria-autocomplete")],["ariaBrailleLabel",h("aria-braillelabel")],["ariaBrailleRoleDescription",h("aria-brailleroledescription")],["ariaBusy",h("aria-busy")],["ariaChecked",h("aria-checked")],["ariaColCount",h("aria-colcount")],["ariaColIndex",h("aria-colindex")],["ariaColIndexText",h("aria-colindextext")],["ariaColSpan",h("aria-colspan")],["ariaCurrent",h("aria-current")],["ariaDescription",h("aria-description")],["ariaDisabled",h("aria-disabled")],["ariaExpanded",h("aria-expanded")],["ariaHasPopup",h("aria-haspopup")],["ariaHidden",h("aria-hidden")],["ariaInvalid",h("aria-invalid")],["ariaKeyShortcuts",h("aria-keyshortcuts")],["ariaLabel",h("aria-label")],["ariaLevel",h("aria-level")],["ariaLive",h("aria-live")],["ariaModal",h("aria-modal")],["ariaMultiLine",h("aria-multiline")],["ariaMultiSelectable",h("aria-multiselectable")],["ariaOrientation",h("aria-orientation")],["ariaPlaceholder",h("aria-placeholder")],["ariaPosInSet",h("aria-posinset")],["ariaPressed",h("aria-pressed")],["ariaReadOnly",h("aria-readonly")],["ariaRelevant",h("aria-relevant")],["ariaRequired",h("aria-required")],["ariaRoleDescription",h("aria-roledescription")],["ariaRowCount",h("aria-rowcount")],["ariaRowIndex",h("aria-rowindex")],["ariaRowIndexText",h("aria-rowindextext")],["ariaRowSpan",h("aria-rowspan")],["ariaSelected",h("aria-selected")],["ariaSetSize",h("aria-setsize")],["ariaSort",h("aria-sort")],["ariaValueMax",h("aria-valuemax")],["ariaValueMin",h("aria-valuemin")],["ariaValueNow",h("aria-valuenow")],["ariaValueText",h("aria-valuetext")],["autocapitalize",h("autocapitalize")],["autocorrect",D("autocorrect",{keywords:["on","off"]})],["autofocus",D("autofocus")],["className",h("class")],["contentEditable",h("contenteditable")],["dir",h("dir")],["draggable",D("draggable")],["enterKeyHint",h("enterkeyhint")],["headingOffset",h("headingoffset")],["headingReset",D("headingreset")],["hidden",{attribute:"hidden",kind:"hidden"}],["id",h("id")],["inert",D("inert")],["inputMode",h("inputmode")],["lang",h("lang")],["popover",h("popover")],["role",h("role")],["slot",h("slot")],["spellcheck",D("spellcheck")],["tabIndex",h("tabindex")],["title",h("title")],["translate",D("translate",{keywords:["yes","no"]})],["writingSuggestions",h("writingsuggestions")]],ld=[["aLink","body",h("alink")],["abbr","td th",h("abbr")],["accept","input",h("accept")],["acceptCharset","form",h("accept-charset")],["action","form",h("action")],["align","caption col colgroup div embed h1 h2 h3 h4 h5 h6 hr iframe img input legend object p table tbody td tfoot th thead tr",h("align")],["allow","iframe",h("allow")],["allowFullscreen","iframe",D("allowfullscreen")],["alpha","input",D("alpha")],["alt","area img input",h("alt")],["archive","object",h("archive")],["as","link",h("as")],["async","script",D("async")],["autocomplete","form input select textarea",h("autocomplete")],["autoplay","audio video",D("autoplay")],["axis","td th",h("axis")],["background","body",h("background")],["behavior","marquee",h("behavior")],["bgColor","body marquee table td th tr",h("bgcolor")],["border","img object table",h("border")],["cellPadding","table",h("cellpadding")],["cellSpacing","table",h("cellspacing")],["ch","col colgroup tbody td tfoot th thead tr",h("char")],["chOff","col colgroup tbody td tfoot th thead tr",h("charoff")],["charset","a link script",h("charset")],["checked","input",D("checked",Xr)],["cite","blockquote del ins q",h("cite")],["clear","br",h("clear")],["closedBy","dialog",h("closedby")],["code","object",h("code")],["codeBase","object",h("codebase")],["codeType","object",h("codetype")],["colSpan","td th",h("colspan")],["color","font hr",h("color")],["colorSpace","input",h("colorspace")],["cols","frameset textarea",h("cols")],["command","button",h("command")],["compact","dir dl menu ol ul",D("compact")],["content","meta",h("content")],["controls","audio img video",D("controls")],["coords","a area",h("coords")],["crossOrigin","audio img link script video",h("crossorigin")],["data","object",h("data")],["dateTime","del ins time",h("datetime")],["declare","object",D("declare")],["decoding","img",h("decoding")],["default","track",D("default")],["defaultChecked","input",D("checked")],["defaultMuted","audio video",D("muted")],["defaultSelected","option",D("selected")],["defaultValue","input",h("value")],["defer","script",D("defer")],["dirName","input textarea",h("dirname")],["direction","marquee",h("direction")],["disabled","button fieldset input link optgroup option select textarea",D("disabled")],["download","a area",h("download")],["encoding","form",h("enctype")],["enctype","form",h("enctype")],["event","script",h("event")],["face","font",h("face")],["fetchPriority","img link script",h("fetchpriority")],["formAction","button input",h("formaction")],["formEnctype","button input",h("formenctype")],["formMethod","button input",h("formmethod")],["formNoValidate","button input",D("formnovalidate")],["formTarget","button input",h("formtarget")],["frame","table",h("frame")],["frameBorder","frame iframe",h("frameborder")],["headers","td th",h("headers")],["height","canvas embed iframe img input marquee object source td th video",h("height")],["high","meter",h("high")],["href","a area base link",h("href")],["hreflang","a area link",h("hreflang")],["hspace","embed img input marquee object",h("hspace")],["htmlFor","label script template",h("for")],["httpEquiv","meta",h("http-equiv")],["imageSizes","link",h("imagesizes")],["imageSrcset","link",h("imagesrcset")],["integrity","link script",h("integrity")],["isMap","img",D("ismap")],["kind","track",h("kind")],["label","optgroup option track",h("label")],["link","body",h("link")],["loading","audio iframe img video",h("loading")],["longDesc","frame iframe img",h("longdesc")],["loop","audio video",D("loop")],["low","meter",h("low")],["lowsrc","img",h("lowsrc")],["marginHeight","frame iframe",h("marginheight")],["marginWidth","frame iframe",h("marginwidth")],["max","input meter progress",h("max")],["maxLength","input textarea",h("maxlength")],["media","link meta source style",h("media")],["method","form",h("method")],["min","input meter",h("min")],["minLength","input textarea",h("minlength")],["multiple","input select",D("multiple")],["muted","audio video",D("muted",Xr)],["name","a button details embed fieldset form frame iframe img input map meta object output param select slot textarea",h("name")],["noHref","area",D("nohref")],["noModule","script",D("nomodule")],["noResize","frame",D("noresize")],["noShade","hr",D("noshade")],["noValidate","form",D("novalidate")],["noWrap","td th",D("nowrap")],["open","details dialog",D("open")],["optimum","meter",h("optimum")],["pattern","input",h("pattern")],["ping","a area",h("ping")],["placeholder","input textarea",h("placeholder")],["playsInline","video",D("playsinline")],["popoverTargetAction","button input",h("popovertargetaction")],["poster","video",h("poster")],["preload","audio video",h("preload")],["readOnly","input textarea",D("readonly")],["referrerPolicy","a area iframe img link script",h("referrerpolicy")],["rel","a area form link",h("rel")],["required","input select textarea",D("required")],["rev","a link",h("rev")],["reversed","ol",D("reversed")],["rowSpan","td th",h("rowspan")],["rows","frameset textarea",h("rows")],["rules","table",h("rules")],["scheme","meta",h("scheme")],["scope","td th",h("scope")],["scrollAmount","marquee",h("scrollamount")],["scrollDelay","marquee",h("scrolldelay")],["scrolling","frame iframe",h("scrolling")],["selected","option",D("selected",Xr)],["shadowRootClonable","template",D("shadowrootclonable")],["shadowRootCustomElementRegistry","template",h("shadowrootcustomelementregistry")],["shadowRootDelegatesFocus","template",D("shadowrootdelegatesfocus")],["shadowRootMode","template",h("shadowrootmode")],["shadowRootSerializable","template",D("shadowrootserializable")],["shadowRootSlotAssignment","template",h("shadowrootslotassignment")],["shape","a area",h("shape")],["size","font hr input select",h("size")],["sizes","img source",h("sizes")],["span","col colgroup",h("span")],["src","audio embed frame iframe img input source track video",h("src")],["srcdoc","iframe",h("srcdoc")],["srclang","track",h("srclang")],["srcset","img source",h("srcset")],["standby","object",h("standby")],["start","ol",h("start")],["step","input",h("step")],["summary","table",h("summary")],["target","a area base form link",h("target")],["text","body",h("text")],["trueSpeed","marquee",D("truespeed")],["type","a area button embed input li link object ol param script source style ul",h("type")],["useMap","img input object",h("usemap")],["vAlign","col colgroup tbody td tfoot th thead tr",h("valign")],["vLink","body",h("vlink")],["value","button data li meter option param progress",h("value")],["value","input",h("value",Xr)],["valueType","param",h("valuetype")],["version","html",h("version")],["vspace","embed img input marquee object",h("vspace")],["width","canvas col colgroup embed hr iframe img input listing marquee object pre source table td th video xmp",h("width")],["wrap","textarea",h("wrap")]];ud=new Set(["output","textarea"]),pd=new Set(["a","option","title"])});var fd,dd;var Cl=v(()=>{fd={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."},dd={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var md;var Nl=v(()=>{md={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 gd,hd,yd;var Rl=v(()=>{gd={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},hd={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},yd={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var xd;var Tl=v(()=>{xd={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 bd,$d;var kl=v(()=>{bd={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"},$d={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 Sd;var Pl=v(()=>{Sd={description:"Image optimization configuration for the project.",properties:{formats:{description:'Output formats, each one of "avif", "jpeg", "png" or "webp" (default ["avif", "jpeg"]). AVIF and JPEG are lossy; PNG and WebP are written losslessly, so listing WebP produces larger files than either. A source with transparency is written as PNG wherever JPEG is listed.',items:{type:"string"},type:"array"},lazyLoad:{type:"boolean"},optimize:{type:"boolean"},picture:{description:"Wrap a multi-format image in a <picture> with one <source> per format (default true). With it off the <img> carries a srcset in the preferred format alone, which browsers that cannot decode that format will still select from.",type:"boolean"},quality:{description:"Lossy quality per format, 1 to 100 (defaults: avif 65, jpeg 80). The build writes png and webp losslessly, so png is never read and webp is read only by the cloudflare service, as the quality of its transform URLs (default 80).",properties:{avif:{type:"number"},jpeg:{type:"number"},png:{type:"number"},webp:{type:"number"}},type:"object"},remoteDomains:{description:'Hostnames whose remote (https) images are optimized through /cdn-cgi/image transform URLs (cloudflare service only), e.g. ["drive.usercontent.google.com"]. Remote sources from other hosts are left untouched.',items:{type:"string"},type:"array"},service:{description:'How images are optimized: "build" encodes variants at build time; "cloudflare" emits /cdn-cgi/image transform URLs served by Cloudflare Image Transformations (requires the feature to be enabled on the serving zone).',enum:["build","cloudflare"],type:"string"},sizes:{type:"string"},widths:{items:{type:"number"},type:"array"}},type:"object"}});var wd;var _l=v(()=>{wd={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var Ed,vd,Jd,Od,jd,Ad,Cd,Nd,Rd;var Ml=v(()=>{Ed={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},vd={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},Jd={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Od={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},jd={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Ad={description:"Reference to the current Array map iteration context.",examples:["$map/item","$map/index","$map/item/text","$map/item/done","#/$map/item/text"],pattern:String.raw`^(#/)?\$map/(item|index)(/.*)?$`,type:"string"},Cd={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Nd={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"},Rd={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Td;var Dl=v(()=>{Td={additionalProperties:{anyOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/RefObject"},{$ref:"#/$defs/StyleObject"}]},description:"CSS style definition. camelCase property names follow CSSOM convention. Keys starting with :, ., &, or [ are treated as nested CSS selectors. Keys matching $media breakpoint names (or other @-prefixed at-rules) group nested rules. Nesting is recursive: selector and at-rule groups may nest to arbitrary depth "+"(e.g. breakpoint → selector → pseudo-class), mirroring the compiler's recursive emission. "+"An object carrying $ref is a reactive VALUE, and the runtime reads it as one. It also matches the nested-block branch vacuously, since a block admits a string under any key, which is why these branches are anyOf rather than oneOf. A DECLARATION at-rule (@font-face, @property, @position-try, @counter-style) may hold an ARRAY of blocks, which is that key written more than once, in order: an object's keys are "+"unique, so @font-face — the at-rule whose identity is not in its key — could not otherwise "+"state a family's second weight at all.",patternProperties:{"^@(font-face|property|position-try|counter-style)":{anyOf:[{$ref:"#/$defs/StyleObject"},{items:{$ref:"#/$defs/StyleObject"},minItems:1,type:"array"}]}},properties:{$description:{description:"Why this rule exists. Emitted as a comment by static builds, ignored at runtime.",type:"string"}},type:"object"}});var kd,Pd;var Il=v(()=>{kd={additionalProperties:!1,description:"Dynamic mapped list. Re-renders when the items state entry changes.",properties:{$prototype:{const:"Array",type:"string"},filter:{$ref:"#/$defs/RefObject"},items:{oneOf:[{$ref:"#/$defs/RefObject"},{type:"array"}]},key:{additionalProperties:!1,description:"The identity of each rendered row: a $map/item pointer read per item, in either spelling ($map/item/id or #/$map/item/id). A row whose key survives a change keeps its DOM node and its effects across reorders, insertions and "+"removals; without a key, rows are keyed by index. $map/index is not a key — an index "+"names a position, not a row.",properties:{$ref:{pattern:String.raw`^(#/)?\$map/item(/.+)?$`,type:"string"}},required:["$ref"],type:"object"},map:{$ref:"#/$defs/ElementDef"},sort:{$ref:"#/$defs/RefObject"}},required:["$prototype","items","map"],type:"object"},Pd={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 _d,Md,Dd,Id,Ld,Fd;var Ll=v(()=>{_d={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Md={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"},Dd={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Id={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"},Ld={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"},Fd={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 Vd;var Fl=v(()=>{Vd={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 Wd;var Vl=v(()=>{Wd={additionalProperties:!1,description:'A function declaration. $prototype must be "Function". body (inline) and $src (external) are mutually exclusive; declaring both is an error. First parameter is always state (the reactive scope).',not:{required:["body","$src"]},properties:{$export:{description:"Named export in $src module. Defaults to the state key name.",type:"string"},$lazy:{description:"Load $src on first call instead of importing it up front. The function then returns a "+"promise, so it may only be called from a handler or lifecycle hook — never bound as a "+"computed value. Use it for code most visitors never reach.",type:"boolean"},$prototype:{const:"Function",type:"string"},$src:{description:"External module specifier. Mutually exclusive with body.",examples:["./counter.js","npm:@myorg/validators"],type:"string"},arguments:{description:"Legacy alias for parameters: bare string parameter names (state may be listed explicitly as the first name). Superseded by parameters.",examples:[["state","event"]],items:{type:"string"},type:"array"},body:{description:"Inline function body: a source string in erasable TypeScript, which plain JavaScript already is (spec §23.1; types are erased before it is analysed or run; first implicit parameter is state), or a structured statement array (spec §20) — explicit structured function declaration, analyzable by tooling and editable visually. The escalation ladder within the shape is structured statements → source string.",examples:["state.count++",'state.items.push({ id: Date.now(), text: "", done: false })','return state.score >= 90 ? "gold" : "silver"',"const input = event.target as HTMLInputElement; state.label = input.value",[{operator:"push",target:{$ref:"#/state/cart"},value:1},{dispatchEvent:"cart-changed",detail:{$ref:"#/state/cart"}}]],oneOf:[{type:"string"},{$ref:"#/$defs/StatementList"}]},description:{type:"string"},emits:{description:"Array of CEM-compatible Event objects this function dispatches. Used for CEM extraction and studio event discovery.",items:{$ref:"#/$defs/CemEvent"},type:"array"},name:{description:"Explicit function name. Defaults to the state key name.",type:"string"},parameters:{description:"Function parameters (after the implicit state parameter). Accepts CEM-compatible parameter objects or bare string names for backward compatibility.",examples:[["event"],[{name:"event",type:{text:"Event"}}],[{description:"Item identifier",name:"id",type:{text:"number"}}]],items:{oneOf:[{type:"string"},{$ref:"#/$defs/CemParameter"}]},type:"array"},type:{description:"Return type for tooling (JSON Schema or CEM { text } format)."}},required:["$prototype"],type:"object"}});var Hd,Bd;var Wl=v(()=>{Hd={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"}]},Bd={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 si,qd;var Hl=v(()=>{si=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],qd={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 Ud;var Bl=v(()=>{Ud={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 zd,Kd,Gd,Yd,Xd,Zd,Qd,em,tm,nm,rm,sm,om,im,am,lm,cm;var ql=v(()=>{No();zd={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"},Kd={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."},Gd={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."},Yd={enum:["!","-"]},Xd={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},Zd={const:"?:"},Qd={const:"switch"},em={const:"call"},tm={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"]},nm={enum:["=","+=","-=","*=","/="]},rm={enum:["pop","shift"]},sm={enum:["push","unshift"]},om={const:"splice"},im={const:"reduce"},am={enum:["map","filter"]},lm={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 "+`${el()}) — 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"},cm={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 um,pm,fm,dm;var Ul=v(()=>{um={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"}]},pm={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},fm={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},dm={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 zl,mm,gm,hm,ym,xm,bm,$m,Sm,wm,Em;var Kl=v(()=>{zl=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],mm={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"},gm={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"},hm={description:"Class constructor definition.",properties:{$prototype:{const:"Function",type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},role:{const:"constructor",type:"string"},superCall:{properties:{arguments:{items:{type:"string"},type:"array"}},type:"object"}},type:"object"},ym={description:"A class method or accessor definition. Capability roles (parse, serialize, rewrite, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",properties:{$prototype:{const:"Function",type:"string"},access:{enum:["public","private","protected"],type:"string"},body:{description:"The member's body in erasable TypeScript, which plain JavaScript already is (spec §23.1), as one string or as an array of lines.",oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:{type:"string"},getter:{properties:{body:{type:"string"}},type:"object"},identifier:{type:"string"},parameters:{items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{$ref:"#/$defs/ClassParameterDef"}]},type:"array"},returnType:{},role:{enum:zl,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"},xm={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"},bm={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"},$m={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"},Sm={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"},wm={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"},Em={additionalProperties:!1,description:'A .class.json schema-defined class. $prototype must be "Class". Defines fields, constructor, methods, and type parameters via $defs. Optionally points to a JS module via $implementation for hybrid execution.',properties:{$defs:{description:"Class members: parameters, returnTypes, fields, constructor, methods.",properties:{constructor:{$ref:"#/$defs/ClassConstructorDef"},fields:{additionalProperties:{$ref:"#/$defs/ClassFieldDef"},description:"Class fields with role, access, scope, and type information.",type:"object"},methods:{additionalProperties:{$ref:"#/$defs/ClassMethodDef"},description:"Class methods and accessors.",type:"object"},parameters:{additionalProperties:{$ref:"#/$defs/ClassParameterDef"},description:"Reusable typed parameter schemas, keyed by name.",type:"object"},returnTypes:{additionalProperties:{type:"object"},description:"Output type schemas, keyed by name.",type:"object"}},type:"object"},$id:{type:"string"},$implementation:{description:"Relative path to a JS module containing the actual class implementation.",type:"string"},$prototype:{const:"Class",type:"string"},$schema:{type:"string"},$studio:{$ref:"#/$defs/StudioHints"},connector:{$ref:"#/$defs/ConnectorBlockDef"},description:{type:"string"},extends:{description:"Base class — string name or $ref to another .class.json.",oneOf:[{type:"string"},{properties:{$ref:{type:"string"}},required:["$ref"],type:"object"}]},format:{$ref:"#/$defs/FormatDef"},project:{$ref:"#/$defs/ProjectBlockDef"},server:{$ref:"#/$defs/ServerBlockDef"},title:{description:"PascalCase class name, used as the export name.",type:"string"}},required:["$prototype","title"],type:"object"}});function ln(e){if(!y(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Eb(e){let t=ln(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&vm.has(r)?"rtl":"ltr"}function vb(e){let t=ln(e);if(t===null)return y(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Jb(e){let t=e.i18n,n=[];if(!j(t))return{errors:n,i18n:null};let r=Array.isArray(t.locales)?t.locales:[],s=[];for(let l of r){let c=ln(l);if(c===null){n.push(`i18n.locales: "${String(l)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(c))s.push(c)}let o=ln(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&ln(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};if(!s.includes(o))s.unshift(o);let i=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:Jm;return{errors:n,i18n:{defaultLocale:o,locales:s,routing:i}}}function Ob(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=ln(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var vm,Zr="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",Jm="prefix-except-default";var Gl=v(()=>{K();vm=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});var Yl,Om;var Xl=v(()=>{Gl();Yl=[301,302,303,307,308],Om={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:Zr,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:Zr,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:Zr,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:[...Yl],type:"integer"}},required:["destination"],type:"object"},{additionalProperties:!1,description:"A rewrite (proxy): the destination's content is served AT the source URL, with no "+"redirect. Emitted as status 200 in `_redirects`, which is the host convention — "+"not an HTTP redirection status.",properties:{destination:{type:"string"},rewrite:{const:!0,type:"boolean"}},required:["destination","rewrite"],type:"object"}]},description:"Static redirect and rewrite rules. Keys are source paths in URLPattern pathname syntax.",examples:[{"/api/*":{destination:"https://api.example.com/*",rewrite:!0},"/legacy/*":{destination:"/archive/*",status:308},"/old-about":"/about"}],propertyNames:{pattern:"^/"},type:"object"},state:{description:"Site-wide reactive state available to all pages.",type:"object"},style:{additionalProperties:{oneOf:[{type:"string"},{type:"number"},{$ref:"#/$defs/StyleObject"}]},description:"Global CSS styles applied to the <body> element. Uses the same camelCase CSSOM convention and recursive selector/at-rule nesting as component styles.",type:"object"},url:{description:"Production URL of the deployed site.",examples:["https://example.com","https://jxsuite.com"],type:"string"}},type:"object"}});var jm;var Zl=v(()=>{jm={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 Rb="https://jxsuite.com/schema/project/fields/v2",Tb="https://jxsuite.com/schema/document/paths/v2",Am,Cm,kb,Pb;var Ql=v(()=>{Am={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"},Cm={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"},kb=[{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"}],Pb={description:"A source shape contributed by an extension this schema cannot see. The project's generated document.schema.json validates these exactly; enable the owning extension and regenerate with `jx schema` to get precise checking here.",minProperties:1,type:"object"}});var ec=v(()=>{Cl();Nl();Rl();Tl();kl();Pl();_l();Ml();Dl();Il();Ll();Fl();Vl();Wl();Hl();Bl();ql();Ul();Kl();Xl();Zl();Ql()});function tc(e,t,n){let r=e.$description;if(y(r))(Object.keys(t).length>0?t:n).$description=r}function nc(e,t,n,r,s=Nm,o={}){let i=[],l=(p,d)=>{let x={mediaQueries:t,scope:d,transposeValue:n};if(r)x.resolveValue=(w,g)=>r(w,g,d);for(let w of tn(p,x))i.push(o.comments===!0?qn(w):w.text)},c={},a={},u=[],f=[];for(let[p,d]of Object.entries(e)){if(j(d)&&!Array.isArray(d)){if(p.startsWith("@"))u.push([p,d]);else if(!p.startsWith("--"))f.push([p,d]);continue}if(Bn(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")c[p]=d;else a[p]=d}tc(e,c,a),l(c,s.root),l(a,s.body);for(let[p,d]of f)if(p.startsWith("&"))l({[p]:d},s.root);else l(d,p);for(let[p,d]of u){if(Wn(p)||Hn(p)){l({[p]:d},null);continue}let x={},w={},g=[];for(let[m,b]of Object.entries(d)){if(j(b)&&!Array.isArray(b)){if(!m.startsWith("@"))g.push([m,b]);continue}if(m.startsWith("$"))continue;if(m.startsWith("--"))x[m]=b;else w[m]=b}tc(d,x,w),l({[p]:x},s.root),l({[p]:w},s.body);for(let[m,b]of g)l({[p]:b},m)}if(Object.values(t).some((p)=>pt(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${Ue}="light"]) { color-scheme: light }`,`${s.root}:where([${Ue}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
14
|
+
`)}var Nm;var rc=v(()=>{Un();K();Nm={body:"body",root:":root"}});function sc(e,t){return t===null?e:":host"}var Qr=v(()=>{Un()});function nr(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=ic(s);if(!o)continue;let i=ac(s)?`_a[${r}] === undefined ? ${JSON.stringify(s.default)} : _a[${r}]`:`_a[${r}]`;n.push(`${JSON.stringify(o)}: ${i}`)}return`(..._a) => { const _args = { ${n.join(", ")} }; return ${t}; }`}function ic(e){return y(e)?e:e?.name??""}function ac(e){return j(e)&&"default"in e}function Rm(e,t){let n=lc(e,t);return n===e?e:`${n} as ${e}`}function lc(e,t){let n=t?.$export;return y(n)&&n!==""?n:e}function os(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o}=n,{url:i}=t,l=B(i),c=t.method??"GET";if(t.manual)return`${s}// ${e}: manual Request — fetch triggered by user action`;let a=[`// ${e}: auto-fetch from ${l?"(dynamic URL)":i}`,o?`${o}.push(effect(() => {`:"effect(() => {"];if(l)a.push(` const url = \`${km(i,r)}\`;`,' if (!url || url === "undefined" || url.includes("undefined")) return;');else a.push(` const url = ${JSON.stringify(i)};`);let u=[];if(c!=="GET")u.push(`method: ${JSON.stringify(c)}`);if(t.headers)u.push(`headers: ${JSON.stringify(t.headers)}`);if(t.body){let p=j(t.body)?JSON.stringify(JSON.stringify(t.body)):JSON.stringify(t.body);u.push(`body: ${p}`)}let f=u.length>0?`, { ${u.join(", ")} }`:"";return a.push(` fetch(url${f})`," .then(r => r.ok ? r.json() : Promise.reject(r.statusText))",` .then(d => { ${r}.${e} = d; })`,` .catch(e => { ${r}.${e} = { error: String(e) }; });`,o?"}));":"});"),a.map((p)=>`${s}${p}`).join(`
|
|
15
|
+
`)}function is(e,t,n={}){let{statePrefix:r="state",indent:s="",collect:o,serverBaseUrl:i="/_jx/server"}=n,l=JSON.stringify(`${i}/${t.$export}`),c=Object.entries(t.arguments??{}),a=c.map(([w,g])=>{if(!_(g))return`${dt(w)}: ${JSON.stringify(g)}`;if(Tm.some((m)=>g.$ref.startsWith(m)))throw Error(`Server function "${e}": argument "${w}" references "${g.$ref}", which a state entry cannot read. Use a #/state/, parent#/, window#/ or document#/ reference.`);return`${dt(w)}: ${mt({$ref:g.$ref},{statePrefix:r})}`}),u=c.some(([,w])=>_(w)),f=`${vc}(${l}, ${a.length>0?`{ ${a.join(", ")} }`:"{}"})`,p=U(r,xe(e)),d=`console.error(${JSON.stringify(`Jx server function ${t.$export}:`)}, e)`;return(u?[`// ${e}: server function ${t.$export}, called again when an argument changes`,"{"," let _jxSeq = 0;",o?` ${o}.push(effect(() => {`:" effect(() => {"," const _seq = ++_jxSeq;",` ${f}`,` .then((d) => { if (_seq === _jxSeq) ${p} = d; })`,` .catch((e) => { if (_seq === _jxSeq) ${d}; });`,o?" }));":" });","}"]:[`// ${e}: server function ${t.$export}, called once`,f,` .then((d) => { ${p} = d; })`,` .catch((e) => { ${d}; });`]).map((w)=>`${s}${w}`).join(`
|
|
16
|
+
`)}function km(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function oc(e){return`<script type="importmap">
|
|
17
|
+
{
|
|
18
|
+
"imports": {
|
|
19
|
+
${Object.entries(e).map(([n,r])=>` ${JSON.stringify(n)}: ${JSON.stringify(r)}`).join(`,
|
|
20
|
+
`)}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
</script>`}function pn(e){if(e.runtimeImports!==void 0)return oc(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return oc(e.litHtmlSrc===vt?{...t,"lit-html/":`${vt}/`}:t)}function uc(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${Xn}\??\.${Xn}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${Xn}(?:\?\.)?\[${Xn}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||Pm.test(e)}function pc(e,t){let n=Fo(t),r=e.state??{},s=Object.keys(n).filter((a)=>!(a in r));if(s.length===0)return e;let o=JSON.stringify(e),i=Object.values(r).some((a)=>j(a)&&!Array.isArray(a)&&y(a.$src)),l=new Set(s.filter((a)=>i||uc(o,a)));for(let a of l)for(let u of Lo(n[a]))if(!(u in r))l.add(u);if(l.size===0)return e;let c=Object.fromEntries(s.filter((a)=>l.has(a)).map((a)=>[a,n[a]]));return{...e,state:{...c,...r}}}function _m(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!zn(n)));return JSON.stringify({...e,state:t})}function as(e){if(y(e))return B(e);if(!j(e))return!1;if(e.state){let n;for(let[r,s]of Object.entries(e.state)){if(r==="$site"||r==="$page")continue;if(!j(s)||Array.isArray(s))return!0;if(s.timing==="compiler")continue;if(zn(s)){if(n??=_m(e),uc(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if(Et(s))continue;return!0}}if(e.$switch)return!0;if(Q(e)||va(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>as(n)))return!0;let t=fn(e);for(let[n,r]of Object.entries(e)){if(Ke.has(n)||t&&n==="innerHTML")continue;if(_(r))return!0;if(B(r))return!0}if(j(e.style)){for(let n of Object.values(e.style))if(B(n))return!0}if(j(e.attributes)){for(let n of Object.values(e.attributes))if(B(n))return!0}return!1}function fn(e){return e.$static===!0||e.$prerendered===!0}function dn(e,t=null,n={},r={}){let s=e?.state?li(e.state,t):t??ns();return{media:r,scope:s,scopeDefs:n}}function ns(e=null){return Object.create(e)}function ci(e){return e[cc]}function Mm(e,t){return ci(e)?.has(t)??!1}function rr(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return Mm(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function ai(e,t,n){if(t>0&&Lm.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!Fm.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function fc(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(ai(e,t,!0)&&!ai(e,t,!1))return!0;return!1}function mn(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:Mt(e),o="",i=0;for(let l=s.indexOf("state");l!==-1;l=s.indexOf("state",l+1))if(ai(s,l,r))o+=e.slice(i,l)+t,i=l+5;return o+e.slice(i)}function rs(e,t){if(y(e)){if(!e.includes("state."))return;let o=Mt(e);for(let i of o.matchAll(Dm))t.add(i[1]);for(let i of o.matchAll(Im))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)rs(o,t);return}if(!j(e))return;let n=e,{operator:r,target:s}=n;if(y(r)&&ze(r)&&_(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))rs(o,t)}function ts(e,t){for(let n of xn(e)){if(Q(n)){ts(n.map?[n.map]:[],t);continue}if(!Be(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(me(s)||Ne(s)))rs(s.body??s.$expression,t);ts(Object.values(n.cases??{}).filter((r)=>Be(r)&&!ee(r)),t),ts(n.children,t)}}function ht(e,t){if(me(t)&&Eo(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function ls(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(ht(`state entry "${r}"`,s),!me(s)||!s.$src)continue;if(s.$lazy===!0){if(t.get(r)==="computed")throw Error(`"${r}" declares "$lazy": true but is used as a computed value, not called. A lazily loaded function resolves to a promise; a computed must resolve now. Remove "$lazy", or call ${r}() from a handler instead of binding its value.`);let i=n.lazy.get(s.$src);if(!i)i=[],n.lazy.set(s.$src,i);i.push({binding:r,exportName:lc(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(Rm(r,s))}return n}function cs(e,t){let n=[];for(let[o,i]of e.eager)n.push(`import { ${[...i].join(", ")} } from '${t?t(o):o}';`);let r=[],s=0;for(let[o,i]of e.lazy){let l=`_jxLazy${s}`;s+=1,r.push(`let ${l};`,`const ${l}Load = () => (${l} ??= import('${t?t(o):o}'));`,...i.map(({binding:c,exportName:a})=>`const ${c} = (...args) => ${l}Load().then((m) => m.${a}(...args));`))}return{imports:n,loaders:r}}function li(e={},t=null,n={}){let r=ns(t),s=t?ci(t):void 0,o=new Set(s);if(Object.defineProperty(r,cc,{configurable:!0,enumerable:!1,value:o,writable:!0}),n.holdMutable===!0){let f=new Set;for(let p of Object.values(e))if(me(p)||Ne(p))rs(p.body??p.$expression,f);if(n.document)ts([n.document],f);for(let p of f)if(p in e)o.add(p)}let i=nt({state:e});for(let[f,p]of Object.entries(e)){if(!j(p)||Array.isArray(p)){gt(r,f,es(p));continue}if("default"in p){gt(r,f,es(p.default));continue}if(ut(p)){o.add(f);continue}if(!p.$prototype&&!("$expression"in p)&&!Et(p))gt(r,f,es(p))}let l=[],c=[],a=[];for(let[f,p]of Object.entries(e)){if(B(p)){l.push([f,p]);continue}if(!j(p))continue;if(Ne(p)){let d=p.$expression;if(a.push([f,JSON.stringify(d)]),Qe(p)){let x=p.parameters;gt(r,f,(...w)=>{let g={};for(let[m,b]of x.entries()){let S=ic(b);if(!S)continue;g[S]=w[m]===void 0&&ac(b)?b.default:w[m]}return _e(d,r,null,{args:g})})}else if(ze(d.operator))gt(r,f,(x,w)=>_e(d,x,w));else oi(r,f,()=>_e(d,r,null));continue}if(me(p)){if(ht(`state entry "${f}"`,p),et(p)){let{body:d}=p;a.push([f,JSON.stringify(d)]),gt(r,f,(x,w)=>{an(d,x??r,w??null)})}else if(y(p.body)){let{body:d}=p,x=Function(...tt(p),d);if(i.get(f)==="computed")oi(r,f,()=>x(r)),c.push([f,d]);else gt(r,f,x),a.push([f,d])}else gt(r,f,()=>{}),o.add(f);continue}if(ct(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){gt(r,f,es(p.default??null));continue}if(ct(p)&&p.$prototype==="Request")o.add(f);if(hn(p))o.add(f)}let u=!0;while(u){u=!1;for(let[f,p]of[...c,...l])if(!o.has(f)&&mc(p,r))o.add(f),u=!0;for(let[f,p]of a)if(!o.has(f)&&Vm(p,o))o.add(f),u=!0}for(let[f,p]of l)oi(r,f,()=>ui(p,r));return r}function gt(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function oi(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function te(e,t){if(_(e))return dc(e.$ref,t);if(B(e))return ui(e,t);return e}function ee(e){return _(e)}function dc(e,t){if(!y(e))return e;let n=Ce(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?ii(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return ii(t,e.slice(8));return ii(t,e)??null}function mc(e,t){if(!t)return!1;let n=ci(t);for(let r of e.matchAll(/\bstate\.([A-Za-z_$][\w$]*)\s*(\()?/g)){if(r[2])continue;let s=r[1];if(n?.has(s))return!0;let o;try{o=t[s]}catch{continue}if(je(o))return!0}return!1}function Vm(e,t){for(let n of e.matchAll(/#\/state\/([^"/\\]+)|\bstate\.([A-Za-z_$][\w$]*)/g)){let[,r,s]=n,o=r===void 0?s:r.replaceAll("~1","/").replaceAll("~0","~");if(o!==void 0&&t.has(o))return!0}return!1}function us(e){return Kr(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function ui(e,t){if(mc(e,t))return null;let n=["state","$map","$site","$page"],r=[t,t?.$map,t?.$site,t?.$page],s=t?.$map;if(j(s)&&!Array.isArray(s)){n.push("item","index");let o=s;r.push(o.item,o.index)}try{let o=Kr(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function ii(e,t){return be(e,t)}function es(e){if(!j(e))return e;return structuredClone(e)}function Wm(e,t){if(!e||!t)return"";return Object.entries(e).filter(([n,r])=>!n.startsWith(":")&&!n.startsWith(".")&&!n.startsWith("&")&&!n.startsWith("[")&&!n.startsWith("@")&&B(r)).map(([n,r])=>{let s=te(r,t);return s==null?null:`${Re(n)}: ${s}`}).filter(Boolean).join("; ")}function Hm(e,t){if(!y(t)&&!Y(t)&&!le(t))return null;if(e.kind==="text")return String(t);if(e.kind==="hidden"){if(y(t)&&t.toLowerCase()==="until-found")return"until-found";return t?"":null}let n=Boolean(t);if(e.keywords)return e.keywords[n?0:1];return st(e.attribute,n)}function hc(e,t){if(_(e)&&(t===null||rr(e.$ref,t)))return;try{return te(e,t)}catch{return}}function Yn(e,t,n){return n&&t===""?` ${e}`:` ${e}="${G(t)}"`}function Dt(e,t,n=""){let r=fr(e.tagName,t),s=new Map,o,i=te(e.id,t);if(i)s.set("id",Yn("id",String(i),!1));let l=ur(e),c=l?te(pr(e),t):null,a=[y(c)||Y(c)?String(c):"",Jt(e)??""].filter((w)=>w!=="").join(" ");if(a)s.set("class",Yn("class",a,!1));let u=(w,g)=>{if(g===void 0)return;let m=jl(r,w);if(!m)return;let b=hc(g,t);if(m.live&&b!==void 0)o??=new Set,o.add(m.attribute);let S=Hm(m,b);if(S!==null)s.set(m.attribute,Yn(m.attribute,S,m.kind!=="text"))};for(let w of gc)u(w,e[w]);let f=e;for(let w of Object.keys(f)){if(qm.has(w)||w.startsWith("$")||w.startsWith("on")||ri(r,w))continue;u(w,f[w])}let p="";if(e.attributes)for(let[w,g]of Object.entries(e.attributes)){if(l&&w==="class")continue;let m=te(g,t),b=null;if(le(m)){let E=st(w,m);b=E===null?null:Yn(w,E,!0)}else if(y(m)||Y(m))b=Yn(w,String(m),!1);let S=w.toLowerCase();if(o?.has(S))continue;if(s.has(S)){if(b===null&&(m===null||m===void 0||le(m)))s.delete(S);else if(b!==null)s.set(S,b);continue}p+=b??""}let d="";for(let w of s.values())d+=w;let x=[Wm(e.style,t),n].filter(Boolean).join("; ");if(x)d+=` style="${G(x)}"`;if(d+=p,e.$static)d+=" data-jx-static";else if(e.$prerendered)d+=" data-jx-prerendered";return d}function sr(e,t,n){if(fn(e))return;if(!(("innerText"in e)||("value"in e)||("defaultValue"in e)||("text"in e)))return;for(let[r,s]of Object.entries(e)){if(s===void 0||!ri(t,r))continue;let o=hc(s,n),i=o===null||o===void 0?"":G(String(o));return r==="innerText"?i.replaceAll(/\r\n|\r|\n/gu,"<br>"):i}return}function or(e,t=" "){return e?"":`
|
|
24
|
+
${t}`}function ps(){let e=JSON.stringify(Hr),t=JSON.stringify(Ue);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function yc(e,t,n,r,s={}){for(let o of tn(t,{...s,mediaQueries:r,resolveValue:(i,l)=>xc(i,l,n),scope:n}))e.push(qn(o))}function xc(e,t,n){let r=y(t)?t:t.$ref;return Um.push({property:e,selector:n,source:r}),null}function fs(){return`const __jxEnumAttrs = new Set(${JSON.stringify(wl())});
|
|
25
|
+
function ${It}(n, v) {
|
|
19
26
|
if (typeof v !== 'boolean') return v;
|
|
20
27
|
const l = n.toLowerCase();
|
|
21
28
|
if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
|
|
22
29
|
return v ? '' : null;
|
|
23
|
-
}`}function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
${
|
|
30
|
+
}`}function ds(e){let t={keyed:!1,arranged:!1},n=(r)=>{for(let s of xn(r)){if(Q(s)){t.arranged||=_(s.filter)||_(s.sort),t.keyed||=_(s.key),n(s.map?[s.map]:[]);continue}if(!Be(s))continue;n(Object.values(s.cases??{}).filter((o)=>Be(o)&&!ee(o))),n(s.children)}};return n([e]),t}function zm(e,t){for(let r of[e.items,e.filter,e.sort])if(_(r)&&rr(r.$ref,t))return!1;let n=(r)=>{for(let s of xn(r)){if(Q(s)){if(!zm(s,t))return!1;continue}if(!Be(s))continue;let o=Object.values(s.cases??{}).filter((i)=>Be(i)&&!ee(i));if(!n(o)||!n(s.children))return!1}return!0};return n(e.map?[e.map]:[])}function ir(e){let{items:t}=e;if(B(t))throw Error(`A repeater's items must be a $ref or a literal array, not the template string ${JSON.stringify(t)}. A template is not read as a list: bind items to a state entry by $ref, and compute the list in that entry.`)}function ms(e){let t=Ce(e);if(t==="$map/item")return[];return t.startsWith("$map/item/")?Ie(t.slice(10)):null}function gs(){return`function ${gn}(items, filter, sort) {
|
|
31
|
+
if (!Array.isArray(items)) return [];
|
|
32
|
+
let list = items;
|
|
33
|
+
if (typeof filter === 'function') list = list.filter(filter);
|
|
34
|
+
if (typeof sort === 'function') list = [...list].sort(sort);
|
|
35
|
+
return list;
|
|
36
|
+
}
|
|
37
|
+
function ${bc}(list, path, pointer, warn) {
|
|
38
|
+
const keys = list.map((item, index) => {
|
|
39
|
+
if (pointer === null) return index;
|
|
40
|
+
if (path === null) {
|
|
41
|
+
`+' warn(`key "${pointer}" is not a $map/item pointer — rows fall back to their index`);\n'+` return index;
|
|
42
|
+
}
|
|
43
|
+
if (path.length === 0) return item;
|
|
44
|
+
let key = item;
|
|
45
|
+
for (const name of path) key = key?.[name];
|
|
46
|
+
if (key === undefined || key === null) {
|
|
47
|
+
`+' warn(`key "${pointer}" is empty for some items — those rows fall back to their index`);\n'+` return index;
|
|
48
|
+
}
|
|
49
|
+
return key;
|
|
50
|
+
});
|
|
51
|
+
const seen = new Set();
|
|
52
|
+
for (let i = 0; i < keys.length; i++) {
|
|
53
|
+
if (seen.has(keys[i])) {
|
|
54
|
+
`+" warn(`duplicate key ${String(keys[i])} — every occurrence after the first is rebuilt on each change`);\n"+` keys[i] = { duplicate: i };
|
|
55
|
+
} else {
|
|
56
|
+
seen.add(keys[i]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return keys;
|
|
60
|
+
}`}function ys(){return["class __JxKeyedList extends AsyncDirective {"," #args = null;"," #runner = null;"," #queued = false;"," #warned = false;"," #snap = shallowRef({ list: [], keys: [] });"," #warn = (message) => {"," if (this.#warned) return;"," this.#warned = true;"," console.warn(`Jx $map: ${message}`);"," };"," #compute = () => {"," const [items, filter, sort, path, pointer] = this.#args;",` const list = Array.from(${gn}(items, filter, sort));`,` this.#snap.value = { list, keys: ${bc}(list, path, pointer, this.#warn) };`," };"," #schedule = () => {"," if (this.#queued) return;"," this.#queued = true;"," queueMicrotask(() => {"," this.#queued = false;"," if (this.#runner) this.#runner();"," });"," };"," #start(lazy) {"," this.#runner = effect(this.#compute, { lazy, scheduler: this.#schedule });"," if (lazy) this.#schedule();"," }"," render() {}"," update(_part, args) {"," const previous = this.#args;"," this.#args = args;"," if (!this.#runner) {"," if (this.isConnected) this.#start(false);"," } else if (previous[0] !== args[0] || previous[1] !== args[1] || previous[2] !== args[2]) {"," this.#schedule();"," }"," const snap = this.#snap.value;"," return repeat(snap.list, (_item, index) => snap.keys[index], args[5]);"," }"," disconnected() {"," if (this.#runner) stop(this.#runner);"," this.#runner = null;"," }"," reconnected() {"," if (!this.#runner && this.#args) this.#start(true);"," }","}",`const ${lr} = directive(__JxKeyedList);`,"const __jxLiterals = new Map();",`function ${ar}(text) {`," if (!__jxLiterals.has(text)) __jxLiterals.set(text, JSON.parse(text));"," return __jxLiterals.get(text);","}"].join(`
|
|
61
|
+
`)}function $c(){return[`function ${pi}(el, k) {`," if (Object.hasOwn(el, k)) return true;"," if (el.hasAttribute(k)) return true;"," const kebab = k.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase());"," return kebab !== k && el.hasAttribute(kebab);","}",`function ${fi}(el, k) {`," for (let p = Object.getPrototypeOf(el); p; p = Object.getPrototypeOf(p)) {"," const d = Object.getOwnPropertyDescriptor(p, k);"," if (d) return d.set;"," }"," return undefined;","}"].join(`
|
|
62
|
+
`)}function Sc(){return[`function ${xs}(state, name, value, defaults) {`," const key = name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," if (defaults && defaults.has(key) && defaults.get(key) === undefined) return;"," const current = state[key];"," if (typeof current === 'boolean') {"," state[key] = value !== null && value !== 'false';"," return;"," }"," if (value === null) {"," const declared = defaults ? defaults.get(key) : undefined;"," state[key] = declared === undefined ? (typeof current === 'number' ? 0 : '') : declared;"," return;"," }"," state[key] = typeof current === 'number' ? Number(value) : value;","}"].join(`
|
|
63
|
+
`)}function wc(e){return Zt(e)}function cr(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>y(n)):[]}function Ec(e){let t=Qo(e),n=new Set(cr(e).map((s)=>wc(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function bs(){return[`async function ${vc}(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(`
|
|
64
|
+
`)}function Gm(e){let t={};for(let[n,r]of Object.entries(e))if(!Km.has(n)&&r!==void 0)t[n]=r;return t}function Xm(e){return ct(e)&&!Ym.has(e.$prototype)}function hn(e){return Xm(e)&&e.timing==="client"}function $s(){return[`async function ${Jc}(C, name, config) {`,` if (typeof C !== 'function') throw new TypeError('Jx: "' + name + '" is not a class');`," const i = new C(config);"," const v = typeof i.resolve === 'function' ? await i.resolve() : 'value' in i ? i.value : i;"," return [v, i];","}"].join(`
|
|
65
|
+
`)}function Ss(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!hn(o))continue;if(t===void 0)throw Error(`"${s}": external class "${o.$prototype}" with timing "client" compiles only in a site build`);let i=t(o),l=r.get(i);if(l===void 0)l=`_JxClass${r.size}`,r.set(i,l);n.push({binding:l,config:Gm(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function ws(e,t){let{indent:n,instances:r,statePrefix:s}=t,o=["Promise.all(["];for(let{binding:i,config:l,key:c,name:a}of e){let u=U(s,xe(c)),f=JSON.stringify(c);o.push(`${n} ${Jc}(${i}, ${JSON.stringify(a)}, ${JSON.stringify(l)}).then(([v, i]) => {`,`${n} ${u} = v;`,`${n} ${r}.set(${f}, i);`,`${n} if (typeof i.subscribe === 'function') i.subscribe((n) => { ${u} = n; });`,`${n} }).catch((e) => { console.error(${JSON.stringify(`Jx: external class "${c}" failed`)}, e); }),`)}return o.push(`${n}])`),o.join(`
|
|
66
|
+
`)}function Oc(){return[`function ${di}(host, internals, state, keys, root, formValue, watch) {`," const initial = { checked: state.checked, value: state.value };"," let ownDisabled = state.disabled;"," let forced = false;"," const control = () => root().querySelector('input, textarea, select');"," const mayBeLabelled = () => {"," if (host.closest('label')) return true;"," const id = host.id;"," if (id === '') return false;"," const tree = host.getRootNode();"," const scope = tree instanceof DocumentFragment ? tree : host.ownerDocument;"," return Array.from(scope.querySelectorAll('label[for]'))"," .some((label) => label.getAttribute('for') === id);"," };"," const nameControl = () => {"," if (!mayBeLabelled()) return;"," const target = control();"," const labels = internals.labels;"," if (target && labels.length > 0 && 'ariaLabelledByElements' in target &&"," !target.hasAttribute('aria-label') && !target.getAttribute('aria-labelledby')) {"," target.ariaLabelledByElements = Array.from(labels).filter((l) => l instanceof Element);"," }"," };"," host.addEventListener('click', (event) => {"," const target = control();"," if (event.target !== host || !target || target.disabled) return;"," target.focus();"," if (target.type === 'checkbox' || target.type === 'radio') target.click();"," });"," host.addEventListener('focusin', nameControl);"," const valueMissingMessage = () => {"," const probe = host.ownerDocument.createElement('input');"," probe.required = true;"," if (keys.checked) probe.type = 'checkbox';"," return probe.validationMessage || 'Please fill out this field.';"," };"," return {"," disabled(flag) {"," if (!keys.disabled) return;"," if (flag) {"," if (!forced) { ownDisabled = host.hasAttribute('disabled') ? false : state.disabled; forced = true; }"," state.disabled = true;"," } else if (forced) {"," forced = false;"," state.disabled = ownDisabled;"," }"," },"," reset() {"," if (keys.value) state.value = initial.value;"," if (keys.checked) state.checked = initial.checked;"," },"," start() {"," if (formValue) {"," watch(() => {"," const value = formValue();"," if (value === null || value === undefined) internals.setFormValue(null);"," else if (value instanceof File || value instanceof FormData) internals.setFormValue(value);"," else internals.setFormValue(String(value));"," });"," }"," if (keys.required) {"," watch(() => {"," const empty = keys.checked"," ? !state.checked"," : state.value === null || state.value === undefined || state.value === '';"," if (state.required && empty) {"," internals.setValidity({ valueMissing: true }, valueMissingMessage(), control() ?? undefined);"," } else {"," internals.setValidity({});"," }"," });"," }"," nameControl();"," },"," };","}"].join(`
|
|
67
|
+
`)}function jc(){let e=`new RegExp(${JSON.stringify(Gr.source)}, ${JSON.stringify(Gr.flags)})`,t=`Symbol.for(${JSON.stringify(ni)})`,n=JSON.stringify(ti),r=JSON.stringify(Yr);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${mi}(host) {`,` const id = host.getAttribute(${n});`," if (id === null) return Array.from(host.childNodes);",` host.removeAttribute(${n});`,` const open = ${r} + ' ' + id + ' ';`,` const close = '/' + ${r} + ' ' + id;`," const openers = [];"," const w = host.ownerDocument.createTreeWalker(host, 128);"," for (let n = w.nextNode(); n; n = w.nextNode()) if (n.data.startsWith(open)) openers.push(n);"," const out = [];"," for (const o of openers) {"," const name = decodeURIComponent(o.data.slice(open.length));"," for (let n = o.nextSibling; n; n = n.nextSibling) {"," if (n.nodeType === 8 && n.data === close) break;"," __jxSlotRec.set(n, name);"," out.push(n);"," }"," }"," return out;","}",`function ${gi}(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(`
|
|
68
|
+
`)}function cn(e){for(let t of xn(e)){if(Q(t)){if(t.map&&cn([t.map]))return!0;continue}if(!Be(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>Be(r)&&!ee(r));if(cn(n)||cn(t.children))return!0}return!1}function xn(e){if(Q(e))return[e];if(!Array.isArray(e))return[];return e}function bn(e,t={},n=null){let r=[],s=nc(j(n)?n:{},t,(i)=>i,xc,void 0,{comments:!0});if(s!=="")r.push(s);if(Rc(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
|
|
69
|
+
${Zm(r.join(`
|
|
31
70
|
`))}
|
|
32
|
-
</style>`}function
|
|
33
|
-
${
|
|
34
|
-
`);return""}function
|
|
35
|
-
`)
|
|
36
|
-
|
|
37
|
-
|
|
71
|
+
</style>`}function Zm(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Jt(e){return e[Ac]}function Cc(e,t,n){let r=Jt(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[Ac]=s,s}function Es(e){let{children:t}=e;if(Array.isArray(t))return t;return Q(t)?[t]:[]}function Qn(e,t){if(!j(e))return;if(Q(e)){if(e.map)Qn(e.map,t);return}t(e);for(let n of Es(e))Qn(n,t);if(j(e.cases))for(let n of Object.values(e.cases))Qn(n,t)}function Nc(e,t,n){Qn(e,(r)=>{if(r.style)Cc(r,t,n)})}function ur(e){return Jt(e)!==void 0||Boolean(e.className)}function pr(e){let{attributes:t}=e;return j(t)&&Object.hasOwn(t,"class")?t.class:e.className}function Rc(e,t,n,r="",s,o="jx",i={}){let l=s??{n:0};Qn(e,(c)=>{if(c.style)yc(t,c.style,`.${Cc(c,l,o)}`,n,i)})}function G(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function $n(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function S$(e){let t=new Set;return Tc(e,t),[...t]}function Tc(e,t){if(!j(e))return;if(e.state){for(let n of Object.values(e.state))if(me(n)&&n.$src)t.add(n.$src)}if(Array.isArray(e.children))for(let n of e.children)Tc(n,t)}function w$(e){let t=[];return kc(e,t),t}function kc(e,t){if(!j(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(ut(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)kc(n,t)}function fr(e,t){if(y(e))return e;let n=Yt(e);if(n.length===0)return"div";if(!qe(e))return n[0];let r=e.$expression,s=r.target;if(r.operator==="?:")return te(s,t)?r.value:r.initial;let o=te(s,t);return r.cases[String(o)]??r.default}function Qm(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function eg(e,t,n,r=null){let s=new Map;for(let o of xn(e)){let i="",l=!0,c;if(y(o)||Y(o)||le(o)){if(c=n(o),Gr.test(c))continue;l=c!==""}else if(Q(o))c=n(o);else if(!Be(o))c=n(o),l=c!=="";else{let u=te(o.attributes?.slot,t),f=y(o.slot)?te(o.slot,t):null;if(y(u)&&u!=="")i=u,c=n(o);else if(y(f)&&f!==""){i=f;let{slot:p,...d}=o;c=n({...d,attributes:{...d.attributes,slot:f}})}else c=n(o)}let a=s.get(i);if(a)a.html=a.html===""?c:`${a.html}
|
|
72
|
+
${c}`,a.content||=l;else s.set(i,{content:l,html:c})}return{groups:s,id:r,taken:new Set}}function Pc(e,t,n){for(let r of xn(e)){if(Q(r)||!Be(r))continue;if(r.tagName==="slot"){let s=te(r.attributes?.name,t);n.taken.add(y(s)?s:"")}Pc(r.children,t,n)}}function tg(e){let t=null,n={};for(let[r,s]of Object.entries(e??{}))if(r.startsWith("props.")&&r.length>6)t??={},t[r.slice(6)]=s;else n[r]=s;return{lifted:t,rest:n}}function yi(e,t){if(!t)return li(e.state??{},null);let n={...e.state};for(let[r,s]of Object.entries(t)){let o=n[r];n[r]=j(o)&&!Array.isArray(o)&&"default"in o?{...o,default:s}:s}return li(n,null)}function ng(e,t,n){let r=cr(e).filter((l)=>Object.hasOwn(t??{},l));if(!t||r.length===0)return null;let s=Qo(e),o=yi(e,null),i=null;for(let l of r){let c=te(t[l],n),a=null;if(le(c))a=st(l,c);else if(y(c)||Y(c))a=String(c);let u=wc(l);if(a===null||s.has(u)&&s.get(u)===void 0)continue;vl(o,l,a,s),i??={},i[u]=o[u]}return i}function rg(e,t){let n={};for(let[r,s]of Object.entries(e??{})){if(_(s)&&rr(s.$ref,t))continue;let o;try{o=te(s,t)}catch{continue}if(y(o)||Y(o)||le(o))n[r]=o}return n}function sg(e,t){return Object.fromEntries(Object.entries(e??{}).flatMap(([n,r])=>{if(!B(r))return[];let s=te(r,t);return s==null?[]:[[n,s]]}))}function er(e,t,n,r,s=!1){if(e.textContent!==void 0){let i=te(e.textContent,t);return i!=null?G(String(i)):""}if(e.innerHTML){let i=te(e.innerHTML,t);return i!=null?String(i):e.innerHTML}let o=sr(e,fr(e.tagName,t),t);if(o!==void 0)return o;if(Q(e.children))return _c(e.children,t,n,r,s);if(Array.isArray(e.children))return e.children.map((i)=>tr(i,t,n,r,s)).join(s?"":`
|
|
73
|
+
`);return""}function _c(e,t,n=null,r=null,s=!1){let o=e.map;if(!o)return"";ir(e);let i=t??ns(),l=og(e,i);if(l===null)return"";return l.map((c,a)=>{let u=ns(i);return u.$map={index:a,item:c},u["$map/item"]=c,u["$map/index"]=a,tr(o,u,n,r,s)}).join(s?"":`
|
|
74
|
+
`)}function og(e,t){let n=(r)=>_(r)?dc(r.$ref,t):void 0;for(let r of[e.items,e.filter,e.sort])if(_(r)&&rr(r.$ref,t))return null;try{let r=_(e.items)?n(e.items):e.items;if(!Array.isArray(r))return null;return El(r,n(e.filter),n(e.sort))}catch{return null}}function tr(e,t,n=null,r=null,s=!1){if(y(e)){if(B(e)&&t){let a=ui(e,t);if(a!=null)return G(String(a));return r?"":G(e)}return G(e)}if(Y(e)||le(e))return G(String(e));if(Array.isArray(e))return e.map((a)=>tr(a,t,n,r,s)).join(s?"":`
|
|
75
|
+
`);if(!j(e))return"";if(Q(e))return _c(e,t,n,r,s);if(e.$switch){let a=e.tagName??"div",u=Dt(e,t),p=_(e.$switch)&&t!==null&&rr(e.$switch.$ref,t)?null:te(e.$switch,t),d=p==null?void 0:e.cases?.[String(p)],x=d!==void 0&&!ee(d)?tr(d,t,n,r,s):"";return`<${a}${u}>${x}</${a}>`}let o=fr(e.tagName,t);if(o==="slot"&&n){let a=te(e.attributes?.name,t),u=y(a)?a:"",f;if(!n.taken.has(u))n.taken.add(u),f=n.groups.get(u);let p=f?.html??"";if(p!==""&&n.id!==null)p=`<!--${Yr} ${n.id} ${encodeURIComponent(u)}-->${p}<!--/${Yr} ${n.id}-->`;if(f?.content)return Pc(e.children,t,n),p;let d=er(e,t,n,r,s);return p===""?d:d===""?p:`${p}
|
|
76
|
+
${d}`}let i=r?.componentDefs.get(o);if(i&&r)return ig(e,i,t,n,r);let l=Dt(e,t);if(hi.has(o))return`<${o}${l}>`;let c=er(e,t,n,r,s||yt.has(o));return`<${o}${l}>${c}</${o}>`}function ig(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:l}=tg(e.attributes),c={...i,...e.$props},a={};for(let[O,T]of Object.entries(c))a[O]=te(T,n)??T;let u=Object.keys(a).length>0,f={...ng(t,l,n),...a},p=Object.keys(f).length>0,d=s.path??[],x={key:JSON.stringify(f),tag:o},w=[...d.map((O)=>O.tag),o].join(" → ");if(d.some((O)=>O.tag===x.tag&&O.key===x.key))throw Error(`Component <${o}> renders itself: ${w}. A component cannot appear inside its own `+"definition with the same props — the expansion would never end.");if(d.length>=ei)throw Error(`Component nesting exceeds ${ei} levels: ${w}. A component that renders itself with changing props needs a case that stops.`);let g={...s,path:[...d,x]},{children:m}=e,b=(O)=>tr(O,n,r,s),S=ft(t,s.defaults),E=!ag(o,t,s.liveTags),J=yi(t,p?f:null),M,k=null;if(S){let O=Array.isArray(m)?m.map((T)=>b(T)).join(`
|
|
77
|
+
`):"";M=`<template shadowrootmode="${S}"><link rel="stylesheet" href="${lg(o)}">${er(t,J,null,g)}</template>${O}`}else{k=!E&&cn(t.children)?Qm(s):null;let O=eg(m,n,b,k);M=er(t,J,O,g)}let P=Object.entries(sg(t.style,J)).map(([O,T])=>`${Re(O)}: ${T}`).join("; "),R={...e};delete R.$props,delete R.children;let H={...l,...rg(t.attributes,J)};if(R.attributes=!E&&u?{...H,"data-jx-props":JSON.stringify(a)}:H,k!==null)R.attributes={...R.attributes,[ti]:String(k)};if(E)R.$static=!0;else R.$prerendered=!0;return`<${o}${Dt(R,n,P)}>${M}</${o}>`}function E$(e,t=null,n=null,r=null){return er(e,yi(e,t),n,r)}function ag(e,t,n){return n?n.has(e):!Dc(t)}function ss(e,t){let n=new Set,r=(s,o)=>{if(Array.isArray(s)){for(let i of s)r(i,!1);return}if(!j(s))return;if(Q(s)){r(s.map,!1);return}if(!o){for(let i of Yt(s.tagName))if(t.has(i))n.add(i)}r(s.children,!1);for(let i of Object.values(s.cases??{}))if(!ee(i))r(i,!1)};return r(e,!0),n}function v$(e,t){let n=(i)=>{let l=new Set(i),c=[...l];for(let a=c.pop();a!==void 0;a=c.pop())for(let u of ss(e.get(a),e))if(!l.has(u))l.add(u),c.push(u);return l},r=t?n(ss(t,e)):void 0,s=new Set,o=[];for(let[i,l]of e)if(!Dc(l)){if(s.add(i),!r||r.has(i))o.push(i)}for(let i of n(o))s.add(i);return s}function Mc(e,t){let n=new Set(e),r=new Set,s=[],o=(i)=>{if(r.has(i))return;r.add(i);let l=t.get(i);if(l)for(let c of[...ss(l,t)].toSorted())o(c);if(n.has(i))s.push(i)};for(let i of[...e].toSorted())o(i);return s}function Dc(e){if(cr(e).length>0)return!1;return Zn(e)}function Zn(e){if(!j(e))return!0;if(Array.isArray(e))return e.every((t)=>Zn(t));if(Q(e))return Array.isArray(e.items)&&e.filter===void 0&&e.sort===void 0&&e.key===void 0&&(e.map===void 0||Zn(e.map));if(e.$prototype)return!1;if(e.$switch!==void 0||qe(e.tagName))return!1;if(e.$ref)return!1;if(e.state)for(let t of Object.values(e.state)){if(!j(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)=>Zn(t));if(Q(e.children))return Zn(e.children);return!0}function lg(e){return`/components/${e}.css`}function J$(e,t,n,r){let s=new Set([e]),o=[n.get(e)??""],i=(l)=>{for(let c of ss(t.get(l)??{},t)){if(s.has(c)||r.has(c))continue;s.add(c),o.push(n.get(c)??""),i(c)}};return i(e),o.join("")}function Ic(e,t,n=null,r={},s=null){let o=[],i=sc(e,s),l={host:s===null?"light":"shadow"};if(s!==null)l.shadowTree=!0;let c=j(t)?t:{};if(yc(o,"display"in c?c:{display:"block",...c},i,r,l),n){let a={n:0};for(let u of Es(n))Rc(u,o,r,"",a,e,{shadowTree:s!==null})}return o.length>0?`${o.join(`
|
|
38
78
|
`)}
|
|
39
|
-
`:""}var
|
|
79
|
+
`:""}var Tm,cc,un="https://esm.sh/@vue/reactivity@3.5.40",vt="https://esm.sh/lit-html@3.3.0",Xn,Pm,Dm,Im,Lm,Fm,gc,Bm,qm,yt,Um,It="__jxAttrText",gn="__jxListItems",bc="__jxRowKeys",ar="__jxLiteral",lr="__jxKeyed",hs,pi="__jxSupplies",fi="__jxNativeSetter",xs="__jxAbsorbAttr",vc="__jxServerCall",Km,Ym,Jc="__jxInstantiate",di="__jxAssociateForm",mi="__jxCaptureSlotted",gi="__jxDistributeSlots",yn="<!---->",Ac,hi;var Lt=v(()=>{Qt();Kn();Al();on();zr();ec();rc();K();Qr();nn();Kn();on();zr();K();on();Tm=["$map/","event#/","$args/","$reduce/"];cc=Symbol("jx.runtimeOnlyStateKeys");Xn=String.raw`(?:\s|\\[nrt])*`,Pm=new RegExp(String.raw`(?:=|\.\.\.)${Xn}state[ \t]*(?:[;,)}\]"]|\\[nr])`);Dm=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,Im=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,Lm=/[\w$.]/u,Fm=/[\w$]/u;gc=["hidden","tabIndex","title","lang","dir"],Bm=new Set([...gc,"id","className"]),qm=new Set([...Ke,...Bm,"textContent","innerHTML"]);yt=new Set(["pre","textarea","listing","plaintext","xmp"]);Um=[];hs=["import { AsyncDirective, directive } from 'lit-html/async-directive.js';","import { repeat } from 'lit-html/directives/repeat.js';"];Km=new Set(["$prototype","$src","$export","timing","default","description"]);Ym=new Set(si);Ac=Symbol("jx.styleHandle");hi=new Set(["input","br","hr","img","meta","link","area","col","source"])});class Lc{index;text;constructor(e){this.text=e,this.index=e.codePointAt(0)===65279?1:0}get done(){return this.index>=this.text.length}startsWith(e){return this.text.startsWith(e,this.index)}skipLine(){let e=this.text.indexOf(`
|
|
40
80
|
`,this.index);this.index=e===-1?this.text.length:e}skipBlock(){let e=1;this.index+=2;while(!this.done&&e>0)if(this.startsWith("/*"))e+=1,this.index+=2;else if(this.startsWith("*/"))e-=1,this.index+=2;else this.index+=1}skipTrivia(){for(;;){while(!this.done&&/[\s;]/u.test(this.text.charAt(this.index)))this.index+=1;if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(this.startsWith("/-"))this.index+=2,this.skipNode();else return}}skipString(){let e=0,t=this.index;while(this.text.charAt(t)==="#")e+=1,t+=1;let n=this.text.startsWith('"""',t),r=n?'"""':'"',s=r+"#".repeat(e);t+=r.length;while(t<this.text.length)if(e===0&&this.text.charAt(t)==="\\")t+=2;else if(this.text.startsWith(s,t))return this.index=t+s.length,!0;else if(!n&&this.text.charAt(t)===`
|
|
41
81
|
`)return!1;else t+=1;return!1}skipNode(){let e=0;while(!this.done){let t=this.text.charAt(this.index);if(t==='"'||t==="#"&&/^#+"/u.test(this.text.slice(this.index,this.index+16))){if(!this.skipString())return!1}else if(this.startsWith("//"))this.skipLine();else if(this.startsWith("/*"))this.skipBlock();else if(t==="{")e+=1,this.index+=1;else if(t==="}"){if(e===0)return!1;e-=1,this.index+=1}else if((t===`
|
|
42
|
-
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function
|
|
43
|
-
`,"\r"]);
|
|
44
|
-
`],["r","\r"],["t","\t"]])});function Md(e){return e instanceof Error?e.message:String(e)}function kl(e){if(b(e))return Pl.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>kl(t));if(C(e))return rn(e);return e}function rn(e){let t={};for(let[n,r]of Object.entries(e))t[Pl.test(n)?n.normalize("NFC"):n]=kl(r);return t}function ko(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${Md(o)}`,{cause:o})}if(!C(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Nl(e);if(s.length>0){let o=s.map((i)=>Tl(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return rn(r)}function _l(e,t){return ko(e,t,"Jx document")}function Dl(e,t){return ko(e,t,"project config")}function Dx(e,t){return ko(e,t,"class definition")}var Pl;var Hn=S(()=>{q();Rl();Pl=/[^\p{ASCII}]/u});function Un(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function wt(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Qr(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function X(e){return!isNaN(e)&&!Un(e)&&!wt(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function Ml(e){return e>=65&&e<91||e>=97&&e<123||!1}function _o(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function Do(e){return _o(e)||e===95}function lt(e){return e>=48&&e<58}function Pt(e){return lt(e)||e===95}function Mo(e){return e>=48&&e<56}function Il(e){return Mo(e)||e===95}function Io(e){return e===48||e===49}function Ll(e){return Io(e)||e===95}function Fl(e){return e===45||e===43}var $t=1,sn=2,Nt=3,Hr=4,Br=5,Bn=6,qr=7,Ur=8,qn=9,bt=10,we=11,on=12,an=13,zr=14,at=15,Kr=16,Gr=17,Tt=18,St=19,Yr=20,Xr=21,Zr=22,ln=23,Rt=24,Ye=28;function*Ld(e){for(let t of(Id??=new Intl.Segmenter("en")).segment(e))yield t.segment}function Fd(e){return e[Symbol.iterator]()}function Vl(e,{flags:t,graphemeLocations:n=!1}){let r=n?Ld(e):Fd(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*Wl(e){if(F(e,65279))e.column=1,yield P(e,sn);if(Qr(e.current))throw Xe(e,`Invalid character \\u${e.current.toString(16)}`)}function oe(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(Qr(n))if(n>=55296&&n<=57343||n>1114111)zn(e,`Invalid character \\u${n.toString(16)}`);else zn(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function Le(e,t){if(t(e.current)){let n=e.current;return oe(e),n}}function F(e,t){if(e.current===t)return oe(e),t}function cn(e){if(!wt(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return oe(e),e.column=1,e.line++,!0}function Lo(e,t){while(e.current===t)oe(e)}function z(e,t){while(t(e.current))oe(e)}function P(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},l=e.start;e.start=i;let a=e.errorsInToken;e.errorsInToken=null;let c={type:t,text:e.text.slice(l.offset,i.offset),start:l,end:i,errors:a};if(n){if(!c.errors)c.errors=[];c.errors.push(new V(n,{token:c}))}return c}function Xe(e,t){if(t instanceof V)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(wt(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new V(`${t}`,{start:o,end:i})}function zn(e,t){(e.errorsInToken??=[]).push(Xe(e,t))}var Id;var Hl=S(()=>{kt()});function _t(e){return(t)=>(oe(t),P(t,e))}function Kn(e){return z(e,Un),P(e,Tt)}function Dt(e){return cn(e),P(e,St)}function Vd(e){oe(e);let t=!1,n=!1;if(F(e,34)){if(!F(e,34))return P(e,qn);if(n=!0,e.current===34)throw Xe(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(F(e,34)){if(F(e,34)&&F(e,34))t=!0}else F(e,92),cn(e)||oe(e)}else while(!t&&e.offset<e.length)if(F(e,34))t=!0;else F(e,92),cn(e)||oe(e);if(!t)throw Xe(e,"Unexpected EOF inside string");return P(e,n?ln:qn)}function Bl(e){if(oe(e),e.current===35||e.current===34){let t=1;while(F(e,35))t++;if(!F(e,34))throw Xe(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(F(e,34))if(F(e,34)){if(e.current===34)throw Xe(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(F(e,35))r++;if(r===t)return P(e,bt)}while(!0){if(e.offset>=e.length)throw Xe(e,"Unexpected EOF while parsing raw string");if(F(e,34)){if(n){if(!F(e,34)||!F(e,34))continue}let r=0;while(r<t&&F(e,35))r++;if(r===t)return P(e,n?Rt:bt)}else cn(e)||oe(e)}}else{let t;if(e.current<255){let n=D[e.current];t=n(e)}else if(Un(e.current))t=Kn(e);else if(wt(e.current))t=Dt(e);else t=Vo(e);if(t.type!==we)(t.errors??=[]).push(new V("Expected a valid identifier",{token:t}));return t.type=an,t}}function Wd(e){if(oe(e),Le(e,lt))return z(e,X),P(e,we,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return z(e,X),P(e,we)}function Hd(e){if(oe(e),F(e,45))return P(e,Nt);else if(F(e,47)){while(e.offset<e.length&&!wt(e.current))oe(e);return P(e,Xr)}else if(F(e,42)){let t=1;while(e.offset<e.length)if(F(e,42)){if(F(e,47)){if(t--,t===0)return P(e,Zr)}}else if(F(e,47)){if(F(e,42))t++}else cn(e)||oe(e);throw Xe(e,"Unexpected EOF in multiline comment")}else ts(e)}function ql(e){return oe(e),Bd(e)}function Bd(e){if(lt(e.current))return Fe(e);else if(F(e,46)){if(Le(e,lt))return z(e,X),P(e,we,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return z(e,X),P(e,we)}else return z(e,X),P(e,we)}function Fo(e,t,n,r){return(s)=>{let o=oe(s);if(Le(s,n))return z(s,r),P(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(F(s,95)){if(z(s,r),!X(s.current))return P(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return z(s,X),P(s,we,`Invalid ${e} number`)}else if(F(s,95)){if(Lo(s,95),n(s.current)){if(z(s,r),!X(s.current))return P(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return z(s,X),P(s,we,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(lt(s.current))return P(s,we,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return z(s,X),P(s,Ye)}}function Fe(e){if(F(e,48)){let t=es[e.current];if(t)return t(e)}if(z(e,Pt),F(e,46)){if(!Le(e,lt))if(e.current===95)zn(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else zn(e,"Invalid decimal number, a decimal point must be followed by a digit");z(e,Pt)}if(F(e,101)||F(e,69))if(Le(e,Fl),Le(e,lt)){if(z(e,Pt),X(e.current))return z(e,X),P(e,we,"Invalid number with suffix, a number with an exponent cannot have a suffix");return P(e,at)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return z(e,Pt),P(e,at,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return z(e,X),P(e,at,"Invalid decimal number, missing a number after the exponent");else if(F(e,95)){if(Lo(e,95),lt(e.current)){if(z(e,Pt),!X(e.current))return P(e,at,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return z(e,X),P(e,we,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return z(e,X),P(e,Ye);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){oe(e);let t=null;if(Le(e,Do))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return z(e,X),P(e,Ye,t)}else if(Le(e,Ml)){let t=null;if(Le(e,Pt))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return z(e,X),P(e,Ye,t)}else if(F(e,44))return z(e,X),P(e,Ye,"Invalid number with suffix, a suffix cannot start with a comma");else if(F(e,46))return z(e,X),P(e,Ye,"Invalid number with suffix, a suffix cannot start with a dot");else if(Le(e,X))return z(e,X),P(e,Ye);else return P(e,at);else return P(e,at)}function qd(e){if(oe(e),e.current!=35)return z(e,X),P(e,we);let t=Bl(e);t.start.offset--,t.start.column--;let n;switch(t.type){case bt:case Rt:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new V(n,{token:t})),t}function Vo(e){return oe(e),z(e,X),P(e,we)}function ts(e){throw Xe(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*Gn(e,t){let n=Vl(e,t);yield*Wl(n);while(!n.currentIter.done){if(n.current<255){let r=D[n.current];yield r(n);continue}if(Un(n.current)){yield Kn(n);continue}if(wt(n.current)){yield Dt(n);continue}yield Vo(n)}yield P(n,$t)}var es,D;var Ul=S(()=>{kt();Hl();es=Array(256).fill(null);es[98]=Fo("binary",Gr,Io,Ll);es[111]=Fo("octal",Kr,Mo,Il);es[120]=Fo("hexadecimal",zr,_o,Do);D=Array(255);D.fill(Vo);for(let e=0;e<32;e++)D[e]=ts;D[9]=Kn;D[10]=Dt;D[11]=Dt;D[12]=Dt;D[13]=Dt;D[32]=Kn;D[34]=Vd;D[35]=Bl;D[40]=_t(Hr);D[41]=_t(Bn);D[43]=ql;D[45]=ql;D[46]=Wd;D[47]=Hd;D[48]=Fe;D[49]=Fe;D[50]=Fe;D[51]=Fe;D[52]=Fe;D[53]=Fe;D[54]=Fe;D[55]=Fe;D[56]=Fe;D[57]=Fe;D[59]=_t(Ur);D[61]=_t(on);D[91]=ts;D[92]=_t(Yr);D[93]=ts;D[114]=qd;D[123]=_t(Br);D[125]=_t(qr);D[133]=Dt;D[160]=Kn});var un=S(()=>{Ul()});var V;var kt=S(()=>{un();V=class V extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===$t)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function pn(e){return zl.get(e)}function Kl(e,{start:t},{end:n}){zl.set(e,{start:t,end:n})}var zl;var Wo=S(()=>{zl=new WeakMap});function Gl({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Ve{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Ve(this.name);return e.representation=this.representation,e}}class Ze{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Ze(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class We{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new We(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new Ze(e)}}var Ho=()=>{};class Te{static createArgument(e){return new Te(new We(e),null)}static createProperty(e,t){return new Te(new We(t),new Ve(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Te(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new Ve(e):null}getValue(){return this.value.value}setValue(e){this.value=new We(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Bo=S(()=>{Ho()});function*fn(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function qo(e){return e.children??(e.children=new Et)}class dn{static create(e){return new dn(new Ve(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new dn(this.name.clone(),e?[]:this.entries.map((n)=>n.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new Ze(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,n){let r=Te.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of fn(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of fn(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=Te.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){qo(this).appendNode(e)}insertNodeBefore(e,t){qo(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){qo(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var Yl=S(()=>{Uo();Bo()});function*mn(e){if(e instanceof Et)yield*e.nodes;else yield e}class Et{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new Et(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...mn(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...mn(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...mn(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...mn(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...mn(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...mn(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of fn(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of fn(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Uo=()=>{};var Xl=S(()=>{Uo();Bo();Yl();Ho()});function Zl(e,t,n){let r;while(r=zd.exec(t)){let s=Yn(n,t,r.index);e.push(new V("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function Ql(e,t,n){if(!gn.test(t))return e.push(new V("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!gn.test(t[0]))return e.push(new V("Multi-line strings must start with a newline",{token:n})),t;let r=Yd.exec(t)?.[1];if(r==null)return e.push(new V("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(Zd,(s,o,i,l,a)=>{if(!l)return`
|
|
45
|
-
`;if(!i.startsWith(r)){let
|
|
82
|
+
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function Sn(e){if(cg.test(e))return"unreadable";let t=new Lc(e);for(;;){if(t.skipTrivia(),t.done)return"document";if(t.startsWith("(")){let n=e.indexOf(")",t.index);if(n===-1)return"unreadable";t.index=n+1}else{let[n]=ug.exec(e.slice(t.index,t.index+256))??[];if(!n)return t.startsWith('"')||t.startsWith("#")?"document":"unreadable";if(!n.startsWith("$"))return n==="project"?"project":"document";if(t.index+=n.length,!t.skipNode())return"unreadable"}}}var cg,ug;var dr=v(()=>{cg=/\0/u,ug=/^[^\s\\/(){};[\]"#=]+/u});function Vc(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():dg(o(),r),l=()=>{s+=1;let c="";while(s<e.length){let a=e[s];if(a==="\\"){let u=e[s+1]??"";if(u==="u")c+=String.fromCodePoint(Number.parseInt(e.slice(s+2,s+6),16)),s+=6;else c+=pg.get(u)??u,s+=2;continue}if(a==='"')return s+=1,c;c+=a,s+=1}return c};while(s<e.length){let c=e[s];if(Fc.has(c)||c===","||c===":"){s+=1;continue}if(c==="{"||c==="["){n.push(c==="{"?{keys:new Set,kind:"object",path:i()}:{kind:"array",path:i()}),r=null,s+=1;continue}if(c==="}"||c==="]"){n.pop(),r=null,s+=1;continue}if(c==='"'){let u=l(),f=n.at(-1);if(f?.kind==="object"&&fg(e,s)===":"){if(f.keys.has(u))t.push({detail:u,kind:"duplicate-key",path:f.path});f.keys.add(u),r=u}else r=null;continue}if(c==="-"||c>="0"&&c<="9"){let u=s;while(s<e.length&&/[\d+.eE-]/.test(e[s]))s+=1;let f=e.slice(u,s);if(!mg(f))t.push({detail:f,kind:"unsafe-number",path:i()});r=null;continue}let a=s;while(s<e.length&&/[A-Za-z]/.test(e[s]))s+=1;if(s===a)s+=1;r=null}return t}function fg(e,t){let n=t;while(n<e.length&&Fc.has(e[n]))n+=1;return e[n]??""}function dg(e,t){return e===""?t:`${e}.${t}`}function mg(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Wc(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 Fc,pg;var Hc=v(()=>{Fc=new Set([" ","\t",`
|
|
83
|
+
`,"\r"]);pg=new Map([["b","\b"],["f","\f"],["n",`
|
|
84
|
+
`],["r","\r"],["t","\t"]])});function gg(e){return e instanceof Error?e.message:String(e)}function qc(e){if(y(e))return Bc.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>qc(t));if(A(e))return wn(e);return e}function wn(e){let t={};for(let[n,r]of Object.entries(e))t[Bc.test(n)?n.normalize("NFC"):n]=qc(r);return t}function xi(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${gg(o)}`,{cause:o})}if(!A(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Vc(e);if(s.length>0){let o=s.map((i)=>Wc(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return wn(r)}function Uc(e,t){return xi(e,t,"Jx document")}function zc(e,t){return xi(e,t,"project config")}function M$(e,t){return xi(e,t,"class definition")}var Bc;var mr=v(()=>{K();Hc();Bc=/[^\p{ASCII}]/u});function yr(e){switch(e){case 9:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:return!0}return!1}function Ct(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Ps(e){return e<8||e>=14&&e<=25||e===127||e>=55296&&e<=57343||e>1114111||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297||e===65279}function ne(e){return!isNaN(e)&&!yr(e)&&!Ct(e)&&e!==61&&e!==92&&e!==47&&e!==40&&e!==41&&e!==123&&e!==125&&e!==59&&e!==91&&e!==93&&e!==34&&e!==35&&!0}function Kc(e){return e>=65&&e<91||e>=97&&e<123||!1}function bi(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function $i(e){return bi(e)||e===95}function bt(e){return e>=48&&e<58}function Ht(e){return bt(e)||e===95}function Si(e){return e>=48&&e<56}function Gc(e){return Si(e)||e===95}function wi(e){return e===48||e===49}function Yc(e){return wi(e)||e===95}function Xc(e){return e===45||e===43}var Ot=1,En=2,Ft=3,vs=4,Js=5,gr=6,Os=7,js=8,hr=9,jt=10,ve=11,vn=12,Jn=13,As=14,xt=15,Cs=16,Ns=17,Vt=18,At=19,Rs=20,Ts=21,ks=22,On=23,Wt=24,ot=28;function*yg(e){for(let t of(hg??=new Intl.Segmenter("en")).segment(e))yield t.segment}function xg(e){return e[Symbol.iterator]()}function Zc(e,{flags:t,graphemeLocations:n=!1}){let r=n?yg(e):xg(e),s=r.next();return{text:e,graphemeLocations:n,line:1,column:1,offset:0,length:e.length,iterator:r,currentIter:s,current:s.done?NaN:s.value.codePointAt(0),start:{line:1,column:1,offset:0},errorsInToken:null,flags:t}}function*Qc(e){if(q(e,65279))e.column=1,yield I(e,En);if(Ps(e.current))throw it(e,`Invalid character \\u${e.current.toString(16)}`)}function ue(e){e.offset+=e.currentIter.value.length,e.column++;let t=e.currentIter=e.iterator.next(),n=e.current=t.done?NaN:t.value.codePointAt(0);if(Ps(n))if(n>=55296&&n<=57343||n>1114111)xr(e,`Invalid character \\u${n.toString(16)}`);else xr(e,`Invalid character \\u${n.toString(16)}, this character is not allowed but can be included in strings as \\u{${n.toString(16)}}`);return n}function Ge(e,t){if(t(e.current)){let n=e.current;return ue(e),n}}function q(e,t){if(e.current===t)return ue(e),t}function jn(e){if(!Ct(e.current))return!1;if(!e.graphemeLocations&&e.current===13&&e.text.codePointAt(e.offset+1)===10)e.iterator.next(),e.offset++;return ue(e),e.column=1,e.line++,!0}function Ei(e,t){while(e.current===t)ue(e)}function X(e,t){while(t(e.current))ue(e)}function I(e,t,n){let{line:r,column:s,offset:o}=e,i={line:r,column:s,offset:o},l=e.start;e.start=i;let c=e.errorsInToken;e.errorsInToken=null;let a={type:t,text:e.text.slice(l.offset,i.offset),start:l,end:i,errors:c};if(n){if(!a.errors)a.errors=[];a.errors.push(new z(n,{token:a}))}return a}function it(e,t){if(t instanceof z)return t;let{line:n,column:r,offset:s}=e,o={line:n,column:r,offset:s},i;if(s<e.length)if(Ct(e.current))i={line:n+1,column:1,offset:s+1};else i={line:n,column:r+1,offset:s+1};return new z(`${t}`,{start:o,end:i})}function xr(e,t){(e.errorsInToken??=[]).push(it(e,t))}var hg;var eu=v(()=>{Bt()});function qt(e){return(t)=>(ue(t),I(t,e))}function br(e){return X(e,yr),I(e,Vt)}function Ut(e){return jn(e),I(e,At)}function bg(e){ue(e);let t=!1,n=!1;if(q(e,34)){if(!q(e,34))return I(e,hr);if(n=!0,e.current===34)throw it(e,"Multiline strings must start with exactly three quotes");while(!t&&e.offset<e.length)if(q(e,34)){if(q(e,34)&&q(e,34))t=!0}else q(e,92),jn(e)||ue(e)}else while(!t&&e.offset<e.length)if(q(e,34))t=!0;else q(e,92),jn(e)||ue(e);if(!t)throw it(e,"Unexpected EOF inside string");return I(e,n?On:hr)}function tu(e){if(ue(e),e.current===35||e.current===34){let t=1;while(q(e,35))t++;if(!q(e,34))throw it(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(q(e,34))if(q(e,34)){if(e.current===34)throw it(e,"Multiline strings must start with exactly three quotes");n=!0}else{let r=0;while(q(e,35))r++;if(r===t)return I(e,jt)}while(!0){if(e.offset>=e.length)throw it(e,"Unexpected EOF while parsing raw string");if(q(e,34)){if(n){if(!q(e,34)||!q(e,34))continue}let r=0;while(r<t&&q(e,35))r++;if(r===t)return I(e,n?Wt:jt)}else jn(e)||ue(e)}}else{let t;if(e.current<255){let n=F[e.current];t=n(e)}else if(yr(e.current))t=br(e);else if(Ct(e.current))t=Ut(e);else t=Ji(e);if(t.type!==ve)(t.errors??=[]).push(new z("Expected a valid identifier",{token:t}));return t.type=Jn,t}}function $g(e){if(ue(e),Ge(e,bt))return X(e,ne),I(e,ve,"Invalid identifier, identifiers that start with a sign and a dot must be quoted if the next character is a digit to prevent confusion with decimal numbers");return X(e,ne),I(e,ve)}function Sg(e){if(ue(e),q(e,45))return I(e,Ft);else if(q(e,47)){while(e.offset<e.length&&!Ct(e.current))ue(e);return I(e,Ts)}else if(q(e,42)){let t=1;while(e.offset<e.length)if(q(e,42)){if(q(e,47)){if(t--,t===0)return I(e,ks)}}else if(q(e,47)){if(q(e,42))t++}else jn(e)||ue(e);throw it(e,"Unexpected EOF in multiline comment")}else Ms(e)}function nu(e){return ue(e),wg(e)}function wg(e){if(bt(e.current))return Ye(e);else if(q(e,46)){if(Ge(e,bt))return X(e,ne),I(e,ve,"Invalid identifier or number, surround with quotes to make it an identifier or add a zero between the sign and the decimal point");return X(e,ne),I(e,ve)}else return X(e,ne),I(e,ve)}function vi(e,t,n,r){return(s)=>{let o=ue(s);if(Ge(s,n))return X(s,r),I(s,t);else if(!s.flags.experimentalSuffixedNumbers){if(q(s,95)){if(X(s,r),!ne(s.current))return I(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return X(s,ne),I(s,ve,`Invalid ${e} number`)}else if(q(s,95)){if(Ei(s,95),n(s.current)){if(X(s,r),!ne(s.current))return I(s,t,`Invalid ${e} number, the first character after 0${String.fromCodePoint(o)} cannot be an underscore`)}return X(s,ne),I(s,ve,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else if(bt(s.current))return I(s,ve,"Invalid number with suffix, a suffix cannot start with a letter followed by a number");else return X(s,ne),I(s,ot)}}function Ye(e){if(q(e,48)){let t=_s[e.current];if(t)return t(e)}if(X(e,Ht),q(e,46)){if(!Ge(e,bt))if(e.current===95)xr(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else xr(e,"Invalid decimal number, a decimal point must be followed by a digit");X(e,Ht)}if(q(e,101)||q(e,69))if(Ge(e,Xc),Ge(e,bt)){if(X(e,Ht),ne(e.current))return X(e,ne),I(e,ve,"Invalid number with suffix, a number with an exponent cannot have a suffix");return I(e,xt)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return X(e,Ht),I(e,xt,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return X(e,ne),I(e,xt,"Invalid decimal number, missing a number after the exponent");else if(q(e,95)){if(Ei(e,95),bt(e.current)){if(X(e,Ht),!ne(e.current))return I(e,xt,"Invalid decimal number, the number after the exponent mustn't start on an underscore")}return X(e,ne),I(e,ve,"Invalid number with suffix, a suffix cannot start with a letter followed by an underscore")}else return X(e,ne),I(e,ot);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){ue(e);let t=null;if(Ge(e,$i))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return X(e,ne),I(e,ot,t)}else if(Ge(e,Kc)){let t=null;if(Ge(e,Ht))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return X(e,ne),I(e,ot,t)}else if(q(e,44))return X(e,ne),I(e,ot,"Invalid number with suffix, a suffix cannot start with a comma");else if(q(e,46))return X(e,ne),I(e,ot,"Invalid number with suffix, a suffix cannot start with a dot");else if(Ge(e,ne))return X(e,ne),I(e,ot);else return I(e,xt);else return I(e,xt)}function Eg(e){if(ue(e),e.current!=35)return X(e,ne),I(e,ve);let t=tu(e);t.start.offset--,t.start.column--;let n;switch(t.type){case jt:case Wt:n='Invalid raw string, the correct syntax is #" "#, not r#" "#';break;default:n="Invalid token, did you forget a whitespace after this r?"}return(t.errors??=[]).push(new z(n,{token:t})),t}function Ji(e){return ue(e),X(e,ne),I(e,ve)}function Ms(e){throw it(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*$r(e,t){let n=Zc(e,t);yield*Qc(n);while(!n.currentIter.done){if(n.current<255){let r=F[n.current];yield r(n);continue}if(yr(n.current)){yield br(n);continue}if(Ct(n.current)){yield Ut(n);continue}yield Ji(n)}yield I(n,Ot)}var _s,F;var ru=v(()=>{Bt();eu();_s=Array(256).fill(null);_s[98]=vi("binary",Ns,wi,Yc);_s[111]=vi("octal",Cs,Si,Gc);_s[120]=vi("hexadecimal",As,bi,$i);F=Array(255);F.fill(Ji);for(let e=0;e<32;e++)F[e]=Ms;F[9]=br;F[10]=Ut;F[11]=Ut;F[12]=Ut;F[13]=Ut;F[32]=br;F[34]=bg;F[35]=tu;F[40]=qt(vs);F[41]=qt(gr);F[43]=nu;F[45]=nu;F[46]=$g;F[47]=Sg;F[48]=Ye;F[49]=Ye;F[50]=Ye;F[51]=Ye;F[52]=Ye;F[53]=Ye;F[54]=Ye;F[55]=Ye;F[56]=Ye;F[57]=Ye;F[59]=qt(js);F[61]=qt(vn);F[91]=Ms;F[92]=qt(Rs);F[93]=Ms;F[114]=Eg;F[123]=qt(Js);F[125]=qt(Os);F[133]=Ut;F[160]=br});var An=v(()=>{ru()});var z;var Bt=v(()=>{An();z=class z extends Error{name="InvalidKdlError";start;end;token;errors;constructor(e,{token:t,start:n=t?.start,end:r=t?.end,errors:s,...o}={}){if(t?.type===Ot)e=`${e} at end of input`;else if(n)e=`${e} at ${n.line}:${n.column}`;super(e,o);this.token=t,this.start=n,this.end=r,this.errors=s}*flat(){if(this.errors==null){yield this;return}for(let e of this.errors)yield*e.flat()}}});function Cn(e){return su.get(e)}function ou(e,{start:t},{end:n}){su.set(e,{start:t,end:n})}var su;var Oi=v(()=>{su=new WeakMap});function iu({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Xe{type="identifier";static type="identifier";representation;constructor(e){this.name=e}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new Xe(this.name);return e.representation=this.representation,e}}class at{type="tag";static type="tag";representation;leading;trailing;suffix;constructor(e){this.name,Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!1,value:e})}getName(){return this.name}setName(e){if(e!==this.name)this.name=e,this.representation=void 0}clone(){let e=new at(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class Ze{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new Ze(this.value);return e.tag=this.tag?.clone()??null,e.betweenTagAndValue=this.betweenTagAndValue,e.representation=this.representation,e}getValue(){return this.value}setValue(e){if(e!==this.value)this.value=e,this.representation=void 0}getTag(){return this.tag?this.tag.name:null}setTag(e){if(e==null)this.tag=null;else if(this.tag!=null)this.tag.setName(e);else this.tag=new at(e)}}var ji=()=>{};class Me{static createArgument(e){return new Me(new Ze(e),null)}static createProperty(e,t){return new Me(new Ze(t),new Xe(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new Me(this.value.clone(),this.name?.clone()??null);return e.leading=this.leading,e.trailing=this.trailing,e.equals=this.equals,e}getTag(){return this.value.getTag()}setTag(e){this.value.setTag(e)}getName(){return this.name?this.name.name:null}setName(e){this.name=e!=null?new Xe(e):null}getValue(){return this.value.value}setValue(e){this.value=new Ze(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Ai=v(()=>{ji()});function*Nn(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function Ci(e){return e.children??(e.children=new Nt)}class Rn{static create(e){return new Rn(new Xe(e))}type="node";static type="node";name;tag=null;entries;children;leading;trailing;beforeChildren;betweenTagAndName;constructor(e,t=[],n=null){this.name=e,this.entries=t,this.children=n}clone({shallow:e=!1}={}){let t=new Rn(this.name.clone(),e?[]:this.entries.map((n)=>n.clone()),this.children?.clone({shallow:e}));if(this.tag)t.tag=this.tag.clone();return t.leading=this.leading,t.betweenTagAndName=this.betweenTagAndName,t.beforeChildren=this.beforeChildren,t.trailing=this.trailing,t}getTag(){return this.tag?this.tag.name:null}setTag(e){this.tag=e!=null?new at(e):null}getName(){return this.name.name}setName(e){this.name.setName(e)}hasArguments(){return this.entries.some((e)=>e.isArgument())}getArguments(){return this.getArgumentEntries().map((e)=>e.getValue())}getArgumentEntries(){return this.entries.filter((e)=>e.isArgument())}hasArgument(e){return this.getArgumentEntry(e)!=null}getArgument(e){return this.getArgumentEntry(e)?.getValue()}getArgumentEntry(e){for(let t of this.entries){if(!t.isArgument())continue;if(e===0)return t;e--}}addArgument(e,t,n){let r=Me.createArgument(e);if(r.value.setTag(t),n!=null)for(let[s,o]of this.entries.entries()){if(!o.isArgument())continue;if(n===0){this.entries.splice(s,0,o);return}n--}this.entries.push(r)}removeArgument(e){for(let[t,n]of this.entries.entries()){if(!n.isArgument())continue;if(e===0){this.entries.splice(t,1);return}e--}}hasProperties(){return this.entries.some((e)=>e.isProperty())}getProperties(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e.getValue()]))}getPropertyEntries(){return this.entries.filter((e)=>e.isProperty())}getPropertyEntryMap(){return new Map(this.getPropertyEntries().map((e)=>[e.getName(),e]))}hasProperty(e){return this.getPropertyEntry(e)!=null}getProperty(e){return this.getPropertyEntry(e)?.getValue()}getPropertyEntry(e){for(let t of Nn(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of Nn(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=Me.createProperty(e,t);r.value.setTag(n),this.entries.push(r)}deleteProperty(e){this.entries=this.entries.filter((t)=>t.getName()!==e)}hasChildren(){return this.children!=null&&!this.children.isEmpty()}appendNode(e){Ci(this).appendNode(e)}insertNodeBefore(e,t){Ci(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){Ci(this).insertNodeAfter(e,t)}removeNode(e){if(this.children==null)throw Error("Node to remove is not in document");this.children.removeNode(e)}replaceNode(e,t){if(this.children==null)throw Error("Node to remove is not in document");this.children.replaceNode(e,t)}findNodesByName(e){return this.children!=null?this.children.findNodesByName(e):[]}findNodeByName(e){return this.children?.findNodeByName(e)}findParameterizedNode(e,t){return this.children?.findParameterizedNode(e,t)}removeNodesByName(e){this.children?.removeNodesByName(e)}}var au=v(()=>{Ni();Ai()});function*Tn(e){if(e instanceof Nt)yield*e.nodes;else yield e}class Nt{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new Nt(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...Tn(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...Tn(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...Tn(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...Tn(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n+1,0,...Tn(e))}removeNode(e){let t=this.nodes.indexOf(e);if(t===-1)throw Error("Node to remove is not in document");this.nodes.splice(t,1)}replaceNode(e,t){let n=this.nodes.indexOf(e);if(n===-1)throw Error("Node to replace is not in document");this.nodes.splice(n,1,...Tn(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of Nn(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of Nn(this.nodes)){if(n.name.name!==e)continue;let r=n.getArguments();if(r.length!==1||t!==void 0&&r[0]!==t)continue;return n}return}removeNodesByName(e){this.nodes=this.nodes.filter((t)=>t.name.name!==e)}isEmpty(){return this.nodes.length===0}}var Ni=()=>{};var lu=v(()=>{Ni();Ai();au();ji()});function cu(e,t,n){let r;while(r=Jg.exec(t)){let s=Sr(n,t,r.index);e.push(new z("Raw strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[0].length,line:s.line+1,column:1}}))}return t}function uu(e,t,n){if(!kn.test(t))return e.push(new z("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!kn.test(t[0]))return e.push(new z("Multi-line strings must start with a newline",{token:n})),t;let r=Ag.exec(t)?.[1];if(r==null)return e.push(new z("The final line in a multiline string may only contain whitespace",{token:n})),t;return t.replace(Ng,(s,o,i,l,c)=>{if(!l)return`
|
|
85
|
+
`;if(!i.startsWith(r)){let a=Sr(n,t,c+o.length);return e.push(new z("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:a,end:{offset:a.offset+r.length,line:a.line,column:a.column+r.length}})),`
|
|
46
86
|
`}return`
|
|
47
|
-
`+i.slice(r.length)+l}).slice(1,-1)}function
|
|
48
|
-
`;if(!i.startsWith(r)){let
|
|
87
|
+
`+i.slice(r.length)+l}).slice(1,-1)}function pu(e,t,n){let r;while(r=jg.exec(t)){let s=Sr(n,t,r.indices[1][0]);e.push(new z("Strings with single quotes cannot contain any unescaped newlines, use triple-quotes for multiline strings",{token:n,start:s,end:{offset:s.offset+r[1].length,line:s.line+1,column:1}}))}return t.replace(Tg,(s,o,i,l,c)=>du(e,t,n,s,o,i,l,c))}function fu(e,t,n){if(!Og.test(t))return e.push(new z("Strings with three quotes must be multiline strings",{token:n})),t;if(!kn.test(t[0]))return e.push(new z("Multi-line strings must start with a newline",{token:n})),t;let r=Cg.exec(t)?.[1];if(r==null){let s=Rg.exec(t),o=s?Sr(n,t,s.index):void 0,i="The final line in a multiline string may only contain whitespace";if(s?.[0][0]==="\\")i+=" after removing escaped whitespace";return e.push(new z(i,{token:n,start:o,end:o&&{offset:o.offset,line:o.line,column:o.column+1}})),t}return t.replace(kg,(s,o,i,l,c,a,u)=>{if(!o)return du(e,t,n,s,l,c,a,u);let f=t[u+o.length+(i?i.length:0)];if(kn.test(f))return`
|
|
88
|
+
`;if(!i.startsWith(r)){let p=Sr(n,t,u+o.length);return e.push(new z("Every non-blank line of a multi-line string must start with the offset defined by the last line of the string",{token:n,start:p,end:{offset:p.offset+r.length,line:p.line,column:p.column+r.length}})),`
|
|
49
89
|
`}return`
|
|
50
|
-
`+i.slice(r.length)}).slice(1,-1)}function
|
|
51
|
-
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),gn=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,zd=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,Kd=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,Gd=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;Yd=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,Xd=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,Zd=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,Qd=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;em=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;tm=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function ct(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function K(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return ct(e),n}}function M(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new V(t,{token:n})}function je(e,t,n,r=n){if(e.storeLocations)Kl(t,n,r)}function Ee(e="",t="",n=""){return e+t+n||void 0}function ss(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return ct(o),o}function Ko(e,t){if(!t&&!e.current.done&&e.current.value.type!==$t)t=M(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof V)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new V(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new V("Encountered multiple errors",{errors:n})}function ns(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function sc(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Go(e){let{value:t}=e.current,n,r,s,o,i,l=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case Ye:{if(!e.flags.experimentalSuffixedNumbers)throw new V("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,p=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,p),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(p),sc(s))e.errors.push(M(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Gr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Kr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case at:l=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case zr:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case an:if(n=ns(t.text),n===void 0)if(n=null,ns(t.text.toLowerCase())!==void 0)e.errors.push(M(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(M(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(M(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}ct(e);let a=e.flags.experimentalSuffixedNumbers&&K(e,an);if(a)if(l){if(o=a.text,ns(o)!==void 0)e.errors.push(M(a,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(M(a,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(M(a,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(M(a,"Unexpected hashed suffix, you can only place suffixes on numbers"));let c=new We(n);if(c.representation=r??t.text,je(e,c,t),s){let u=new Ze(s);u.representation=o,u.suffix=!0,je(e,u,e.lastToken),c.tag=u}return c}function Xn(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case we:if(ct(e),sc(t.text))e.errors.push(M(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case qn:ct(e),n=[ec(e.errors,t.text.slice(1,-1),t),t.text,t];break;case ln:ct(e),n=[tc(e.errors,t.text.slice(3,-3),t),t.text,t];break;case bt:{ct(e);let r=t.text,s=r.indexOf('"');n=[Zl(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case Rt:{ct(e);let r=t.text,s=r.indexOf('"');n=[Ql(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(K(e,an))e.errors.push(M(e.lastToken,ns(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return n}function Yo(e){let t=Xn(e);if(!t)return;let n=new Ve(t[0]);return n.representation=t[1],je(e,n,t[2],e.lastToken),n}function rs(e){let t=Go(e);if(t)return t;let n=Xn(e);if(!n)return;let r=new We(n[0]);return r.representation=n[1],je(e,r,n[2],e.lastToken),r}function Zn(e){let t=K(e,Xr);if(!t)return;let{value:n}=e.current;return ct(e),t.text+(n?.text??"")}function os(e){return K(e,Zr)?.text}function Xo(e){return K(e,Tt)??os(e)}function is(e){let t=K(e,Yr);if(!t)return;while(Xo(e));if(!Zn(e)&&!K(e,St)&&!K(e,$t))e.errors.push(M(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function Jt(e){let t=e.lastToken.end;while(K(e,St)?.text??Zn(e)??Xo(e)??is(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function ce(e){let t=e.lastToken.end;while(Xo(e)??is(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function zo(e){let t=K(e,Hr);if(!t)return;let n=ce(e),r=Xn(e);if(!r&&e.current.value){let l=e.current.value;if(Jt(e))e.errors.push(M(l,"This type of whitespace is not allowed inside a tag"));r=Xn(e)}if(!r){if(Go(e))e.errors.push(M(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw M(e,"Invalid tag, did you forget to quote a string?");let s=ce(e),o=K(e,Bn);if(!o&&e.current.value){let l=e.current.value;if(Jt(e))e.errors.push(M(l,"This type of whitespace is not allowed inside a tag"));o=K(e,Bn)}if(!o)throw M(e,"Invalid tag, did you forget to quote a string?");let i=new Ze(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,je(e,i,t,e.lastToken),i}function as(e){return Zn(e)??K(e,St)?.text??K(e,Ur)?.text??K(e,$t)?.text}function Zo(e){if(!K(e,Br))return;let t=lc(e);if(!K(e,qr))throw M(e,"Invalid node children");return t}function hn(e){let t=e.current.value;{let p=zo(e);if(p){let d=ce(e),f=rs(e);if(!f)throw M(e,"Invalid argument");if(f.tag)e.errors.push(M(e.lastToken,"A number suffix cannot be combined with a regular tag"));f.tag=p,f.betweenTagAndValue=d;let y=new Te(f,null);je(e,f,t,e.lastToken),je(e,y,t,e.lastToken);let h=ce(e);if(K(e,on))e.errors.push(M(e.lastToken,typeof f.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),h=Ee(h,ce(e))||" ";return[y,h]}}{let p=Go(e);if(p){let d=new Te(p,null);je(e,d,t,e.lastToken);let f=ce(e);if(K(e,on))e.errors.push(M(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),f=Ee(f,ce(e))||" ";return[d,f]}}let n=Xn(e);if(!n)return;let r=ce(e),s=K(e,on);if(!s){let p=new We(n[0]);p.representation=n[1],je(e,p,n[2]);let d=new Te(p,null);return je(e,d,t,e.lastToken),[d,r]}let o=new Ve(n[0]);o.representation=n[1],je(e,o,n[2]);let i=ce(e),l=zo(e),a=l&&ce(e),c=rs(e);if(!c)throw M(e,"Expected a value");if(l){if(c.tag)e.errors.push(M(e.lastToken,"A number suffix cannot be combined with a regular tag"));c.tag=l,c.betweenTagAndValue=a}let u=new Te(c,o);return je(e,u,t,e.lastToken),u.equals=Ee(r,s.text,i),[u,void 0]}function oc(e){let t=ce(e)??"",n;while(n=Mt(e)){let i=e.lastToken.end,l=hn(e);if(!l)throw M(e,"Expected a property or argument");if(!(l[1]??ce(e)))throw M(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=hn(e);if(!r)return;let s=r[1]??ce(e)??"";while(n=Mt(e)){let i=e.lastToken.end,l=hn(e);if(!l)throw M(e,"Expected a property or argument");if(!(l[1]??ce(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function Mt(e){let t=K(e,Nt)?.text;if(!t)return;return Ee(t,Jt(e))}function ls(e){let t=e.current.value,n=zo(e),r=n&&ce(e),s=Yo(e);if(!s)if(n)throw M(e,"Couldn't find node name");else return;let o=ce(e),i=o!=null,l=Mt(e),a=[];while(i||l){let d=e.lastToken.end,f=hn(e);if(!f)break;if(l)i=(f[1]||ce(e))!=null,o=Ee(o,l,e.text.slice(d.offset,e.lastToken.end.offset)),l=Mt(e);else{let y=f[0];y.leading=o,a.push(y),o=f[1]||ce(e),i=o!=null,l=Mt(e)}}let c,u;while(!0){l??=Mt(e);let d=e.lastToken.end,f=Zo(e);if(!f){if(l)throw M(e,"Unexpected slashdash");break}if(l)o=Ee(o,l,e.text.slice(d.offset,e.lastToken.end.offset)),l=void 0;else{if(c)e.errors.push(M(e,"A node can only have one children block"));c=f,u=o??"",o=void 0}o=Ee(o,ce(e))}let p=new dn(s,a,c);return p.tag=n??null,p.betweenTagAndName=r,p.beforeChildren=u,p.trailing=o??"",je(e,p,t,e.lastToken),p}function ic(e){let t=Jt(e),n=ls(e);if(!n)return;let r=Ee(as(e),Jt(e));return n.leading=Ee(t,n.leading),n.trailing=Ee(n.trailing,r),n}function ac(e){let t=K(e,sn)?.text,n=lc(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Ee(t,n.nodes[0].leading);else n.trailing=Ee(t,n.trailing);return n}function lc(e){let t=e.current.value,n=[],r=!0,s=Jt(e);while(r){let i=e.lastToken.end,l=Mt(e),a=ls(e);if(!a){if(l)throw M(e,"Unexpected slashdash");break}let c=ce(e),u=as(e);if(l)s=Ee(s,e.text.slice(i.offset,e.lastToken.end.offset),Jt(e));else a.trailing=Ee(a.trailing,c,u)??"",n.push(a),a.leading=s??"",s=Jt(e);r=u!=null}let o=new Et(n);return je(e,o,t,e.lastToken),o.trailing=s??"",o}var Qo=S(()=>{kt();Wo();Xl();rc();un()});function cc(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function nm(e){{let t=K(e,sn);if(t)return{type:"bom",text:t.text}}{let t=K(e,St);if(t)return{type:"newline",text:t.text}}{let t=K(e,Tt);if(t)return{type:"space",text:t.text}}{let t=Zn(e);if(t)return{type:"singleline",text:t}}{let t=os(e);if(t)return{type:"multiline",text:t}}return}function cs(e){{let t=is(e);if(t)return{type:"line-escape",text:t}}{let t=K(e,Tt);if(t)return{type:"space",text:t.text}}{let t=os(e);if(t)return{type:"multiline",text:t}}return}function uc(e){let t=[];while(!0){{let n=nm(e);if(n){t.push(n);continue}}if(K(e,Nt)?.text){let r,s=cc(e,cs)??[],o=ls(e);if(!o)throw M(e,"Invalid slashdash, expected a commented node");o.trailing=Ee(o.trailing,cc(e,cs)?.map((i)=>i.text).join(""),as(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function rm(e){let t=K(e,Nt);if(t==null)return;let n,r=[];while(n=cs(e))r.push(n);let s,o,i="";if(o=hn(e)){if(s=o[0],o[1])i=o[1]}else if(o=Zo(e))s=o;else throw M(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function ei(e){let t=[];while(!0){let n=cs(e);if(!n)break;let r=!0;t.push(n);while(r){let s=rm(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...ei(ss(s[1][0],Gn(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var pc=S(()=>{un();Qo()});function vt(e,{as:t="document",flags:n,...r}={}){let s=sm[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let o=Gl(n),i=Gn(e,{...r,flags:o}),l=ss(e,i,{...r,flags:o}),a;try{a=s(l)}catch(c){Ko(l,c)}if(Ko(l),!a)throw new V(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return a}var sm;var fc=S(()=>{kt();un();Qo();pc();sm={value:rs,identifier:Yo,node:ic,entry:oc,document:ac,"whitespace in document":uc,"whitespace in node":ei}});var us=S(()=>{kt();Wo();fc()});function yn(e,t){let n=e.slice(0,t),r=n.split(`
|
|
90
|
+
`+i.slice(r.length)}).slice(1,-1)}function du(e,t,n,r,s,o,i,l){if(i)return"";if(o){let c=n.text.startsWith('"""'),a=t.slice(0,l).split(kn),u={offset:n.start.offset+(c?3:1)+l,line:n.start.line+(a.length-1),column:a.length===1?n.start.column+(c?3:1)+l:a.at(-1).length},f={offset:u.offset+r.length,line:u.line,column:u.column+r.length};if(!o.startsWith("{"))e.push(new z(String.raw`Invalid unicode escape "\u${o}", did you forget to use {}? "\u{${o}}"`,{token:n,start:u,end:f}));else e.push(new z(String.raw`Invalid unicode escape "\u${o.endsWith("}")?o:`${o}...`}"`,{token:n,start:u,end:f}));return""}else if(s){let c=parseInt(s,16);if(c>=55296&&c<=57343)e.push(new z(String.raw`Invalid unicode escape "\u{${s}}, only scalar values can be added using an escape`,{token:n}));return String.fromCodePoint(c)}else{let c=vg.get(r);if(c==null)return e.push(new z(r.length<2?"Invalid whitespace escape at the end of a string":`Invalid escape "${r}"`,{token:n})),"";return c}}function Sr(e,t,n){let r=1;switch(e.type){case On:r=3;break;case jt:r=e.text.indexOf('"')+1;break;case Wt:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(kn);return{offset:e.start.offset+r+n,line:e.start.line+(s.length-1),column:s.length===1?e.start.column+r+n:1+s[s.length-1].length}}var vS,vg,kn,Jg,Og,jg,Ag,Cg,Ng,Rg,Tg,kg;var mu=v(()=>{Bt();An();vS=new Map([...Array.from({length:32},(e,t)=>[t,`\\u{${t.toString(16).padStart(2,"0")}}`]),[127,"\\u{7f}"],[8206,"\\u{200e}"],[8207,"\\u{200f}"],[8234,"\\u{202a}"],[8235,"\\u{202b}"],[8236,"\\u{202c}"],[8237,"\\u{202d}"],[8238,"\\u{202e}"],[8294,"\\u{2066}"],[8295,"\\u{2067}"],[8296,"\\u{2068}"],[8297,"\\u{2069}"],[65279,"\\u{feff}"],[34,"\\\""],[92,"\\\\"],[10,"\\n"],[11,"\\u{0b}"],[12,"\\f"],[13,"\\r"],[133,"\\u{85}"],[8232,"\\u{2028}"],[8233,"\\u{2029}"],[8,"\\b"],[9,"\\t"]]),vg=new Map([["\\n",`
|
|
91
|
+
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),kn=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,Jg=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,Og=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/s,jg=/(?:^|[^\\\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029])(?:\\\\)*[\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000\x0A\x0B\x0C\x0D\x85\u2028\u2029]*(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])/dgs;Ag=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,Cg=/(?:^|[^\\\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])(?:\\\\)*[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(?:\\[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)*$/,Ng=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]?)/g,Rg=/([^\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000])[\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*$/;Tg=/\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g;kg=/(\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029])([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)|\\(?:$|u\{(0[0-9a-fA-F]{0,5}|10[0-9a-fA-F]{4}|[1-9a-fA-F][0-9a-fA-F]{0,4})\}|u(\{[^}]{1,6}\}?|[0-9a-fA-F]{1,5}|10[0-9a-fA-F]{4})|([\x0A\x0B\x0C\x0D\x85\u2028\u2029\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]+)|.)/g});function $t(e){if(!e.current.done)e.lastToken=e.current.value;e.current=e.tokens.next();let t=!e.current.done&&e.current.value.errors;if(t)e.errors.push(...t)}function Z(e,t){if(!e.current.done&&e.current.value.type===t){let n=e.current.value;return $t(e),n}}function V(e,t){let n="current"in e?e.current.value??e.lastToken:e;return new z(t,{token:n})}function ke(e,t,n,r=n){if(e.storeLocations)ou(t,n,r)}function Je(e="",t="",n=""){return e+t+n||void 0}function Ls(e,t,{storeLocations:n=!1,flags:r}){let s={type:-1,text:"",start:{offset:0,line:1,column:1},end:{offset:0,line:1,column:1},errors:null},o={text:e,tokens:t[Symbol.iterator](),current:{done:!1,value:s},storeLocations:n,lastToken:s,errors:[],flags:r};return $t(o),o}function Ti(e,t){if(!t&&!e.current.done&&e.current.value.type!==Ot)t=V(e,`Unexpected token ${JSON.stringify(e.current.value.text)}, did you forget to quote an identifier?`);let n=e.errors??[];if(t!=null)if(t instanceof z)if(t.errors)n.push(...t.errors);else n.push(t);else n.push(new z(`An unexpected error occurred, ${String(t)}, this is likely a bug in the KDL parser`,{cause:t}));if(n.length)if(n.length===1)throw n[0];else throw new z("Encountered multiple errors",{errors:n})}function Ds(e){switch(e){case"#null":return null;case"#true":return!0;case"#false":return!1;case"#inf":return 1/0;case"#-inf":return-1/0;case"#nan":return NaN}}function gu(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function ki(e){let{value:t}=e.current,n,r,s,o,i,l=!1;if(t?.text[0]==="-"||t?.text[0]==="+")i=t.text[0];switch(t?.type){case ot:{if(!e.flags.experimentalSuffixedNumbers)throw new z("Unreachable code: got a suffixed number from the tokenizer but the suffixed number flag is not set",{token:t});let u=i?t.text.slice(1):t.text,f=u.search(/[^0-9._]/);if(r=(i??"")+u.slice(0,f),n=Number.parseFloat(r.replaceAll("_","")),o=s=u.slice(f),gu(s))e.errors.push(V(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Ns:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case Cs:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case xt:l=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case As:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case Jn:if(n=Ds(t.text),n===void 0)if(n=null,Ds(t.text.toLowerCase())!==void 0)e.errors.push(V(e,`Invalid keyword ${t.text}, keywords are case sensitive, write ${t.text.toLowerCase()} instead`));else switch(t.text.toLowerCase()){case"#nul":case"#nill":e.errors.push(V(e,`Invalid keyword ${t.text}, did you mean #null?`));break;case"#fals":case"#fasle":e.errors.push(V(e,`Invalid keyword ${t.text}, did you mean #false?`));break;case"#ture":case"#treu":e.errors.push(V(e,`Invalid keyword ${t.text}, did you mean #true?`));break;case"#ifn":e.errors.push(V(e,`Invalid keyword ${t.text}, did you mean #inf?`));break;case"#-ifn":e.errors.push(V(e,`Invalid keyword ${t.text}, did you mean #-inf?`));break;default:e.errors.push(V(e,`Invalid keyword ${t.text}, surround it with quotes to use a string`))}break;default:return}$t(e);let c=e.flags.experimentalSuffixedNumbers&&Z(e,Jn);if(c)if(l){if(o=c.text,Ds(o)!==void 0)e.errors.push(V(c,`Invalid number suffix ${o}, did you forget a space between the number and the keyword?`));s=o.slice(1)}else if(s)e.errors.push(V(c,"Unexpected hashed suffix, a number can only have one suffix"));else if(typeof n==="number")e.errors.push(V(c,"Unexpected hashed suffix, you cannot place suffixes on number keywords"));else e.errors.push(V(c,"Unexpected hashed suffix, you can only place suffixes on numbers"));let a=new Ze(n);if(a.representation=r??t.text,ke(e,a,t),s){let u=new at(s);u.representation=o,u.suffix=!0,ke(e,u,e.lastToken),a.tag=u}return a}function wr(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case ve:if($t(e),gu(t.text))e.errors.push(V(e,`Invalid keyword "${t.text}", add a leading # to use the keyword or surround with quotes to make it a string`));n=[t.text,t.text,t];break;case hr:$t(e),n=[pu(e.errors,t.text.slice(1,-1),t),t.text,t];break;case On:$t(e),n=[fu(e.errors,t.text.slice(3,-3),t),t.text,t];break;case jt:{$t(e);let r=t.text,s=r.indexOf('"');n=[cu(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case Wt:{$t(e);let r=t.text,s=r.indexOf('"');n=[uu(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Z(e,Jn))e.errors.push(V(e.lastToken,Ds(e.lastToken.text)===void 0?"Unexpected hashed suffix on a string, you can only place suffixes on numbers":"Unexpected keyword, did you forget to add whitespace?"));return n}function Pi(e){let t=wr(e);if(!t)return;let n=new Xe(t[0]);return n.representation=t[1],ke(e,n,t[2],e.lastToken),n}function Is(e){let t=ki(e);if(t)return t;let n=wr(e);if(!n)return;let r=new Ze(n[0]);return r.representation=n[1],ke(e,r,n[2],e.lastToken),r}function Er(e){let t=Z(e,Ts);if(!t)return;let{value:n}=e.current;return $t(e),t.text+(n?.text??"")}function Fs(e){return Z(e,ks)?.text}function _i(e){return Z(e,Vt)??Fs(e)}function Vs(e){let t=Z(e,Rs);if(!t)return;while(_i(e));if(!Er(e)&&!Z(e,At)&&!Z(e,Ot))e.errors.push(V(e,`Expected newline or single-line comment after backslash but got ${e.current.value?.text??"EOF"}`));return e.text.slice(t.start.offset,e.lastToken.end.offset)}function Rt(e){let t=e.lastToken.end;while(Z(e,At)?.text??Er(e)??_i(e)??Vs(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function ge(e){let t=e.lastToken.end;while(_i(e)??Vs(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function Ri(e){let t=Z(e,vs);if(!t)return;let n=ge(e),r=wr(e);if(!r&&e.current.value){let l=e.current.value;if(Rt(e))e.errors.push(V(l,"This type of whitespace is not allowed inside a tag"));r=wr(e)}if(!r){if(ki(e))e.errors.push(V(e,"Invalid tag, did you forget to quote a string?")),r=["error","error"]}if(!r)throw V(e,"Invalid tag, did you forget to quote a string?");let s=ge(e),o=Z(e,gr);if(!o&&e.current.value){let l=e.current.value;if(Rt(e))e.errors.push(V(l,"This type of whitespace is not allowed inside a tag"));o=Z(e,gr)}if(!o)throw V(e,"Invalid tag, did you forget to quote a string?");let i=new at(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,ke(e,i,t,e.lastToken),i}function Ws(e){return Er(e)??Z(e,At)?.text??Z(e,js)?.text??Z(e,Ot)?.text}function Mi(e){if(!Z(e,Js))return;let t=bu(e);if(!Z(e,Os))throw V(e,"Invalid node children");return t}function Pn(e){let t=e.current.value;{let f=Ri(e);if(f){let p=ge(e),d=Is(e);if(!d)throw V(e,"Invalid argument");if(d.tag)e.errors.push(V(e.lastToken,"A number suffix cannot be combined with a regular tag"));d.tag=f,d.betweenTagAndValue=p;let x=new Me(d,null);ke(e,d,t,e.lastToken),ke(e,x,t,e.lastToken);let w=ge(e);if(Z(e,vn))e.errors.push(V(e.lastToken,typeof d.value==="string"?"Unexpected equals sign, properties are name=(tag)value not (tag)name=value":"Unexpected equals sign")),w=Je(w,ge(e))||" ";return[x,w]}}{let f=ki(e);if(f){let p=new Me(f,null);ke(e,p,t,e.lastToken);let d=ge(e);if(Z(e,vn))e.errors.push(V(e.lastToken,"Unexpected equals sign, did you forget to quote the property name?")),d=Je(d,ge(e))||" ";return[p,d]}}let n=wr(e);if(!n)return;let r=ge(e),s=Z(e,vn);if(!s){let f=new Ze(n[0]);f.representation=n[1],ke(e,f,n[2]);let p=new Me(f,null);return ke(e,p,t,e.lastToken),[p,r]}let o=new Xe(n[0]);o.representation=n[1],ke(e,o,n[2]);let i=ge(e),l=Ri(e),c=l&&ge(e),a=Is(e);if(!a)throw V(e,"Expected a value");if(l){if(a.tag)e.errors.push(V(e.lastToken,"A number suffix cannot be combined with a regular tag"));a.tag=l,a.betweenTagAndValue=c}let u=new Me(a,o);return ke(e,u,t,e.lastToken),u.equals=Je(r,s.text,i),[u,void 0]}function hu(e){let t=ge(e)??"",n;while(n=zt(e)){let i=e.lastToken.end,l=Pn(e);if(!l)throw V(e,"Expected a property or argument");if(!(l[1]??ge(e)))throw V(e,"Expected space after slashdashed property or argument");t=t+n+e.text.slice(i.offset,e.lastToken.end.offset)}let r=Pn(e);if(!r)return;let s=r[1]??ge(e)??"";while(n=zt(e)){let i=e.lastToken.end,l=Pn(e);if(!l)throw V(e,"Expected a property or argument");if(!(l[1]??ge(e)))break;s=s+n+e.text.slice(i.offset,e.lastToken.end.offset)}let o=r[0];return o.leading=t,o.trailing=s,o}function zt(e){let t=Z(e,Ft)?.text;if(!t)return;return Je(t,Rt(e))}function Hs(e){let t=e.current.value,n=Ri(e),r=n&&ge(e),s=Pi(e);if(!s)if(n)throw V(e,"Couldn't find node name");else return;let o=ge(e),i=o!=null,l=zt(e),c=[];while(i||l){let p=e.lastToken.end,d=Pn(e);if(!d)break;if(l)i=(d[1]||ge(e))!=null,o=Je(o,l,e.text.slice(p.offset,e.lastToken.end.offset)),l=zt(e);else{let x=d[0];x.leading=o,c.push(x),o=d[1]||ge(e),i=o!=null,l=zt(e)}}let a,u;while(!0){l??=zt(e);let p=e.lastToken.end,d=Mi(e);if(!d){if(l)throw V(e,"Unexpected slashdash");break}if(l)o=Je(o,l,e.text.slice(p.offset,e.lastToken.end.offset)),l=void 0;else{if(a)e.errors.push(V(e,"A node can only have one children block"));a=d,u=o??"",o=void 0}o=Je(o,ge(e))}let f=new Rn(s,c,a);return f.tag=n??null,f.betweenTagAndName=r,f.beforeChildren=u,f.trailing=o??"",ke(e,f,t,e.lastToken),f}function yu(e){let t=Rt(e),n=Hs(e);if(!n)return;let r=Je(Ws(e),Rt(e));return n.leading=Je(t,n.leading),n.trailing=Je(n.trailing,r),n}function xu(e){let t=Z(e,En)?.text,n=bu(e);if(!t)return n;if(n.nodes[0])n.nodes[0].leading=Je(t,n.nodes[0].leading);else n.trailing=Je(t,n.trailing);return n}function bu(e){let t=e.current.value,n=[],r=!0,s=Rt(e);while(r){let i=e.lastToken.end,l=zt(e),c=Hs(e);if(!c){if(l)throw V(e,"Unexpected slashdash");break}let a=ge(e),u=Ws(e);if(l)s=Je(s,e.text.slice(i.offset,e.lastToken.end.offset),Rt(e));else c.trailing=Je(c.trailing,a,u)??"",n.push(c),c.leading=s??"",s=Rt(e);r=u!=null}let o=new Nt(n);return ke(e,o,t,e.lastToken),o.trailing=s??"",o}var Di=v(()=>{Bt();Oi();lu();mu();An()});function $u(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function Pg(e){{let t=Z(e,En);if(t)return{type:"bom",text:t.text}}{let t=Z(e,At);if(t)return{type:"newline",text:t.text}}{let t=Z(e,Vt);if(t)return{type:"space",text:t.text}}{let t=Er(e);if(t)return{type:"singleline",text:t}}{let t=Fs(e);if(t)return{type:"multiline",text:t}}return}function Bs(e){{let t=Vs(e);if(t)return{type:"line-escape",text:t}}{let t=Z(e,Vt);if(t)return{type:"space",text:t.text}}{let t=Fs(e);if(t)return{type:"multiline",text:t}}return}function Su(e){let t=[];while(!0){{let n=Pg(e);if(n){t.push(n);continue}}if(Z(e,Ft)?.text){let r,s=$u(e,Bs)??[],o=Hs(e);if(!o)throw V(e,"Invalid slashdash, expected a commented node");o.trailing=Je(o.trailing,$u(e,Bs)?.map((i)=>i.text).join(""),Ws(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function _g(e){let t=Z(e,Ft);if(t==null)return;let n,r=[];while(n=Bs(e))r.push(n);let s,o,i="";if(o=Pn(e)){if(s=o[0],o[1])i=o[1]}else if(o=Mi(e))s=o;else throw V(t,"Couldn't find argument, property, or children that were commented by slashdash");return[{type:"slashdash",preface:r,value:s},i]}function Ii(e){let t=[];while(!0){let n=Bs(e);if(!n)break;let r=!0;t.push(n);while(r){let s=_g(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Ii(Ls(s[1][0],$r(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var wu=v(()=>{An();Di()});function Tt(e,{as:t="document",flags:n,...r}={}){let s=Mg[t];if(s==null)throw TypeError(`Invalid "as" target passed: ${JSON.stringify(t)}`);if(typeof e!=="string"){if(typeof TextDecoder!=="function")throw TypeError("Uint8Array input is only supported on platforms that include TextDecoder");e=new TextDecoder("utf-8",{fatal:!0}).decode(e)}let o=iu(n),i=$r(e,{...r,flags:o}),l=Ls(e,i,{...r,flags:o}),c;try{c=s(l)}catch(a){Ti(l,a)}if(Ti(l),!c)throw new z(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return c}var Mg;var Eu=v(()=>{Bt();An();Di();wu();Mg={value:Is,identifier:Pi,node:yu,entry:hu,document:xu,"whitespace in document":Su,"whitespace in node":Ii}});var qs=v(()=>{Bt();Oi();Eu()});function _n(e,t){let n=e.slice(0,t),r=n.split(`
|
|
52
92
|
`).length;return{column:t-n.lastIndexOf(`
|
|
53
|
-
`),line:r,offset:t}}var ge;var xn=S(()=>{ge=class ge extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new ge(`${e}: ${this.reason}`,t)}}});var dc;var mc=S(()=>{dc=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncsrcchange","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","onicecandidatepairadd","onicecandidatepairnominate","onicecandidatepairremove","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onssrcchange","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function k(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw I(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw I(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function I(e,t,n){let r=fs(t)?.start;return new ge(n,r===void 0?null:yn(e.text,r))}function fs(e){let t=pn(e);return t?{end:t.end.offset,start:t.start.offset}:null}function ie(e,t,n){let r=e.spans?fs(n):null;if(r)e.spans?.set(t,r)}function gc(e,t,n){let r=e.tokens&&n?fs(n):null;if(r)e.tokens?.names.set(t,r)}function pe(e,t,n){let r=e.tokens&&n?fs(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function Ot(e){return e.entries.filter((t)=>!t.name)}function ee(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function $n(e,t){let n=t.getTag();if(n!==null&&!xc.has(n))throw I(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw I(e,t,"(ref) annotates a value, and this is a name");return n}function ut(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw I(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(ne(r)){if(!Number.isFinite(r))throw I(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw I(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!b(r))throw I(e,t,"(ref) needs a string");return{$ref:r}}return r}function De(e,t){return t.entries.filter((n)=>!n.name).map((n)=>ut(e,n))}function Me(e){return e.entries.filter((t)=>t.name)}function he(e){return e.children?.nodes??[]}function Qe(e){return e.getName()??""}function am(e,t,n){let r={$prototype:"Function"},s=De(e,t),o=he(t);for(let l of Me(t))k(r,Qe(l),ut(e,l),e,l),pe(e,`${n}/${ee(Qe(l))}`,l);let i=e.tokens?Ot(t):[];if(o.length>0){if(s.length>0)k(r,"parameters",s,e,t);k(r,"body",ti(e,o,`${n}/body`),e,t)}else if(s.length>0){let l=s.at(-1)??null,a=s.slice(0,-1);if(a.length>0)k(r,"parameters",a,e,t);k(r,"body",l,e,t),pe(e,`${n}/body`,i.pop())}for(let[l,a]of i.entries())pe(e,`${n}/parameters/${l}`,a);return ie(e,n,t),r}function lm(e,t,n){let r={$prototype:"Function",$src:"#client"};if(De(e,t).length>0||he(t).length>0)throw I(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of Me(t))k(r,Qe(s),ut(e,s),e,s),pe(e,`${n}/${ee(Qe(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return ie(e,n,t),r}function cm(e,t,n){if(De(e,t).length>0||he(t).length>0)throw I(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=Me(t);if(s.length>0){let o={};for(let i of s){let l=Qe(i);k(o,l,ut(e,i),e,i),ie(e,`${n}/arguments/${ee(l)}`,i),pe(e,`${n}/arguments/${ee(l)}`,i)}r.arguments=o}return ie(e,n,t),r}function um(e,t,n){let r={};for(let a of Me(t)){let c=Qe(a);if(k(r,c,ut(e,a),e,a),c!=="timing"||r[c]!=="server")throw I(e,a,"A script takes timing=server, and nothing else")}let s=De(e,t),[o]=s;if(s.length!==1||!b(o)||he(t).length>0)throw I(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",l=n.$script;if(!C(l)||!hc.has(l))l={},hc.add(l),k(n,"$script",l,e,t);k(l,i,o,e,t),ie(e,`/$script/${i}`,t),pe(e,`/$script/${i}`,Ot(t)[0])}function yc(e,t,n){for(let[r,s]of(e.tokens?Ot(n):[]).entries())pe(e,`${t}/${r}`,s)}function ti(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw I(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return _e(e,s,`${n}/${r+o}`)})}function _e(e,t,n){let r=$n(e,t);if(ie(e,n,t),r==="fn")return am(e,t,n);if(r==="export")return lm(e,t,n);if(r==="server")return cm(e,t,n);let s=De(e,t),o=Me(t),i=he(t);if(r==="array"){if(o.length>0)throw I(e,t,"(array) holds items, and these are named");return yc(e,n,t),[...s,...ti(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw I(e,t,"A list of values cannot also have names or a block");return yc(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw I(e,t,"A value cannot also have names or a block");return pe(e,n,Ot(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((a)=>a.getName()==="-"))return ti(e,i,n)}else if(s.length>0)throw I(e,t,"(object) holds names, and this is a value");let l={};for(let a of o){let c=Qe(a);k(l,c,ut(e,a),e,a),ie(e,`${n}/${ee(c)}`,a),gc(e,`${n}/${ee(c)}`,a.name),pe(e,`${n}/${ee(c)}`,a)}for(let a of i){let c=a.getName();k(l,c,_e(e,a,`${n}/${ee(c)}`),e,a),gc(e,`${n}/${ee(c)}`,a.name)}return l}function ds(e,t,n){let r={};if(ie(e,n,t),De(e,t).length>0)throw I(e,t,"A style block holds declarations, and this is a value");for(let s of Me(t)){let o=Qe(s);k(r,o,ut(e,s),e,s),ie(e,`${n}/${ee(o)}`,s),pe(e,`${n}/${ee(o)}`,s)}for(let s of he(t)){let o=s.getName(),i=`${n}/${ee(o)}`,l=he(s);if(s.getTag()==="array"||l.length>0&&l.every((c)=>c.getName()==="-")){k(r,o,_e(e,s,i),e,s);continue}let a=De(e,s);if(a.length>1)throw I(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(a.length===1){if(Me(s).length>0||he(s).length>0)throw I(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);k(r,o,a[0]??null,e,s),ie(e,i,s),pe(e,i,Ot(s)[0])}else k(r,o,ds(e,s,i),e,s)}return r}function ps(e,t,n){let r=he(t);if(r.length!==1||!r[0])throw I(e,t,`"${t.getName()}" holds one element`);return bc(e,r[0],n)}function $c(e,t,n){let r={$prototype:"Array"};if(ie(e,n,t),De(e,t).length>0)throw I(e,t,"$array holds names and one element, and this is a value");for(let s of Me(t)){let o=Qe(s),i=o.startsWith(".")?o.slice(1):o;k(r,i,ut(e,s),e,s),pe(e,`${n}/${ee(i)}`,s)}if(he(t).length>0)k(r,"map",ps(e,t,`${n}/map`),e,t);return r}function bc(e,t,n){let r=t.getName();if(r==="-"){let s=De(e,t);if(s.length!==1||Me(t).length>0||he(t).length>0)throw I(e,t,'"-" is one piece of text or one (ref)');return ie(e,n,t),pe(e,n,Ot(t)[0]),s[0]??null}if(r==="$array")return $c(e,t,n);return ni(e,t,n)}function pm(e,t,n,r){let s=$n(e,n);if(t==="map")return ps(e,n,r);if(t==="cases"){let o={};for(let i of he(n)){let l=i.getName();k(o,l,ps(e,i,`${r}/${ee(l)}`),e,i)}return o}if(t==="children"&&s!=="array"&&he(n).length>0)return ps(e,n,r);return _e(e,n,r)}function ni(e,t,n){let r={},s=t.getName(),o=$n(e,t);if(ie(e,n,t),o!==null)throw I(e,t,`(${o}) cannot annotate an element`);let i=De(e,t);if(s==="$element"){let[a,c,...u]=i;if(u.length>0)throw I(e,t,"$element takes at most a tag and a text value");if(a!==void 0)k(r,"tagName",a,e,t);if(c!==void 0)k(r,"textContent",c,e,t),pe(e,`${n}/textContent`,Ot(t)[1])}else{if(s.startsWith("$"))throw I(e,t,`"${s}" is not a kind of element`);if(k(r,"tagName",s,e,t),i.length>1)throw I(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)k(r,"textContent",i[0],e,t),ie(e,`${n}/textContent`,t),pe(e,`${n}/textContent`,Ot(t)[0])}fm(e,t,r,n);let l=[];for(let a of he(t))dm(e,a,r,l,n);if(l.length>0)k(r,"children",l,e,t);return r}function Sc(e){let{attributes:t}=e;if(C(t))return t;let n={};return e.attributes=n,n}function fm(e,t,n,r){for(let s of Me(t)){let o=Qe(s),i=s.getTag();if(i==="fn")throw I(e,s,"A function has a block form: (fn)name, on a line of its own");let l=ut(e,s);if(o.startsWith(".")||o.startsWith("$")){let a=o.startsWith(".")?o.slice(1):o;k(n,a,l,e,s),ie(e,`${r}/${ee(a)}`,s),pe(e,`${r}/${ee(a)}`,s)}else if(o.startsWith("on")&&i==="ref")k(n,o,l,e,s),ie(e,`${r}/${ee(o)}`,s),pe(e,`${r}/${ee(o)}`,s);else if(o.startsWith("on")&&dc.has(o))throw I(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else k(Sc(n),o,l,e,s),ie(e,`${r}/attributes/${ee(o)}`,s),pe(e,`${r}/attributes/${ee(o)}`,s)}}function dm(e,t,n,r,s){let o=t.getName(),i=$n(e,t),l=(a)=>`${s}/${ee(a)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw I(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);k(n,o,_e(e,t,l(o)),e,t)}else if(o==="script"){if(s!=="")throw I(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw I(e,t,`(${i}) cannot annotate a script`);um(e,t,n)}else if(o==="state")k(n,"state",_e(e,t,l("state")),e,t);else if(o==="style")k(n,"style",ds(e,t,l("style")),e,t);else if(o==="attributes"){let a=_e(e,t,l("attributes"));if(C(a))for(let[c,u]of Object.entries(a))k(Sc(n),c,u,e,t);else k(n,"attributes",a,e,t)}else if(o.startsWith(".")){let a=o.slice(1);k(n,a,pm(e,a,t,l(a)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")k(n,o,_e(e,t,l(o)),e,t);else{if(im.has(o))throw I(e,t,`"${o}" is reserved here`);r.push(bc(e,t,`${s}/children/${r.length}`))}}function ri(e,t){return he(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?_e(e,n,s):ni(e,n,s)})}function si(e){let t=om.exec(e);if(t)throw new ge(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,yn(e,t.index));try{return vt(e,{storeLocations:!0})}catch(n){let s=(n instanceof V?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new ge(o.split(`
|
|
54
|
-
`)[0]??o,s?
|
|
55
|
-
`,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function
|
|
56
|
-
`)+1)}function
|
|
93
|
+
`),line:r,offset:t}}var $e;var Mn=v(()=>{$e=class $e extends Error{column;line;offset;reason;constructor(e,t=null){super(t?`${e} (line ${t.line}, column ${t.column})`:e);this.name="JxnError",this.column=t?.column??null,this.line=t?.line??null,this.offset=t?.offset??null,this.reason=e}inFile(e){let t=this.line!==null&&this.column!==null&&this.offset!==null?{column:this.column,line:this.line,offset:this.offset}:null;return new $e(`${e}: ${this.reason}`,t)}}});var vu;var Ju=v(()=>{vu=new Set(["onabort","onactivate","onaddsourcebuffer","onaddtrack","onadvertisementreceived","onafterprint","onanimationcancel","onanimationend","onanimationiteration","onanimationstart","onappinstalled","onaudioend","onaudioprocess","onaudiostart","onauxclick","onavailabilitychanged","onbackgroundfetchabort","onbackgroundfetchclick","onbackgroundfetchfail","onbackgroundfetchsuccess","onbeforeinput","onbeforeinstallprompt","onbeforematch","onbeforeprint","onbeforetoggle","onbeforexrselect","onbegin","onblocked","onblur","onboundary","onbufferedamountlow","onbufferedchange","oncancel","oncanmakepayment","oncanplay","oncanplaythrough","oncaptureaction","oncapturedmousechange","oncapturehandlechange","onchange","oncharacterboundsupdate","oncharacteristicvaluechanged","onchargingchange","onchargingtimechange","onclick","onclose","onclosing","oncommand","oncomplete","oncompositionend","oncompositionstart","onconfigurationchange","onconnect","onconnecting","onconnectionavailable","onconnectionstatechange","oncontentdelete","oncontextlost","oncontextmenu","oncontextoverflow","oncontextrestored","oncontrollerchange","oncookiechange","oncopy","oncsrcchange","oncuechange","oncurrententrychange","oncurrentscreenchange","oncut","ondataavailable","ondatachannel","ondblclick","ondequeue","ondevicechange","ondevicemotion","ondeviceorientation","ondeviceorientationabsolute","ondischargingtimechange","ondisconnect","ondispose","ondownloadprogress","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onencrypted","onend","onended","onendstreaming","onenter","onenterpictureinpicture","onerror","onexit","onfencedtreeclick","onfetch","onfinish","onfocus","onformdata","onframeratechange","onfreeze","onfullscreenchange","onfullscreenerror","ongamepadconnected","ongamepaddisconnected","ongatheringstatechange","ongattserverdisconnected","ongeometrychange","ongotpointercapture","onhashchange","onicecandidate","onicecandidateerror","onicecandidatepairadd","onicecandidatepairnominate","onicecandidatepairremove","oniceconnectionstatechange","onicegatheringstatechange","oninput","oninputreport","oninputsourceschange","oninstall","oninstallresult","oninvalid","onisolationchange","onkeydown","onkeyframerequest","onkeypress","onkeystatuseschange","onkeyup","onlanguagechange","onlayoutchange","onleavepictureinpicture","onlevelchange","onload","onloadeddata","onloadedmetadata","onloadend","onloading","onloadingdone","onloadingerror","onloadstart","onlocation","onlostpointercapture","onmanagedconfigurationchange","onmark","onmessage","onmessageerror","onmidimessage","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onmute","onnavigate","onnavigateerror","onnavigatesuccess","onnegotiationneeded","onnomatch","onnotificationclick","onnotificationclose","onoffline","ononline","onopen","onorientationchange","onpagehide","onpagereveal","onpageshow","onpageswap","onpaste","onpause","onpayerdetailchange","onpaymentmethodchange","onpaymentrequest","onperiodicsync","onplay","onplaying","onpointercancel","onpointerdown","onpointerenter","onpointerleave","onpointerlockchange","onpointerlockerror","onpointermove","onpointerout","onpointerover","onpointerrawupdate","onpointerup","onpopstate","onportalactivate","onprerenderingchange","onprioritychange","onprocessorerror","onprogress","onpromptaction","onpromptdismiss","onpush","onpushsubscriptionchange","onquotaoverflow","onratechange","onreading","onreadingerror","onreadystatechange","onredraw","onreflectionchange","onrejectionhandled","onrelease","onremove","onremovesourcebuffer","onremovetrack","onrepeat","onreset","onresize","onresourcetimingbufferfull","onresult","onresume","onrtctransform","onscreenschange","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onselectedcandidatepairchange","onselectend","onselectionchange","onselectstart","onserviceadded","onservicechanged","onserviceremoved","onshippingaddresschange","onshippingoptionchange","onshow","onsignalingstatechange","onsinkchange","onslotchange","onsnapchanged","onsnapchanging","onsoundend","onsoundstart","onsourceclose","onsourceended","onsourceopen","onspeechend","onspeechstart","onsqueeze","onsqueezeend","onsqueezestart","onssrcchange","onstalled","onstart","onstartstreaming","onstatechange","onstop","onstorage","onstream","onsubmit","onsuccess","onsuspend","onsync","onterminate","ontextformatupdate","ontextupdate","ontimeout","ontimeupdate","ontoggle","ontonechange","ontoolactivated","ontoolcancel","ontoolchange","ontouchcancel","ontouchend","ontouchmove","ontouchstart","ontrack","ontransitioncancel","ontransitionend","ontransitionrun","ontransitionstart","onuncapturederror","onunhandledrejection","onunload","onunmute","onupdate","onupdateend","onupdatefound","onupdatestart","onupgradeneeded","onvalidationstatuschange","onversionchange","onvisibilitychange","onvoiceschanged","onvolumechange","onwaiting","onwaitingforkey","onwebkitanimationend","onwebkitanimationiteration","onwebkitanimationstart","onwebkittransitionend","onwheel","onzoomlevelchange"])});function L(e,t,n,r,s){let o=t.normalize("NFC");if(o==="__proto__")throw W(r,s,'"__proto__" cannot be a key: it would not be data');if(Object.hasOwn(e,o))throw W(r,s,`"${o}" is written twice, and one of them would be lost`);e[o]=n}function W(e,t,n){let r=zs(t)?.start;return new $e(n,r===void 0?null:_n(e.text,r))}function zs(e){let t=Cn(e);return t?{end:t.end.offset,start:t.start.offset}:null}function pe(e,t,n){let r=e.spans?zs(n):null;if(r)e.spans?.set(t,r)}function Ou(e,t,n){let r=e.tokens&&n?zs(n):null;if(r)e.tokens?.names.set(t,r)}function he(e,t,n){let r=e.tokens&&n?zs(n.value):null;if(r){let s=n?.value.representation,o=s===void 0?r.start:r.end-s.length;e.tokens?.values.set(t,{end:r.end,start:o})}}function kt(e){return e.entries.filter((t)=>!t.name)}function oe(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Dn(e,t){let n=t.getTag();if(n!==null&&!Cu.has(n))throw W(e,t,`(${n}) is not an annotation Jx Notation has`);if(n==="ref")throw W(e,t,"(ref) annotates a value, and this is a name");return n}function St(e,t){let n=t.getTag(),r=t.getValue();if(n!==null&&n!=="ref")throw W(e,t,`(${n}) cannot annotate a value here; only (ref) can`);if(Y(r)){if(!Number.isFinite(r))throw W(e,t,"JSON has no way to hold #inf or #nan");if(Number.isInteger(r)&&!Number.isSafeInteger(r))throw W(e,t,"This number is too large to survive being read as JSON")}if(n==="ref"){if(!y(r))throw W(e,t,"(ref) needs a string");return{$ref:r}}return r}function Ve(e,t){return t.entries.filter((n)=>!n.name).map((n)=>St(e,n))}function We(e){return e.entries.filter((t)=>t.name)}function Se(e){return e.children?.nodes??[]}function lt(e){return e.getName()??""}function Lg(e,t,n){let r={$prototype:"Function"},s=Ve(e,t),o=Se(t);for(let l of We(t))L(r,lt(l),St(e,l),e,l),he(e,`${n}/${oe(lt(l))}`,l);let i=e.tokens?kt(t):[];if(o.length>0){if(s.length>0)L(r,"parameters",s,e,t);L(r,"body",Li(e,o,`${n}/body`),e,t)}else if(s.length>0){let l=s.at(-1)??null,c=s.slice(0,-1);if(c.length>0)L(r,"parameters",c,e,t);L(r,"body",l,e,t),he(e,`${n}/body`,i.pop())}for(let[l,c]of i.entries())he(e,`${n}/parameters/${l}`,c);return pe(e,n,t),r}function Fg(e,t,n){let r={$prototype:"Function",$src:"#client"};if(Ve(e,t).length>0||Se(t).length>0)throw W(e,t,"(export) names a function the document's script exports, and holds no body of its own");for(let s of We(t))L(r,lt(s),St(e,s),e,s),he(e,`${n}/${oe(lt(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return pe(e,n,t),r}function Vg(e,t,n){if(Ve(e,t).length>0||Se(t).length>0)throw W(e,t,"(server) names a function the document's server script exports. Its arguments are written name=value");let r={$export:t.getName().normalize("NFC"),$src:"#server",timing:"server"},s=We(t);if(s.length>0){let o={};for(let i of s){let l=lt(i);L(o,l,St(e,i),e,i),pe(e,`${n}/arguments/${oe(l)}`,i),he(e,`${n}/arguments/${oe(l)}`,i)}r.arguments=o}return pe(e,n,t),r}function Wg(e,t,n){let r={};for(let c of We(t)){let a=lt(c);if(L(r,a,St(e,c),e,c),a!=="timing"||r[a]!=="server")throw W(e,c,"A script takes timing=server, and nothing else")}let s=Ve(e,t),[o]=s;if(s.length!==1||!y(o)||Se(t).length>0)throw W(e,t,"A script holds one string, which is the text of its module");let i=Object.hasOwn(r,"timing")?"server":"client",l=n.$script;if(!A(l)||!ju.has(l))l={},ju.add(l),L(n,"$script",l,e,t);L(l,i,o,e,t),pe(e,`/$script/${i}`,t),he(e,`/$script/${i}`,kt(t)[0])}function Au(e,t,n){for(let[r,s]of(e.tokens?kt(n):[]).entries())he(e,`${t}/${r}`,s)}function Li(e,t,n,r=0){return t.map((s,o)=>{if(s.getName()!=="-")throw W(e,s,`A list holds only "-" items, and this is "${s.getName()}"`);return Fe(e,s,`${n}/${r+o}`)})}function Fe(e,t,n){let r=Dn(e,t);if(pe(e,n,t),r==="fn")return Lg(e,t,n);if(r==="export")return Fg(e,t,n);if(r==="server")return Vg(e,t,n);let s=Ve(e,t),o=We(t),i=Se(t);if(r==="array"){if(o.length>0)throw W(e,t,"(array) holds items, and these are named");return Au(e,n,t),[...s,...Li(e,i,n,s.length)]}if(r!=="object"){if(s.length>1){if(o.length>0||i.length>0)throw W(e,t,"A list of values cannot also have names or a block");return Au(e,n,t),s}if(s.length===1){if(o.length>0||i.length>0)throw W(e,t,"A value cannot also have names or a block");return he(e,n,kt(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((c)=>c.getName()==="-"))return Li(e,i,n)}else if(s.length>0)throw W(e,t,"(object) holds names, and this is a value");let l={};for(let c of o){let a=lt(c);L(l,a,St(e,c),e,c),pe(e,`${n}/${oe(a)}`,c),Ou(e,`${n}/${oe(a)}`,c.name),he(e,`${n}/${oe(a)}`,c)}for(let c of i){let a=c.getName();L(l,a,Fe(e,c,`${n}/${oe(a)}`),e,c),Ou(e,`${n}/${oe(a)}`,c.name)}return l}function Ks(e,t,n){let r={};if(pe(e,n,t),Ve(e,t).length>0)throw W(e,t,"A style block holds declarations, and this is a value");for(let s of We(t)){let o=lt(s);L(r,o,St(e,s),e,s),pe(e,`${n}/${oe(o)}`,s),he(e,`${n}/${oe(o)}`,s)}for(let s of Se(t)){let o=s.getName(),i=`${n}/${oe(o)}`,l=Se(s);if(s.getTag()==="array"||l.length>0&&l.every((a)=>a.getName()==="-")){L(r,o,Fe(e,s,i),e,s);continue}let c=Ve(e,s);if(c.length>1)throw W(e,s,`"${o}" has more than one value. A selector with a space in it needs quotes`);if(c.length===1){if(We(s).length>0||Se(s).length>0)throw W(e,s,`"${o}" has a value and names. A selector with a space in it needs quotes`);L(r,o,c[0]??null,e,s),pe(e,i,s),he(e,i,kt(s)[0])}else L(r,o,Ks(e,s,i),e,s)}return r}function Us(e,t,n){let r=Se(t);if(r.length!==1||!r[0])throw W(e,t,`"${t.getName()}" holds one element`);return Ru(e,r[0],n)}function Nu(e,t,n){let r={$prototype:"Array"};if(pe(e,n,t),Ve(e,t).length>0)throw W(e,t,"$array holds names and one element, and this is a value");for(let s of We(t)){let o=lt(s),i=o.startsWith(".")?o.slice(1):o;L(r,i,St(e,s),e,s),he(e,`${n}/${oe(i)}`,s)}if(Se(t).length>0)L(r,"map",Us(e,t,`${n}/map`),e,t);return r}function Ru(e,t,n){let r=t.getName();if(r==="-"){let s=Ve(e,t);if(s.length!==1||We(t).length>0||Se(t).length>0)throw W(e,t,'"-" is one piece of text or one (ref)');return pe(e,n,t),he(e,n,kt(t)[0]),s[0]??null}if(r==="$array")return Nu(e,t,n);return Fi(e,t,n)}function Hg(e,t,n,r){let s=Dn(e,n);if(t==="map")return Us(e,n,r);if(t==="cases"){let o={};for(let i of Se(n)){let l=i.getName();L(o,l,Us(e,i,`${r}/${oe(l)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Se(n).length>0)return Us(e,n,r);return Fe(e,n,r)}function Fi(e,t,n){let r={},s=t.getName(),o=Dn(e,t);if(pe(e,n,t),o!==null)throw W(e,t,`(${o}) cannot annotate an element`);let i=Ve(e,t);if(s==="$element"){let[c,a,...u]=i;if(u.length>0)throw W(e,t,"$element takes at most a tag and a text value");if(c!==void 0)L(r,"tagName",c,e,t);if(a!==void 0)L(r,"textContent",a,e,t),he(e,`${n}/textContent`,kt(t)[1])}else{if(s.startsWith("$"))throw W(e,t,`"${s}" is not a kind of element`);if(L(r,"tagName",s,e,t),i.length>1)throw W(e,t,"An element has one text value. A list of them needs a block");if(i[0]!==void 0)L(r,"textContent",i[0],e,t),pe(e,`${n}/textContent`,t),he(e,`${n}/textContent`,kt(t)[0])}Bg(e,t,r,n);let l=[];for(let c of Se(t))qg(e,c,r,l,n);if(l.length>0)L(r,"children",l,e,t);return r}function Tu(e){let{attributes:t}=e;if(A(t))return t;let n={};return e.attributes=n,n}function Bg(e,t,n,r){for(let s of We(t)){let o=lt(s),i=s.getTag();if(i==="fn")throw W(e,s,"A function has a block form: (fn)name, on a line of its own");let l=St(e,s);if(o.startsWith(".")||o.startsWith("$")){let c=o.startsWith(".")?o.slice(1):o;L(n,c,l,e,s),pe(e,`${r}/${oe(c)}`,s),he(e,`${r}/${oe(c)}`,s)}else if(o.startsWith("on")&&i==="ref")L(n,o,l,e,s),pe(e,`${r}/${oe(o)}`,s),he(e,`${r}/${oe(o)}`,s);else if(o.startsWith("on")&&vu.has(o))throw W(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else L(Tu(n),o,l,e,s),pe(e,`${r}/attributes/${oe(o)}`,s),he(e,`${r}/attributes/${oe(o)}`,s)}}function qg(e,t,n,r,s){let o=t.getName(),i=Dn(e,t),l=(c)=>`${s}/${oe(c)}`;if(i==="fn"||i==="on"){if(!o.startsWith("on"))throw W(e,t,`(${i}) in an element marks a handler, and "${o}" is not one`);L(n,o,Fe(e,t,l(o)),e,t)}else if(o==="script"){if(s!=="")throw W(e,t,`"script" is the document's module, and is written in its root element. A <script> element is $element "script"`);if(i!==null)throw W(e,t,`(${i}) cannot annotate a script`);Wg(e,t,n)}else if(o==="state")L(n,"state",Fe(e,t,l("state")),e,t);else if(o==="style")L(n,"style",Ks(e,t,l("style")),e,t);else if(o==="attributes"){let c=Fe(e,t,l("attributes"));if(A(c))for(let[a,u]of Object.entries(c))L(Tu(n),a,u,e,t);else L(n,"attributes",c,e,t)}else if(o.startsWith(".")){let c=o.slice(1);L(n,c,Hg(e,c,t,l(c)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")L(n,o,Fe(e,t,l(o)),e,t);else{if(Ig.has(o))throw W(e,t,`"${o}" is reserved here`);r.push(Ru(e,t,`${s}/children/${r.length}`))}}function Vi(e,t){return Se(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?Fe(e,n,s):Fi(e,n,s)})}function Wi(e){let t=Dg.exec(e);if(t)throw new $e(`A raw control character (U+${t[0].codePointAt(0)?.toString(16).toUpperCase().padStart(4,"0")}) cannot be in a Jx Notation file. Escape it, as \\u{1b}`,_n(e,t.index));try{return Tt(e,{storeLocations:!0})}catch(n){let s=(n instanceof z?n.errors?.[0]??n:null)?.start,o=n instanceof Error?n.message:String(n);throw new $e(o.split(`
|
|
94
|
+
`)[0]??o,s?_n(e,s.offset):null)}}function ku(e){if(Sn(e.text)==="project")throw new $e('This is a project file: its first node is "project". A document has an element there, and a <project> element is $element "project"');let n=Wi(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)L(r,i,Vi(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")L(r,i,Fe(e,o,`/${oe(i)}`),e,o),pe(e,`/${oe(i)}`,o);else if(s)throw W(e,o,"A document has one root element, and this is a second");else s=o}if(s){let o=s.getName()==="$array"?Nu(e,s,""):Fi(e,s,"");for(let[i,l]of Object.entries(o))L(r,i,l,e,s)}return wn(r)}function vr(e,t){try{return ku({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof $e?n.inFile(t):n}}function Hi(e){let t=new Map;return{document:ku({spans:t,text:e}),spans:t}}var Dg,Cu,Ig,ju;var Jr=v(()=>{qs();K();mr();dr();Mn();Ju();Dg=/(?![\t\n\v\f\r])\p{Cc}/u,Cu=new Set(["array","export","fn","object","on","ref","server"]),Ig=new Set(["attributes","script","state","style"]);ju=new WeakSet});function Or(e){return e.toLowerCase().endsWith(".jxn")}function Pt(e){return e.endsWith(".json")||Or(e)}function Kt(e,t){return Or(t)?vr(e,t):Uc(e,t)}var Bi=v(()=>{mr();Jr()});function Kg(e){let t={comments:0,escapes:[]},n=zg.exec(e)?.[0].length??0;while(n<e.length)if(e.startsWith("//",n)){t.comments+=1;let r=e.indexOf(`
|
|
95
|
+
`,n);n=r===-1?e.length:r}else if(e.startsWith("/*",n)){t.comments+=1;let r=e.indexOf("*/",n+2);n=r===-1?e.length:r+2}else if(e.startsWith("/-",n))t.comments+=1,n+=2;else if(e.charAt(n)==="#"&&/^#+"/u.test(e.slice(n,n+16))){let[r=""]=/^#+/u.exec(e.slice(n))??[],s=n+r.length,o=e.startsWith('"""',s)?'"""':'"',i=e.indexOf(o+r,s+o.length);n=i===-1?e.length:i+o.length+r.length}else if(e.charAt(n)==='"'){let r=e.startsWith('"""',n)?'"""':'"';n+=r.length;while(n<e.length&&!e.startsWith(r,n))if(e.charAt(n)==="\\")t.escapes.push(n),n+=2;else n+=1;n+=r.length}else n+=1;return t}function Gg(e){return Kg(e).escapes.flatMap((t)=>{let n=Ug.get(e.charAt(t+1));return n?[{..._n(e,t),message:n}]:[]})}var Ug,zg;var Pu=v(()=>{Mn();Ug=new Map([["b",String.raw`\b in a quoted string is a backspace, not a word boundary. Use a raw string, like #"…"#, if this is a pattern.`],["s",String.raw`\s in a quoted string is a space, not whitespace. Use a raw string, like #"…"#, if this is a pattern.`]]),zg=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function In(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>In(s,t)).join(",")}]`;if(!A(e))return e===void 0?"null":JSON.stringify(e);return`{${(t?Object.keys(e):Object.keys(e).toSorted()).map((s)=>`${JSON.stringify(s)}:${In(e[s],t||s==="style")}`).join(",")}}`}function Yg(e,t){let n=e;for(let r of t.split("/").slice(1)){let s=r.replaceAll("~1","/").replaceAll("~0","~");if(Array.isArray(n))n=n[Number(s)];else n=A(n)?n[s]:void 0}return n}function Xg({spans:e}){let t=new Map;for(let[n,r]of e){let s=t.get(r.start);if(s===void 0||n.length<s.length)t.set(r.start,n)}return t}function _u(e,t){let n=Xg(e),r=new Map;for(let[s,o]of n)r.set(s,In(Yg(e.document,o)));return{meanings:r,pointers:n,text:t}}function wt(e){let t=Cn(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function Ys(e,t){let{end:n,start:r}=wt(e);return t.slice(r,n).trimEnd()}function Gs(e,t){let{end:n,start:r}=wt(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function Ki(e){return e.children?.nodes??[]}function qi(e){let t=e.entries.map((o)=>`${o.getName()??""}=(${o.getTag()??""})${JSON.stringify(o.getValue())}`),n=t.filter((o)=>!o.startsWith("=")).toSorted(),r=t.filter((o)=>o.startsWith("=")),s=Ki(e).map((o)=>qi(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function Ui(e,t,n){if(qi(t)===qi(n))return!0;let r=e.previous.meanings.get(wt(t).start);return r!==void 0&&r===e.next.meanings.get(wt(n).start)}function Mu(e){let n=e.entries.filter((r)=>["$id","key"].includes(r.getName()??"")).map((r)=>JSON.stringify(r.getValue()));return`(${e.getTag()??""})${e.getName()} ${n.join(" ")}`}function Du(e,t,n){let r=e.length+1,s=t.length+1,o=new Int32Array(r*s);for(let a=e.length-1;a>=0;a-=1)for(let u=t.length-1;u>=0;u-=1){let f=e[a],p=t[u];o[a*s+u]=f!==void 0&&p!==void 0&&n(f,p)?(o[(a+1)*s+u+1]??0)+1:Math.max(o[(a+1)*s+u]??0,o[a*s+u+1]??0)}let i=[],l=0,c=0;while(l<e.length&&c<t.length){let a=e[l],u=t[c];if(a!==void 0&&u!==void 0&&n(a,u))i.push([l,c]),l+=1,c+=1;else if((o[(l+1)*s+c]??0)>=(o[l*s+c+1]??0))l+=1;else c+=1}return i}function Zg(e,t,n){let r=new Map,s=new Set,o=(a,u)=>{let f=t[a];if(f)r.set(u,f),s.add(a)},i=Du(t,n,(a,u)=>Ui(e,a,u)),l=0,c=0;for(let[a,u]of[...i,[t.length,n.length]]){let f=Du(t.slice(l,a),n.slice(c,u),(p,d)=>Mu(p)===Mu(d));for(let[p,d]of f)o(l+p,c+d);if(a<t.length)o(a,u);l=a+1,c=u+1}for(let[a,u]of n.entries())if(!r.has(a)){let f=t.findIndex((p,d)=>!s.has(d)&&Ui(e,p,u));if(f!==-1)o(f,a)}return r}function Gi(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
|
|
96
|
+
`)+1)}function Qg(e,t,n){return e.split(`
|
|
57
97
|
`).map((r,s)=>s>0&&r.startsWith(t)?n+r.slice(t.length):r).join(`
|
|
58
|
-
`)}function
|
|
59
|
-
${
|
|
98
|
+
`)}function eh(e,t,n){let r=[...n],s=(i)=>{let l=i.getName(),c=r.findIndex((a)=>a.getName()===l);return c===-1?void 0:r.splice(c,1)[0]},o="";for(let i of t.entries){let l=s(i);if(l){let c=l.getTag()===i.getTag()&&l.getValue()===i.getValue();o+=c?Gs(i,e.previous.text):`${i.leading??" "}${Gs(l,e.next.text).trimStart()}`}}for(let i of r)o+=` ${Gs(i,e.next.text).trimStart()}`;return o}function th(e,t,n){let r=new Map;for(let o of Ki(t)){let i=e.previous.pointers.get(wt(o).start);if(i!==void 0)r.set(i,o)}let s=new Map;for(let o of n.entries){let i=e.next.pointers.get(wt(o).start),l=i===void 0?void 0:r.get(i);if(l&&o.getName()!==null)s.set(l,o)}return s}function nh(e,t,n){let{text:r}=e.previous,s=Gs(n,e.next.text).trimStart().slice(`${n.getName()}=`.length),[o]=t.entries;if(o?.getName()===null&&t.entries.length===1&&!t.children){if(o.getValue()===n.getValue()&&o.getTag()===n.getTag())return Ys(t,r);return`${zi(t,r)}${o.leading??" "}${s}`}return`${zi(t,r)} ${s}`}function zi(e,t){let{start:n}=wt(e),[r]=e.entries;if(r)return t.slice(n,wt(r).start-(r.leading??"").length);let s=e.children&&Cn(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return Ys(e,t)}function rh(e,t,n,r){let s=th(e,t,n),o=new Set(s.values()),i=n.entries.filter((d)=>!o.has(d)),l=`${zi(t,e.previous.text)}${eh(e,t,i)}`,c=Ki(n);if(c.length===0&&s.size===0)return l;let a=c[0]?Gi(c[0]):`${r} `,u=t.children,f=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&oh(u,e.previous.text,t)){let d=`${r}${sh(u,r)}`;return`${l}${f}{${Lu(e,u,c,d,a,s)}}`}let p=c.map((d)=>Iu(e,d,a,`${r} `));return`${l}${f}{
|
|
99
|
+
${p.join("")}${r}}`}function sh(e,t){let[n]=e.nodes,r=n?Gi(n):"";return r.startsWith(t)?r.slice(t.length):" "}function oh(e,t,n){let{end:r,start:s}=wt(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
|
|
60
100
|
`)&&t.slice(s,r).includes(`
|
|
61
|
-
`)}function
|
|
62
|
-
`}function
|
|
63
|
-
`),u=
|
|
64
|
-
`)&&!
|
|
65
|
-
`},
|
|
66
|
-
`)||
|
|
67
|
-
`))
|
|
68
|
-
`;let
|
|
69
|
-
`)?
|
|
70
|
-
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(
|
|
101
|
+
`)}function Iu(e,t,n,r){return`${r}${Qg(Ys(t,e.next.text),n,r)}
|
|
102
|
+
`}function Lu(e,t,n,r,s,o){let i=t.nodes.filter((g)=>!o.has(g)),l=Zg(e,i,n),c=t.nodes[0]?.leading??"",a=c.indexOf(`
|
|
103
|
+
`),u=a===-1?"":c.slice(0,a+1),f=u,p=-1,d=()=>{if(f!==""&&!f.endsWith(`
|
|
104
|
+
`)&&!f.endsWith(";"))f+=`
|
|
105
|
+
`},x=(g,m)=>{let b=t.nodes.indexOf(g),S=b===p+1||b>p;p=Math.max(p,b);let E=g===t.nodes[0]?c.slice(u.length):g.leading??"";if(S&&(E.includes(`
|
|
106
|
+
`)||f===u||f.endsWith(";"))){f+=`${E}${m}${g.trailing??""}`;return}if(!f.endsWith(`
|
|
107
|
+
`))f+=`
|
|
108
|
+
`;let J=(g.trailing??"").replace(/^;/u,"");f+=`${E.includes(`
|
|
109
|
+
`)?E:r}${m}${J}`},w=(g)=>{for(let[m,b]of t.nodes.entries()){let S=o.get(b);if(S&&m<g&&m>p)d(),x(b,nh(e,b,S))}};for(let[g,m]of n.entries()){let b=l.get(g);if(b){w(t.nodes.indexOf(b)),d();let S=Ui(e,b,m)?Ys(b,e.previous.text):rh(e,b,m,Gi(b));x(b,S)}else d(),f+=Iu(e,m,s,r)}return w(t.nodes.length),`${f}${t.trailing??""}`}function Xs(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=In(s.document);if(In(r.document)===o)return e;let i={next:_u(s,t),previous:_u(r,e)},l=Lu(i,Tt(e,{storeLocations:!0}),Tt(t,{storeLocations:!0}).nodes,"","",new Map);try{return In(n(l).document)===o?l:t}catch{return t}}var Zs=v(()=>{qs();K()});function Hu(e){return!/\p{Cs}/u.test(e)}function Bu(e,t){try{return Tt(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function eo(e){let t='"';for(let n of e)if(n==='"')t+=String.raw`\"`;else if(n==="\\")t+=String.raw`\\`;else if(n===`
|
|
110
|
+
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(Wu.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function qu(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function lh(e,t){if(ih.test(e))return null;let n=qu(e,'"""'),r=`${t}${we}`,s=e.split(`
|
|
71
111
|
`).map((i)=>i===""?"":r+i),o=`${n}"""
|
|
72
112
|
${s.join(`
|
|
73
113
|
`)}
|
|
74
|
-
${r}"""${n}`;return
|
|
75
|
-
`)){let r=
|
|
76
|
-
`))){let
|
|
77
|
-
`)?null:`${
|
|
78
|
-
`))break;i.push(`${
|
|
79
|
-
`)})}function
|
|
80
|
-
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function
|
|
81
|
-
`))i.push(...
|
|
82
|
-
`))t.push(...
|
|
83
|
-
`)}`);else if(i.startsWith("$"))n.push(...
|
|
114
|
+
${r}"""${n}`;return Bu(o,e)?o:null}function Qs(e,t,n){if(!Hu(e))throw new $e(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(Vu.test(e))return e;if(e.includes(`
|
|
115
|
+
`)){let r=lh(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!Wu.test(e)){let r=qu(e,'"'),s=`${r}"${e}"${r}`;if(Bu(s,e))return s}return eo(e)}function ye(e,t){if(!Hu(e))throw new $e(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return Vu.test(e)?e:eo(e)}function fe(e,t,n){if(e===null)return"#null";if(e===!0)return"#true";if(e===!1)return"#false";if(Y(e))return Object.is(e,-0)?"-0":String(e);if(y(e))return Qs(e,t,n);return Ar(e)?`(ref)${eo(e.$ref)}`:null}function Uu(e){if(!Ee(e)||e.$prototype!=="Function")return!1;let{$prototype:t,body:n,parameters:r,...s}=e,o=Object.values(s).every((a)=>fe(a,"","")!==null),i=r===void 0||Array.isArray(r)&&r.length>0&&r.every((a)=>y(a))&&n!==void 0,l=n===void 0||y(n)||Array.isArray(n),c=Array.isArray(n)&&n.length===0;return o&&i&&l&&!c}function zu(e,t,n,r){let{$prototype:s,body:o,parameters:i,...l}=t,c=[`${n}(fn)${ye(e,r)}`];for(let[a,u]of Object.entries(l))c.push(`${ye(a,r)}=${fe(u,n,re(r,a))}`);if(Array.isArray(i))for(let a of i)c.push(Qs(String(a),n,re(r,"parameters")));if(y(o))c.push(Qs(o,n,re(r,"body")));else if(Array.isArray(o))return[`${c.join(" ")} {`,...o.flatMap((a,u)=>De("-",a,n+we,re(re(r,"body"),u))),`${n}}`];return[c.join(" ")]}function ch(e){if(!Ee(e)||e.$prototype!=="Function"||e.$src!=="#client"||!y(e.$export)||Object.hasOwn(e,"body")||Object.hasOwn(e,"parameters"))return!1;return Object.values(e).every((t)=>fe(t,"","")!==null)}function uh(e,t,n,r){let{$export:s,$prototype:o,$src:i,...l}=t,c=[`${n}(export)${ye(e,r)}`];if(s!==e)c.push(`$export=${fe(s,n,re(r,"$export"))}`);for(let[a,u]of Object.entries(l))c.push(`${ye(a,r)}=${fe(u,n,re(r,a))}`);return[c.join(" ")]}function fh(e,t){if(!Ee(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>ph.has(s)))return!1;let{arguments:n}=t;if(n===void 0)return!0;let r=Ee(n)?Object.values(n):[];return r.length>0&&r.every((s)=>fe(s,"","")!==null)}function dh(e,t,n,r){let s=[`${n}(server)${ye(e,r)}`],o=re(r,"arguments"),i=Ee(t.arguments)?t.arguments:{};for(let[l,c]of Object.entries(i))s.push(`${ye(l,o)}=${fe(c,n,re(o,l))}`);return[s.join(" ")]}function De(e,t,n,r){let s=ye(e,r),o=n+s,i=fe(t,n,r);if(i!==null)return[`${o} ${i}`];if(ch(t))return uh(e,t,n,r);if(fh(e,t))return dh(e,t,n,r);if(Uu(t))return zu(e,t,n,r);if(Array.isArray(t)){if(t.length===0)return[`${n}(array)${s}`];let u=t.map((p,d)=>fe(p,n,re(r,d)));if(t.length>1&&u.every((p)=>p!==null&&!p.includes(`
|
|
116
|
+
`))){let p=`${o} ${u.join(" ")}`;if(p.length<=Yi)return[p]}return[`${o} {`,...t.flatMap((p,d)=>De("-",p,n+we,re(r,d))),`${n}}`]}let l=Ee(t)?Object.entries(t):[];if(l.length===0)return[`${o} {}`];let c=l.every(([u])=>u==="-")?`${n}(object)${s}`:o,a=l.map(([u,f])=>{let p=fe(f,n,re(r,u));return p===null||p.includes(`
|
|
117
|
+
`)?null:`${ye(u,r)}=${p}`});if(a.every((u)=>u!==null)){let u=`${c} ${a.join(" ")}`;if(u.length<=Yi)return[u]}return[`${c} {`,...l.flatMap(([u,f])=>De(u,f,n+we,re(r,u))),`${n}}`]}function Ku(e,t,n,r){let s=Object.entries(t),o=n+ye(e,r);if(s.length===0)return[`${o} {}`];let i=[],l=0;for(let[p,d]of s){let x=fe(d,n,re(r,p));if(x===null||x.includes(`
|
|
118
|
+
`))break;i.push(`${ye(p,r)}=${x}`),l+=1}let c=`${o} ${i.join(" ")}`,a=i.length>0&&c.length<=Yi,u=a?l:0,f=s.slice(u).flatMap(([p,d])=>{if(Ee(d)&&!Ar(d))return Ku(p,d,n+we,re(r,p));return De(p,d,n+we,re(r,p))});if(a&&f.length===0)return[c];return[`${a?c:o} {`,...f,`${n}}`]}function mh(e){if(!Ee(e)||e.$prototype!=="Array"||!Ee(e.map))return!1;let{$prototype:t,map:n,...r}=e;return Object.values(r).every((s)=>{let o=fe(s,"","");return o!==null&&!o.includes(`
|
|
119
|
+
`)})}function gh(e,t,n){let{$prototype:r,map:s,...o}=e,i=[`${t}$array`];for(let[l,c]of Object.entries(o))i.push(`${ye(l,n)}=${fe(c,t,re(n,l))}`);return[`${i.join(" ")} {`,...jr(s??null,t+we,re(n,"map")),`${t}}`]}function jr(e,t,n){let r=fe(e,t,n);if(r!==null)return[`${t}- ${r}`];if(mh(e))return gh(e,t,n);if(Ee(e))return Xi(e,t,n);throw new $e(`${n} is a list inside a list of children, which has no spelling`)}function hh(e,t,n){let{tagName:r}=e;if(!y(r))return`${t}$element`;if(ah.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${eo(r)}`;return t+ye(r,n)}function yh(e,t){return t!==null&&!t.includes(`
|
|
120
|
+
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function xh(e,t){let n=Ee(e)?Object.entries(e):[],r=[];for(let[s,o]of n){if(s!=="client"&&s!=="server"||!y(o))return null;let i=s==="server"?"timing=server ":"";r.push(`${t}script ${i}${Qs(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function Xi(e,t,n,r=[]){let s=[hh(e,t,n)],o=t+we,i=[...r],l={},c=null;for(let[a,u]of Object.entries(e)){let f=re(n,a);if(a==="tagName"&&y(u))continue;if(a==="children")continue;if(a==="textContent"){let p=fe(u,t,f);if(p===null||!y(e.tagName))Fu(s,i,a,u,o,t,f);else c=p}else if(a==="attributes"&&Ee(u))for(let[p,d]of Object.entries(u)){let x=fe(d,t,re(f,p));if(yh(p,x))s.push(`${ye(p,f)}=${x}`);else l[p]=d}else if(a==="state")i.push(...De("state",u,o,f));else if(a==="style"&&Ee(u))i.push(...Ku("style",u,o,f));else if(a.startsWith("on")&&Ar(u))s.push(`${ye(a,f)}=${fe(u,t,f)}`);else if(a.startsWith("on"))i.push(...Uu(u)?zu(a,u,o,f):De(a,u,o,f).map((p,d)=>d===0?p.replace(o,`${o}(on)`):p));else if(a.startsWith("$")){let p=fe(u,t,f);if(p===null||p.includes(`
|
|
121
|
+
`))i.push(...De(a,u,o,f));else s.push(`${ye(a,f)}=${p}`)}else Fu(s,i,a,u,o,t,f)}if(Object.keys(l).length>0)i.push(...De("attributes",l,o,re(n,"attributes")));if(i.push(...bh(e.children,o,re(n,"children"))),c!==null)s.push(c);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function bh(e,t,n){if(e===void 0)return[];if(Array.isArray(e)){if(e.length===0)return[`${t}(array).children`];return e.flatMap((s,o)=>jr(s,t,re(n,o)))}let r=fe(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...jr(e,t+we,n),`${t}}`]}function Fu(e,t,n,r,s,o,i){let l=ye(`.${n}`,i);if(n==="map"&&Ee(r)){t.push(`${s}${l} {`,...jr(r,s+we,i),`${s}}`);return}if(n==="cases"&&Ee(r)){t.push(`${s}${l} {`);for(let[a,u]of Object.entries(r))t.push(`${s}${we}${ye(a,i)} {`,...jr(u,s+we+we,re(i,a)),`${s}${we}}`);t.push(`${s}}`);return}let c=fe(r,o,i);if(c===null||c.includes(`
|
|
122
|
+
`))t.push(...De(`.${n}`,r,s,i));else e.push(`${l}=${c}`)}function Gu(e,t){return["$head {",...e.flatMap((n,r)=>Ee(n)&&!Ar(n)&&y(n.tagName)&&!n.$ref?Xi(n,t,`/$head/${r}`):De("-",n,t,`/$head/${r}`)),"}"]}function $h(e){let{document:t,spans:n}=Hi(e);return{document:A(t)?t:null,spans:n}}function Zi(e,t){let n=Sh(e);return t===void 0?n:Xs(t,n,$h)}function Sh(e){if(!A(e))throw new $e("A document is an object");let t=e,n=["/- kdl-version 2"],r={},s=Object.keys(t).some((i)=>!i.startsWith("$")),o=[];for(let[i,l]of Object.entries(t)){let c=i==="$script"&&s?xh(l,we):null;if(c)o=c;else if(i==="$head"&&Array.isArray(l))n.push(...Gu(l,we));else if(i==="$head")n.push(`(object)${De(i,l,"","/$head").join(`
|
|
123
|
+
`)}`);else if(i.startsWith("$"))n.push(...De(i,l,"",re("",i)));else r[i]=l}if(Object.keys(r).length>0)n.push("",...Xi(r,"","",o));return`${n.join(`
|
|
84
124
|
`)}
|
|
85
|
-
`}var ye=" ",fi=100,Nc,Tc,Am,Cm,xe=(e)=>C(e),or=(e)=>xe(e)&&b(e.$ref)&&Object.keys(e).length===1,Z=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,Pm;var gi=S(()=>{us();q();xn();er();ys();Nc=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,Tc=/[\p{Cc}\p{Zl}\p{Zp}--]/u,Am=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,Cm=new Set(["-","attributes","script","state","style"]);Pm=new Set(["$export","$src","arguments","timing"])});function Um(e,t,n){if($n(e,t)!==null)throw I(e,t,`"project" names the file's kind, and takes no annotation`);let r=De(e,t);if(r.length>1||Me(t).length>0||he(t).length>0)throw I(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)k(n,"name",r[0],e,t),ie(e,"/name",t)}function zm(e,t,n){let r=t.getName(),s=`/${ee(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=ri(e,t),ie(e,s,t);else if(qm.has(r)&&o)i=ds(e,t,s);else i=_e(e,t,s);k(n,r,i,e,t)}function Km(e){if(nn(e.text)==="document")throw new ge('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=si(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===Bm){if(r)throw I(e,s,'"project" is written twice, and a file declares one project');Um(e,s,n),r=!0}else zm(e,s,n);return rn(n)}function hi(e,t){try{return Km({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof ge?n.inFile(t):n}}var Bm="project",qm;var yi=S(()=>{q();Hn();Wn();xn();er();ys();gi();qm=new Set(["$media","style"])});var bs=S(()=>{Wn();ii();xn();Ec();er();ys();gi();yi()});function Wc(e){if(!b(e))return null;let[t,...n]=e.split(";"),r=(t??"").indexOf("/");if(r===-1)return null;let s=(t??"").slice(0,r).trim().toLowerCase(),o=(t??"").slice(r+1).trim().toLowerCase();if(!Lc.test(s)||!Lc.test(o))return null;let i=o.lastIndexOf("+"),l=i===-1?null:o.slice(i+1),a=i===-1?o:o.slice(0,i);if(l==="")return null;let c=a.indexOf("."),u=c===-1?null:a.slice(0,c),p=u!==null&&Ym.has(u)?u:null,d=p===null?a:a.slice(p.length+1);if(d==="")return null;let f={};for(let y of n){let h=y.indexOf("=");if(h===-1)return null;let m=y.slice(0,h).trim().toLowerCase(),g=y.slice(h+1).trim();if(m==="")return null;if(g.startsWith('"')&&g.endsWith('"')&&g.length>=2)g=g.slice(1,-1);f[m]=g}return{parameters:f,subtype:d,suffix:l,tree:p,type:s}}function Hc(e){if(!b(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(Wc(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function Bc(e){let t=Wc(e);if(t===null)return null;let n=t.tree===null?"":`${t.tree}.`,r=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${n}${t.subtype}${r}`}var Lc,Ym,Fc="text/markdown; variant=GFM",Vc="application/yaml",Kb;var qc=S(()=>{q();Lc=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Ym=new Set(["vnd","prs","x"]);Kb={".jxn":"text/plain; charset=utf-8",".markdown":`${Fc}; charset=utf-8`,".md":`${Fc}; charset=utf-8`,".yaml":`${Vc}; charset=utf-8`,".yml":`${Vc}; charset=utf-8`}});function Gc(e){if(e===null)throw TypeError("A class descriptor cannot be null");return C(e)?e:{}}class ir{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=Bc(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=Zm(n)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!Ae(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class Ss{#t;get#e(){return[...this.#t,ng]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let n=Hc(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of zc){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=Uc(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=Uc(e);return this.#e.some((n)=>n.extensions.includes(t))}}function Zm(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!eg(o))continue;let i={identifier:s.identifier??r,timing:s.timing??Xm};if(b(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function eg(e){return e!==void 0&&Qm.has(e)}function Uc(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var zc,Kc,Xm,Qm,tg,ng;var xi=S(()=>{q();qc();zc=["parse","serialize","rewrite","discover","load"],Kc=[...zc,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];Xm=["compiler","server"];Qm=new Set(Kc);tg={importModule:async()=>{await Promise.resolve().then(() => bs());return{JxNotation:{parse:(n)=>Qn(n),serialize:(n)=>mi(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},ng=new ir("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},tg)});class Yc{#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new Ss(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function Xc(e,t,n){let r=[];for(let s of e??[])r.push(await rg(s,t,n));return new Yc(r)}async function rg(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let a=t.resolvePath(n,e);r=t.resolvePath(`${a}/package.json`,`./${ar}`)}else try{r=t.resolvePath(n,`${e}/${ar}`)}catch(a){throw Error(`Extension "${e}" is not resolvable: it must export ${ar} (is the package installed, and does its exports map include it?): ${$i(a)}`,{cause:a})}let s;try{s=await t.loadJson(r)}catch(a){throw Error(`Extension "${e}": cannot read manifest ${r}: ${$i(a)}`,{cause:a})}if(!C(s)||!b(s.name))throw Error(`Extension "${e}": ${ar} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[a,c]of Object.entries(o.classes??{})){let u=t.resolvePath(r,c),p;try{p=await t.loadJson(u)}catch(d){throw Error(`Extension "${e}": cannot read class "${a}" at ${u}: ${$i(d)}`,{cause:d})}i.push(new ir(a,u,Gc(p),t))}let l={};if(o.schemas?.project)l.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)l.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)l.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:l}}function $i(e){return e instanceof Error?e.message:String(e)}var ar="jx-extension.json";var Zc=S(()=>{xi();q();xi()});var Qc=S(()=>{q()});function og(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function tu(e){let t=sg.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function dS(e,t){return tr(t)?hi(e,t):Dl(e,t)}var sg,eu="project.jxn",bi;var nu=S(()=>{q();Qc();Wn();ii();yi();Hn();sg=["project.jxn","project.json"];bi=class bi extends Error{constructor(e){super(og(e));this.name="ProjectFileConflictError"}}});import{accessSync as xS,closeSync as $S,constants as bS,existsSync as ig,fstatSync as SS,lstatSync as wS,openSync as ES,readFileSync as JS,statSync as vS}from"node:fs";import{dirname as jS,join as ru}from"node:path";function ag(e){return tu((t)=>ig(ru(e,t)))}function su(e){let t=ag(e);if(t==="conflict")throw new bi(e);return ru(e,t??eu)}var ou=S(()=>{nu()});import{existsSync as lg,readFileSync as cg}from"node:fs";import{dirname as Es,isAbsolute as ug,resolve as iu,sep as ws}from"node:path";import{pathToFileURL as pg}from"node:url";import{createRequire as fg}from"node:module";function au(e){let t=[e],n=`${ws}src${ws}`,r=`${ws}dist${ws}`;if(e.includes(n)){let s=e.replace(n,r);if(t.push(s),s.endsWith(".ts"))t.push(`${s.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);return t}function MS(e){let t=au(e),n=Es(e),r=[...t.filter((o)=>Es(o)===n),...t.filter((o)=>Es(o)!==n)],s=r.find((o)=>lg(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function dg(e){let t=au(e),n;for(let r of t)try{return await import(pg(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function mg(e,t){return fg(iu(e,"package.json")).resolve(t)}function gg(e){return{importModule:(t)=>dg(t),loadJson:async(t)=>JSON.parse(cg(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return iu(Es(t),n);if(ug(n))return n;return mg(e,n)}}}async function IS(e,t){return Xc(t?.extensions,gg(e),su(e))}function Js(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 Si=S(()=>{Zc();q();ou()});async function uu(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function l(a,c){let u,p;if(b(a)){let{readFileSync:_}=await import("node:fs"),{resolve:G}=await import("node:path");if(p=c?G(c,a):G(a),i.has(p))return;if(i.add(p),nr(p))u=rr(_(p,"utf8"),p);else{let{extname:N}=await import("node:path"),H=N(p).toLowerCase(),j=s?.byExtension(H,"parse");if(!j){await Promise.resolve().then(() => Si());throw Js(p,H)}u=await j.parseDocument(_(p,"utf8"))}if(u=Jn(u,p),t.projectRoot!==void 0){let{relative:N}=await import("node:path");u=po(u,N(t.projectRoot,p))}}else{if(u=Jn(a,a.tagName??"a component"),p=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}await t.prepareDocument?.(u,p);let d=u.state??{};u=ul(u,t.projectState);let{tagName:f}=u;if(!f||!f.includes("-"))throw Error(`compileElement: tagName "${f}" must contain a hyphen`);let{dirname:y}=await import("node:path"),h=p?y(p):null,m=[];if(Array.isArray(u.$elements))for(let _ of u.$elements){let G=Y(_)?_.$ref:_;if(!b(G))continue;if(h)await l(G,h);let N=n?n(G,h):G.replace(/\.(?:json|jxn)$/i,".js");m.push(N)}let g=Wr(f);if(r)u.$media={...r,...u.$media};let{resolveClass:x,rewriteSrc:w}=t,O=u.imports??{},A=wi(u,g,m,w?(_)=>w(_,h):void 0,Jr(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((_)=>!(_ in d)),x?(_)=>x(_,h,O):void 0),T=p?p.replace(/\.(?:json|jxn)$/i,".js"):`${f}.js`;o.push({content:A,path:T,tagName:f})}return await l(e,t.basePath??null),{files:o}}async function yg(e,t={}){let{title:n="Jx App",reactivitySrc:r=zt,litHtmlSrc:s=Kt}=t,o=await uu(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:l}=await import("node:path"),a=l(i.path),c=`<!DOCTYPE html>
|
|
125
|
+
`}var we=" ",Yi=100,Vu,Wu,ih,ah,Ee=(e)=>A(e),Ar=(e)=>Ee(e)&&y(e.$ref)&&Object.keys(e).length===1,re=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,ph;var Qi=v(()=>{qs();K();Mn();Jr();Zs();Vu=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,Wu=/[\p{Cc}\p{Zl}\p{Zp}--]/u,ih=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,ah=new Set(["-","attributes","script","state","style"]);ph=new Set(["$export","$src","arguments","timing"])});function vh(e,t,n){if(Dn(e,t)!==null)throw W(e,t,`"project" names the file's kind, and takes no annotation`);let r=Ve(e,t);if(r.length>1||We(t).length>0||Se(t).length>0)throw W(e,t,`"project" holds one value, the project's name, and nothing else`);if(r[0]!==void 0)L(n,"name",r[0],e,t),pe(e,"/name",t)}function Jh(e,t,n){let r=t.getName(),s=`/${oe(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=Vi(e,t),pe(e,s,t);else if(Eh.has(r)&&o)i=Ks(e,t,s);else i=Fe(e,t,s);L(n,r,i,e,t)}function Oh(e){if(Sn(e.text)==="document")throw new $e('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=Wi(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===wh){if(r)throw W(e,s,'"project" is written twice, and a file declares one project');vh(e,s,n),r=!0}else Jh(e,s,n);return wn(n)}function ea(e,t){try{return Oh({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof $e?n.inFile(t):n}}var wh="project",Eh;var ta=v(()=>{K();mr();dr();Mn();Jr();Zs();Qi();Eh=new Set(["$media","style"])});var Cr=v(()=>{dr();Bi();Mn();Pu();Jr();Zs();Qi();ta()});function Qu(e){if(!y(e))return null;let[t,...n]=e.split(";"),r=(t??"").indexOf("/");if(r===-1)return null;let s=(t??"").slice(0,r).trim().toLowerCase(),o=(t??"").slice(r+1).trim().toLowerCase();if(!Yu.test(s)||!Yu.test(o))return null;let i=o.lastIndexOf("+"),l=i===-1?null:o.slice(i+1),c=i===-1?o:o.slice(0,i);if(l==="")return null;let a=c.indexOf("."),u=a===-1?null:c.slice(0,a),f=u!==null&&Ah.has(u)?u:null,p=f===null?c:c.slice(f.length+1);if(p==="")return null;let d={};for(let x of n){let w=x.indexOf("=");if(w===-1)return null;let g=x.slice(0,w).trim().toLowerCase(),m=x.slice(w+1).trim();if(g==="")return null;if(m.startsWith('"')&&m.endsWith('"')&&m.length>=2)m=m.slice(1,-1);d[g]=m}return{parameters:d,subtype:p,suffix:l,tree:f,type:s}}function ep(e){if(!y(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(Qu(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function tp(e){let t=Qu(e);if(t===null)return null;let n=t.tree===null?"":`${t.tree}.`,r=t.suffix===null?"":`+${t.suffix}`;return`${t.type}/${n}${t.subtype}${r}`}var Yu,Ah,Xu="text/markdown; variant=GFM",Zu="application/yaml",Kw;var np=v(()=>{K();Yu=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Ah=new Set(["vnd","prs","x"]);Kw={".jxn":"text/plain; charset=utf-8",".markdown":`${Xu}; charset=utf-8`,".md":`${Xu}; charset=utf-8`,".yaml":`${Zu}; charset=utf-8`,".yml":`${Zu}; charset=utf-8`}});function ip(e){if(e===null)throw TypeError("A class descriptor cannot be null");return A(e)?e:{}}class Nr{name;classPath;classDef;extensions;mediaType;mediaTypeEssence;documentKinds;exportTarget;remote;studio;project;server;connector;capabilities;#t;#e=null;constructor(e,t,n,r){this.name=e,this.classPath=t,this.classDef=n,this.#t=r;let{format:s}=n;this.extensions=(s?.extensions??[]).map((o)=>o.toLowerCase()),this.mediaType=s?.mediaType??null,this.mediaTypeEssence=tp(this.mediaType),this.documentKinds=s?.documentKinds??[],this.exportTarget=s?.exportTarget===!0,this.remote=s?.remote===!0,this.studio=n.$studio??null,this.project=n.project??null,this.server=n.server??null,this.connector=n.connector??null,this.capabilities=Nh(n)}implementation(){if(!this.#e){let e=this.classDef.$implementation;if(!e)return Promise.reject(Error(`Format class "${this.name}" has no $implementation to import`));this.#e=this.#t.importModule(this.#t.resolvePath(this.classPath,e))}return this.#e}async implementationExport(){return this.#n(await this.implementation())}#n(e){let t=this.classDef.title??this.name;return e[t]??e.default?.[t]??e.default}async call(e,...t){let n=this.capabilities[e];if(!n)throw Error(`Format class "${this.name}" does not declare a "${e}" capability`);let r=this.#n(await this.implementation()),s=r?.[n.identifier];if(!je(s)){let i=this.classDef.title??this.name;throw TypeError(`Format class "${this.name}": implementation export "${i}" has no static "${n.identifier}" method`)}return await s.call(r,...t)}async parseDocument(e,t){return await this.call("parse",e,t)}}class to{#t;get#e(){return[...this.#t,Ph]}constructor(e){this.#t=e;for(let t of e)if(t.extensions.includes(".jxn"))throw Error(`Format "${t.name}" claims ".jxn", which is built in`);for(let t of e){if(t.mediaType===null)continue;let n=ep(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of sp){let n=new Map;for(let r of e){if(!r.capabilities[t])continue;for(let s of r.extensions){let o=n.get(s);if(o)throw Error(`Format conflict: "${o.name}" and "${r.name}" both claim "${s}" with the "${t}" capability`);n.set(s,r)}}}}get entries(){return this.#t}byExtension(e,t){let n=rp(e);return this.#e.find((r)=>r.extensions.includes(n)&&(!t||r.capabilities[t]))}byName(e){return this.#t.find((t)=>t.name===e)}withCapability(e){return this.#e.filter((t)=>t.capabilities[e])}documentExtensions(e){let t=new Set;for(let n of this.#e){if(e&&!n.documentKinds.includes(e))continue;for(let r of n.extensions)t.add(r)}return t.delete(".json"),[...t]}has(e){let t=rp(e);return this.#e.some((n)=>n.extensions.includes(t))}}function Nh(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!Th(o))continue;let i={identifier:s.identifier??r,timing:s.timing??Ch};if(y(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function Th(e){return e!==void 0&&Rh.has(e)}function rp(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var sp,op,Ch,Rh,kh,Ph;var na=v(()=>{K();np();sp=["parse","serialize","rewrite","discover","load"],op=[...sp,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];Ch=["compiler","server"];Rh=new Set(op);kh={importModule:async()=>{await Promise.resolve().then(() => Cr());return{JxNotation:{parse:(n)=>vr(n),serialize:(n)=>Zi(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},Ph=new Nr("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},kh)});class ap{#t;#e;#n;constructor(e){this.#t=e,this.#e=e.flatMap((s)=>s.classes);let t=new Map;for(let s of e)for(let o of s.classes){let i=t.get(o.name);if(i&&i!==s.specifier)throw Error(`Extension conflict: "${i}" and "${s.specifier}" both provide a class named "${o.name}"`);t.set(o.name,s.specifier)}let n=new Map;for(let s of this.#e){if(!s.project)continue;let o=n.get(s.project.key);if(o)throw Error(`Extension conflict: "${o.name}" and "${s.name}" both claim the project section "${s.project.key}"`);n.set(s.project.key,s)}let r=new Map;for(let s of this.#e){if(!s.server)continue;let{basePath:o}=s.server;if(!o.startsWith("/_jx/"))throw Error(`Extension "${s.name}": server basePath "${o}" must be under /_jx/`);let i=r.get(o);if(i)throw Error(`Extension conflict: "${i.name}" and "${s.name}" both mount "${o}"`);r.set(o,s)}this.#n=new to(this.#e.filter((s)=>s.extensions.length>0))}get extensions(){return this.#t}get classes(){return this.#e}get formats(){return this.#n}byName(e){return this.#e.find((t)=>t.name===e)}projectContributions(){return this.#e.filter((e)=>e.project!==null)}byProjectKey(e){return this.#e.find((t)=>t.project?.key===e)}byPathsDiscriminator(e){return this.#e.find((t)=>t.capabilities.resolvePaths?.discriminator===e)}emitters(){return this.#e.filter((e)=>e.capabilities.emit!==void 0)}headProviders(){return this.#e.filter((e)=>e.capabilities.head!==void 0)}assetProviders(){return this.#e.filter((e)=>e.capabilities.assets!==void 0)}serverMounts(){return this.#e.filter((e)=>e.server!==null).toSorted((e,t)=>(e.server?.order??100)-(t.server?.order??100)||e.name.localeCompare(t.name))}connectors(){return this.#e.filter((e)=>e.connector!==null)}schemaFragments(e){return this.#t.map((t)=>t.schemas[e]).filter((t)=>typeof t==="string")}}async function lp(e,t,n){let r=[];for(let s of e??[])r.push(await _h(s,t,n));return new ap(r)}async function _h(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let c=t.resolvePath(n,e);r=t.resolvePath(`${c}/package.json`,`./${Rr}`)}else try{r=t.resolvePath(n,`${e}/${Rr}`)}catch(c){throw Error(`Extension "${e}" is not resolvable: it must export ${Rr} (is the package installed, and does its exports map include it?): ${ra(c)}`,{cause:c})}let s;try{s=await t.loadJson(r)}catch(c){throw Error(`Extension "${e}": cannot read manifest ${r}: ${ra(c)}`,{cause:c})}if(!A(s)||!y(s.name))throw Error(`Extension "${e}": ${Rr} must declare a "name"`);let o=s;if(!e.startsWith(".")&&o.name!==e)throw Error(`Extension "${e}": manifest name "${o.name}" does not match the specifier`);let i=[];for(let[c,a]of Object.entries(o.classes??{})){let u=t.resolvePath(r,a),f;try{f=await t.loadJson(u)}catch(p){throw Error(`Extension "${e}": cannot read class "${c}" at ${u}: ${ra(p)}`,{cause:p})}i.push(new Nr(c,u,ip(f),t))}let l={};if(o.schemas?.project)l.project=t.resolvePath(r,o.schemas.project);if(o.schemas?.document)l.document=t.resolvePath(r,o.schemas.document);if(o.schemas?.fields)l.fields=t.resolvePath(r,o.schemas.fields);return{specifier:e,manifestPath:r,manifest:o,classes:i,schemas:l}}function ra(e){return e instanceof Error?e.message:String(e)}var Rr="jx-extension.json";var cp=v(()=>{na();K();na()});var up=v(()=>{K()});function Dh(e){return`${e} holds both project.jxn and project.json, and a project has one. Keep the one you edit and delete the other`}function fp(e){let t=Mh.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function dE(e,t){return Or(t)?ea(e,t):zc(e,t)}var Mh,pp="project.jxn",sa;var dp=v(()=>{K();up();dr();Bi();ta();mr();Mh=["project.jxn","project.json"];sa=class sa extends Error{constructor(e){super(Dh(e));this.name="ProjectFileConflictError"}}});import{accessSync as xE,closeSync as bE,constants as $E,existsSync as Ih,fstatSync as SE,lstatSync as wE,openSync as EE,readFileSync as vE,statSync as JE}from"node:fs";import{dirname as jE,join as mp}from"node:path";function Lh(e){return fp((t)=>Ih(mp(e,t)))}function gp(e){let t=Lh(e);if(t==="conflict")throw new sa(e);return mp(e,t??pp)}var hp=v(()=>{dp()});import{existsSync as Fh,readFileSync as Vh}from"node:fs";import{dirname as ro,isAbsolute as Wh,resolve as yp,sep as no}from"node:path";import{pathToFileURL as Hh}from"node:url";import{createRequire as Bh}from"node:module";function xp(e){let t=[e],n=`${no}src${no}`,r=`${no}dist${no}`;if(e.includes(n)){let s=e.replace(n,r);if(t.push(s),s.endsWith(".ts"))t.push(`${s.slice(0,-3)}.js`)}if(e.endsWith(".js"))t.push(`${e.slice(0,-3)}.ts`);return t}function DE(e){let t=xp(e),n=ro(e),r=[...t.filter((o)=>ro(o)===n),...t.filter((o)=>ro(o)!==n)],s=r.find((o)=>Fh(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function qh(e){let t=xp(e),n;for(let r of t)try{return await import(Hh(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function Uh(e,t){return Bh(yp(e,"package.json")).resolve(t)}function zh(e){return{importModule:(t)=>qh(t),loadJson:async(t)=>JSON.parse(Vh(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return yp(ro(t),n);if(Wh(n))return n;return Uh(e,n)}}}async function IE(e,t){return lp(t?.extensions,zh(e),gp(e))}function so(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 oa=v(()=>{cp();K();hp()});function Gh(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function co(e,t={}){let{resolveElementPath:n,$media:r,formats:s}=t,o=[],i=new Set;async function l(c,a){let u,f;if(y(c)){let{readFileSync:k}=await import("node:fs"),{resolve:P}=await import("node:path");if(f=a?P(a,c):P(c),i.has(f))return;if(i.add(f),Pt(f))u=Kt(k(f,"utf8"),f);else{let{extname:R}=await import("node:path"),H=R(f).toLowerCase(),O=s?.byExtension(H,"parse");if(!O){await Promise.resolve().then(() => oa());throw so(f,H)}u=await O.parseDocument(k(f,"utf8"))}if(u=Fn(u,f),t.projectRoot!==void 0){let{relative:R}=await import("node:path");u=Yo(u,R(t.projectRoot,f))}}else{if(u=Fn(c,c.tagName??"a component"),f=null,u.tagName&&i.has(u.tagName))return;if(u.tagName)i.add(u.tagName)}await t.prepareDocument?.(u,f);let p=u.state??{};u=pc(u,t.projectState);let{tagName:d}=u;if(!d||!d.includes("-"))throw Error(`compileElement: tagName "${d}" must contain a hyphen`);let{dirname:x}=await import("node:path"),w=f?x(f):null,g=[];if(Array.isArray(u.$elements))for(let k of u.$elements){let P=_(k)?k.$ref:k;if(!y(P))continue;if(w)await l(P,w);let R=n?n(P,w):P.replace(/\.(?:json|jxn)$/i,".js");g.push(R)}let m=$n(d);if(r)u.$media={...r,...u.$media};let{resolveClass:b,rewriteSrc:S}=t,E=u.imports??{},J=ia(u,m,g,S?(k)=>S(k,w):void 0,ft(u,t.defaults),t.serverBaseUrl,Object.keys(u.state??{}).filter((k)=>!(k in p)),b?(k)=>b(k,w,E):void 0,t.stylesheetHref?.(d)??null),M=f?f.replace(/\.(?:json|jxn)$/i,".js"):`${d}.js`;o.push({content:J,path:M,tagName:d})}return await l(e,t.basePath??null),{files:o}}async function Yh(e,t={}){let{title:n="Jx App",reactivitySrc:r=un,litHtmlSrc:s=vt}=t,o=await co(e,t),i=o.files.at(-1);if(!i)throw Error("compileElementPage: no element modules were produced");let{basename:l}=await import("node:path"),c=l(i.path),a=`<!DOCTYPE html>
|
|
86
126
|
<html lang="en">
|
|
87
127
|
<head>
|
|
88
128
|
<meta charset="utf-8">
|
|
89
129
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
90
|
-
<title>${
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
"imports": {
|
|
94
|
-
"@vue/reactivity": "${r}",
|
|
95
|
-
"lit-html": "${s}"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
</script>
|
|
130
|
+
<title>${G(n)}</title>
|
|
131
|
+
${pn({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
99
132
|
</head>
|
|
100
133
|
<body>
|
|
101
134
|
<${i.tagName}></${i.tagName}>
|
|
102
|
-
<script type="module" src="./${
|
|
135
|
+
<script type="module" src="./${c}"></script>
|
|
103
136
|
</body>
|
|
104
|
-
</html>`;return{files:o.files,html:c}}function xg(e){if(!E(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(ft(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(Zt(e))return"null";if(nt(e))return"null";return JSON.stringify(e)}function wi(e,t,n,r,s=null,o="/_jx/server",i=[],l){let a=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)a.push(`// Source: ${e.$id}`);for(let v of n)a.push(`import '${v}';`);let c=e.state??{},u=At(e),p=Rr(Tr(c,u),r);a.push(...p.imports);let d=Lr(c,l),f=d.entries.length>0;a.push(...d.imports);let y=Object.entries(c).flatMap(([v,J])=>tt(J)&&J.$prototype==="Request"?[[v,J]]:[]),h=Object.entries(c).flatMap(([v,J])=>nt(J)?[[v,J]]:[]);a.push("import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",_r());let m=Object.keys(c).filter((v)=>!Rs(v)),g=m.filter((v)=>!hg.has(v)),x=g.filter((v)=>i.includes(v)),w=x.length>0;if(a.push(`const __jxProps = ${JSON.stringify(m)};`),g.length>0)a.push(`const __jxBridged = ${JSON.stringify(g)};`,ml());if(w)a.push(`const __jxInherited = new Set(${JSON.stringify(x)});`);let O=Ln(e);if(O.length>0)a.push(gl(),`const __jxObserved = ${JSON.stringify(O)};`,`const __jxObservedDefaults = () => ${yl(e)};`);if(h.length>0)a.push(Mr());if(f)a.push(Ir());let A=s===null&&Ut(e.children);if(A)a.push(bl());a.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...s===null?[]:[" #root = null;"],...f?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...O.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[]," constructor() {"," super();");let T=[],_=[],G=[],N=[],H=[];for(let[v,J]of Object.entries(c))if(Ce(J))if(et(J))N.push([v,J]);else if(Ge(J.$expression.operator))G.push([v,J]);else _.push([v,J]);else if(ue(J))(u.get(v)==="computed"?_:G).push([v,J]);else if(b(J)&&J.includes("${"))H.push([v,J]);else{let se=xg(J);if(se!==void 0)T.push([v,se])}a.push(" this.state = reactive({");for(let[v,J]of T)a.push(` ${st(v)}: ${J},`);a.push(" });");for(let[v,J]of G)if(a.push(""),Ce(J)){let se=Je(J.$expression,{eventParam:"e",statePrefix:"s"});a.push(` ${W("this.state",Se(v))} = (s, e) => { ${se}; };`)}else if(Be(J)){let se=ke(J.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});a.push(` ${W("this.state",Se(v))} = (s, e) => {`,se," };")}else{let se=W("this.state",Se(v));if(J.$src)a.push(` ${se} = ${v};`);else{let Ns=b(J.body)?J.body:"";a.push(` ${se} = (${Ue(J).join(", ")}) => {`,` ${Ns}`," };")}}for(let[v,J]of N){a.push("");let se=Je(J.$expression,{eventParam:"e",statePrefix:"this.state"});a.push(` ${W("this.state",Se(v))} = ${Mn(J,se)};`)}for(let[v,J]of H)a.push("",` ${W("this.state",Se(v))} = computed(() => ${Pr(Yt(J,"this.state",{code:!1}))});`);for(let[v,J]of _)if(a.push(""),Ce(J)){let se=Je(J.$expression,{eventParam:"e",statePrefix:"this.state"});a.push(` ${W("this.state",Se(v))} = computed(() => ${se});`)}else if(J.$src)a.push(` ${W("this.state",Se(v))} = computed(() => ${v}(this.state));`);else{a.push(` ${W("this.state",Se(v))} = computed(() => {`);let se=Yt(b(J.body)?J.body:"","this.state");a.push(` ${se}`," });")}a.push(" }","");let j={n:0};for(let v of Vr(e))El(v,j,e.tagName??"jx");let R=pu(),$e=!Array.isArray(e.children)&&e.textContent!==void 0?` ${As(e.textContent)}`:js(e.children,e.style," ",!1,!1,R);if(a.push(" template() {"," const s = this.state;",...R.decls," return html`",$e," `;"," }","",...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 _first = !this.#rendered;"," this.#rendered = true;",...w?[" const _given = new Set();"]:[],...O.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${Dr}(this.state, _a, this.getAttribute(_a), _d);`," }"," }"]:[]," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;",w?" if (__jxProps.includes(k)) { this.state[k] = v; _given.add(k); }":" if (__jxProps.includes(k)) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (__jxProps.includes(_k)) {"," this.state[_k] = this.getAttribute(_n);",...w?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),g.length>0)a.push(" if (_first) {"," for (const _k of __jxBridged) {",` if (_k in this && this[_k] !== undefined && ${Oo}(this, _k)) {`," this.state[_k] = this[_k];",...w?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...w?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],` const _set = ${jo}(this, _k);`," Object.defineProperty(this, _k, {"," configurable: true,"," get: () => this.state[_k],"," set: (v) => { if (_set) _set.call(this, v); this.state[_k] = v; },"," });"," }"," }");if(f)a.push(` this.#jxReady ??= ${Fr(d.entries,{indent:" ",instances:"this.#jxInstances",statePrefix:"this.state"})};`," const _c = ++this.#jxConnection;"," this.#jxReady.then(() => {"," if (_c === this.#jxConnection && this.isConnected) this.#jxRender();"," });"," }",""," #jxRender() {"," const _first = !this.#jxDrawn;"," this.#jxDrawn = true;");for(let[v,J]of y)a.push(Ar(v,J,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[v,J]of h)a.push(Cr(v,J,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(E(e.style)){let v=[];for(let[J,se]of Object.entries(e.style)){if(J.startsWith(":")||J.startsWith(".")||J.startsWith("&")||J.startsWith("[")||J.startsWith("@"))continue;if(b(se)&&se.includes("${"))v.push([Oe(J),se])}if(v.length>0){a.push(" this.#effects.push(effect(() => {");for(let[J,se]of v){let Ns=se.replaceAll(/\$\{([^}]+)\}/g,(Wg,Nu)=>`\${${Yt(Nu,"this.state")}}`);a.push(` this.style['${J}'] = \`${Ns}\`;`)}a.push(" }));")}}if(A)a.push(` const _slotted = _first ? ${Ao}(this) : null;`);if(a.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)a.push(" if (_first) this.replaceChildren();"," this.#effects.push(effect(() => render(this.template(), this)));");else a.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }"," this.#effects.push(effect(() => render(this.template(), _root)));");if(A)a.push(` if (_first) ${Co}(this, _slotted);`);if(a.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {"," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }"),"onAdopted"in c)a.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(O.length>0)a.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${Dr}(this.state, name, newVal, __jxObservedDefaults());`," }");return a.push("}","",`customElements.define('${e.tagName}', ${t});`,""),a.join(`
|
|
105
|
-
`)}function
|
|
137
|
+
</html>`;return{files:o.files,html:a}}function Xh(e){if(!j(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(Et(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(hn(e))return"null";if(ut(e))return"null";return JSON.stringify(e)}function ia(e,t,n,r,s=null,o="/_jx/server",i=[],l,c=null){let a=["// Generated by @jxsuite/compiler — do not edit manually"];if(e.$id)a.push(`// Source: ${e.$id}`);for(let N of n)a.push(`import '${N}';`);let u=e.state??{},f=nt(e),p=cs(ls(u,f),r);a.push(...p.imports);let d=Ss(u,l),x=d.entries.length>0;a.push(...d.imports);let w=Object.entries(u).flatMap(([N,C])=>ct(C)&&C.$prototype==="Request"?[[N,C]]:[]),g=Object.entries(u).flatMap(([N,C])=>ut(C)?[[N,C]]:[]),m=ds(e);if(a.push(m.keyed?"import { reactive, computed, effect, stop, shallowRef } from '@vue/reactivity';":"import { reactive, computed, effect, stop } from '@vue/reactivity';","import { render, html, nothing } from 'lit-html';",...m.keyed?hs:[],fs()),m.arranged||m.keyed)a.push(gs());if(m.keyed)a.push(ys());let b=Object.keys(u).filter((N)=>!Xt(N)),S=b.filter((N)=>!Kh.has(N)),E=S.filter((N)=>i.includes(N)),J=E.length>0;a.push(`const __jxProps = ${JSON.stringify(b)};`);let M=Zo(e),k=S.filter((N)=>M.has(N));if(S.length>0)a.push(`const __jxBridged = ${JSON.stringify(S)};`,$c());if(k.length>0)a.push(`const __jxDerived = new Set(${JSON.stringify(k)});`);if(J)a.push(`const __jxInherited = new Set(${JSON.stringify(E)});`);let P=cr(e);if(P.length>0)a.push(Sc(),`const __jxObserved = ${JSON.stringify(P)};`,`const __jxObservedDefaults = () => ${Ec(e)};`);if(g.length>0)a.push(bs());if(x)a.push($s());let R=s===null&&cn(e.children);if(R)a.push(jc());let H=e.formAssociated===!0;if(H)a.push(Oc());a.push(...p.loaders,"",`class ${t} extends HTMLElement {`," #effects = [];"," #rendered = false;",...m.keyed?[" #part = null;"]:[],...s===null?[]:[" #root = null;"],...H?[" #internals;"," #form = null;"]:[],...x?[" #jxInstances = new Map();"," #jxReady = null;"," #jxConnection = 0;"," #jxDrawn = false;"]:[],"",...P.length>0?[" static get observedAttributes() { return __jxObserved; }",""]:[],...H?[" static formAssociated = true;",""," #attach() {"," if (this.#internals === undefined) {"," this.#internals = typeof this.attachInternals === 'function' ? this.attachInternals() : null;"," }"," return this.#internals;"," }",""]:[]," constructor() {"," super();");let O=[],T=[],de=[],He=[],Pr=[];for(let[N,C]of Object.entries(u))if(Ne(C))if(Qe(C))He.push([N,C]);else if(ze(C.$expression.operator))de.push([N,C]);else T.push([N,C]);else if(me(C))(f.get(N)==="computed"?T:de).push([N,C]);else if(y(C)&&C.includes("${"))Pr.push([N,C]);else{let ie=Xh(C);if(ie!==void 0)O.push([N,ie])}a.push(" this.state = reactive({");for(let[N,C]of O)a.push(` ${dt(N)}: ${C},`);a.push(" });");for(let[N,C]of de)if(a.push(""),Ne(C)){let ie=Te(C.$expression,{eventParam:"e",statePrefix:"s"});a.push(` ${U("this.state",xe(N))} = (s, e) => { ${ie}; };`)}else if(et(C)){let ie=Le(C.body,{dispatchTarget:"this",eventParam:"e",indent:" ",statePrefix:"this.state"});a.push(` ${U("this.state",xe(N))} = (s, e) => {`,ie," };")}else{let ie=U("this.state",xe(N));if(C.$src)a.push(` ${ie} = ${N};`);else{let Gt=y(C.body)?C.body:"";a.push(` ${ie} = (${tt(C).join(", ")}) => {`,` ${Gt}`," };")}}for(let[N,C]of He){a.push("");let ie=Te(C.$expression,{eventParam:"e",statePrefix:"this.state"});a.push(` ${U("this.state",xe(N))} = ${nr(C,ie)};`)}for(let[N,C]of Pr){let ie=mn(C,"this.state",{code:!1}),Gt=us(ie);a.push("",lo(ie)?` ${U("this.state",xe(N))} = computed(() => { const state = this.state; return ${Gt}; });`:` ${U("this.state",xe(N))} = computed(() => ${Gt});`)}for(let[N,C]of T)if(a.push(""),Ne(C)){let ie=Te(C.$expression,{eventParam:"e",statePrefix:"this.state"});a.push(` ${U("this.state",xe(N))} = computed(() => ${ie});`)}else if(C.$src)a.push(` ${U("this.state",xe(N))} = computed(() => ${N}(this.state));`);else{a.push(` ${U("this.state",xe(N))} = computed(() => {`);let ie=mn(y(C.body)?C.body:"","this.state");a.push(` ${ie}`," });")}let ya=Zh(e);if(ya.length>0){a.push(""," {"," const s = this.state;");for(let{type:N,source:C}of ya)a.push(` this.addEventListener(${JSON.stringify(N)}, ${C});`);a.push(" }")}a.push(" }","");let Kp={n:0};for(let N of Es(e))Nc(N,Kp,e.tagName??"jx");let fo=Sp(),xa=!Array.isArray(e.children)&&e.textContent!==void 0?` ${uo(e.textContent)}`:io(e.children,e.style," ",!1,!1,fo),Gp=[xa,...fo.decls].some((N)=>lo(N));if(a.push(" template() {"," const s = this.state;",...Gp?[" const state = s;"]:[],...fo.decls," return html`",xa," `;"," }","",...s===null?[]:[" #renderRoot() {"," if (this.#root) return this.#root;",s==="closed"?H?" const _a = this.#attach()?.shadowRoot ?? null;":" const _a = this.attachInternals().shadowRoot;":" const _a = this.shadowRoot;",` this.#root = _a ?? this.attachShadow({ mode: '${s}' });`,...c===null?[]:[` if (!_a) this.#root.append(Object.assign(document.createElement('link'), { rel: 'stylesheet', href: ${Gh(c)} }));`]," return this.#root;"," }",""]," connectedCallback() {"," const _first = !this.#rendered;"," this.#rendered = true;",...m.keyed?[" this.#part?.setConnected(true);"]:[],...J?[" const _given = new Set();"]:[],...P.length>0?[" if (_first) {"," const _d = __jxObservedDefaults();"," for (const _a of __jxObserved) {",` if (this.hasAttribute(_a)) ${xs}(this.state, _a, this.getAttribute(_a), _d);`," }"," }"]:[]," const _pa = this.getAttribute('data-jx-props');"," if (_pa) {"," try {"," const _p = JSON.parse(_pa);"," for (const [k, v] of Object.entries(_p)) {"," if (k.startsWith('#')) continue;",J?" if (__jxProps.includes(k)) { this.state[k] = v; _given.add(k); }":" if (__jxProps.includes(k)) this.state[k] = v;"," }"," } catch {}"," this.removeAttribute('data-jx-props');"," }"," const _pn = this.getAttributeNames().filter(n => n.startsWith('props.') && n.length > 6);"," for (const _n of _pn) {"," const _k = _n.slice(6);"," if (_k.startsWith('#')) { this.removeAttribute(_n); continue; }"," if (__jxProps.includes(_k)) {"," this.state[_k] = this.getAttribute(_n);",...J?[" _given.add(_k);"]:[]," this.removeAttribute(_n);"," }"," }"),S.length>0)a.push(" if (_first) {"," for (const _k of __jxBridged) {",...k.length>0?[" if (__jxDerived.has(_k)) continue;"]:[],` if (_k in this && this[_k] !== undefined && ${pi}(this, _k)) {`," this.state[_k] = this[_k];",...J?[" _given.add(_k);"]:[]," }"," }"," for (const _k of __jxBridged) {",...J?[" if (__jxInherited.has(_k) && !_given.has(_k)) continue;"]:[],...k.length>0?[" if (__jxDerived.has(_k)) {"," Object.defineProperty(this, _k, { configurable: true, get: () => this.state[_k] });"," continue;"," }"]:[],` const _set = ${fi}(this, _k);`," Object.defineProperty(this, _k, {"," configurable: true,"," get: () => this.state[_k],"," set: (v) => { if (_set) _set.call(this, v); this.state[_k] = v; },"," });"," }"," }");if(x)a.push(` this.#jxReady ??= ${ws(d.entries,{indent:" ",instances:"this.#jxInstances",statePrefix:"this.state"})};`," const _c = ++this.#jxConnection;"," this.#jxReady.then(() => {"," if (_c === this.#jxConnection && this.isConnected) this.#jxRender();"," });"," }",""," #jxRender() {"," const _first = !this.#jxDrawn;"," this.#jxDrawn = true;");for(let[N,C]of w)a.push(os(N,C,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[N,C]of g)a.push(is(N,C,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(a.push(...Qh(e)),j(e.style)){let N=[];for(let[C,ie]of Object.entries(e.style)){if(C.startsWith(":")||C.startsWith(".")||C.startsWith("&")||C.startsWith("[")||C.startsWith("@"))continue;if(y(ie)&&ie.includes("${"))N.push([Re(C),ie])}if(N.length>0){a.push(" this.#effects.push(effect(() => {");for(let[C,ie]of N){let Gt=ie.replaceAll(/\$\{([^}]+)\}/g,(Dy,Yp)=>`\${${mn(Yp,"this.state")}}`);a.push(` this.style['${C}'] = \`${Gt}\`;`)}a.push(" }));")}}if(R)a.push(` const _slotted = _first ? ${mi}(this) : null;`);if(a.push(" if (this.hasAttribute('data-jx-prerendered')) {"," this.removeAttribute('data-jx-prerendered');"," }"),s===null)a.push(" if (_first) this.replaceChildren();",m.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), this); }));":" this.#effects.push(effect(() => render(this.template(), this)));");else a.push(" const _root = this.#renderRoot();"," if (_first) {"," for (const _n of [..._root.childNodes]) {"," if (!(_n.nodeType === 1 && _n.tagName === 'LINK')) _n.remove();"," }"," }",m.keyed?" this.#effects.push(effect(() => { this.#part = render(this.template(), _root); }));":" this.#effects.push(effect(() => render(this.template(), _root)));");if(R)a.push(` if (_first) ${gi}(this, _slotted);`);if(H)a.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${di}(this, _i, this.state, ${JSON.stringify(Jl(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${ey(e.formValue)}, (fn) => { this.#effects.push(effect(fn)); });`," }"," }"," if (this.#form) this.#form.start();");if(a.push(" if (_first && typeof this.state.onMount === 'function') {"," queueMicrotask(() => this.state.onMount.call(this, this.state, this));"," }"," }",""," disconnectedCallback() {",...m.keyed?[" this.#part?.setConnected(false);"]:[]," for (const _e of this.#effects) { stop(_e); }"," this.#effects.length = 0;"," if (typeof this.state.onUnmount === 'function') { this.state.onUnmount(this.state); }"," }"),"onAdopted"in u)a.push(""," adoptedCallback() {"," if (typeof this.state.onAdopted === 'function') { this.state.onAdopted(this.state); }"," }");if(H)a.push(""," formResetCallback() { if (this.#form) this.#form.reset(); }",""," formDisabledCallback(disabled) { if (this.#form) this.#form.disabled(disabled); }");if(P.length>0)a.push(""," attributeChangedCallback(name, oldVal, newVal) {"," if (oldVal === newVal) return;",` ${xs}(this.state, name, newVal, __jxObservedDefaults());`," }");return a.push("}","",`customElements.define('${e.tagName}', ${t});`,""),a.join(`
|
|
138
|
+
`)}function Sp(){return{byText:new Map,decls:[]}}function wp(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
|
|
106
139
|
${t}
|
|
107
|
-
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function
|
|
108
|
-
`)}function
|
|
140
|
+
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function io(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let l=i?yn:"";if(Q(e))return`${$p(e,n)}${l}`;if(!Array.isArray(e))return"";return e.map((c)=>{if(Q(c))return`${$p(c,n)}${l}`;let a=aa(c,r?"":n,r,s,o);return y(c)&&c.includes("${")||j(c)&&qe(c.tagName)?`${a}${l}`:a}).join(r?"":`
|
|
141
|
+
`)}function aa(e,t,n=!1,r=!1,s=null,o=null){if(y(e)){if(e.includes("${"))return`${t}${uo(e)}`;return`${t}${G(e)}`}if(Y(e)||le(e))return`${t}${G(String(e))}`;if(!j(e))return"";if(qe(e.tagName)){let g=e.tagName.$expression,m=mt(g.target,{eventParam:"e",statePrefix:"s"}),b=g.operator==="?:"?[[!0,g.value],[!1,g.initial]]:[...Object.entries(g.cases),["__default__",g.default]],S=b.map(([,R])=>R),E=S.map((R)=>n||yt.has(R)),J=null;if(s&&E.every((R)=>R===E[0])){let R=bp(e,`${t} `,E[0]===!0,r,s,S.some((H)=>H.includes("-")));if(R.trim()!=="")J=wp(s,R)}let M=b.map(([R,H])=>{let O={...e,tagName:H};return[R,aa(O,`${t} `,n,r,s,J)]});if(g.operator==="?:"){let[,R]=M[0],[,H]=M[1];return`${t}\${${m}
|
|
109
142
|
? html\`
|
|
110
|
-
${
|
|
143
|
+
${R}
|
|
111
144
|
\`
|
|
112
145
|
: html\`
|
|
113
146
|
${H}
|
|
114
|
-
\`}`}let
|
|
147
|
+
\`}`}let k=M.flatMap(([R,H])=>R==="__default__"?[]:[` ${JSON.stringify(R)}: html\`
|
|
115
148
|
${H}
|
|
116
|
-
\``]),[,
|
|
117
|
-
${
|
|
149
|
+
\``]),[,P]=M.at(-1);return`${t}\${{
|
|
150
|
+
${k.join(`,
|
|
118
151
|
`)}
|
|
119
|
-
}[String(${
|
|
120
|
-
${
|
|
121
|
-
\`}`}let i=e.tagName??"div",l=n||yt.has(i),
|
|
122
|
-
${t} ${
|
|
123
|
-
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${
|
|
124
|
-
${t}>`;let
|
|
125
|
-
${t}>${
|
|
126
|
-
${
|
|
127
|
-
${
|
|
152
|
+
}[String(${m})] ?? html\`
|
|
153
|
+
${P}
|
|
154
|
+
\`}`}let i=e.tagName??"div",l=n||yt.has(i),c=[],a=Ep(e,Oe,Pe);if(e.attributes)for(let[g,m]of Object.entries(e.attributes)){if(g==="class"&&a!==null)continue;if(_(m))c.push(`${g}="\${${It}('${g}', ${Pe(m.$ref)}) ?? nothing}"`);else if(y(m)&&la(m))c.push(`${g}="\${${It}('${g}', ${Oe(m).slice(2,-1)}) ?? nothing}"`);else if(y(m)&&m.includes("${"))c.push(`${g}="${Oe(m)}"`);else if(le(m)){let b=st(g,m);if(b!==null)c.push(b===""?g:`${g}="${b}"`)}else c.push(`${g}="${m}"`)}if(e.id)c.push(`id="${Oe(String(e.id))}"`);if(a!==null)c.push(a);for(let[g,m]of Object.entries(e)){if(Ke.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(ao(m))c.push(`.${g}="\${${Pe(m.$ref)}}"`);else if(y(m)&&m.includes("${"))c.push(`.${g}="${Oe(m)}"`);else c.push(`.${g}="\${${JSON.stringify(m)}}"`)}if(e.$props)for(let[g,m]of Object.entries(e.$props))if(ao(m))c.push(`.${g}="\${${Pe(m.$ref)}}"`);else if(y(m)&&m.includes("${"))c.push(`.${g}="${Oe(m)}"`);else c.push(`.${g}="\${${JSON.stringify(m)}}"`);let u=r?"s.$map = $map; ":"";for(let[g,m]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ht(`inline "${g}" handler`,m);let b=g.slice(2).toLowerCase(),S=ca(m,u);if(S!==null)c.push(`@${b}="\${${S}}"`)}let f=Jp(e.style);if(f)c.push(`style="${f}"`);let p=c.length>0?`
|
|
155
|
+
${t} ${c.join(`
|
|
156
|
+
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${p}
|
|
157
|
+
${t}>`;let x=o??bp(e,t,l,r,s,i.includes("-")),w=i==="slot"?yn:"";return l?`${w}<${i}${p}>${x}${w}</${i}>`:`${t}${w}<${i}${p}
|
|
158
|
+
${t}>${x}${w}</${i}>`}function bp(e,t,n,r,s,o=!1){if(e.$switch){let i=_(e.$switch)?e.$switch.$ref:e.$switch,l=Pe(i),c=[];for(let[p,d]of Object.entries(e.cases??{})){if(!d||_(d))continue;c.push([p,aa(d,`${t} `,!1,r,s)])}let a=c.map(([,p])=>p),u=new Set(a.filter((p,d)=>a.indexOf(p)!==d&&p.trim()!==""));return`\${{
|
|
159
|
+
${c.map(([p,d])=>{let x=s&&u.has(d)?wp(s,d):d;return` ${JSON.stringify(p)}: html\`
|
|
160
|
+
${x}
|
|
128
161
|
\``}).join(`,
|
|
129
162
|
`)}
|
|
130
|
-
}[${l}]}`}if(e.textContent!==void 0){let i=
|
|
131
|
-
${
|
|
132
|
-
${t}`;return""}function
|
|
133
|
-
${t} ${
|
|
134
|
-
${t} `)}`:"",
|
|
135
|
-
${
|
|
136
|
-
${t} `;let
|
|
137
|
-
${t} <${
|
|
138
|
-
${t} >${
|
|
139
|
-
${t}\``,
|
|
140
|
-
})(s, e);`;return`${
|
|
141
|
-
`}function
|
|
142
|
-
`:"",
|
|
163
|
+
}[${l}]}`}if(e.textContent!==void 0){let i=uo(e.textContent),l=_(e.textContent)||y(e.textContent)&&e.textContent.includes("${");return o&&l?`${i}${yn}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?io(e.children,e.style,"",!0,r,s,o):`
|
|
164
|
+
${io(e.children,e.style,`${t} `,!1,r,s,o)}
|
|
165
|
+
${t}`;return""}function $p(e,t){ir(e);let n=_(e.key),r=JSON.stringify(Array.isArray(e.items)?e.items:[]),s=n?`${ar}(${JSON.stringify(r)})`:r;if(_(e.items))s=`(${Pe(e.items.$ref)} ?? [])`;let o=_(e.filter)?Pe(e.filter.$ref):"undefined",i=_(e.sort)?Pe(e.sort.$ref):"undefined",l=_(e.filter)||_(e.sort),c=e.map;if(!c)return"";let a=c.tagName??"div",u=[],f=Ep(c,Oe,oo);if(c.attributes)for(let[E,J]of Object.entries(c.attributes)){if(E==="class"&&f!==null)continue;if(_(J))u.push(`${E}="\${${oo(J.$ref)}}"`);else if(y(J)&&J.includes("${"))u.push(`${E}="${Oe(J)}"`);else u.push(`${E}="${J}"`)}if(c.id)u.push(`id="${Oe(String(c.id))}"`);if(f!==null)u.push(f);for(let[E,J]of Object.entries(c)){if(Ke.has(E)||E.startsWith("$")||E.startsWith("on")||E==="tagName"||E==="id"||E==="className"||E==="style"||E==="children"||E==="textContent"||E==="innerHTML"||E==="attributes")continue;if(ao(J))u.push(`.${E}="\${${oo(J.$ref)}}"`);else if(y(J)&&J.includes("${"))u.push(`.${E}="${Oe(J)}"`);else u.push(`.${E}="\${${JSON.stringify(J)}}"`)}if(c.$props)for(let[E,J]of Object.entries(c.$props))if(_(J))u.push(`.${E}="\${${oo(J.$ref)}}"`);else if(y(J)&&J.includes("${"))u.push(`.${E}="${Oe(J)}"`);else u.push(`.${E}="\${${JSON.stringify(J)}}"`);let p=Jp(c.style);if(p)u.push(`style="${p}"`);for(let[E,J]of Object.entries(c)){if(!E.startsWith("on"))continue;ht(`inline "${E}" handler`,J);let M=E.slice(2).toLowerCase(),k=ca(J,"s.$map = $map; ");if(k!==null)u.push(`@${M}="\${${k}}"`)}let d=u.length>0?`
|
|
166
|
+
${t} ${u.join(`
|
|
167
|
+
${t} `)}`:"",x=Sp(),w="";if(c.textContent!==void 0)w=uo(c.textContent);else if(c.children)w=`
|
|
168
|
+
${io(c.children,null,`${t} `,!1,!0,x)}
|
|
169
|
+
${t} `;let g=`html\`
|
|
170
|
+
${t} <${a}${d}
|
|
171
|
+
${t} >${w}</${a}>
|
|
172
|
+
${t}\``,m=(g.includes("$map")?"const $map = { item, index }; ":"")+x.decls.map((E)=>`${E.trim()} `).join(""),b=m?`(item, index) => { ${m}return ${g}; }`:`(item, index) => ${g}`;if(_(e.key)){let E=e.key.$ref,J=[s,o,i,JSON.stringify(ms(E)),JSON.stringify(E),b];return`${t}\${${lr}(${J.join(", ")})}`}let S=l?`${gn}(${s}, ${o}, ${i})`:s;return`${t}\${${S}.map(${b})}`}function Ep(e,t,n){if(!ur(e))return null;let r=pr(e),s="";if(_(r))s=`\${${n(r.$ref)} ?? ""}`;else if(y(r))s=t(r);else if(Y(r))s=String(r);let o=Jt(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function ao(e){return _(e)&&e.$ref!==""}function Pe(e){let t=Ce(e);if(t.startsWith("#/state/"))return U("s",t.slice(8));if(t.startsWith("$map/"))return vp(t.slice(5));if(t.startsWith("parent#/"))return U("s",t.slice(8));if(t.startsWith("window#/"))return U("window",t.slice(8));if(t.startsWith("document#/"))return U("document",t.slice(10));return U("s",t)}function vp(e){let[t,...n]=Ie(e);return U(t??"",n.map((r)=>xe(r)).join("/"))}function oo(e){let t=Ce(e);if(t.startsWith("$map/"))return vp(t.slice(5));return Pe(t)}function Oe(e){return mn(e,"s",{code:!1})}function la(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function uo(e){if(_(e))return`\${${Pe(e.$ref)}}`;if(y(e)&&e.includes("${"))return Oe(e);return String(e)}function lo(e){let t=0,n="";for(let r=0;r<e.length;r++){let s=e.charAt(r);if(t===0){if(s==="$"&&e.charAt(r+1)==="{")t=1,n="",r+=1;continue}if(s==="{")t+=1;else if(s==="}"){if(t-=1,t===0){if(fc(n))return!0;continue}}n+=s}return!1}function ca(e,t){if(ao(e))return t?`(e) => { ${t}${Pe(e.$ref)}(s, e); }`:`(e) => ${Pe(e.$ref)}(s, e)`;if(j(e)&&"$expression"in e){let n=Te(e.$expression,{eventParam:"e",statePrefix:"s"});return`(e) => { ${t}${n}; }`}if(me(e))return`(e) => { ${t}${ty(e)} }`;return null}function Zh(e){let t=[];for(let[n,r]of Object.entries(e)){if(!n.startsWith("on")||Ke.has(n))continue;ht(`root "${n}" handler`,r);let s=ca(r,"");if(s!==null)t.push({source:s,type:n.slice(2).toLowerCase()})}return t}function Qh(e){let t=[],n=(r,s,o)=>[" this.#effects.push(effect(() => {",o?" const s = this.state, state = s;":" const s = this.state;",` const _v = ${It}(${r}, ${s});`,` if (_v === null || _v === undefined) this.removeAttribute(${r});`,` else this.setAttribute(${r}, String(_v));`," }));"];for(let[r,s]of Object.entries(e.attributes??{})){let o=JSON.stringify(r);if(_(s))t.push(...n(o,Pe(s.$ref),!1));else if(y(s)&&la(s)){let i=Oe(s);t.push(...n(o,i.slice(2,-1),lo(i)))}else if(y(s)&&s.includes("${")){let i=Oe(s);t.push(...n(o,`\`${i}\``,lo(i)))}else if(le(s)){let i=st(r,s);if(i!==null)t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(i)});`)}else if(y(s)||Y(s))t.push(` if (_first) this.setAttribute(${o}, ${JSON.stringify(String(s))});`)}return t}function ey(e){if(e===void 0)return"null";if(_(e))return`() => { const s = this.state; return ${Pe(e.$ref)}; }`;if(y(e)&&e.includes("${")){let t=Oe(e);return`() => { const s = this.state, state = s; try { return ${la(e)?t.slice(2,-1):`\`${t}\``}; } catch { return null; } }`}return`() => ${JSON.stringify(e)}`}function ty(e){if(et(e))return Le(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=y(e.body)?e.body:"";if(Vn(e))return`((${tt(e).join(", ")}) => { ${t}
|
|
173
|
+
})(s, e);`;return`${mn(t,"s",{bare:!0})}
|
|
174
|
+
`}function Jp(e){if(!j(e))return"";let t=[];for(let[n,r]of Object.entries(e)){if(n.startsWith(":")||n.startsWith(".")||n.startsWith("&")||n.startsWith("[")||n.startsWith("@"))continue;if(y(r)&&r.includes("${")){let s=Re(n);t.push(`${s}: ${Oe(r)}`)}}return t.join("; ")}var Kh;var po=v(()=>{Fr();Xo();Qt();Kn();Lt();K();Cr();Qr();nn();Kh=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formResetCallback","formDisabledCallback"])});function Op(e,t){let{title:n="Jx App"}=t,r=dn(e,null,e.state??{},e.$media??{}),s=bn(e,e.$media??{},t.projectStyle??null),o=jp(e,r),i=[],l=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((a)=>pt(String(a))!==null)?`<script>${ps()}</script>
|
|
175
|
+
`:"",c=`<!DOCTYPE html>
|
|
143
176
|
<html lang="en">
|
|
144
177
|
<head>
|
|
145
178
|
<meta charset="utf-8">
|
|
146
179
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
147
|
-
<title>${
|
|
180
|
+
<title>${G(n)}</title>
|
|
148
181
|
${l}
|
|
149
182
|
${s}
|
|
150
183
|
</head>
|
|
151
184
|
<body>
|
|
152
185
|
${o}
|
|
153
186
|
</body>
|
|
154
|
-
</html>`;return{files:i,html:
|
|
155
|
-
${
|
|
156
|
-
})()`)};`);else
|
|
187
|
+
</html>`;return{files:i,html:c}}function jp(e,t){if(y(e))return G(e);if(Y(e)||le(e))return G(String(e));if(!j(e))return"";let n=dn(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=fr(e.tagName,n.scope),s=Dt(e,n.scope);if(hi.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||yt.has(r),i=ny(e,r,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function ny(e,t,n){if(e.textContent!==void 0){let s=te(e.textContent,n.scope);return s==null?"":G(String(s))}if(e.innerHTML){if(fn(e))return e.innerHTML;let s=te(e.innerHTML,n.scope);return s==null?e.innerHTML:String(s)}let r=sr(e,t,n.scope);if(r!==void 0)return r;if(Array.isArray(e.children))return e.children.map((s)=>jp(s,n)).join(or(n.preformatted));return""}var Ap=v(()=>{Lt();K()});function ma(e,t){let{title:n="Jx App",reactivitySrc:r=un,litHtmlSrc:s=vt,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,l=dn(e,null,e.state??{},e.$media??{}),c=nt(e),a=bn(e,e.$media??{},t.projectStyle??null),u={h:0,l:0,m:0,needsLit:!1,s:0,sw:0,t:0,textParts:!1},f=new Map,p=new Map,d=[],x=[],w=[],g=[],m=[],b=[],S=e.state??{},E=Ss(S,t.resolveClass);for(let[O,T]of Object.entries(S)){if(!j(T)||Array.isArray(T)){if(B(T))x.push([O,`() => ${us(T)}`]);else d.push([O,T]);continue}if(Ne(T)){let de=T.$expression,He=Te(de,{eventParam:"e",statePrefix:"state"});if(Qe(T))m.push(`state[${JSON.stringify(O)}] = ${nr(T,He)};`);else if(ze(de.operator))g.push([O,{args:["state","e"],body:He}]);else x.push([O,`() => ${He}`]);continue}if(me(T)){let{body:de}=T;if(Array.isArray(de)){let He=Le(de,{eventParam:"e",statePrefix:"state"});if(T.parameters&&T.parameters.length>0)m.push(`state[${JSON.stringify(O)}] = ${nr(T,`(() => {
|
|
188
|
+
${He}
|
|
189
|
+
})()`)};`);else g.push([O,{args:["state","e"],body:He}])}else if(T.$src)if(c.get(O)==="computed")x.push([O,`() => { return ${O}(state); }`]);else m.push(`state[${JSON.stringify(O)}] = ${O};`),g.push([O,{args:["state","event"],body:`return ${O}(state, event);`}]);else if(y(de)&&c.get(O)==="computed")x.push([O,`() => { ${de} }`]);else g.push([O,{args:tt(T),body:de}]);continue}if(Et(T))continue;if(Dr(T)){d.push([O,T.default]);continue}if(ct(T)){if(T.$prototype==="LocalStorage"||T.$prototype==="SessionStorage"){let de=T.$prototype==="LocalStorage"?"localStorage":"sessionStorage",He=T.key??O,Pr=T.default??null;d.push([O,null]),m.push(iy(O,de,He,Pr));continue}if(T.$prototype==="Request"){d.push([O,null]),m.push(os(O,T));continue}if(T.$prototype==="Cookie"){d.push([O,null]),m.push(ay(O,T.name??O,T.default??null));continue}if(hn(T)){d.push([O,null]);continue}}if(ut(T)){d.push([O,null]),b.push(is(O,T,{serverBaseUrl:i}));continue}d.push([O,T])}let J=Cp(e,l,f,p,u);for(let[O,T]of f)if(!w.some(([de])=>de===O))w.push([O,T]);for(let[O,T]of p)if(!g.some(([de])=>de===O))g.push([O,T]);let M=ls(S,c),k=oy(d,x,w,g,m,b,M,u,r,t.rewriteSrc,E,ds(e)),P=pn({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports}),R=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((O)=>pt(String(O))!==null)?`<script>${ps()}</script>
|
|
157
190
|
`:"",H=`<!DOCTYPE html>
|
|
158
191
|
<html lang="en">
|
|
159
192
|
<head>
|
|
160
193
|
<meta charset="utf-8">
|
|
161
194
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
162
|
-
<title>${
|
|
163
|
-
${
|
|
164
|
-
{
|
|
165
|
-
"imports": {
|
|
166
|
-
${G.join(`,
|
|
167
|
-
`)}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
</script>
|
|
171
|
-
${c}
|
|
195
|
+
<title>${G(n)}</title>
|
|
196
|
+
${R}${P}
|
|
197
|
+
${a}
|
|
172
198
|
<script type="module" src="./${o}"></script>
|
|
173
199
|
</head>
|
|
174
200
|
<body>
|
|
175
|
-
${
|
|
201
|
+
${J}
|
|
176
202
|
</body>
|
|
177
|
-
</html>`;return{files:[{content:
|
|
203
|
+
</html>`;return{files:[{content:k,path:o}],html:H}}function Cp(e,t,n,r,s){if(y(e)){if(!B(e))return G(e);let g=`_t${s.t}`;s.t+=1,s.textParts=!0,n.set(g,`() => \`${e}\``);let m=te(e,t.scope),b=m==null?"":G(String(m));return`<!--jx-text:${g}-->${b}<!--/jx-text-->`}if(Y(e)||le(e))return G(String(e));if(!j(e))return"";let o=dn(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(qe(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Yt(e.tagName).join(", ")}). Move the element into a component, or give it a literal tagName.`);let i=e.tagName??"div";o.preformatted=t.preformatted===!0||yt.has(i);let l=[],c=!1;if(e.textContent!==void 0){let g=e.textContent;if(ee(g)){let m=Tr(g.$ref);l.push(`:text-content="${m}"`),pa(n,m,g.$ref),c=!0}else if(B(g)){let m=`_t${s.t}`;s.t+=1,l.push(`:text-content="${m}"`),n.set(m,`() => \`${g}\``),c=!0}}for(let[g,m]of Object.entries(e)){if(!g.startsWith("on")||g==="observedAttributes")continue;ht(`inline "${g}" handler`,m);let b=g.slice(2).toLowerCase();if(ee(m)){let S=Tr(m.$ref);l.push(`@${b}="${S}"`),c=!0}else if(me(m)){let S=`_h${s.h}`;s.h+=1,l.push(`@${b}="${S}"`);let{body:E}=m;r.set(S,Array.isArray(E)?{args:["state","e"],body:Le(E,{eventParam:"e",statePrefix:"state"})}:{args:Vn(m)?tt(m):["state","event"],body:E}),c=!0}else if(Ne(m)){let S=`_h${s.h}`;s.h+=1,l.push(`@${b}="${S}"`);let E=Te(m.$expression,{eventParam:"e",statePrefix:"state"});r.set(S,{args:["state","e"],body:E}),c=!0}}if(j(e.style))for(let[g,m]of Object.entries(e.style)){if(g.startsWith(":")||g.startsWith(".")||g.startsWith("&")||g.startsWith("[")||g.startsWith("@"))continue;if(kp(m))continue;if(B(m)){let b=`_s${s.s}`;s.s+=1,l.push(`:style.${Re(g)}="${b}"`),n.set(b,`() => \`${m}\``),c=!0}}if(j(e.attributes))for(let[g,m]of Object.entries(e.attributes)){let b=g==="class"?Jt(e):void 0;if(b!==void 0&&(ee(m)||B(m))){let S=`_t${s.t}`;s.t+=1;let E=ee(m)?da(m.$ref):`\`${m}\``;l.push(`:attr.class="${S}"`),n.set(S,`() => [${E}, ${JSON.stringify(b)}].filter((c) => c != null && c !== "").join(" ")`),c=!0;continue}if(ee(m)){let S=Tr(m.$ref);l.push(`:attr.${g}="${S}"`),pa(n,S,m.$ref),c=!0}else if(B(m)){let S=`_t${s.t}`;s.t+=1,l.push(`:attr.${g}="${S}"`),n.set(S,`() => \`${m}\``),c=!0}}for(let[g,m]of Object.entries(e)){if(Ke.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(ee(m)){let b=Tr(m.$ref);l.push(`:${Re(g)}="${b}"`),pa(n,b,m.$ref),c=!0}else if(B(m)){let b=`_t${s.t}`;s.t+=1,l.push(`:${Re(g)}="${b}"`),n.set(b,`() => \`${m}\``),c=!0}}let a=Dt(e,o.scope),u=c?" data-bind":"",f=l.length>0?` ${l.join(" ")}`:"",p="",d=e;if(d.$switch){s.needsLit=!0;let g=`_sw${s.sw}`;s.sw+=1;let m=ee(d.$switch)?da(d.$switch.$ref):`\`${String(d.$switch)}\``,b=d.cases??{},S=Object.entries(b).filter(([,J])=>J&&!ee(J)).map(([J,M])=>`${JSON.stringify(J)}: html\`${fa(M,o.preformatted)}\``);n.set(g,`() => ({${S.join(", ")}})[String(${m})] ?? html\`\``),l.push(`:render="${g}"`);let E=` ${l.join(" ")}`;return`<${i}${a} data-bind${E}></${i}>`}let x=sr(d,i,o.scope);if(d.textContent!==void 0&&!c){let g=te(d.textContent,o.scope);p=g==null?"":G(String(g))}else if(d.textContent!==void 0&&c){let g=te(d.textContent,o.scope);p=g==null?"":G(String(g))}else if(d.innerHTML){let g=fn(d)?d.innerHTML:te(d.innerHTML,o.scope);p=g==null?d.innerHTML:String(g)}else if(x!==void 0)p=x;else if(Q(d.children)){s.needsLit=!0;let g=`_list${s.l}`;s.l+=1;let m=d.children;n.set(g,`() => ${Tp(m)}`),l.push(`:render="${g}"`),c=!0;let b=" data-bind",S=` ${l.join(" ")}`;if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${a}${b}${S}>`;return`<${i}${a}${b}${S}></${i}>`}else if(Array.isArray(d.children)&&d.children.some((g)=>Q(g))){s.needsLit=!0;let g=`_children${s.l}`;s.l+=1;let m=d.children.map((S)=>fa(S,o.preformatted)).join(or(o.preformatted," "));n.set(g,o.preformatted?`() => html\`${m}\``:`() => html\`
|
|
178
204
|
${m}
|
|
179
|
-
\``),l.push(`:render="${
|
|
180
|
-
})(state, e);`:`${
|
|
181
|
-
`;s+=` @${
|
|
182
|
-
${
|
|
183
|
-
`;else if(Array.isArray(e.children)){let
|
|
184
|
-
${
|
|
205
|
+
\``),l.push(`:render="${g}"`),c=!0;let b=` ${l.join(" ")}`;return`<${i}${a} data-bind${b}></${i}>`}else if(Array.isArray(d.children)){if(ry.has(i)&&d.children.some((g)=>B(g)))throw Error(`A template text child of <${i}> cannot be bound: HTML reads its content as text. Write it as the element's textContent.`);p=d.children.map((g)=>Cp(g,o,n,r,s)).join(or(o.preformatted))}if(new Set(["input","br","hr","img","meta","link"]).has(i))return`<${i}${a}${u}${f}>`;return`<${i}${a}${u}${f}>${p}</${i}>`}function Np(e,t=!1){if(!e)return"";if(qe(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Yt(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||yt.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=ur(e);if(o){let a=pr(e),u="";if(ee(a))u=`\${${Ln(a.$ref)} ?? ""}`;else if(y(a))u=_t(a);else if(Y(a))u=String(a);let f=[u,Jt(e)??""].filter((p)=>p!=="").join(" ");s+=` class="${f}"`}if(j(e.$props))for(let[a,u]of Object.entries(e.$props))if(ee(u))s+=` .${a}="\${${Ln(u.$ref)}}"`;else if(B(u))s+=` .${a}="${_t(u)}"`;else s+=` .${a}="\${${JSON.stringify(u)}}"`;if(j(e.attributes))for(let[a,u]of Object.entries(e.attributes)){if(o&&a==="class")continue;if(B(u)){s+=` ${a}="${_t(u)}"`;continue}if(ee(u)){s+=` ${a}="\${${Ln(u.$ref)}}"`;continue}if(le(u)){let f=st(a,u);if(f!==null)s+=f===""?` ${a}`:` ${a}="${G(f)}"`;continue}s+=` ${a}="${G(String(u))}"`}if(j(e.style)){let a=[];for(let[u,f]of Object.entries(e.style)){if(u.startsWith(":")||u.startsWith(".")||u.startsWith("&")||u.startsWith("[")||u.startsWith("@"))continue;if(kp(f))continue;if(B(String(f)))a.push(`${Re(u)}: ${_t(String(f))}`)}if(a.length>0)s+=` style="${a.join("; ")}"`}for(let[a,u]of Object.entries(e)){if(!a.startsWith("on")||a==="observedAttributes")continue;ht(`inline "${a}" handler`,u);let f=a.slice(2).toLowerCase();if(ee(u)){let p=Tr(u.$ref);s+=` @${f}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(et(u)){let p=Le(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${f}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(me(u)){let p=sy(u.body),d=Vn(u)?`((${tt(u).join(", ")}) => { ${p}
|
|
206
|
+
})(state, e);`:`${p}
|
|
207
|
+
`;s+=` @${f}=\${(e) => { state.$map = { item, index }; ${d}}}`}else if(j(u)&&"$expression"in u){let p=Te(u.$expression,{eventParam:"e",statePrefix:"state"});s+=` @${f}=\${(e) => { state.$map = { item, index }; ${p}; }}`}}for(let[a,u]of Object.entries(e)){if(Ke.has(a)||a.startsWith("$")||a.startsWith("on")||a==="tagName"||a==="id"||a==="className"||a==="style"||a==="children"||a==="textContent"||a==="innerHTML"||a==="attributes")continue;if(ee(u))s+=` .${a}="\${${Ln(u.$ref)}}"`;else if(B(u))s+=` .${a}="${_t(u)}"`;else s+=` .${a}="\${${JSON.stringify(u)}}"`}let i=n.includes("-")?yn:"",l="";if(e.textContent!==void 0){let a=String(e.textContent);if(B(a))l=`${_t(a)}${i}`;else if(ee(e.textContent))l=`\${${Ln(e.textContent.$ref)}}${i}`;else l=G(a)}else if(e.innerHTML)l=_t(String(e.innerHTML));else if(Q(e.children))l=`
|
|
208
|
+
${Rp(e.children)}${i}
|
|
209
|
+
`;else if(Array.isArray(e.children)){let a=e.children.map((u)=>{let f=fa(u,r);return Q(u)||y(u)&&B(u)?`${f}${i}`:f});l=r?a.join(""):`
|
|
210
|
+
${a.join(`
|
|
185
211
|
`)}
|
|
186
|
-
`}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${l}</${n}>`}function
|
|
187
|
-
}; fn(state, e); },`);p.push("};")}else p.push("const on = {};");if(p.push("","function hydrate(root) {"),
|
|
188
|
-
`)}function
|
|
189
|
-
`)}function
|
|
190
|
-
`)}function
|
|
212
|
+
`}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${l}</${n}>`}function fa(e,t=!1){if(y(e))return B(e)?_t(e):G(e);if(Y(e)||le(e))return G(String(e));if(Q(e))return Rp(e);return Np(e,t)}function Rp(e){return`\${${Tp(e)}}`}function ua(e){return Ce(e).startsWith("$map/")?Ln(e):da(e)}function Tp(e){ir(e);let{items:t,filter:n,sort:r,key:s}=e,o=ee(s),i=JSON.stringify(t??[]),l=o?`${ar}(${JSON.stringify(i)})`:i;if(ee(t))l=ua(t.$ref);let c=ee(n)?ua(n.$ref):"undefined",a=ee(r)?ua(r.$ref):"undefined",u=`(item, index) => html\`${Np(e.map)}\``;if(o){let f=s.$ref,p=[`(${l} ?? [])`,c,a,JSON.stringify(ms(f)),JSON.stringify(f),u];return`${lr}(${p.join(", ")})`}if(ee(n)||ee(r))return`${gn}(${l}, ${c}, ${a}).map(${u})`;return`(${l} ?? []).map(${u})`}function _t(e){return e.replaceAll("$map.","")}function sy(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function oy(e,t,n,r,s,o,i,l,c,a,u,f){let p=[],{needsLit:d,textParts:x}=l,w=t.length>0;p.push("// Generated by @jxsuite/compiler — do not edit manually");let g=["reactive","effect"];if(w)g.push("computed");if(f.keyed)g.push("stop","shallowRef");if(p.push(`import { ${g.join(", ")} } from '@vue/reactivity';`),d)p.push("import { html, render } from 'lit-html';");if(f.keyed)p.push(...hs);let m=cs(i,a);if(p.push(...m.imports,...u.imports,...m.loaders,"",fs()),f.arranged||f.keyed)p.push(gs());if(f.keyed)p.push(ys());if(o.length>0)p.push("",bs());let b=u.entries.length>0;if(b)p.push("",$s(),"const _jxInstances = new Map();");p.push("","const state = reactive({");for(let[S,E]of e)p.push(` ${dt(S)}: ${JSON.stringify(E)},`);if(p.push("});",""),s.length>0){for(let S of s)p.push(S);p.push("")}if(t.length>0){for(let[S,E]of t)p.push(`${U("state",xe(S))} = computed(${E});`);p.push("")}if(o.length>0){for(let S of o)p.push(S);p.push("")}if(n.length>0){p.push("const bind = {");for(let[S,E]of n)p.push(` ${dt(S)}: ${E},`);p.push("};")}else p.push("const bind = {};");if(p.push(""),r.length>0){p.push("const on = {");for(let[S,E]of r)p.push(` ${dt(S)}: (e) => { const fn = (${E.args.join(", ")}) => { ${E.body}
|
|
213
|
+
}; fn(state, e); },`);p.push("};")}else p.push("const on = {};");if(p.push("","function hydrate(root) {"),x)p.push(" const texts = [];"," const walker = document.createTreeWalker(root, 128);"," while (walker.nextNode()) {"," const c = walker.currentNode;"," if (c.data.startsWith('jx-text:') && c.data.slice(8) in bind) { texts.push(c); }"," }");if(p.push(" root.querySelectorAll('[data-bind]').forEach(el => {"," [...el.attributes].forEach(a => {"," if (a.name.startsWith(':')) {"," const parts = a.name.slice(1).split('.');"," const key = a.value;"),d)p.push(" if (parts[0] === 'render') {"," effect(() => { render(bind[key](), el); });"," } else if (parts[0] === 'style' && parts.length > 1) {");else p.push(" if (parts[0] === 'style' && parts.length > 1) {");if(p.push(" effect(() => { el.style[parts[1]] = bind[key](); });"," } else if (parts[0] === 'attr' && parts.length > 1) {"," effect(() => {",` const _t = ${It}(parts[1], bind[key]());`," if (_t === null) { el.removeAttribute(parts[1]); }"," else { el.setAttribute(parts[1], _t); }"," });"," } else {"," const prop = parts[0].replace(/-([a-z])/g, (_, c) => c.toUpperCase());"," effect(() => { el[prop] = bind[key](); });"," }"," } else if (a.name.startsWith('@')) {"," el.addEventListener(a.name.slice(1), on[a.value]);"," }"," });"," });"),x)p.push(" texts.forEach(c => {"," const key = c.data.slice(8);"," let text = c.nextSibling;"," if (!text || text.nodeType !== 3) {"," text = document.createTextNode('');"," c.after(text);"," }"," effect(() => { text.data = bind[key](); });"," });");if(p.push("}",""),b)p.push(`await ${ws(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return p.push("hydrate(document);",""),p.join(`
|
|
214
|
+
`)}function iy(e,t,n,r){return[`// ${e}: ${t} (key: "${n}")`,"try {",` const _s = ${t}.getItem(${JSON.stringify(n)});`,` state.${e} = _s !== null ? JSON.parse(_s) : ${JSON.stringify(r)};`,`} catch { state.${e} = ${JSON.stringify(r)}; }`,"effect(() => {",` const v = state.${e};`," try {",` if (v === null) ${t}.removeItem(${JSON.stringify(n)});`,` else ${t}.setItem(${JSON.stringify(n)}, JSON.stringify(v));`," } catch {}","});"].join(`
|
|
215
|
+
`)}function ay(e,t,n){return[`// ${e}: Cookie (name: "${t}")`,"{",` const _m = document.cookie.match(new RegExp("(?:^|; )${t}=([^;]*)"));`,` try { state.${e} = _m ? JSON.parse(decodeURIComponent(_m[1])) : ${JSON.stringify(n)}; }`,` catch { state.${e} = _m ? _m[1] : ${JSON.stringify(n)}; }`,"}"].join(`
|
|
216
|
+
`)}function kp(e){return e===null||j(e)}function Ln(e){let t=Ce(e);if(t.startsWith("$map/")){let[n,...r]=Ie(t.slice(5));return U(n??"",r.map((s)=>xe(s)).join("/"))}if(t.startsWith("#/state/"))return U("state",t.slice(8));return U("state",t)}function da(e){return tl("state",e.startsWith("#/state/")?e.slice(8):e)}function Tr(e){return nl(e.startsWith("#/state/")?e.slice(8):e)}function pa(e,t,n){if(e.has(t))return;e.set(t,`() => ${U("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var ry;var ga=v(()=>{Qt();Kn();Lt();K();nn();ry=new Set(["script","style","textarea","title"])});function ly(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function Pp(e){if(e===null||e.locales.length<2)return"";let t=JSON.stringify(e.locales),n=JSON.stringify(e.defaultLocale),r=JSON.stringify(Object.fromEntries(e.locales.map((s)=>[s,ly(s,e)])));return`
|
|
191
217
|
// ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
|
|
192
218
|
const JX_LOCALES = ${t}
|
|
193
219
|
const JX_DEFAULT_LOCALE = ${n}
|
|
@@ -256,24 +282,24 @@ app.use('/', async (c, next) => {
|
|
|
256
282
|
res.headers.set('Content-Language', locale)
|
|
257
283
|
c.res = res
|
|
258
284
|
})
|
|
259
|
-
`}function
|
|
260
|
-
`),
|
|
261
|
-
`),
|
|
285
|
+
`}function cy(e,t="/_jx/server"){return Ho(e,t)}function uy(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,l=cy(i,t.baseUrl);if(e.length===0&&r.length===0&&!n)return null;let c=e.map(({exportName:x,src:w})=>`import { ${x} } from '${w}'`).join(`
|
|
286
|
+
`),a=py(r,s),u=e.map(({exportName:x})=>my(x,l)).join(`
|
|
287
|
+
`),f=n==="cloudflare-workers"||n==="cloudflare-pages"?`
|
|
262
288
|
app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
|
|
263
289
|
`:`
|
|
264
|
-
`,
|
|
290
|
+
`,p=Pp(o),d=e.length===0&&r.length===0?"":dy(i,l);return`// Generated by @jxsuite/compiler — do not edit manually
|
|
265
291
|
import { Hono } from 'hono'
|
|
266
|
-
${
|
|
292
|
+
${c}${a.imports}
|
|
267
293
|
|
|
268
294
|
const app = new Hono()
|
|
269
|
-
${
|
|
270
|
-
${
|
|
295
|
+
${p}${d}${a.routes}${u}
|
|
296
|
+
${f}
|
|
271
297
|
export default app
|
|
272
|
-
`}function
|
|
298
|
+
`}function py(e,t){if(e.length===0)return{imports:"",routes:""};let n=e.toSorted((o,i)=>o.order-i.order),r=[];for(let o of n)r.push(`import { ${o.className} } from '${o.module}'`);for(let o of t)r.push(`import { ${o.className} } from '${o.module}'`);let s=["// Extension server mounts (specs/extensions.md §11): one shared ctx, mounted in order.","const jxCtx = {}",`const jxConnectors = { ${t.map((o)=>`${JSON.stringify(o.provider)}: ${o.className}`).join(", ")} }`];for(let[o,i]of n.entries()){let l=JSON.stringify(i.options);s.push(`const jxMount${o} = await ${i.className}.mount({ ...${l}, connectors: jxConnectors }, jxCtx)`,`app.all('${i.basePath}/*', (c) => jxMount${o}(c.req.raw, c.env))`,`app.all('${i.basePath}', (c) => jxMount${o}(c.req.raw, c.env))`)}return{imports:`
|
|
273
299
|
${r.join(`
|
|
274
300
|
`)}`,routes:`${s.join(`
|
|
275
301
|
`)}
|
|
276
|
-
`}}function
|
|
302
|
+
`}}function dy(e,t){let n=Ho(e,fy);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
|
|
277
303
|
const jxGate = async (c, next) => {
|
|
278
304
|
const site = c.req.header('sec-fetch-site')
|
|
279
305
|
const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
|
|
@@ -290,7 +316,7 @@ const jxGate = async (c, next) => {
|
|
|
290
316
|
}
|
|
291
317
|
${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
|
|
292
318
|
`)}
|
|
293
|
-
`}function
|
|
319
|
+
`}function my(e,t){return`
|
|
294
320
|
app.post('${t}/${e}', async (c) => {
|
|
295
321
|
if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
|
|
296
322
|
return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
|
|
@@ -302,26 +328,23 @@ app.post('${t}/${e}', async (c) => {
|
|
|
302
328
|
console.error('jx: server function ${e} threw:', e)
|
|
303
329
|
return c.json({ ok: false, error: 'Server error' }, 500)
|
|
304
330
|
}
|
|
305
|
-
})`}var
|
|
306
|
-
`)}function
|
|
307
|
-
|
|
331
|
+
})`}var fy="/_jx";var _p=v(()=>{Bo()});function ha(e,t=[]){if(!A(e))return t;let{children:n}=e;if(e.tagName==="slot"){let r=e.attributes,s=A(r)?r.name:void 0,o={name:y(s)?s.trim():""};if(Array.isArray(n)&&n.length>0)o.fallback=n;t.push(o)}if(Array.isArray(n))for(let r of n)ha(r,t);return t}var Mp=v(()=>{K()});function Dp(e){if(e===null||e===void 0)return"null";if(Array.isArray(e))return"array";if(y(e))return"string";if(Y(e))return"number";return le(e)?"boolean":"object"}function gy(e){if(y(e))return e;if(!A(e))return;if(y(e.text))return e.text;if(y(e.type))return e.type;if(Array.isArray(e.type))return e.type.filter((t)=>y(t)).join(" | ");return y(e.$ref)?e.$ref.slice(e.$ref.lastIndexOf("/")+1):void 0}function kr(e){let t=gy(e);return t===void 0||t===""?void 0:{text:t}}function Lp(e){if(y(e)&&e!=="")return e;return e===!0?!0:void 0}function hy(e,t){let n={kind:"field",name:e};if(Dr(t)){let r=kr(t.type)??kr(y(t.$ref)?{$ref:t.$ref}:void 0);if(n.type=r??{text:Dp(t.default)},n.default=JSON.stringify(t.default),y(t.description))n.description=t.description;let s=Lp(t.deprecated);if(s!==void 0)n.deprecated=s;return n}if(A(t)){if(Object.keys(t).some((s)=>s.startsWith("$"))||Ea(t))return null}else if(B(t))return null;return n.type={text:Dp(t)},n.default=JSON.stringify(t),n}function yy(e){if(y(e))return{name:e};if(!A(e)||!y(e.name))return null;let t={name:e.name},n=kr(e.type);if(n)t.type=n;if(y(e.description))t.description=e.description;if(le(e.optional))t.optional=e.optional;if(e.default!==void 0)t.default=JSON.stringify(e.default);return t}function xy(e,t){let n={kind:"method",name:e};if(y(t.description))n.description=t.description;let s=(t.parameters??t.arguments??[]).map((i)=>yy(i)).filter((i)=>i!==null&&i.name!=="state");if(s.length>0)n.parameters=s;let o=kr(t.type);if(o)n.return={type:o};return n}function Ip(e,t){if(!Array.isArray(e))return;for(let n of e){if(!A(n)||!y(n.name)||t.has(n.name))continue;let r={name:n.name,type:kr(n.type)??{text:"Event"}};if(y(n.description))r.description=n.description;let s=Lp(n.deprecated);if(s!==void 0)r.deprecated=s;t.set(n.name,r)}}function by(e){let t=new Set,n=(s)=>{if(!A(s))return;let o=A(s.attributes)?s.attributes.part:void 0;if(y(o)){for(let i of o.split(/\s+/u))if(i!=="")t.add(i)}r(s)},r=(s)=>{if(Array.isArray(s.children))for(let o of s.children)n(o)};return r(e),[...t]}function $y(e){let t=e.doc,n=A(t.state)?t.state:{},r=nt(e.doc),s=[],o=[],i=new Map,l=new Map;Ip(t.emits,l);for(let[m,b]of Object.entries(n)){if(Xt(m))continue;if(me(b)){if(Ip(b.emits,l),!wo.has(m)&&r.get(m)!=="computed")o.push(xy(m,b));continue}let S=hy(m,b);if(S)o.push(S),i.set(m,S)}let c=[],a=new Set,u=Array.isArray(t.observedAttributes)?t.observedAttributes:[];for(let m of new Set(u.filter((b)=>y(b)))){let b={name:m},S=Zt(m),E=i.get(S);if(E){b.fieldName=S;for(let J of["type","default","description","deprecated"])if(E[J]!==void 0)Object.assign(b,{[J]:E[J]});if(!a.has(S)){a.add(S),E.attribute=m;let J=n[S];if(A(J)&&J.reflects===!0)E.reflects=!0}}c.push(b)}for(let[m,b]of Object.entries(n)){if(Xt(m)||!A(b)||!y(b.attribute))continue;if(i.get(m)?.attribute!==b.attribute)s.push(`${e.tagName}: state entry "${m}" declares attribute "${b.attribute}", but the `+"element does not observe it into that entry (spec.md §16.5); add it to "+"observedAttributes or remove it")}let f={customElement:!0,kind:"class",members:o,name:e.className,tagName:e.tagName},p=y(t.description)?t.description:t.$description;if(y(p))f.description=p;if(c.length>0)f.attributes=c;if(l.size>0)f.events=[...l.values()];let d=ha(t).map((m)=>({name:m.name}));if(d.length>0)f.slots=d;let x=A(t.style)?t.style:{},w=Object.entries(x).filter(([m])=>m.startsWith("--")).map(([m,b])=>({default:String(b),name:m}));if(w.length>0)f.cssProperties=w;let g=e.shadow?by(e.doc).map((m)=>({name:m})):[];if(g.length>0)f.cssParts=g;return{module:{declarations:[f],exports:[{declaration:{name:e.className},kind:"custom-element-definition",name:e.tagName}],kind:"javascript-module",path:e.modulePath},warnings:s}}function Fp(e){let n=e.toSorted((r,s)=>r.tagName<s.tagName?-1:1).map((r)=>$y(r));return{manifest:{modules:n.map((r)=>r.module),schemaVersion:"2.1.0"},warnings:n.flatMap((r)=>r.warnings)}}function Vp(e){return`${JSON.stringify(e,null,2)}
|
|
332
|
+
`}var Wp=v(()=>{Mp();Qt();K()});async function vy(e){let{readdirSync:t}=await import("node:fs"),{resolve:n}=await import("node:path");if(!y(e))return e.map((r)=>n(r));return t(e).filter((r)=>Pt(r)).toSorted().map((r)=>n(e,r))}async function Jy(e){let{readFileSync:t}=await import("node:fs");if(!Pt(e))throw Error(`compileElementPack: ${e} is not a .json or .jxn document, the two a pack compiles`);return Kt(t(e,"utf8"),e)}async function Oy(e){let{resolve:t}=await import("node:path"),n=(e.packDir??"dist").replaceAll(/^\.?\/+|\/+$/gu,""),r=await vy(e.components),s=new Map,o=new Map;for(let x of r){let w=await Jy(x),{tagName:g}=w;if(!y(g)||!g.includes("-"))throw Error(`compileElementPack: ${x} is not a component: its tagName must contain a hyphen`);let m=[...o].find(([,b])=>b===g);if(m)throw Error(`compileElementPack: ${m[0]} and ${x} both declare the tagName "${g}"`);s.set(g,w),o.set(x,g)}let i={stylesheetHref:(x)=>`./${x}.css`,resolveElementPath:(x,w)=>{let g=w===null?t(x):t(w,x),m=o.get(g);if(m===void 0)throw Error(`compileElementPack: "${x}" names a component outside the pack (${g})`);return`./${m}.js`}};if(e.rewriteSrc)i.rewriteSrc=e.rewriteSrc;if(e.$media)i.$media=e.$media;if(e.defaults)i.defaults=e.defaults;let l=new Map;for(let x of r){let{files:w}=await co(x,i);for(let g of w)if(!l.has(g.tagName))l.set(g.tagName,g.content)}let c=Mc([...s.keys()],s),a=[],u=[],f=[];for(let x of c){let w=s.get(x),g=l.get(x);if(!w||g===void 0)continue;a.push({content:g,path:`${x}.js`});let m=ft(w,e.defaults),b=Ic(x,w.style,w,e.$media??w.$media??{},m);if(b!==""){if(a.push({content:b,path:`${x}.css`}),m===null)u.push(b)}f.push({className:$n(x),doc:w,modulePath:n===""?`${x}.js`:`${n}/${x}.js`,shadow:m!==null,tagName:x})}let{manifest:p,warnings:d}=Fp(f);return a.push({content:`// Generated by @jxsuite/compiler — do not edit manually
|
|
333
|
+
${c.map((x)=>`import './${x}.js';`).join(`
|
|
334
|
+
`)}
|
|
335
|
+
`,path:Sy},{content:u.join(""),path:wy},{content:Vp(p),path:Ey}),{files:a,manifest:p,tags:c,warnings:d}}async function jy(e,t){let{mkdirSync:n,writeFileSync:r}=await import("node:fs"),{dirname:s,resolve:o}=await import("node:path");return e.files.map((i)=>{let l=o(t,i.path);return n(s(l),{recursive:!0}),r(l,i.content,"utf8"),l})}var Sy="index.js",wy="elements.css",Ey="custom-elements.json";var Hp=v(()=>{Wp();K();Cr();Qr();Lt();po()});function qp(e){let t=Va(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=Cy(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,l=Ay(i)?i:void 0,c=s?.methods??{},a=["// Generated by @jxsuite/compiler from .class.json — do not edit manually"];if(t.$id)a.push(`// Source: ${t.$id}`);a.push("");let u=Ny(t.extends);if(u!==null)a.push(u,"");let f=r!=="Object"?` extends ${r}`:"";a.push(`class ${n}${f} {`);for(let[p,d]of Object.entries(o)){if(d.scope!=="static")continue;let x=d.identifier??p,w=d.access==="private"?"#":"",g=d.initializer!==void 0?JSON.stringify(d.initializer):d.default!==void 0?JSON.stringify(d.default):"null";a.push(` static ${w}${x} = ${g};`)}for(let[p,d]of Object.entries(o)){if(d.scope==="static")continue;if(d.access!=="private")continue;let x=d.identifier??p;a.push(` #${x};`)}if(Object.keys(o).length>0)a.push("");if(a.push(" constructor(config = {}) {"),l?.superCall||r!=="Object"){let p=l?.superCall?.arguments?l.superCall.arguments.join(", "):"";a.push(` super(${p});`)}for(let[p,d]of Object.entries(o)){if(d.scope==="static")continue;let x=d.identifier??p,w=d.access==="private"?"#":"",g=d.initializer!==void 0?JSON.stringify(d.initializer):d.default!==void 0?JSON.stringify(d.default):"null";a.push(` this.${w}${x} = config.${x} !== undefined ? config.${x} : ${g};`)}if(l?.body){let p=Array.isArray(l.body)?l.body:[l.body];for(let d of p)a.push(` ${d}`)}a.push(" }");for(let[p,d]of Object.entries(c)){let x=d.identifier??p,w=d.scope==="static",m=d.access==="private"?"#":"",b=w?"static ":"",S=d.returnType?.$ref?.includes("Promise")||Ty(d)?"async ":"",E=Bp(d.parameters??[]),J=Ry(d.body);if(a.push(""),d.role==="accessor"){if(d.getter)a.push(` ${b}get ${m}${x}() {`,` ${d.getter.body}`," }");if(d.setter){let M=Bp(d.setter.parameters??[])||"v";a.push(` ${b}set ${m}${x}(${M}) {`,` ${d.setter.body}`," }")}}else{a.push(` ${b}${S}${m}${x}(${E}) {`);for(let M of J)a.push(` ${M}`);a.push(" }")}}return a.push("}","",`export { ${n} };`,`export default ${n};`,""),a.join(`
|
|
336
|
+
`)}function Ay(e){return typeof e==="object"}function Cy(e){if(!e)return"Object";if(y(e))return e;if(e.$ref){let t=e.$ref.match(Up);return t?t[1]:"Object"}return"Object"}function Ny(e){if(!e||y(e)||!e.$ref)return null;let t=e.$ref.match(Up);if(!t)return null;let[n=""]=e.$ref.split("#"),r=n.replace(/\.class\.json$/,".js"),s=/^(?:\.{0,2}\/|[a-z][a-z0-9+.-]*:)/i.test(r)?r:`./${r}`;return`import ${t[1]} from ${JSON.stringify(s)};`}function Bp(e){return e.map((t)=>{if(t.$ref)return t.$ref.split("/").pop();let n=t.identifier??t.name;return y(n)?n:"arg"}).join(", ")}function Ry(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function Ty(e){return(Array.isArray(e.body)?e.body.join(`
|
|
337
|
+
`):e.body??"").includes("await ")}var Up;var zp=v(()=>{Fr();K();Up=/([A-Za-z0-9_]+)\.class\.json/});import{readFileSync as ky}from"node:fs";async function Py(e,t={}){let{title:n="Jx App",reactivitySrc:r=un,litHtmlSrc:s=vt,projectStyle:o=null}=t,i;if(y(e)){let c=ky(e,"utf8");if(Pt(e))i=Kt(c,e);else{let{extname:a}=await import("node:path"),u=a(e).toLowerCase(),f=t.formats?.byExtension(u,"parse");if(!f){await Promise.resolve().then(() => oa());throw so(e,u)}i=await f.parseDocument(c)}}else i=e;if(i=Fn(i,y(e)?e:"the document"),Ja(i)){await Promise.resolve().then(() => zp());let a=qp(i),u=y(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:a,path:u}],html:""}}if(!as(i)){let c={projectStyle:o,title:n};if(t.prePaintScheme===!1)c.prePaintScheme=!1;return Op(i,c)}if(i.tagName&&i.tagName.includes("-")){let{tagName:c}=i,a=$n(c),f={content:ia(i,a,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${c}.js`,tagName:c},p=bn(i,i.$media??{},o),d=`<!DOCTYPE html>
|
|
308
338
|
<html lang="en">
|
|
309
339
|
<head>
|
|
310
340
|
<meta charset="utf-8">
|
|
311
341
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
312
|
-
<title>${
|
|
313
|
-
|
|
314
|
-
{
|
|
315
|
-
"imports": {
|
|
316
|
-
"@vue/reactivity": "${r}",
|
|
317
|
-
"lit-html": "${s}"
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
</script>
|
|
321
|
-
${d}
|
|
342
|
+
<title>${G(n)}</title>
|
|
343
|
+
${pn({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
344
|
+
${p}
|
|
322
345
|
</head>
|
|
323
346
|
<body>
|
|
324
|
-
<${
|
|
325
|
-
<script type="module" src="./${
|
|
347
|
+
<${c}></${c}>
|
|
348
|
+
<script type="module" src="./${c}.js"></script>
|
|
326
349
|
</body>
|
|
327
|
-
</html>`;return{files:[
|
|
350
|
+
</html>`;return{files:[f],html:d}}let l={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,..._y(t),title:n};if(t.serverBaseUrl!==void 0)l.serverBaseUrl=t.serverBaseUrl;if(t.resolveClass!==void 0)l.resolveClass=t.resolveClass;if(t.runtimeImports!==void 0)l.runtimeImports=t.runtimeImports;return ma(i,l)}function _y(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function kv(e,t){let n=await Py(e),{writeFileSync:r,mkdirSync:s}=await import("node:fs"),{dirname:o,join:i}=await import("node:path");if(t){r(t,n.html,"utf8"),console.error(`Written to ${t}`);let l=o(t);for(let c of n.files){let a=i(l,c.path);s(o(a),{recursive:!0}),r(a,c.content,"utf8"),console.error(`Written to ${a}`)}}else process.stdout.write(n.html)}var My=v(()=>{Fr();Lt();po();Ap();ga();K();Cr();Lt();_p();po();Hp();ga()});My();export{Py as compile,ma as compileClient,co as compileElement,Oy as compileElementPack,Yh as compileElementPage,uy as compileSiteServer,as as isDynamic,kv as runCli,jy as writeElementPack};
|