@stacksjs/stx 0.2.122 → 0.2.124
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 +28 -10
- package/dist/component-renderer.js +18 -5
- package/dist/craft.js +241 -223
- package/dist/pwa.js +143 -125
- package/dist/signals.js +26 -8
- package/dist/ssg.js +216 -198
- package/package.json +5 -5
package/dist/pwa.js
CHANGED
|
@@ -20,7 +20,7 @@ registerRoute(
|
|
|
20
20
|
],`:""}
|
|
21
21
|
})
|
|
22
22
|
);`)}return Q.join(`
|
|
23
|
-
`)}function OQ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${LQ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${VQ($).replace(/\\\*/g,".*")}')`}function LQ($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function FQ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function VQ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var q9={};r(q9,{isWorkboxEnabled:()=>K9,getServiceWorkerGenerator:()=>TQ,generateWorkboxServiceWorker:()=>G9,generateWorkboxConfig:()=>Q9});function Q9($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(W7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?T1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function G9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Q9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?T1(Z,$):null,q=K?O$(K):"[]",W=
|
|
23
|
+
`)}function OQ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${LQ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${VQ($).replace(/\\\*/g,".*")}')`}function LQ($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function FQ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function VQ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var q9={};r(q9,{isWorkboxEnabled:()=>K9,getServiceWorkerGenerator:()=>TQ,generateWorkboxServiceWorker:()=>G9,generateWorkboxConfig:()=>Q9});function Q9($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(W7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?T1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function G9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Q9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?T1(Z,$):null,q=K?O$(K):"[]",W=wQ(X.modules),z=J9($);return`/**
|
|
24
24
|
* Service Worker - Generated by stx with Workbox
|
|
25
25
|
* Cache Version: ${X.cacheVersion}
|
|
26
26
|
*
|
|
@@ -174,8 +174,8 @@ ${J?.enabled?AQ(J):"// Push notifications disabled"}
|
|
|
174
174
|
${G?.enabled?NQ(G):"// Background sync disabled"}
|
|
175
175
|
|
|
176
176
|
console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
|
|
177
|
-
`}function
|
|
178
|
-
`)}function
|
|
177
|
+
`}function wQ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${RQ(X)};`)}return Z.join(`
|
|
178
|
+
`)}function RQ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function AQ($){return`
|
|
179
179
|
// ============================================================================
|
|
180
180
|
// Push Notifications
|
|
181
181
|
// ============================================================================
|
|
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
|
|
|
1190
1190
|
});
|
|
1191
1191
|
});
|
|
1192
1192
|
}
|
|
1193
|
-
</script>`}function kQ(){return'<link rel="manifest" href="/manifest.json">'}function bQ($){return`<meta name="theme-color" content="${z7($)}">`}function z7($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var V$=k(()=>{T5()});import M5 from"path";function H9($){_9=$?.trim()||null}function I5(){return process.env[fQ]?.trim()||_9||o1}function D5($=process.cwd(),...Z){let Y=I5();return M5.isAbsolute(Y)?M5.join(Y,...Z):M5.join($,Y,...Z)}function E5($){if(!$||M5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==o1&&!Z.startsWith(`${o1}/`))return $;let Y=Z.slice(o1.length+1);return Y?M5.join(I5(),Y):I5()}var o1=".stx",fQ="STX_DIR",_9=null;var
|
|
1193
|
+
</script>`}function kQ(){return'<link rel="manifest" href="/manifest.json">'}function bQ($){return`<meta name="theme-color" content="${z7($)}">`}function z7($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var V$=k(()=>{T5()});import M5 from"path";function H9($){_9=$?.trim()||null}function I5(){return process.env[fQ]?.trim()||_9||o1}function D5($=process.cwd(),...Z){let Y=I5();return M5.isAbsolute(Y)?M5.join(Y,...Z):M5.join($,Y,...Z)}function E5($){if(!$||M5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==o1&&!Z.startsWith(`${o1}/`))return $;let Y=Z.slice(o1.length+1);return Y?M5.join(I5(),Y):I5()}var o1=".stx",fQ="STX_DIR",_9=null;var w$=()=>{};var O0;var O9=k(()=>{O0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function L9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||z} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var F9,V9;var B7=k(()=>{F9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},V9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function gQ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...X1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1194
1194
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1195
1195
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${J==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
1196
1196
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1425,8 +1425,8 @@ else {
|
|
|
1425
1425
|
</script>
|
|
1426
1426
|
`}function T9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!dQ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=uQ();Q=Q.replace("</head>",`${K}
|
|
1427
1427
|
</head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=mQ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
|
|
1428
|
-
`+Q.slice(W)}}return Q}var X1,R9,
|
|
1429
|
-
style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},
|
|
1428
|
+
`+Q.slice(W)}}return Q}var X1,w9,R9,A9,N9;var j7=k(()=>{X1={duration:300,delay:0,ease:"ease",direction:"both"};w9={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||X1.duration:X1.duration,G=Z.length>2?Z[2]||X1.ease:X1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||X1.delay:X1.delay,q=Z.length>4?Z[4]||X1.direction:X1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=gQ(Q,{duration:J,delay:K,ease:G,direction:q}),U="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${U} ${B} ${q==="out"?"stx-out":""}"
|
|
1429
|
+
style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},R9={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${W}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},A9={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=lQ(Q,J,{staggerDelay:G,sequence:K});return`${$}
|
|
1430
1430
|
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},N9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=hQ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as M9}from"stx-router";var I9=k(()=>{_7()});async function pQ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=M9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var D9;var _7=k(()=>{I9();D9={name:"stxRouter",handler:pQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function E9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...cQ,...Z};return`
|
|
1431
1431
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
1432
1432
|
<script>
|
|
@@ -1830,19 +1830,19 @@ ${H}
|
|
|
1830
1830
|
`),X)Q=Q.replace(/\n/g,`<br />
|
|
1831
1831
|
`);for(let z=0;z<J.length;z++)Q=Q.replace(`\x00CODEBLOCK${z}\x00`,J[z]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function c0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
1832
1832
|
`});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
1833
|
-
`}),$}import nQ from"process";function d0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(nQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var M1=()=>{};var b5={};r(b5,{queueClientBundleBuild:()=>x9,hasUserImports:()=>sQ,bundleClientScript:()=>aQ});import j0 from"path";import b0 from"fs";function sQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function rQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let z of W)try{if(b0.existsSync(z)&&b0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(b0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(b0.existsSync(W)&&b0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=j0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return X.add(G.path),{contents:b0.readFileSync(G.path,"utf8"),loader:q}})}}}function x9($){let Z=globalThis,X=(Z[C9]??Promise.resolve()).then($,$);return Z[C9]=X.then(()=>{return},()=>{return}),X}async function aQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||D5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${oQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let _=Bun.file(W),j=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==v9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(b0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=O7.get(K);if(U)return await U;let B=x9(()=>tQ($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));O7.set(K,B);try{return await B}finally{O7.delete(K)}}async function tQ($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=D5(X,"bundle-tmp"),z=j0.join(W,`${G}.ts`),U=j0.join(W,"out",G);b0.mkdirSync(W,{recursive:!0}),b0.mkdirSync(U,{recursive:!0});let B=j0.dirname(Z),_=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let
|
|
1834
|
-
export { ${_.join(", ")} }`:"";await Bun.write(z,$+F),console.log("[stx:bundler] bundling:",G,"from:",j0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:Q,plugins:[rQ(X,B,z,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...d0()},root:X});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let
|
|
1835
|
-
`),I=
|
|
1836
|
-
`);if(
|
|
1833
|
+
`}),$}import nQ from"process";function d0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(nQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var M1=()=>{};var b5={};r(b5,{queueClientBundleBuild:()=>x9,hasUserImports:()=>sQ,bundleClientScript:()=>aQ});import j0 from"path";import b0 from"fs";function sQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!P9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function rQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let z of W)try{if(b0.existsSync(z)&&b0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(b0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(b0.existsSync(W)&&b0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=j0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return X.add(G.path),{contents:b0.readFileSync(G.path,"utf8"),loader:q}})}}}function x9($){let Z=globalThis,X=(Z[C9]??Promise.resolve()).then($,$);return Z[C9]=X.then(()=>{return},()=>{return}),X}async function aQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||D5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${oQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let _=Bun.file(W),j=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==v9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(b0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=O7.get(K);if(U)return await U;let B=x9(()=>tQ($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));O7.set(K,B);try{return await B}finally{O7.delete(K)}}async function tQ($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=D5(X,"bundle-tmp"),z=j0.join(W,`${G}.ts`),U=j0.join(W,"out",G);b0.mkdirSync(W,{recursive:!0}),b0.mkdirSync(U,{recursive:!0});let B=j0.dirname(Z),_=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)_.push(w)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
|
|
1834
|
+
export { ${_.join(", ")} }`:"";await Bun.write(z,$+F),console.log("[stx:bundler] bundling:",G,"from:",j0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:Q,plugins:[rQ(X,B,z,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...d0()},root:X});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let S=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){R.push([S[2],S[1]]);continue}let b=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))R.push([b,b])}let A=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,T=R.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),M=R.map(([D])=>`var ${D} = undefined;`).join(`
|
|
1835
|
+
`),I=R.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
|
|
1836
|
+
`);if(w=`${A.join(`
|
|
1837
1837
|
`)}
|
|
1838
1838
|
${M}
|
|
1839
1839
|
var ${N} = (function() {
|
|
1840
|
-
${
|
|
1840
|
+
${w}
|
|
1841
1841
|
return { ${T} };
|
|
1842
1842
|
})();
|
|
1843
|
-
${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",
|
|
1844
|
-
${
|
|
1845
|
-
`)}`:"";return console.warn(`[stx:bundler] error: ${
|
|
1843
|
+
${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",w.length,"bytes"),_.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${j0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;b0.mkdirSync(J,{recursive:!0}),await Bun.write(K,w);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:b0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:v9,files:E})),w}catch(V){let w=V instanceof Error?V.message:String(V),R=V?.errors,A=Array.isArray(R)&&R.length>0?`
|
|
1844
|
+
${R.map((N)=>`- ${N?.message??N}`).join(`
|
|
1845
|
+
`)}`:"";return console.warn(`[stx:bundler] error: ${w}${A}`),$}finally{try{b0.rmSync(z,{force:!0}),b0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var oQ=5,v9=1,P9,O7,C9;var S5=k(()=>{M1();w$();P9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];O7=new Map,C9=Symbol.for("stx.client-bundle-build-queue")});var m9={};r(m9,{renderVendorStyleTags:()=>A$,processClientScript:()=>C5,injectBrowserCoreAutoImports:()=>s1,generateServerDataBridge:()=>N$,generateBrowserAutoImportDestructuring:()=>qG,generateAutoImportDestructuring:()=>L7,extractBridgeData:()=>P5,extractAndStripCssImports:()=>R$});import I1 from"path";import y5 from"fs";function $G($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function ZG($,Z){let Y=Z;while(!0){let X=I1.join(Y,"node_modules",$,"package.json");if(y5.existsSync(X))return I1.dirname(X);let Q=I1.dirname(Y);if(Q===Y)return null;Y=Q}}function YG($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function XG($,Z){let Y=$G($);if(!Y||!Y.subpath)return null;let X=ZG(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(y5.readFileSync(I1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=YG(Q.exports,J);if(!G)return null;let K=I1.resolve(X,G);return y5.existsSync(K)?K:null}function R$($,Z){let Y=Z.filePath?I1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(eQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:I1.resolve(Y,q),!y5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,X)}catch{z=XG(q,X)}if(!z)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(Q.has(W))return"";Q.add(W);try{let z=y5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:J}}function JG($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function A$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${JG(Z.source)}" data-stx-layer="vendor">
|
|
1846
1846
|
@layer vendor {
|
|
1847
1847
|
${Z.contents}
|
|
1848
1848
|
}
|
|
@@ -1911,7 +1911,7 @@ else {
|
|
|
1911
1911
|
// STX: auto-generated event bindings
|
|
1912
1912
|
${$.map((Y,X)=>jG(Y,X)).join(`
|
|
1913
1913
|
`)}`}function g9($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
|
|
1914
|
-
`)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}}G++}return Z}function OG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!HG.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((J=z.exec($))!==null)X(J[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=U.exec($))!==null)X(J[1]);return Z}async function C5($,Z={}){let Y=$,X="",Q=!1,J=[],G=
|
|
1914
|
+
`)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}}G++}return Z}function OG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!HG.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((J=z.exec($))!==null)X(J[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=U.exec($))!==null)X(J[1]);return Z}async function C5($,Z={}){let Y=$,X="",Q=!1,J=[],G=R$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=A$(G.styles),q=s1(Y);Y=q.code,J=q.imports;let{hasUserImports:W,bundleClientScript:z}=await Promise.resolve().then(() => (S5(),b5));if(W(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=d9(Y);Y=O.code,X=L7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${N$(Y,Z.serverData)}${X}`,Y=c0(Y),!Q&&D1(Z.attrs||""))Y=E1(Y);let U=_G(Z.eventBindings||[]),B=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(B)){let O=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
|
|
1915
1915
|
${X}${Y}
|
|
1916
1916
|
${U}
|
|
1917
1917
|
</script>`}let j=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let V=O.length>0?`
|
|
@@ -1920,12 +1920,12 @@ window.stx.mount(function() {
|
|
|
1920
1920
|
'use strict';
|
|
1921
1921
|
${X}${Y}
|
|
1922
1922
|
${U}${V}
|
|
1923
|
-
})</script>`}if(!L&&!H){if(j)return F(g9($));if(Z.templateContent){let O=g9($);if(O.length>0){let V=OG(Z.templateContent);if(O.some((
|
|
1923
|
+
})</script>`}if(!L&&!H){if(j)return F(g9($));if(Z.templateContent){let O=g9($);if(O.length>0){let V=OG(Z.templateContent);if(O.some((R)=>V.has(R)))return F(O)}}}return`${K}<script data-stx-scoped>
|
|
1924
1924
|
;(function() {
|
|
1925
1925
|
'use strict';
|
|
1926
1926
|
${X}${Y}
|
|
1927
1927
|
${U}
|
|
1928
|
-
})()</script>`}var eQ,QG,h9,GG,UG,HG;var v5=k(()=>{L0();eQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;QG=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],h9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];GG=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);UG={left:0,middle:1,right:2};HG=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function
|
|
1928
|
+
})()</script>`}var eQ,QG,h9,GG,UG,HG;var v5=k(()=>{L0();eQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;QG=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],h9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];GG=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);UG={left:0,middle:1,right:2};HG=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function wG($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function RG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(FG.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&c9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function AG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!c9.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function T$($){let Z=$.trim(),Y=wG(Z);RG(Y,Z),AG(Z);for(let X of p9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!l9.allowBracketNotation&&VG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function NG($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||p9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=F7(X);else Z[Y]=X}return Z}function F7($,Z=0){if(Z>=l9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>F7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=F7(Q,Z+1);else Y[X]=Q}return Y}function Z0($,Z){try{let Y=NG(Z),X=Object.keys(Y),Q=Object.values(Y);return Q0($,X)(...Q)}catch{return}}function J0($){try{return T$($),!0}catch{return!1}}function F0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=T$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!X.test(z))continue;if(i9.has(z))continue;Q.push(W),J.push(z)}let G=(W)=>Function(...J,...W,`
|
|
1929
1929
|
'use strict';
|
|
1930
1930
|
try {
|
|
1931
1931
|
return ${Y};
|
|
@@ -1936,7 +1936,7 @@ catch (e) {
|
|
|
1936
1936
|
}
|
|
1937
1937
|
throw e;
|
|
1938
1938
|
}
|
|
1939
|
-
`),K=G([]);if(J.length===Z.length)return u9(K,J,G);return u9((...W)=>{let z=Array(Q.length);for(let U=0;U<Q.length;U++)z[U]=W[Q[U]];return K(...z)},J,G,(W)=>{K=G(W)})}function u9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let B=U instanceof Error?U.message:"",_=J.exec(B);if(!(U instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||i9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function M$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var LG,l9,p9,FG,c9,VG,i9;var _0=k(()=>{LG={maxSanitizeDepth:10,allowBracketNotation:!1},l9={...LG},p9=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],FG=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),c9=new Set(["__proto__","constructor","prototype"]),VG=/[\w)\]]\s*\[\s*['"]/;i9=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function I$($,Z){let Y=TG++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return MG.set(X,{type:$,expression:Z}),X}var TG=0,MG;var n9=k(()=>{MG=new Map});function t9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function W1($,Z){return t9($,Z,o9,s9)}function r1($,Z){return t9($,Z,r9,a9)}function x5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function IG($,Z){if($.startsWith("<!--",Z)){let Y=x5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[o9,s9],[r9,a9]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function V7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=IG($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function r0($,Z,Y){let X=V7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function z1($){let{output:Z,tokens:Y}=r0($,W1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function f5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var o9,s9,r9,a9;var k1=k(()=>{o9=/<script\b[^>]*>/iy,s9=/<\/script\s*>/ig,r9=/<style\b[^>]*>/iy,a9=/<\/style\s*>/ig});var J8={};r(J8,{usesSignalsInScript:()=>a1,unescapeHtml:()=>R7,registerFilters:()=>EG,registerFilter:()=>Z8,processExpressions:()=>U1,interpolateScriptsInTemplate:()=>bG,interpolateScriptExpressions:()=>D$,getAllFilters:()=>Y8,evaluateExpression:()=>m0,escapeHtml:()=>i0,defaultFilters:()=>h5,clearCustomFilters:()=>kG,applyFilters:()=>X8});function DG($){let Z=e9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),e9.set($,Z)}return Z.lastIndex=0,Z}function Z8($,Z){if($ in h5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);g5[$]=Z}function EG($){for(let[Z,Y]of Object.entries($))Z8(Z,Y)}function Y8(){return{...h5,...g5}}function kG(){for(let $ of Object.keys(g5))delete g5[$]}function i0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function a1($){let{scripts:Z}=z1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function $8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let z=X[W];if(!J&&z==="`"){J=!0,G=0;continue}if(J){if(z==="`"&&G===0){J=!1;continue}if(z==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){Q+=z;continue}continue}Q+=z}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function D$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=m0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function bG($,Z,Y={}){let{output:X,scripts:Q}=z1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let B=D$(U,Z);return q[0]+B+G.slice(W)});return f5(X,J)}function U1($,Z,Y,X){let Q=$,J=(B,_)=>{let j=r1(B,_);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(_,j))?-1:j},G=(B,_,j,H)=>{let L=j.length,{output:F,tokens:O}=r0(B,_,(V,R)=>H(L+R));return j.push(...O),F},K=[];Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||a1($),z=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,_,j)=>{try{let H=m0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,j,B)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,j)=>{try{let H=m0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return I$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return I$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,j,B)}}),Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(B,_,j)=>{let H=_.trim();if(U.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],R=V&&((V in Z)||L.includes(V)),w=Boolean(V&&z.has(V)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(A),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=m0(_,Z);if(w)return B;if(W&&!$8(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return I$("expr",H);return M!==void 0&&M!==null?i0(String(M)):""}catch(M){if(w)return B;if(W&&!$8(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return W0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,B)}});for(let B=0;B<q.length;B++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)Q=Q.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return Q}function X8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=g5[G]||h5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(Y8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,z=1;while(W>0&&z<Q.length){if(Q[z]==="(")W++;if(Q[z]===")")W--;z++}if(W===0){let U=Q.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[m0(`(${U})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let R=U[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return m0(R,Y,!0)})}}catch{q=[U]}Q=Q.substring(z).trim()}}try{X=K(X,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function SG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function m0($,Z,Y=!1){try{let X=$.trim(),Q=SG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=m0(J,Z,!0);return X8(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return Z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=yG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function yG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=PG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function PG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function R7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var g5,e9,h5;var a0=k(()=>{_0();L0();n9();k1();g5={},e9=new Map;h5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return i0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(DG(q),String(W))}),K},t:($,Z,Y={})=>{return h5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function t1($="const",Z=[],Y){let X=Z.length?E$.filter((Q)=>!Z.includes(Q)):E$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var E$,Q8;var d5=k(()=>{E$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],Q8=["onMount","onDestroy"]});class m5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function $5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!e1.has(Y)){if(e1.size>=CG){let X=e1.keys().next().value;if(X)e1.delete(X)}e1.set(Y,new RegExp($,Z))}return e1.get(Y)}class G8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=Q.get(W);if(!z){if(Q.size>=J){let U=Q.keys().next().value;if(U)Q.delete(U)}z=Function(...Z,`
|
|
1939
|
+
`),K=G([]);if(J.length===Z.length)return u9(K,J,G);return u9((...W)=>{let z=Array(Q.length);for(let U=0;U<Q.length;U++)z[U]=W[Q[U]];return K(...z)},J,G,(W)=>{K=G(W)})}function u9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let B=U instanceof Error?U.message:"",_=J.exec(B);if(!(U instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||i9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function M$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var LG,l9,p9,FG,c9,VG,i9;var _0=k(()=>{LG={maxSanitizeDepth:10,allowBracketNotation:!1},l9={...LG},p9=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],FG=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),c9=new Set(["__proto__","constructor","prototype"]),VG=/[\w)\]]\s*\[\s*['"]/;i9=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function I$($,Z){let Y=TG++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return MG.set(X,{type:$,expression:Z}),X}var TG=0,MG;var n9=k(()=>{MG=new Map});function t9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function W1($,Z){return t9($,Z,o9,s9)}function r1($,Z){return t9($,Z,r9,a9)}function x5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function IG($,Z){if($.startsWith("<!--",Z)){let Y=x5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[o9,s9],[r9,a9]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function V7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=IG($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function r0($,Z,Y){let X=V7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function z1($){let{output:Z,tokens:Y}=r0($,W1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function f5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var o9,s9,r9,a9;var k1=k(()=>{o9=/<script\b[^>]*>/iy,s9=/<\/script\s*>/ig,r9=/<style\b[^>]*>/iy,a9=/<\/style\s*>/ig});var J8={};r(J8,{usesSignalsInScript:()=>a1,unescapeHtml:()=>w7,registerFilters:()=>EG,registerFilter:()=>Z8,processExpressions:()=>U1,interpolateScriptsInTemplate:()=>bG,interpolateScriptExpressions:()=>D$,getAllFilters:()=>Y8,evaluateExpression:()=>m0,escapeHtml:()=>i0,defaultFilters:()=>h5,clearCustomFilters:()=>kG,applyFilters:()=>X8});function DG($){let Z=e9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),e9.set($,Z)}return Z.lastIndex=0,Z}function Z8($,Z){if($ in h5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);g5[$]=Z}function EG($){for(let[Z,Y]of Object.entries($))Z8(Z,Y)}function Y8(){return{...h5,...g5}}function kG(){for(let $ of Object.keys(g5))delete g5[$]}function i0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function a1($){let{scripts:Z}=z1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function $8($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let z=X[W];if(!J&&z==="`"){J=!0,G=0;continue}if(J){if(z==="`"&&G===0){J=!1;continue}if(z==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){Q+=z;continue}continue}Q+=z}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function D$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=m0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function bG($,Z,Y={}){let{output:X,scripts:Q}=z1($),J=Q.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let B=D$(U,Z);return q[0]+B+G.slice(W)});return f5(X,J)}function U1($,Z,Y,X){let Q=$,J=(B,_)=>{let j=r1(B,_);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(_,j))?-1:j},G=(B,_,j,H)=>{let L=j.length,{output:F,tokens:O}=r0(B,_,(V,w)=>H(L+w));return j.push(...O),F},K=[];Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||a1($),z=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,_,j)=>{try{let H=m0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,j,B)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,j)=>{try{let H=m0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return I$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return I$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,j,B)}}),Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(B,_,j)=>{let H=_.trim();if(U.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],w=V&&((V in Z)||L.includes(V)),R=Boolean(V&&z.has(V)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(A),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=m0(_,Z);if(R)return B;if(W&&!$8(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return I$("expr",H);return M!==void 0&&M!==null?i0(String(M)):""}catch(M){if(R)return B;if(W&&!$8(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return W0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,B)}});for(let B=0;B<q.length;B++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)Q=Q.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return Q}function X8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=g5[G]||h5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(Y8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,z=1;while(W>0&&z<Q.length){if(Q[z]==="(")W++;if(Q[z]===")")W--;z++}if(W===0){let U=Q.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[m0(`(${U})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(j){if(_+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=w}if(_)B.push(_);q=B.map((V)=>{let w=V.trim();return m0(w,Y,!0)})}}catch{q=[U]}Q=Q.substring(z).trim()}}try{X=K(X,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function SG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function m0($,Z,Y=!1){try{let X=$.trim(),Q=SG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=m0(J,Z,!0);return X8(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return Z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=yG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function yG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=PG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function PG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function w7($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var g5,e9,h5;var a0=k(()=>{_0();L0();n9();k1();g5={},e9=new Map;h5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return i0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(DG(q),String(W))}),K},t:($,Z,Y={})=>{return h5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function t1($="const",Z=[],Y){let X=Z.length?E$.filter((Q)=>!Z.includes(Q)):E$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var E$,Q8;var d5=k(()=>{E$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],Q8=["onMount","onDestroy"]});class m5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function $5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!e1.has(Y)){if(e1.size>=CG){let X=e1.keys().next().value;if(X)e1.delete(X)}e1.set(Y,new RegExp($,Z))}return e1.get(Y)}class G8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=Q.get(W);if(!z){if(Q.size>=J){let U=Q.keys().next().value;if(U)Q.delete(U)}z=Function(...Z,`
|
|
1940
1940
|
'use strict';
|
|
1941
1941
|
try {
|
|
1942
1942
|
return ${q};
|
|
@@ -1947,7 +1947,7 @@ catch (e) {
|
|
|
1947
1947
|
}
|
|
1948
1948
|
throw e;
|
|
1949
1949
|
}
|
|
1950
|
-
`),Q.set(W,z)}return z(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class K8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function vG(){if(!
|
|
1950
|
+
`),Q.set(W,z)}return z(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class K8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function vG(){if(!R7)R7=new K8;return R7}var e1,CG=500,BH,R7=null,q8;var Z5=k(()=>{e1=new Map;BH=new G8;q8=new Proxy({},{get($,Z){return vG()[Z]}})});function W8($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function z8($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=A7($),q=[],W=new Map;if(J)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let B=U[1],_=`${Z}_${B}`;W.set(B,_)}}for(let z of K){let U=U8(z,Z,X,Q,W,G);q.push(U)}return q.join(`
|
|
1951
1951
|
|
|
1952
1952
|
`)}function A7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,z,U,B]=W;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:B.trim()});else if(z==="media"||z==="supports"||z==="container"){let _=A7(B);Z.push({selector:`@${z} ${U.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
|
|
1953
1953
|
`)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function U8($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=A7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>U8(B,Z,Y,X,Q,J)).join(`
|
|
@@ -1956,20 +1956,20 @@ catch (e) {
|
|
|
1956
1956
|
}`}return`${G} { ${K} }`}let q=xG(G,Z,Y,X),W=K;for(let[z,U]of Q)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function xG($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=fG(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function fG($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function k$($,Z){if(!gG.test($))return{html:$,hasScoped:!1};let Y=W8(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${N7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let z=hG(W,X),U=q.replace(new RegExp(N7,"gi"),"").trim(),B=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${B}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return Q=mG(Q,X),{html:Q,hasScoped:!0}}function hG($,Z){return z8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function mG($,Z){let Y=r0($,(Q,J)=>{let G=W1(Q,J);return G>J?G:r1(Q,J)},(Q,J)=>dG(J)),X=uG(Y.output,Z);return B8.lastIndex=0,X.replace(B8,(Q,J)=>Y.tokens[Number(J)])}function uG($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var N7,gG,dG=($)=>`\x00stx-scope-mask-${$}\x00`,B8;var T7=k(()=>{k1();N7=String.raw`(?<![\w-])scoped(?![\w-])`,gG=new RegExp(`<style\\s+[^>]*${N7}`,"i");B8=/\u0000stx-scope-mask-(\d+)\u0000/g});function pG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return lG.test(Z)}function b$($){u5.lastIndex=0;let Z;while((Z=u5.exec($))!==null){if(Z[0].startsWith("</")||pG(Z[0]))continue;let Y=Z.index,X=u5.lastIndex,Q=1,J;while((J=u5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:u5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var u5,lG;var M7=k(()=>{u5=/<\/?template\b[^>]*>/gi,lG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var j8=()=>{};function S0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var E7={};r(E7,{useTitle:()=>sG,useSeoMeta:()=>_8,usePageTitle:()=>sG,useHead:()=>D7,seoMetaToHeadConfig:()=>y$,resetHead:()=>nG,renderHtmlAttrs:()=>aG,renderHead:()=>rG,renderBodyAttrs:()=>tG,processTitleDirective:()=>ZK,processMetaDirective:()=>YK,processHeadDirective:()=>$K,mergeHeadConfigs:()=>Y5,getPageMeta:()=>iG,getHead:()=>I7,definePageMeta:()=>oG,applyHead:()=>eG});function I7(){return B1}function iG(){return S$}function nG(){B1={},cG.length=0,S$={}}function D7($){B1=Y5(B1,$)}function Y5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function _8($){D7(y$($))}function y$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function oG($){if(S$={...S$,...$},$.title||$.description)_8({title:$.title,description:$.description})}function sG($){let Z=typeof $==="function"?$():$;D7({title:Z})}function rG($=B1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${b1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${b1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${b1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${b1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${b1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
|
|
1957
1957
|
`)}function aG($=B1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${b1(Y)}"`).join(" ")}function tG($=B1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${b1(Y)}"`).join(" ")}function b1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function eG($=B1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function $K($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
|
|
1958
1958
|
`,""}),headContent:Z.trim()}}function ZK($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Y5(K,{title:G}),""})}function YK($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,U=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W},B=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Y5(B,{meta:[U]}),""})}var B1,cG,S$;var l5=k(()=>{B1={},cG=[],S$={}});var P$={};r(P$,{stripTypeScript:()=>V8,hasVariables:()=>T8,extractVariables:()=>S1,extractScriptFromTemplate:()=>N8,convertToCommonJS:()=>b7});import X5 from"path";import p5 from"process";function XK($){let Z=[],Y=0,X=$.split(`
|
|
1959
|
-
`);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...U)}}}}return[...new Set(Z)]}function V8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let z=X[W];if(q){if(J+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,J+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){Q.push(J),J="";continue}J+=z}if(J)Q.push(J);return Q.map((W)=>{let z=W.trim(),U=z.startsWith("..."),B=U?z.slice(3):z,_=-1,j=0;for(let
|
|
1959
|
+
`);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...U)}}}}return[...new Set(Z)]}function V8($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let z=X[W];if(q){if(J+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,J+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){Q.push(J),J="";continue}J+=z}if(J)Q.push(J);return Q.map((W)=>{let z=W.trim(),U=z.startsWith("..."),B=U?z.slice(3):z,_=-1,j=0;for(let R=0;R<B.length;R++)if(B[R]==="<")j++;else if(B[R]===">")j--;else if(B[R]===":"&&j===0){_=R;break}if(_===-1)return W;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){O=R;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let _=Z[q];if(z){if(_===z)z=null;q++;continue}if(_==='"'||_==="'"||_==="`"){z=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let B=Y(U);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
|
|
1960
1960
|
|
|
1961
|
-
`),Z}async function S1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let y=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=y.transformSync(v)}catch{Q=V8($)}let J={exports:{}},G=J.exports,K=p5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((y)=>y[1]).filter((y)=>!y.startsWith("node:")&&!y.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(y));for(let y of W)try{let v=X5.resolve(K,"node_modules",y),m=X5.join(v,"package.json"),c=JSON.parse(q0("fs").readFileSync(m,"utf8")),K0=c.main||"index.js";if(c.exports){let B0=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof B0==="string")K0=B0;else if(B0?.bun)K0=B0.bun;else if(B0?.import)K0=B0.import;else if(B0?.default)K0=B0.default}q[y]=await import(X5.resolve(v,K0))}catch{}let z=(y)=>{if(q[y])return q[y];return q0(y)},U=Z.props||{},B=(y)=>{if(!y)return U;let v={};for(let[m,c]of Object.entries(y)){let K0=U[m];if(K0!==void 0)v[m]=K0;else if(typeof c==="function")v[m]=c();else v[m]=c}return v};for(let[y,v]of Object.entries(U))Object.defineProperty(B,y,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let y of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,y))continue;try{Object.defineProperty(B,y,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(y)=>{if(!y)return U;let v={...U};for(let[m,c]of Object.entries(y)){let K0=c&&typeof c==="object"&&!Array.isArray(c)?c:{type:c};if(v[m]===void 0&&K0.default!==void 0)v[m]=typeof K0.default==="function"?K0.default():K0.default}return v},j=()=>Z.slots||{},H=(y,v)=>{let m={...y};for(let[c,K0]of Object.entries(v))if(m[c]===void 0)if(typeof K0==="function")m[c]=K0();else m[c]=K0;return m},L=(y)=>{let v=()=>y;return v.set=(m)=>{},v.update=(m)=>{},v},F=(y)=>{let v,m=!1;return()=>{if(!m)try{v=y(),m=!0}catch{v=void 0}return v}},O=(y)=>{},V=(y)=>y(),
|
|
1961
|
+
`),Z}async function S1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let y=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=y.transformSync(v)}catch{Q=V8($)}let J={exports:{}},G=J.exports,K=p5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((y)=>y[1]).filter((y)=>!y.startsWith("node:")&&!y.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(y));for(let y of W)try{let v=X5.resolve(K,"node_modules",y),m=X5.join(v,"package.json"),c=JSON.parse(q0("fs").readFileSync(m,"utf8")),K0=c.main||"index.js";if(c.exports){let B0=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof B0==="string")K0=B0;else if(B0?.bun)K0=B0.bun;else if(B0?.import)K0=B0.import;else if(B0?.default)K0=B0.default}q[y]=await import(X5.resolve(v,K0))}catch{}let z=(y)=>{if(q[y])return q[y];return q0(y)},U=Z.props||{},B=(y)=>{if(!y)return U;let v={};for(let[m,c]of Object.entries(y)){let K0=U[m];if(K0!==void 0)v[m]=K0;else if(typeof c==="function")v[m]=c();else v[m]=c}return v};for(let[y,v]of Object.entries(U))Object.defineProperty(B,y,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let y of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,y))continue;try{Object.defineProperty(B,y,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(y)=>{if(!y)return U;let v={...U};for(let[m,c]of Object.entries(y)){let K0=c&&typeof c==="object"&&!Array.isArray(c)?c:{type:c};if(v[m]===void 0&&K0.default!==void 0)v[m]=typeof K0.default==="function"?K0.default():K0.default}return v},j=()=>Z.slots||{},H=(y,v)=>{let m={...y};for(let[c,K0]of Object.entries(v))if(m[c]===void 0)if(typeof K0==="function")m[c]=K0();else m[c]=K0;return m},L=(y)=>{let v=()=>y;return v.set=(m)=>{},v.update=(m)=>{},v},F=(y)=>{let v,m=!1;return()=>{if(!m)try{v=y(),m=!0}catch{v=void 0}return v}},O=(y)=>{},V=(y)=>y(),w=(y)=>{},R=(y)=>{},A=(y)=>{},N=()=>{let y=Z.__stxServeContext,v=Z.__stxServeSearch??y?.search??"",m=y?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:m,name:"",fullPath:m+v,hash:"",matched:[]}},T=()=>({push:(y)=>{},replace:(y)=>{},back:()=>{},forward:()=>{},go:(y)=>{}}),M=(y)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=Y5(v,y||{})},I=(y)=>{M(y$(y||{}))},E=(y)=>({value:y}),D=(y)=>y,P=(y)=>({value:typeof y==="function"?y():y}),S=(y,v)=>{},b=(y)=>{},C=(y)=>{},h=(y)=>y?y():Promise.resolve(),x=(y)=>(v,...m)=>{},u=(y)=>{},t=(y,v)=>{},X0=(y,v)=>v,$1=()=>({value:"light"}),f0=()=>L(!1),T0=(y)=>L(!1),Y0=()=>L(!1),R0=()=>T0("(prefers-color-scheme: dark)"),l0=()=>T0("(prefers-color-scheme: light)"),Z1=()=>T0("(prefers-reduced-motion: reduce)"),R1=()=>T0("(prefers-contrast: more)"),l={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},s=new Proxy(l,{get(y,v){if(v in y)return y[v];return},set(y,v,m){return y[v]=m,!0}}),g={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},d=console;try{let y=b7(Q,Y),v=new Set(Object.keys(U)),m=(a)=>/^[a-z_$][\w$]*$/i.test(a),c=Object.keys(Z).filter((a)=>!v.has(a)&&a!=="props"&&m(a)),K0=c.map((a)=>Z[a]),B0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),M0=[],g0=[];for(let[a,s0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(B0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(y))continue;M0.push(a),g0.push(s0)}let z0=XK(y).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
|
|
1962
1962
|
`),K1=Z.params??{},p0=[],A1=[];for(let a=0;a<c.length;a++){if(c[a]==="params")continue;p0.push(c[a]),A1.push(K0[a])}let h0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...M0,...p0,`return (async () => {
|
|
1963
1963
|
${y}
|
|
1964
1964
|
${z0}
|
|
1965
1965
|
return module.exports
|
|
1966
|
-
})()`)(J,G,z,U,B,_,H,L,F,O,V,R,
|
|
1966
|
+
})()`)(J,G,z,U,B,_,H,L,F,O,V,w,R,A,N,T,M,I,E,D,P,S,b,C,h,x,u,j,t,X0,$1,f0,T0,Y0,R0,l0,Z1,R1,s,g,d,l.confirm,l.alert,l.fetch,K1,...g0,...A1);if(X.preserveExisting){for(let[a,s0]of Object.entries(h0))if(!(a in Z)||Z[a]===void 0)Z[a]=s0}else Object.assign(Z,h0);for(let[a,s0]of Object.entries(U))if(!(a in Z))Z[a]=s0}catch(y){if(p5.env.STX_DEBUG){let v=y instanceof Error?y.message:String(y);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await qK(Q,Z,Y)}catch(v){if(p5.env.STX_DEBUG){let m=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${m}`)}}}}function b7($,Z){let Y=Z?X5.dirname(Z):p5.cwd(),X=$.split(`
|
|
1967
1967
|
`),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let z=null,U=!1,B=X[W];for(let _=0;_<B.length;_++){let j=B[_];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(z){if(j===z)z=null;continue}if(j==='"'||j==="'"||j==="`"){z=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),z=(U)=>{if(U.startsWith("."))return X5.resolve(Y,U);return U};if(K){let[,U,B]=K,_=z(B);Q.push(`const ${U} = await import('${_}')`),Q.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,B]=q,_=U.trim(),j=z(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let U=z(W[1]);Q.push(`await import('${U}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=H8(X,J),{type:q,name:W,value:z}=K;Q.push(`${q} ${W} = ${z};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=k7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=H8(X,J),{type:q,name:W,value:z}=K;Q.push(`${q} ${W} = ${z};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=k7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=k7(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),z=0,U=J;for(;U<X.length;U++){let B=X[U];for(let _ of B)if(_==="{")z++;else if(_==="}")z--;if(U>J)W+=`
|
|
1968
1968
|
`+B;if(z<=0&&U>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=U+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return JK(Q.join(`
|
|
1969
1969
|
`),Y)}function JK($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],z=$[Q+1];if(G){if(X+=W,W===`
|
|
1970
|
-
`)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&z==="/"){X+=z,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&z==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&z==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=z,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&z==="{"){q++,X+=z,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=QK($,Q);if(U){let{quote:B,path:_,end:j}=U;if(_.startsWith(".")){let H=X5.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=W,Q++}return X}function QK($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function
|
|
1971
|
-
`);return{type:_,name:
|
|
1972
|
-
${
|
|
1970
|
+
`)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&z==="/"){X+=z,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&z==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&z==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=z,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&z==="{"){q++,X+=z,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=QK($,Q);if(U){let{quote:B,path:_,end:j}=U;if(_.startsWith(".")){let H=X5.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=W,Q++}return X}function QK($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function w8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=S0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function R8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=w8(Y,X);if(K){let q=R8(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function H8($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let z=Y.slice(W[0].length),U=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let _=z.startsWith("{")?"}":"]",j=z;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(_))break;z=j}let B=w8(z,0);if(B){let _=W[1],j=B.pattern,H=z.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(O8(L)){let A=L8($,O,L);F=A.value,O=A.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=R8(j),w=`__stx_src_${Z}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
|
|
1971
|
+
`);return{type:_,name:w,value:`${F}; ${_} ${j} = ${w};
|
|
1972
|
+
${R}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(O8(G)){let W=L8($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
|
|
1973
1973
|
${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function k7($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(GK(Y)){let K=KK($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function O8($){let Z=$.trim();if(Z.startsWith("{"))return S0(Z,"{","}",0)===-1;if(Z.startsWith("["))return S0(Z,"[","]",0)===-1;return!A8(Z)}function A8($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function GK($){let Z=$.indexOf("{");if(Z===-1)return!0;return S0($,"{","}",Z)===-1}function L8($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!A8(X)){let J=$[Q];X+=`
|
|
1974
1974
|
${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
|
|
1975
1975
|
${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function KK($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(S0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
|
|
@@ -3895,7 +3895,10 @@ catch (e) {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
}
|
|
3897
3897
|
if (el.nodeType === Node.TEXT_NODE) {
|
|
3898
|
-
|
|
3898
|
+
// DOM textContent is specified as a string, but lightweight DOM
|
|
3899
|
+
// implementations and user-created nodes can retain a numeric value
|
|
3900
|
+
// assigned by a binding. Normalize before interpolation detection.
|
|
3901
|
+
const text = el.textContent == null ? '' : String(el.textContent);
|
|
3899
3902
|
if (text && text.includes('{{')) {
|
|
3900
3903
|
const parts = text.split(/(\\{\\{[\\s\\S]+?\\}\\})/g);
|
|
3901
3904
|
if (parts.length > 1) {
|
|
@@ -4805,13 +4808,24 @@ else if (typeof value === 'string') {
|
|
|
4805
4808
|
var __forComponentSetupFactories = new Map();
|
|
4806
4809
|
|
|
4807
4810
|
function forEachGroupElement(nodes, callback) {
|
|
4808
|
-
|
|
4811
|
+
function visit(node, insideTemplateContent) {
|
|
4809
4812
|
if (!node || node.nodeType !== Node.ELEMENT_NODE) return;
|
|
4810
|
-
callback(node);
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4813
|
+
callback(node, insideTemplateContent);
|
|
4814
|
+
|
|
4815
|
+
// HTMLTemplateElement children live in template.content, outside the
|
|
4816
|
+
// element's ordinary descendant tree. Component roots and setup scripts
|
|
4817
|
+
// wrapped by caller-owned :if/:for directives must still be discoverable
|
|
4818
|
+
// for scope remapping before those templates are cloned.
|
|
4819
|
+
var entersTemplateContent = node.tagName === 'TEMPLATE' && node.content;
|
|
4820
|
+
var childRoot = entersTemplateContent
|
|
4821
|
+
? node.content
|
|
4822
|
+
: node;
|
|
4823
|
+
Array.from(childRoot.childNodes || []).forEach(function(child) {
|
|
4824
|
+
visit(child, insideTemplateContent || entersTemplateContent);
|
|
4825
|
+
});
|
|
4826
|
+
}
|
|
4827
|
+
|
|
4828
|
+
nodes.forEach(function(node) { visit(node, false); });
|
|
4815
4829
|
}
|
|
4816
4830
|
|
|
4817
4831
|
// A signal component expanded inside <template :for> carries a compiled
|
|
@@ -4859,7 +4873,11 @@ else if (typeof value === 'string') {
|
|
|
4859
4873
|
function hydrateComponentScopes(nodes, callerScope) {
|
|
4860
4874
|
var roots = [];
|
|
4861
4875
|
var scripts = [];
|
|
4862
|
-
forEachGroupElement(nodes, function(node) {
|
|
4876
|
+
forEachGroupElement(nodes, function(node, insideTemplateContent) {
|
|
4877
|
+
// A template's content is inert source material. Remapping must traverse
|
|
4878
|
+
// it, but setup and event hydration belong to the live clones inserted by
|
|
4879
|
+
// bindIf/bindFor, where the correct iteration scope is available.
|
|
4880
|
+
if (insideTemplateContent) return;
|
|
4863
4881
|
if (node.hasAttribute && node.hasAttribute('data-stx-scope')) roots.push(node);
|
|
4864
4882
|
if (node.tagName === 'SCRIPT' && node.hasAttribute('data-stx-scoped')) scripts.push(node);
|
|
4865
4883
|
});
|
|
@@ -8511,10 +8529,10 @@ ${U}`);return U+`
|
|
|
8511
8529
|
`+Q+$.slice(K+1)}return Q+`
|
|
8512
8530
|
`+$}async function m8($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
|
|
8513
8531
|
`}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (d7(),h7)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
|
|
8514
|
-
</body>`+$.slice(G+7)}var r$={};r(r$,{scanScriptTags:()=>o8,rewriteStxImportSpecifiers:()=>t8,processSignals:()=>c7,processScriptSetup:()=>r8,preEvalLiteralReactiveIfs:()=>l7,parseLoopExpression:()=>s8,hasSignalsSyntax:()=>s$,findMarkupIndexOutsideScripts:()=>o$,extractExports:()=>a8,convertSignalLoopsToAttributes:()=>p7,convertSignalDirectivesToAttributes:()=>u7});function o8($,Z={}){let Y=[];for(let X of V7($,W1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function s8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=l8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=l8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function l8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function s$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function dK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function mK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function uK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function c8($,Z,Y){if(!$)return!1;let X=uK($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(p8.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(X))!==null){let B=z[1];if(X.slice(0,z.index).trimEnd().endsWith("."))continue;if(p8.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function n$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,""")}"`,Q=$.trim(),J=Q.match(n8);if(J&&lK(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function lK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function u7($,Z){let Y=mK($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,z=W+K[0].length,U=1,B=z;while(B<J.length&&U>0){if(J[B]==="(")U++;else if(J[B]===")")U--;B++}if(U!==0)continue;let _=J.substring(z,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),
|
|
8515
|
-
`)}else{if(!c8(_,Y,Z))continue;
|
|
8532
|
+
</body>`+$.slice(G+7)}var r$={};r(r$,{scanScriptTags:()=>o8,rewriteStxImportSpecifiers:()=>t8,processSignals:()=>c7,processScriptSetup:()=>r8,preEvalLiteralReactiveIfs:()=>l7,parseLoopExpression:()=>s8,hasSignalsSyntax:()=>s$,findMarkupIndexOutsideScripts:()=>o$,extractExports:()=>a8,convertSignalLoopsToAttributes:()=>p7,convertSignalDirectivesToAttributes:()=>u7});function o8($,Z={}){let Y=[];for(let X of V7($,W1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function s8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=l8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=l8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function l8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function s$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function dK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function mK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function uK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function c8($,Z,Y){if(!$)return!1;let X=uK($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(p8.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(X))!==null){let B=z[1];if(X.slice(0,z.index).trimEnd().endsWith("."))continue;if(p8.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function n$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,""")}"`,Q=$.trim(),J=Q.match(n8);if(J&&lK(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function lK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function u7($,Z){let Y=mK($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,z=W+K[0].length,U=1,B=z;while(B<J.length&&U>0){if(J[B]==="(")U++;else if(J[B]===")")U--;B++}if(U!==0)continue;let _=J.substring(z,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),w;if(dK(V)){let R=i5(J.substring(W,L));if(R.length===0)continue;let A=R[0].branches.filter((M)=>M.type!=="else");if(!(A.length>0&&A.every((M)=>c8(M.condition,Y,Z))))continue;w=R[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return n$(I,"@else-if",M.condition??"");if(M.type==="else")return n$(I,"@else");return n$(I,"@if",M.condition??"")}).join(`
|
|
8533
|
+
`)}else{if(!c8(_,Y,Z))continue;w=n$(X(V),"@if",_)}q.push({start:W,end:L,replacement:w}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:B}=q[W];J=J.substring(0,z)+B+J.substring(U)}return J}return X($)}function pK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function cK($,Z,Y,X){if(m7.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${z[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(U[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||m7.has(Q)))K++}q=B+1}return-1}function nK($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return iK.test(J)}function l7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(U)=>Z.some(([B,_])=>U>=B&&U<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[U,B,_,j,H,L,F]=K,O=pK(H);if(O===void 0)continue;let V=K.index,w=V+U.length,N=!!F||/\/\s*>$/.test(U)||m7.has(B.toLowerCase())?w:cK($,V,B,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&nK($,N)){J.lastIndex=w;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:N,replacement:""}),J.lastIndex=N}if(G.length===0)return $;G.sort((U,B)=>U.start-B.start);let q=[],W=-1;for(let U of G){if(U.start<W)continue;q.push(U),W=U.end}let z=$;for(let U=q.length-1;U>=0;U--){let{start:B,end:_,replacement:j}=q[U];z=z.substring(0,B)+j+z.substring(_)}return z}function p7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),B=z,_=s8(U);if(_.iterable){let A=_.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Z){let N=A.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),w=V.match(n8),R;if(w){let[,A,N,T]=w;R=`<${A}${N} @for="${U}">${T}</${A}>`}else R=`<template @for="${U}">${V}</template>`;J.push({start:K,end:L,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function oK($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(z)=>{let U=X+1;while(U<J){let B=$[U];if(B==="\\"){U+=2;continue}if(B===z)return U+1;U++}return J},K=()=>{let z=X+2;while(z<J&&$[z]!==`
|
|
8516
8534
|
`)z++;return z},q=()=>{let z=X+2;while(z<J-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return J},W=(z)=>{let U=z,B=0;while(U<J){let _=$[U];if(_==="/"&&$[U+1]==="/"){let j=U+2;while(j<J&&$[j]!==`
|
|
8517
|
-
`)j++;U=j;continue}if(_==="/"&&$[U+1]==="*"){let j=U+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=U+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}U=j;continue}if(_==="("||_==="["||_==="{"){B++,U++;continue}if(_===")"||_==="]"||_==="}"){B--,U++;continue}if(_===";"&&B===0)return U+1;U++}return J};while(X<J){let z=$[X];if(z==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(z==="/"&&$[X+1]==="*"){let U=q();Y.push($.slice(X,U)),X=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(X,U)),X=U;continue}if(z==="{"){Q++,Y.push(z),X++;continue}if(z==="}"){Q--,Y.push(z),X++;continue}if(Q===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(z),X++}return Y.join("")}async function r8($,Z,Y){let X=o8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let L of X){let F=L.body;if(D1(L.attrs))F=E1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${hK++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (S5(),b5)),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=s1(F).code,K(F))console.log("[stx:bundler] bundling signal script imports"),F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,
|
|
8535
|
+
`)j++;U=j;continue}if(_==="/"&&$[U+1]==="*"){let j=U+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=U+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}U=j;continue}if(_==="("||_==="["||_==="{"){B++,U++;continue}if(_===")"||_==="]"||_==="}"){B--,U++;continue}if(_===";"&&B===0)return U+1;U++}return J};while(X<J){let z=$[X];if(z==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(z==="/"&&$[X+1]==="*"){let U=q();Y.push($.slice(X,U)),X=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(X,U)),X=U;continue}if(z==="{"){Q++,Y.push(z),X++;continue}if(z==="}"){Q--,Y.push(z),X++;continue}if(Q===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(z),X++}return Y.join("")}async function r8($,Z,Y){let X=o8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let L of X){let F=L.body;if(D1(L.attrs))F=E1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${hK++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (S5(),b5)),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=s1(F).code,K(F))console.log("[stx:bundler] bundling signal script imports"),F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>t8(w));let O=c0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
|
|
8518
8536
|
${O}`)}let z=W.join(`
|
|
8519
8537
|
|
|
8520
8538
|
`);z=oK(z);let U=a8(z),B=U.split(",").map((L)=>L.trim()).filter(Boolean),_=N$(z,Y),j=`
|
|
@@ -8526,17 +8544,17 @@ ${_}${z}
|
|
|
8526
8544
|
}
|
|
8527
8545
|
window.__stx_latestSetup=${G};
|
|
8528
8546
|
if(window.stx)window.stx._latestSetup=${G};
|
|
8529
|
-
</script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${u8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${u8})>`,"gi"),(O,V,
|
|
8547
|
+
</script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${u8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${u8})>`,"gi"),(O,V,w)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:H,setupCode:j}}function a8($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
|
|
8530
8548
|
`)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},U=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')z(Z[J]);else if(Z[J]==="`")U();else J++;continue}J++}},B=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
|
|
8531
|
-
`)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let
|
|
8549
|
+
`)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){z(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){U(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function c7($,Z,Y,X){if(!s$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await r8(Q,Y,X);if(Q=J,Q=await d8(Q,Z),Q=h8(Q),G){let z=o$(Q,/<\/head>/i),U=z===-1?o$(Q,/<body[^>]*>/i):-1;if(z!==-1)Q=`${Q.slice(0,z)}${G}
|
|
8532
8550
|
${Q.slice(z)}`;else if(U!==-1){let B=/<body[^>]*>/i.exec(Q.slice(U))[0],_=U+B.length;Q=`${Q.slice(0,_)}
|
|
8533
8551
|
${G}${Q.slice(_)}`}else Q=`${Q}
|
|
8534
8552
|
${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=o$(Q,z);if(U!==-1){let B=Q.slice(0,U),_=Q.slice(U).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function o$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function t8($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return i8;return`var ${Z.join(", ")}; ${i8}`}var hK=0,u8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,n8,p8,m7,iK,i8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var s5=k(()=>{v5();v$();d5();L0();k1();n8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;p8=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);m7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);iK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import sK from"fs";import f from"path";function e8($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function aK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function D1($){return!aK($)}function E1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function tK($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(z)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===z){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let z=1;while(Q<J&&z>0)if($[Q]==="{")z++,Q++;else if($[Q]==="}")z--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
|
|
8535
8553
|
`)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let z=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function eK($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function $q($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Zq($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of eK(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=$q(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let B=W.slice(z+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[U]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function t$($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],z=typeof Q.root==="string"?f.resolve(Q.root):void 0,U=z??f.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(f.join(f.dirname(j),"components"));_(Z),_(Q._rootComponentsDir),_(f.join(f.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(z)_(f.resolve(z,"resources/views/components")),_(f.resolve(z,"resources/components")),_(f.resolve(z,"src/components")),_(f.resolve(z,"components"));if(J.startsWith("./")||J.startsWith("../"))return n(f.resolve(f.dirname(X),`${J}.stx`));for(let L of B){let F=f.isAbsolute(L)?L:f.resolve(U,L);for(let O of W)if(await n(f.join(F,O)))return!0}return!1}function Yq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Xq($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function Jq($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function C1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (c5(),P$)),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&Yq(B)?B:"";try{let j=(g)=>g.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),H=(g)=>g.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let g=[L,L.toLowerCase(),j(L),H(L)];for(let d of g)if(O.has(d)){F=O.get(d);break}}let V=[];if(!F){let g=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],d=[...new Set(g)],y=Q.__originalFilePath,v=[];if(y){let z0=f.join(f.dirname(y),"components");v.push(z0)}if(X)v.push(X);let m=G._rootComponentsDir;if(typeof m==="string"&&!v.includes(m))v.push(m);let c=f.join(f.dirname(J),"components");if(!v.includes(c))v.push(c);if(G.componentsDir&&G.componentsDir!==X&&!v.includes(G.componentsDir))v.push(G.componentsDir);let K0=G._pluginComponentDirs;if(Array.isArray(K0)){for(let z0 of K0)if(typeof z0==="string"&&!v.includes(z0))v.push(z0)}let B0=typeof G.root==="string"?f.resolve(G.root):void 0,M0=B0??f.dirname(J),g0=[];if(B0)g0.push(f.resolve(B0,"resources/views/components")),g0.push(f.resolve(B0,"resources/components")),g0.push(f.resolve(B0,"src/components")),g0.push(f.resolve(B0,"components"));g0.push(f.resolve(import.meta.dir,"components"));for(let z0 of g0)if(!v.includes(z0))v.push(z0);let j$=[...new Set(v.map((z0)=>{if(!z0)return z0;return f.isAbsolute(z0)?z0:f.resolve(M0,z0)}))];if(v.length=0,v.push(...j$),L.startsWith("./")||L.startsWith("../"))F=f.resolve(f.dirname(J),`${L}.stx`),V.push(F);else for(let z0 of v){if(!z0)continue;for(let K1 of d){let p0=f.join(z0,K1);if(V.push(p0),await n(p0)){F=p0;break}}if(F)break;if(!F)try{let K1=await import("fs");if(!K1.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let A1=8,N1=[{path:z0,depth:0}];while(N1.length>0&&!F){let h0=N1.pop();if(h0.depth>=A1)continue;let a;try{a=K1.readdirSync(h0.path,{withFileTypes:!0})}catch{continue}for(let s0 of a){if(!s0.isDirectory())continue;if(s0.name==="node_modules"||s0.name.startsWith("."))continue;let G7=f.join(h0.path,s0.name);for(let XQ of d){let K7=f.join(G7,XQ);if(V.push(K7),await n(K7)){F=K7;break}}if(F)break;N1.push({path:G7,depth:h0.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let g=V.length>0?`
|
|
8536
8554
|
Searched paths:
|
|
8537
8555
|
${V.map((d)=>` - ${d}`).join(`
|
|
8538
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${g}`}q.add(F);let
|
|
8539
|
-
`)}`}if(Y&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:$1}=await Promise.resolve().then(() => (y7(),S7)),{defaultSlot:f0,namedSlots:T0}=T;X0=await $1(X0,f0,T0,I);for(let[g,d]of Object.entries(I))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("<")||d.includes(""")){let y=
|
|
8556
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${g}`}q.add(F);let w;if(a$.has(F))w=a$.get(F);else try{w=await Bun.file(F).text(),a$.set(F,w)}catch(g){return`[Error loading component: ${g instanceof Error?g.message:String(g)}]`}let R=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[g,d]of Object.entries(Q))if(!g.startsWith("__")||R.has(g))A[g]=d;let{extractSlotContent:N}=await Promise.resolve().then(() => (y7(),S7)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[g,d]of T.namedSlots)M[g]=d.content;let I={...A,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{},...Xq(Y)&&{__stx_force_signals:!0}};Zq(w,I);let E=w,D=b$(E);if(D)E=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(P)],b=[];for(let g of S){let d=g[1]||"",y=g[2]||"",v=d.includes("server");if(D1(d)&&y.trim())y=E1(y);if(v&&y)try{await W(y,I,F)}catch(c){}if(!v){let c=y.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),K0=c.includes("{{")&&c.includes("}}"),B0=c.includes("{!!")&&c.includes("!!}");if(K0||B0)c=D$(c,I);let M0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${M0}>${c}</script>`)}}let C=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),h=C?C[1]:"",x=C?C[2]:"",u="",t=h&&/\bscoped\b/i.test(h);if(C)u=`<style${h}>${x}</style>`;let X0=E;if(X0=X0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),C)X0=X0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let g=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(X0=X0.replace(g,(y,v)=>{let m=v.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(m)d.push(`<style${m[1]}>${m[2]}</style>`);return""}),X0=X0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)u=`${u}${d.join(`
|
|
8557
|
+
`)}`}if(Y&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:$1}=await Promise.resolve().then(() => (y7(),S7)),{defaultSlot:f0,namedSlots:T0}=T;X0=await $1(X0,f0,T0,I);for(let[g,d]of Object.entries(I))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("<")||d.includes(""")){let y=w7(d);I[g]=y}}let Y0=b.some((g)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(g)),R0=Jq(b);if(R0.length>0)I.__stx_client_signal_names=R0;let l0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Y0||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let Z1=await V0(X0,I,F,l0,q),R1=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let g of Z1.matchAll(/\{\{([\s\S]*?)\}\}/g))R1.add(g[1].trim());if(R1.size>0)Q.__stx_preserved_client_expressions=[...R1];let l=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++rK}_${Math.random().toString(36).slice(2,8)}`,s=Z1;if(Y0){let g="";if(Object.keys(Z).length>0)try{g=` data-stx-props="${e8(JSON.stringify(Z))}"`}catch{}let d=_?` stx-hydrate="${e8(_)}"`:"";s=`<div data-stx-scope="${l}"${g}${d}>${Z1}</div>`;let y=await Promise.all(b.map(async(v)=>{let m=v.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!m)return v;let[,c,K0]=m,B0=R$(K0,{filePath:F,projectRoot:process.cwd()}),M0=B0.code,g0=A$(B0.styles);M0=s1(M0).code;let{hasUserImports:j$,bundleClientScript:z0}=await Promise.resolve().then(() => (S5(),b5));if(j$(M0))M0=await z0(M0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:K1}=await Promise.resolve().then(() => (s5(),r$));M0=M0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(h0,a)=>K1(a));let p0=c0(M0),A1=tK(p0),N1=`
|
|
8540
8558
|
(function() {
|
|
8541
8559
|
${t1("const",[...Q8,...A1],p0)}
|
|
8542
8560
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
@@ -8633,8 +8651,8 @@ ${e.dim}${K}${e.reset}
|
|
|
8633
8651
|
filter: blur(0);
|
|
8634
8652
|
transform: scale(1);
|
|
8635
8653
|
}
|
|
8636
|
-
`.trim();$3=new Map});import{createHash as qZ}from"crypto";import{readFile as Lq,stat as WZ}from"fs/promises";async function I0($){try{let Z=await Lq($);return qZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function KZ($){return qZ("sha256").update($).digest("hex").slice(0,16)}function Z4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${KZ($)}-${KZ(Y)}`}async function Y3($){try{return(await WZ($)).mtimeMs}catch{return 0}}async function A0($){try{return await WZ($),!0}catch{return!1}}var v1=()=>{};import{mkdir as Fq,readFile as Vq,writeFile as Rq,readdir as CO,rm as wq,stat as vO}from"fs/promises";import{join as UZ,dirname as Aq}from"path";async function Nq($){try{await Fq($,{recursive:!0})}catch{}}function BZ($,Z,Y){return UZ($,Y,`${Z}.json`)}async function zZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Y3(Z)!==$.srcMtime)return!1;return!0}async function Y4($,Z,Y,X=X3){if(!X.enabled)return null;let Q=Z4($,Z),J=G5.get(Q);if(J){if(await zZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;G5.delete(Q)}let G=BZ(X.directory,Q,Y);if(await A0(G))try{let K=await Vq(G,"utf-8"),q=JSON.parse(K);if(await zZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),G5.set(Q,q),q.data}catch{}return null}async function X4($,Z,Y,X,Q=X3){if(!Q.enabled)return;let J=Z4($,Z),G=await I0($),K=await Y3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:Z4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};G5.set(J,q);let W=BZ(Q.directory,J,X);try{await Nq(Aq(W)),await Rq(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function J4($,Z=X3){if($==="all")G5.clear();else G5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=UZ(Z.directory,X);try{await wq(Q,{recursive:!0,force:!0})}catch{}}}var G5,X3;var J3=k(()=>{v1();G5=new Map,X3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class G4{config;constructor($={}){this.config={...Tq,...$}}async get($,Z){return Y4($,Z,"image",this.config)}async set($,Z,Y){return X4($,Z,Y,"image",this.config)}async clear(){return J4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function Q3($){if(!Q4)Q4=new G4($);else if($)Q4.updateConfig($);return Q4}async function K4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Q3(X).get($,Z)}async function q4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return Q3(Q).set($,Z,Y)}async function jZ(){return Q3().clear()}var Tq,Q4=null;var G3=k(()=>{J3();Tq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Mq,basename as Iq,extname as Dq,join as Eq}from"path";import{mkdir as kq}from"fs/promises";async function K3(){try{return await import("ts-images")}catch{return null}}function _Z($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function bq($,Z){let Y=Z?_Z(Z):_Z("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function HZ($,Z,Y){let X=await K3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await K4($,Z,Y);if(Q)return Q;try{let J=Mq($);if(!await A0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=bq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await kq(K,{recursive:!0});let W=await I0(J),z=Iq($,Dq($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await q3(J,Z.transformations,X);for(let j of U){let H=G[j]||{},L=`${z}-${W}.${j}`,F=Eq(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await q4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function OZ($,Z,Y,X){let Q=await K3();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function q3($,Z,Y){let X=Y||await K3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var LZ=k(()=>{v1();G3()});import{resolve as Sq,basename as yq,extname as Pq,join as Cq}from"path";import{mkdir as vq}from"fs/promises";async function xq(){try{return await import("ts-images")}catch{return null}}async function FZ($,Z,Y){let X=await xq();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=Sq($);if(!await A0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||fq,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await vq(K,{recursive:!0});let W=await I0(Q),z=yq($,Pq($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${z}-${L}w-${W}.${j}`,O=Cq(K,F),V=`${q}/${F}`;try{let R=U[j]?.quality||80;if(await A0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let w=await X.processImage({input:Q,output:O,format:j,quality:R,resize:{width:L}});if(w)B.byFormat[j].push({path:O,url:V,width:L,height:w.height||Math.round(L*(w.height||1)/(w.width||1)),format:j,size:w.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||gq(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function gq($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function VZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var fq;var RZ=k(()=>{v1();fq=[320,480,640,768,1024,1280,1536,1920]});var wZ={};r(wZ,{setCachedImageResult:()=>q4,processImage:()=>HZ,optimizeImage:()=>OZ,getCachedImageResult:()=>K4,generateSrcset:()=>VZ,generateResponsiveVariants:()=>FZ,clearImageCache:()=>jZ,applyTransformations:()=>q3,ImageProcessorCache:()=>G4});var AZ=k(()=>{LZ();RZ();G3()});async function hq(){try{return await Promise.resolve().then(() => (AZ(),wZ))}catch($){if(!NZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),NZ=!0;return null}}async function W4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return lq(X,Y)}if(Y.processedResult?.processed)return B3($,Y.processedResult,Z);if(Y.responsiveVariants)return DZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=Q5,dpr:z,formats:U=r5,quality:B=W3,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":U4,decoding:V=z4,fetchpriority:R,objectFit:w,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:P=!1,baseUrl:S=""}=Z;if(P&&!Z.optimize)return uq($);let b,C,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await QZ(Q,{strategy:j,...H}),C=JZ(h,b,H)}catch{}let x=z!==void 0&&G!==void 0,u;if(x)u=mq($,h,b,Z);else u=await dq($,h,b,Z);let t;if(F){let f0=U.includes("webp")?"webp":U[0],T0=r7(Q,W,{..._,q:B},f0),Y0=typeof q==="object"?a7(q):q||"100vw";t=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${Y0}" />`}let X0=[];if(!TZ&&j!=="none")X0.push(Z3),TZ=!0;if(C)X0.push(C);let $1=L?IZ(h):void 0;return{html:u,preloadLink:t,css:X0.length>0?X0.join(`
|
|
8637
|
-
`):void 0,script:$1}}async function dq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=Q5,formats:z=r5,quality:U=W3,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":U4,decoding:L=z4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:
|
|
8654
|
+
`.trim();$3=new Map});import{createHash as qZ}from"crypto";import{readFile as Lq,stat as WZ}from"fs/promises";async function I0($){try{let Z=await Lq($);return qZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function KZ($){return qZ("sha256").update($).digest("hex").slice(0,16)}function Z4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${KZ($)}-${KZ(Y)}`}async function Y3($){try{return(await WZ($)).mtimeMs}catch{return 0}}async function A0($){try{return await WZ($),!0}catch{return!1}}var v1=()=>{};import{mkdir as Fq,readFile as Vq,writeFile as wq,readdir as CO,rm as Rq,stat as vO}from"fs/promises";import{join as UZ,dirname as Aq}from"path";async function Nq($){try{await Fq($,{recursive:!0})}catch{}}function BZ($,Z,Y){return UZ($,Y,`${Z}.json`)}async function zZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Y3(Z)!==$.srcMtime)return!1;return!0}async function Y4($,Z,Y,X=X3){if(!X.enabled)return null;let Q=Z4($,Z),J=G5.get(Q);if(J){if(await zZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;G5.delete(Q)}let G=BZ(X.directory,Q,Y);if(await A0(G))try{let K=await Vq(G,"utf-8"),q=JSON.parse(K);if(await zZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),G5.set(Q,q),q.data}catch{}return null}async function X4($,Z,Y,X,Q=X3){if(!Q.enabled)return;let J=Z4($,Z),G=await I0($),K=await Y3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:Z4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};G5.set(J,q);let W=BZ(Q.directory,J,X);try{await Nq(Aq(W)),await wq(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function J4($,Z=X3){if($==="all")G5.clear();else G5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=UZ(Z.directory,X);try{await Rq(Q,{recursive:!0,force:!0})}catch{}}}var G5,X3;var J3=k(()=>{v1();G5=new Map,X3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class G4{config;constructor($={}){this.config={...Tq,...$}}async get($,Z){return Y4($,Z,"image",this.config)}async set($,Z,Y){return X4($,Z,Y,"image",this.config)}async clear(){return J4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function Q3($){if(!Q4)Q4=new G4($);else if($)Q4.updateConfig($);return Q4}async function K4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Q3(X).get($,Z)}async function q4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return Q3(Q).set($,Z,Y)}async function jZ(){return Q3().clear()}var Tq,Q4=null;var G3=k(()=>{J3();Tq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Mq,basename as Iq,extname as Dq,join as Eq}from"path";import{mkdir as kq}from"fs/promises";async function K3(){try{return await import("ts-images")}catch{return null}}function _Z($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function bq($,Z){let Y=Z?_Z(Z):_Z("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function HZ($,Z,Y){let X=await K3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await K4($,Z,Y);if(Q)return Q;try{let J=Mq($);if(!await A0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=bq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await kq(K,{recursive:!0});let W=await I0(J),z=Iq($,Dq($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await q3(J,Z.transformations,X);for(let j of U){let H=G[j]||{},L=`${z}-${W}.${j}`,F=Eq(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await q4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function OZ($,Z,Y,X){let Q=await K3();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function q3($,Z,Y){let X=Y||await K3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var LZ=k(()=>{v1();G3()});import{resolve as Sq,basename as yq,extname as Pq,join as Cq}from"path";import{mkdir as vq}from"fs/promises";async function xq(){try{return await import("ts-images")}catch{return null}}async function FZ($,Z,Y){let X=await xq();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=Sq($);if(!await A0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||fq,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await vq(K,{recursive:!0});let W=await I0(Q),z=yq($,Pq($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${z}-${L}w-${W}.${j}`,O=Cq(K,F),V=`${q}/${F}`;try{let w=U[j]?.quality||80;if(await A0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(R)B.byFormat[j].push({path:O,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:j,size:R.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||gq(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function gq($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function VZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var fq;var wZ=k(()=>{v1();fq=[320,480,640,768,1024,1280,1536,1920]});var RZ={};r(RZ,{setCachedImageResult:()=>q4,processImage:()=>HZ,optimizeImage:()=>OZ,getCachedImageResult:()=>K4,generateSrcset:()=>VZ,generateResponsiveVariants:()=>FZ,clearImageCache:()=>jZ,applyTransformations:()=>q3,ImageProcessorCache:()=>G4});var AZ=k(()=>{LZ();wZ();G3()});async function hq(){try{return await Promise.resolve().then(() => (AZ(),RZ))}catch($){if(!NZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),NZ=!0;return null}}async function W4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return lq(X,Y)}if(Y.processedResult?.processed)return B3($,Y.processedResult,Z);if(Y.responsiveVariants)return DZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=Q5,dpr:z,formats:U=r5,quality:B=W3,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":U4,decoding:V=z4,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:P=!1,baseUrl:S=""}=Z;if(P&&!Z.optimize)return uq($);let b,C,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await QZ(Q,{strategy:j,...H}),C=JZ(h,b,H)}catch{}let x=z!==void 0&&G!==void 0,u;if(x)u=mq($,h,b,Z);else u=await dq($,h,b,Z);let t;if(F){let f0=U.includes("webp")?"webp":U[0],T0=r7(Q,W,{..._,q:B},f0),Y0=typeof q==="object"?a7(q):q||"100vw";t=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${Y0}" />`}let X0=[];if(!TZ&&j!=="none")X0.push(Z3),TZ=!0;if(C)X0.push(C);let $1=L?IZ(h):void 0;return{html:u,preloadLink:t,css:X0.length>0?X0.join(`
|
|
8655
|
+
`):void 0,script:$1}}async function dq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=Q5,formats:z=r5,quality:U=W3,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":U4,decoding:L=z4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?a7(q):q||"100vw",I=[];for(let P of z){let S=r7(Q,W,{...B,q:U},P),b=t7(P);if(_&&!j)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${M}" />`)}let E=z3({src:a5(Q,{...B,q:U}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R,className:MZ(A,Y),style:U3(N,O,V,Y),lazy:_&&!j,data:T}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
|
|
8638
8656
|
<picture>
|
|
8639
8657
|
${I.join(`
|
|
8640
8658
|
`)}
|
|
@@ -8644,7 +8662,7 @@ ${I.join(`
|
|
|
8644
8662
|
${I.join(`
|
|
8645
8663
|
`)}
|
|
8646
8664
|
<img ${E} />
|
|
8647
|
-
</picture>`;return D}function mq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=W3,params:z={},lazy:U=!0,priority:B=!1,loading:_=B?"eager":U4,decoding:j=z4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,
|
|
8665
|
+
</picture>`;return D}function mq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=W3,params:z={},lazy:U=!0,priority:B=!1,loading:_=B?"eager":U4,decoding:j=z4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=XZ(Q,N,q,{...z,q:W}),M=z3({src:a5(Q,{...z,w:N,q:W}),alt:J,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:MZ(w,Y),style:U3(R,L,F,Y),lazy:U&&!B,data:A}),I=U&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
|
|
8648
8666
|
<img ${M} ${I} />
|
|
8649
8667
|
</div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function uq($){let{src:Z,alt:Y,width:X,height:Q,loading:J=U4,decoding:G=z4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${z3({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:_,style:U3(j,q,W),id:H,data:L})} />`}}function z3($){let Z=[];if($.lazy)Z.push(`data-src="${n0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${n0($.src)}"`);if(Z.push(`alt="${n0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${n0($.className)}"`);if($.style)Z.push(`style="${n0($.style)}"`);if($.id)Z.push(`id="${n0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${n0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function MZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function U3($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function n0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function IZ($){return`
|
|
8650
8668
|
(function() {
|
|
@@ -8683,22 +8701,22 @@ ${I.join(`
|
|
|
8683
8701
|
|
|
8684
8702
|
observer.observe(container);
|
|
8685
8703
|
})();
|
|
8686
|
-
`.trim()}async function lq($,Z){let Y=await hq();if(!Y)return W4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return DZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return B3($,J,Z)}return W4({...$,process:!1},Z)}async function B3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((C)=>C.format==="jpeg")||L.find((C)=>C.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),
|
|
8704
|
+
`.trim()}async function lq($,Z){let Y=await hq();if(!Y)return W4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return DZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return B3($,J,Z)}return W4({...$,process:!1},Z)}async function B3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((C)=>C.format==="jpeg")||L.find((C)=>C.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of L){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],A=["avif","webp","jpeg","png"];for(let C of A){let h=w.get(C);if(h&&h.length>0){let x=h.map((t)=>`${t.url} ${t.width}w`).join(", "),u=t7(C);if(G&&!K)R.push(` <source type="${u}" data-srcset="${x}" />`);else R.push(` <source type="${u}" srcset="${x}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${n0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${n0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${n0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(z)N.push(`crossorigin="${z}"`);if(U)N.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(B)E.push(B);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[C,h]of Object.entries(H))N.push(`data-${C}="${n0(h)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${j}" class="stx-img-placeholder" style="${C}">
|
|
8687
8705
|
<picture>
|
|
8688
|
-
${
|
|
8706
|
+
${R.join(`
|
|
8689
8707
|
`)}
|
|
8690
8708
|
<img ${N.join(" ")} />
|
|
8691
8709
|
</picture>
|
|
8692
8710
|
</div>`}else D=`<picture${j?` id="${j}"`:""}>
|
|
8693
|
-
${
|
|
8711
|
+
${R.join(`
|
|
8694
8712
|
`)}
|
|
8695
8713
|
<img ${N.join(" ")} />
|
|
8696
8714
|
</picture>`;let P=[];if(Z.placeholder)P.push(Z3);let S=G?IZ(j):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:P.length>0?P.join(`
|
|
8697
8715
|
`):void 0,script:S}}async function DZ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return B3($,X,Y)}var NZ=!1,W3=80,z4="async",U4="lazy",TZ=!1;var EZ=k(()=>{e7();GZ()});function pq(){return $4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=cq($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||Q5,formats:G.formats||r5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await W4(K,{isDev:q}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
|
|
8698
8716
|
`+z;if(W.css)z+=`
|
|
8699
8717
|
<style>${W.css}</style>`;if(W.script)z+=`
|
|
8700
|
-
<script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function cq($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=iq(X),J=j3(Q[0],Y)||"",G=j3(Q[1],Y)||"",K={};if(Q[2]){let q=j3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function iq($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function j3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var kZ;var bZ=k(()=>{s7();EZ();e7();kZ=pq()});class j4{config;constructor($={}){this.config={...nq,...$}}async get($,Z){return Y4($,Z,"video",this.config)}async set($,Z,Y){return X4($,Z,Y,"video",this.config)}async clear(){return J4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function _3($){if(!B4)B4=new j4($);else if($)B4.updateConfig($);return B4}async function _4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return _3(X).get($,Z)}async function H4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return _3(Q).set($,Z,Y)}async function SZ(){return _3().clear()}var nq,B4=null;var H3=k(()=>{J3();nq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as O3,basename as L3,extname as F3,join as O4}from"path";import{mkdir as V3}from"fs/promises";async function
|
|
8701
|
-
`)}async function
|
|
8718
|
+
<script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function cq($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=iq(X),J=j3(Q[0],Y)||"",G=j3(Q[1],Y)||"",K={};if(Q[2]){let q=j3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function iq($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function j3($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var kZ;var bZ=k(()=>{s7();EZ();e7();kZ=pq()});class j4{config;constructor($={}){this.config={...nq,...$}}async get($,Z){return Y4($,Z,"video",this.config)}async set($,Z,Y){return X4($,Z,Y,"video",this.config)}async clear(){return J4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function _3($){if(!B4)B4=new j4($);else if($)B4.updateConfig($);return B4}async function _4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return _3(X).get($,Z)}async function H4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return _3(Q).set($,Z,Y)}async function SZ(){return _3().clear()}var nq,B4=null;var H3=k(()=>{J3();nq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as O3,basename as L3,extname as F3,join as O4}from"path";import{mkdir as V3}from"fs/promises";async function w3(){try{return await import("ts-videos")}catch{return null}}async function L4($,Z,Y,X){let Q=await w3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=O3($);if(!await A0(J))return null;await V3(Y,{recursive:!0});let G=await I0(J),K=L3($,F3($)),q=Z.format||"webp",W=Z.timestamp||0,z=`${K}-poster-${G}.${q}`,U=O4(Y,z),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:U,url:`${X}/${z}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function F4($,Z,Y,X){let Q=await w3();if(!Q)return[];try{let J=O3($);if(!await A0(J))return[];await V3(Y,{recursive:!0});let G=await I0(J),K=L3($,F3($)),q=Z.format||"webp",U=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,_=Z.interval||U/B,j=[];for(let L=0;L<B&&L*_<U;L++)j.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||O4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function yZ($,Z,Y,X){let Q=await w3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=O3($);if(!await A0(J))return null;await V3(Y,{recursive:!0});let G=await I0(J),K=L3($,F3($)),z=(await new Q.Input(J).getInfo()).duration||60,U=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(z/B),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=O4(Y,O),w=[];for(let A=0;A<L;A++)w.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:w,width:_,height:j,format:H,quality:Z.quality||70,outputDir:O4(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),N=U*_,T=F*j,M=await A.createSprite({images:R.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var R3=k(()=>{v1()});import{resolve as CZ,basename as vZ,extname as xZ,join as x1}from"path";import{mkdir as V4,writeFile as fZ}from"fs/promises";async function gZ(){try{return await import("ts-videos")}catch{return null}}async function w4($,Z,Y,X,Q){let J=await gZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=CZ($);if(!await A0(G))return null;let K=await I0(G),q=vZ($,xZ($)),W=x1(Y,`${q}-${K}-hls`);await V4(W,{recursive:!0});let z=Z.length>0?Z:hZ,U=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of z){let w=x1(W,V.label);await V4(w,{recursive:!0});let R=`${V.label}.m3u8`,A=x1(w,R);try{let N=await J.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=N.segmentCount||Math.ceil(j/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=x1(W,"master.m3u8"),O=oq(H,X,q,K);return await fZ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function oq($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
|
|
8719
|
+
`)}async function R4($,Z,Y,X,Q){let J=await gZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=CZ($);if(!await A0(G))return null;let K=await I0(G),q=vZ($,xZ($)),W=x1(Y,`${q}-${K}-dash`);await V4(W,{recursive:!0});let z=Z.length>0?Z:hZ,U=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of z){let A=x1(W,R.label);await V4(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:U,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(L.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${N}`)}}if(L.length===0)return null;let O=x1(W,"manifest.mpd"),V=sq(L,F,H,U,B);await fZ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function sq($,Z,Y,X,Q){let J=PZ(Y),G=PZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
|
|
8702
8720
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
8703
8721
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
8704
8722
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -8724,7 +8742,7 @@ ${w.join(`
|
|
|
8724
8742
|
</Representation>
|
|
8725
8743
|
`}K+=` </AdaptationSet>
|
|
8726
8744
|
`}return K+=` </Period>
|
|
8727
|
-
</MPD>`,K}function PZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var hZ;var A3=k(()=>{v1();hZ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as dZ,basename as rq,extname as aq,join as tq}from"path";import{mkdir as eq}from"fs/promises";async function mZ(){try{return await import("ts-videos")}catch{return null}}function $W($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function ZW($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function N3($){let Z=await mZ();if(!Z)return null;try{let Y=dZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function uZ($,Z,Y,X){let Q=await mZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await _4($,Z,Y);if(J)return J;try{let G=dZ($);if(!await A0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await eq(K,{recursive:!0});let W=await I0(G),z=rq($,aq($)),U={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),U.metadata=await N3(G)||void 0;let B={};if(Z.quality)B.bitrate=$W(Z.quality);if(Z.platform)Object.assign(B,ZW(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${z}-${W}.mp4`,j=tq(K,_);try{let H=await YW(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await L4(G,_,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await F4(G,Y.thumbnails,K,q);if(_.length>0)U.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await
|
|
8745
|
+
</MPD>`,K}function PZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var hZ;var A3=k(()=>{v1();hZ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as dZ,basename as rq,extname as aq,join as tq}from"path";import{mkdir as eq}from"fs/promises";async function mZ(){try{return await import("ts-videos")}catch{return null}}function $W($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function ZW($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function N3($){let Z=await mZ();if(!Z)return null;try{let Y=dZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function uZ($,Z,Y,X){let Q=await mZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await _4($,Z,Y);if(J)return J;try{let G=dZ($);if(!await A0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await eq(K,{recursive:!0});let W=await I0(G),z=rq($,aq($)),U={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),U.metadata=await N3(G)||void 0;let B={};if(Z.quality)B.bitrate=$W(Z.quality);if(Z.platform)Object.assign(B,ZW(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${z}-${W}.mp4`,j=tq(K,_);try{let H=await YW(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await L4(G,_,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await F4(G,Y.thumbnails,K,q);if(_.length>0)U.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await w4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,hls:j}}if(_.format==="dash"){let j=await R4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await H4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function YW($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var lZ=k(()=>{v1();H3();R3();A3()});var pZ={};r(pZ,{setCachedVideoResult:()=>H4,processVideo:()=>uZ,getCachedVideoResult:()=>_4,generateThumbnails:()=>F4,generateSpriteSheet:()=>yZ,generatePoster:()=>L4,generateHLSManifest:()=>w4,generateDASHManifest:()=>R4,clearVideoCache:()=>SZ,analyzeVideo:()=>N3,VideoProcessorCache:()=>j4});var cZ=k(()=>{lZ();R3();A3();H3()});async function nZ(){try{return await Promise.resolve().then(() => (cZ(),pZ))}catch($){if(!iZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),iZ=!0;return null}}async function A4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return qW(X,Y)}if(Y.processedResult?.processed)return aZ($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await WW(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=oZ,autoplay:z=!1,muted:U=!1,loop:B=!1,preload:_=sZ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,N=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return QW($,Z);if(F&&F!=="video")return JW(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:rZ(J)}]:[],D=[`id="${I}"`];if(W)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(B)D.push("loop");if(j)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${H0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${H0(N)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${H0(T)}"`);if(M)D.push(`style="${H0(M)}"`);let P=E.map((C)=>{return` <source ${H?`data-src="${H0(C.src)}"`:`src="${H0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
8728
8746
|
`),S=`<video ${D.join(" ")}>
|
|
8729
8747
|
${P}
|
|
8730
8748
|
Your browser does not support the video tag.
|
|
@@ -8786,7 +8804,7 @@ ${P}
|
|
|
8786
8804
|
`:""}
|
|
8787
8805
|
</div>
|
|
8788
8806
|
</div>
|
|
8789
|
-
`.trim(),
|
|
8807
|
+
`.trim(),w=`
|
|
8790
8808
|
(function() {
|
|
8791
8809
|
var container = document.getElementById('${L}');
|
|
8792
8810
|
if (!container) return;
|
|
@@ -8880,7 +8898,7 @@ else {
|
|
|
8880
8898
|
});
|
|
8881
8899
|
}
|
|
8882
8900
|
})();
|
|
8883
|
-
`.trim(),
|
|
8901
|
+
`.trim(),R=`
|
|
8884
8902
|
.ts-video-player {
|
|
8885
8903
|
position: relative;
|
|
8886
8904
|
background: #000;
|
|
@@ -8932,7 +8950,7 @@ else {
|
|
|
8932
8950
|
.ts-video-player__play-button svg {
|
|
8933
8951
|
margin-left: 4px;
|
|
8934
8952
|
}
|
|
8935
|
-
`.trim();return{html:V,script:
|
|
8953
|
+
`.trim();return{html:V,script:w,css:R}}function rZ($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function GW($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function KW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function H0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function qW($,Z){let Y=await nZ();if(!Y)return A4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return aZ($,Q,Z);return A4({...$,process:!1},Z)}async function WW($,Z){let Y=await nZ();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function aZ($,Z,Y){let{controls:X=oZ,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=sZ,playsinline:q=!0,lazy:W=!0,width:z,height:U,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=rZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(_)A.push("disablepictureinpicture");if(j)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(W){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${H0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${H0(R)}"`);let N=z||Z.metadata?.width,T=U||Z.metadata?.height;if(N)A.push(`width="${N}"`);if(T)A.push(`height="${T}"`);if(H)A.push(`class="${H0(H)}"`);if(L)A.push(`style="${H0(L)}"`);let I=` <source ${W?`data-src="${H0(O)}"`:`src="${H0(O)}"`} type="${V}" />`,E=`<video ${A.join(" ")}>
|
|
8936
8954
|
${I}
|
|
8937
8955
|
Your browser does not support the video tag.
|
|
8938
8956
|
</video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${H0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
|
|
@@ -8972,7 +8990,7 @@ ${E}
|
|
|
8972
8990
|
|
|
8973
8991
|
observer.observe(video);
|
|
8974
8992
|
})();
|
|
8975
|
-
`.trim();let P;if(
|
|
8993
|
+
`.trim();let P;if(w)P=`
|
|
8976
8994
|
.stx-video-wrapper {
|
|
8977
8995
|
position: relative;
|
|
8978
8996
|
width: 100%;
|
|
@@ -9282,7 +9300,7 @@ catch (error) {
|
|
|
9282
9300
|
init();
|
|
9283
9301
|
}
|
|
9284
9302
|
})();
|
|
9285
|
-
</script>`}function CL($){return[...$,...I3]}var OW,LW,FW,VW,I3;var D3=k(()=>{OW={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return BW($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},LW={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return jW($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},FW={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return _W($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},VW={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return HW($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},I3=[OW,LW,FW,VW]});function E3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var N4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function t5(){return!1}function e5(){return!t5()||process.env.STX_DEBUG==="true"}function T4(){return!1}import
|
|
9303
|
+
</script>`}function CL($){return[...$,...I3]}var OW,LW,FW,VW,I3;var D3=k(()=>{OW={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return BW($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},LW={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return jW($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},FW={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return _W($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},VW={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return HW($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},I3=[OW,LW,FW,VW]});function E3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var N4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function t5(){return!1}function e5(){return!t5()||process.env.STX_DEBUG==="true"}function T4(){return!1}import wW from"path";function M4(){return{...k3}}function I4($){if(!k3.showRelativePaths||!$)return $;let Z=k3.baseDir||process.cwd();try{let Y=wW.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var RW,k3,D4,f1,E4;var k4=k(()=>{N4();RW={showRelativePaths:!1,enableAutoRecovery:e5(),logRecoveryWarnings:!0},k3={...RW};D4=class D4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=I4(this.filePath)}};f1=class f1 extends D4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};E4=class E4 extends D4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function Y2($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:z,format:U="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=DW(K,q);B=O.line,_=O.column}let j=Q?I4(Q):void 0,H=X?E3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=NW(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=TW(L,K,q);break;case"text":default:F=AW(L,K,q);break}return{formatted:F,data:L}}function AW($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
|
|
9286
9304
|
${$.message}`),Z&&$.line){let J=MW(Z,$.line,2);if(J)X.push(`
|
|
9287
9305
|
${J}`)}if($.snippet)X.push(`
|
|
9288
9306
|
Snippet: ${$.snippet}`);if($.suggestion)X.push(`
|
|
@@ -9311,25 +9329,25 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
9311
9329
|
`)}}});var Q2=()=>{};var G2=k(()=>{N4();X2();J2();Q2();k4()});var J1=k(()=>{G2()});function K2($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,B=z.length>1?z[1]:"";if(B&&Z[B])W=Z[B];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${p(U)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<Q.length&&W>0){if(Q[z]==="(")W++;else if(Q[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=Q.substring(q+1,z).trim(),B=z+1,_=(()=>{try{let j=F0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return $0("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),J.lastIndex=0}return Q}function q2($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=X.substring(K+1,W).trim(),U=W+1,B=(()=>{try{let _=F0(z,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return $0("StructuredData",j,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(U),Q.lastIndex=0}return X}function W2($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<Q.length&&q>0){let F=Q[W];if(U){U=!1,W++;continue}if(F==="\\"&&z){U=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let B=Q.substring(W).match(/^\s*\)/);if(!B)break;let _=W+B[0].length,j=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=F0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
|
|
9312
9330
|
`,V+=`<meta name="title" content="${p(O.title)}">
|
|
9313
9331
|
`;if(O.description)V+=`<meta name="description" content="${p(O.description)}">
|
|
9314
|
-
`;if(O.keywords){let
|
|
9332
|
+
`;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${p(w)}">
|
|
9315
9333
|
`}if(O.robots)V+=`<meta name="robots" content="${p(O.robots)}">
|
|
9316
9334
|
`;if(O.canonical)V+=`<link rel="canonical" href="${p(O.canonical)}">
|
|
9317
|
-
`;if(O.openGraph){let
|
|
9318
|
-
`,
|
|
9319
|
-
`}if(
|
|
9320
|
-
`}if(
|
|
9321
|
-
`}if(
|
|
9322
|
-
`,
|
|
9323
|
-
`;if(
|
|
9324
|
-
`;if(
|
|
9325
|
-
`}if(
|
|
9326
|
-
`}if(O.twitter){let
|
|
9327
|
-
`,
|
|
9328
|
-
`}if(
|
|
9329
|
-
`}if(
|
|
9330
|
-
`}if(
|
|
9331
|
-
`;if(
|
|
9332
|
-
`}if(O.structuredData){let
|
|
9335
|
+
`;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${p(w.type||"website")}">
|
|
9336
|
+
`,w.title||O.title){let R=w.title||O.title||"";V+=`<meta property="og:title" content="${p(R)}">
|
|
9337
|
+
`}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta property="og:description" content="${p(R)}">
|
|
9338
|
+
`}if(w.url||O.canonical){let R=w.url||O.canonical||"";V+=`<meta property="og:url" content="${p(R)}">
|
|
9339
|
+
`}if(w.image){if(V+=`<meta property="og:image" content="${p(w.image)}">
|
|
9340
|
+
`,w.imageAlt)V+=`<meta property="og:image:alt" content="${p(w.imageAlt)}">
|
|
9341
|
+
`;if(w.imageWidth)V+=`<meta property="og:image:width" content="${p(String(w.imageWidth))}">
|
|
9342
|
+
`;if(w.imageHeight)V+=`<meta property="og:image:height" content="${p(String(w.imageHeight))}">
|
|
9343
|
+
`}if(w.siteName)V+=`<meta property="og:site_name" content="${p(w.siteName)}">
|
|
9344
|
+
`}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${p(w.card||"summary_large_image")}">
|
|
9345
|
+
`,w.title||O.title){let R=w.title||O.title||"";V+=`<meta name="twitter:title" content="${p(R)}">
|
|
9346
|
+
`}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta name="twitter:description" content="${p(R)}">
|
|
9347
|
+
`}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${p(R)}">
|
|
9348
|
+
`}if(w.site)V+=`<meta name="twitter:site" content="${p(w.site)}">
|
|
9349
|
+
`;if(w.creator)V+=`<meta name="twitter:creator" content="${p(w.creator)}">
|
|
9350
|
+
`}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
|
|
9333
9351
|
`}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function z2($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
|
|
9334
9352
|
<!-- stx SEO Tags -->
|
|
9335
9353
|
<meta name="title" content="${p(G)}">
|
|
@@ -9399,14 +9417,14 @@ ${z}
|
|
|
9399
9417
|
customElements.define('${Z}', ${G});
|
|
9400
9418
|
`}async function j2($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[$$.join($$.dirname(X),G,`${Q}.stx`),$$.join(process.cwd(),G,`${Q}.stx`),$$.join($$.dirname(X),`${Q}.stx`)],q=null;for(let U of K)if(await n(U)){q=await Bun.file(U).text();break}if(!q)return $0("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=EW(q,Q);return`<script type="module">
|
|
9401
9419
|
${kW(W)}
|
|
9402
|
-
</script>`}var _2=k(()=>{J1();L0()});var H2={};r(H2,{timingPlugin:()=>CW,pluginManager:()=>bW,definePlugin:()=>b4,debugPlugin:()=>PW,createVariablesPlugin:()=>vW,createFilterPlugin:()=>yW,createDirectivePlugin:()=>SW,PluginManager:()=>C3});function b4($){return $}class C3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function SW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function yW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function vW($){return b4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var bW,PW,CW;var O2=k(()=>{bW=new C3;PW=b4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),CW=b4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var F2={};r(F2,{validateConfig:()=>dW,loadStxConfig:()=>W5,defineStxConfig:()=>hW,defaultConfig:()=>g1,config:()=>x3});import v3 from"fs";import D0 from"path";import{loadConfigWithResult as xW}from"bunfig";function fW($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=D0.join(process.cwd(),"resources","views"),Q=D0.join(process.cwd(),"resources","layouts");if(v3.existsSync(X)&&v3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=D0.join(process.cwd(),"resources","views","pages");if(v3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function gW($){if(H9($.stateDir),$.stateDir=I5(),$.cachePath=E5($.cachePath),$.build)$.build.cacheDir=E5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=E5($.media.cache.directory);if($.story)$.story.outDir=E5($.story.outDir)}async function W5($){if(!$){if(q5)return q5;if(S4)return S4}let Z=$?D0.resolve($):process.cwd(),Y=L2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await xW({name:"stx",alias:"ui",cwd:Z,defaultConfig:g1,verbose:!1})).config;gW(J);let G=fW(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!D0.isAbsolute(J.partialsDir))J.partialsDir=D0.join(K,J.partialsDir);if(J.componentsDir&&!D0.isAbsolute(J.componentsDir))J.componentsDir=D0.join(K,J.componentsDir);if(J.layoutsDir&&!D0.isAbsolute(J.layoutsDir))J.layoutsDir=D0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (O2(),H2)),q=[],W=[];for(let z of J.plugins){let U=typeof z==="string"?z:z[0],B=typeof z==="string"?{}:z[1]||{};try{let _,j;try{_=await import(U),j=D0.dirname(q0.resolve(U))}catch{let L=D0.resolve(process.cwd(),U);_=await import(L),j=D0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(L2.set(Z,X),!$)S4=X,X.then((Q)=>{q5=Q}).catch(()=>{});return X}function hW($){return $}function dW($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var g1,q5=null,L2,S4=null,x3;var z5=k(()=>{B7();j7();_7();H7();o7();bZ();M3();D3();P3();R$();_2();g1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:o1,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:YZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:j2,hasEndTag:!1,description:"Include a web component in the template"},F9,V9,U2,B2,R9,A9,N9,w9,D9,b9,kZ,T3,...I3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};L2=new Map;x3=new Proxy(g1,{get($,Z){if(q5&&Z in q5)return q5[Z];if(!S4)W5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import G0 from"path";import{hasLocalConfig as mW}from"bunfig/discovery";function h3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function g3($,Z){if(h1.has($))h1.delete($);else if(h1.size>=uW)h1.delete(h1.keys().next().value);h1.set($,Z)}async function lW($){if(!H1)return null;try{let Z=Bun.file(G0.join(H1,`cw-${h3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function pW($,Z){if(!H1)return;try{if(!fs.existsSync(H1))fs.mkdirSync(H1,{recursive:!0});await Bun.write(G0.join(H1,`cw-${h3($)}.css`),Z)}catch{}}async function R2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function cW(){let $=[],Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);return $}function iW(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function nW(){if(V2)return Q1;V2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await R2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=G0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return Q1=J,Q1}let Z=await $(cW());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await R2(Q);if(J){if(Q1=J,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return Q1}}let X=await $(iW());if(X)return Q1=X,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}async function oW($){try{if(!mW({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=G0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function sW($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function rW($,Z){try{let Y=await nW();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):sW($);if(X.size===0)return"";let Q=Z?G0.resolve(Z):process.cwd();if(!H1)H1=D5(Q,"cache");let J=[...X].sort().join(" "),G=`${f3||"default"}::${J}`,K=h1.get(G);if(K!==void 0)return g3(G,K),K;let q=await lW(G);if(q!==null)return g3(G,q),q;if(!y4){let w=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (z5(),F2)),N=await A(Q);if(N.css)if(typeof N.css==="string"){let T=G0.isAbsolute(N.css)?N.css:G0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);w=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(w={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=G0.isAbsolute(N.css.config)?N.css.config:G0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);w={...M.default||M,...w}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}y4=w||await oW(Q);try{f3=h3(JSON.stringify(y4??{}))}catch{f3="unhashable"}}let W=Y.defaultConfig||Y.config,z=y4||{},U=W.theme||{},_=(z.theme||{}).extend||{},j={...U};if(Object.keys(_).length>0)j.extend=_;let H=[...W.safelist||[],...z.safelist||[]],L={...W,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let w of H)F.generate(w);for(let w of X)F.generate(w);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[w,A]of Object.entries(V)){if(!X.has(w)&&!H.includes(w))continue;let N=A.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let R=O.split(`
|
|
9403
|
-
`);for(let[
|
|
9404
|
-
.${
|
|
9405
|
-
@media (prefers-color-scheme: dark) { .dark .${
|
|
9420
|
+
</script>`}var _2=k(()=>{J1();L0()});var H2={};r(H2,{timingPlugin:()=>CW,pluginManager:()=>bW,definePlugin:()=>b4,debugPlugin:()=>PW,createVariablesPlugin:()=>vW,createFilterPlugin:()=>yW,createDirectivePlugin:()=>SW,PluginManager:()=>C3});function b4($){return $}class C3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function SW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function yW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function vW($){return b4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var bW,PW,CW;var O2=k(()=>{bW=new C3;PW=b4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),CW=b4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var F2={};r(F2,{validateConfig:()=>dW,loadStxConfig:()=>W5,defineStxConfig:()=>hW,defaultConfig:()=>g1,config:()=>x3});import v3 from"fs";import D0 from"path";import{loadConfigWithResult as xW}from"bunfig";function fW($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=D0.join(process.cwd(),"resources","views"),Q=D0.join(process.cwd(),"resources","layouts");if(v3.existsSync(X)&&v3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=D0.join(process.cwd(),"resources","views","pages");if(v3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function gW($){if(H9($.stateDir),$.stateDir=I5(),$.cachePath=E5($.cachePath),$.build)$.build.cacheDir=E5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=E5($.media.cache.directory);if($.story)$.story.outDir=E5($.story.outDir)}async function W5($){if(!$){if(q5)return q5;if(S4)return S4}let Z=$?D0.resolve($):process.cwd(),Y=L2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await xW({name:"stx",alias:"ui",cwd:Z,defaultConfig:g1,verbose:!1})).config;gW(J);let G=fW(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!D0.isAbsolute(J.partialsDir))J.partialsDir=D0.join(K,J.partialsDir);if(J.componentsDir&&!D0.isAbsolute(J.componentsDir))J.componentsDir=D0.join(K,J.componentsDir);if(J.layoutsDir&&!D0.isAbsolute(J.layoutsDir))J.layoutsDir=D0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (O2(),H2)),q=[],W=[];for(let z of J.plugins){let U=typeof z==="string"?z:z[0],B=typeof z==="string"?{}:z[1]||{};try{let _,j;try{_=await import(U),j=D0.dirname(q0.resolve(U))}catch{let L=D0.resolve(process.cwd(),U);_=await import(L),j=D0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(L2.set(Z,X),!$)S4=X,X.then((Q)=>{q5=Q}).catch(()=>{});return X}function hW($){return $}function dW($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var g1,q5=null,L2,S4=null,x3;var z5=k(()=>{B7();j7();_7();H7();o7();bZ();M3();D3();P3();w$();_2();g1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:o1,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:YZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:j2,hasEndTag:!1,description:"Include a web component in the template"},F9,V9,U2,B2,w9,A9,N9,R9,D9,b9,kZ,T3,...I3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};L2=new Map;x3=new Proxy(g1,{get($,Z){if(q5&&Z in q5)return q5[Z];if(!S4)W5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import G0 from"path";import{hasLocalConfig as mW}from"bunfig/discovery";function h3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function g3($,Z){if(h1.has($))h1.delete($);else if(h1.size>=uW)h1.delete(h1.keys().next().value);h1.set($,Z)}async function lW($){if(!H1)return null;try{let Z=Bun.file(G0.join(H1,`cw-${h3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function pW($,Z){if(!H1)return;try{if(!fs.existsSync(H1))fs.mkdirSync(H1,{recursive:!0});await Bun.write(G0.join(H1,`cw-${h3($)}.css`),Z)}catch{}}async function w2($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function cW(){let $=[],Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);return $}function iW(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function nW(){if(V2)return Q1;V2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await w2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=G0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return Q1=J,Q1}let Z=await $(cW());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await w2(Q);if(J){if(Q1=J,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return Q1}}let X=await $(iW());if(X)return Q1=X,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}async function oW($){try{if(!mW({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=G0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function sW($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function rW($,Z){try{let Y=await nW();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):sW($);if(X.size===0)return"";let Q=Z?G0.resolve(Z):process.cwd();if(!H1)H1=D5(Q,"cache");let J=[...X].sort().join(" "),G=`${f3||"default"}::${J}`,K=h1.get(G);if(K!==void 0)return g3(G,K),K;let q=await lW(G);if(q!==null)return g3(G,q),q;if(!y4){let R=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (z5(),F2)),N=await A(Q);if(N.css)if(typeof N.css==="string"){let T=G0.isAbsolute(N.css)?N.css:G0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);R=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(R={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=G0.isAbsolute(N.css.config)?N.css.config:G0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);R={...M.default||M,...R}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}y4=R||await oW(Q);try{f3=h3(JSON.stringify(y4??{}))}catch{f3="unhashable"}}let W=Y.defaultConfig||Y.config,z=y4||{},U=W.theme||{},_=(z.theme||{}).extend||{},j={...U};if(Object.keys(_).length>0)j.extend=_;let H=[...W.safelist||[],...z.safelist||[]],L={...W,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let R of H)F.generate(R);for(let R of X)F.generate(R);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
|
|
9421
|
+
`);for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of N){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<w.length;b++){let C=w[b].trim();if(C===`${S} {`||C.startsWith(`${S} {`)){let h=b,x="";while(h<w.length){if(x+=w[h],w[h].includes("}"))break;h++}let u=x.match(/\{([^}]+)\}/);if(u)if(E)M.push(u[1].trim());else T.push(u[1].trim());break}}}if(T.length)O+=`
|
|
9422
|
+
.${R} { ${T.join(" ")} }`;if(M.length)O+=`
|
|
9423
|
+
@media (prefers-color-scheme: dark) { .dark .${R} { ${M.join(" ")} } }`}return g3(G,O),pW(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function R2($,Z){let Y=await rW($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
|
|
9406
9424
|
${Y}
|
|
9407
9425
|
</style>`,Q=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(Q.test($)){let J=!1;return $.replace(Q,()=>{if(J)return"";return J=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
|
|
9408
9426
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
9409
|
-
${X}`);return X+$}var Q1=null,V2=!1,y4=null,uW=256,h1,H1=null,f3=null;var A2=k(()=>{
|
|
9427
|
+
${X}`);return X+$}var Q1=null,V2=!1,y4=null,uW=256,h1,H1=null,f3=null;var A2=k(()=>{w$();O9();h1=new Map});function N2(){return`
|
|
9410
9428
|
// STX Lifecycle Runtime
|
|
9411
9429
|
(function() {
|
|
9412
9430
|
if (typeof window === 'undefined') return;
|
|
@@ -9751,7 +9769,7 @@ else {
|
|
|
9751
9769
|
|
|
9752
9770
|
console.log('[stx] Lifecycle runtime initialized');
|
|
9753
9771
|
})();
|
|
9754
|
-
`}function d3($){return Symbol($)}var rF,aF,tF;var T2=k(()=>{rF=d3("theme"),aF=d3("router"),tF=d3("i18n")});import*as I2 from"crypto";function M2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function aW(){return`stx-${I2.randomBytes(4).toString("hex")}`}function tW($){return/\$\w+\./.test($)}function eW($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],z=!1,U=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(tW(V)){z=!0;let
|
|
9772
|
+
`}function d3($){return Symbol($)}var rF,aF,tF;var T2=k(()=>{rF=d3("theme"),aF=d3("router"),tF=d3("i18n")});import*as I2 from"crypto";function M2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function aW(){return`stx-${I2.randomBytes(4).toString("hex")}`}function tW($){return/\$\w+\./.test($)}function eW($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],z=!1,U=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(tW(V)){z=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:O,expr:R,fullMatch:F,originalAttr:O}),M2(R).forEach((N)=>Y.add(N)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!z)return J;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=aW(),U=` id="${H}"${U}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:M2(L.expr)});return`<${G}${U}${q}`}),{html:Q,bindings:Z,stores:Y}}function $z($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
|
|
9755
9773
|
<script>
|
|
9756
9774
|
(function() {
|
|
9757
9775
|
'use strict';
|
|
@@ -10290,12 +10308,12 @@ window.__stx_reactive = (function() {
|
|
|
10290
10308
|
<script data-stx-scoped data-stx-reactive>
|
|
10291
10309
|
${Fz()}
|
|
10292
10310
|
${Y}
|
|
10293
|
-
</script>`}function m2($,Z,Y){if(d2=0,!
|
|
10294
|
-
`+Q.slice(G);else Q+=J;return Q}function Rz($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${P4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${P4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${P4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${P4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function wz($){return/x-data\s*=\s*["']/.test($)}var d2=0,jz=0;var u2=k(()=>{a0()});import Az from"fs";import m3 from"path";import{createHighlighter as Nz}from"ts-syntax-highlighter";async function Tz($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let X=(await Az.promises.stat($)).mtime.getTime();if(Z.cache&&u3.has($)){let U=u3.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:J,content:G}=y9(Q),K=Z.markdown||x3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=k5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Mz(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:J||{}};if(Z.cache)u3.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function Mz($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!C4)try{C4=await Nz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,z)=>{let U=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!C4.getSupportedLanguages().includes(B))return K;return(await C4.highlight(U,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,z,U]=K,B=await Q(q,W,z,U);J=J.replace(q,B)}return J}async function l2($,Z,Y="",X={}){return await Iz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!m3.isAbsolute(K))z=m3.resolve(m3.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let R=V.indexOf(":");if(R>0){let w=V.substring(0,R).trim(),A=V.substring(R+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(N||T)A=A.substring(1,A.length-1);U[w]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await Tz(z,X),j={...Z,..._,...U},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return W0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function Iz($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var u3,C4=null;var p2=k(()=>{z5();L0();u3=new Map});function O1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var c2=k(()=>{_0()});function Dz($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=P7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let B;if(U.value&&J0(U.value))B=Q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)B=Z0(U.value,Z);if(q===B){W=U.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function d1($,Z,Y){let X=$;X=Dz(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=j1(X,K+7);if(!q)break;let W=q.endPos,z=y1(X,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(W,z),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(U))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(U))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(U))!==null)V.push({pos:R.index,type:"else"});V.sort((w,A)=>w.pos-A.pos);for(let w of V)if(w.type==="open")H++;else if(w.type==="close")H--;else if(w.type==="else"&&H===0){_=w.pos;break}}let j;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${U}@endif`;X=X.substring(0,K)+j+X.substring(z+10),J=!0}}X=p3(X,Z,Y),X=c3(X,Z,Y),X=l3(X,Z);let Q=()=>{let J=i5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&J0(z.condition))U=Q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function i2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function l3($,Z){let Y=$;function X(K,q,W,z){let U=1,B=z,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&U>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,B=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,B=Y.slice(W+5),_=i2(B);if(_)z=_.value,U=W+5+_.consumed;else U=W+5;let j=X(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?O1(`auth?.check && auth?.user?.[${z}]`,Z):O1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,B=Y.slice(W+6),_=i2(B);if(_)z=_.value,U=W+6+_.consumed;else U=W+6;let j=X(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?O1(`!auth?.check || !auth?.user?.[${z}]`,Z):O1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=O1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let B=U.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=R.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=w.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],E=0;for(let b=0;b<O.length;b++){let C=O[b];if(I.push({content:F.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let h=F.slice(C.pos+`@${W}`.length),x=G(h);if(x){I[I.length-1]={content:F.slice(E,C.pos)},E=C.pos+`@${W}`.length+x.paramsEnd,I.push({content:"",ability:x.ability,type:x.type,id:x.id}),I.pop();let u=O[b+1],t=u?u.pos:F.length;I.push({content:F.slice(E,t),ability:x.ability,type:x.type,id:x.id}),E=t}}else E=C.pos+5}if(E<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=J(j.ability,j.type,j.id),P=K==="can"?D:!D,S="";if(P)S=I[0]?.content||"";else{let b=!1;for(let C=1;C<I.length;C++){let h=I[C];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let x=J(h.ability,h.type,h.id);if(K==="can"?x:!x){S=h.content,b=!0;break}}}if(!b&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),z=!0}}return Y}function p3($,Z,Y){let X=$;function Q(J,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),B=J.match(U);if(!B||B.index===void 0)break;let _=B.index,j=j1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,R=0,w=0;while(w<F.length){let A=F.indexOf("@",w);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){R++,w=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){R--,w=A+1;continue}if(R===0&&/^@else(?![a-z])/.test(N)){V=A;break}w=A+1}try{let A=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=A?T:M}else N=A?F:"";J=J.substring(0,_)+N+J.substring(L+`@${K}`.length),z=!0}catch(A){let N=A instanceof Error?A.message:String(A),T=$0(W,`Error processing @${G} directive: ${N}`,o.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=O1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=O1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function c3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,R=O,w=-1;while(V>0&&R<j.length){z.lastIndex=R,U.lastIndex=R;let D=z.exec(j),P=U.exec(j),S=D?D.index:1/0,b=P?P.index:1/0;if(S<b)V++,R=S+D[0].length;else if(b<1/0){if(V--,V===0){w=b;break}R=b+P[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=j.substring(O,w),N=-1,T=0,M=0;while(M<A.length){let D=A.indexOf("@",M);if(D===-1)break;let P=A.substring(D);if(B.test(P)){T++,M=D+1;continue}if(_.test(P)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){N=D;break}M=D+1}let I;if(N!==-1){let D=A.slice(0,N),P=A.slice(N+5);I=W?D:P}else I=W?A:"";let E=`@${q}`.length;j=j.substring(0,F)+I+j.substring(w+E),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var v4=k(()=>{c2();J1();v$();_0()});function o2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function x4($,Z){if(!$)return Z?.nonceGenerator?.()??o2();let Y=n2.get($);if(!Y)Y=Z?.nonceGenerator?.()??o2(),n2.set($,Y);return Y}function Ez($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function s2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Ez($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function r2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?x4(Y,Z):void 0,Q=s2(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
10295
|
-
${Q}`)}function a2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function t2($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?x4(Z,J):void 0;return s2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return x4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=x4(Z,J);return Q}var n2;var e2=k(()=>{n2=new WeakMap});import kz from"crypto";function Sz($=bz){let Z=kz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return i3=Z,Z}function yz(){if(!i3)Sz();return i3}function Pz($=$Y){let Z=yz();return`<input type="hidden" name="${$}" value="${Z}">`}function ZY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return Pz(X||$Y)})}var bz=40,$Y="_token",i3=null;var YY=()=>{};async function XY($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await Cz(Q,J,Z,Y,X);else Q=await vz(Q,J,Z,Y,X)}return Q}async function Cz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,z=$5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],B=z.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?JY(j):[],O=H.trim(),V=await G(O,F,Y,X);U.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);U.push({original:_,processed:$0("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}B=z.exec(W)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];W=W.replace(j,H)}return W}async function vz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=$5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[_,j=""]=z,H=z.index||0;try{let L=JY(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}z=q.exec(K)}let U=$5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=U.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:j})}B=U.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function JY($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var QY=k(()=>{J1();Z5()});function m1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function fz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(m1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(m1(Y.key,"appearance.key"),m1(Y.attribute,"appearance.attribute"),m1(Y.default,"appearance.default"),m1(X.key,"colorMode.key"),m1(X.attribute,"colorMode.attribute"),m1(X.default,"colorMode.default"),!KY.test(Y.key)||!KY.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!GY.test(Y.attribute)||!GY.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!xz.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function gz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function hz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${gz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function dz($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function qY($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=dz(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=Z0(`(${K})`,Z),W=hz(fz(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var GY,KY,xz;var WY=k(()=>{_0();GY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,KY=/^[A-Za-z_$][\w$]*$/,xz=new Set(["light","dark","system"])});import mz from"crypto";function
|
|
10311
|
+
</script>`}function m2($,Z,Y){if(d2=0,!Rz($))return $;let X=_z($);if(X.length===0)return $;let Q=wz($,X),J=Vz(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
|
|
10312
|
+
`+Q.slice(G);else Q+=J;return Q}function wz($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${P4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${P4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${P4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${P4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Rz($){return/x-data\s*=\s*["']/.test($)}var d2=0,jz=0;var u2=k(()=>{a0()});import Az from"fs";import m3 from"path";import{createHighlighter as Nz}from"ts-syntax-highlighter";async function Tz($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let X=(await Az.promises.stat($)).mtime.getTime();if(Z.cache&&u3.has($)){let U=u3.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:J,content:G}=y9(Q),K=Z.markdown||x3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=k5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Mz(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:J||{}};if(Z.cache)u3.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function Mz($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!C4)try{C4=await Nz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,z)=>{let U=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!C4.getSupportedLanguages().includes(B))return K;return(await C4.highlight(U,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,z,U]=K,B=await Q(q,W,z,U);J=J.replace(q,B)}return J}async function l2($,Z,Y="",X={}){return await Iz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!m3.isAbsolute(K))z=m3.resolve(m3.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(N||T)A=A.substring(1,A.length-1);U[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await Tz(z,X),j={...Z,..._,...U},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return W0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function Iz($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var u3,C4=null;var p2=k(()=>{z5();L0();u3=new Map});function O1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var c2=k(()=>{_0()});function Dz($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=P7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let B;if(U.value&&J0(U.value))B=Q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)B=Z0(U.value,Z);if(q===B){W=U.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function d1($,Z,Y){let X=$;X=Dz(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=j1(X,K+7);if(!q)break;let W=q.endPos,z=y1(X,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(W,z),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")H++;else if(R.type==="close")H--;else if(R.type==="else"&&H===0){_=R.pos;break}}let j;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${U}@endif`;X=X.substring(0,K)+j+X.substring(z+10),J=!0}}X=p3(X,Z,Y),X=c3(X,Z,Y),X=l3(X,Z);let Q=()=>{let J=i5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&J0(z.condition))U=Q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function i2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function l3($,Z){let Y=$;function X(K,q,W,z){let U=1,B=z,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&U>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,B=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,B=Y.slice(W+5),_=i2(B);if(_)z=_.value,U=W+5+_.consumed;else U=W+5;let j=X(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?O1(`auth?.check && auth?.user?.[${z}]`,Z):O1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,B=Y.slice(W+6),_=i2(B);if(_)z=_.value,U=W+6+_.consumed;else U=W+6;let j=X(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?O1(`!auth?.check || !auth?.user?.[${z}]`,Z):O1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=O1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let B=U.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],E=0;for(let b=0;b<O.length;b++){let C=O[b];if(I.push({content:F.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let h=F.slice(C.pos+`@${W}`.length),x=G(h);if(x){I[I.length-1]={content:F.slice(E,C.pos)},E=C.pos+`@${W}`.length+x.paramsEnd,I.push({content:"",ability:x.ability,type:x.type,id:x.id}),I.pop();let u=O[b+1],t=u?u.pos:F.length;I.push({content:F.slice(E,t),ability:x.ability,type:x.type,id:x.id}),E=t}}else E=C.pos+5}if(E<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=J(j.ability,j.type,j.id),P=K==="can"?D:!D,S="";if(P)S=I[0]?.content||"";else{let b=!1;for(let C=1;C<I.length;C++){let h=I[C];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let x=J(h.ability,h.type,h.id);if(K==="can"?x:!x){S=h.content,b=!0;break}}}if(!b&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),z=!0}}return Y}function p3($,Z,Y){let X=$;function Q(J,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),B=J.match(U);if(!B||B.index===void 0)break;let _=B.index,j=j1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){V=A;break}R=A+1}try{let A=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=A?T:M}else N=A?F:"";J=J.substring(0,_)+N+J.substring(L+`@${K}`.length),z=!0}catch(A){let N=A instanceof Error?A.message:String(A),T=$0(W,`Error processing @${G} directive: ${N}`,o.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=O1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=O1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function c3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,w=O,R=-1;while(V>0&&w<j.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(j),P=U.exec(j),S=D?D.index:1/0,b=P?P.index:1/0;if(S<b)V++,w=S+D[0].length;else if(b<1/0){if(V--,V===0){R=b;break}w=b+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=j.substring(O,R),N=-1,T=0,M=0;while(M<A.length){let D=A.indexOf("@",M);if(D===-1)break;let P=A.substring(D);if(B.test(P)){T++,M=D+1;continue}if(_.test(P)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){N=D;break}M=D+1}let I;if(N!==-1){let D=A.slice(0,N),P=A.slice(N+5);I=W?D:P}else I=W?A:"";let E=`@${q}`.length;j=j.substring(0,F)+I+j.substring(R+E),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var v4=k(()=>{c2();J1();v$();_0()});function o2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function x4($,Z){if(!$)return Z?.nonceGenerator?.()??o2();let Y=n2.get($);if(!Y)Y=Z?.nonceGenerator?.()??o2(),n2.set($,Y);return Y}function Ez($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function s2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Ez($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function r2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?x4(Y,Z):void 0,Q=s2(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
10313
|
+
${Q}`)}function a2($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<script nonce="${Z}"${Q}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,Q)=>{if(Q.includes("nonce="))return X;return`<style nonce="${Z}"${Q}>`}),Y}function t2($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?x4(Z,J):void 0;return s2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return x4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=x4(Z,J);return Q}var n2;var e2=k(()=>{n2=new WeakMap});import kz from"crypto";function Sz($=bz){let Z=kz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return i3=Z,Z}function yz(){if(!i3)Sz();return i3}function Pz($=$Y){let Z=yz();return`<input type="hidden" name="${$}" value="${Z}">`}function ZY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return Pz(X||$Y)})}var bz=40,$Y="_token",i3=null;var YY=()=>{};async function XY($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await Cz(Q,J,Z,Y,X);else Q=await vz(Q,J,Z,Y,X)}return Q}async function Cz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,z=$5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],B=z.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?JY(j):[],O=H.trim(),V=await G(O,F,Y,X);U.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);U.push({original:_,processed:$0("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}B=z.exec(W)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];W=W.replace(j,H)}return W}async function vz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=$5(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[_,j=""]=z,H=z.index||0;try{let L=JY(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}z=q.exec(K)}let U=$5(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=U.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:j})}B=U.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function JY($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var QY=k(()=>{J1();Z5()});function m1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function fz($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(m1(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(m1(Y.key,"appearance.key"),m1(Y.attribute,"appearance.attribute"),m1(Y.default,"appearance.default"),m1(X.key,"colorMode.key"),m1(X.attribute,"colorMode.attribute"),m1(X.default,"colorMode.default"),!KY.test(Y.key)||!KY.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!GY.test(Y.attribute)||!GY.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((Q)=>typeof Q!=="string"||Q.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!xz.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function gz($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function hz($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${gz($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function dz($,Z){let Y=1,X=null,Q=!1;for(let J=Z+1;J<$.length;J++){let G=$[J];if(Q){Q=!1;continue}if(X){if(G==="\\")Q=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return J}return-1}function qY($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index+Q[0].length-1,G=dz(Y,J);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(J+1,G).trim(),q=Z0(`(${K})`,Z),W=hz(fz(q));Y=Y.slice(0,Q.index)+W+Y.slice(G+1),X.lastIndex=Q.index+W.length}return Y}var GY,KY,xz;var WY=k(()=>{_0();GY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,KY=/^[A-Za-z_$][\w$]*$/,xz=new Set(["light","dark","system"])});import mz from"crypto";function w0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function uz(){return mz.randomUUID()}function g4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=uz();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${w0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${w0(J)}">`;return X}),Y}function BY($,Z,Y=UY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let z=J||G||"POST",U=K||q||"",B=L1(W),_=z.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${w0(j)}" action="${w0(U)}"${B?` ${B}`:""}>`;if(H+=`
|
|
10296
10314
|
${g4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
|
|
10297
|
-
${g4(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let z=J||G||"",U=K||q||"",B=L1(W),_=Z$(z,Z),j=_!==void 0&&_!==null?_:U||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=Y$(z,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=f4(O?O[1]:"",Y.input,F,Y.inputError),
|
|
10298
|
-
`),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),B=z.trim();if(B==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=sz(B)}}return Z}function sz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function rz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function az($,Z){return cz($,Z)}function tz($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function ez($,Z={}){return LY($,Z)}function LY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=$U($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=ZU(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function $U($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function ZU($,Z){let Y=YU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return XU(Q,Y.slice(2).join(","),Z);case"select":return QU(Q,Y.slice(2).join(","));case"selectordinal":return GU(Q,Y.slice(2).join(","));case"number":return qU(Q,Y[2]?.trim());case"date":return WU(Q,Y[2]?.trim());case"time":return zU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function YU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function XU($,Z,Y){let X=Number($)||0,Q=e3(Z),J=`=${X}`;if(Q[J])return o3(Q[J],X,Y);let G=JU(X);if(Q[G])return o3(Q[G],X,Y);if(Q.other)return o3(Q.other,X,Y);return String(X)}function o3($,Z,Y){let X=$.replace(/#/g,String(Z));return LY(X,Y)}function JU($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function QU($,Z){let Y=String($||""),X=e3(Z);if(X[Y])return X[Y];return X.other||String($)}function GU($,Z){let Y=Number($)||0,X=e3(Z),Q=KU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function KU($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function e3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function qU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function WU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function zU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function UU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function HY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(UU(G))return ez(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=tz(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function FY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...t3,...X.i18n},K=await az(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await OY(Q,J,async(z,U,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return F0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return HY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...Q.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,B)=>console.warn(`Match ${B}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await OY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return F0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return HY(U,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Q}async function OY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var X$,t3,r3,J$,n3;var VY=k(()=>{J1();_0();t3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},r3={},J$={},n3={}});var Y6={};r(Y6,{streamingSuspenseDirective:()=>AY,streamToResponse:()=>NU,streamTemplateSimple:()=>VU,streamTemplate:()=>jU,renderStreamingPage:()=>HU,registerStreamingDirectives:()=>
|
|
10315
|
+
${g4(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let z=J||G||"",U=K||q||"",B=L1(W),_=Z$(z,Z),j=_!==void 0&&_!==null?_:U||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=Y$(z,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=f4(O?O[1]:"",Y.input,F,Y.inputError),w=B.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${w0(L)}" name="${w0(z)}" value="${w0(j)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=L1(G),W=Z$(J,Z)||K.trim(),z=Y$(J,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=f4(U?U[1]:"",Y.input,z,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${w0(J)}" class="${B}"${_?` ${_}`:""}>${w0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=L1(G),W=Z$(J,Z),z=Y$(J,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=f4(U?U[1]:"",Y.input,z,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${w0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=L1(K),W=Z$(J,Z),z=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${w0(J)}" value="${w0(G)}" class="${B}"${z?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=L1(K),W=Z$(J,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${w0(J)}" value="${w0(G)}" class="${B}"${z?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=L1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=Y$(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=f4(B?B[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${w0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${w0(W)}"`);if(z)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=L1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${w0(J)}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),X}function jY($,Z,Y=UY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(Y$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return zY(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return zY(Q,Z)}let q=K.trim();if(J0(q)){let W=Z0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function Y$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function zY($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function Z$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function L1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var UY;var _Y=k(()=>{_0();UY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import s3 from"path";async function lz(){if(X$!==void 0)return X$;try{X$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{X$=null}return X$}function pz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function cz($,Z){if({...t3,...Z.i18n}.cache&&r3[$]){let Q=r3[$],J=Z.i18n?.cacheMaxAge??0;if(!pz(Q,J))return Q.translations}if(J$[$]?.state==="loading")return J$[$].promise;n3[$]="loading";let X=a3($,Z).then((Q)=>{return n3[$]="loaded",delete J$[$],Q}).catch((Q)=>{throw n3[$]="error",J$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return J$[$]={promise:X,state:"loading"},X}async function a3($,Z){let Y={...t3,...Z.i18n},X=s3.isAbsolute(Y.translationsDir)?Y.translationsDir:s3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await lz(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:rz(Y.format)}):await iz($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return a3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)r3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return a3(Y.defaultLocale,Z);return{}}}async function iz($,Z,Y){let X=s3.join(Y,`${$}${nz(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return oz(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function nz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function oz($){let Z={},Y=$.split(`
|
|
10316
|
+
`),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),B=z.trim();if(B==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=sz(B)}}return Z}function sz($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function rz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function az($,Z){return cz($,Z)}function tz($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function ez($,Z={}){return LY($,Z)}function LY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=$U($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=ZU(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function $U($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function ZU($,Z){let Y=YU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return XU(Q,Y.slice(2).join(","),Z);case"select":return QU(Q,Y.slice(2).join(","));case"selectordinal":return GU(Q,Y.slice(2).join(","));case"number":return qU(Q,Y[2]?.trim());case"date":return WU(Q,Y[2]?.trim());case"time":return zU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function YU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function XU($,Z,Y){let X=Number($)||0,Q=e3(Z),J=`=${X}`;if(Q[J])return o3(Q[J],X,Y);let G=JU(X);if(Q[G])return o3(Q[G],X,Y);if(Q.other)return o3(Q.other,X,Y);return String(X)}function o3($,Z,Y){let X=$.replace(/#/g,String(Z));return LY(X,Y)}function JU($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function QU($,Z){let Y=String($||""),X=e3(Z);if(X[Y])return X[Y];return X.other||String($)}function GU($,Z){let Y=Number($)||0,X=e3(Z),Q=KU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function KU($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function e3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function qU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function WU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function zU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function UU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function HY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(UU(G))return ez(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=tz(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function FY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...t3,...X.i18n},K=await az(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await OY(Q,J,async(z,U,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return F0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return HY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...Q.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,B)=>console.warn(`Match ${B}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await OY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return F0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return HY(U,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Q}async function OY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var X$,t3,r3,J$,n3;var VY=k(()=>{J1();_0();t3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},r3={},J$={},n3={}});var Y6={};r(Y6,{streamingSuspenseDirective:()=>AY,streamToResponse:()=>NU,streamTemplateSimple:()=>VU,streamTemplate:()=>jU,renderStreamingPage:()=>HU,registerStreamingDirectives:()=>RU,processStreamDirectives:()=>LU,processSectionDirectives:()=>AU,islandDirective:()=>NY,generateHydrationRuntime:()=>TU,extractStreamBoundaries:()=>FU,createStreamRenderer:()=>wU,buildSuspenseResolveScript:()=>Z6,SUSPENSE_RESOLVER_RUNTIME:()=>RY});import h4 from"path";function BU($){let Z=[],Y=0,X;wY.lastIndex=0;while((X=wY.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function jU($,Z={},Y={}){let X={...g1,...Y,streaming:{...$6,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:h4.dirname($)};if(q.trim())await S1(q,z,$);let U=BU(W),B=new Set;if(!U.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(u1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await V0(W,z,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(u1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let N=W.slice(w,R.start);if(N.trim()){let T=await V0(N,z,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let A=await V0(R.content,z,$,X,B);J.enqueue(A),await new Promise((N)=>setTimeout(N,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let A=await V0(R,z,$,X,B);J.enqueue(A)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await V0(L.content,z,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
|
|
10299
10317
|
<template data-suspense-fallback>Loading...</template>
|
|
10300
10318
|
</div>`),j.set(L.name,V0(L.content,z,$,X,B))}J.enqueue(`
|
|
10301
10319
|
<script>
|
|
@@ -10319,7 +10337,7 @@ window.__stxSuspense.resolve('${$}', \`${X}\`);
|
|
|
10319
10337
|
</script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
|
|
10320
10338
|
<script>
|
|
10321
10339
|
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${i0(X)}</div>');
|
|
10322
|
-
</script>`}}function _U($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function HU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(
|
|
10340
|
+
</script>`}}function _U($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function HU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(RY),await Promise.all(Z.map(async(J)=>{let G=_U(J.render(),X,J.id);Q.enqueue(await Z6(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function LU($,Z){return $.replace(OU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function FU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function VU($,Z={},Y={}){let X={...g1,...Y,streaming:{...$6,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:h4.dirname($)};if(q.trim())await S1(q,z,$);let U=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(u1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await V0(W,z,$,X,U);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(u1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let R=W.slice(O,V.start);if(R.trim()){let A=await V0(R,z,$,X,U);J.enqueue(A)}}let w=await V0(V.content,z,$,X,U);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await V0(V,z,$,X,U);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function wU($,Z={}){let Y={...g1,...Z,streaming:{...$6,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;u1.lastIndex=0;while((W=u1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let z=G.replace(u1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:h4.dirname($)};return await S1(J,_,$),V0(z,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${i0(B)}" not found in template "${i0($)}"</div>`;let j={..._,__filename:$,__dirname:h4.dirname($)};await S1(J,j,$);let H=new Set;return await V0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return W0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function RU($={}){let Z=[];if($.streaming?.enabled)Z.push(AY);if($.hydration?.enabled)Z.push(NY);return Z}async function AU($,Z,Y,X={}){return $}function NU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function TU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
10323
10341
|
`);if(Z==="loader")return`
|
|
10324
10342
|
(function() {
|
|
10325
10343
|
window.__stx = window.__stx || {};
|
|
@@ -10461,7 +10479,7 @@ else {
|
|
|
10461
10479
|
else {
|
|
10462
10480
|
stx.hydrate();
|
|
10463
10481
|
}
|
|
10464
|
-
})();`}var $6,u1,RY
|
|
10482
|
+
})();`}var $6,u1,wY,RY=`
|
|
10465
10483
|
<script>
|
|
10466
10484
|
(function(){
|
|
10467
10485
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -10481,14 +10499,14 @@ else {
|
|
|
10481
10499
|
}
|
|
10482
10500
|
};
|
|
10483
10501
|
})();
|
|
10484
|
-
</script>`,OU,AY,NY;var X6=k(()=>{z5();a0();e$();L0();$6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},u1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,
|
|
10502
|
+
</script>`,OU,AY,NY;var X6=k(()=>{z5();a0();e$();L0();$6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},u1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,wY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;OU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;AY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},NY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
|
|
10485
10503
|
${W}
|
|
10486
10504
|
<script type="application/json" data-island-props="${G}">
|
|
10487
10505
|
${q?`{${q}}`:"{}"}
|
|
10488
10506
|
</script>
|
|
10489
10507
|
</div>`}}});var IY={};r(IY,{warnUnbalancedTags:()=>J6,findUnbalancedTags:()=>MY});function U5($){return $.replace(/[^\n]/g," ")}function MY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,U5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,U5).replace(/<!--[\s\S]*?-->/g,U5).replace(/\{\{\{[\s\S]*?\}\}\}/g,U5).replace(/\{\{[\s\S]*?\}\}/g,U5).replace(/\{!![\s\S]*?!!\}/g,U5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(MU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let z=Y.get(q);if(z)z.count++;else{let U=Z.slice(0,J.index).split(`
|
|
10490
|
-
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(IU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function J6($,Z){let Y;try{Y=MY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(TY.has(X))return;TY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var MU,IU,TY;var Q6=k(()=>{MU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),IU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);TY=new Set});import u0 from"path";import G6 from"fs";function DY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function EY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class kY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),DY(Q),EY(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${DY(Q)}.stx`,`${EY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=u0.resolve(u0.dirname(Z),`${Q}.stx`);if(await n(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(u0.join(u0.dirname(W),"components"));if(q)K.push(q);let z=u0.join(u0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),B=[u0.resolve(U,"src/components"),u0.resolve(U,"components"),u0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=u0.join(_,j);if(await n(H))return H}try{if(!G6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=G6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=u0.join(_,L.name);for(let O of G){let V=u0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var y0;var K6=k(()=>{L0();y0=new kY});function E0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function B5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(E0(J));continue}Y.push(`${E0(J)}="${E0(Q)}"`)}return Y}var d4=()=>{};function Q$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function DU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var q6;var W6=k(()=>{d4();q6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=DU($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${Q$(X.value)}"`);else q.push(`href="${Q$(X.value)}"`);if(Q)q.push(`class="${Q$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${Q$(J)}"`),q.push(`data-stx-exact-active-class="${Q$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...B5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function k0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function U6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function bY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=EU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function B6($,Z,Y,X){return Z.map((Q)=>`${G$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function kU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${G$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function G$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function bU($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var EU,z6,j6;var _6=k(()=>{d4();EU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},z6=[320,640,768,1024,1280,1536,1920];j6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=k0($,"src")||"",Q=k0($,"alt")||"",J=k0($,"width"),G=k0($,"height"),K=k0($,"sizes"),q=k0($,"srcset"),W=k0($,"densities"),z=k0($,"format"),U=k0($,"placeholder"),B=k0($,"placeholderColor")||"#e5e7eb",_=k0($,"provider"),j=k0($,"class")||k0($,"className")||"",H=k0($,"style")||"",L=k0($,"quality"),F=U6($,"lazy",!0),O=U6($,"preload",!1),V=U6($,"picture",!1)||!!z,
|
|
10491
|
-
`}if(V){let S=[];if(z==="avif"||z==="auto"){let b=G$(X,R,
|
|
10508
|
+
`).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(IU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function J6($,Z){let Y;try{Y=MY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(TY.has(X))return;TY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var MU,IU,TY;var Q6=k(()=>{MU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),IU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);TY=new Set});import u0 from"path";import G6 from"fs";function DY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function EY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class kY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),DY(Q),EY(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${DY(Q)}.stx`,`${EY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=u0.resolve(u0.dirname(Z),`${Q}.stx`);if(await n(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(u0.join(u0.dirname(W),"components"));if(q)K.push(q);let z=u0.join(u0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),B=[u0.resolve(U,"src/components"),u0.resolve(U,"components"),u0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=u0.join(_,j);if(await n(H))return H}try{if(!G6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=G6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=u0.join(_,L.name);for(let O of G){let V=u0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var y0;var K6=k(()=>{L0();y0=new kY});function E0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function B5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(E0(J));continue}Y.push(`${E0(J)}="${E0(Q)}"`)}return Y}var d4=()=>{};function Q$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function DU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var q6;var W6=k(()=>{d4();q6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=DU($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${Q$(X.value)}"`);else q.push(`href="${Q$(X.value)}"`);if(Q)q.push(`class="${Q$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${Q$(J)}"`),q.push(`data-stx-exact-active-class="${Q$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...B5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function k0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function U6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function bY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=EU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function B6($,Z,Y,X){return Z.map((Q)=>`${G$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function kU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${G$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function G$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function bU($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var EU,z6,j6;var _6=k(()=>{d4();EU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},z6=[320,640,768,1024,1280,1536,1920];j6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=k0($,"src")||"",Q=k0($,"alt")||"",J=k0($,"width"),G=k0($,"height"),K=k0($,"sizes"),q=k0($,"srcset"),W=k0($,"densities"),z=k0($,"format"),U=k0($,"placeholder"),B=k0($,"placeholderColor")||"#e5e7eb",_=k0($,"provider"),j=k0($,"class")||k0($,"className")||"",H=k0($,"style")||"",L=k0($,"quality"),F=U6($,"lazy",!0),O=U6($,"preload",!1),V=U6($,"picture",!1)||!!z,w=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=B6(X,z6,_,z),N=bY(K);else if(!A&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));A=kU(X,S,w,_,z)}else if(K)N=bY(K);let T=[];if(H)T.push(H);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=bU(w||16,R||9,B);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${N0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=G$(X,w,R,_,z),I=[];if(I.push(`src="${N0(M)}"`),I.push(`alt="${N0(Q)}"`),J)I.push(`width="${N0(J)}"`);if(G)I.push(`height="${N0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${N0(j)}"`);if(T.length>0)I.push(`style="${N0(T.join(";"))}"`);if(A)I.push(`srcset="${N0(A)}"`);if(N)I.push(`sizes="${N0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...B5($,E));let D=`<img ${I.join(" ")} />`,P="";if(O){let b=z==="webp"?"image/webp":z==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${N0(M)}"${b?` type="${b}"`:""}${A?` imagesrcset="${N0(A)}"`:""}${N?` imagesizes="${N0(N)}"`:""} />
|
|
10509
|
+
`}if(V){let S=[];if(z==="avif"||z==="auto"){let b=G$(X,w,R,_,"avif"),C=A?B6(X,z6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${N0(C)}"${N?` sizes="${N0(N)}"`:""} />`)}if(z==="webp"||z==="auto"){let b=G$(X,w,R,_,"webp"),C=A?B6(X,z6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${N0(C)}"${N?` sizes="${N0(N)}"`:""} />`)}return`${P}<picture>
|
|
10492
10510
|
${S.join(`
|
|
10493
10511
|
`)}
|
|
10494
10512
|
${D}
|
|
@@ -10499,7 +10517,7 @@ ${D}
|
|
|
10499
10517
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
10500
10518
|
<script>
|
|
10501
10519
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
10502
|
-
</script>`}}});function PY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function yU($,Z,Y){let X=PY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var yY,
|
|
10520
|
+
</script>`}}});function PY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function yU($,Z,Y){let X=PY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var yY,w6;var R6=k(()=>{yY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},w6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=E0(PY($,"position")||"top-right"),Q=yU($,"max",5),J=yY[X]||yY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
10503
10521
|
<style>
|
|
10504
10522
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
10505
10523
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -10525,14 +10543,14 @@ ${D}
|
|
|
10525
10543
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
10526
10544
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
10527
10545
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
10528
|
-
</style>`}}});import{existsSync as PU,readFileSync as CU}from"fs";function vU($){if(xY.has($))return;xY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function xU($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(PU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return q0.resolve(Y)}catch{}return null}function fU($){if(l4.has($))return l4.get($);let Z=xU($);if(!Z)return vU($),null;try{let Y=JSON.parse(CU(Z,"utf8"));return l4.set($,Y.icons),Y.icons}catch{return null}}function H5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var l4,xY,I6;var D6=k(()=>{l4=new Map,xY=new Set;I6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=H5($,"name")??H5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=E0(H5($,"size")||"24"),K=E0(H5($,"color")||"currentColor"),q=E0(H5($,"class")||""),W=E0(H5($,"style")||""),z=l4.get(Q)??fU(Q);if(!z)return`<!-- Icon: collection "${Q}" not loaded -->`;let U=z[J];if(!U)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=U.width||24,_=U.height||24,j=`0 0 ${B} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function fY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function gY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var E6;var k6=k(()=>{E6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=gY(Z,"fallback"),Q=X.rest,J=gY(Q,"error"),G=J.rest,K=X.region??fY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??fY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function p4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var b6;var S6=k(()=>{b6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(p4($,"name")||"v").replace(/["'<>]/g,""),Q=(p4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=p4($,"class"),G=p4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function hY(){y0.registerBuiltin(q6),y0.registerBuiltin(j6),y0.registerBuiltin(H6),y0.registerBuiltin(F6),y0.registerBuiltin(
|
|
10529
|
-
`||T==="\t")F++;O=A+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let R=$.slice(B,V),w=V+L.length;X.push({fullMatch:$.slice(J,w),tagName:q,attributes:j,content:R,startIndex:J,endIndex:w,isSelfClosing:!1}),Q=w}}return X}function uY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var lY=k(()=>{_0();L0();k1()});var rY={};r(rY,{processESImports:()=>oY,processComponents:()=>n4});import i4 from"fs";import x0 from"path";function hU($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let z=J(W.slice(6));X.serverDynamic[z]=uY(q,Y);continue}if(W.startsWith(":")){let z=J(W.slice(1)),U=q===y6?z:q;try{if(!J0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);X.clientReactive[z]=U;continue}let B=Object.keys(Z),j=Q0(U,B)(...Object.values(Z));if(j===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!B.includes(O))){X.clientReactive[z]=U;continue}}X.serverDynamic[z]=j}catch{X.clientReactive[z]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let z=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(J0(U)){let _=Q0(U,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${U}`);G(W,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,U);G(W,q)}else{let U=q,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=B.exec(q))!==null)try{let j=_[1];if(!J0(j)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let L=Q0(j,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,j)}G(W,U)}continue}G(W,q===y6?"true":q)}return X}function dU($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=y6}return Z}function cY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(y0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function uU($){let Z=iY.get($);if(Z)return Z;let Y=new Map,X=[x0.join($,"src"),x0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=i4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=x0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let B=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return iY.set($,Y),Y}function lU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=x0.join(Y,"node_modules",$);try{if(i4.statSync(X).isDirectory())return X}catch{}let Q=x0.dirname(Y);if(Q===Y)return null;Y=Q}}async function oY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=x0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,j,H=[];while((j=B.exec(U))!==null){let[L,F,O,V]=j,R=null,w=null;if(V.startsWith(".")||V.startsWith("/")){let T=x0.resolve(G,V);if(T.endsWith(".stx"))w=T;else{let M=`${T}.stx`;try{if(i4.statSync(M).isFile())w=M}catch{try{if(i4.statSync(T).isDirectory())R=T}catch{}}}}else R=lU(V,G);if(!R&&!w)continue;let A=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&w)N(O,w),A=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=R?uU(R):null;for(let{source:I,local:E}of T){let D=null;if(w)D=w;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),A=!0}}if(A)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${z}>${_}</script>`}),K}async function pU($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,z]=q,U=z.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of U){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[x0.resolve(x0.dirname(Y),`${B}.stx`),x0.resolve(x0.dirname(Y),B),x0.resolve(X.componentsDir||"components",`${B}.stx`),x0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function cU($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let z=W.index,U=z+W[0].length-1,B=1,_=U+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(U+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let w={};if(O)try{w=F0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(z,H),`[Error parsing component props: ${D}]`);continue}let A="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)A=M[1].trim(),N=H+M[0].length;let I=await C1(F,w,A,G,Z,Y,X,K,Q);J=J.substring(0,z)+I+J.substring(N),q.lastIndex=0}return J}async function iU($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=z1(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,gU),J=f5(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=mY(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],w=H?c4(R.tagName):R.tagName,A=dU(R.attributes),N=hU(A,Z,X),T=y0.getBuiltin(R.tagName),M=T?await t$(w,G,Z,Y,X):!1;if(T&&!M){let P={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(N,R.content,P);if(Object.keys(N.clientReactive).length>0)S=nY(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([C,h])=>`${C}="${cY(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}if(!H&&R.tagName.includes("-")&&!await t$(w,G,Z,Y,X))continue;let I={};for(let[P,S]of Object.entries(N.static))I[P]=S;for(let[P,S]of Object.entries(N.serverDynamic))I[P]=S;let D=await C1(w,I,R.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)D=nY(D,N.clientReactive);if(Object.keys(N.events).length>0){let P=sY(D);if(P){let S=Object.entries(N.events).map(([C,h])=>`${C}="${cY(h)}"`).join(" "),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(P.insertPos)}}F=F.substring(0,R.startIndex)+D+F.substring(R.endIndex)}return F}}function nY($,Z){let Y=sY($);if(!Y)return $;let X=new Set(["if","for","show"]),Q=Object.entries(Z).map(([K,q])=>`:${c4(K)}="${q.replace(/"/g,""")}"`).join(" "),J=Object.keys(Z).filter((K)=>!X.has(K)).map((K)=>c4(K)).join(" "),G=J?` data-stx-parent-bindings="${J}"`:"";return $.substring(0,Y.insertPos)+`${G} ${Q}`+$.substring(Y.insertPos)}function sY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function n4($,Z,Y,X,Q){if(!pY)hY(),pY=!0;let J=await oY($,Z,Y,X,Q);J=await pU(J,Z,Y,X,Q),J=await cU(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=r0(J,x5,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let W=J;if(J=await iU(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=mU(J);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var pY=!1,y6="\x00stx-boolean-attribute",gU,iY;var P6=k(()=>{K6();dY();lY();k1();L0();_0();gU=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);iY=new Map});var XX={};r(XX,{processLoops:()=>C6});function sU($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=X.substring(K+1,W),U=W+1,B=z.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=z.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=F0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function o4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let j=X[W];if(U){U=!1,W++;continue}if(j==="\\"&&z){U=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function rU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);T$(J);let W=Q0(J,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return X}}),Y}function aU($,Z){let Y=$;return Y=o4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(J,Z));return G?s4:""}catch{return""}}),Y=o4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(J,Z));return G?r4:""}catch{return""}}),Y}function tU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,s4),Z=Z.replace(/@continue(?!\()/g,r4),Z}function aY($){let Z=$.includes(s4),Y=Z?$.substring(0,$.indexOf(s4)):$;return{hasBreak:Z,content:Y}}function tY($){let Z=$.includes(r4),Y=Z?$.substring(0,$.indexOf(r4)):$;return{hasContinue:Z,content:Y}}function $X($){let Z=$;return Z=o4(Z,"@break",(Y)=>{let X=Y.trim();if(!M$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=o4(Z,"@continue",(Y)=>{let X=Y.trim();if(!M$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function eU($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of X)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,B=K.length-1,_=0;while(U<=B){let j=U+B>>1;if(K[j].pos<=z)_=K[j].depth,U=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,B=1,_=U+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,w=V,A=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(R>0&&w<$.length){A.lastIndex=w,N.lastIndex=w;let S=A.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)R++,w=S.index+S[0].length;else{if(R--,R===0){T=b.index;break}w=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,E=-1,D=0,P=0;while(P<M.length){let S=M.indexOf("@",P);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))D++,P=S+1;else if(b.startsWith("@endforelse"))D--,P=S+11;else if(D===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}P=S+1}else P=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function eY($,Z){let Y=$;while(!0){let X=eU(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let z;if(J0(G))z=Q0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+U+Y.substring(J)}catch(z){let U=z instanceof Error?z.message:String(z),B=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function C6($,Z,Y,X){let Q=$;Q=eY(Q,Z);function J(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,B=z.index+z[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),R=L.substring(F+4),w=H+1,A=1,N=w,T=/@foreach\s*\(/g,M=/@endforeach/g;while(A>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let D=q.substring(w,E.index),P=E.index+11;return{start:O,end:P,arrayExpr:V,itemVar:R,content:D}}N=E.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=J(z);if(!U)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(J0(F))O=Q0(F,Object.keys(W))(...Object.values(W));else O=Z0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);z=z.substring(0,B)+E+z.substring(_);continue}let R=X?.loops?.useAltLoopVariable??oU,w=H.trim(),A=null,N,T=!1;if(w.includes("=>")){let E=w.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])A=E[0],N=E[1];else N=w}else if(!w.startsWith("[")&&!w.startsWith("{")&&w.includes(",")){let E=w.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],A=E[1],T=!0;else N=w}else N=w;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],P={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:P,$loop:P};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))x.forEach((u,t)=>{if(u)S[u]=D[t]});else S[N]=D}else S[N]=D;if(A)if(!T&&V&&Array.isArray(D)&&D.length===2)S[A]=D[0],S[N]=D[1];else S[A]=E;let b=aU(L,S),C=tY(b);if(C.hasContinue){M+=C.content;continue}let h=aY(b);if(h.hasBreak){M+=h.content;break}if(b=eY(b,S),b=G(b,S),b=d1(b,S,Y),b=tU(b),h=aY(b),h.hasBreak){M+=h.content;break}if(C=tY(b),C.hasContinue){M+=C.content;continue}b=U1(b,S,Y),b=rU(b,S),b=sU(b,S),M+=b}z=z.substring(0,B)+M+z.substring(_)}catch(F){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);z=z.substring(0,B)+O+z.substring(_)}}return z}Q=G(Q,Z),Q=YX(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??nU;return Q=YB(Q,Z,K),Q}function ZX($){return M$($)}function YX($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=S0(Q,"(",")",q);if(W===-1)break;let z=Q.slice(q+1,W),U=W+1,B=C$(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!ZX(z)){let H=$0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=$B(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let A=ZB({forExpr:z,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=$X(V);let w=Function(...F,`
|
|
10546
|
+
</style>`}}});import{existsSync as PU,readFileSync as CU}from"fs";function vU($){if(xY.has($))return;xY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function xU($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(PU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return q0.resolve(Y)}catch{}return null}function fU($){if(l4.has($))return l4.get($);let Z=xU($);if(!Z)return vU($),null;try{let Y=JSON.parse(CU(Z,"utf8"));return l4.set($,Y.icons),Y.icons}catch{return null}}function H5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var l4,xY,I6;var D6=k(()=>{l4=new Map,xY=new Set;I6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=H5($,"name")??H5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=E0(H5($,"size")||"24"),K=E0(H5($,"color")||"currentColor"),q=E0(H5($,"class")||""),W=E0(H5($,"style")||""),z=l4.get(Q)??fU(Q);if(!z)return`<!-- Icon: collection "${Q}" not loaded -->`;let U=z[J];if(!U)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=U.width||24,_=U.height||24,j=`0 0 ${B} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function fY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function gY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var E6;var k6=k(()=>{E6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=gY(Z,"fallback"),Q=X.rest,J=gY(Q,"error"),G=J.rest,K=X.region??fY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??fY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function p4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var b6;var S6=k(()=>{b6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(p4($,"name")||"v").replace(/["'<>]/g,""),Q=(p4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=p4($,"class"),G=p4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function hY(){y0.registerBuiltin(q6),y0.registerBuiltin(j6),y0.registerBuiltin(H6),y0.registerBuiltin(F6),y0.registerBuiltin(w6),y0.registerBuiltin(A6),y0.registerBuiltin(T6),y0.registerBuiltin(I6),y0.registerBuiltin(E6),y0.registerBuiltin(b6)}var dY=k(()=>{W6();_6();O6();V6();R6();N6();M6();D6();k6();S6();K6();W6();_6();O6();V6();R6();N6();M6();D6();k6();S6()});function c4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function mY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,z=null,U=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(z){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===z)z=null;W++;continue}if(H==='"'||H==="'"){z=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(U,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(A!==-1&&A<N){let T=$[A+H.length];if(T===" "||T===">"||T==="/"||T===`
|
|
10547
|
+
`||T==="\t")F++;O=A+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let w=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:j,content:w,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}function uY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var lY=k(()=>{_0();L0();k1()});var rY={};r(rY,{processESImports:()=>oY,processComponents:()=>n4});import i4 from"fs";import x0 from"path";function hU($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let z=J(W.slice(6));X.serverDynamic[z]=uY(q,Y);continue}if(W.startsWith(":")){let z=J(W.slice(1)),U=q===y6?z:q;if(z==="if"||z==="for"||z==="show"){X.clientReactive[z]=U;continue}try{if(!J0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);X.clientReactive[z]=U;continue}let B=Object.keys(Z),j=Q0(U,B)(...Object.values(Z));if(j===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!B.includes(O))){X.clientReactive[z]=U;continue}}X.serverDynamic[z]=j}catch{X.clientReactive[z]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let z=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(J0(U)){let _=Q0(U,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${U}`);G(W,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,U);G(W,q)}else{let U=q,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=B.exec(q))!==null)try{let j=_[1];if(!J0(j)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let L=Q0(j,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,j)}G(W,U)}continue}G(W,q===y6?"true":q)}return X}function dU($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=y6}return Z}function cY($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function mU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(y0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function uU($){let Z=iY.get($);if(Z)return Z;let Y=new Map,X=[x0.join($,"src"),x0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=i4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=x0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let B=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return iY.set($,Y),Y}function lU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=x0.join(Y,"node_modules",$);try{if(i4.statSync(X).isDirectory())return X}catch{}let Q=x0.dirname(Y);if(Q===Y)return null;Y=Q}}async function oY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=x0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,j,H=[];while((j=B.exec(U))!==null){let[L,F,O,V]=j,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let T=x0.resolve(G,V);if(T.endsWith(".stx"))R=T;else{let M=`${T}.stx`;try{if(i4.statSync(M).isFile())R=M}catch{try{if(i4.statSync(T).isDirectory())w=T}catch{}}}}else w=lU(V,G);if(!w&&!R)continue;let A=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&R)N(O,R),A=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=w?uU(w):null;for(let{source:I,local:E}of T){let D=null;if(R)D=R;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),A=!0}}if(A)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${z}>${_}</script>`}),K}async function pU($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,z]=q,U=z.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of U){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[x0.resolve(x0.dirname(Y),`${B}.stx`),x0.resolve(x0.dirname(Y),B),x0.resolve(X.componentsDir||"components",`${B}.stx`),x0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function cU($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let z=W.index,U=z+W[0].length-1,B=1,_=U+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(U+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let R={};if(O)try{R=F0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(z,H),`[Error parsing component props: ${D}]`);continue}let A="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)A=M[1].trim(),N=H+M[0].length;let I=await C1(F,R,A,G,Z,Y,X,K,Q);J=J.substring(0,z)+I+J.substring(N),q.lastIndex=0}return J}async function iU($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=z1(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,gU),J=f5(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=mY(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],R=H?c4(w.tagName):w.tagName,A=dU(w.attributes),N=hU(A,Z,X),T=y0.getBuiltin(w.tagName),M=T?await t$(R,G,Z,Y,X):!1;if(T&&!M){let P={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(N,w.content,P);if(Object.keys(N.clientReactive).length>0)S=nY(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([C,h])=>`${C}="${cY(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}if(!H&&w.tagName.includes("-")&&!await t$(R,G,Z,Y,X))continue;let I={};for(let[P,S]of Object.entries(N.static))I[P]=S;for(let[P,S]of Object.entries(N.serverDynamic))I[P]=S;let D=await C1(R,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)D=nY(D,N.clientReactive);if(Object.keys(N.events).length>0){let P=sY(D);if(P){let S=Object.entries(N.events).map(([C,h])=>`${C}="${cY(h)}"`).join(" "),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function nY($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),Q=Object.entries(Z).filter(([z])=>!Y.has(z)),J=Q.filter(([z])=>!X.has(z)).map(([z])=>c4(z)).join(" "),G=$,K=Q.length>0?sY(G):null;if(K){let z=Q.map(([B,_])=>`:${c4(B)}="${_.replace(/"/g,""")}"`).join(" "),U=J?` data-stx-parent-bindings="${J}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,""")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,""")}">${G}</template>`;return G}function sY($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function n4($,Z,Y,X,Q){if(!pY)hY(),pY=!0;let J=await oY($,Z,Y,X,Q);J=await pU(J,Z,Y,X,Q),J=await cU(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=r0(J,x5,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let W=J;if(J=await iU(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=mU(J);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var pY=!1,y6="\x00stx-boolean-attribute",gU,iY;var P6=k(()=>{K6();dY();lY();k1();L0();_0();gU=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);iY=new Map});var XX={};r(XX,{processLoops:()=>C6});function sU($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=X.substring(K+1,W),U=W+1,B=z.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=z.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=F0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function o4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let j=X[W];if(U){U=!1,W++;continue}if(j==="\\"&&z){U=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function rU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);T$(J);let W=Q0(J,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return X}}),Y}function aU($,Z){let Y=$;return Y=o4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(J,Z));return G?s4:""}catch{return""}}),Y=o4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(J,Z));return G?r4:""}catch{return""}}),Y}function tU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,s4),Z=Z.replace(/@continue(?!\()/g,r4),Z}function aY($){let Z=$.includes(s4),Y=Z?$.substring(0,$.indexOf(s4)):$;return{hasBreak:Z,content:Y}}function tY($){let Z=$.includes(r4),Y=Z?$.substring(0,$.indexOf(r4)):$;return{hasContinue:Z,content:Y}}function $X($){let Z=$;return Z=o4(Z,"@break",(Y)=>{let X=Y.trim();if(!M$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=o4(Z,"@continue",(Y)=>{let X=Y.trim();if(!M$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function eU($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of X)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,B=K.length-1,_=0;while(U<=B){let j=U+B>>1;if(K[j].pos<=z)_=K[j].depth,U=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,B=1,_=U+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,R=V,A=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){A.lastIndex=R,N.lastIndex=R;let S=A.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)w++,R=S.index+S[0].length;else{if(w--,w===0){T=b.index;break}R=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,E=-1,D=0,P=0;while(P<M.length){let S=M.indexOf("@",P);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))D++,P=S+1;else if(b.startsWith("@endforelse"))D--,P=S+11;else if(D===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}P=S+1}else P=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function eY($,Z){let Y=$;while(!0){let X=eU(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let z;if(J0(G))z=Q0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+U+Y.substring(J)}catch(z){let U=z instanceof Error?z.message:String(z),B=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function C6($,Z,Y,X){let Q=$;Q=eY(Q,Z);function J(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,B=z.index+z[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),R=H+1,A=1,N=R,T=/@foreach\s*\(/g,M=/@endforeach/g;while(A>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let D=q.substring(R,E.index),P=E.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:D}}N=E.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=J(z);if(!U)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(J0(F))O=Q0(F,Object.keys(W))(...Object.values(W));else O=Z0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);z=z.substring(0,B)+E+z.substring(_);continue}let w=X?.loops?.useAltLoopVariable??oU,R=H.trim(),A=null,N,T=!1;if(R.includes("=>")){let E=R.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])A=E[0],N=E[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let E=R.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],A=E[1],T=!0;else N=R}else N=R;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],P={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:P,$loop:P};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))x.forEach((u,t)=>{if(u)S[u]=D[t]});else S[N]=D}else S[N]=D;if(A)if(!T&&V&&Array.isArray(D)&&D.length===2)S[A]=D[0],S[N]=D[1];else S[A]=E;let b=aU(L,S),C=tY(b);if(C.hasContinue){M+=C.content;continue}let h=aY(b);if(h.hasBreak){M+=h.content;break}if(b=eY(b,S),b=G(b,S),b=d1(b,S,Y),b=tU(b),h=aY(b),h.hasBreak){M+=h.content;break}if(C=tY(b),C.hasContinue){M+=C.content;continue}b=U1(b,S,Y),b=rU(b,S),b=sU(b,S),M+=b}z=z.substring(0,B)+M+z.substring(_)}catch(F){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);z=z.substring(0,B)+O+z.substring(_)}}return z}Q=G(Q,Z),Q=YX(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??nU;return Q=YB(Q,Z,K),Q}function ZX($){return M$($)}function YX($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=S0(Q,"(",")",q);if(W===-1)break;let z=Q.slice(q+1,W),U=W+1,B=C$(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!ZX(z)){let H=$0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=$B(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let A=ZB({forExpr:z,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=$X(V);let R=Function(...F,`
|
|
10530
10548
|
let result = '';
|
|
10531
10549
|
for (${z}) {
|
|
10532
10550
|
result += \`${V}\`;
|
|
10533
10551
|
}
|
|
10534
10552
|
return result;
|
|
10535
|
-
`)(...O);Q=Q.substring(0,K)+
|
|
10553
|
+
`)(...O);Q=Q.substring(0,K)+R+Q.substring(j),J=!0}catch(H){let L=$0("For",`Error in @for(${z}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function $B($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let z=q.indexOf("="),U=(z>=0?q.slice(0,z):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function ZB($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
|
|
10536
10554
|
for (${Z}) {
|
|
10537
10555
|
__pushIter([${X.join(", ")}])
|
|
10538
10556
|
}
|
|
@@ -10583,32 +10601,32 @@ ${QX($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
|
|
|
10583
10601
|
} finally {
|
|
10584
10602
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
10585
10603
|
}
|
|
10586
|
-
})();`}function GB($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function qB($){if($.__onceStore instanceof Set)return $.__onceStore;return KB}async function f6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=XB($,"@partial","@include"),q=qB(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let
|
|
10587
|
-
`;continue}if(X0)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (c5(),P$));await Y0(t,I,O)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Y0)}if(!X0&&!T0){let Y0=u.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++JX}`;let
|
|
10588
|
-
`}}if(S){let x=GB(
|
|
10604
|
+
})();`}function GB($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function qB($){if($.__onceStore instanceof Set)return $.__onceStore;return KB}async function f6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=XB($,"@partial","@include"),q=qB(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=V;continue}let A=R[1],N=W(A,G,Y),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),N=x6(A,0);if(N===-1){L.lastIndex=R;continue}let T=A.substring(0,N).trim(),M=A.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=R;continue}let E=I[1],D=M.substring(I[0].length),P,S=x6(D,0);if(S!==-1)P=D.substring(S+1).trim();try{let b=`Boolean(${T})`,C;if(J0(b)){let u=Q0(b,Object.keys(Z));C=Boolean(u(...Object.values(Z)))}else C=Boolean(Z0(b,Z));let h=H?!C:C,x="";if(h){let u=W(E,G,Y);if(u&&await Bun.file(u).exists())Q.add(u);x=`@include('${E}'${P?`, ${P}`:""})`}K=K.substring(0,O)+x+K.substring(R),L.lastIndex=0}catch(b){let C=b instanceof Error?b.message:String(b),h=W0("Include",`Error evaluating ${j} condition: ${C}`,Y,$,O);K=K.substring(0,O)+h+K.substring(R),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){j.lastIndex=0,K=K.replace(R,"");continue}let[,N,T,M,I]=A;try{let E,D=T.trim();if(J0(D))E=Q0(D,Object.keys(Z))(...Object.values(Z));else E=Z0(D,Z);let P="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[M]:S},C=await U(N,b,$,L);P+=C}else if(I)P=await U(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+W0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){j.lastIndex=0,K=K.replace(R,"");continue}let N=A[1],T=w.slice(A[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,S=1;while(S<T.length&&P>0){if(T[S]==="{")P++;else if(T[S]==="}"){if(P--,P===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let P=JSON.parse(N.replace(/'/g,'"')),S={};if(M)try{S=F0(M,Z)}catch(C){let h=C instanceof Error?C.message:String(C);if(X.debug){let x=W0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,R);K=K.replace(R,()=>x)}else K=K.replace(R,()=>E||"");continue}let b=!1;for(let C of P){let h=W(C,G,Y);if(!h)continue;if(await n(h)){let x=await U(C,S,$,L);K=K.replace(R,()=>x),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(R,()=>E);else if(X.debug){let C=W0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let S=P instanceof Error?P.message:String(P),b=W0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,R);K=K.replace(R,()=>b)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let R=U0.normalize(w),A=R.startsWith(O+U0.sep)||R===O,N=R.startsWith(V+U0.sep)||R===V,T=!1,M=U0.dirname(V);if(R.startsWith(M+U0.sep)){if(!U0.relative(M,R).split(U0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!A&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let z=U0.resolve(Y);J.add(z);async function U(j,H={},L,F){let O=W(j,G,Y);if(!O)return W0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let w=[...J,V].map((R)=>U0.basename(R)).join(" -> ");return W0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(x){let u=x instanceof Error?x.message:String(x);return W0("Include",`Error loading include file ${j}: ${u}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (X6(),Y6));w=x(w,Z)}if(w&&(X.debug||!t5()&&!T4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (Q6(),IY));x(w,O)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (P6(),rY));await x(w,Z,O,X,Q)}catch(x){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let A=b$(R);if(A)R=A.content.trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[x,u]of Object.entries(H))I[x]=u;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],P="",S=null;for(let x of D){let u=x[1]||"",t=x[2]||"",X0=u.includes("server"),$1=D1(u),f0="";try{let{extractAndStripCssImports:Y0,renderVendorStyleTags:R0}=await Promise.resolve().then(() => (v5(),m9)),l0=Y0(t,{filePath:O,projectRoot:process.cwd()});t=l0.code,f0=R0(l0.styles)}catch(Y0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}if($1&&t.trim())t=E1(t);if(!X0)try{let{hasUserImports:Y0,bundleClientScript:R0}=await Promise.resolve().then(() => (S5(),b5));if(Y0(t))t=await R0(t,O,{projectRoot:process.cwd()})}catch(Y0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,Y0 instanceof Error?Y0.message:Y0)}let T0=JB(t);if(T0&&!X0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++JX}`;let Y0=c0(t),R0=QB(Y0,S);P+=`${f0}<script data-stx-scoped>${R0}</script>
|
|
10605
|
+
`;continue}if(X0)try{let{extractVariables:Y0}=await Promise.resolve().then(() => (c5(),P$));await Y0(t,I,O)}catch(Y0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Y0)}if(!X0&&!T0){let Y0=u.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++JX}`;let R0=c0(t),l0=KX(R0,S),Z1=GX(R0,l0);P+=`${f0}<script data-stx-scoped${Y0?` ${Y0}`:""}>${Z1}</script>
|
|
10606
|
+
`}}if(S){let x=GB(R,S);if(R=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await f6(R,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (v6(),XX)),C=b(R,I,O);C=d1(C,I,O);let h=a1(w);if(C=U1(C,I,O,{forceSignals:h}),M)C+=`
|
|
10589
10607
|
`+M;if(P)C+=`
|
|
10590
|
-
`+P;return C}catch(
|
|
10591
|
-
`)})}var JX=0,
|
|
10608
|
+
`+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return W0("Include",`Error processing include ${j}: ${R}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=F;continue}let R=w[1],A,N=V.substring(w[0].length),T=x6(N,0);if(T!==-1)A=N.substring(T+1).trim();let M={};if(A)try{M=F0(A,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,W0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,j)),B.lastIndex=0;continue}let I=await U(R,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function g6($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let z=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let B=U.index,_=U[1],j=B+U[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let R=q.slice(O),A=R.match(H),N=R.match(L),T=A?O+A.index:1/0,M=N?O+N.index:1/0;if(T<M)F++,O=T+(A[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function h6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
|
|
10609
|
+
`)})}var JX=0,UR,KB;var qX=k(()=>{M7();v4();a0();d5();Z5();_0();L0();UR=new m5(500),KB=new Set});import*as d6 from"path";async function WX($,Z,Y=""){if(d6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return UX($,Z,Y,"@js","@endjs")}async function zX($,Z,Y=""){if(d6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return UX($,Z,Y,"@ts","@endts")}async function UX($,Z,Y,X,Q){let J=$,G=$5(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=z.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
|
|
10592
10610
|
${j}
|
|
10593
10611
|
${F}
|
|
10594
|
-
`,
|
|
10612
|
+
`,w=Function(...B,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=W0(`${X} Directive`,`Error executing code: ${_}`,Y,$,U,W);console.error(j),J=J.replace(W,"")}return J}var BX=k(()=>{Z5();L0()});function WB($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function jX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return WB(X,J||"_method")})}async function _X($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=W0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
|
|
10595
10613
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${i0(W)}</div>
|
|
10596
|
-
`)}}}return J}async function HX($,Z,Y,X){return _X($,Z,Y,X,"before")}async function OX($,Z,Y,X){return _X($,Z,Y,X,"after")}var LX=k(()=>{a0();L0()});import{defineRoute as
|
|
10614
|
+
`)}}}return J}async function HX($,Z,Y,X){return _X($,Z,Y,X,"before")}async function OX($,Z,Y,X){return _X($,Z,Y,X,"after")}var LX=k(()=>{a0();L0()});import{defineRoute as TR,defineRoutes as MR,resetRoutes as IR,route as DR,setAppUrl as ER}from"stx-router";import{route as zB}from"stx-router";function FX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?F0(Q,{}):{};return zB(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var VX=k(()=>{_0()});async function wX($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(W$.exact[$])for(let X of W$.exact[$])await Promise.resolve(X(Z,$));if(W$.exact[Y])for(let X of W$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of W$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var W$;var RX=k(()=>{W$={patterns:[],exact:{}}});function AX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>AX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function NX($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],z=J[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=z,j=!1;while((B=U.exec(z))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=AX(R);if(A){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${A}"`);else _=_.replace(B[0],` class="${A}"`)}else _=_.replace(B[0],"");j=!0;continue}if(UB.has(H)){if(R)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(R===null||R===void 0||R===!1)_=_.replace(B[0],"");else{let A=String(R).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");_=_.replace(B[0],` ${H}="${A}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:B}=q[W];Y=Y.slice(0,z)+B+Y.slice(U)}return Y}var UB;var TX=k(()=>{UB=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function l1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let Q=/\/\s*>$/.test(X[0])||BB.has(X[1].toLowerCase()),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function _B($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function t0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=_B($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function MX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function O5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function F1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function V1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function HB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function OB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;let Q=O5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=F1(X.attrs,"v-for"),z=F1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z),j=`@foreach(${q})
|
|
10597
10615
|
`,H=`${j}${_}
|
|
10598
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function LB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;let Q=O5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=t0(Z,X),K=F1(X.attrs,"v-if"),q=V1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,z=!0;while(z){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=l1(Z,W+L);if(!F){z=!1;break}let O=O5(F.attrs,"v-else-if"),V=MX(F.attrs,"v-else");if(O!==null){let
|
|
10616
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function LB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;let Q=O5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=t0(Z,X),K=F1(X.attrs,"v-if"),q=V1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,z=!0;while(z){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=l1(Z,W+L);if(!F){z=!1;break}let O=O5(F.attrs,"v-else-if"),V=MX(F.attrs,"v-else");if(O!==null){let w=t0(Z,F),R=F1(F.attrs,"v-else-if"),A=V1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),W=w.outerEnd}else if(V){let w=t0(Z,F),R=F1(F.attrs,"v-else"),A=V1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),z=!1}else z=!1}let U=[];for(let H of J)if(H.type==="if")U.push(`@if(${H.expr})
|
|
10599
10617
|
${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
|
|
10600
10618
|
${H.element}`);else U.push(`@else
|
|
10601
10619
|
${H.element}`);U.push("@endif");let B=U.join(`
|
|
10602
|
-
`),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function FB($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function VB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let z=K[1],U=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${z}="${B}" @update:${z}="${B} = $event"`,K=Q.match(G)}if(J){let z=t0(Z,X),U=Z.slice(z.outerStart,z.outerEnd),B=V1(U,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length;continue}let q=O5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(jB.has(X.tag.toLowerCase())){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function
|
|
10620
|
+
`),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function FB($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function VB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let z=K[1],U=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${z}="${B}" @update:${z}="${B} = $event"`,K=Q.match(G)}if(J){let z=t0(Z,X),U=Z.slice(z.outerStart,z.outerEnd),B=V1(U,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length;continue}let q=O5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(jB.has(X.tag.toLowerCase())){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function wB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function RB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function AB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;let Q=O5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=t0(Z,X),G=F1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function NB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;let Q=O5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=t0(Z,X),G=F1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function TB($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function MB($){let Z=$,Y=0;while(Y<Z.length){let X=l1(Z,Y);if(!X)break;if(!MX(X.attrs,"v-once")){Y=X.end;continue}let Q=F1(X.attrs,"v-once"),J=t0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
|
|
10603
10621
|
${V1(G,{...X,start:0,end:X.end-X.start},Q)}
|
|
10604
|
-
@endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function IB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function DB($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function IX($){if(!HB($))return $;let Z=$;return Z=OB(Z),Z=LB(Z),Z=MB(Z),Z=
|
|
10622
|
+
@endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function IB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function DB($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function IX($){if(!HB($))return $;let Z=$;return Z=OB(Z),Z=LB(Z),Z=MB(Z),Z=wB(Z),Z=RB(Z),Z=VB(Z),Z=FB(Z),Z=DB(Z),Z=AB(Z),Z=NB(Z),Z=TB(Z),Z=IB(Z),Z}var BB,jB;var DX=k(()=>{BB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jB=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function a4($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}async function EX($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${a4(z.expr)}" -->`;J=J.slice(0,z.index)+O+J.slice(z.index+z.full.length);continue}let B=z.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=Z0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await C1(U,_,z.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,z.index)+F+J.slice(z.index+z.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${a4(B)} -->`;J=J.slice(0,z.index)+_+J.slice(z.index+z.full.length)}}return J=await EB(J,Z,Y,X,Q),J}async function EB($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Z0(z.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${a4(z.expr)}" -->`;J=J.slice(0,z.index)+j+J.slice(z.index+z.full.length);continue}let B=X.componentsDir||"components",_=await C1(U,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,z.index)+_+J.slice(z.index+z.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${a4(B)} -->`;J=J.slice(0,z.index)+_+J.slice(z.index+z.full.length)}}return J}var kX=k(()=>{L0();_0()});function bX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
|
|
10605
10623
|
${$.slice(Z)}`}function kB($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let z=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function bB($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:z={}}=Z,U=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((N)=>{return` <meta ${Object.entries(N).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
|
|
10606
10624
|
`),H=G.map((N)=>{return` <link ${Object.entries(N).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
|
|
10607
10625
|
`),L=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([M])=>M!=="content").map(([M,I])=>`${M}="${I}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
|
|
10608
|
-
`),F=Object.entries(z).map(([N,T])=>` ${N}="${T}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:
|
|
10626
|
+
`),F=Object.entries(z).map(([N,T])=>` ${N}="${T}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:w}=kB($),R=[j,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...w.map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),A=[V,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
10609
10627
|
<html lang="${Q}">
|
|
10610
10628
|
<head>
|
|
10611
|
-
${
|
|
10629
|
+
${R.join(`
|
|
10612
10630
|
`)}
|
|
10613
10631
|
</head>
|
|
10614
10632
|
<body${O}${F}>
|
|
@@ -10623,7 +10641,7 @@ ${j}
|
|
|
10623
10641
|
</script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,z,U,B]=q,_=z+B;if(PX(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await CX(U,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
|
|
10624
10642
|
/* Source: ${U} */
|
|
10625
10643
|
${L}
|
|
10626
|
-
</style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var xX=k(()=>{M1()});function t4($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let
|
|
10644
|
+
</style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var xX=k(()=>{M1()});function t4($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){_=V;break}}let F=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(J0(V))w=Q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+A+Y.substring(q+1),X.lastIndex=J+A.length}catch(V){o0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function e4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function fX($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),B=U.indexOf("@endmemo");if(B===-1)continue;let _=U.slice(0,B),j=z+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[N,T,M="",I]=R,E=`<${T}${M} data-stx-memo="${W}"${I}>`;A=_.slice(0,L)+E+w.slice(N.length)+_.slice(L+w.length)}else A=`${_.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${_.slice(L+w.length)}`;Q.push({start:J,end:j,replacement:A}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function u6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function gX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,z=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let B=$.slice(z+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,z)+" x-cloak>",Q=z+1}return X+=$.slice(Q),X}function hX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,z=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(J+Q[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!SB.test(U))continue;let B=$[z-1]==="/",_=B?z-1:z;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var SB;var l6=k(()=>{J1();_0();SB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function $7($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of yB){if(Q.some((z)=>K.includes(z)||G.source.includes(z)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let z=$.split(`
|
|
10627
10645
|
`),U=[];z.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))U.push(j+1)});let B=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";J.push(` \u2717 ${K}${B}
|
|
10628
10646
|
\u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
|
|
10629
10647
|
${J.join(`
|
|
@@ -11354,7 +11372,7 @@ else {
|
|
|
11354
11372
|
|
|
11355
11373
|
console.log('[stx] Error boundary runtime initialized');
|
|
11356
11374
|
})();
|
|
11357
|
-
`}var Jj=0;var ZJ={};r(ZJ,{renderSSRSuspense:()=>Fj,processSuspenseDirectives:()=>_j,generateSuspenseRuntime:()=>
|
|
11375
|
+
`}var Jj=0;var ZJ={};r(ZJ,{renderSSRSuspense:()=>Fj,processSuspenseDirectives:()=>_j,generateSuspenseRuntime:()=>wj,generateSuspenseCSS:()=>Vj,createSSRSuspense:()=>Lj});function jj(){return`suspense-${++Bj}-${Date.now().toString(36)}`}function _j($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=jj(),W=Hj(J||"");return Oj(q,G.trim(),K.trim(),W)})}function Hj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function Oj($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
|
|
11358
11376
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
|
|
11359
11377
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
11360
11378
|
${Y}
|
|
@@ -11625,7 +11643,7 @@ else {
|
|
|
11625
11643
|
background-size: 200% 100%;
|
|
11626
11644
|
}
|
|
11627
11645
|
}
|
|
11628
|
-
`}function
|
|
11646
|
+
`}function wj(){return`
|
|
11629
11647
|
// STX Suspense Runtime
|
|
11630
11648
|
(function() {
|
|
11631
11649
|
if (typeof window === 'undefined') return;
|
|
@@ -11692,7 +11710,7 @@ else {
|
|
|
11692
11710
|
|
|
11693
11711
|
console.log('[stx] Suspense runtime initialized');
|
|
11694
11712
|
})();
|
|
11695
|
-
`}var Bj=0;var QJ={};r(QJ,{processAsyncDirectives:()=>Aj,isAsyncComponent:()=>Tj,generateAsyncComponentRuntime:()=>Ij,generateAsyncComponentCSS:()=>Mj,defineAsyncComponent:()=>Nj});function YJ(){return`async-${++
|
|
11713
|
+
`}var Bj=0;var QJ={};r(QJ,{processAsyncDirectives:()=>Aj,isAsyncComponent:()=>Tj,generateAsyncComponentRuntime:()=>Ij,generateAsyncComponentCSS:()=>Mj,defineAsyncComponent:()=>Nj});function YJ(){return`async-${++Rj}-${Date.now().toString(36)}`}function Aj($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let z=YJ(),U=XJ(K);return JJ(z,U,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=YJ(),z=XJ(K);return JJ(W,z,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function XJ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function JJ($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
|
|
11696
11714
|
<div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
|
|
11697
11715
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
11698
11716
|
${Y}
|
|
@@ -12047,7 +12065,7 @@ catch (error) {
|
|
|
12047
12065
|
|
|
12048
12066
|
console.log('[stx] Async component runtime initialized');
|
|
12049
12067
|
})();
|
|
12050
|
-
`}var
|
|
12068
|
+
`}var Rj=0;var KJ={};r(KJ,{shouldCacheComponent:()=>yj,processKeepAliveDirectives:()=>Ej,onDeactivated:()=>xj,onActivated:()=>vj,generateKeepAliveRuntime:()=>Cj,generateKeepAliveCSS:()=>Pj,createKeepAliveCache:()=>Sj});function GJ(){return`keep-alive-${++Dj}-${Date.now().toString(36)}`}function Ej($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=GJ(),q=kj(J||"");return bj(K,G.trim(),q)})}function kj($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function bj($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
|
|
12051
12069
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
12052
12070
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
12053
12071
|
${Z}
|
|
@@ -12395,11 +12413,11 @@ else {
|
|
|
12395
12413
|
|
|
12396
12414
|
console.log('[stx] Keep-alive runtime initialized');
|
|
12397
12415
|
})();
|
|
12398
|
-
`}function vj($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function xj($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Dj=0;var BJ={};r(BJ,{useVirtualList:()=>WJ,processVirtualListDirectives:()=>n6,processVirtualGridDirectives:()=>UJ,processInfiniteListDirectives:()=>zJ,generateVirtualListCSS:()=>qJ,default:()=>fj,createVirtualList:()=>i6});function i6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function B(){if(G)return _();let A=Math.max(0,Math.floor(z/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,A+N+Q*2);return{startIndex:A,endIndex:T}}function _(){let A=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(A+I>z){N=Math.max(0,M-Q);break}A+=I}A=0;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(A+=I,A>z+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function j(){if(G){let A=0;for(let N=0;N<W.length;N++)A+=U.get(N)||K;return A}return W.length*Y}function H(A){if(G){let N=0;for(let T=0;T<A;T++)N+=U.get(T)||K;return N}return A*Y}function L(){let{startIndex:A,endIndex:N}=B();return{startIndex:A,endIndex:N,scrollTop:z,totalHeight:j(),visibleItems:W.slice(A,N+1),itemHeights:new Map(U)}}function F(A,N="auto"){let T=H(A);O(T,N)}function O(A,N="auto"){z=Math.max(0,Math.min(A,j()-X))}function V(){B()}function
|
|
12416
|
+
`}function vj($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function xj($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Dj=0;var BJ={};r(BJ,{useVirtualList:()=>WJ,processVirtualListDirectives:()=>n6,processVirtualGridDirectives:()=>UJ,processInfiniteListDirectives:()=>zJ,generateVirtualListCSS:()=>qJ,default:()=>fj,createVirtualList:()=>i6});function i6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function B(){if(G)return _();let A=Math.max(0,Math.floor(z/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,A+N+Q*2);return{startIndex:A,endIndex:T}}function _(){let A=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(A+I>z){N=Math.max(0,M-Q);break}A+=I}A=0;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(A+=I,A>z+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function j(){if(G){let A=0;for(let N=0;N<W.length;N++)A+=U.get(N)||K;return A}return W.length*Y}function H(A){if(G){let N=0;for(let T=0;T<A;T++)N+=U.get(T)||K;return N}return A*Y}function L(){let{startIndex:A,endIndex:N}=B();return{startIndex:A,endIndex:N,scrollTop:z,totalHeight:j(),visibleItems:W.slice(A,N+1),itemHeights:new Map(U)}}function F(A,N="auto"){let T=H(A);O(T,N)}function O(A,N="auto"){z=Math.max(0,Math.min(A,j()-X))}function V(){B()}function w(A){W=[...A],U.clear(),V()}function R(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:R}}function n6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(z.containerHeight/z.itemHeight),_=z.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
|
|
12399
12417
|
<div class="virtual-item ${z.itemClass||""}"
|
|
12400
12418
|
style="position: absolute; top: ${O*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
|
|
12401
12419
|
data-index="${O}">
|
|
12402
|
-
${
|
|
12420
|
+
${w}
|
|
12403
12421
|
</div>`}let F=W.length*z.itemHeight;return`
|
|
12404
12422
|
<div id="${U}"
|
|
12405
12423
|
class="virtual-list-container ${z.containerClass||""}"
|
|
@@ -12538,10 +12556,10 @@ else {
|
|
|
12538
12556
|
${q}
|
|
12539
12557
|
</div>
|
|
12540
12558
|
</div>
|
|
12541
|
-
`})}function UJ($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/z.columns),_=B*(z.rowHeight+(z.gap||0)),j=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let
|
|
12559
|
+
`})}function UJ($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/z.columns),_=B*(z.rowHeight+(z.gap||0)),j=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<z.columns;w++){let R=V*z.columns+w;if(R>=W.length)break;let A=W[R],N=w*(100/z.columns),T=V*(z.rowHeight+(z.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof A==="object"&&A!==null)return String(A[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));O+=`
|
|
12542
12560
|
<div class="virtual-grid-item"
|
|
12543
12561
|
style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
|
|
12544
|
-
data-index="${
|
|
12562
|
+
data-index="${R}">
|
|
12545
12563
|
${M}
|
|
12546
12564
|
</div>`}return`
|
|
12547
12565
|
<div id="${U}"
|
|
@@ -12768,7 +12786,7 @@ else {
|
|
|
12768
12786
|
stxIslands.initIslands();
|
|
12769
12787
|
}
|
|
12770
12788
|
})();
|
|
12771
|
-
</script>`}function HJ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function OJ($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var DJ={};r(DJ,{processStaticDirectives:()=>MJ,processPartialHydrationDirectives:()=>FJ,onHydrated:()=>TJ,isHydrated:()=>NJ,hydrateIsland:()=>
|
|
12789
|
+
</script>`}function HJ($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function OJ($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var DJ={};r(DJ,{processStaticDirectives:()=>MJ,processPartialHydrationDirectives:()=>FJ,onHydrated:()=>TJ,isHydrated:()=>NJ,hydrateIsland:()=>wJ,hydrateByStrategy:()=>RJ,hydrateAll:()=>AJ,generatePartialHydrationCSS:()=>VJ,generateIslandManifest:()=>IJ,default:()=>cj,createIslandRegistry:()=>LJ});function LJ(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function gj($){return`
|
|
12772
12790
|
<script data-hydrate="${$}">
|
|
12773
12791
|
(function() {
|
|
12774
12792
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -12920,8 +12938,8 @@ else {
|
|
|
12920
12938
|
});
|
|
12921
12939
|
})();
|
|
12922
12940
|
</script>
|
|
12923
|
-
`}function FJ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=
|
|
12924
|
-
`+_J();return X}function
|
|
12941
|
+
`}function FJ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=w5(X,"load",Z),X=w5(X,"idle",Z),X=w5(X,"visible",Z),X=w5(X,"media",Z),X=pj(X),X=w5(X,"hover",Z),X=w5(X,"event",Z),Q=J&&X!==$,Q)X+=`
|
|
12942
|
+
`+_J();return X}function w5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=HJ(G.trim()),z=OJ(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(W)U.push(`data-component="${W}"`);let _=Object.keys(z).length>0?`
|
|
12925
12943
|
<script type="application/json" data-island-props="${q}">${JSON.stringify(z)}</script>`:"",j="";switch(Z){case"load":j=gj(q);break;case"idle":j=hj(q,K);break;case"visible":j=dj(q,K);break;case"media":j=mj(q,K);break;case"hover":j=uj(q);break;case"event":j=lj(q,K);break}return`
|
|
12926
12944
|
<div data-island="${q}"
|
|
12927
12945
|
data-strategy="${Z}"
|
|
@@ -12992,11 +13010,11 @@ else {
|
|
|
12992
13010
|
.stx-island.hydrated {
|
|
12993
13011
|
opacity: 1;
|
|
12994
13012
|
}
|
|
12995
|
-
`}function
|
|
13013
|
+
`}function wJ($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function RJ($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function AJ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function NJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function TJ($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function MJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function IJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
|
|
12996
13014
|
<script type="application/json" id="stx-island-manifest">
|
|
12997
13015
|
${JSON.stringify(Z)}
|
|
12998
13016
|
</script>
|
|
12999
|
-
`}var cj;var EJ=k(()=>{cj={processPartialHydrationDirectives:FJ,processStaticDirectives:MJ,generatePartialHydrationCSS:VJ,generateIslandManifest:IJ,createIslandRegistry:LJ,hydrateIsland:
|
|
13017
|
+
`}var cj;var EJ=k(()=>{cj={processPartialHydrationDirectives:FJ,processStaticDirectives:MJ,generatePartialHydrationCSS:VJ,generateIslandManifest:IJ,createIslandRegistry:LJ,hydrateIsland:wJ,hydrateByStrategy:RJ,hydrateAll:AJ,isHydrated:NJ,onHydrated:TJ}});var hJ={};r(hJ,{watchMultiple:()=>PJ,watchEffect:()=>CJ,watch:()=>yJ,unref:()=>kJ,toRefs:()=>bJ,throttledComputed:()=>gJ,stxWatchMultiple:()=>PJ,stxWatchEffect:()=>CJ,stxWatch:()=>yJ,stxUnref:()=>kJ,stxToRefs:()=>bJ,stxThrottledComputed:()=>gJ,stxShallowRef:()=>SJ,stxRef:()=>R5,stxIsRef:()=>w1,stxDebouncedComputed:()=>fJ,stxComputed:()=>B$,shallowRef:()=>SJ,ref:()=>R5,processWatchDirectives:()=>xJ,processComputedDirectives:()=>vJ,isRef:()=>w1,default:()=>ij,debouncedComputed:()=>fJ,computed:()=>B$});function R5($){let Z=$,Y=new Set,X={get value(){if(e0){let Q=U$.get(X);if(!Q)Q=new Set,U$.set(X,Q);Q.add(e0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=U$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function w1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function kJ($){return w1($)?$.value:$}function bJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=R5($[Y]);return Z}function SJ($){return R5($)}function B$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=U.value;q.forEach((_)=>_(B))}};function z(){K.clear();let B=e0;e0=W,Y7.push(W);try{return Y()}finally{Y7.pop(),e0=B}}let U={get value(){if(e0){let B=U$.get(U);if(!B)B=new Set,U$.set(U,B);B.add(e0)}if(G){let B=z();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function yJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(w1($))return Q?p1($.value):$.value;return $()},U=()=>{if(!q||W)return;let j=z();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?p1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(w1($))B=$.subscribe(()=>U());else B=B$($).subscribe(()=>U());if(X)K=void 0,U();else K=z();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function PJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((U)=>w1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((B)=>w1(B)?B.value:void 0);if(Z(U,J),J=[...U],Q)z()},W=$.map((U)=>{if(w1(U))return U.subscribe(()=>q());return()=>{}});if(X)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function CJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=e0;e0=G,Y7.push(G);try{X=$()}finally{Y7.pop(),e0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function vJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function xJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
|
|
13000
13018
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
13001
13019
|
(function() {
|
|
13002
13020
|
// Watch implementation for ${J}
|
|
@@ -13008,7 +13026,7 @@ else {
|
|
|
13008
13026
|
}
|
|
13009
13027
|
})();
|
|
13010
13028
|
</script>
|
|
13011
|
-
`})}function p1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>p1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(p1(Q),p1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(p1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=p1($[Y]);return Z}function fJ($,Z=100){let Y=
|
|
13029
|
+
`})}function p1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>p1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(p1(Q),p1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(p1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=p1($[Y]);return Z}function fJ($,Z=100){let Y=R5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return B$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function gJ($,Z=100){let Y=R5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return B$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var e0=null,Y7,U$,ij;var dJ=k(()=>{Y7=[],U$=new WeakMap;ij={ref:R5,computed:B$,watch:yJ,watchMultiple:PJ,watchEffect:CJ,isRef:w1,unref:kJ,toRefs:bJ,shallowRef:SJ,debouncedComputed:fJ,throttledComputed:gJ,processComputedDirectives:vJ,processWatchDirectives:xJ}});var pJ={};r(pJ,{v:()=>nj,processHasErrorsDirective:()=>lJ,processFormValidationDirectives:()=>sj,processErrorsDirective:()=>uJ,processErrorDirective:()=>mJ,defineForm:()=>oj,Validator:()=>A5});class A5{rules=[];defaultValue="";addRule($){let Z=new A5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new A5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new A5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function oj($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function z(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function U(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let R of Y)J[R]=!0;if(await z())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:z,validateField:W,reset:U,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function mJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
|
|
13012
13030
|
`)}catch{return""}})}function uJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
|
|
13013
13031
|
`)}catch{return""}})}function lJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function sj($,Z,Y){let X=$;return X=mJ(X,Z,Y),X=uJ(X,Z,Y),X=lJ(X,Z,Y),X}var nj;var cJ=k(()=>{nj=new A5});var oJ={};r(oJ,{processXElementDirectives:()=>rj,hasXElementDirectives:()=>nJ,generateXElementRuntime:()=>iJ});function iJ(){return`<script data-stx-scoped data-stx-x-element-runtime>
|
|
13014
13032
|
(function() {
|
|
@@ -13302,16 +13320,16 @@ else {
|
|
|
13302
13320
|
`)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function X7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function tJ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function K_($){let Z=X7($,"data-stx-runtime");if(!Z)return $;let Y=tJ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=tJ(Q);if(J===-1)return X+`
|
|
13303
13321
|
`+Q;return Q.slice(0,J)+X+`
|
|
13304
13322
|
`+Q.slice(J)}async function V0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!t5()&&!T4())&&Y&&Y.endsWith(".stx"))J6($,Y);try{return await q8.timeAsync("template-processing",async()=>{let G=await q_($,Z,Y,X,Q);if(J)G=u6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??I7(),z=(Z.__stx_head_raw||"").trim(),U,B=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)U=B[1].trim(),z=z.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||U||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
|
|
13305
|
-
`),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=m6(G);if(G=yX(G,H),L)G=SX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],
|
|
13323
|
+
`),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=m6(G);if(G=yX(G,H),L)G=SX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=Q_(V);G=G.replace("<head>",`<head>
|
|
13306
13324
|
<meta name="stx-layout" content="${aJ(V)}">
|
|
13307
|
-
<meta name="stx-layout-group" content="${aJ(
|
|
13325
|
+
<meta name="stx-layout-group" content="${aJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=bX(G),G=K_(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (mX(),dX)),q=X.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=X7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
13308
13326
|
`+z+G.slice(U.end)}}catch{}if(J)try{let{getComposableScript:K}=await Promise.resolve().then(() => (pX(),lX)),q=X.composablesDir,W=await K(q);if(W){let z=`<script data-stx-composables>${W}</script>`,U=X7(G,"data-stx-stores")||X7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
13309
|
-
`+z+G.slice(U.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await
|
|
13327
|
+
`+z+G.slice(U.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await R2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof E4)throw G;let K=G instanceof Error?G.message:String(G),q=new f1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:Y,context:Z}),y3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return b3.createFallbackContent("Template Processing",q)}}async function q_($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!P0.isAbsolute(X.partialsDir)?P0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!P0.isAbsolute(X.componentsDir)?P0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!P0.isAbsolute(X.layoutsDir)?P0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await U_(Y,Z),z_(Z,K),q=await K5(()=>HX(q,Z,Y,K),q,(O)=>{o0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=r0(q,x5,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let z=W.tokens,U=(O)=>z.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>z[Number(w)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=IX(q),q=await vX(q,Y,Q);let _={};q=g6(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",R=P0.dirname(Y),A=K.layoutsDir?P0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=P0.join(R,"_layout.stx");if(await n(T)){w=T;break}let M=P0.dirname(R);if(M===R||M.length<A.length)break;R=M}if(w)H=w;else if(K.layoutsDir){let N=P0.isAbsolute(K.layoutsDir)?K.layoutsDir:P0.resolve(process.cwd(),K.layoutsDir),T=P0.join(N,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
|
|
13310
13328
|
${q.trim()}
|
|
13311
|
-
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,
|
|
13329
|
+
@endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let R=Z0(w.trim(),Z);if(R===void 0)return O;return j[V]=String(R??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",c1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=h6(q,_),H){let O=[],V=z1(q),w=r0(V.output,r1,(R,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=w.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,A,N)=>{let T=A==="SCRIPT"?V.scripts[Number(N)]:w.tokens[Number(N)];if(T)O.push(T);return""}),O.length>0){let R=O.join(`
|
|
13312
13330
|
`);j.content=j.content?`${j.content}
|
|
13313
|
-
${
|
|
13314
|
-
${q}`,U(q)}catch(O){return o0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await eJ(q,Z,Y,G,Q))}function W_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function z_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function U_($,Z){await K5(()=>
|
|
13331
|
+
${R}`:R,Z.__sections=j}}if(H)try{let O;if(P0.isAbsolute(H))O=H,Q.add(H);else O=await K5(()=>n7(H,Y,G,Q),null,()=>{throw new f1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(o0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new f1(T,Y);return q}let V=await K5(()=>Bun.file(O).text(),"",()=>{throw new f1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,P,S)=>{return T[P]=S.trim(),""});for(let[D,P]of Object.entries(T))if(j[D]&&j[D].includes(c1)){let S=j[D].indexOf(c1);j[D]=j[D].slice(0,S)+P+j[D].slice(S+c1.length)}else if(!j[D])j[D]=P;let I={...Z,__sections:j},E=`@layout('${w[1]}')${M}`;return await V0(E,I,O,G,Q)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=g6(R,_),N={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let E=j[M];if(E.includes(c1)){let D=N[M]||"",P=E.indexOf(c1);E=E.slice(0,P)+D+E.slice(P+c1.length)}return E}return I||""}),A=W_(A,j),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),A=h6(A,_),Z.__originalFilePath=Y,q=await eJ(A,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
|
|
13332
|
+
${q}`,U(q)}catch(O){return o0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await eJ(q,Z,Y,G,Q))}function W_($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function z_($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function U_($,Z){await K5(()=>wX($,Z),void 0,(Y)=>{o0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function B_($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (c5(),P$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));o0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function j_($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (a0(),J8));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return o0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function eJ($,Z,Y,X,Q){let J=$,G=X;if(await B_(J,Z,Y),J=await j_(J,Z,Y),J=await WX(J,Z,Y),J=await zX(J,Z,Y),J=await XY(J,Z,Y,G),a1(J))J=u7(J,Z),J=p7(J,Z);J=l7(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (X6(),Y6));J=K(J,Z),J=C6(J,Z,Y,G),J=await n4(J,Z,Y,G,Q),J=await EX(J,Z,Y,G,Q),J=T9(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => iX);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => oX);J=W(J,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await Promise.resolve().then(() => tX);J=z(J,Z,Y),J=U(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => $J);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => ZJ);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => QJ);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => KJ);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (jJ(),BJ));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (EJ(),DJ));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:R,processWatchDirectives:A}=await Promise.resolve().then(() => (dJ(),hJ));J=R(J,Z,Y),J=A(J,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (cJ(),pJ));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (l5(),E7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(J);if(J=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
|
|
13315
13333
|
`;if(J=M(J,Z),J=I(J,Z),J=FX(J),J=l3(J,Z),J=ZY(J),J=jX(J),J=await f6(J,Z,Y,G,Q),J=await n4(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=u6(J),J=d1(J,Z,Y),J=p3(J,Z),J=c3(J,Z),J=g4(J,Z),J=BY(J,Z),J=jY(J,Z),J=await l2(J,Z,Y,G),J=await ZZ(J,Z,Y),J=await FY(J,Z,Y,G),J=L9(J,Z,Y,G),J=K2(J,Z,Y,G),J=q2(J,Z,Y),J=W2(J,Z,Y,G),J=t2(J,Z,Y,G),J=t4(J,Z),J=e4(J),J=fX(J),!G.skipEventDirectives)J=x2(J,Z,Y);if(J=m2(J,Z,Y),G.debug){let l=/\bx-data\s*=/.test(J),s=s$($);if(l&&s)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
13316
13334
|
Both work on the same page, but they manage separate scopes.
|
|
13317
13335
|
Prefer signals (state/derived/effect) for new components.`)}J=NX(J,Z),J=await U1(J,Z,Y),J=gX(J),J=hX(J),J=D2(J);let{processXElementDirectives:P}=await Promise.resolve().then(() => oJ);J=P(J);let S=Z.__originalFilePath||Y,b=P5(Z);if(J=await c7(J,G,S,b),J=qY(J,Z),J=await OX(J,Z,Y,G),G.media?.image?.autoSiblings){let l=G.publicDir||"public",{rewriteImagesWithSiblings:s}=await Promise.resolve().then(() => (rJ(),sJ));J=await s(J,{publicDir:l})}if(G.seo?.enabled)J=z2(J,Z,G);let C=(l,s,g=!0)=>{if(!s)return l;let d=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),y=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(d&&y){if(g)l=l.replace(y[0],d[0]);if(s=s.replace(d[0],"").trim(),!s)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${s}
|
|
@@ -13325,7 +13343,7 @@ ${N2()}
|
|
|
13325
13343
|
`+m}else J=J.replace("</head>",`${s}
|
|
13326
13344
|
</head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
|
|
13327
13345
|
${s}`);else J=s+`
|
|
13328
|
-
`+J}{let{scanScriptTags:l}=await Promise.resolve().then(() => (s5(),r$)),s=[];for(let g of l(J)){if(!/\bserver\b/i.test(g.attrs))continue;let d=g.start+g.fullMatch.indexOf(">")+1,y=G_(J,d);if(y===-1)continue;let v=y+9;while(v<J.length&&/\s/.test(J[v]))v++;s.push({start:g.start,end:v})}for(let g=s.length-1;g>=0;g--){let{start:d,end:y}=s[g];J=J.substring(0,d)+J.substring(y)}}let T0=k$(J,Y);if(T0.hasScoped)J=T0.html;let Y0=Z.__stx_event_bindings||[],
|
|
13346
|
+
`+J}{let{scanScriptTags:l}=await Promise.resolve().then(() => (s5(),r$)),s=[];for(let g of l(J)){if(!/\bserver\b/i.test(g.attrs))continue;let d=g.start+g.fullMatch.indexOf(">")+1,y=G_(J,d);if(y===-1)continue;let v=y+9;while(v<J.length&&/\s/.test(J[v]))v++;s.push({start:g.start,end:v})}for(let g=s.length-1;g>=0;g--){let{start:d,end:y}=s[g];J=J.substring(0,d)+J.substring(y)}}let T0=k$(J,Y);if(T0.hasScoped)J=T0.html;let Y0=Z.__stx_event_bindings||[],R0=!1,l0=[],Z1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:R1}=await Promise.resolve().then(() => (s5(),r$));for(let l of R1(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))l0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:s,content:g}of l0){R0=!0;let d=g;$7(g,Y,X.strict);let y=await C5(g,{eventBindings:Y0,attrs:s,hasColonDirectives:Z1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(l,()=>y)}if(R0)Z.__stx_event_bindings=[];if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")J=a2(J,Z.cspNonce);return J}var c1="<!--PARENT_CONTENT_PLACEHOLDER-->";var e$=k(()=>{A2();k1();B7();T2();E2();b2();H7();j7();f2();v5();u2();p2();v4();e2();YY();QY();WY();J1();l5();a0();_Y();VY();qX();BX();v6();o7();LX();Z5();VX();P3();L0();RX();TX();DX();kX();T7();s5();P6();xX();l6();p6();_0();Q6();l6();p6()});import F_ from"fs";import o6 from"path";import zQ from"fs";import Y1 from"path";var a6=[72,96,128,144,152,192,384,512],t6=[120,152,167,180],e6=[16,32];async function $9($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=Y1.isAbsolute(X.src)?X.src:Y1.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=Y1.resolve(Z,X.outputDir||"pwa-icons");try{zQ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||a6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
|
|
13329
13347
|
Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let U=await W.default(Q).metadata();if(U.width&&U.width<512)Y.warnings.push(`Source icon is ${U.width}x${U.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=Y1.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=Y1.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of t6){let O=Y1.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=Y1.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of e6){let F=Y1.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=Y1.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let z=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${z}`),Y.success=!1}return Y}function A_($){let Z=$.sizes||a6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of t6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of e6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function Z9(){try{return await import("sharp"),!0}catch{return!1}}V$();function SQ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function yQ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function PQ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function CQ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function vQ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function xQ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:SQ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=yQ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=PQ($);if(W)q.share_target=W;let z=CQ($);if(z)q.file_handlers=z;let U=vQ($);if(U)q.protocol_handlers=U;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function j9($){let Z=xQ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function y_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function P_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import ZQ from"path";async function YQ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=ZQ.isAbsolute(Z.page)?Z.page:ZQ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (e$(),$Q)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return __($)}function __($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
|
|
13330
13348
|
<html lang="en">
|
|
13331
13349
|
<head>
|