@jxsuite/compiler 10.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +278 -275
- package/dist/compiler.js +120 -117
- package/package.json +8 -8
- package/src/child-separator.ts +260 -0
- package/src/shared.ts +26 -30
- package/src/site/build-time.ts +45 -0
- package/src/site/context-injection.ts +4 -0
- package/src/site/csp.ts +102 -0
- package/src/site/headers-emitter.ts +2 -1
- package/src/site/image-transform.ts +1 -1
- package/src/site/locale-negotiation.ts +44 -14
- package/src/site/site-build.ts +105 -29
- package/src/site/site-loader.ts +2 -1
- package/src/site/social-image.ts +159 -0
- package/src/site/validate-command.ts +54 -34
- package/src/targets/compile-client.ts +20 -9
- package/src/targets/compile-element.ts +14 -6
- package/src/targets/compile-server.ts +3 -2
- package/src/targets/compile-static.ts +5 -4
package/dist/compiler.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
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
|
|
1
|
+
import{createRequire as mf}from"node:module";var lf=Object.create;var{getPrototypeOf:cf,defineProperty:Ea,getOwnPropertyNames:uf}=Object;var va=Object.prototype.hasOwnProperty;function pf(e){return this[e]}var ff,df,ex=(e,t,n)=>{var r=e!=null&&typeof e==="object";if(r){var s=t?ff??=new WeakMap:df??=new WeakMap,o=s.get(e);if(o)return o}n=e!=null?lf(cf(e)):{};let i=t||!e||!e.__esModule||!va.call(e,"default")?Ea(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let l of uf(e))if(!va.call(i,l))Ea(i,l,{get:pf.bind(e,l),enumerable:!0})}if(r)s.set(e,i);return i};var tx=(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 rx=mf(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 et(e){return Ne(e)&&Array.isArray(e.parameters)&&e.parameters.length>0}function tt(e){return me(e)&&Array.isArray(e.body)}function ut(e){return A(e)&&typeof e.$prototype==="string"&&e.$prototype!=="Function"}function pt(e){return A(e)&&e.timing==="server"&&typeof e.$src==="string"&&typeof e.$export==="string"&&!e.$prototype}function Lr(e){return A(e)&&!e.$prototype&&!e.$expression&&"default"in e}function vt(e){if(!A(e))return!1;for(let t of Object.keys(e))if(!xo.has(t))return!1;return!0}function ja(e){if(!A(e))return!1;for(let t of Object.keys(e))if(xo.has(t))return!0;return!1}function Q(e){return A(e)&&e.$prototype==="Array"}function Aa(e){return(Array.isArray(e)?e:[e]).some((n)=>Q(n))}function Ca(e){return A(e)&&e.$prototype==="Class"}function qe(e){return A(e)}function B(e){return typeof e==="string"&&e.includes("${")}function Na(e){return/\breturn\b[^\S\n]*(?![;}\s]|$)/.test(Dt(e))}function bo(e){return e.$prototype==="Function"||y(e.role)&&e.role!=="field"}function Dt(e){if(!/[/'"`]/u.test(e))return e;let t=Dr.get(e);if(t!==void 0)return t;let n=ka(e);if(Dr.size>=Ra)Dr.clear();return Dr.set(e,n),n}function Ta(e){if(!e.includes("${"))return gf;let t=Ir.get(e);if(t!==void 0)return t;let n=[],r=0;while(r<e.length){let s=[];ka(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(Ja(e,c,r+a))}if(o===-1)break;let i=hf(e,o);if(i===-1)r=o+2;else n.push(Ja(e,o,i)),r=i}if(Ir.size>=Ra)Ir.clear();return Ir.set(e,n),n}function Ja(e,t,n){return{end:n,expr:e.slice(t+2,n-1),start:t}}function hf(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 xf(e,t,n){return(t==="+"||t==="-")&&e.charAt(n-1)===t}function Oa(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 ka(e,t){let n=e.split(""),r=(a)=>{if(n[a]!==void 0&&n[a]!==`
|
|
3
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
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==="/"&&
|
|
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==="/"&&yf.has(i)&&!xf(e,i,l)&&Oa(e,c)>0){let u=Oa(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 bf(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Fr(e){if(!e)return[];return e.map((t)=>y(t)?t:t.name)}function $f(e){return typeof e==="string"}function Ue(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 Xt(e){if($f(e))return[e];if(!Ue(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 Zt(e){return e.startsWith("#")}function Qt(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}var xo,Dr,Ra=2048,gf,Ir,yf;var K=v(()=>{xo=new Set(["type","enum","minimum","maximum","minLength","maxLength","pattern","format","items","properties","required","description","title","$comment"]);Dr=new Map;gf=[],Ir=new Map;yf=new Set("(,=:[!&|?{;+-*%<>~^")});function Sf(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 So(e,t,n,r){return{...Sf(e,t),kind:n,message:r,offset:t}}function wf(e,t){let n=t;while(n<e.length&&/\s/u.test(e.charAt(n)))n+=1;return n}function Da(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 Ia(e){wo=e,Vr=null}function vf(e,t){if(!Vr){if(!wo)throw Error("@jxsuite/erase was imported without an entry that loads its stripper");Vr=wo()}return Vr(e,t)}function La(e,t,n){return vf(e,(r)=>{let s=wf(e,r.pos),[o="this"]=/^[\w$]+/u.exec(e.slice(s))??[];n.push(So(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 Jf(e){return Dt(e).includes("<")||!Da(e)}function Of(e){let t=$o.get(e);if(t)return t;if(!Jf(e)){let i={code:e,problems:[]};return $o.set(e,i),i}let n=[],r=La(e,"A function body",n),s=Dt(r);for(let i of s.matchAll(Ef)){let l=i.index+(i[1]?.length??0)+(i[2]?.length??0);n.push(So(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&&Da(e)){let i=[...e].findIndex((l,c)=>l!==r[c]);n.push(So(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 $o.set(e,o),o}function ax(e){let t=Pa.get(e);if(t)return t;let n=[],s={code:La(e,"A script",n),problems:n};return Pa.set(e,s),s}function jf(e){return String(e).replaceAll("~","~0").replaceAll("/","~1")}function _a(e,t,n){if(y(e))return Ma(e,t,n);if(Array.isArray(e)&&e.length>0&&e.every((r)=>y(r)))return Ma(e.join(`
|
|
10
10
|
`),t,n).split(`
|
|
11
|
-
`);return e}function
|
|
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
|
|
15
|
-
`)
|
|
16
|
-
`)}function
|
|
11
|
+
`);return e}function Ma(e,t,n){let{code:r,problems:s}=Of(e),[o,...i]=s.filter((l)=>l.kind==="unsupported");if(o)throw new Fa(t,[o,...i]);for(let l of s)n.push({...t,problem:l});return r}function Eo(e,t,n){if(Array.isArray(e))return e.map((i,l)=>Eo(i,{...t,pointer:`${t.pointer}/${l}`},n));if(!A(e))return e;let r=bo(e),s=[],o={set:(i,l)=>{s.push([i,l])}};for(let[i,l]of Object.entries(e)){let c={...t,pointer:`${t.pointer}/${jf(i)}`};if(r&&i==="body")o.set(i,_a(l,c,n));else if(r&&(i==="getter"||i==="setter")&&A(l)){let a={...l};if(l.body!==void 0)a.body=_a(l.body,{...c,pointer:`${c.pointer}/body`},n);o.set(i,a)}else o.set(i,Eo(l,c,n))}return Object.fromEntries(s)}function vo(e,t,n=[]){return Eo(e,{path:t,pointer:""},n)}function Va(e,t,n=[]){return vo(e,t,n)}var Ef,$o,Vr=null,wo=null,Pa,Fa;var Jo=v(()=>{K();Ef=/(^|[\n;{}])(\s*)(import|export)(?=[\s{*"'])/gu;$o=new Map;Pa=new Map;Fa=class Fa 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 Af}from"node:module";var Wa=v(()=>{Jo();Jo();Ia(()=>Af(import.meta.url)("ts-blank-space").default)});function Ba(e){for(let{path:t,pointer:n,problem:r}of e){let s=`${t}${n} (line ${r.line}, column ${r.column}): ${r.message}`;if(!Ha.has(s))Ha.add(s),console.warn(`Warning: ${s}`)}}function Wn(e,t){let n=[],r=vo(e,t,n);return Ba(n),r}function qa(e,t){let n=[],r=Va(e,t,n);return Ba(n),r}var Ha;var Wr=v(()=>{Wa();Ha=new Set});function Cf(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 Oo)if(A(e.state)&&o in e.state)t.add(o);return t}function jo(e){return"body"in e&&"$src"in e}function Hn(e){return Fr(e.parameters??e.arguments).length>0}function nt(e){let t=["state"];for(let n of Fr(e.parameters??e.arguments))if(n!=="state")t.push(n);return t}function Nf(e,t,n){if(tt(t))return"callable";if(Fr(t.parameters??t.arguments).length>0)return"callable";if(y(t.body))return Na(t.body)?"computed":"callable";if(t.$src)return n().has(e)?"callable":"computed";return"callable"}function rt(e){let t=new Map,n=null,r=()=>n??=Cf(e);for(let[s,o]of Object.entries(e.state??{}))if(me(o))t.set(s,Nf(s,o,r));return t}var Oo;var en=v(()=>{K();Oo=new Set(["onMount","onUnmount","onAdopted"])});function Re(e){return e.replaceAll(/[A-Z]/g,(t)=>`-${t.toLowerCase()}`)}function za(e,t){if(e.startsWith("@--"))return t[e.slice(1)]??e.slice(1);if(e.startsWith("@(")){let n=e.slice(2,-1).trim();return Rf.has(n.toLowerCase())?n:e.slice(1)}return null}function Bn(e){return e.startsWith("@position-try")||e.startsWith("@property")||e.startsWith("@font-face")||e.startsWith("@counter-style")}function qn(e){return e.startsWith("@keyframes")}function Ka(e,t){let n=[];for(let r of tn(e))for(let s of tn(t))n.push(Ao(r,s));return n.join(", ")}function Ao(e,t){let n=kf(e,t);if(n!==null)return n;let r=el(t,e);if(r!==null)return r;if(t.startsWith("[")||t.startsWith(":")||t.startsWith("."))return`${e}${t}`;return`${e} ${t}`}function Ga(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 Ya(e){if(e.endsWith(":host"))return{inner:"",prefix:e.slice(0,-5)};let t=e.lastIndexOf(":host(");if(t===-1||Ga(e,t+5)!==e.length)return null;return{inner:e.slice(t+6,-1),prefix:e.slice(0,t)}}function Xa(e){if(!e.startsWith(":host"))return null;let t=e.slice(5);if(t.startsWith("(")){let n=Ga(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 Za(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===":"&&Tf.test(e.slice(r)))return r}}return e.length}function kf(e,t){let n=Ya(e);if(n===null||!Ro(t))return null;let r=Br(t);if(r.length>1||r.length===1&&r[0]!==0)return null;let s=r.length===1?t.slice(1):t,o=Za(s);if(o===0)return`${e}${s}`;return`${n.prefix}:host(${n.inner}${s.slice(0,o)})${s.slice(o)}`}function _f(e,t,n){let r=Xa(e);if(r===null)return n==="shadow"&&Pf.test(e)?e:Ao(t,e);let{inner:s,rest:o}=r;if(n==="light")return`${t}${s??""}${o}`;let l=`${Ya(t)?.prefix??""}:host${s===null?"":`(${s})`}`;if(o==="")return l;return/^[\s>+~]/u.test(o)?`${l}${o}`:Ao(l,o)}function Qa(e,t,n){let r=[];for(let s of tn(t))for(let o of tn(e))r.push(_f(o,s,n));return r.join(", ")}function Mf(e){return tn(e).every((t)=>{let n=Xa(t);if(n===null)return Ro(t);let r=Za(n.rest);return n.rest.slice(r).replace(/^::?[\w-]+(?:\([^)]*\))?/u,"")===""})}function Br(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 el(e,t){return Br(e).length>0?Df(e,t):null}function Df(e,t){let n="",r=0;for(let s of Br(e))n+=e.slice(r,s)+t,r=s+1;return n+e.slice(r)}function tn(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 ft(e){let t=/^\(\s*prefers-color-scheme\s*:\s*(light|dark)\s*\)$/.exec(e.trim())?.[1];return t==="light"||t==="dark"?t:null}function Co(e,t){if(e===":root"||e==="html")return{auto:`${e}:where(:not([${ze}]))`,forced:`${e}:where([${ze}="${t}"])`};return{auto:`:where(:root:not([${ze}])) ${e}`,forced:`:where(:root[${ze}="${t}"]) ${e}`}}function Un(e){return e.startsWith(":")||e.startsWith(".")||e.startsWith("&")||e.startsWith("[")}function No(e){return e.startsWith("--")?e:Re(e)}function Hr(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 tl(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 zn(e){if(e.description===void 0)return e.text;return`/* ${e.description.replaceAll("*/","* /")} */
|
|
12
|
+
${e.text}`}function If(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 Lf(e){let t=Object.keys(e).filter((r)=>qn(r));if(t.length===0)return e;let n={...e};for(let r of t)delete n[r];return n}function Ro(e){let n=Br(e).at(-1),r=n===void 0?e:e.slice(n+1);return r===""||r.startsWith(":")||r.startsWith(".")||r.startsWith("[")}function nn(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(!Bn(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("@")||Un(P)))continue;if(P.startsWith("$"))continue;let H=p(P,R,J,M);if(H!==null)k.push([No(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=tl(S,P,J),H={text:R,conditions:[...S],selector:P,declarations:J,target:M,key:Hr(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=If(J,M,k);a.push({blocks:k,conditions:[...J],declarations:[],key:Hr(P),selector:null,target:"unscoped",text:P,...x(E.$description)})},m=(S,E,J,M,k,P)=>{if(S==="@--")return;if(Bn(S)){w([...M,S],null,d(E,!1,!0,"unscoped"),"unscoped",E.$description);return}if(qn(S)){g(S,E,M);return}let R=za(S,r),H=R===null?S:`@media ${R}`,O=R===null?null:ft(R);if(O!==null&&J!==null&&!c){let{auto:T,forced:de}=Co(J,O);b(E,T,[...M,H],k,P),b(Lf(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,Qa(P,E,l),J,Mf(P)?M:"descendant",!1);else if(E!==null)b(H,Ka(E,P),J,Ro(P)?M:"descendant",!1)}return b(e,n,[],"self",!0),a}function Ua(e){return e===!1||e==="open"||e==="closed"}function dt(e,t){let n=e?.$shadow;if(Ua(n))return n===!1?null:n;let r=t?.shadow;return Ua(r)&&r!==!1?r:null}var Rf,Tf,Pf,ze="data-color-scheme",qr="jx-color-scheme";var Kn=v(()=>{K();Rf=new Set(["all","print","screen","speech"]);Tf=/^:(?:before|after|first-line|first-letter)(?![\w-])/u;Pf=/^::(?:slotted|part)\(/u});function sl(){return`the Intl helpers ${ko.join(", ")}`}var st="en-US",To="UTC",nl,ko,rl;var Po=v(()=>{nl=[{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."}],ko=nl.map((e)=>e.path),rl=Object.fromEntries(nl.map((e)=>[e.path,e.params.indexOf("locale")]))});function Ff(e){return e.replaceAll("~1","/").replaceAll("~0","~")}function xe(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Ae(e){return e.startsWith("#/$map/")?e.slice(2):e}function Le(e){if(e==="")return[];return e.split("/").map((t)=>Ff(t))}function be(e,t){let n=e;for(let r of Le(t))n=n?.[r];return n}function U(e,t){let n=e;for(let r of Le(t))n+=_o.test(r)?`.${r}`:`[${JSON.stringify(r)}]`;return n}function ol(e,t){let n=e;for(let[r,s]of Le(t).entries()){let o=r===0?"":"?.";n+=_o.test(s)?`${r===0?".":o}${s}`:`${o}[${JSON.stringify(s)}]`}return n}function mt(e){return _o.test(e)?e:JSON.stringify(e)}function il(e){let t=e.replaceAll(/[^A-Za-z0-9_$]/g,"_");if(t==="")return"ref";return/^\d/.test(t)?`_${t}`:t}var _o;var rn=v(()=>{_o=/^[A-Za-z_$][A-Za-z0-9_$]*$/});function Mo(e){let t=e.$map;return j(t)?t:void 0}function Kr(e){return j(e)&&!Array.isArray(e)&&"operator"in e}function sn(e){return j(e)&&!Array.isArray(e)&&"$ref"in e}function Bf(e,t,n){let r=rl[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 dl(){return globalThis.window??globalThis}function ml(e){return e.startsWith("window#/")&&Wf.has(e.slice(8))}function Ke(e){return ul.has(e)}function Ur(e){if(Array.isArray(e))return e.some((t)=>Ur(t));if(e===void 0||!Kr(e))return!1;return Ke(e.operator)||[e.target,e.value,e.initial,e.default].some((t)=>Ur(t))||Object.values(e.cases??{}).some((t)=>Ur(t))}function Gn(e){return et(e)&&!Ur(e.$expression)}function Do(e,t){if(Array.isArray(e)){for(let n of e)Do(n,t);return}if(e===void 0||!j(e))return;if(sn(e)){if(!qf.test(e.$ref)){let n=e.$ref.replace(/^(?:#\/state\/|parent#\/)/,"");t.add(Le(n)[0]??"")}return}if(Kr(e)){let n=[e.target,e.value,e.initial,e.default];for(let r of[...n,...Object.values(e.cases??{})])Do(r,t)}}function Ho(e){let t=new Set;return Do(e.$expression,t),[...t]}function Bo(e){let t=new Map;for(let[r,s]of Object.entries(e??{}))if(!r.startsWith("$")&&Gn(s))t.set(r,s);let n=!1;while(!n){n=!0;for(let[r,s]of t)if(Ho(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>Uf)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(Kr(e))return Me(e,t,n,r,s);if(sn(e)){let o=zr(e.$ref,t,n,r);return s?.report(s.path??[],o),o}if(Array.isArray(e))return gl(e,t,n,r,s);return s?.report(s.path??[],e),e}function gl(e,t,n,r,s){return e.map((o,i)=>se(o,t,n,r,ae(s,i)))}function zf(e,t,n,r){let s=Ae(e),o=(i)=>{if(!s.slice(i.length).includes("/"))return t;return zr(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?zr(s.slice(0,s.lastIndexOf("/")),t,n,r):void 0;return}function zr(e,t,n,r){let s=Ae(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=Mo(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(dl(),s.slice(8));if(s.startsWith("document#/"))return be(globalThis.document,s.slice(10));return be(t,s)??null}function Kf(e,t,n,r){let s=Ae(e);if(s.startsWith("$map/")){let o=s.split("/"),[,i]=o,l,c=Mo(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:Mo(t)??t}}if(s.startsWith("#/state/")){let o=s.slice(8);if(o.indexOf("/")===-1)return{key:o,obj:t};let l=Le(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 Me(e,t,n,r,s){let o=Gf(e,t,n,r,s);return s?.report(s.path??[],o),o}function ll(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 Gf(e,t,n,r,s){let{operator:o,target:i,value:l,initial:c}=e;if(!Vf.has(o))throw Error(`$expression: unknown operator "${o}"`);if(Io.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=sn(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>al)throw Error(`$expression: call depth exceeded (${al})`);let f=Array.isArray(l)?l.map((d,x)=>se(d,t,n,r,ae(s,["value",x]))):[];if(a.startsWith("window#/")){if(!ml(a))throw Error(`$expression: "${a}" is not a blessed pure global`);let d=a.slice(8),x=Hf.get(d);if(x)return x(...Bf(d,f,t));let w=dl(),g=be(w,d),m=d.lastIndexOf("/"),b=m===-1?w:be(w,d.slice(0,m));return g.apply(b,f)}let p=zr(a,t,n,r);if(je(p))return p.apply(zf(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 Me(d.$expression,t,n,{args:x,callDepth:u})}throw TypeError(`$expression: call target "${a}" is not callable`)}if(Vo.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(Lo.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 ll(o,a,u)}}if(pl.has(o)){let a=se(l,t,n,r,ae(s,"value")),{obj:u,key:f}=Kf(i.$ref,t,n,r);u[f]=o==="="?a:ll(o.slice(0,-1),u[f],a);return}if(fl.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(Wo.has(o)){let a=se(i,t,n,r,ae(s,"target")),u=l===void 0?[]:Array.isArray(l)?gl(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(Fo.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=Me(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)=>Me(u,t,n,{...r,index:p,item:f},p===0?ae(s,"value"):void 0));if(o==="filter")return a.filter((f,p)=>Me(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(Kr(e))return Te(e,t);if(sn(e))return qo(e.$ref,t);if(Array.isArray(e))return e.map((n)=>ce(n,t)).join(", ");return JSON.stringify(e)}function Yf(e){return`_fx_${e.replaceAll(/[^A-Za-z0-9_$]/g,"_")}`}function qo(e,t){let n=Ae(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 cl(e,t){if(sn(e))return qo(e.$ref,t);return ce(e,t)}function Xf(e,t,n){let r=(i)=>t[i]??"undefined",s=`(${n.statePrefix??"state"}?.$page?.locale ?? ${JSON.stringify(st)})`,o=JSON.stringify(To);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(Io.has(n)&&!("value"in e)){let i=ce(r,t);if(n==="!")return`!(${i})`;if(n==="-")return`-(${i})`}if(n==="call"){let i=(sn(r)?r.$ref:void 0)??"",l=Array.isArray(s)?s.map((c)=>ce(c,t)):[];if(i.startsWith("window#/")){if(!ml(i))throw Error(`$expression: "${i}" is not a blessed pure global`);let c=Xf(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`${Yf(c)}(${t.statePrefix??"state"}, { ${u} })`}}return`${qo(i,t)}(${l.join(", ")})`}if(Vo.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(Lo.has(n)){let i=ce(r,t),l=ce(s,t);return`(${i} ${n} ${l})`}if(pl.has(n)){let i=cl(r,t),l=ce(s,t);return`${i} ${n} ${l}`}if(fl.has(n)){let i=cl(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(Wo.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(Fo.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 on(e,t,n,r){return se(e,t,n,r)}function gt(e,t={}){return ce(e,t)}var ul,Io,Lo,pl,fl,Fo,Vo,Wo,Vf,Wf,Hf,qf,al=64,Uf=64;var an=v(()=>{Po();K();rn();ul=new Set(["=","+=","-=","*=","/=","push","pop","shift","unshift","splice"]),Io=new Set(["!","-"]),Lo=new Set(["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]),pl=new Set(["=","+=","-=","*=","/="]),fl=new Set(["push","pop","shift","unshift","splice"]),Fo=new Set(["reduce","map","filter"]),Vo=new Set(["?:","switch"]),Wo=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"]),Vf=new Set([...ul,...Io,...Lo,...Fo,...Vo,...Wo,"call"]),Wf=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",...ko]),Hf=new Map([["Intl/compare",(e,t,n,r)=>new Intl.Collator(n??st,r).compare(e,t)],["Intl/displayName",(e,t,n,r)=>new Intl.DisplayNames(n??st,{...r,type:t??"language"}).of(e)],["Intl/formatDate",(e,t,n)=>new Intl.DateTimeFormat(t??st,{timeZone:To,...n}).format(new Date(e))],["Intl/formatList",(e,t,n)=>new Intl.ListFormat(t??st,n).format(e)],["Intl/formatNumber",(e,t,n)=>new Intl.NumberFormat(t??st,n).format(e)],["Intl/formatRelativeTime",(e,t,n,r)=>new Intl.RelativeTimeFormat(n??st,r).format(e,t)],["Intl/plural",(e,t,n)=>new Intl.PluralRules(t??st,n).select(e)],["Intl/segment",(e,t,n)=>[...new Intl.Segmenter(n??st,{granularity:t??"grapheme"}).segment(e)].map((r)=>r.segment)]]);qf=/^(?:\$args\/|\$reduce\/|\$map\/|window#\/|document#\/|event#\/)/});function Zf(e){return e.startsWith(hl)}function jx(e){let t=e;if(Zf(t))t=t.slice(hl.length);return t=t.replace(/^\.\//,"").replace(/\.(js|ts|mjs|mts)$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,""),`${Uo}${t}.js`}function Ax(e){let t=/\.(\w+)$/.exec(e)?.[1]??"",n=e.replace(/\.\w+$/,"").replaceAll("@","").replaceAll(/[/\\]+/g,"-").replaceAll(/[^\w.-]/g,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"");return t===""?`${Uo}${n}`:`${Uo}${n}.${t}`}function yl(e){let t=e.replaceAll("\\","/");return t.length>1&&t.endsWith("/")?t.slice(0,-1):t}function xl(e){let t=yl(e);return t.startsWith("/")?t:`/${t}`}function Qf(e,t){return[...e].toSorted((n,r)=>r[t].length-n[t].length)}function Cx(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 Qf(e,"urlPrefix")){let o=xl(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`${yl(s.dir)}/${l.join("/")}`}return null}function Nx(e,t){let n=new Set;for(let r of t){let s=xl(r.urlPrefix),o=new RegExp(`${s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}/[^${ed}]+`,"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 td(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 nd(e){return e.map(({url:t,descriptor:n})=>n?`${t} ${n}`:t).join(", ")}function Rx(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 ln(e,t){if(e===""||!t.startsWith("/")||t.startsWith("//"))return t;if(t===e||t.startsWith(`${e}/`))return t;return e+t}function Tx(e,t){let n=new URL(t);if(!n.pathname.endsWith("/"))n.pathname+="/";return new URL(e.replace(/^\/+/,""),n).href}var hl="npm:",Uo="/assets/",ed;var Gr=v(()=>{K();ed=String.raw`"'\s<>()\\`});function bl(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 rd(e){return(j(e)||je(e))&&"then"in e&&je(e.then)}async function cn(e,t,n,r={}){let s=r.args?{args:r.args}:void 0;for(let o of e){let i=bl(o);switch(i.kind){case"expression":{let l=Me(i.node,t,n,s);if(rd(l))await l;break}case"if":{let l=i.node,c=on(l.if,t,n,s)?l.then:l.else;if(Array.isArray(c))await cn(c,t,n,r);break}case"switch":{let l=i.node,c=String(on(l.$switch,t,n,s)),a=l.cases??{},u=Object.hasOwn(a,c)?a[c]:l.default;if(Array.isArray(u))await cn(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=on(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 Fe(e,t={}){let n=t.indent??"",r=[];for(let s of e){let o=bl(s);switch(o.kind){case"expression":{r.push(`${n}${Te(o.node,t)};`);break}case"if":{let i=o.node,l=gt(i.if,t),c={...t,indent:`${n} `};if(r.push(`${n}if (${l}) {`,Fe(i.then??[],c)),i.else)r.push(`${n}} else {`,Fe(i.else,c));r.push(`${n}}`);break}case"switch":{let i=o.node,l=gt(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)}: {`,Fe(u,c),`${n} break;`,`${n} }`);if(i.default)r.push(`${n} default: {`,Fe(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: ${gt(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 Yr=v(()=>{K();an()});var zo=v(()=>{K()});function Xo(e){if(e===sd)return"client";if(e===od)return"server";return null}function id(e){return e.replaceAll("\\","/").replace(/^(?:\.\/)+/,"")}function Sl(e,t){return`${Yo}${id(e)}#${t}`}function wl(e){return e.startsWith(Yo)}function El(e){if(!wl(e))return null;let t=e.slice(Yo.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 Ko(e,t){if(Array.isArray(e)){let r=e.map((s)=>Ko(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=Xo(s);o=i===null?s:Sl(t,i)}else if(r!=="$script")o=Ko(s,t);if(o!==s)n??={...e},n[r]=o}return n===null?e:n}function Zo(e,t){return Ko(e,t)}function cd(e){return ad.test(e)&&!ld.test(e)}function $l(e){return Xo(e)==="client"||El(e)?.side==="client"}function Go(e,t,n){if(Array.isArray(e)){for(let[r,s]of e.entries())Go(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")Go(s,[...t,r],n);return n}function ud(e){let t=e.at(-1);return y(t)?`"${t}"`:"this entry"}function Fx(e){let t=Go(e,[],[]),n=t.some((s)=>!s.lazy&&$l(s.src)),r=[];for(let s of t){let o=ud(s.path);if(!s.lazy&&cd(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&&$l(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 Yo="jx-script:",sd="#client",od="#server",ad,ld;var Qo=v(()=>{K();ad=/^\.{1,2}\//u,ld=/\.json$/iu});function gd(e){for(let t of Object.keys(e))if(md.has(t))return!0;return!1}function Xr(e){if(!e.startsWith("${")||!e.endsWith("}"))return!1;let[t,...n]=Ta(e);return t!==void 0&&n.length===0&&t.start===0&&t.end===e.length}function Ol(){return[...Jl].toSorted()}function ot(e,t){let n=e.toLowerCase();if(n.startsWith("aria-")||Jl.has(n))return String(t);return t?"":null}function jl(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 Al(e,t,n,r){let s=Qt(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 ei(e){let t=vl.get(e);if(t)return t;let n=new Set,r=rt(e);for(let[s,o]of Object.entries(e.state??{}))if(y(o)?B(o):Ne(o)?!et(o)&&!Ke(o.$expression.operator):r.get(s)==="computed")n.add(s);return vl.set(e,n),n}function Cl(e){let t=e.state??{},n=ei(e),r=(s)=>(s in t)&&!n.has(s);return{checked:r("checked"),disabled:r("disabled"),required:r("required"),value:r("value")}}function ti(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(hd.some((s)=>(s in r))){t.set(n,void 0);continue}if(gd(r))continue}t.set(n,r)}return t}var md,Ge,Jl,pb,vl,hd,ni=32,Zr,Qr="jx-slot",ri="data-jx-slots",si="jx.slot.group",fb;var Yn=v(()=>{Kn();an();rn();K();en();Gr();Yr();zo();Qo();zo();Kn();md=new Set(["type","properties","items","enum","minimum","maximum","minLength","maxLength","pattern","required","examples"]);Ge=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"]),Jl=new Set(["contenteditable","draggable","spellcheck"]);pb=Object.freeze({emptyRow:!0});vl=new WeakMap;hd=["$expression","$prototype","$ref","$src"],Zr=/^[\t\n\f\r ]+$/u,fb=(()=>{let e=Symbol.for(si),t=globalThis;return t[e]??=new WeakMap,t[e]})()});function bd(){if(!Xn){Xn=new Map;for(let[e,t,n]of xd){let r=Xn.get(e);if(!r)r=new Map,Xn.set(e,r);for(let s of t.split(" "))r.set(s,n)}}return Xn}function Rl(e,t){return Nl??=new Map(yd),Nl.get(t)??bd().get(t)?.get(e.toLowerCase())??null}function oi(e,t){if(t==="innerText")return!0;if(t==="value"||t==="defaultValue")return $d.has(e.toLowerCase());return t==="text"&&Sd.has(e.toLowerCase())}var h=(e,t={})=>({attribute:e,kind:"text",...t}),D=(e,t={})=>({attribute:e,kind:"boolean",...t}),es,yd,xd,Nl,Xn,$d,Sd;var Tl=v(()=>{es={live:!0},yd=[["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")]],xd=[["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",es)],["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",es)],["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",es)],["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",es)],["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")]];$d=new Set(["output","textarea"]),Sd=new Set(["a","option","title"])});var wd,Ed;var kl=v(()=>{wd={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."},Ed={anyOf:[{$ref:"#/$defs/TagName"},{additionalProperties:!1,properties:{$expression:{$ref:"#/$defs/TagExpression"}},required:["$expression"],type:"object"}]}});var vd;var Pl=v(()=>{vd={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 Jd,Od,jd;var _l=v(()=>{Jd={oneOf:[{type:"string"},{$ref:"#/$defs/RefObject"}]},Od={oneOf:[{type:"boolean"},{$ref:"#/$defs/RefObject"}]},jd={oneOf:[{type:"number"},{$ref:"#/$defs/RefObject"}]}});var Ad;var Ml=v(()=>{Ad={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 Cd,Nd;var Dl=v(()=>{Cd={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"},Nd={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 Rd;var Il=v(()=>{Rd={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 Td;var Ll=v(()=>{Td={enum:["string","number","integer","boolean","array","object","null"],type:"string"}});var kd,Pd,_d,Md,Dd,Id,Ld,Fd,Vd;var Fl=v(()=>{kd={description:"Reference to a $defs type definition in the current component.",examples:["#/$defs/Count","#/$defs/TodoItem","#/$defs/Status"],pattern:String.raw`^#/\$defs/`,type:"string"},Pd={description:"Reference to a state entry (runtime variable) in the current component.",examples:["#/state/count","#/state/addTask","#/state/items"],pattern:"^#/state/",type:"string"},_d={description:"Reference to an external Jx component file.",examples:["./card.json","https://cdn.example.com/button.json"],pattern:String.raw`^(\./|\.\./).*\.json$|^https?://`,type:"string"},Md={description:"Reference to a window or document global.",examples:["window#/currentUser","document#/appConfig"],pattern:"^(window|document)#/",type:"string"},Dd={description:"Reference to a named state entry passed via $props from a parent component.",examples:["parent#/sharedState","parent#/theme"],pattern:"^parent#/",type:"string"},Id={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"},Ld={oneOf:[{$ref:"#/$defs/InternalRef"},{$ref:"#/$defs/StateRef"},{$ref:"#/$defs/ExternalRef"},{$ref:"#/$defs/GlobalRef"},{$ref:"#/$defs/ParentRef"},{$ref:"#/$defs/MapRef"}],type:"string"},Fd={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"},Vd={properties:{$props:{$ref:"#/$defs/PropsObject"},$ref:{$ref:"#/$defs/ExternalRef"}},required:["$ref"],type:"object"}});var Wd;var Vl=v(()=>{Wd={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 Hd,Bd;var Wl=v(()=>{Hd={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"},Bd={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 qd,Ud,zd,Kd,Gd,Yd;var Hl=v(()=>{qd={additionalProperties:{oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{$ref:"#/$defs/RefObject"}]},description:"HTML attributes and ARIA attributes set via element.setAttribute().",type:"object"},Ud={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"},zd={oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"null"},{$ref:"#/$defs/RefObject"}]},Kd={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"},Gd={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"},Yd={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 Xd;var Bl=v(()=>{Xd={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 Zd;var ql=v(()=>{Zd={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 Qd,em;var Ul=v(()=>{Qd={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"}]},em={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 ii,tm;var zl=v(()=>{ii=["Function","Request","URLSearchParams","FormData","LocalStorage","SessionStorage","Cookie","IndexedDB","Array","Set","Map","Blob","ReadableStream"],tm={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 nm;var Kl=v(()=>{nm={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 rm,sm,om,im,am,lm,cm,um,pm,fm,dm,mm,gm,hm,ym,xm,bm;var Gl=v(()=>{Po();rm={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"},sm={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."},om={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."},im={enum:["!","-"]},am={enum:["+","-","*","/","%","===","!==","<","<=",">",">=","&&","||","??"]},lm={const:"?:"},cm={const:"switch"},um={const:"call"},pm={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"]},fm={enum:["=","+=","-=","*=","/="]},dm={enum:["pop","shift"]},mm={enum:["push","unshift"]},gm={const:"splice"},hm={const:"reduce"},ym={enum:["map","filter"]},xm={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 "+`${sl()}) — 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"},bm={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 $m,Sm,wm,Em;var Yl=v(()=>{$m={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"}]},Sm={additionalProperties:{$ref:"#/$defs/StateEntry"},description:"Map of runtime variables. Keys are camelCase (public) or #-prefixed (private). All entries are reactive by default.",type:"object"},wm={additionalProperties:{$ref:"#/$defs/TypeDefEntry"},description:"Map of reusable JSON Schema type definitions. Keys are PascalCase type names. No runtime artifacts are produced.",type:"object"},Em={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 Xl,vm,Jm,Om,jm,Am,Cm,Nm,Rm,Tm,km;var Zl=v(()=>{Xl=["method","accessor","parse","serialize","rewrite","discover","load","projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"],vm={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"},Jm={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"},Om={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"},jm={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:Xl,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"},Am={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"},Cm={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"},Nm={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"},Rm={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"},Tm={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"},km={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 un(e){if(!y(e)||e.trim()==="")return null;try{return new Intl.Locale(e.trim()).toString()}catch{return null}}function Lb(e){let t=un(e);if(t===null)return"ltr";let n=new Intl.Locale(t),r=n.script??n.maximize().script;return r!==void 0&&Pm.has(r)?"rtl":"ltr"}function Fb(e){let t=un(e);if(t===null)return y(e)?e:"";return new Intl.DisplayNames([t],{type:"language"}).of(t)??t}function Vb(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 c of r){let a=un(c);if(a===null){n.push(`i18n.locales: "${String(c)}" is not a well-formed BCP 47 language tag.`);continue}if(!s.includes(a))s.push(a)}let o=un(t.defaultLocale)??s[0]??null;if(t.defaultLocale!==void 0&&un(t.defaultLocale)===null)n.push(`i18n.defaultLocale: "${String(t.defaultLocale)}" is not a well-formed BCP 47 language tag.`);if(o===null)return n.push("i18n is declared with no usable locale — set `defaultLocale` or `locales`."),{errors:n,i18n:null};let i=[o,...s.filter((c)=>c!==o)],l=t.routing==="prefix-always"||t.routing==="prefix-except-default"?t.routing:_m;return{errors:n,i18n:{defaultLocale:o,locales:i,routing:l}}}function Wb(e,t){if(t===null)return null;let n=e.split("/").find(Boolean);if(n===void 0)return t.defaultLocale;let r=un(n);return r!==null&&t.locales.includes(r)?r:t.defaultLocale}var Pm,ts="^[A-Za-z]{2,8}(-[A-Za-z0-9]{1,8})*$",_m="prefix-except-default";var Ql=v(()=>{K();Pm=new Set(["Adlm","Arab","Aran","Armi","Avst","Cprt","Egyd","Egyh","Elym","Gara","Hatr","Hebr","Hluw","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogd","Sogo","Syrc","Thaa","Todr","Yezi"])});var ec,tc="utf-8",Mm;var nc=v(()=>{Ql();ec=[301,302,303,307,308],Mm={description:"Schema for Jx project.json files. A project.json file is the root anchor file for a Jx project, declaring site metadata, default settings, global styles, extensions, and build configuration. Open by design: extension-contributed sections (e.g. `content`) are opaque top-level keys; the generated per-project entry document (project.schema.json) closes the composition.",properties:{$defs:{description:"JSON Schema type definitions, tooling only. A document's #/$defs/Name reference resolves here when the document does not define Name itself.",type:"object"},$elements:{description:"Global custom element dependencies available to all pages. Items are $ref objects or npm package specifier strings.",items:{oneOf:[{additionalProperties:!1,properties:{$ref:{type:"string"}},required:["$ref"],type:"object"},{type:"string"}]},type:"array"},$head:{description:"Global <head> entries applied to all pages. Array of element definitions for meta tags, link tags, script tags, etc.",examples:[[{attributes:{href:"/favicon.svg",rel:"icon"},tagName:"link"},{attributes:{content:"Jx",name:"generator"},tagName:"meta"}]],items:{properties:{attributes:{additionalProperties:{type:"string"},type:"object"},tagName:{type:"string"}},type:"object"},type:"array"},$media:{additionalProperties:{type:"string"},description:'Named media breakpoints following CSS @custom-media convention. Available in all component style objects. Declaring a pure color-scheme query (e.g. "--dark": "(prefers-color-scheme: dark)") additionally opts the site into the forced-scheme contract: @--dark style blocks are dual-emitted so a data-color-scheme attribute on <html> overrides the OS preference, color-scheme is declared on :root, and a pre-paint script restores the '+"visitor's persisted choice (spec §9.5).",examples:[{"--dark":"(prefers-color-scheme: dark)","--lg":"(min-width: 1024px)","--md":"(min-width: 768px)","--sm":"(min-width: 640px)"}],type:"object"},$schema:{description:"Relative path to the generated per-project schema (conventionally ./project.schema.json, written by `jx schema`).",type:"string"},build:{description:"Build configuration.",properties:{adapter:{description:"Platform adapter for deployment-specific output.",enum:["static","cloudflare-pages","cloudflare-workers","node","bun"],type:"string"},deploy:{additionalProperties:!1,description:"Deployment tracking: the hosting project this repo publishes to. Identifiers "+"only (no secrets) — safe to commit; Studio uses it to tell whether the publish "+"workflow already exists. `adapter` says how the build is packaged; `deploy` says where it ships.",properties:{accountId:{description:"Hosting account id (e.g. the Cloudflare account id).",type:"string"},productionUrl:{description:"Production URL of the connected hosting project.",type:"string"},projectName:{description:"Hosting project name (e.g. the Cloudflare Pages project).",pattern:"^[a-z0-9][a-z0-9-]*$",type:"string"},provider:{description:"Hosting provider the project is connected to.",enum:["cloudflare-pages"],type:"string"}},required:["provider","accountId","projectName"],type:"object"},format:{default:"directory",description:"Reserved; currently unused. Accepted for forward compatibility with single-file output (desktop single-file mode) — the build emits per-route directories regardless.",enum:["directory","single"],type:"string"},outDir:{default:"./dist",description:"Output directory for compiled site.",type:"string"},headers:{additionalProperties:!1,description:"Emit dist/_headers — the response headers only the build can know. Honored by "+"Cloudflare Pages/Workers assets and Netlify; on the node/bun adapters the file documents what a reverse proxy in front of them must send.",properties:{cache:{default:"auto",description:'"auto" marks the content-addressed image variants immutable (RFC 8246) and revalidates everything else (RFC 9111). "off" emits no Cache-Control at all.',enum:["auto","off"],type:"string"},enabled:{default:!0,type:"boolean"},rules:{additionalProperties:{additionalProperties:{type:"string"},type:"object"},description:"Verbatim rules, merged after the generated block.",propertyNames:{pattern:"^/"},type:"object"},security:{additionalProperties:!1,properties:{contentTypeOptions:{default:!0,type:"boolean"},csp:{default:!1,description:"CSP Level 3. Off by default: unlike the other security headers this one "+"governs code the build cannot see — a third-party script that loads a "+"second script, a widget that opens a frame — so turning it on is a change "+"to verify in the browser console, not a safe default. `script-src` is derived from the inline scripts and external origins the build emitted; `style-src` keeps 'unsafe-inline', because per-page <style> blocks and per-element style attributes have no site-wide hash.",oneOf:[{type:"boolean"},{const:"report-only"},{additionalProperties:!1,properties:{directives:{additionalProperties:{oneOf:[{type:"string"},{const:!1}]},description:"Replace (string) or remove (false) a computed directive. A replacement is wholesale, so an addition restates the defaults.",type:"object"},mode:{default:"enforce",enum:["enforce","report-only"]},reportUri:{format:"uri-reference",type:"string"},sources:{additionalProperties:{oneOf:[{type:"string"},{items:{type:"string"},type:"array"}]},description:"Add sources to a computed directive without restating it. Each entry is appended after the derived sources (the script hashes and collected origins stay), skipped if already present. A directive the policy does not carry is created from the one a browser falls back to, `default-src` for the fetch directives. For origins that arrive only at runtime. A directive named here and in `directives` is a build error.",propertyNames:{pattern:"^[A-Za-z][A-Za-z0-9-]*$"},type:"object"}},type:"object"}]},frameOptions:{default:"SAMEORIGIN",oneOf:[{enum:["DENY","SAMEORIGIN"],type:"string"},{const:!1}]},hsts:{default:!1,description:"RFC 6797. Off by default: a wrong max-age locks the apex domain to HTTPS for that long, and the mistake is invisible until a certificate lapses. `preload` requires `includeSubDomains` and is a build error without it.",oneOf:[{type:"boolean"},{additionalProperties:!1,properties:{includeSubDomains:{default:!0,type:"boolean"},maxAge:{default:31536000,minimum:0,type:"integer"},preload:{default:!1,type:"boolean"}},type:"object"}]},permissionsPolicy:{default:"camera=(), microphone=(), geolocation=()",oneOf:[{type:"string"},{const:!1}]},referrerPolicy:{default:"strict-origin-when-cross-origin",oneOf:[{enum:["no-referrer","no-referrer-when-downgrade","origin","origin-when-cross-origin","same-origin","strict-origin","strict-origin-when-cross-origin","unsafe-url"],type:"string"},{const:!1}]}},type:"object"}},type:"object"},sitemap:{default:!0,description:"Generate sitemap.xml from the route table (requires `url`). Set false to disable.",type:"boolean"},trailingSlash:{default:"always",description:"Trailing slash behavior for generated URLs.",enum:["always","never","ignore"],type:"string"}},type:"object"},copy:{additionalProperties:{type:"string"},description:"Declarative file copy map. Keys are source paths (relative to project root), values are destination paths (relative to outDir).",type:"object"},defaults:{description:"Default settings applied to all pages unless overridden.",properties:{charset:{default:tc,description:"The <meta charset> every page declares. The HTML Standard allows only utf-8, which is the default.",type:"string"},dir:{description:"Base direction for the <html> element. Omitted when unset — a page's `$dir` "+"overrides it. Right-to-left content renders left-to-right without this.",enum:["ltr","rtl","auto"],type:"string"},lang:{default:"en",description:"Default lang attribute for the <html> element. A page's `$lang` overrides it.",type:"string"},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:ts,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:ts,type:"string"},locales:{description:"Available locales, as BCP 47 language tags.",examples:[["en","fr","de"]],items:{pattern:ts,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:[...ec],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 Dm;var rc=v(()=>{Dm={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 zb="https://jxsuite.com/schema/project/fields/v2",Kb="https://jxsuite.com/schema/document/paths/v2",Im,Lm,Gb,Yb;var sc=v(()=>{Im={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"},Lm={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"},Gb=[{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"}],Yb={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 oc=v(()=>{kl();Pl();_l();Ml();Dl();Il();Ll();Fl();Vl();Wl();Hl();Bl();ql();Ul();zl();Kl();Gl();Yl();Zl();nc();rc();sc()});function ic(e,t,n){let r=e.$description;if(y(r))(Object.keys(t).length>0?t:n).$description=r}function ac(e,t,n,r,s=Fm,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 nn(p,x))i.push(o.comments===!0?zn(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(Un(p)||p.startsWith("@")||p.startsWith("$"))continue;if(p.startsWith("--")||p==="colorScheme"||p==="color-scheme")c[p]=d;else a[p]=d}ic(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(Bn(p)||qn(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}ic(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)=>ft(p)!==null)&&!("colorScheme"in e))i.push(`${s.root} { color-scheme: light dark }`,`${s.root}:where([${ze}="light"]) { color-scheme: light }`,`${s.root}:where([${ze}="dark"]) { color-scheme: dark }`);return i.join(`
|
|
14
|
+
`)}var Fm;var lc=v(()=>{Kn();K();Fm={body:"body",root:":root"}});function uc(e){return Vm.has(e.toLowerCase())?"block":"inline"}function pc(e){let t=e;for(let r=cc.exec(t);r;r=cc.exec(t))t=t.slice(r[0].length);if(t==="")return null;let n=Wm.exec(t);return n?uc(n[1]):"text"}function fc(e){let t=e;while(t.endsWith("-->")){let r=t.lastIndexOf("<!--");if(r===-1)break;t=t.slice(0,r)}if(t==="")return null;let n=Hm.exec(t)??Bm.exec(t);return n?uc(n[1]):"text"}function qm(e,t){let n=fc(e),r=pc(t);if(n===null||r===null)return!1;return n!=="text"&&r!=="text"&&(n==="block"||r==="block")}function Ce(e,t={}){let{lead:n="",preformatted:r=!1,separator:s=`
|
|
15
|
+
`}=t;if(r)return e.join("");let o=e.filter((l)=>l!==""&&l!==n),i="";for(let[l,c]of o.entries()){if(l===0){i=c;continue}let a=o[l-1],u=ai(c,n);i+=qm(a,u)?`${s}${c}`:u}return i}function ns(e,t){let{close:n,lead:r="",open:s}=t;if(e==="")return e;let o=pc(ai(e,r)),i=fc(e),l=o==="block"?s:"",c=i==="block"?n:"";return`${l}${l===""?ai(e,r):e}${c}`}function li(e,t){let{close:n,open:r,...s}=t,o=Ce(e,s);return s.preformatted?o:ns(o,{close:n,lead:s.lead,open:r})}function ai(e,t){return e.startsWith(t)?e.slice(t.length):e}var Vm,cc,Wm,Hm,Bm;var Zn=v(()=>{Vm=new Set(["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","search","section","summary","table","tbody","td","tfoot","th","thead","tr","ul","xmp"]);cc=/^<!--[\s\S]*?-->/u,Wm=/^<([a-zA-Z][^\s/>]*)/u,Hm=/<\/([a-zA-Z][^\s>]*)\s*>$/u,Bm=/<([a-zA-Z][^\s/<>]*)(?:\s[^<]*)?>$/u});function dc(e,t){return t===null?e:":host"}var rs=v(()=>{Kn()});function or(e,t){let n=[];for(let[r,s]of(e.parameters??[]).entries()){let o=gc(s);if(!o)continue;let i=hc(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 gc(e){return y(e)?e:e?.name??""}function hc(e){return j(e)&&"default"in e}function Um(e,t){let n=yc(e,t);return n===e?e:`${n} as ${e}`}function yc(e,t){let n=t?.$export;return y(n)&&n!==""?n:e}function cs(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(`
|
|
16
|
+
`)}function us(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`${mt(w)}: ${JSON.stringify(g)}`;if(zm.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`${mt(w)}: ${gt({$ref:g.$ref},{statePrefix:r})}`}),u=c.some(([,w])=>_(w)),f=`${kc}(${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(`
|
|
17
|
+
`)}function Km(e,t){if(t==="state")return e;return e.replaceAll(/\$\{([^}]*)\}/g,(n,r)=>`\${${r.replaceAll(/(?<!this\.)\bstate\./g,`${t}.`)}}`)}function mc(e){return`<script type="importmap">
|
|
17
18
|
{
|
|
18
19
|
"imports": {
|
|
19
20
|
${Object.entries(e).map(([n,r])=>` ${JSON.stringify(n)}: ${JSON.stringify(r)}`).join(`,
|
|
20
21
|
`)}
|
|
21
22
|
}
|
|
22
23
|
}
|
|
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
|
-
|
|
25
|
-
function ${It}(n, v) {
|
|
24
|
+
</script>`}function dn(e){if(e.runtimeImports!==void 0)return mc(e.runtimeImports);let t={"@vue/reactivity":e.reactivitySrc,"lit-html":e.litHtmlSrc};return mc(e.litHtmlSrc===Jt?{...t,"lit-html/":`${Jt}/`}:t)}function bc(e,t){let n=t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),r=String.raw`\bstate${er}\??\.${er}${n}(?![\w$])`,s="(?:\\\\\"|['`])",o=String.raw`\bstate${er}(?:\?\.)?\[${er}${"(?:\\\\\"|['`])"}${n}${"(?:\\\\\"|['`])"}`,i=String.raw`#/state/${n}(?=["/])`;return new RegExp(`${r}|${o}|${i}`).test(e)||Gm.test(e)}function $c(e,t){let n=Bo(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||bc(o,a)));for(let a of l)for(let u of Ho(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 Ym(e){let t=Object.fromEntries(Object.entries(e.state??{}).filter(([,n])=>!Gn(n)));return JSON.stringify({...e,state:t})}function ps(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(Gn(s)){if(n??=Ym(e),bc(n,r))return!0;continue}if(s.$prototype)return!0;if("default"in s)return!0;if(vt(s))continue;return!0}}if(e.$switch)return!0;if(Q(e)||Aa(e.children))return!0;if(Array.isArray(e.children)&&e.children.some((n)=>ps(n)))return!0;let t=mn(e);for(let[n,r]of Object.entries(e)){if(Ge.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 mn(e){return e.$static===!0||e.$prerendered===!0}function gn(e,t=null,n={},r={}){let s=e?.state?fi(e.state,t):t??is();return{media:r,scope:s,scopeDefs:n}}function is(e=null){return Object.create(e)}function di(e){return e[xc]}function Xm(e,t){return di(e)?.has(t)??!1}function ir(e,t){if(!e.startsWith("#/state/"))return!1;let[n=""]=e.slice(8).split("/");return Xm(t,n.replaceAll("~1","/").replaceAll("~0","~"))}function pi(e,t,n){if(t>0&&eg.test(e.charAt(t-1)))return!1;let r=t+5;if(n)return!tg.test(e.charAt(r));while(/\s/u.test(e.charAt(r)))r+=1;return e.charAt(r)==="."}function Sc(e){for(let t=e.indexOf("state");t!==-1;t=e.indexOf("state",t+1))if(pi(e,t,!0)&&!pi(e,t,!1))return!0;return!1}function hn(e,t,n={}){if(!e.includes("state"))return e;let r=n.bare===!0,s=n.code===!1?e:Dt(e),o="",i=0;for(let l=s.indexOf("state");l!==-1;l=s.indexOf("state",l+1))if(pi(s,l,r))o+=e.slice(i,l)+t,i=l+5;return o+e.slice(i)}function as(e,t){if(y(e)){if(!e.includes("state."))return;let o=Dt(e);for(let i of o.matchAll(Zm))t.add(i[1]);for(let i of o.matchAll(Qm))t.add(i[1]);return}if(Array.isArray(e)){for(let o of e)as(o,t);return}if(!j(e))return;let n=e,{operator:r,target:s}=n;if(y(r)&&Ke(r)&&_(s)&&s.$ref.startsWith("#/state/"))t.add(s.$ref.slice(8).split("/")[0]);for(let o of Object.values(n))as(o,t)}function os(e,t){for(let n of $n(e)){if(Q(n)){os(n.map?[n.map]:[],t);continue}if(!qe(n))continue;for(let[r,s]of Object.entries(n))if(r.startsWith("on")&&(me(s)||Ne(s)))as(s.body??s.$expression,t);os(Object.values(n.cases??{}).filter((r)=>qe(r)&&!ee(r)),t),os(n.children,t)}}function yt(e,t){if(me(t)&&jo(t))throw Error(`${e} declares both "body" and "$src"; they are mutually exclusive (spec.md §5.3 4d). Keep one.`)}function fs(e,t){let n={eager:new Map,lazy:new Map};for(let[r,s]of Object.entries(e)){if(yt(`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:yc(r,s)});continue}let o=n.eager.get(s.$src);if(!o)o=new Set,n.eager.set(s.$src,o);o.add(Um(r,s))}return n}function ds(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 fi(e={},t=null,n={}){let r=is(t),s=t?di(t):void 0,o=new Set(s);if(Object.defineProperty(r,xc,{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))as(p.body??p.$expression,f);if(n.document)os([n.document],f);for(let p of f)if(p in e)o.add(p)}let i=rt({state:e});for(let[f,p]of Object.entries(e)){if(!j(p)||Array.isArray(p)){ht(r,f,ss(p));continue}if("default"in p){ht(r,f,ss(p.default));continue}if(pt(p)){o.add(f);continue}if(!p.$prototype&&!("$expression"in p)&&!vt(p))ht(r,f,ss(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)]),et(p)){let x=p.parameters;ht(r,f,(...w)=>{let g={};for(let[m,b]of x.entries()){let S=gc(b);if(!S)continue;g[S]=w[m]===void 0&&hc(b)?b.default:w[m]}return Me(d,r,null,{args:g})})}else if(Ke(d.operator))ht(r,f,(x,w)=>Me(d,x,w));else ci(r,f,()=>Me(d,r,null));continue}if(me(p)){if(yt(`state entry "${f}"`,p),tt(p)){let{body:d}=p;a.push([f,JSON.stringify(d)]),ht(r,f,(x,w)=>{cn(d,x??r,w??null)})}else if(y(p.body)){let{body:d}=p,x=Function(...nt(p),d);if(i.get(f)==="computed")ci(r,f,()=>x(r)),c.push([f,d]);else ht(r,f,x),a.push([f,d])}else ht(r,f,()=>{}),o.add(f);continue}if(ut(p)&&(p.$prototype==="LocalStorage"||p.$prototype==="SessionStorage")){ht(r,f,ss(p.default??null));continue}if(ut(p)&&p.$prototype==="Request")o.add(f);if(xn(p))o.add(f)}let u=!0;while(u){u=!1;for(let[f,p]of[...c,...l])if(!o.has(f)&&Ec(p,r))o.add(f),u=!0;for(let[f,p]of a)if(!o.has(f)&&ng(p,o))o.add(f),u=!0}for(let[f,p]of l)ci(r,f,()=>mi(p,r));return r}function ht(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}function ci(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:n})}function te(e,t){if(_(e))return wc(e.$ref,t);if(B(e))return mi(e,t);return e}function ee(e){return _(e)}function wc(e,t){if(!y(e))return e;let n=Ae(e);if(n.startsWith("$map/")){let r=n.split("/"),s=r[1],i=t.$map?.[s]??t[`$map/${s}`];return r.length>2?ui(i,r.slice(2).join("/")):i}if(e.startsWith("#/state/"))return ui(t,e.slice(8));return ui(t,e)??null}function Ec(e,t){if(!t)return!1;let n=di(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 ng(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 ms(e){return Xr(e)?`(${e.slice(2,-1)})`:`\`${e}\``}function mi(e,t){if(Ec(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=Xr(e)?`return (${e.slice(2,-1)})`:`return \`${e}\``;return Function(...n,o)(...r)}catch{return null}}function ui(e,t){return be(e,t)}function ss(e){if(!j(e))return e;return structuredClone(e)}function rg(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 sg(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 ot(e.attribute,n)}function Jc(e,t){if(_(e)&&(t===null||ir(e.$ref,t)))return;try{return te(e,t)}catch{return}}function Qn(e,t,n){return n&&t===""?` ${e}`:` ${e}="${G(t)}"`}function It(e,t,n=""){let r=mr(e.tagName,t),s=new Map,o,i=te(e.id,t);if(i)s.set("id",Qn("id",String(i),!1));let l=fr(e),c=l?te(dr(e),t):null,a=[y(c)||Y(c)?String(c):"",Ot(e)??""].filter((w)=>w!=="").join(" ");if(a)s.set("class",Qn("class",a,!1));let u=(w,g)=>{if(g===void 0)return;let m=Rl(r,w);if(!m)return;let b=Jc(g,t);if(m.live&&b!==void 0)o??=new Set,o.add(m.attribute);let S=sg(m,b);if(S!==null)s.set(m.attribute,Qn(m.attribute,S,m.kind!=="text"))};for(let w of vc)u(w,e[w]);let f=e;for(let w of Object.keys(f)){if(ig.has(w)||w.startsWith("$")||w.startsWith("on")||oi(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=ot(w,m);b=E===null?null:Qn(w,E,!0)}else if(y(m)||Y(m))b=Qn(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=[rg(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 ar(e,t,n){if(mn(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||!oi(t,r))continue;let o=Jc(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 gs(){let e=JSON.stringify(qr),t=JSON.stringify(ze);return`(function(){try{var s=localStorage.getItem(${e});if(s==="light"||s==="dark"){document.documentElement.setAttribute(${t},s)}}catch(e){}})()`}function Oc(e,t,n,r,s={}){for(let o of nn(t,{...s,mediaQueries:r,resolveValue:(i,l)=>jc(i,l,n),scope:n}))e.push(zn(o))}function jc(e,t,n){let r=y(t)?t:t.$ref;return ag.push({property:e,selector:n,source:r}),null}function hs(){return`const __jxEnumAttrs = new Set(${JSON.stringify(Ol())});
|
|
25
|
+
function ${Lt}(n, v) {
|
|
26
26
|
if (typeof v !== 'boolean') return v;
|
|
27
27
|
const l = n.toLowerCase();
|
|
28
28
|
if (l.startsWith('aria-') || __jxEnumAttrs.has(l)) return String(v);
|
|
29
29
|
return v ? '' : null;
|
|
30
|
-
}`}function
|
|
30
|
+
}`}function ys(e){let t={keyed:!1,arranged:!1},n=(r)=>{for(let s of $n(r)){if(Q(s)){t.arranged||=_(s.filter)||_(s.sort),t.keyed||=_(s.key),n(s.map?[s.map]:[]);continue}if(!qe(s))continue;n(Object.values(s.cases??{}).filter((o)=>qe(o)&&!ee(o))),n(s.children)}};return n([e]),t}function lg(e,t){for(let r of[e.items,e.filter,e.sort])if(_(r)&&ir(r.$ref,t))return!1;let n=(r)=>{for(let s of $n(r)){if(Q(s)){if(!lg(s,t))return!1;continue}if(!qe(s))continue;let o=Object.values(s.cases??{}).filter((i)=>qe(i)&&!ee(i));if(!n(o)||!n(s.children))return!1}return!0};return n(e.map?[e.map]:[])}function lr(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 xs(e){let t=Ae(e);if(t==="$map/item")return[];return t.startsWith("$map/item/")?Le(t.slice(10)):null}function bs(){return`function ${yn}(items, filter, sort) {
|
|
31
31
|
if (!Array.isArray(items)) return [];
|
|
32
32
|
let list = items;
|
|
33
33
|
if (typeof filter === 'function') list = list.filter(filter);
|
|
34
34
|
if (typeof sort === 'function') list = [...list].sort(sort);
|
|
35
35
|
return list;
|
|
36
36
|
}
|
|
37
|
-
function ${
|
|
37
|
+
function ${Ac}(list, path, pointer, warn) {
|
|
38
38
|
const keys = list.map((item, index) => {
|
|
39
39
|
if (pointer === null) return index;
|
|
40
40
|
if (path === null) {
|
|
@@ -57,88 +57,88 @@ function ${bc}(list, path, pointer, warn) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
return keys;
|
|
60
|
-
}`}function
|
|
61
|
-
`)}function
|
|
62
|
-
`)}function
|
|
63
|
-
`)}function
|
|
64
|
-
`)}function
|
|
65
|
-
`)}function
|
|
66
|
-
`)}function
|
|
67
|
-
`)}function
|
|
68
|
-
`)}function
|
|
69
|
-
${
|
|
60
|
+
}`}function Ss(){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(${yn}(items, filter, sort));`,` this.#snap.value = { list, keys: ${Ac}(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 ${ur} = directive(__JxKeyedList);`,"const __jxLiterals = new Map();",`function ${cr}(text) {`," if (!__jxLiterals.has(text)) __jxLiterals.set(text, JSON.parse(text));"," return __jxLiterals.get(text);","}"].join(`
|
|
61
|
+
`)}function Cc(){return[`function ${gi}(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 ${hi}(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 Nc(){return[`function ${ws}(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 Rc(e){return Qt(e)}function pr(e){let{observedAttributes:t}=e;return Array.isArray(t)?t.filter((n)=>y(n)):[]}function Tc(e){let t=ti(e),n=new Set(pr(e).map((s)=>Rc(s)));return`new Map([${[...t].flatMap(([s,o])=>n.has(s)?[`[${JSON.stringify(s)}, ${o===void 0?"undefined":JSON.stringify(o)}]`]:[]).join(", ")}])`}function Es(){return[`async function ${kc}(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 ug(e){let t={};for(let[n,r]of Object.entries(e))if(!cg.has(n)&&r!==void 0)t[n]=r;return t}function fg(e){return ut(e)&&!pg.has(e.$prototype)}function xn(e){return fg(e)&&e.timing==="client"}function vs(){return[`async function ${Pc}(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 Js(e,t){let n=[],r=new Map;for(let[s,o]of Object.entries(e)){if(!xn(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:ug(o),key:s,name:o.$prototype})}return{entries:n,imports:[...r].map(([s,o])=>`import ${o} from '${s}';`)}}function Os(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} ${Pc}(${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 _c(){return[`function ${yi}(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 Mc(){let e=`new RegExp(${JSON.stringify(Zr.source)}, ${JSON.stringify(Zr.flags)})`,t=`Symbol.for(${JSON.stringify(si)})`,n=JSON.stringify(ri),r=JSON.stringify(Qr);return[`const __jxSlotWs = ${e};`,`const __jxSlotRec = globalThis[${t}] || (globalThis[${t}] = new WeakMap());`,`function ${xi}(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 ${bi}(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 pn(e){for(let t of $n(e)){if(Q(t)){if(t.map&&pn([t.map]))return!0;continue}if(!qe(t))continue;if(t.tagName==="slot")return!0;let n=Object.values(t.cases??{}).filter((r)=>qe(r)&&!ee(r));if(pn(n)||pn(t.children))return!0}return!1}function $n(e){if(Q(e))return[e];if(!Array.isArray(e))return[];return e}function Sn(e,t={},n=null){let r=[],s=ac(j(n)?n:{},t,(i)=>i,jc,void 0,{comments:!0});if(s!=="")r.push(s);if(Fc(e,r,t,"",{n:0}),r.length===0)return"";return`<style>
|
|
69
|
+
${dg(r.join(`
|
|
70
70
|
`))}
|
|
71
|
-
</style>`}function
|
|
72
|
-
|
|
73
|
-
`);return""}function
|
|
74
|
-
`)}function
|
|
75
|
-
`);if(!j(e))return"";if(Q(e))return
|
|
76
|
-
|
|
77
|
-
`):"";M=`<template shadowrootmode="${S}"><link rel="stylesheet" href="${
|
|
71
|
+
</style>`}function dg(e){return e.replaceAll(/<\/(?=style)/gi,String.raw`<\/`)}function Ot(e){return e[Dc]}function Ic(e,t,n){let r=Ot(e);if(r!==void 0)return r;let s=`${n}-${t.n}`;return t.n+=1,e[Dc]=s,s}function js(e){let{children:t}=e;if(Array.isArray(t))return t;return Q(t)?[t]:[]}function nr(e,t){if(!j(e))return;if(Q(e)){if(e.map)nr(e.map,t);return}t(e);for(let n of js(e))nr(n,t);if(j(e.cases))for(let n of Object.values(e.cases))nr(n,t)}function Lc(e,t,n){nr(e,(r)=>{if(r.style)Ic(r,t,n)})}function fr(e){return Ot(e)!==void 0||Boolean(e.className)}function dr(e){let{attributes:t}=e;return j(t)&&Object.hasOwn(t,"class")?t.class:e.className}function Fc(e,t,n,r="",s,o="jx",i={}){let l=s??{n:0};nr(e,(c)=>{if(c.style)Oc(t,c.style,`.${Ic(c,l,o)}`,n,i)})}function G(e){return String(e).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function wn(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function L$(e){let t=new Set;return Vc(e,t),[...t]}function Vc(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)Vc(n,t)}function F$(e){let t=[];return Wc(e,t),t}function Wc(e,t){if(!j(e))return;if(e.state){for(let[n,r]of Object.entries(e.state))if(pt(r))t.push({exportName:r.$export,key:n,src:r.$src})}if(Array.isArray(e.children))for(let n of e.children)Wc(n,t)}function mr(e,t){if(y(e))return e;let n=Xt(e);if(n.length===0)return"div";if(!Ue(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 mg(e){if(!e?.slotIds)return null;return e.slotIds.n+=1,e.slotIds.n}function gg(e,t,n,r=null){let s=new Map;for(let o of $n(e)){let i="",l=!0,c;if(y(o)||Y(o)||le(o)){if(c=n(o),Zr.test(c))continue;l=c!==""}else if(Q(o))c=n(o);else if(!qe(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=Ce([a.html,c],{separator:`
|
|
72
|
+
`}),a.content||=l;else s.set(i,{content:l,html:c})}return{groups:s,id:r,taken:new Set}}function Hc(e,t,n){for(let r of $n(e)){if(Q(r)||!qe(r))continue;if(r.tagName==="slot"){let s=te(r.attributes?.name,t);n.taken.add(y(s)?s:"")}Hc(r.children,t,n)}}function hg(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 Si(e,t){if(!t)return fi(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 fi(n,null)}function yg(e,t,n){let r=pr(e).filter((l)=>Object.hasOwn(t??{},l));if(!t||r.length===0)return null;let s=ti(e),o=Si(e,null),i=null;for(let l of r){let c=te(t[l],n),a=null;if(le(c))a=ot(l,c);else if(y(c)||Y(c))a=String(c);let u=Rc(l);if(a===null||s.has(u)&&s.get(u)===void 0)continue;Al(o,l,a,s),i??={},i[u]=o[u]}return i}function xg(e,t){let n={};for(let[r,s]of Object.entries(e??{})){if(_(s)&&ir(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 bg(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 rr(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=ar(e,mr(e.tagName,t),t);if(o!==void 0)return o;if(Q(e.children))return Bc(e.children,t,n,r,s);if(Array.isArray(e.children))return Ce(e.children.map((i)=>sr(i,t,n,r,s)),{preformatted:s,separator:`
|
|
73
|
+
`});return""}function Bc(e,t,n=null,r=null,s=!1){let o=e.map;if(!o)return"";lr(e);let i=t??is(),l=$g(e,i);if(l===null)return"";return Ce(l.map((c,a)=>{let u=is(i);return u.$map={index:a,item:c},u["$map/item"]=c,u["$map/index"]=a,sr(o,u,n,r,s)}),{preformatted:s,separator:`
|
|
74
|
+
`})}function $g(e,t){let n=(r)=>_(r)?wc(r.$ref,t):void 0;for(let r of[e.items,e.filter,e.sort])if(_(r)&&ir(r.$ref,t))return null;try{let r=_(e.items)?n(e.items):e.items;if(!Array.isArray(r))return null;return jl(r,n(e.filter),n(e.sort))}catch{return null}}function sr(e,t,n=null,r=null,s=!1){if(y(e)){if(B(e)&&t){let a=mi(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 Ce(e.map((a)=>sr(a,t,n,r,s)),{preformatted:s,separator:`
|
|
75
|
+
`});if(!j(e))return"";if(Q(e))return Bc(e,t,n,r,s);if(e.$switch){let a=e.tagName??"div",u=It(e,t),p=_(e.$switch)&&t!==null&&ir(e.$switch.$ref,t)?null:te(e.$switch,t),d=p==null?void 0:e.cases?.[String(p)],x=d!==void 0&&!ee(d)?sr(d,t,n,r,s):"";return`<${a}${u}>${x}</${a}>`}let o=mr(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=`<!--${Qr} ${n.id} ${encodeURIComponent(u)}-->${p}<!--/${Qr} ${n.id}-->`;if(f?.content)return Hc(e.children,t,n),p;let d=rr(e,t,n,r,s);return Ce([p,d],{preformatted:s,separator:`
|
|
76
|
+
`})}let i=r?.componentDefs.get(o);if(i&&r)return Sg(e,i,t,n,r);let l=It(e,t);if($i.has(o))return`<${o}${l}>`;let c=rr(e,t,n,r,s||xt.has(o));return`<${o}${l}>${c}</${o}>`}function Sg(e,t,n,r,s){let o=t.tagName,{lifted:i,rest:l}=hg(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={...yg(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>=ni)throw Error(`Component nesting exceeds ${ni} 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)=>sr(O,n,r,s),S=dt(t,s.defaults),E=!wg(o,t,s.liveTags),J=Si(t,p?f:null),M,k=null;if(S){let O=Array.isArray(m)?Ce(m.map((T)=>b(T)),{separator:`
|
|
77
|
+
`}):"";M=`<template shadowrootmode="${S}"><link rel="stylesheet" href="${Eg(o)}">${rr(t,J,null,g)}</template>${O}`}else{k=!E&&pn(t.children)?mg(s):null;let O=gg(m,n,b,k);M=rr(t,J,O,g)}let P=Object.entries(bg(t.style,J)).map(([O,T])=>`${Re(O)}: ${T}`).join("; "),R={...e};delete R.$props,delete R.children;let H={...l,...xg(t.attributes,J)};if(R.attributes=!E&&u?{...H,"data-jx-props":JSON.stringify(a)}:H,k!==null)R.attributes={...R.attributes,[ri]:String(k)};if(E)R.$static=!0;else R.$prerendered=!0;return`<${o}${It(R,n,P)}>${M}</${o}>`}function V$(e,t=null,n=null,r=null){return rr(e,Si(e,t),n,r)}function wg(e,t,n){return n?n.has(e):!Uc(t)}function ls(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 Xt(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 W$(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 ls(e.get(a),e))if(!l.has(u))l.add(u),c.push(u);return l},r=t?n(ls(t,e)):void 0,s=new Set,o=[];for(let[i,l]of e)if(!Uc(l)){if(s.add(i),!r||r.has(i))o.push(i)}for(let i of n(o))s.add(i);return s}function qc(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[...ls(l,t)].toSorted())o(c);if(n.has(i))s.push(i)};for(let i of[...e].toSorted())o(i);return s}function Uc(e){if(pr(e).length>0)return!1;return tr(e)}function tr(e){if(!j(e))return!0;if(Array.isArray(e))return e.every((t)=>tr(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||tr(e.map));if(e.$prototype)return!1;if(e.$switch!==void 0||Ue(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)=>tr(t));if(Q(e.children))return tr(e.children);return!0}function Eg(e){return`/components/${e}.css`}function H$(e,t,n,r){let s=new Set([e]),o=[n.get(e)??""],i=(l)=>{for(let c of ls(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 zc(e,t,n=null,r={},s=null){let o=[],i=dc(e,s),l={host:s===null?"light":"shadow"};if(s!==null)l.shadowTree=!0;let c=j(t)?t:{};if(Oc(o,"display"in c?c:{display:"block",...c},i,r,l),n){let a={n:0};for(let u of js(n))Fc(u,o,r,"",a,e,{shadowTree:s!==null})}return o.length>0?`${o.join(`
|
|
78
78
|
`)}
|
|
79
|
-
`:""}var
|
|
79
|
+
`:""}var zm,xc,fn="https://esm.sh/@vue/reactivity@3.5.40",Jt="https://esm.sh/lit-html@3.3.0",er,Gm,Zm,Qm,eg,tg,vc,og,ig,xt,ag,Lt="__jxAttrText",yn="__jxListItems",Ac="__jxRowKeys",cr="__jxLiteral",ur="__jxKeyed",$s,gi="__jxSupplies",hi="__jxNativeSetter",ws="__jxAbsorbAttr",kc="__jxServerCall",cg,pg,Pc="__jxInstantiate",yi="__jxAssociateForm",xi="__jxCaptureSlotted",bi="__jxDistributeSlots",bn="<!---->",Dc,$i;var Ft=v(()=>{en();Yn();Tl();an();Yr();oc();lc();K();Zn();rs();rn();Yn();an();Yr();K();an();zm=["$map/","event#/","$args/","$reduce/"];xc=Symbol("jx.runtimeOnlyStateKeys");er=String.raw`(?:\s|\\[nrt])*`,Gm=new RegExp(String.raw`(?:=|\.\.\.)${er}state[ \t]*(?:[;,)}\]"]|\\[nr])`);Zm=/\bstate\.([A-Za-z_$][\w$]*)\s*(?:\+\+|--|(?:\*\*|\|\||&&|\?\?|<<|>>>|>>|[-+*/%&|^])?=(?!=))/g,Qm=/\bstate\.([A-Za-z_$][\w$]*)\s*\.\s*(?:push|pop|shift|unshift|splice|sort|reverse|fill|copyWithin)\s*\(/g,eg=/[\w$.]/u,tg=/[\w$]/u;vc=["hidden","tabIndex","title","lang","dir"],og=new Set([...vc,"id","className"]),ig=new Set([...Ge,...og,"textContent","innerHTML"]);xt=new Set(["pre","textarea","listing","plaintext","xmp"]);ag=[];$s=["import { AsyncDirective, directive } from 'lit-html/async-directive.js';","import { repeat } from 'lit-html/directives/repeat.js';"];cg=new Set(["$prototype","$src","$export","timing","default","description"]);pg=new Set(ii);Dc=Symbol("jx.styleHandle");$i=new Set(["input","br","hr","img","meta","link","area","col","source"])});class Kc{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(`
|
|
80
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)===`
|
|
81
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===`
|
|
82
|
-
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function
|
|
83
|
-
`,"\r"]);
|
|
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=
|
|
82
|
+
`||t===";")&&e===0)return this.index+=1,!0;else this.index+=1}return e===0}}function En(e){if(vg.test(e))return"unreadable";let t=new Kc(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]=Jg.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 vg,Jg;var gr=v(()=>{vg=/\0/u,Jg=/^[^\s\\/(){};[\]"#=]+/u});function Yc(e){let t=[],n=[],r=null,s=0,o=()=>n.at(-1)?.path??"",i=()=>r===null?o():Ag(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+=Og.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(Gc.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"&&jg(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(!Cg(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 jg(e,t){let n=t;while(n<e.length&&Gc.has(e[n]))n+=1;return e[n]??""}function Ag(e,t){return e===""?t:`${e}.${t}`}function Cg(e){if(/[.eE]/.test(e))return!0;let t=Number(e);if(!Number.isFinite(t))return!1;return String(t)===e.replace(/^\+/,"")}function Xc(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 Gc,Og;var Zc=v(()=>{Gc=new Set([" ","\t",`
|
|
83
|
+
`,"\r"]);Og=new Map([["b","\b"],["f","\f"],["n",`
|
|
84
|
+
`],["r","\r"],["t","\t"]])});function Ng(e){return e instanceof Error?e.message:String(e)}function eu(e){if(y(e))return Qc.test(e)?e.normalize("NFC"):e;if(Array.isArray(e))return e.map((t)=>eu(t));if(A(e))return vn(e);return e}function vn(e){let t={};for(let[n,r]of Object.entries(e))t[Qc.test(n)?n.normalize("NFC"):n]=eu(r);return t}function wi(e,t,n){let r;try{r=JSON.parse(e)}catch(o){throw Error(`Failed to parse ${n} at ${t}: ${Ng(o)}`,{cause:o})}if(!A(r))throw Error(`Invalid ${n} at ${t}: expected a JSON object`);let s=Yc(e);if(s.length>0){let o=s.map((i)=>Xc(i)).join("; ");throw Error(`Invalid ${n} at ${t}: ${o}`)}return vn(r)}function tu(e,t){return wi(e,t,"Jx document")}function nu(e,t){return wi(e,t,"project config")}function eS(e,t){return wi(e,t,"class definition")}var Qc;var hr=v(()=>{K();Zc();Qc=/[^\p{ASCII}]/u});function br(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 Nt(e){return e===13||e===10||e===133||e===11||e===12||e===8232||e===8233||!1}function Is(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)&&!br(e)&&!Nt(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 ru(e){return e>=65&&e<91||e>=97&&e<123||!1}function Ei(e){return e>=48&&e<58||e>=65&&e<71||e>=97&&e<103||!1}function vi(e){return Ei(e)||e===95}function $t(e){return e>=48&&e<58}function Bt(e){return $t(e)||e===95}function Ji(e){return e>=48&&e<56}function su(e){return Ji(e)||e===95}function Oi(e){return e===48||e===49}function ou(e){return Oi(e)||e===95}function iu(e){return e===45||e===43}var jt=1,Jn=2,Vt=3,As=4,Cs=5,yr=6,Ns=7,Rs=8,xr=9,At=10,ve=11,On=12,jn=13,Ts=14,bt=15,ks=16,Ps=17,Wt=18,Ct=19,_s=20,Ms=21,Ds=22,An=23,Ht=24,it=28;function*Tg(e){for(let t of(Rg??=new Intl.Segmenter("en")).segment(e))yield t.segment}function kg(e){return e[Symbol.iterator]()}function au(e,{flags:t,graphemeLocations:n=!1}){let r=n?Tg(e):kg(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*lu(e){if(q(e,65279))e.column=1,yield I(e,Jn);if(Is(e.current))throw at(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(Is(n))if(n>=55296&&n<=57343||n>1114111)$r(e,`Invalid character \\u${n.toString(16)}`);else $r(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 Ye(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 Cn(e){if(!Nt(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 ji(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 at(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(Nt(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 $r(e,t){(e.errorsInToken??=[]).push(at(e,t))}var Rg;var cu=v(()=>{qt()});function Ut(e){return(t)=>(ue(t),I(t,e))}function Sr(e){return X(e,br),I(e,Wt)}function zt(e){return Cn(e),I(e,Ct)}function Pg(e){ue(e);let t=!1,n=!1;if(q(e,34)){if(!q(e,34))return I(e,xr);if(n=!0,e.current===34)throw at(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),Cn(e)||ue(e)}else while(!t&&e.offset<e.length)if(q(e,34))t=!0;else q(e,92),Cn(e)||ue(e);if(!t)throw at(e,"Unexpected EOF inside string");return I(e,n?An:xr)}function uu(e){if(ue(e),e.current===35||e.current===34){let t=1;while(q(e,35))t++;if(!q(e,34))throw at(e,`Expected a quote after ${"#".repeat(t)}`);let n=!1;if(q(e,34))if(q(e,34)){if(e.current===34)throw at(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,At)}while(!0){if(e.offset>=e.length)throw at(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?Ht:At)}else Cn(e)||ue(e)}}else{let t;if(e.current<255){let n=F[e.current];t=n(e)}else if(br(e.current))t=Sr(e);else if(Nt(e.current))t=zt(e);else t=Ci(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),Ye(e,$t))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 Mg(e){if(ue(e),q(e,45))return I(e,Vt);else if(q(e,47)){while(e.offset<e.length&&!Nt(e.current))ue(e);return I(e,Ms)}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,Ds)}}else if(q(e,47)){if(q(e,42))t++}else Cn(e)||ue(e);throw at(e,"Unexpected EOF in multiline comment")}else Fs(e)}function pu(e){return ue(e),Dg(e)}function Dg(e){if($t(e.current))return Xe(e);else if(q(e,46)){if(Ye(e,$t))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 Ai(e,t,n,r){return(s)=>{let o=ue(s);if(Ye(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(ji(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($t(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,it)}}function Xe(e){if(q(e,48)){let t=Ls[e.current];if(t)return t(e)}if(X(e,Bt),q(e,46)){if(!Ye(e,$t))if(e.current===95)$r(e,"Invalid decimal number, the part after the decimal point mustn't start on an underscore");else $r(e,"Invalid decimal number, a decimal point must be followed by a digit");X(e,Bt)}if(q(e,101)||q(e,69))if(Ye(e,iu),Ye(e,$t)){if(X(e,Bt),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,bt)}else if(!e.flags.experimentalSuffixedNumbers)if(e.current===95)return X(e,Bt),I(e,bt,"Invalid decimal number, the number after the exponent mustn't start on an underscore");else return X(e,ne),I(e,bt,"Invalid decimal number, missing a number after the exponent");else if(q(e,95)){if(ji(e,95),$t(e.current)){if(X(e,Bt),!ne(e.current))return I(e,bt,"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,it);else if(e.flags.experimentalSuffixedNumbers)if(e.current===88||e.current===120){ue(e);let t=null;if(Ye(e,vi))t="Invalid number with suffix, a suffix cannot start with an x followed by a hexidecimal number";return X(e,ne),I(e,it,t)}else if(Ye(e,ru)){let t=null;if(Ye(e,Bt))t="Invalid number with suffix, a suffix cannot start with a letter followed by a digit";return X(e,ne),I(e,it,t)}else if(q(e,44))return X(e,ne),I(e,it,"Invalid number with suffix, a suffix cannot start with a comma");else if(q(e,46))return X(e,ne),I(e,it,"Invalid number with suffix, a suffix cannot start with a dot");else if(Ye(e,ne))return X(e,ne),I(e,it);else return I(e,bt);else return I(e,bt)}function Ig(e){if(ue(e),e.current!=35)return X(e,ne),I(e,ve);let t=uu(e);t.start.offset--,t.start.column--;let n;switch(t.type){case At:case Ht: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 Ci(e){return ue(e),X(e,ne),I(e,ve)}function Fs(e){throw at(e,`Unexpected character ${JSON.stringify(String.fromCodePoint(e.current))}, did you forget to quote an identifier?`)}function*wr(e,t){let n=au(e,t);yield*lu(n);while(!n.currentIter.done){if(n.current<255){let r=F[n.current];yield r(n);continue}if(br(n.current)){yield Sr(n);continue}if(Nt(n.current)){yield zt(n);continue}yield Ci(n)}yield I(n,jt)}var Ls,F;var fu=v(()=>{qt();cu();Ls=Array(256).fill(null);Ls[98]=Ai("binary",Ps,Oi,ou);Ls[111]=Ai("octal",ks,Ji,su);Ls[120]=Ai("hexadecimal",Ts,Ei,vi);F=Array(255);F.fill(Ci);for(let e=0;e<32;e++)F[e]=Fs;F[9]=Sr;F[10]=zt;F[11]=zt;F[12]=zt;F[13]=zt;F[32]=Sr;F[34]=Pg;F[35]=uu;F[40]=Ut(As);F[41]=Ut(yr);F[43]=pu;F[45]=pu;F[46]=_g;F[47]=Mg;F[48]=Xe;F[49]=Xe;F[50]=Xe;F[51]=Xe;F[52]=Xe;F[53]=Xe;F[54]=Xe;F[55]=Xe;F[56]=Xe;F[57]=Xe;F[59]=Ut(Rs);F[61]=Ut(On);F[91]=Fs;F[92]=Ut(_s);F[93]=Fs;F[114]=Ig;F[123]=Ut(Cs);F[125]=Ut(Ns);F[133]=zt;F[160]=Sr});var Nn=v(()=>{fu()});var z;var qt=v(()=>{Nn();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===jt)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 Rn(e){return du.get(e)}function mu(e,{start:t},{end:n}){du.set(e,{start:t,end:n})}var du;var Ni=v(()=>{du=new WeakMap});function gu({experimentalSuffixedNumbers:e=!1}={}){return{experimentalSuffixedNumbers:e}}class Ze{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 Ze(this.name);return e.representation=this.representation,e}}class lt{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 lt(this.name);return e.representation=this.representation,e.leading=this.leading,e.trailing=this.trailing,e.suffix=this.suffix,e}}class Qe{type="value";static type="value";representation;tag=null;betweenTagAndValue;constructor(e){this.value=e}clone(){let e=new Qe(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 lt(e)}}var Ri=()=>{};class De{static createArgument(e){return new De(new Qe(e),null)}static createProperty(e,t){return new De(new Qe(t),new Ze(e))}type="entry";static type="entry";name;value;leading;trailing;equals;constructor(e,t){this.value=e,this.name=t}clone(){let e=new De(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 Ze(e):null}getValue(){return this.value.value}setValue(e){this.value=new Qe(e)}isArgument(){return this.name==null}isProperty(){return this.name!=null}}var Ti=v(()=>{Ri()});function*Tn(e){for(let t=e.length-1;t>=0;t--)yield e[t]}function ki(e){return e.children??(e.children=new Rt)}class kn{static create(e){return new kn(new Ze(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 kn(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 lt(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=De.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 Tn(this.entries))if(t.getName()===e)return t;return}setProperty(e,t,n){for(let s of Tn(this.entries))if(s.getName()===e){s.setValue(t),s.value.setTag(n);return}let r=De.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){ki(this).appendNode(e)}insertNodeBefore(e,t){ki(this).insertNodeBefore(e,t)}insertNodeAfter(e,t){ki(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 hu=v(()=>{Pi();Ti()});function*Pn(e){if(e instanceof Rt)yield*e.nodes;else yield e}class Rt{type="document";static type="document";nodes;trailing;constructor(e=[]){this.nodes=e}clone({shallow:e}={}){let t=new Rt(e?[]:this.nodes.map((n)=>n.clone()));return t.trailing=this.trailing,t}appendNode(e){this.nodes.push(...Pn(e))}insertNodeBefore(e,t){if(t==null){this.nodes.push(...Pn(e));return}let n=this.nodes.indexOf(t);if(n===-1)throw Error("Reference node is not in document");this.nodes.splice(n,0,...Pn(e))}insertNodeAfter(e,t){if(t==null){this.nodes.unshift(...Pn(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,...Pn(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,...Pn(t))}findNodesByName(e){return this.nodes.filter((t)=>t.name.name===e)}findNodeByName(e){for(let t of Tn(this.nodes))if(t.name.name===e)return t;return}findParameterizedNode(e,t){for(let n of Tn(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 Pi=()=>{};var yu=v(()=>{Pi();Ti();hu();Ri()});function xu(e,t,n){let r;while(r=Fg.exec(t)){let s=Er(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 bu(e,t,n){if(!_n.test(t))return e.push(new z("Raw strings with three quotes must be multiline strings",{token:n})),t;if(!_n.test(t[0]))return e.push(new z("Multi-line strings must start with a newline",{token:n})),t;let r=Hg.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(qg,(s,o,i,l,c)=>{if(!l)return`
|
|
85
|
+
`;if(!i.startsWith(r)){let a=Er(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}})),`
|
|
86
86
|
`}return`
|
|
87
|
-
`+i.slice(r.length)+l}).slice(1,-1)}function
|
|
88
|
-
`;if(!i.startsWith(r)){let p=
|
|
87
|
+
`+i.slice(r.length)+l}).slice(1,-1)}function $u(e,t,n){let r;while(r=Wg.exec(t)){let s=Er(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(zg,(s,o,i,l,c)=>wu(e,t,n,s,o,i,l,c))}function Su(e,t,n){if(!Vg.test(t))return e.push(new z("Strings with three quotes must be multiline strings",{token:n})),t;if(!_n.test(t[0]))return e.push(new z("Multi-line strings must start with a newline",{token:n})),t;let r=Bg.exec(t)?.[1];if(r==null){let s=Ug.exec(t),o=s?Er(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 wu(e,t,n,s,l,c,a,u);let f=t[u+o.length+(i?i.length:0)];if(_n.test(f))return`
|
|
88
|
+
`;if(!i.startsWith(r)){let p=Er(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}})),`
|
|
89
89
|
`}return`
|
|
90
|
-
`+i.slice(r.length)}).slice(1,-1)}function
|
|
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(`
|
|
90
|
+
`+i.slice(r.length)}).slice(1,-1)}function wu(e,t,n,r,s,o,i,l){if(i)return"";if(o){let c=n.text.startsWith('"""'),a=t.slice(0,l).split(_n),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=Lg.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 Er(e,t,n){let r=1;switch(e.type){case An:r=3;break;case At:r=e.text.indexOf('"')+1;break;case Ht:r=e.text.indexOf('"')+3;break}let s=t.slice(0,n).split(_n);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 WS,Lg,_n,Fg,Vg,Wg,Hg,Bg,qg,Ug,zg,Kg;var Eu=v(()=>{qt();Nn();WS=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"]]),Lg=new Map([["\\n",`
|
|
91
|
+
`],["\\r","\r"],["\\t","\t"],["\\\\","\\"],["\\\"",'"'],["\\b","\b"],["\\f","\f"],["\\s"," "]]),_n=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/,Fg=/\x0D\x0A|[\x0A\x0B\x0C\x0D\x85\u2028\u2029]/g,Vg=/(?:^|[^\\\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,Wg=/(?:^|[^\\\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;Hg=/[\x0A\x0B\x0C\x0D\x85\u2028\u2029]([\uFEFF\u0009\u0020\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)$/,Bg=/(?:^|[^\\\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]*)*$/,qg=/(\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,Ug=/([^\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]*$/;zg=/\\(?:$|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 St(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 St(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)mu(t,n,r)}function Je(e="",t="",n=""){return e+t+n||void 0}function Hs(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 St(o),o}function Mi(e,t){if(!t&&!e.current.done&&e.current.value.type!==jt)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 Vs(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 vu(e){return e==="inf"||e==="-inf"||e==="nan"||e==="true"||e==="false"||e==="null"||!1}function Di(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 it:{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),vu(s))e.errors.push(V(e,`Invalid suffix ${s}, values that look like keywords cannot be used as suffix`))}break;case Ps:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),2);break;case ks:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),8);break;case bt:l=!0,n=Number.parseFloat(t.text.replaceAll("_",""));break;case Ts:l=!0,n=(i==="-"?-1:1)*Number.parseInt(t.text.slice(i?3:2).replaceAll("_",""),16);break;case jn:if(n=Vs(t.text),n===void 0)if(n=null,Vs(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}St(e);let c=e.flags.experimentalSuffixedNumbers&&Z(e,jn);if(c)if(l){if(o=c.text,Vs(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 Qe(n);if(a.representation=r??t.text,ke(e,a,t),s){let u=new lt(s);u.representation=o,u.suffix=!0,ke(e,u,e.lastToken),a.tag=u}return a}function vr(e){if(e.current.done)return;let{value:t}=e.current,n;switch(t.type){case ve:if(St(e),vu(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 xr:St(e),n=[$u(e.errors,t.text.slice(1,-1),t),t.text,t];break;case An:St(e),n=[Su(e.errors,t.text.slice(3,-3),t),t.text,t];break;case At:{St(e);let r=t.text,s=r.indexOf('"');n=[xu(e.errors,r.slice(s+1,-(s+1)),t),r,t];break}case Ht:{St(e);let r=t.text,s=r.indexOf('"');n=[bu(e.errors,r.slice(s+3,-(s+3)),t),r,t];break}default:return}if(Z(e,jn))e.errors.push(V(e.lastToken,Vs(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 Ii(e){let t=vr(e);if(!t)return;let n=new Ze(t[0]);return n.representation=t[1],ke(e,n,t[2],e.lastToken),n}function Ws(e){let t=Di(e);if(t)return t;let n=vr(e);if(!n)return;let r=new Qe(n[0]);return r.representation=n[1],ke(e,r,n[2],e.lastToken),r}function Jr(e){let t=Z(e,Ms);if(!t)return;let{value:n}=e.current;return St(e),t.text+(n?.text??"")}function Bs(e){return Z(e,Ds)?.text}function Li(e){return Z(e,Wt)??Bs(e)}function qs(e){let t=Z(e,_s);if(!t)return;while(Li(e));if(!Jr(e)&&!Z(e,Ct)&&!Z(e,jt))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 Tt(e){let t=e.lastToken.end;while(Z(e,Ct)?.text??Jr(e)??Li(e)??qs(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(Li(e)??qs(e));if(e.lastToken.end===t)return;return e.text.slice(t.offset,e.lastToken.end.offset)}function _i(e){let t=Z(e,As);if(!t)return;let n=ge(e),r=vr(e);if(!r&&e.current.value){let l=e.current.value;if(Tt(e))e.errors.push(V(l,"This type of whitespace is not allowed inside a tag"));r=vr(e)}if(!r){if(Di(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,yr);if(!o&&e.current.value){let l=e.current.value;if(Tt(e))e.errors.push(V(l,"This type of whitespace is not allowed inside a tag"));o=Z(e,yr)}if(!o)throw V(e,"Invalid tag, did you forget to quote a string?");let i=new lt(r[0]);return i.representation=r[1],i.leading=n,i.trailing=s,ke(e,i,t,e.lastToken),i}function Us(e){return Jr(e)??Z(e,Ct)?.text??Z(e,Rs)?.text??Z(e,jt)?.text}function Fi(e){if(!Z(e,Cs))return;let t=Au(e);if(!Z(e,Ns))throw V(e,"Invalid node children");return t}function Mn(e){let t=e.current.value;{let f=_i(e);if(f){let p=ge(e),d=Ws(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 De(d,null);ke(e,d,t,e.lastToken),ke(e,x,t,e.lastToken);let w=ge(e);if(Z(e,On))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=Di(e);if(f){let p=new De(f,null);ke(e,p,t,e.lastToken);let d=ge(e);if(Z(e,On))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=vr(e);if(!n)return;let r=ge(e),s=Z(e,On);if(!s){let f=new Qe(n[0]);f.representation=n[1],ke(e,f,n[2]);let p=new De(f,null);return ke(e,p,t,e.lastToken),[p,r]}let o=new Ze(n[0]);o.representation=n[1],ke(e,o,n[2]);let i=ge(e),l=_i(e),c=l&&ge(e),a=Ws(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 De(a,o);return ke(e,u,t,e.lastToken),u.equals=Je(r,s.text,i),[u,void 0]}function Ju(e){let t=ge(e)??"",n;while(n=Kt(e)){let i=e.lastToken.end,l=Mn(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=Mn(e);if(!r)return;let s=r[1]??ge(e)??"";while(n=Kt(e)){let i=e.lastToken.end,l=Mn(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 Kt(e){let t=Z(e,Vt)?.text;if(!t)return;return Je(t,Tt(e))}function zs(e){let t=e.current.value,n=_i(e),r=n&&ge(e),s=Ii(e);if(!s)if(n)throw V(e,"Couldn't find node name");else return;let o=ge(e),i=o!=null,l=Kt(e),c=[];while(i||l){let p=e.lastToken.end,d=Mn(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=Kt(e);else{let x=d[0];x.leading=o,c.push(x),o=d[1]||ge(e),i=o!=null,l=Kt(e)}}let a,u;while(!0){l??=Kt(e);let p=e.lastToken.end,d=Fi(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 kn(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 Ou(e){let t=Tt(e),n=zs(e);if(!n)return;let r=Je(Us(e),Tt(e));return n.leading=Je(t,n.leading),n.trailing=Je(n.trailing,r),n}function ju(e){let t=Z(e,Jn)?.text,n=Au(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 Au(e){let t=e.current.value,n=[],r=!0,s=Tt(e);while(r){let i=e.lastToken.end,l=Kt(e),c=zs(e);if(!c){if(l)throw V(e,"Unexpected slashdash");break}let a=ge(e),u=Us(e);if(l)s=Je(s,e.text.slice(i.offset,e.lastToken.end.offset),Tt(e));else c.trailing=Je(c.trailing,a,u)??"",n.push(c),c.leading=s??"",s=Tt(e);r=u!=null}let o=new Rt(n);return ke(e,o,t,e.lastToken),o.trailing=s??"",o}var Vi=v(()=>{qt();Ni();yu();Eu();Nn()});function Cu(e,t){let n=[],r;while(r=t(e))n.push(r);return n.length>0?n:void 0}function Gg(e){{let t=Z(e,Jn);if(t)return{type:"bom",text:t.text}}{let t=Z(e,Ct);if(t)return{type:"newline",text:t.text}}{let t=Z(e,Wt);if(t)return{type:"space",text:t.text}}{let t=Jr(e);if(t)return{type:"singleline",text:t}}{let t=Bs(e);if(t)return{type:"multiline",text:t}}return}function Ks(e){{let t=qs(e);if(t)return{type:"line-escape",text:t}}{let t=Z(e,Wt);if(t)return{type:"space",text:t.text}}{let t=Bs(e);if(t)return{type:"multiline",text:t}}return}function Nu(e){let t=[];while(!0){{let n=Gg(e);if(n){t.push(n);continue}}if(Z(e,Vt)?.text){let r,s=Cu(e,Ks)??[],o=zs(e);if(!o)throw V(e,"Invalid slashdash, expected a commented node");o.trailing=Je(o.trailing,Cu(e,Ks)?.map((i)=>i.text).join(""),Us(e)),t.push({type:"slashdash",preface:s,value:o});continue}break}return t}function Yg(e){let t=Z(e,Vt);if(t==null)return;let n,r=[];while(n=Ks(e))r.push(n);let s,o,i="";if(o=Mn(e)){if(s=o[0],o[1])i=o[1]}else if(o=Fi(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 Wi(e){let t=[];while(!0){let n=Ks(e);if(!n)break;let r=!0;t.push(n);while(r){let s=Yg(e);if(!s)break;if(t.push(s[0]),s[1][0])t.push(...Wi(Hs(s[1][0],wr(s[1][0],{flags:e.flags}),{flags:e.flags})));r=!!s[1][0]}}return t}var Ru=v(()=>{Nn();Vi()});function kt(e,{as:t="document",flags:n,...r}={}){let s=Xg[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=gu(n),i=wr(e,{...r,flags:o}),l=Hs(e,i,{...r,flags:o}),c;try{c=s(l)}catch(a){Mi(l,a)}if(Mi(l),!c)throw new z(`Expected ${/^[aeiouy]/.exec(t)?"an":"a"} ${t}`);return c}var Xg;var Tu=v(()=>{qt();Nn();Vi();Ru();Xg={value:Ws,identifier:Ii,node:Ou,entry:Ju,document:ju,"whitespace in document":Nu,"whitespace in node":Wi}});var Gs=v(()=>{qt();Ni();Tu()});function Dn(e,t){let n=e.slice(0,t),r=n.split(`
|
|
92
92
|
`).length;return{column:t-n.lastIndexOf(`
|
|
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?
|
|
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
|
|
96
|
-
`)+1)}function
|
|
93
|
+
`),line:r,offset:t}}var $e;var In=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 ku;var Pu=v(()=>{ku=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=Xs(t)?.start;return new $e(n,r===void 0?null:Dn(e.text,r))}function Xs(e){let t=Rn(e);return t?{end:t.end.offset,start:t.start.offset}:null}function pe(e,t,n){let r=e.spans?Xs(n):null;if(r)e.spans?.set(t,r)}function _u(e,t,n){let r=e.tokens&&n?Xs(n):null;if(r)e.tokens?.names.set(t,r)}function he(e,t,n){let r=e.tokens&&n?Xs(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 Pt(e){return e.entries.filter((t)=>!t.name)}function oe(e){return e.replaceAll("~","~0").replaceAll("/","~1")}function Ln(e,t){let n=t.getTag();if(n!==null&&!Iu.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 wt(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 We(e,t){return t.entries.filter((n)=>!n.name).map((n)=>wt(e,n))}function He(e){return e.entries.filter((t)=>t.name)}function Se(e){return e.children?.nodes??[]}function ct(e){return e.getName()??""}function eh(e,t,n){let r={$prototype:"Function"},s=We(e,t),o=Se(t);for(let l of He(t))L(r,ct(l),wt(e,l),e,l),he(e,`${n}/${oe(ct(l))}`,l);let i=e.tokens?Pt(t):[];if(o.length>0){if(s.length>0)L(r,"parameters",s,e,t);L(r,"body",Hi(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 th(e,t,n){let r={$prototype:"Function",$src:"#client"};if(We(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 He(t))L(r,ct(s),wt(e,s),e,s),he(e,`${n}/${oe(ct(s))}`,s);if(!Object.hasOwn(r,"$export"))r.$export=t.getName().normalize("NFC");return pe(e,n,t),r}function nh(e,t,n){if(We(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=He(t);if(s.length>0){let o={};for(let i of s){let l=ct(i);L(o,l,wt(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 rh(e,t,n){let r={};for(let c of He(t)){let a=ct(c);if(L(r,a,wt(e,c),e,c),a!=="timing"||r[a]!=="server")throw W(e,c,"A script takes timing=server, and nothing else")}let s=We(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)||!Mu.has(l))l={},Mu.add(l),L(n,"$script",l,e,t);L(l,i,o,e,t),pe(e,`/$script/${i}`,t),he(e,`/$script/${i}`,Pt(t)[0])}function Du(e,t,n){for(let[r,s]of(e.tokens?Pt(n):[]).entries())he(e,`${t}/${r}`,s)}function Hi(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 Ve(e,s,`${n}/${r+o}`)})}function Ve(e,t,n){let r=Ln(e,t);if(pe(e,n,t),r==="fn")return eh(e,t,n);if(r==="export")return th(e,t,n);if(r==="server")return nh(e,t,n);let s=We(e,t),o=He(t),i=Se(t);if(r==="array"){if(o.length>0)throw W(e,t,"(array) holds items, and these are named");return Du(e,n,t),[...s,...Hi(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 Du(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,Pt(t)[0]),s[0]??null}if(i.length>0&&o.length===0&&i.every((c)=>c.getName()==="-"))return Hi(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=ct(c);L(l,a,wt(e,c),e,c),pe(e,`${n}/${oe(a)}`,c),_u(e,`${n}/${oe(a)}`,c.name),he(e,`${n}/${oe(a)}`,c)}for(let c of i){let a=c.getName();L(l,a,Ve(e,c,`${n}/${oe(a)}`),e,c),_u(e,`${n}/${oe(a)}`,c.name)}return l}function Zs(e,t,n){let r={};if(pe(e,n,t),We(e,t).length>0)throw W(e,t,"A style block holds declarations, and this is a value");for(let s of He(t)){let o=ct(s);L(r,o,wt(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,Ve(e,s,i),e,s);continue}let c=We(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(He(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,Pt(s)[0])}else L(r,o,Zs(e,s,i),e,s)}return r}function Ys(e,t,n){let r=Se(t);if(r.length!==1||!r[0])throw W(e,t,`"${t.getName()}" holds one element`);return Fu(e,r[0],n)}function Lu(e,t,n){let r={$prototype:"Array"};if(pe(e,n,t),We(e,t).length>0)throw W(e,t,"$array holds names and one element, and this is a value");for(let s of He(t)){let o=ct(s),i=o.startsWith(".")?o.slice(1):o;L(r,i,wt(e,s),e,s),he(e,`${n}/${oe(i)}`,s)}if(Se(t).length>0)L(r,"map",Ys(e,t,`${n}/map`),e,t);return r}function Fu(e,t,n){let r=t.getName();if(r==="-"){let s=We(e,t);if(s.length!==1||He(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,Pt(t)[0]),s[0]??null}if(r==="$array")return Lu(e,t,n);return Bi(e,t,n)}function sh(e,t,n,r){let s=Ln(e,n);if(t==="map")return Ys(e,n,r);if(t==="cases"){let o={};for(let i of Se(n)){let l=i.getName();L(o,l,Ys(e,i,`${r}/${oe(l)}`),e,i)}return o}if(t==="children"&&s!=="array"&&Se(n).length>0)return Ys(e,n,r);return Ve(e,n,r)}function Bi(e,t,n){let r={},s=t.getName(),o=Ln(e,t);if(pe(e,n,t),o!==null)throw W(e,t,`(${o}) cannot annotate an element`);let i=We(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`,Pt(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`,Pt(t)[0])}oh(e,t,r,n);let l=[];for(let c of Se(t))ih(e,c,r,l,n);if(l.length>0)L(r,"children",l,e,t);return r}function Vu(e){let{attributes:t}=e;if(A(t))return t;let n={};return e.attributes=n,n}function oh(e,t,n,r){for(let s of He(t)){let o=ct(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=wt(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")&&ku.has(o))throw W(e,s,`${o} needs (ref)"pointer", or a function on a line of its own: (fn)${o} "…"`);else L(Vu(n),o,l,e,s),pe(e,`${r}/attributes/${oe(o)}`,s),he(e,`${r}/attributes/${oe(o)}`,s)}}function ih(e,t,n,r,s){let o=t.getName(),i=Ln(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,Ve(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`);rh(e,t,n)}else if(o==="state")L(n,"state",Ve(e,t,l("state")),e,t);else if(o==="style")L(n,"style",Zs(e,t,l("style")),e,t);else if(o==="attributes"){let c=Ve(e,t,l("attributes"));if(A(c))for(let[a,u]of Object.entries(c))L(Vu(n),a,u,e,t);else L(n,"attributes",c,e,t)}else if(o.startsWith(".")){let c=o.slice(1);L(n,c,sh(e,c,t,l(c)),e,t)}else if(o.startsWith("$")&&o!=="$array"&&o!=="$element")L(n,o,Ve(e,t,l(o)),e,t);else{if(Qg.has(o))throw W(e,t,`"${o}" is reserved here`);r.push(Fu(e,t,`${s}/children/${r.length}`))}}function qi(e,t){return Se(t).map((n,r)=>{let s=`/$head/${r}`;return n.getName()==="-"?Ve(e,n,s):Bi(e,n,s)})}function Ui(e){let t=Zg.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}`,Dn(e,t.index));try{return kt(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?Dn(e,s.offset):null)}}function Wu(e){if(En(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=Ui(e.text),r={},s=null;for(let o of n.nodes){let i=o.getName();if(i==="$head"&&o.getTag()===null)L(r,i,qi(e,o),e,o);else if(i.startsWith("$")&&i!=="$array"&&i!=="$element")L(r,i,Ve(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"?Lu(e,s,""):Bi(e,s,"");for(let[i,l]of Object.entries(o))L(r,i,l,e,s)}return vn(r)}function Or(e,t){try{return Wu({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof $e?n.inFile(t):n}}function zi(e){let t=new Map;return{document:Wu({spans:t,text:e}),spans:t}}var Zg,Iu,Qg,Mu;var jr=v(()=>{Gs();K();hr();gr();In();Pu();Zg=/(?![\t\n\v\f\r])\p{Cc}/u,Iu=new Set(["array","export","fn","object","on","ref","server"]),Qg=new Set(["attributes","script","state","style"]);Mu=new WeakSet});function Ar(e){return e.toLowerCase().endsWith(".jxn")}function _t(e){return e.endsWith(".json")||Ar(e)}function Gt(e,t){return Ar(t)?Or(e,t):tu(e,t)}var Ki=v(()=>{hr();jr()});function ch(e){let t={comments:0,escapes:[]},n=lh.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 uh(e){return ch(e).escapes.flatMap((t)=>{let n=ah.get(e.charAt(t+1));return n?[{...Dn(e,t),message:n}]:[]})}var ah,lh;var Hu=v(()=>{In();ah=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.`]]),lh=/^\uFEFF?\s*\/-[^\S\n]*kdl-version[^\S\n]+\d+[^\S\n]*(?:\n|$)/u});function Fn(e,t=!1){if(Array.isArray(e))return`[${e.map((s)=>Fn(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)}:${Fn(e[s],t||s==="style")}`).join(",")}}`}function ph(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 fh({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 Bu(e,t){let n=fh(e),r=new Map;for(let[s,o]of n)r.set(s,Fn(ph(e.document,o)));return{meanings:r,pointers:n,text:t}}function Et(e){let t=Rn(e);return{end:t?.end.offset??0,start:t?.start.offset??0}}function eo(e,t){let{end:n,start:r}=Et(e);return t.slice(r,n).trimEnd()}function Qs(e,t){let{end:n,start:r}=Et(e);return`${e.leading??" "}${t.slice(r,n).trimEnd()}`}function Zi(e){return e.children?.nodes??[]}function Gi(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=Zi(e).map((o)=>Gi(o));return`(${e.getTag()??""})${e.getName()} ${[...n,...r].join(" ")} {${s.join(";")}}`}function Yi(e,t,n){if(Gi(t)===Gi(n))return!0;let r=e.previous.meanings.get(Et(t).start);return r!==void 0&&r===e.next.meanings.get(Et(n).start)}function qu(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 Uu(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 dh(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=Uu(t,n,(a,u)=>Yi(e,a,u)),l=0,c=0;for(let[a,u]of[...i,[t.length,n.length]]){let f=Uu(t.slice(l,a),n.slice(c,u),(p,d)=>qu(p)===qu(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)&&Yi(e,p,u));if(f!==-1)o(f,a)}return r}function Qi(e){let t=e.leading??"";return t.slice(t.lastIndexOf(`
|
|
96
|
+
`)+1)}function mh(e,t,n){return e.split(`
|
|
97
97
|
`).map((r,s)=>s>0&&r.startsWith(t)?n+r.slice(t.length):r).join(`
|
|
98
|
-
`)}function
|
|
99
|
-
${p.join("")}${r}}`}function
|
|
98
|
+
`)}function gh(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?Qs(i,e.previous.text):`${i.leading??" "}${Qs(l,e.next.text).trimStart()}`}}for(let i of r)o+=` ${Qs(i,e.next.text).trimStart()}`;return o}function hh(e,t,n){let r=new Map;for(let o of Zi(t)){let i=e.previous.pointers.get(Et(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(Et(o).start),l=i===void 0?void 0:r.get(i);if(l&&o.getName()!==null)s.set(l,o)}return s}function yh(e,t,n){let{text:r}=e.previous,s=Qs(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 eo(t,r);return`${Xi(t,r)}${o.leading??" "}${s}`}return`${Xi(t,r)} ${s}`}function Xi(e,t){let{start:n}=Et(e),[r]=e.entries;if(r)return t.slice(n,Et(r).start-(r.leading??"").length);let s=e.children&&Rn(e.children);if(s)return t.slice(n,s.start.offset-1).trimEnd();return eo(e,t)}function xh(e,t,n,r){let s=hh(e,t,n),o=new Set(s.values()),i=n.entries.filter((d)=>!o.has(d)),l=`${Xi(t,e.previous.text)}${gh(e,t,i)}`,c=Zi(n);if(c.length===0&&s.size===0)return l;let a=c[0]?Qi(c[0]):`${r} `,u=t.children,f=t.beforeChildren===""?" ":t.beforeChildren??" ";if(u&&u.nodes.length>0&&$h(u,e.previous.text,t)){let d=`${r}${bh(u,r)}`;return`${l}${f}{${Ku(e,u,c,d,a,s)}}`}let p=c.map((d)=>zu(e,d,a,`${r} `));return`${l}${f}{
|
|
99
|
+
${p.join("")}${r}}`}function bh(e,t){let[n]=e.nodes,r=n?Qi(n):"";return r.startsWith(t)?r.slice(t.length):" "}function $h(e,t,n){let{end:r,start:s}=Et(n),[o]=e.nodes;return o!==void 0&&(o.leading??"").includes(`
|
|
100
100
|
`)&&t.slice(s,r).includes(`
|
|
101
|
-
`)}function
|
|
102
|
-
`}function
|
|
101
|
+
`)}function zu(e,t,n,r){return`${r}${mh(eo(t,e.next.text),n,r)}
|
|
102
|
+
`}function Ku(e,t,n,r,s,o){let i=t.nodes.filter((g)=>!o.has(g)),l=dh(e,i,n),c=t.nodes[0]?.leading??"",a=c.indexOf(`
|
|
103
103
|
`),u=a===-1?"":c.slice(0,a+1),f=u,p=-1,d=()=>{if(f!==""&&!f.endsWith(`
|
|
104
104
|
`)&&!f.endsWith(";"))f+=`
|
|
105
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
106
|
`)||f===u||f.endsWith(";"))){f+=`${E}${m}${g.trailing??""}`;return}if(!f.endsWith(`
|
|
107
107
|
`))f+=`
|
|
108
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,
|
|
110
|
-
`)t+=String.raw`\n`;else if(n==="\t")t+=String.raw`\t`;else if(n==="\r")t+=String.raw`\r`;else if(
|
|
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,yh(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=Yi(e,b,m)?eo(b,e.previous.text):xh(e,b,m,Qi(b));x(b,S)}else d(),f+=zu(e,m,s,r)}return w(t.nodes.length),`${f}${t.trailing??""}`}function to(e,t,n){let r;try{r=n(e)}catch{return t}let s=n(t),o=Fn(s.document);if(Fn(r.document)===o)return e;let i={next:Bu(s,t),previous:Bu(r,e)},l=Ku(i,kt(e,{storeLocations:!0}),kt(t,{storeLocations:!0}).nodes,"","",new Map);try{return Fn(n(l).document)===o?l:t}catch{return t}}var no=v(()=>{Gs();K()});function Zu(e){return!/\p{Cs}/u.test(e)}function Qu(e,t){try{return kt(`x ${e}`).nodes[0]?.entries[0]?.getValue()===t}catch{return!1}}function so(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(Xu.test(n))t+=`\\u{${n.codePointAt(0)?.toString(16)}}`;else t+=n;return`${t}"`}function ep(e,t){let n="#";while(e.includes(t+n))n+="#";return n}function Eh(e,t){if(Sh.test(e))return null;let n=ep(e,'"""'),r=`${t}${we}`,s=e.split(`
|
|
111
111
|
`).map((i)=>i===""?"":r+i),o=`${n}"""
|
|
112
112
|
${s.join(`
|
|
113
113
|
`)}
|
|
114
|
-
${r}"""${n}`;return
|
|
115
|
-
`)){let r=
|
|
116
|
-
`))){let p=`${o} ${u.join(" ")}`;if(p.length<=
|
|
117
|
-
`)?null:`${ye(u,r)}=${p}`});if(a.every((u)=>u!==null)){let u=`${c} ${a.join(" ")}`;if(u.length<=
|
|
118
|
-
`))break;i.push(`${ye(p,r)}=${x}`),l+=1}let c=`${o} ${i.join(" ")}`,a=i.length>0&&c.length<=
|
|
119
|
-
`)})}function
|
|
120
|
-
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function
|
|
121
|
-
`))i.push(...
|
|
122
|
-
`))t.push(...
|
|
123
|
-
`)}`);else if(i.startsWith("$"))n.push(...
|
|
114
|
+
${r}"""${n}`;return Qu(o,e)?o:null}function ro(e,t,n){if(!Zu(e))throw new $e(`${n} holds a lone surrogate, which Jx Notation has no way to spell`);if(Yu.test(e))return e;if(e.includes(`
|
|
115
|
+
`)){let r=Eh(e,t);if(r)return r}else if((e.includes("\\")||e.includes('"'))&&!Xu.test(e)){let r=ep(e,'"'),s=`${r}"${e}"${r}`;if(Qu(s,e))return s}return so(e)}function ye(e,t){if(!Zu(e))throw new $e(`${t} is a key with a lone surrogate, which Jx Notation cannot spell`);return Yu.test(e)?e:so(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 ro(e,t,n);return Nr(e)?`(ref)${so(e.$ref)}`:null}function tp(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 np(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(ro(String(a),n,re(r,"parameters")));if(y(o))c.push(ro(o,n,re(r,"body")));else if(Array.isArray(o))return[`${c.join(" ")} {`,...o.flatMap((a,u)=>Ie("-",a,n+we,re(re(r,"body"),u))),`${n}}`];return[c.join(" ")]}function vh(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 Jh(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 jh(e,t){if(!Ee(t)||t.timing!=="server"||t.$src!=="#server"||t.$export!==e||!Object.keys(t).every((s)=>Oh.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 Ah(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 Ie(e,t,n,r){let s=ye(e,r),o=n+s,i=fe(t,n,r);if(i!==null)return[`${o} ${i}`];if(vh(t))return Jh(e,t,n,r);if(jh(e,t))return Ah(e,t,n,r);if(tp(t))return np(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<=ea)return[p]}return[`${o} {`,...t.flatMap((p,d)=>Ie("-",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<=ea)return[u]}return[`${c} {`,...l.flatMap(([u,f])=>Ie(u,f,n+we,re(r,u))),`${n}}`]}function rp(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<=ea,u=a?l:0,f=s.slice(u).flatMap(([p,d])=>{if(Ee(d)&&!Nr(d))return rp(p,d,n+we,re(r,p));return Ie(p,d,n+we,re(r,p))});if(a&&f.length===0)return[c];return[`${a?c:o} {`,...f,`${n}}`]}function Ch(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 Nh(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(" ")} {`,...Cr(s??null,t+we,re(n,"map")),`${t}}`]}function Cr(e,t,n){let r=fe(e,t,n);if(r!==null)return[`${t}- ${r}`];if(Ch(e))return Nh(e,t,n);if(Ee(e))return ta(e,t,n);throw new $e(`${n} is a list inside a list of children, which has no spelling`)}function Rh(e,t,n){let{tagName:r}=e;if(!y(r))return`${t}$element`;if(wh.has(r)||r.startsWith("$")||r.startsWith("."))return`${t}$element ${so(r)}`;return t+ye(r,n)}function Th(e,t){return t!==null&&!t.includes(`
|
|
120
|
+
`)&&!e.startsWith("on")&&!e.startsWith("$")&&!e.startsWith(".")}function kh(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}${ro(o,t,`/$script/${s}`)}`)}return r.length>0?r:null}function ta(e,t,n,r=[]){let s=[Rh(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))Gu(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(Th(p,x))s.push(`${ye(p,f)}=${x}`);else l[p]=d}else if(a==="state")i.push(...Ie("state",u,o,f));else if(a==="style"&&Ee(u))i.push(...rp("style",u,o,f));else if(a.startsWith("on")&&Nr(u))s.push(`${ye(a,f)}=${fe(u,t,f)}`);else if(a.startsWith("on"))i.push(...tp(u)?np(a,u,o,f):Ie(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(...Ie(a,u,o,f));else s.push(`${ye(a,f)}=${p}`)}else Gu(s,i,a,u,o,t,f)}if(Object.keys(l).length>0)i.push(...Ie("attributes",l,o,re(n,"attributes")));if(i.push(...Ph(e.children,o,re(n,"children"))),c!==null)s.push(c);return i.length===0?[s.join(" ")]:[`${s.join(" ")} {`,...i,`${t}}`]}function Ph(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)=>Cr(s,t,re(n,o)))}let r=fe(e,t,n);if(r!==null)return[`${t}.children ${r}`];return[`${t}.children {`,...Cr(e,t+we,n),`${t}}`]}function Gu(e,t,n,r,s,o,i){let l=ye(`.${n}`,i);if(n==="map"&&Ee(r)){t.push(`${s}${l} {`,...Cr(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)} {`,...Cr(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(...Ie(`.${n}`,r,s,i));else e.push(`${l}=${c}`)}function sp(e,t){return["$head {",...e.flatMap((n,r)=>Ee(n)&&!Nr(n)&&y(n.tagName)&&!n.$ref?ta(n,t,`/$head/${r}`):Ie("-",n,t,`/$head/${r}`)),"}"]}function _h(e){let{document:t,spans:n}=zi(e);return{document:A(t)?t:null,spans:n}}function na(e,t){let n=Mh(e);return t===void 0?n:to(t,n,_h)}function Mh(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?kh(l,we):null;if(c)o=c;else if(i==="$head"&&Array.isArray(l))n.push(...sp(l,we));else if(i==="$head")n.push(`(object)${Ie(i,l,"","/$head").join(`
|
|
123
|
+
`)}`);else if(i.startsWith("$"))n.push(...Ie(i,l,"",re("",i)));else r[i]=l}if(Object.keys(r).length>0)n.push("",...ta(r,"","",o));return`${n.join(`
|
|
124
124
|
`)}
|
|
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>
|
|
125
|
+
`}var we=" ",ea=100,Yu,Xu,Sh,wh,Ee=(e)=>A(e),Nr=(e)=>Ee(e)&&y(e.$ref)&&Object.keys(e).length===1,re=(e,t)=>`${e}/${String(t).replaceAll("~","~0").replaceAll("/","~1")}`,Oh;var ra=v(()=>{Gs();K();In();jr();no();Yu=/^(?![-+]?\.?\d)(?!(?:true|false|null|inf|-inf|nan)$)[^\s\\/(){};[\]"#=,\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+$/u,Xu=/[\p{Cc}\p{Zl}\p{Zp}--]/u,Sh=/(?!\n)\p{Cc}|[\p{Zl}\p{Zp}--]/u,wh=new Set(["-","attributes","script","state","style"]);Oh=new Set(["$export","$src","arguments","timing"])});function Lh(e,t,n){if(Ln(e,t)!==null)throw W(e,t,`"project" names the file's kind, and takes no annotation`);let r=We(e,t);if(r.length>1||He(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 Fh(e,t,n){let r=t.getName(),s=`/${oe(r)}`,o=t.getTag()===null,i;if(r==="$head"&&o)i=qi(e,t),pe(e,s,t);else if(Ih.has(r)&&o)i=Zs(e,t,s);else i=Ve(e,t,s);L(n,r,i,e,t)}function Vh(e){if(En(e.text)==="document")throw new $e('A project file declares itself: its first node, after any $ metadata, is project "<name>"');let t=Ui(e.text),n={},r=!1;for(let s of t.nodes)if(s.getName()===Dh){if(r)throw W(e,s,'"project" is written twice, and a file declares one project');Lh(e,s,n),r=!0}else Fh(e,s,n);return vn(n)}function sa(e,t){try{return Vh({spans:null,text:e})}catch(n){throw t!==void 0&&n instanceof $e?n.inFile(t):n}}var Dh="project",Ih;var oa=v(()=>{K();hr();gr();In();jr();no();ra();Ih=new Set(["$media","style"])});var Rr=v(()=>{gr();Ki();In();Hu();jr();no();ra();oa()});function lp(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(!op.test(s)||!op.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&&Hh.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 cp(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(lp(e)===null)return`"${e}" is not a well-formed media type (RFC 6838 §4.2)`;return null}function up(e){let t=lp(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 op,Hh,ip="text/markdown; variant=GFM",ap="application/yaml",fE;var pp=v(()=>{K();op=/^[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}$/,Hh=new Set(["vnd","prs","x"]);fE={".jxn":"text/plain; charset=utf-8",".markdown":`${ip}; charset=utf-8`,".md":`${ip}; charset=utf-8`,".yaml":`${ap}; charset=utf-8`,".yml":`${ap}; charset=utf-8`}});function gp(e){if(e===null)throw TypeError("A class descriptor cannot be null");return A(e)?e:{}}class Tr{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=up(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=qh(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 oo{#t;get#e(){return[...this.#t,Gh]}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=cp(t.mediaType);if(n!==null)throw Error(`Format "${t.name}" declares an invalid mediaType: ${n}`)}for(let t of dp){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=fp(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=fp(e);return this.#e.some((n)=>n.extensions.includes(t))}}function qh(e){let t={},n=e.$defs?.methods??{};for(let[r,s]of Object.entries(n)){let{role:o}=s;if(!zh(o))continue;let i={identifier:s.identifier??r,timing:s.timing??Bh};if(y(s.discriminator))i.discriminator=s.discriminator;t[o]=i}return t}function zh(e){return e!==void 0&&Uh.has(e)}function fp(e){let t=e.toLowerCase();return t.startsWith(".")?t:`.${t}`}var dp,mp,Bh,Uh,Kh,Gh;var ia=v(()=>{K();pp();dp=["parse","serialize","rewrite","discover","load"],mp=[...dp,"projectData","resolvePaths","lower","emit","head","assets","mount","dialect","deploySchema","bindings","testConnection"];Bh=["compiler","server"];Uh=new Set(mp);Kh={importModule:async()=>{await Promise.resolve().then(() => Rr());return{JxNotation:{parse:(n)=>Or(n),serialize:(n)=>na(n)}}},loadJson:()=>Promise.reject(Error("Jx Notation reads no file of its own")),resolvePath:(e,t)=>t},Gh=new Tr("jxn","",{$defs:{methods:{parse:{role:"parse"},serialize:{role:"serialize"}}},$implementation:"jxn",format:{documentKinds:["page","component"],extensions:[".jxn"]},title:"JxNotation"},Kh)});class hp{#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 oo(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 yp(e,t,n){let r=[];for(let s of e??[])r.push(await Yh(s,t,n));return new hp(r)}async function Yh(e,t,n){let r;if(e.startsWith("./")||e.startsWith("../")){let c=t.resolvePath(n,e);r=t.resolvePath(`${c}/package.json`,`./${kr}`)}else try{r=t.resolvePath(n,`${e}/${kr}`)}catch(c){throw Error(`Extension "${e}" is not resolvable: it must export ${kr} (is the package installed, and does its exports map include it?): ${aa(c)}`,{cause:c})}let s;try{s=await t.loadJson(r)}catch(c){throw Error(`Extension "${e}": cannot read manifest ${r}: ${aa(c)}`,{cause:c})}if(!A(s)||!y(s.name))throw Error(`Extension "${e}": ${kr} 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}: ${aa(p)}`,{cause:p})}i.push(new Tr(c,u,gp(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 aa(e){return e instanceof Error?e.message:String(e)}var kr="jx-extension.json";var xp=v(()=>{ia();K();ia()});var bp=v(()=>{K()});function Zh(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 Sp(e){let t=Xh.filter((n)=>e(n));if(t.length>1)return"conflict";return t[0]??null}function RE(e,t){return Ar(t)?sa(e,t):nu(e,t)}var Xh,$p="project.jxn",la;var wp=v(()=>{K();bp();gr();Ki();oa();hr();Xh=["project.jxn","project.json"];la=class la extends Error{constructor(e){super(Zh(e));this.name="ProjectFileConflictError"}}});import{accessSync as ME,closeSync as DE,constants as IE,existsSync as Qh,fstatSync as LE,lstatSync as FE,openSync as VE,readFileSync as WE,statSync as HE}from"node:fs";import{dirname as qE,join as Ep}from"node:path";function ey(e){return Sp((t)=>Qh(Ep(e,t)))}function vp(e){let t=ey(e);if(t==="conflict")throw new la(e);return Ep(e,t??$p)}var Jp=v(()=>{wp()});import{existsSync as ty,readFileSync as ny}from"node:fs";import{dirname as ao,isAbsolute as ry,resolve as Op,sep as io}from"node:path";import{pathToFileURL as sy}from"node:url";import{createRequire as oy}from"node:module";function jp(e){let t=[e],n=`${io}src${io}`,r=`${io}dist${io}`;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 tv(e){let t=jp(e),n=ao(e),r=[...t.filter((o)=>ao(o)===n),...t.filter((o)=>ao(o)!==n)],s=r.find((o)=>ty(o));if(s===void 0)throw Error(`no module at ${e} (tried ${r.join(", ")})`);return s}async function iy(e){let t=jp(e),n;for(let r of t)try{return await import(sy(r).href)}catch(s){n=s}throw n instanceof Error?n:Error(String(n))}function ay(e,t){return oy(Op(e,"package.json")).resolve(t)}function ly(e){return{importModule:(t)=>iy(t),loadJson:async(t)=>JSON.parse(ny(t,"utf8")),resolvePath:(t,n)=>{if(n.startsWith("./")||n.startsWith("../"))return Op(ao(t),n);if(ry(n))return n;return ay(e,n)}}}async function nv(e,t){return yp(t?.extensions,ly(e),vp(e))}function lo(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 ca=v(()=>{xp();K();Jp()});function uy(e){let t=JSON.stringify(e);return/^\.{1,2}\//u.test(e)?`new URL(${t}, import.meta.url).href`:t}async function mo(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),_t(f))u=Gt(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(() => ca());throw lo(f,H)}u=await O.parseDocument(k(f,"utf8"))}if(u=Wn(u,f),t.projectRoot!==void 0){let{relative:R}=await import("node:path");u=Zo(u,R(t.projectRoot,f))}}else{if(u=Wn(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=$c(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=wn(d);if(r)u.$media={...r,...u.$media};let{resolveClass:b,rewriteSrc:S}=t,E=u.imports??{},J=ua(u,m,g,S?(k)=>S(k,w):void 0,dt(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 py(e,t={}){let{title:n="Jx App",reactivitySrc:r=fn,litHtmlSrc:s=Jt}=t,o=await mo(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>
|
|
126
126
|
<html lang="en">
|
|
127
127
|
<head>
|
|
128
128
|
<meta charset="utf-8">
|
|
129
129
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
130
130
|
<title>${G(n)}</title>
|
|
131
|
-
${
|
|
131
|
+
${dn({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
132
132
|
</head>
|
|
133
133
|
<body>
|
|
134
134
|
<${i.tagName}></${i.tagName}>
|
|
135
135
|
<script type="module" src="./${c}"></script>
|
|
136
136
|
</body>
|
|
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
|
|
137
|
+
</html>`;return{files:o.files,html:a}}function fy(e){if(!j(e)||Array.isArray(e))return JSON.stringify(e);if("default"in e)return JSON.stringify(e.default);if(vt(e))return;if(e.$prototype==="LocalStorage"||e.$prototype==="SessionStorage")return JSON.stringify(e.default??null);if(e.$prototype==="Request")return"null";if(xn(e))return"null";if(pt(e))return"null";return JSON.stringify(e)}function ua(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=rt(e),p=ds(fs(u,f),r);a.push(...p.imports);let d=Js(u,l),x=d.entries.length>0;a.push(...d.imports);let w=Object.entries(u).flatMap(([N,C])=>ut(C)&&C.$prototype==="Request"?[[N,C]]:[]),g=Object.entries(u).flatMap(([N,C])=>pt(C)?[[N,C]]:[]),m=ys(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?$s:[],hs()),m.arranged||m.keyed)a.push(bs());if(m.keyed)a.push(Ss());let b=Object.keys(u).filter((N)=>!Zt(N)),S=b.filter((N)=>!cy.has(N)),E=S.filter((N)=>i.includes(N)),J=E.length>0;a.push(`const __jxProps = ${JSON.stringify(b)};`);let M=ei(e),k=S.filter((N)=>M.has(N));if(S.length>0)a.push(`const __jxBridged = ${JSON.stringify(S)};`,Cc());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=pr(e);if(P.length>0)a.push(Nc(),`const __jxObserved = ${JSON.stringify(P)};`,`const __jxObservedDefaults = () => ${Tc(e)};`);if(g.length>0)a.push(Es());if(x)a.push(vs());let R=s===null&&pn(e.children);if(R)a.push(Mc());let H=e.formAssociated===!0;if(H)a.push(_c());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=[],Be=[],Mr=[];for(let[N,C]of Object.entries(u))if(Ne(C))if(et(C))Be.push([N,C]);else if(Ke(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("${"))Mr.push([N,C]);else{let ie=fy(C);if(ie!==void 0)O.push([N,ie])}a.push(" this.state = reactive({");for(let[N,C]of O)a.push(` ${mt(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(tt(C)){let ie=Fe(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 Yt=y(C.body)?C.body:"";a.push(` ${ie} = (${nt(C).join(", ")}) => {`,` ${Yt}`," };")}}for(let[N,C]of Be){a.push("");let ie=Te(C.$expression,{eventParam:"e",statePrefix:"this.state"});a.push(` ${U("this.state",xe(N))} = ${or(C,ie)};`)}for(let[N,C]of Mr){let ie=hn(C,"this.state",{code:!1}),Yt=ms(ie);a.push("",fo(ie)?` ${U("this.state",xe(N))} = computed(() => { const state = this.state; return ${Yt}; });`:` ${U("this.state",xe(N))} = computed(() => ${Yt});`)}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=hn(y(C.body)?C.body:"","this.state");a.push(` ${ie}`," });")}let Sa=dy(e);if(Sa.length>0){a.push(""," {"," const s = this.state;");for(let{type:N,source:C}of Sa)a.push(` this.addEventListener(${JSON.stringify(N)}, ${C});`);a.push(" }")}a.push(" }","");let sf={n:0};for(let N of js(e))Lc(N,sf,e.tagName??"jx");let yo=Np(),wa=!Array.isArray(e.children)&&e.textContent!==void 0?` ${go(e.textContent)}`:uo(e.children,e.style," ",!1,!1,yo),of=[wa,...yo.decls].some((N)=>fo(N));if(a.push(" template() {"," const s = this.state;",...of?[" const state = s;"]:[],...yo.decls," return html`",wa," `;"," }","",...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: ${uy(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)) ${ws}(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 && ${gi}(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 = ${hi}(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 ??= ${Os(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(cs(N,C,{collect:"this.#effects",indent:" ",statePrefix:"this.state"}));for(let[N,C]of g)a.push(us(N,C,{collect:"this.#effects",indent:" ",serverBaseUrl:o,statePrefix:"this.state"}));if(a.push(...my(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 Yt=ie.replaceAll(/\$\{([^}]+)\}/g,(Qy,af)=>`\${${hn(af,"this.state")}}`);a.push(` this.style['${C}'] = \`${Yt}\`;`)}a.push(" }));")}}if(R)a.push(` const _slotted = _first ? ${xi}(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) ${bi}(this, _slotted);`);if(H)a.push(" if (_first) {"," const _i = this.#attach();"," if (_i) {",` this.#form = ${yi}(this, _i, this.state, ${JSON.stringify(Cl(e))}, () => ${s===null?"this":"this.#renderRoot()"}, ${gy(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;",` ${ws}(this.state, name, newVal, __jxObservedDefaults());`," }");return a.push("}","",`customElements.define('${e.tagName}', ${t});`,""),a.join(`
|
|
138
|
+
`)}function Np(){return{byText:new Map,decls:[]}}function Rp(e,t){let n=e.byText.get(t);if(n)return n;let r=`_c${e.decls.length}`;e.decls.push(` const ${r} = html\`
|
|
139
139
|
${t}
|
|
140
|
-
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function
|
|
141
|
-
`)}function
|
|
140
|
+
\`;`);let s=`\${${r}}`;return e.byText.set(t,s),s}function uo(e,t,n,r=!1,s=!1,o=null,i=!1){if(!e)return"";let l=i?bn:"";if(Q(e))return`${Cp(e,n)}${l}`;if(!Array.isArray(e))return"";return Ce(e.map((c)=>{if(Q(c))return`${Cp(c,n)}${l}`;let a=pa(c,r?"":n,r,s,o);return y(c)&&c.includes("${")||j(c)&&Ue(c.tagName)?`${a}${l}`:a}),{lead:n,preformatted:r,separator:`
|
|
141
|
+
`})}function pa(e,t,n=!1,r=!1,s=null,o=null){if(y(e)){if(e.includes("${"))return`${t}${go(e)}`;return`${t}${G(e)}`}if(Y(e)||le(e))return`${t}${G(String(e))}`;if(!j(e))return"";if(Ue(e.tagName)){let g=e.tagName.$expression,m=gt(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||xt.has(R)),J=null;if(s&&E.every((R)=>R===E[0])){let R=Ap(e,`${t} `,E[0]===!0,r,s,S.some((H)=>H.includes("-")));if(R.trim()!=="")J=Rp(s,R)}let M=b.map(([R,H])=>{let O={...e,tagName:H};return[R,pa(O,`${t} `,n,r,s,J)]});if(g.operator==="?:"){let[,R]=M[0],[,H]=M[1];return`${t}\${${m}
|
|
142
142
|
? html\`
|
|
143
143
|
${R}
|
|
144
144
|
\`
|
|
@@ -151,27 +151,27 @@ ${k.join(`,
|
|
|
151
151
|
`)}
|
|
152
152
|
}[String(${m})] ?? html\`
|
|
153
153
|
${P}
|
|
154
|
-
\`}`}let i=e.tagName??"div",l=n||
|
|
154
|
+
\`}`}let i=e.tagName??"div",l=n||xt.has(i),c=[],a=Tp(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}="\${${Lt}('${g}', ${Pe(m.$ref)}) ?? nothing}"`);else if(y(m)&&fa(m))c.push(`${g}="\${${Lt}('${g}', ${Oe(m).slice(2,-1)}) ?? nothing}"`);else if(y(m)&&m.includes("${"))c.push(`${g}="${Oe(m)}"`);else if(le(m)){let b=ot(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(Ge.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(po(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(po(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;yt(`inline "${g}" handler`,m);let b=g.slice(2).toLowerCase(),S=da(m,u);if(S!==null)c.push(`@${b}="\${${S}}"`)}let f=Pp(e.style);if(f)c.push(`style="${f}"`);let p=c.length>0?`
|
|
155
155
|
${t} ${c.join(`
|
|
156
156
|
${t} `)}`:"";if(new Set(["input","br","hr","img","meta","link"]).has(i))return`${t}<${i}${p}
|
|
157
|
-
${t}>`;let x=o??
|
|
158
|
-
${t}>${x}${w}</${i}>`}function
|
|
159
|
-
${c.map(([p,d])=>{let x=s&&u.has(d)?
|
|
157
|
+
${t}>`;let x=o??Ap(e,t,l,r,s,i.includes("-")),w=i==="slot"?bn:"";return l?`${w}<${i}${p}>${x}${w}</${i}>`:`${t}${w}<${i}${p}
|
|
158
|
+
${t}>${x}${w}</${i}>`}function Ap(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,pa(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)?Rp(s,d):d;return` ${JSON.stringify(p)}: html\`
|
|
160
160
|
${x}
|
|
161
161
|
\``}).join(`,
|
|
162
162
|
`)}
|
|
163
|
-
}[${l}]}`}if(e.textContent!==void 0){let i=
|
|
164
|
-
${
|
|
165
|
-
|
|
163
|
+
}[${l}]}`}if(e.textContent!==void 0){let i=go(e.textContent),l=_(e.textContent)||y(e.textContent)&&e.textContent.includes("${");return o&&l?`${i}${bn}`:i}if(e.innerHTML!==void 0)return e.innerHTML;if(e.children)return n?uo(e.children,e.style,"",!0,r,s,o):ns(uo(e.children,e.style,`${t} `,!1,r,s,o),{close:`
|
|
164
|
+
${t}`,lead:`${t} `,open:`
|
|
165
|
+
`});return""}function Cp(e,t){lr(e);let n=_(e.key),r=JSON.stringify(Array.isArray(e.items)?e.items:[]),s=n?`${cr}(${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=Tp(c,Oe,co);if(c.attributes)for(let[E,J]of Object.entries(c.attributes)){if(E==="class"&&f!==null)continue;if(_(J))u.push(`${E}="\${${co(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(Ge.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(po(J))u.push(`.${E}="\${${co(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}="\${${co(J.$ref)}}"`);else if(y(J)&&J.includes("${"))u.push(`.${E}="${Oe(J)}"`);else u.push(`.${E}="\${${JSON.stringify(J)}}"`);let p=Pp(c.style);if(p)u.push(`style="${p}"`);for(let[E,J]of Object.entries(c)){if(!E.startsWith("on"))continue;yt(`inline "${E}" handler`,J);let M=E.slice(2).toLowerCase(),k=da(J,"s.$map = $map; ");if(k!==null)u.push(`@${M}="\${${k}}"`)}let d=u.length>0?`
|
|
166
166
|
${t} ${u.join(`
|
|
167
|
-
${t} `)}`:"",x=
|
|
168
|
-
${
|
|
169
|
-
|
|
167
|
+
${t} `)}`:"",x=Np(),w="";if(c.textContent!==void 0)w=go(c.textContent);else if(c.children)w=ns(uo(c.children,null,`${t} `,!1,!0,x),{close:`
|
|
168
|
+
${t} `,lead:`${t} `,open:`
|
|
169
|
+
`});let g=`html\`
|
|
170
170
|
${t} <${a}${d}
|
|
171
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(
|
|
173
|
-
})(s, e);`;return`${
|
|
174
|
-
`}function
|
|
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(xs(E)),JSON.stringify(E),b];return`${t}\${${ur}(${J.join(", ")})}`}let S=l?`${yn}(${s}, ${o}, ${i})`:s;return`${t}\${${S}.map(${b})}`}function Tp(e,t,n){if(!fr(e))return null;let r=dr(e),s="";if(_(r))s=`\${${n(r.$ref)} ?? ""}`;else if(y(r))s=t(r);else if(Y(r))s=String(r);let o=Ot(e)??"";return`class="${[s,o].filter((i)=>i!=="").join(" ")}"`}function po(e){return _(e)&&e.$ref!==""}function Pe(e){let t=Ae(e);if(t.startsWith("#/state/"))return U("s",t.slice(8));if(t.startsWith("$map/"))return kp(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 kp(e){let[t,...n]=Le(e);return U(t??"",n.map((r)=>xe(r)).join("/"))}function co(e){let t=Ae(e);if(t.startsWith("$map/"))return kp(t.slice(5));return Pe(t)}function Oe(e){return hn(e,"s",{code:!1})}function fa(e){return e.startsWith("${")&&e.endsWith("}")&&!e.slice(2).includes("${")}function go(e){if(_(e))return`\${${Pe(e.$ref)}}`;if(y(e)&&e.includes("${"))return Oe(e);return String(e)}function fo(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(Sc(n))return!0;continue}}n+=s}return!1}function da(e,t){if(po(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}${hy(e)} }`;return null}function dy(e){let t=[];for(let[n,r]of Object.entries(e)){if(!n.startsWith("on")||Ge.has(n))continue;yt(`root "${n}" handler`,r);let s=da(r,"");if(s!==null)t.push({source:s,type:n.slice(2).toLowerCase()})}return t}function my(e){let t=[],n=(r,s,o)=>[" this.#effects.push(effect(() => {",o?" const s = this.state, state = s;":" const s = this.state;",` const _v = ${Lt}(${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)&&fa(s)){let i=Oe(s);t.push(...n(o,i.slice(2,-1),fo(i)))}else if(y(s)&&s.includes("${")){let i=Oe(s);t.push(...n(o,`\`${i}\``,fo(i)))}else if(le(s)){let i=ot(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 gy(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 ${fa(e)?t.slice(2,-1):`\`${t}\``}; } catch { return null; } }`}return`() => ${JSON.stringify(e)}`}function hy(e){if(tt(e))return Fe(e.body,{dispatchTarget:"e.currentTarget",eventParam:"e",statePrefix:"s"});let t=y(e.body)?e.body:"";if(Hn(e))return`((${nt(e).join(", ")}) => { ${t}
|
|
173
|
+
})(s, e);`;return`${hn(t,"s",{bare:!0})}
|
|
174
|
+
`}function Pp(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 cy;var ho=v(()=>{Zn();Wr();Qo();en();Yn();Ft();K();Rr();rs();rn();cy=new Set(["state","template","constructor","connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","formResetCallback","formDisabledCallback"])});function _p(e,t){let{title:n="Jx App"}=t,r=gn(e,null,e.state??{},e.$media??{}),s=Sn(e,e.$media??{},t.projectStyle??null),o=Mp(e,r),i=[],l=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((a)=>ft(String(a))!==null)?`<script>${gs()}</script>
|
|
175
175
|
`:"",c=`<!DOCTYPE html>
|
|
176
176
|
<html lang="en">
|
|
177
177
|
<head>
|
|
@@ -184,9 +184,9 @@ ${t}\``,m=(g.includes("$map")?"const $map = { item, index }; ":"")+x.decls.map((
|
|
|
184
184
|
<body>
|
|
185
185
|
${o}
|
|
186
186
|
</body>
|
|
187
|
-
</html>`;return{files:i,html:c}}function
|
|
188
|
-
${
|
|
189
|
-
})()`)};`);else g.push([O,{args:["state","e"],body:
|
|
187
|
+
</html>`;return{files:i,html:c}}function Mp(e,t){if(y(e))return G(e);if(Y(e)||le(e))return G(String(e));if(!j(e))return"";let n=gn(e,t.scope,e.state??t.scopeDefs,e.$media??t.media),r=mr(e.tagName,n.scope),s=It(e,n.scope);if($i.has(r))return`<${r}${s}>`;let o=t.preformatted===!0||xt.has(r),i=yy(e,r,{...n,preformatted:o});return`<${r}${s}>${i}</${r}>`}function yy(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(mn(e))return e.innerHTML;let s=te(e.innerHTML,n.scope);return s==null?e.innerHTML:String(s)}let r=ar(e,t,n.scope);if(r!==void 0)return r;if(Array.isArray(e.children))return Ce(e.children.map((s)=>Mp(s,n)),{preformatted:n.preformatted});return""}var Dp=v(()=>{Zn();Ft();K()});function xa(e,t){let{title:n="Jx App",reactivitySrc:r=fn,litHtmlSrc:s=Jt,modulePath:o="app.js",serverBaseUrl:i="/_jx/server"}=t,l=gn(e,null,e.state??{},e.$media??{}),c=rt(e),a=Sn(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=Js(S,t.resolveClass);for(let[O,T]of Object.entries(S)){if(!j(T)||Array.isArray(T)){if(B(T))x.push([O,`() => ${ms(T)}`]);else d.push([O,T]);continue}if(Ne(T)){let de=T.$expression,Be=Te(de,{eventParam:"e",statePrefix:"state"});if(et(T))m.push(`state[${JSON.stringify(O)}] = ${or(T,Be)};`);else if(Ke(de.operator))g.push([O,{args:["state","e"],body:Be}]);else x.push([O,`() => ${Be}`]);continue}if(me(T)){let{body:de}=T;if(Array.isArray(de)){let Be=Fe(de,{eventParam:"e",statePrefix:"state"});if(T.parameters&&T.parameters.length>0)m.push(`state[${JSON.stringify(O)}] = ${or(T,`(() => {
|
|
188
|
+
${Be}
|
|
189
|
+
})()`)};`);else g.push([O,{args:["state","e"],body:Be}])}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:nt(T),body:de}]);continue}if(vt(T))continue;if(Lr(T)){d.push([O,T.default]);continue}if(ut(T)){if(T.$prototype==="LocalStorage"||T.$prototype==="SessionStorage"){let de=T.$prototype==="LocalStorage"?"localStorage":"sessionStorage",Be=T.key??O,Mr=T.default??null;d.push([O,null]),m.push(Sy(O,de,Be,Mr));continue}if(T.$prototype==="Request"){d.push([O,null]),m.push(cs(O,T));continue}if(T.$prototype==="Cookie"){d.push([O,null]),m.push(wy(O,T.name??O,T.default??null));continue}if(xn(T)){d.push([O,null]);continue}}if(pt(T)){d.push([O,null]),b.push(us(O,T,{serverBaseUrl:i}));continue}d.push([O,T])}let J=Ip(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=fs(S,c),k=$y(d,x,w,g,m,b,M,u,r,t.rewriteSrc,E,ys(e)),P=dn({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports}),R=t.prePaintScheme!==!1&&Object.values(e.$media??{}).some((O)=>ft(String(O))!==null)?`<script>${gs()}</script>
|
|
190
190
|
`:"",H=`<!DOCTYPE html>
|
|
191
191
|
<html lang="en">
|
|
192
192
|
<head>
|
|
@@ -200,24 +200,27 @@ ${He}
|
|
|
200
200
|
<body>
|
|
201
201
|
${J}
|
|
202
202
|
</body>
|
|
203
|
-
</html>`;return{files:[{content:k,path:o}],html:H}}function
|
|
203
|
+
</html>`;return{files:[{content:k,path:o}],html:H}}function Ip(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=gn(e,t.scope,e.state??t.scopeDefs,e.$media??t.media);if(Ue(e.tagName))throw Error(`A tag chosen at creation is not supported on a dynamic page yet (candidates: ${Xt(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||xt.has(i);let l=[],c=!1;if(e.textContent!==void 0){let g=e.textContent;if(ee(g)){let m=Pr(g.$ref);l.push(`:text-content="${m}"`),ga(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;yt(`inline "${g}" handler`,m);let b=g.slice(2).toLowerCase();if(ee(m)){let S=Pr(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:Fe(E,{eventParam:"e",statePrefix:"state"})}:{args:Hn(m)?nt(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(Wp(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"?Ot(e):void 0;if(b!==void 0&&(ee(m)||B(m))){let S=`_t${s.t}`;s.t+=1;let E=ee(m)?ya(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=Pr(m.$ref);l.push(`:attr.${g}="${S}"`),ga(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(Ge.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=Pr(m.$ref);l.push(`:${Re(g)}="${b}"`),ga(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=It(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)?ya(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\`${ha(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=ar(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=mn(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,`() => ${Vp(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=Ce(d.children.map((S)=>ha(S,o.preformatted)),{preformatted:o.preformatted,separator:`
|
|
204
|
+
`});n.set(g,o.preformatted?`() => html\`${m}\``:`() => html\`
|
|
204
205
|
${m}
|
|
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(
|
|
206
|
+
\``),l.push(`:render="${g}"`),c=!0;let b=` ${l.join(" ")}`;return`<${i}${a} data-bind${b}></${i}>`}else if(Array.isArray(d.children)){if(xy.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=Ce(d.children.map((g)=>Ip(g,o,n,r,s)),{preformatted: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 Lp(e,t=!1){if(!e)return"";if(Ue(e.tagName))throw Error(`A tag chosen at creation is not supported inside a dynamic page's repeater yet (candidates: ${Xt(e.tagName).join(", ")}). Move the item into a component, or give it a literal tagName.`);let n=e.tagName??"div",r=t||xt.has(n),s="";if(e.id)s+=` id="${e.id}"`;let o=fr(e);if(o){let a=dr(e),u="";if(ee(a))u=`\${${Vn(a.$ref)} ?? ""}`;else if(y(a))u=Mt(a);else if(Y(a))u=String(a);let f=[u,Ot(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}="\${${Vn(u.$ref)}}"`;else if(B(u))s+=` .${a}="${Mt(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}="${Mt(u)}"`;continue}if(ee(u)){s+=` ${a}="\${${Vn(u.$ref)}}"`;continue}if(le(u)){let f=ot(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(Wp(f))continue;if(B(String(f)))a.push(`${Re(u)}: ${Mt(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;yt(`inline "${a}" handler`,u);let f=a.slice(2).toLowerCase();if(ee(u)){let p=Pr(u.$ref);s+=` @${f}=\${(e) => { state.$map = { item, index }; on.${p}(e); }}`}else if(tt(u)){let p=Fe(u.body,{eventParam:"e",statePrefix:"state"});s+=` @${f}=\${(e) => { state.$map = { item, index }; ${p} }}`}else if(me(u)){let p=by(u.body),d=Hn(u)?`((${nt(u).join(", ")}) => { ${p}
|
|
206
207
|
})(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(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
`)}function
|
|
216
|
-
`)}function
|
|
208
|
+
`;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(Ge.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}="\${${Vn(u.$ref)}}"`;else if(B(u))s+=` .${a}="${Mt(u)}"`;else s+=` .${a}="\${${JSON.stringify(u)}}"`}let i=n.includes("-")?bn:"",l="";if(e.textContent!==void 0){let a=String(e.textContent);if(B(a))l=`${Mt(a)}${i}`;else if(ee(e.textContent))l=`\${${Vn(e.textContent.$ref)}}${i}`;else l=G(a)}else if(e.innerHTML)l=Mt(String(e.innerHTML));else if(Q(e.children))l=li([`${Fp(e.children)}${i}`],{close:`
|
|
209
|
+
`,open:`
|
|
210
|
+
`,separator:`
|
|
211
|
+
`});else if(Array.isArray(e.children)){let a=e.children.map((u)=>{let f=ha(u,r);return Q(u)||y(u)&&B(u)?`${f}${i}`:f});l=li(a,{close:`
|
|
212
|
+
`,open:`
|
|
213
|
+
`,preformatted:r,separator:`
|
|
214
|
+
`})}if(new Set(["input","br","hr","img","meta","link"]).has(n))return`<${n}${s}>`;return`<${n}${s}>${l}</${n}>`}function ha(e,t=!1){if(y(e))return B(e)?Mt(e):G(e);if(Y(e)||le(e))return G(String(e));if(Q(e))return Fp(e);return Lp(e,t)}function Fp(e){return`\${${Vp(e)}}`}function ma(e){return Ae(e).startsWith("$map/")?Vn(e):ya(e)}function Vp(e){lr(e);let{items:t,filter:n,sort:r,key:s}=e,o=ee(s),i=JSON.stringify(t??[]),l=o?`${cr}(${JSON.stringify(i)})`:i;if(ee(t))l=ma(t.$ref);let c=ee(n)?ma(n.$ref):"undefined",a=ee(r)?ma(r.$ref):"undefined",u=`(item, index) => html\`${Lp(e.map)}\``;if(o){let f=s.$ref,p=[`(${l} ?? [])`,c,a,JSON.stringify(xs(f)),JSON.stringify(f),u];return`${ur}(${p.join(", ")})`}if(ee(n)||ee(r))return`${yn}(${l}, ${c}, ${a}).map(${u})`;return`(${l} ?? []).map(${u})`}function Mt(e){return e.replaceAll("$map.","")}function by(e){return e.replaceAll(/(?<![\w$.])\$map\./gu,"")}function $y(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(...$s);let m=ds(i,a);if(p.push(...m.imports,...u.imports,...m.loaders,"",hs()),f.arranged||f.keyed)p.push(bs());if(f.keyed)p.push(Ss());if(o.length>0)p.push("",Es());let b=u.entries.length>0;if(b)p.push("",vs(),"const _jxInstances = new Map();");p.push("","const state = reactive({");for(let[S,E]of e)p.push(` ${mt(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(` ${mt(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(` ${mt(S)}: (e) => { const fn = (${E.args.join(", ")}) => { ${E.body}
|
|
215
|
+
}; 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 = ${Lt}(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 ${Os(u.entries,{indent:"",instances:"_jxInstances",statePrefix:"state"})};`);return p.push("hydrate(document);",""),p.join(`
|
|
216
|
+
`)}function Sy(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(`
|
|
217
|
+
`)}function wy(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(`
|
|
218
|
+
`)}function Wp(e){return e===null||j(e)}function Vn(e){let t=Ae(e);if(t.startsWith("$map/")){let[n,...r]=Le(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 ya(e){return ol("state",e.startsWith("#/state/")?e.slice(8):e)}function Pr(e){return il(e.startsWith("#/state/")?e.slice(8):e)}function ga(e,t,n){if(e.has(t))return;e.set(t,`() => ${U("state",n.startsWith("#/state/")?n.slice(8):n)}`)}var xy;var ba=v(()=>{en();Yn();Ft();K();Zn();rn();xy=new Set(["script","style","textarea","title"])});function Ey(e){return e!==null&&(e.locales.length>1||e.routing==="prefix-always")}function vy(e,t){if(t.routing==="prefix-except-default"&&e===t.defaultLocale)return"/";return`/${e.toLowerCase()}/`}function Hp(e,t=""){if(e===null||!Ey(e))return"";let n=JSON.stringify(e.locales),r=JSON.stringify(e.defaultLocale),s=JSON.stringify(Object.fromEntries(e.locales.map((i)=>[i,ln(t,vy(i,e))]))),o=JSON.stringify(ln(t,"/"));return`
|
|
217
219
|
// ─── Locale negotiation (RFC 4647 Lookup over Accept-Language) ───────────────
|
|
218
|
-
const JX_LOCALES = ${
|
|
219
|
-
const JX_DEFAULT_LOCALE = ${
|
|
220
|
-
const
|
|
220
|
+
const JX_LOCALES = ${n}
|
|
221
|
+
const JX_DEFAULT_LOCALE = ${r}
|
|
222
|
+
const JX_ROOT = ${o}
|
|
223
|
+
const JX_LOCALE_HOMES = ${s}
|
|
221
224
|
|
|
222
225
|
function jxParseAcceptLanguage(header) {
|
|
223
226
|
const parsed = []
|
|
@@ -257,24 +260,24 @@ function jxLookupRange(range, available) {
|
|
|
257
260
|
function jxNegotiateLocale(header, available, fallback) {
|
|
258
261
|
if (typeof header !== 'string' || header.trim() === '') return fallback
|
|
259
262
|
for (const range of jxParseAcceptLanguage(header)) {
|
|
260
|
-
if (range === '*')
|
|
263
|
+
if (range === '*') continue
|
|
261
264
|
const match = jxLookupRange(range, available)
|
|
262
265
|
if (match !== null) return match
|
|
263
266
|
}
|
|
264
267
|
return fallback
|
|
265
268
|
}
|
|
266
269
|
|
|
267
|
-
app.use(
|
|
270
|
+
app.use(JX_ROOT, async (c, next) => {
|
|
268
271
|
const locale = jxNegotiateLocale(c.req.header('accept-language'), JX_LOCALES, JX_DEFAULT_LOCALE)
|
|
269
|
-
const home = JX_LOCALE_HOMES[locale] ||
|
|
270
|
-
if (home !==
|
|
272
|
+
const home = JX_LOCALE_HOMES[locale] || JX_ROOT
|
|
273
|
+
if (home !== JX_ROOT) {
|
|
271
274
|
// 302, never 301: the target depends on the request, so it must never be cached as permanent.
|
|
272
275
|
return new Response(null, {
|
|
273
276
|
headers: { 'Content-Language': locale, Location: home, Vary: 'Accept-Language' },
|
|
274
277
|
status: 302,
|
|
275
278
|
})
|
|
276
279
|
}
|
|
277
|
-
//
|
|
280
|
+
// The root already holds this locale (prefix-except-default). Let the chain serve it, then say the
|
|
278
281
|
// Response depended on the header — a cache that missed this would pin every visitor to it.
|
|
279
282
|
await next()
|
|
280
283
|
const res = new Response(c.res.body, c.res)
|
|
@@ -282,12 +285,12 @@ app.use('/', async (c, next) => {
|
|
|
282
285
|
res.headers.set('Content-Language', locale)
|
|
283
286
|
c.res = res
|
|
284
287
|
})
|
|
285
|
-
`}function
|
|
286
|
-
`),a=
|
|
288
|
+
`}var Bp=v(()=>{Gr()});function Jy(e,t="/_jx/server"){return ln(e,t)}function Oy(e,t={}){let{adapter:n=null,mounts:r=[],connectors:s=[],i18n:o=null,base:i=""}=t,l=Jy(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(`
|
|
289
|
+
`),a=jy(r,s),u=e.map(({exportName:x})=>Ny(x,l)).join(`
|
|
287
290
|
`),f=n==="cloudflare-workers"||n==="cloudflare-pages"?`
|
|
288
291
|
app.all('*', (c) => c.env.ASSETS.fetch(c.req.raw))
|
|
289
292
|
`:`
|
|
290
|
-
`,p=
|
|
293
|
+
`,p=Hp(o,i),d=e.length===0&&r.length===0?"":Cy(i,l);return`// Generated by @jxsuite/compiler — do not edit manually
|
|
291
294
|
import { Hono } from 'hono'
|
|
292
295
|
${c}${a.imports}
|
|
293
296
|
|
|
@@ -295,11 +298,11 @@ const app = new Hono()
|
|
|
295
298
|
${p}${d}${a.routes}${u}
|
|
296
299
|
${f}
|
|
297
300
|
export default app
|
|
298
|
-
`}function
|
|
301
|
+
`}function jy(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:`
|
|
299
302
|
${r.join(`
|
|
300
303
|
`)}`,routes:`${s.join(`
|
|
301
304
|
`)}
|
|
302
|
-
`}}function
|
|
305
|
+
`}}function Cy(e,t){let n=ln(e,Ay);return`// Request gate (specs/compiler.md §6.4): another site may link here, never call here.
|
|
303
306
|
const jxGate = async (c, next) => {
|
|
304
307
|
const site = c.req.header('sec-fetch-site')
|
|
305
308
|
const foreign = site !== undefined && site !== 'same-origin' && site !== 'none'
|
|
@@ -316,7 +319,7 @@ const jxGate = async (c, next) => {
|
|
|
316
319
|
}
|
|
317
320
|
${(t===n||t.startsWith(`${n}/`)?[n]:[n,t]).map((o)=>`app.use('${o}/*', jxGate)`).join(`
|
|
318
321
|
`)}
|
|
319
|
-
`}function
|
|
322
|
+
`}function Ny(e,t){return`
|
|
320
323
|
app.post('${t}/${e}', async (c) => {
|
|
321
324
|
if (!/^application\\/([\\w.-]+\\+)?json\\b/i.test(c.req.header('content-type') ?? '')) {
|
|
322
325
|
return c.json({ ok: false, error: 'Expected an application/json body' }, 415)
|
|
@@ -328,23 +331,23 @@ app.post('${t}/${e}', async (c) => {
|
|
|
328
331
|
console.error('jx: server function ${e} threw:', e)
|
|
329
332
|
return c.json({ ok: false, error: 'Server error' }, 500)
|
|
330
333
|
}
|
|
331
|
-
})`}var
|
|
332
|
-
`}var
|
|
334
|
+
})`}var Ay="/_jx";var qp=v(()=>{Gr();Bp()});function $a(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)$a(r,t);return t}var Up=v(()=>{K()});function zp(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 Ry(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 _r(e){let t=Ry(e);return t===void 0||t===""?void 0:{text:t}}function Gp(e){if(y(e)&&e!=="")return e;return e===!0?!0:void 0}function Ty(e,t){let n={kind:"field",name:e};if(Lr(t)){let r=_r(t.type)??_r(y(t.$ref)?{$ref:t.$ref}:void 0);if(n.type=r??{text:zp(t.default)},n.default=JSON.stringify(t.default),y(t.description))n.description=t.description;let s=Gp(t.deprecated);if(s!==void 0)n.deprecated=s;return n}if(A(t)){if(Object.keys(t).some((s)=>s.startsWith("$"))||ja(t))return null}else if(B(t))return null;return n.type={text:zp(t)},n.default=JSON.stringify(t),n}function ky(e){if(y(e))return{name:e};if(!A(e)||!y(e.name))return null;let t={name:e.name},n=_r(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 Py(e,t){let n={kind:"method",name:e};if(y(t.description))n.description=t.description;let s=(t.parameters??t.arguments??[]).map((i)=>ky(i)).filter((i)=>i!==null&&i.name!=="state");if(s.length>0)n.parameters=s;let o=_r(t.type);if(o)n.return={type:o};return n}function Kp(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:_r(n.type)??{text:"Event"}};if(y(n.description))r.description=n.description;let s=Gp(n.deprecated);if(s!==void 0)r.deprecated=s;t.set(n.name,r)}}function _y(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 My(e){let t=e.doc,n=A(t.state)?t.state:{},r=rt(e.doc),s=[],o=[],i=new Map,l=new Map;Kp(t.emits,l);for(let[m,b]of Object.entries(n)){if(Zt(m))continue;if(me(b)){if(Kp(b.emits,l),!Oo.has(m)&&r.get(m)!=="computed")o.push(Py(m,b));continue}let S=Ty(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=Qt(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(Zt(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=$a(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?_y(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 Yp(e){let n=e.toSorted((r,s)=>r.tagName<s.tagName?-1:1).map((r)=>My(r));return{manifest:{modules:n.map((r)=>r.module),schemaVersion:"2.1.0"},warnings:n.flatMap((r)=>r.warnings)}}function Xp(e){return`${JSON.stringify(e,null,2)}
|
|
335
|
+
`}var Zp=v(()=>{Up();en();K()});async function Fy(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)=>_t(r)).toSorted().map((r)=>n(e,r))}async function Vy(e){let{readFileSync:t}=await import("node:fs");if(!_t(e))throw Error(`compileElementPack: ${e} is not a .json or .jxn document, the two a pack compiles`);return Gt(t(e,"utf8"),e)}async function Wy(e){let{resolve:t}=await import("node:path"),n=(e.packDir??"dist").replaceAll(/^\.?\/+|\/+$/gu,""),r=await Fy(e.components),s=new Map,o=new Map;for(let x of r){let w=await Vy(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 mo(x,i);for(let g of w)if(!l.has(g.tagName))l.set(g.tagName,g.content)}let c=qc([...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=dt(w,e.defaults),b=zc(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:wn(x),doc:w,modulePath:n===""?`${x}.js`:`${n}/${x}.js`,shadow:m!==null,tagName:x})}let{manifest:p,warnings:d}=Yp(f);return a.push({content:`// Generated by @jxsuite/compiler — do not edit manually
|
|
333
336
|
${c.map((x)=>`import './${x}.js';`).join(`
|
|
334
337
|
`)}
|
|
335
|
-
`,path:
|
|
336
|
-
`)}function
|
|
337
|
-
`):e.body??"").includes("await ")}var
|
|
338
|
+
`,path:Dy},{content:u.join(""),path:Iy},{content:Xp(p),path:Ly}),{files:a,manifest:p,tags:c,warnings:d}}async function Hy(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 Dy="index.js",Iy="elements.css",Ly="custom-elements.json";var Qp=v(()=>{Zp();K();Rr();rs();Ft();ho()});function tf(e){let t=qa(e,e.title??"a class"),n=t.title;if(!n)throw Error("compileClassJson: missing title (class name)");let r=qy(t.extends),s=t.$defs,o=s?.fields??{},i=s?.constructor,l=By(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=Uy(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")||Ky(d)?"async ":"",E=ef(d.parameters??[]),J=zy(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=ef(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(`
|
|
339
|
+
`)}function By(e){return typeof e==="object"}function qy(e){if(!e)return"Object";if(y(e))return e;if(e.$ref){let t=e.$ref.match(nf);return t?t[1]:"Object"}return"Object"}function Uy(e){if(!e||y(e)||!e.$ref)return null;let t=e.$ref.match(nf);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 ef(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 zy(e){if(!e)return[""];return Array.isArray(e)?e:[e]}function Ky(e){return(Array.isArray(e.body)?e.body.join(`
|
|
340
|
+
`):e.body??"").includes("await ")}var nf;var rf=v(()=>{Wr();K();nf=/([A-Za-z0-9_]+)\.class\.json/});import{readFileSync as Gy}from"node:fs";async function Yy(e,t={}){let{title:n="Jx App",reactivitySrc:r=fn,litHtmlSrc:s=Jt,projectStyle:o=null}=t,i;if(y(e)){let c=Gy(e,"utf8");if(_t(e))i=Gt(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(() => ca());throw lo(e,u)}i=await f.parseDocument(c)}}else i=e;if(i=Wn(i,y(e)?e:"the document"),Ca(i)){await Promise.resolve().then(() => rf());let a=tf(i),u=y(e)?e.replace(/(\.class)?\.[^./\\]+$/,".js"):`${i.title}.js`;return{files:[{content:a,path:u}],html:""}}if(!ps(i)){let c={projectStyle:o,title:n};if(t.prePaintScheme===!1)c.prePaintScheme=!1;return _p(i,c)}if(i.tagName&&i.tagName.includes("-")){let{tagName:c}=i,a=wn(c),f={content:ua(i,a,[],t.rewriteSrc,null,t.serverBaseUrl,[],t.resolveClass),path:`${c}.js`,tagName:c},p=Sn(i,i.$media??{},o),d=`<!DOCTYPE html>
|
|
338
341
|
<html lang="en">
|
|
339
342
|
<head>
|
|
340
343
|
<meta charset="utf-8">
|
|
341
344
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
342
345
|
<title>${G(n)}</title>
|
|
343
|
-
${
|
|
346
|
+
${dn({litHtmlSrc:s,reactivitySrc:r,runtimeImports:t.runtimeImports})}
|
|
344
347
|
${p}
|
|
345
348
|
</head>
|
|
346
349
|
<body>
|
|
347
350
|
<${c}></${c}>
|
|
348
351
|
<script type="module" src="./${c}.js"></script>
|
|
349
352
|
</body>
|
|
350
|
-
</html>`;return{files:[f],html:d}}let l={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...
|
|
353
|
+
</html>`;return{files:[f],html:d}}let l={litHtmlSrc:s,projectStyle:o,reactivitySrc:r,...Xy(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 xa(i,l)}function Xy(e){let t={};if(e.prePaintScheme===!1)t.prePaintScheme=!1;if(e.rewriteSrc)t.rewriteSrc=e.rewriteSrc;return t}async function tJ(e,t){let n=await Yy(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 Zy=v(()=>{Wr();Ft();ho();Dp();ba();K();Rr();Ft();qp();ho();Qp();ba()});Zy();export{Yy as compile,xa as compileClient,mo as compileElement,Wy as compileElementPack,py as compileElementPage,Oy as compileSiteServer,ps as isDynamic,tJ as runCli,Hy as writeElementPack};
|