@stacksjs/stx 0.2.48 → 0.2.50

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.
Files changed (5) hide show
  1. package/dist/cli.js +160 -160
  2. package/dist/index.js +109 -109
  3. package/dist/pwa.js +150 -150
  4. package/dist/ssg.js +106 -106
  5. package/package.json +1 -1
package/dist/pwa.js CHANGED
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- var{defineProperty:h9,getOwnPropertyNames:HZ,getOwnPropertyDescriptor:LZ}=Object,FZ=Object.prototype.hasOwnProperty;function VZ($){return this[$]}var z7=($)=>{var Y=(B7??=new WeakMap).get($),Z;if(Y)return Y;if(Y=h9({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of HZ($))if(!FZ.call(Y,X))h9(Y,X,{get:VZ.bind($,X),enumerable:!(Z=LZ($,X))||Z.enumerable})}return B7.set($,Y),Y},B7;var RZ=($)=>$;function NZ($,Y){this[$]=RZ.bind(null,Y)}var s=($,Y)=>{for(var Z in Y)h9($,Z,{get:Y[Z],enumerable:!0,configurable:!0,set:NZ.bind(Y,Z)})};var b=($,Y)=>()=>($&&(Y=$($=0)),Y);var e=import.meta.require;import H5 from"fs";import L5 from"path";function TZ($){let Y=0;for(let Z=0;Z<$.length;Z++){let X=$[Z];Y=(Y<<5)-Y+X,Y=Y&Y}return Math.abs(Y).toString(16).padStart(8,"0")}function MZ($,Y){let Z=L5.basename($);for(let X of Y)if(X.startsWith("*.")){let Q=X.slice(1);if(Z.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Z)||Q.test($))return!0}else if(Z===X||$.includes(X))return!0;return!1}function IZ($,Y,Z){let X=L5.extname($).toLowerCase(),Q=wZ[X],J=(Z.maxFileSizeKB||500)*1024;if(Y>J)return!1;if(Z.exclude&&MZ($,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let G of Z.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Z[Q]===!0)return!0;if(!Q)return!1;return!1}function V7($,Y,Z,X){let Q=H5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=L5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;V7(G,Y,Z,X)}else if(J.isFile()){let K=H5.statSync(G),q=L5.relative(Y,G);if(IZ(q,K.size,Z)){let _=H5.readFileSync(G),U=TZ(_),W=`/${q.replace(/\\/g,"/")}`;X.push({url:W,revision:U,size:K.size})}}}}function J1($,Y){let Z=Y.pwa?.precache,X=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!H5.existsSync($))return{entries:[],totalSize:0,fileCount:0};V7($,$,Z,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function F5($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:h9,getOwnPropertyNames:HZ,getOwnPropertyDescriptor:LZ}=Object,FZ=Object.prototype.hasOwnProperty;function VZ($){return this[$]}var z7=($)=>{var Y=(B7??=new WeakMap).get($),Z;if(Y)return Y;if(Y=h9({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of HZ($))if(!FZ.call(Y,X))h9(Y,X,{get:VZ.bind($,X),enumerable:!(Z=LZ($,X))||Z.enumerable})}return B7.set($,Y),Y},B7;var RZ=($)=>$;function NZ($,Y){this[$]=RZ.bind(null,Y)}var r=($,Y)=>{for(var Z in Y)h9($,Z,{get:Y[Z],enumerable:!0,configurable:!0,set:NZ.bind(Y,Z)})};var S=($,Y)=>()=>($&&(Y=$($=0)),Y);var e=import.meta.require;import H5 from"fs";import L5 from"path";function TZ($){let Y=0;for(let Z=0;Z<$.length;Z++){let X=$[Z];Y=(Y<<5)-Y+X,Y=Y&Y}return Math.abs(Y).toString(16).padStart(8,"0")}function MZ($,Y){let Z=L5.basename($);for(let X of Y)if(X.startsWith("*.")){let Q=X.slice(1);if(Z.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Z)||Q.test($))return!0}else if(Z===X||$.includes(X))return!0;return!1}function IZ($,Y,Z){let X=L5.extname($).toLowerCase(),Q=wZ[X],J=(Z.maxFileSizeKB||500)*1024;if(Y>J)return!1;if(Z.exclude&&MZ($,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let G of Z.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Z[Q]===!0)return!0;if(!Q)return!1;return!1}function V7($,Y,Z,X){let Q=H5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=L5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;V7(G,Y,Z,X)}else if(J.isFile()){let K=H5.statSync(G),q=L5.relative(Y,G);if(IZ(q,K.size,Z)){let _=H5.readFileSync(G),U=TZ(_),W=`/${q.replace(/\\/g,"/")}`;X.push({url:W,revision:U,size:K.size})}}}}function J1($,Y){let Z=Y.pwa?.precache,X=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!H5.existsSync($))return{entries:[],totalSize:0,fileCount:0};V7($,$,Z,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function F5($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Z)=>` { url: '${Z.url}', revision: '${Z.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function R7($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var wZ;var l1=b(()=>{wZ={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function EZ($){let Y={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Y[$]||Y["network-first"]}function d9($){return EZ($).className}function N7($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.routes||[],X=Y.cacheStorage,Q=[];for(let J of Z){let G=d9(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let _=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function R7($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var wZ;var l1=S(()=>{wZ={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function EZ($){let Y={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Y[$]||Y["network-first"]}function d9($){return EZ($).className}function N7($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.routes||[],X=Y.cacheStorage,Q=[];for(let J of Z){let G=d9(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let _=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${_},
7
7
  ${U?`maxAgeSeconds: ${U},`:""}
8
8
  purgeOnQuotaError: true,
@@ -20,7 +20,7 @@ registerRoute(
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return Q.join(`
23
- `)}function DZ($){if($.startsWith("*.")){let Y=$.slice(2);return`({ request }) => request.destination === '${kZ(Y)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Y=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Y}') && !url.pathname.slice(${Y.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Y,Z]=$.split("*");return`({ url }) => url.pathname.startsWith('${Y}') && url.pathname.endsWith('${Z}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${SZ($).replace(/\\\*/g,".*")}')`}function kZ($){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 bZ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function SZ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var M7={};s(M7,{isWorkboxEnabled:()=>T7,getServiceWorkerGenerator:()=>xZ,generateWorkboxServiceWorker:()=>w7,generateWorkboxConfig:()=>A7});function A7($,Y){let Z=$.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Z.serviceWorker||{},Q=Z.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let _ of Q)G.add(d9(_.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((_)=>_.maxAgeSeconds||_.maxEntries)||Z.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((_)=>_.strategy==="network-first"||_.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Y?J1(Y,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function w7($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=A7($,Y),Q=Z.serviceWorker||{},J=Z.push,G=Z.backgroundSync,K=Y?J1(Y,$):null,q=K?F5(K):"[]",_=yZ(X.modules),U=N7($);return`/**
23
+ `)}function DZ($){if($.startsWith("*.")){let Y=$.slice(2);return`({ request }) => request.destination === '${kZ(Y)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Y=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Y}') && !url.pathname.slice(${Y.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Y,Z]=$.split("*");return`({ url }) => url.pathname.startsWith('${Y}') && url.pathname.endsWith('${Z}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${SZ($).replace(/\\\*/g,".*")}')`}function kZ($){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 bZ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function SZ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var M7={};r(M7,{isWorkboxEnabled:()=>T7,getServiceWorkerGenerator:()=>xZ,generateWorkboxServiceWorker:()=>w7,generateWorkboxConfig:()=>A7});function A7($,Y){let Z=$.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Z.serviceWorker||{},Q=Z.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let _ of Q)G.add(d9(_.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((_)=>_.maxAgeSeconds||_.maxEntries)||Z.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((_)=>_.strategy==="network-first"||_.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Y?J1(Y,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function w7($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=A7($,Y),Q=Z.serviceWorker||{},J=Z.push,G=Z.backgroundSync,K=Y?J1(Y,$):null,q=K?F5(K):"[]",_=yZ(X.modules),U=N7($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -306,7 +306,7 @@ self.addEventListener('message', (event) => {
306
306
  event.waitUntil(syncQueue.pushRequest({ request }));
307
307
  }
308
308
  });
309
- `}function T7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function xZ($){if(T7($))return w7;let{generateServiceWorker:Y}=(p1(),z7(E7));return Y}var I7=b(()=>{l1()});var E7={};s(E7,{isWorkboxEnabled:()=>D7,getServiceWorkerFileName:()=>A1,generateServiceWorkerAuto:()=>hZ,generateServiceWorker:()=>V5});function V5($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=Z.serviceWorker||{},Q=Z.routes||[],J=X.cacheVersion||"1.0.0",G=Z.offline,K=G?.page?"/offline.html":"/offline.html",q=Z.push,_=Z.backgroundSync,U=Z.cacheStorage,W=Y?J1(Y,$):null,B=W?F5(W):"[]",j=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function T7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function xZ($){if(T7($))return w7;let{generateServiceWorker:Y}=(p1(),z7(E7));return Y}var I7=S(()=>{l1()});var E7={};r(E7,{isWorkboxEnabled:()=>D7,getServiceWorkerFileName:()=>A1,generateServiceWorkerAuto:()=>hZ,generateServiceWorker:()=>V5});function V5($,Y){let Z=$.pwa;if(!Z?.enabled)return"";let X=Z.serviceWorker||{},Q=Z.routes||[],J=X.cacheVersion||"1.0.0",G=Z.offline,K=G?.page?"/offline.html":"/offline.html",q=Z.push,_=Z.backgroundSync,U=Z.cacheStorage,W=Y?J1(Y,$):null,B=W?F5(W):"[]",j=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -1132,7 +1132,7 @@ self.addEventListener('message', (event) => {
1132
1132
  event.waitUntil(registerFormSync(event.data.payload));
1133
1133
  }
1134
1134
  });
1135
- `}function A1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function D7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function hZ($,Y){if(!$.pwa?.enabled)return"";if(D7($)){let{generateWorkboxServiceWorker:Z}=(I7(),z7(M7));return Z($,Y)}return V5($,Y)}var p1=b(()=>{l1()});var k7={};s(k7,{injectPwaTags:()=>u9,generateThemeColorMeta:()=>uZ,generateSwRegistrationScript:()=>dZ,generatePwaTags:()=>R5,generateManifestLink:()=>mZ});function R5($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.manifest,X=Y.icons?.outputDir?`/${Y.icons.outputDir}`:"/pwa-icons",Q=A1($),J=`
1135
+ `}function A1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function D7($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function hZ($,Y){if(!$.pwa?.enabled)return"";if(D7($)){let{generateWorkboxServiceWorker:Z}=(I7(),z7(M7));return Z($,Y)}return V5($,Y)}var p1=S(()=>{l1()});var k7={};r(k7,{injectPwaTags:()=>u9,generateThemeColorMeta:()=>uZ,generateSwRegistrationScript:()=>dZ,generatePwaTags:()=>R5,generateManifestLink:()=>mZ});function R5($){let Y=$.pwa;if(!Y?.enabled)return"";let Z=Y.manifest,X=Y.icons?.outputDir?`/${Y.icons.outputDir}`:"/pwa-icons",Q=A1($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${m9(Z?.themeColor||"#000000")}">
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function mZ(){return'<link rel="manifest" href="/manifest.json">'}function uZ($){return`<meta name="theme-color" content="${m9($)}">`}function m9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var N5=b(()=>{p1()});var O0;var S7=b(()=>{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 y7($,Y,Z,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"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||U} -->`});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 P7,C7;var l9=b(()=>{P7={name:"a11y",handler:($,Y,Z,X)=>{if(!Y.length)return $;let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[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},C7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function sZ($,Y={}){let{duration:Z,delay:X,ease:Q,direction:J,custom:G}={...u0,...Y};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);"}
1193
+ </script>`}function mZ(){return'<link rel="manifest" href="/manifest.json">'}function uZ($){return`<meta name="theme-color" content="${m9($)}">`}function m9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var N5=S(()=>{p1()});var O0;var S7=S(()=>{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 y7($,Y,Z,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"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||U} -->`});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 P7,C7;var l9=S(()=>{P7={name:"a11y",handler:($,Y,Z,X)=>{if(!Y.length)return $;let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[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},C7={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function sZ($,Y={}){let{duration:Z,delay:X,ease:Q,direction:J,custom:G}={...u0,...Y};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,9 +1425,9 @@ else {
1425
1425
  </script>
1426
1426
  `}function h7($,Y,Z,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Z.includes("test")&&Z.includes("animation");if(!aZ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=eZ();Q=Q.replace("</head>",`${K}
1427
1427
  </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=tZ(),_=Q.lastIndexOf("</body>");if(_!==-1)Q=Q.slice(0,_)+q+`
1428
- `+Q.slice(_)}}return Q}var u0,v7,x7,f7,g7;var p9=b(()=>{u0={duration:300,delay:0,ease:"ease",direction:"both"};v7={name:"transition",handler:($,Y,Z,X)=>{if(Y.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Y[0],J=Y.length>1?Number.parseInt(Y[1],10)||u0.duration:u0.duration,G=Y.length>2?Y[2]||u0.ease:u0.ease,K=Y.length>3?Number.parseInt(Y[3],10)||u0.delay:u0.delay,q=Y.length>4?Y[4]||u0.direction:u0.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=sZ(Q,{duration:J,delay:K,ease:G,direction:q}),W="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="${_}" class="${W} ${B} ${q==="out"?"stx-out":""}"
1428
+ `+Q.slice(_)}}return Q}var u0,v7,x7,f7,g7;var p9=S(()=>{u0={duration:300,delay:0,ease:"ease",direction:"both"};v7={name:"transition",handler:($,Y,Z,X)=>{if(Y.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Y[0],J=Y.length>1?Number.parseInt(Y[1],10)||u0.duration:u0.duration,G=Y.length>2?Y[2]||u0.ease:u0.ease,K=Y.length>3?Number.parseInt(Y[3],10)||u0.delay:u0.delay,q=Y.length>4?Y[4]||u0.direction:u0.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=sZ(Q,{duration:J,delay:K,ease:G,direction:q}),W="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="${_}" class="${W} ${B} ${q==="out"?"stx-out":""}"
1429
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"},x7={name:"scrollAnimate",handler:($,Y,Z,X)=>{if(Y.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Y[0],J=Y.length>1?Number.parseInt(Y[1],10)||300:300,G=Y.length>2?Y[2]||"ease":"ease",K=Y.length>3?Number.parseFloat(Y[3])||0.2:0.2,q=Y.length>4?Number.parseInt(Y[4],10)||0:0,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Q==="fade")W+=" stx-fade";else if(Q==="slide-up"||Q==="slide")W+=" stx-from-bottom";else if(Q==="slide-down")W+=" stx-from-top";else if(Q==="slide-left")W+=" stx-from-right";else if(Q==="slide-right")W+=" stx-from-left";else if(Q==="scale")W+=" stx-scale";else if(Q.includes("-"))W+=` stx-${Q}`;else W+=` stx-${Q}`;return`<div id="${_}" class="${W}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},f7={name:"animationGroup",handler:($,Y,Z,X)=>{if(Y.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Y[0],J=Y.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),G=Z.staggerDelay||50,K=Z.sequence||!0,q=$X(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},g7={name:"motion",handler:($,Y,Z,X)=>{let Q=Y.length>0?Y[0].toLowerCase()==="true":!0,J=rZ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as d7}from"stx-router";var m7=b(()=>{c9()});async function YX($,Y,Z,X){let Q=Y[0]?.replace(/['"]/g,"")||"main",J=d7();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var u7;var c9=b(()=>{m7();u7={name:"stxRouter",handler:YX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function l7($){let Y=$.heatmap;if(!Y?.enabled)return"";let Z={...ZX,...Y};return`
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},g7={name:"motion",handler:($,Y,Z,X)=>{let Q=Y.length>0?Y[0].toLowerCase()==="true":!0,J=rZ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as d7}from"stx-router";var m7=S(()=>{c9()});async function YX($,Y,Z,X){let Q=Y[0]?.replace(/['"]/g,"")||"main",J=d7();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var u7;var c9=S(()=>{m7();u7={name:"stxRouter",handler:YX,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function l7($){let Y=$.heatmap;if(!Y?.enabled)return"";let Z={...ZX,...Y};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,7 +1810,7 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function p7($,Y){let Z=l7(Y);if(!Z)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Z+$.slice(X);return $+Z}function XX($){let Y={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Z){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Y.endpoint=G;break;case"samplingRate":Y.samplingRate=Number.parseInt(G,10);break;case"batchSize":Y.batchSize=Number.parseInt(G,10);break;case"trackMouse":Y.trackMouse=G==="true";break;case"trackClicks":Y.trackClicks=G==="true";break;case"trackScroll":Y.trackScroll=G==="true";break;case"honorDnt":Y.honorDnt=G==="true";break;case"debugOverlay":Y.debugOverlay=G==="true";break}}return Y}var ZX,c7;var i9=b(()=>{ZX={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};c7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Y,Z,X)=>{let Q=Z.__stx_config||{};if(Y.length>0){let J=XX(Y.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return l7(Q)}}});function n0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function i7($){let Y=$.trim().toLowerCase();return!Y.startsWith("javascript:")&&!Y.startsWith("vbscript:")&&!Y.startsWith("data:text/html")}function n7($){let Y=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(Y);if(!Z)return{data:{},content:$.trim()};let X=Z[1],Q=$.slice(Z[0].length),J={};for(let G of X.split(`
1813
+ `}function p7($,Y){let Z=l7(Y);if(!Z)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Z+$.slice(X);return $+Z}function XX($){let Y={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Z){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Y.endpoint=G;break;case"samplingRate":Y.samplingRate=Number.parseInt(G,10);break;case"batchSize":Y.batchSize=Number.parseInt(G,10);break;case"trackMouse":Y.trackMouse=G==="true";break;case"trackClicks":Y.trackClicks=G==="true";break;case"trackScroll":Y.trackScroll=G==="true";break;case"honorDnt":Y.honorDnt=G==="true";break;case"debugOverlay":Y.debugOverlay=G==="true";break}}return Y}var ZX,c7;var i9=S(()=>{ZX={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};c7={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Y,Z,X)=>{let Q=Z.__stx_config||{};if(Y.length>0){let J=XX(Y.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return l7(Q)}}});function n0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function i7($){let Y=$.trim().toLowerCase();return!Y.startsWith("javascript:")&&!Y.startsWith("vbscript:")&&!Y.startsWith("data:text/html")}function n7($){let Y=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(Y);if(!Z)return{data:{},content:$.trim()};let X=Z[1],Q=$.slice(Z[0].length),J={};for(let G of X.split(`
1814
1814
  `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=K.slice(0,q).trim(),U=K.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}J[_]=U}return{data:J,content:Q.trim()}}function c1($,Y={}){let{gfm:Z=!0,breaks:X=!1}=Y,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,W,B)=>{let j=J.length,z=W?` class="language-${n0(W)}"`:"";return J.push(`<pre><code${z}>${n0(B.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,W)=>`<code>${n0(W)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,W,B)=>{return`<img src="${i7(B)?n0(B):""}" alt="${n0(W)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,W,B)=>{return`<a href="${i7(B)?n0(B):""}">${W}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
1815
  `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Z)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,W,B)=>{let z=`<tr>${W.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${n0(L)}</th>`).join("")}</tr>`,O=B.trim().split(`
1816
1816
  `).map((L)=>{return`<tr>${L.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<td>${n0(H)}</td>`).join("")}</tr>`}).join(`
@@ -1830,10 +1830,10 @@ ${O}
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
1831
  `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function o0($){let Y=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import JX from"process";function v0($="STX_PUBLIC_"){let Y={},Z={};for(let[X,Q]of Object.entries(JX.env)){if(!X.startsWith($)||Q===void 0)continue;Y[`import.meta.env.${X}`]=JSON.stringify(Q),Z[X]=Q}return Y["import.meta.env"]=JSON.stringify(Z),Y}var w1=()=>{};var n9={};s(n9,{hasUserImports:()=>QX,bundleClientScript:()=>KX});import F0 from"path";import l0 from"fs";function QX($){let Y=/^\s*import\s+(?!type\s)/gm;if(!$.match(Y))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!o7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(!o7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function GX($,Y,Z){let X=(Q,J)=>{let G=Q===Z?Y:F0.dirname(Q),K=F0.resolve(G,J),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let _ of q)try{if(l0.existsSync(_)&&l0.statSync(_,{throwIfNoEntry:!1})?.isFile())return _}catch{}return K};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(J)=>({path:J.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(J)=>({path:J.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(J)=>{return{path:X(J.importer,J.path)}}),Q.onResolve({filter:/^@\//},(J)=>{let G=F0.resolve($,J.path.slice(2)),K=[G,`${G}.ts`,`${G}.js`,F0.join(G,"index.ts"),F0.join(G,"index.js")];for(let q of K)if(l0.existsSync(q)&&l0.statSync(q,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",J.path,"\u2192",q),{path:q};return console.warn("[stx:bundler] could not resolve @/ import:",J.path),{path:G}})}}}async function KX($,Y,Z={}){let X=Z.projectRoot||process.cwd(),Q=Z.minify??!1,J=Z.cacheDir||F0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Y);let K=G.digest("hex").slice(0,12),q=F0.join(J,`${K}.js`),_=Bun.file(q);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let U=F0.join(X,".stx","bundle-tmp"),W=F0.join(U,`${K}.ts`),B=F0.join(U,"out",K);l0.mkdirSync(U,{recursive:!0}),l0.mkdirSync(B,{recursive:!0});let j=F0.dirname(Y),z=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,F;while((F=O.exec($))!==null){if(F[1])continue;if(F[2])F[2].split(",").forEach((V)=>{let N=V.split(":")[0].trim();if(N)z.push(N)});else if(F[3])z.push(F[3])}while((F=L.exec($))!==null){if(F[1])continue;z.push(F[2])}let H=z.length>0?`
1833
+ `}),$}import JX from"process";function v0($="STX_PUBLIC_"){let Y={},Z={};for(let[X,Q]of Object.entries(JX.env)){if(!X.startsWith($)||Q===void 0)continue;Y[`import.meta.env.${X}`]=JSON.stringify(Q),Z[X]=Q}return Y["import.meta.env"]=JSON.stringify(Z),Y}var w1=()=>{};var n9={};r(n9,{hasUserImports:()=>QX,bundleClientScript:()=>KX});import F0 from"path";import l0 from"fs";function QX($){let Y=/^\s*import\s+(?!type\s)/gm;if(!$.match(Y))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!o7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(!o7.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function GX($,Y,Z){let X=(Q,J)=>{let G=Q===Z?Y:F0.dirname(Q),K=F0.resolve(G,J),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,F0.join(K,"index.ts"),F0.join(K,"index.tsx"),F0.join(K,"index.js"),F0.join(K,"index.mjs")];for(let _ of q)try{if(l0.existsSync(_)&&l0.statSync(_,{throwIfNoEntry:!1})?.isFile())return _}catch{}return K};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(J)=>({path:J.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(J)=>({path:J.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(J)=>{return{path:X(J.importer,J.path)}}),Q.onResolve({filter:/^@\//},(J)=>{let G=F0.resolve($,J.path.slice(2)),K=[G,`${G}.ts`,`${G}.js`,F0.join(G,"index.ts"),F0.join(G,"index.js")];for(let q of K)if(l0.existsSync(q)&&l0.statSync(q,{throwIfNoEntry:!1})?.isFile())return console.log("[stx:bundler] resolved @/ import:",J.path,"\u2192",q),{path:q};return console.warn("[stx:bundler] could not resolve @/ import:",J.path),{path:G}})}}}async function KX($,Y,Z={}){let X=Z.projectRoot||process.cwd(),Q=Z.minify??!1,J=Z.cacheDir||F0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Y);let K=G.digest("hex").slice(0,12),q=F0.join(J,`${K}.js`),_=Bun.file(q);if(await _.exists())return console.log("[stx:bundler] cache hit:",K),await _.text();let U=F0.join(X,".stx","bundle-tmp"),W=F0.join(U,`${K}.ts`),B=F0.join(U,"out",K);l0.mkdirSync(U,{recursive:!0}),l0.mkdirSync(B,{recursive:!0});let j=F0.dirname(Y),z=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,L=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,F;while((F=O.exec($))!==null){if(F[1])continue;if(F[2])F[2].split(",").forEach((V)=>{let N=V.split(":")[0].trim();if(N)z.push(N)});else if(F[3])z.push(F[3])}while((F=L.exec($))!==null){if(F[1])continue;z.push(F[2])}let H=z.length>0?`
1834
1834
  export { ${z.join(", ")} }`:"";await Bun.write(W,$+H),console.log("[stx:bundler] bundling:",K,"from:",F0.basename(Y));try{let V=await Bun.build({entrypoints:[W],outdir:B,target:"browser",format:"esm",minify:Q,plugins:[GX(X,j,W)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...v0()},root:X});if(!V.success){let R=V.logs.filter((A)=>A.level==="error").map((A)=>A.message).join(", ");return console.warn("[stx:bundler] build failed:",R),$}let N="";for(let R of V.outputs){N=await R.text();break}return N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),l0.mkdirSync(J,{recursive:!0}),await Bun.write(q,N),N}catch(V){let N=V instanceof Error?V.message:String(V),R=V?.errors,A=Array.isArray(R)&&R.length>0?`
1835
1835
  ${R.map((w)=>`- ${w?.message??w}`).join(`
1836
- `)}`:"";return console.warn(`[stx:bundler] error: ${N}${A}`),$}finally{try{l0.rmSync(W,{force:!0}),l0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var o7;var o9=b(()=>{w1();o7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function WX($){let Y=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Z.exec($))!==null)if(!_X.has(X[1]))Y.add(X[1]);return Array.from(Y)}function BX($){let Y=new Set,Z=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],_=G[2];if(G[0].includes("import type"))continue;q.split(",").map((W)=>W.trim().split(/\s+as\s+/)[0]).filter((W)=>W.length>0).forEach((W)=>{if(Q.add(W),_==="stx")Y.add(W);else Z.add(W)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of qX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Y.add(q)}for(let q of UX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Z.add(q)}let K=WX(X);for(let q of K)if(!Q.has(q))Z.add(q);return{code:X,stxImports:Array.from(Y),browserImports:Array.from(Z)}}function zX($,Y){let Z=[];if($.length>0)Z.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Y.length>0)Z.push(` var { ${Y.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1836
+ `)}`:"";return console.warn(`[stx:bundler] error: ${N}${A}`),$}finally{try{l0.rmSync(W,{force:!0}),l0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var o7;var o9=S(()=>{w1();o7=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function WX($){let Y=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Z.exec($))!==null)if(!_X.has(X[1]))Y.add(X[1]);return Array.from(Y)}function BX($){let Y=new Set,Z=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],_=G[2];if(G[0].includes("import type"))continue;q.split(",").map((W)=>W.trim().split(/\s+as\s+/)[0]).filter((W)=>W.length>0).forEach((W)=>{if(Q.add(W),_==="stx")Y.add(W);else Z.add(W)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of qX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Y.add(q)}for(let q of UX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Z.add(q)}let K=WX(X);for(let q of K)if(!Q.has(q))Z.add(q);return{code:X,stxImports:Array.from(Y),browserImports:Array.from(Z)}}function zX($,Y){let Z=[];if($.length>0)Z.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Y.length>0)Z.push(` var { ${Y.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1837
1837
  ${Z.join(`
1838
1838
  `)}
1839
1839
  `;return""}function OX($){let Y=[];if($.self)Y.push("if ($event.target !== $el) return");for(let Z of $.systemKeys)Y.push(`if (!$event.${Z}Key) return`);if($.keys.length>0){let Z=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Y.push(`if (!(${Z})) return`)}if($.mouse!==null){let Z=jX[$.mouse];Y.push(`if ($event.button !== ${Z}) return`)}if($.prevent)Y.push("$event.preventDefault()");if($.stop)Y.push("$event.stopPropagation()");return Y.join("; ")}function HX($,Y){let{elementId:Z,event:X,handler:Q,modifiers:J}=$,G=OX(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(G)_+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function W(B){return`var scope = $el.closest('[data-stx-scope]');
@@ -1890,7 +1890,7 @@ ${K}${O}
1890
1890
  'use strict';
1891
1891
  ${X}${Z}
1892
1892
  ${K}
1893
- })()</script>`}var qX,UX,_X,jX,FX;var s9=b(()=>{V0();qX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],UX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],_X=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"]);jX={left:0,middle:1,right:2};FX=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 AX($){let Y="",Z=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Z){X=!0;continue}if(Z){if(Z==="`"&&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)Y+=$[Q],Q++}continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}Y+=J}return Y}function i1($){let Y=$.trim(),Z=AX(Y);for(let X of a7)if(X.test(Z))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Y}`);if(!r7.allowBracketNotation&&NX.test(Y))throw Error(`Bracket notation with strings not allowed: ${Y}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Y}function wX($){let Y={};Y.Math=Math,Y.JSON=JSON,Y.Date=Date,Y.String=String,Y.Number=Number,Y.Boolean=Boolean,Y.Array=Array,Y.parseInt=Number.parseInt,Y.parseFloat=Number.parseFloat,Y.isNaN=Number.isNaN,Y.isFinite=Number.isFinite,Y.encodeURIComponent=encodeURIComponent,Y.decodeURIComponent=decodeURIComponent;for(let[Z,X]of Object.entries($)){if(Z.startsWith("__")||a7.some((Q)=>Q.test(Z)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Y[Z]=r9(X);else Y[Z]=X}return Y}function r9($,Y=0){if(Y>=r7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>r9(X,Y+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Z={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Z[X]=r9(Q,Y+1);else Z[X]=Q}return Z}function Z0($,Y){try{let Z=i1($),X=wX(Y);return Function(...Object.keys(X),`
1893
+ })()</script>`}var qX,UX,_X,jX,FX;var s9=S(()=>{V0();qX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],UX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],_X=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"]);jX={left:0,middle:1,right:2};FX=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 AX($){let Y="",Z=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Z){X=!0;continue}if(Z){if(Z==="`"&&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)Y+=$[Q],Q++}continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}Y+=J}return Y}function i1($){let Y=$.trim(),Z=AX(Y);for(let X of a7)if(X.test(Z))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Y}`);if(!r7.allowBracketNotation&&NX.test(Y))throw Error(`Bracket notation with strings not allowed: ${Y}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Y}function wX($){let Y={};Y.Math=Math,Y.JSON=JSON,Y.Date=Date,Y.String=String,Y.Number=Number,Y.Boolean=Boolean,Y.Array=Array,Y.parseInt=Number.parseInt,Y.parseFloat=Number.parseFloat,Y.isNaN=Number.isNaN,Y.isFinite=Number.isFinite,Y.encodeURIComponent=encodeURIComponent,Y.decodeURIComponent=decodeURIComponent;for(let[Z,X]of Object.entries($)){if(Z.startsWith("__")||a7.some((Q)=>Q.test(Z)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Y[Z]=r9(X);else Y[Z]=X}return Y}function r9($,Y=0){if(Y>=r7.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>r9(X,Y+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Z={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Z[X]=r9(Q,Y+1);else Z[X]=Q}return Z}function Z0($,Y){try{let Z=i1($),X=wX(Y);return Function(...Object.keys(X),`
1894
1894
  'use strict';
1895
1895
  try {
1896
1896
  return ${Z};
@@ -1912,7 +1912,7 @@ catch (e) {
1912
1912
  }
1913
1913
  throw e;
1914
1914
  }
1915
- `);if(J.length===Y.length)return G;return(...K)=>{let q=Array(Q.length);for(let _=0;_<Q.length;_++)q[_]=K[Q[_]];return G(...q)}}function w5($){let Y=$.trim(),Z=[/\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 Z)if(X.test(Y))return!1;return!0}var RX,r7,a7,NX,TX;var N0=b(()=>{RX={maxSanitizeDepth:10,allowBracketNotation:!1},r7={...RX},a7=[/\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/],NX=/[\w)\]]\s*\[\s*['"]/;TX=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 T5($,Y){let Z=MX++,X=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return IX.set(X,{type:$,expression:Y}),X}var MX=0,IX;var t7=b(()=>{IX=new Map});var Q3={};s(Q3,{usesSignalsInScript:()=>M5,unescapeHtml:()=>a9,registerFilters:()=>DX,registerFilter:()=>Y3,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>bX,interpolateScriptExpressions:()=>X3,getAllFilters:()=>Z3,evaluateExpression:()=>b0,escapeHtml:()=>K1,defaultFilters:()=>o1,clearCustomFilters:()=>kX,applyFilters:()=>J3});function EX($){let Y=e7.get($);if(!Y){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Y=new RegExp(`:${Z}(?!\\w)`,"g"),e7.set($,Y)}return Y.lastIndex=0,Y}function Y3($,Y){if($ in o1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);n1[$]=Y}function DX($){for(let[Y,Z]of Object.entries($))Y3(Y,Z)}function Z3(){return{...o1,...n1}}function kX(){for(let $ of Object.keys(n1))delete n1[$]}function K1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function M5($){let Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Z;while((Z=Y.exec($))!==null){let X=Z[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function $3($,Y){let Z=["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 _=0;_<X.length;_++){let U=X[_];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[_+1]==="{"){G++,_++;continue}if(U==="}"&&G>0){G--;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let _=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(_)&&!(_ in Y))return!1}}return!0}function X3($,Y){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=b0(Q,Y);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=b0(Q,Y);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Z}function bX($,Y,Z={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Z.skipServer&&/\bserver\b/.test(Q))return X;let G=X3(J,Y);return`<script${Q}>${G}</script>`})}function s0($,Y,Z){let X=$,Q=[];X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let J=[];X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=M5($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let U=b0(q,Y);return U!==void 0&&U!==null?String(U):""}catch(U){let W=U instanceof Error?U.message:String(U);return X0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${W}`,Z,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let U=b0(q,Y);if(U===void 0&&Y.__stx_buildMode==="compile")return T5("raw",q.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(Y.__stx_buildMode==="compile")return T5("raw",q.trim());let W=U instanceof Error?U.message:String(U);return X0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,Z,$,_,K)}}),X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,_)=>{let U=q.trim(),W=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],B=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,z=U.match(B)?.[1],O=z&&((z in Y)||W.includes(z)),L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,F=U.match(L),H=F&&!W.includes(F[1])&&!(F[1]in Y);if(/^__[A-Z_]+__$/.test(U))return"";try{let V=b0(q,Y);if(V===void 0&&G&&!$3(U,Y))return K;if(V===void 0&&Y.__stx_buildMode==="compile"&&!G)return T5("expr",U);return V!==void 0&&V!==null?K1(String(V)):""}catch(V){if(G&&!$3(U,Y))return K;if(H)return K;let N=V instanceof Error?V.message:String(V);return X0("Expression",`Error evaluating: {{ ${U} }}: ${N}`,Z,$,_,K)}});for(let K=0;K<J.length;K++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>J[K]);for(let K=0;K<Q.length;K++)X=X.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return X}function J3($,Y,Z){if(!Y.trim())return $;let X=$,Q=Y.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=n1[G]||o1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(Z3()).join(", ")}`);let q=[];if(Q.startsWith(":")){let _=Q.match(/^:([^|\s]+)/);if(_){let U=_[1].trim();try{let W=Number(U);q=[Number.isNaN(W)?U:W]}catch{q=[U]}Q=Q.substring(_[0].length).trim()}}else if(Q.startsWith("(")){let _=1,U=1;while(_>0&&U<Q.length){if(Q[U]==="(")_++;if(Q[U]===")")_--;U++}if(_===0){let W=Q.substring(1,U-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[b0(`(${W})`,Z,!0)];else{let B=[],j="",z=null,O=0,L=0,F=0,H=!1;for(let V=0;V<W.length;V++){let N=W[V];if(H){j+=N,H=!1;continue}if(N==="\\"){j+=N,H=!0;continue}if(z){if(j+=N,N===z)z=null;continue}if(N==='"'||N==="'"||N==="`"){z=N,j+=N;continue}if(N==="(")O++;else if(N===")")O--;else if(N==="[")L++;else if(N==="]")L--;else if(N==="{")F++;else if(N==="}")F--;if(N===","&&O===0&&L===0&&F===0){B.push(j),j="";continue}j+=N}if(j)B.push(j);q=B.map((V)=>{let N=V.trim();return b0(N,Z,!0)})}}catch{q=[W]}Q=Q.substring(U).trim()}}try{X=K(X,Z,...q)}catch(_){let U=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function SX($){let Y=!1,Z="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Y&&G){G=!1;continue}if(Y&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Y)Y=!0,Z=q;else if(q===Z)Y=!1,Z="";continue}if(Y&&Z==="`"&&q==="$"&&_==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Y)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(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function b0($,Y,Z=!1){try{let X=$.trim(),Q=SX(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=b0(J,Y,!0);return J3(K,G,Y)}if(!t(X)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Y)}try{let J=Object.keys(Y),G=Object.values(Y);return $0(X,J)(...G)}catch{return Z0(X,Y)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=yX(J,Object.keys(Y));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,X);throw X}}function yX($,Y){let Z=null;for(let Q of Y){if(Q===$)continue;let J=PX($,Q);if(Z===null||J<Z.dist)Z={key:Q,dist:J}}if(!Z)return null;let X=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/X<=0.35)return Z.key;return null}function PX($,Y){if($===Y)return 0;if($.length===0)return Y.length;if(Y.length===0)return $.length;let[Z,X]=$.length<Y.length?[$,Y]:[Y,$],Q=Array(Z.length+1),J=Array(Z.length+1);for(let G=0;G<=Z.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Z.length;K++){let q=Z[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<=Z.length;K++)Q[K]=J[K]}return Q[Z.length]}function a9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var n1,e7,o1;var p0=b(()=>{N0();V0();t7();n1={},e7=new Map;o1={uppercase:($,Y)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Y)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Y)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,Y,Z=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,Y,Z="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Z)}catch{return String($)}},join:($,Y,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,Y)=>{if($===void 0||$===null)return"";return K1(String($))},translate:($,Y,Z={})=>{if(!Y||!Y.__translations)return $;let X=Y.__translations,Q=Y.__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(Z).forEach(([q,_])=>{K=K.replace(EX(q),String(_))}),K},t:($,Y,Z={})=>{return o1.translate($,Y,Z)},truncate:($,Y,Z=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Z)return Q;if(Z<=X.length)return X.substring(0,Z);return Q.substring(0,Z-X.length)+X},date:($,Y,Z="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(Z==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Z]||J.short).format(Q)}catch{return String($)}},currency:($,Y,Z="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:Z}).format(Q)}catch{return String($)}},pluralize:($,Y,Z,X)=>{let Q=Number($);if(Number.isNaN(Q))return Z;let J=X||`${Z}s`;return Q===1?Z:J},first:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,Y)=>{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:($,Y,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Y,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Y,Z=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,X);return $},replace:($,Y,Z,X="")=>{if($===void 0||$===null)return"";let Q=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Y)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Y)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Y)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,Y,Z=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Z;return Math.round(X*Q)/Q}}});class s1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Y=this.cache.get($);return this.cache.delete($),this.cache.set($,Y),Y}set($,Y){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set($,Y)}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 M1($,Y){if(Y?.includes("g"))return new RegExp($,Y);let Z=`${$}:${Y||""}`;if(!T1.has(Z)){if(T1.size>=CX){let X=T1.keys().next().value;if(X)T1.delete(X)}T1.set(Z,new RegExp($,Y))}return T1.get(Z)}class G3{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Y=Array.from(new Set($)),Z=Y.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Z);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${Z}:${q}`,U=Q.get(_);if(!U){if(Q.size>=J){let W=Q.keys().next().value;if(W)Q.delete(W)}U=Function(...Y,`
1915
+ `);if(J.length===Y.length)return G;return(...K)=>{let q=Array(Q.length);for(let _=0;_<Q.length;_++)q[_]=K[Q[_]];return G(...q)}}function w5($){let Y=$.trim(),Z=[/\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 Z)if(X.test(Y))return!1;return!0}var RX,r7,a7,NX,TX;var N0=S(()=>{RX={maxSanitizeDepth:10,allowBracketNotation:!1},r7={...RX},a7=[/\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/],NX=/[\w)\]]\s*\[\s*['"]/;TX=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 T5($,Y){let Z=MX++,X=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return IX.set(X,{type:$,expression:Y}),X}var MX=0,IX;var t7=S(()=>{IX=new Map});var Q3={};r(Q3,{usesSignalsInScript:()=>M5,unescapeHtml:()=>a9,registerFilters:()=>DX,registerFilter:()=>Y3,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>bX,interpolateScriptExpressions:()=>X3,getAllFilters:()=>Z3,evaluateExpression:()=>b0,escapeHtml:()=>K1,defaultFilters:()=>o1,clearCustomFilters:()=>kX,applyFilters:()=>J3});function EX($){let Y=e7.get($);if(!Y){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Y=new RegExp(`:${Z}(?!\\w)`,"g"),e7.set($,Y)}return Y.lastIndex=0,Y}function Y3($,Y){if($ in o1)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);n1[$]=Y}function DX($){for(let[Y,Z]of Object.entries($))Y3(Y,Z)}function Z3(){return{...o1,...n1}}function kX(){for(let $ of Object.keys(n1))delete n1[$]}function K1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function M5($){let Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Z;while((Z=Y.exec($))!==null){let X=Z[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;return!1}function $3($,Y){let Z=["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 _=0;_<X.length;_++){let U=X[_];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[_+1]==="{"){G++,_++;continue}if(U==="}"&&G>0){G--;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let _=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(_)&&!(_ in Y))return!1}}return!0}function X3($,Y){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=b0(Q,Y);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=b0(Q,Y);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Z}function bX($,Y,Z={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Z.skipServer&&/\bserver\b/.test(Q))return X;let G=X3(J,Y);return`<script${Q}>${G}</script>`})}function s0($,Y,Z){let X=$,Q=[];X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`});let J=[];X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`});let G=M5($);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,q,_)=>{try{let U=b0(q,Y);return U!==void 0&&U!==null?String(U):""}catch(U){let W=U instanceof Error?U.message:String(U);return X0("Expression",`Error evaluating: {{{ ${q.trim()}}}}: ${W}`,Z,$,_,K)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(K,q,_)=>{try{let U=b0(q,Y);if(U===void 0&&Y.__stx_buildMode==="compile")return T5("raw",q.trim());return U!==void 0&&U!==null?String(U):""}catch(U){if(Y.__stx_buildMode==="compile")return T5("raw",q.trim());let W=U instanceof Error?U.message:String(U);return X0("Expression",`Error evaluating: {!! ${q.trim()} !!}: ${W}`,Z,$,_,K)}}),X=X.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,(K)=>{if(K.startsWith("<!--__STX_SCRIPT_EXPR_"))return K;let q=J.length;return J.push(K),`<!--__STX_SCRIPT_EXPR_${q}__-->`}),X=X.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,(K)=>{if(K.startsWith("<!--__STX_STYLE_"))return K;if(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K))return K;let q=Q.length;return Q.push(K),`<!--__STX_STYLE_${q}__-->`}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(K,q,_)=>{let U=q.trim(),W=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],B=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,z=U.match(B)?.[1],O=z&&((z in Y)||W.includes(z)),L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,F=U.match(L),H=F&&!W.includes(F[1])&&!(F[1]in Y);if(/^__[A-Z_]+__$/.test(U))return"";try{let V=b0(q,Y);if(V===void 0&&G&&!$3(U,Y))return K;if(V===void 0&&Y.__stx_buildMode==="compile"&&!G)return T5("expr",U);return V!==void 0&&V!==null?K1(String(V)):""}catch(V){if(G&&!$3(U,Y))return K;if(H)return K;let N=V instanceof Error?V.message:String(V);return X0("Expression",`Error evaluating: {{ ${U} }}: ${N}`,Z,$,_,K)}});for(let K=0;K<J.length;K++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>J[K]);for(let K=0;K<Q.length;K++)X=X.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return X}function J3($,Y,Z){if(!Y.trim())return $;let X=$,Q=Y.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=n1[G]||o1[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(Z3()).join(", ")}`);let q=[];if(Q.startsWith(":")){let _=Q.match(/^:([^|\s]+)/);if(_){let U=_[1].trim();try{let W=Number(U);q=[Number.isNaN(W)?U:W]}catch{q=[U]}Q=Q.substring(_[0].length).trim()}}else if(Q.startsWith("(")){let _=1,U=1;while(_>0&&U<Q.length){if(Q[U]==="(")_++;if(Q[U]===")")_--;U++}if(_===0){let W=Q.substring(1,U-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[b0(`(${W})`,Z,!0)];else{let B=[],j="",z=null,O=0,L=0,F=0,H=!1;for(let V=0;V<W.length;V++){let N=W[V];if(H){j+=N,H=!1;continue}if(N==="\\"){j+=N,H=!0;continue}if(z){if(j+=N,N===z)z=null;continue}if(N==='"'||N==="'"||N==="`"){z=N,j+=N;continue}if(N==="(")O++;else if(N===")")O--;else if(N==="[")L++;else if(N==="]")L--;else if(N==="{")F++;else if(N==="}")F--;if(N===","&&O===0&&L===0&&F===0){B.push(j),j="";continue}j+=N}if(j)B.push(j);q=B.map((V)=>{let N=V.trim();return b0(N,Z,!0)})}}catch{q=[W]}Q=Q.substring(U).trim()}}try{X=K(X,Z,...q)}catch(_){let U=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function SX($){let Y=!1,Z="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],_=$[K+1];if(Y&&G){G=!1;continue}if(Y&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Y)Y=!0,Z=q;else if(q===Z)Y=!1,Z="";continue}if(Y&&Z==="`"&&q==="$"&&_==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Y)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(_==="|"){K++;continue}if(_==="="){K++;continue}return K}}return-1}function b0($,Y,Z=!1){try{let X=$.trim(),Q=SX(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=b0(J,Y,!0);return J3(K,G,Y)}if(!t(X)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Y)}try{let J=Object.keys(Y),G=Object.values(Y);return $0(X,J)(...G)}catch{return Z0(X,Y)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=yX(J,Object.keys(Y));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,X);throw X}}function yX($,Y){let Z=null;for(let Q of Y){if(Q===$)continue;let J=PX($,Q);if(Z===null||J<Z.dist)Z={key:Q,dist:J}}if(!Z)return null;let X=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/X<=0.35)return Z.key;return null}function PX($,Y){if($===Y)return 0;if($.length===0)return Y.length;if(Y.length===0)return $.length;let[Z,X]=$.length<Y.length?[$,Y]:[Y,$],Q=Array(Z.length+1),J=Array(Z.length+1);for(let G=0;G<=Z.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Z.length;K++){let q=Z[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<=Z.length;K++)Q[K]=J[K]}return Q[Z.length]}function a9($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var n1,e7,o1;var p0=S(()=>{N0();V0();t7();n1={},e7=new Map;o1={uppercase:($,Y)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Y)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Y)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,Y,Z=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,Y,Z="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Z)}catch{return String($)}},join:($,Y,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,Y)=>{if($===void 0||$===null)return"";return K1(String($))},translate:($,Y,Z={})=>{if(!Y||!Y.__translations)return $;let X=Y.__translations,Q=Y.__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(Z).forEach(([q,_])=>{K=K.replace(EX(q),String(_))}),K},t:($,Y,Z={})=>{return o1.translate($,Y,Z)},truncate:($,Y,Z=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Z)return Q;if(Z<=X.length)return X.substring(0,Z);return Q.substring(0,Z-X.length)+X},date:($,Y,Z="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(Z==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Z]||J.short).format(Q)}catch{return String($)}},currency:($,Y,Z="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:Z}).format(Q)}catch{return String($)}},pluralize:($,Y,Z,X)=>{let Q=Number($);if(Number.isNaN(Q))return Z;let J=X||`${Z}s`;return Q===1?Z:J},first:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,Y)=>{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:($,Y,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Y,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Y,Z=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,X);return $},replace:($,Y,Z,X="")=>{if($===void 0||$===null)return"";let Q=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Y)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Y)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Y)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,Y,Z=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Z;return Math.round(X*Q)/Q}}});class s1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Y=this.cache.get($);return this.cache.delete($),this.cache.set($,Y),Y}set($,Y){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set($,Y)}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 M1($,Y){if(Y?.includes("g"))return new RegExp($,Y);let Z=`${$}:${Y||""}`;if(!T1.has(Z)){if(T1.size>=CX){let X=T1.keys().next().value;if(X)T1.delete(X)}T1.set(Z,new RegExp($,Y))}return T1.get(Z)}class G3{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Y=Array.from(new Set($)),Z=Y.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Z);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let _=`${Z}:${q}`,U=Q.get(_);if(!U){if(Q.size>=J){let W=Q.keys().next().value;if(W)Q.delete(W)}U=Function(...Y,`
1916
1916
  'use strict';
1917
1917
  try {
1918
1918
  return ${q};
@@ -1923,23 +1923,23 @@ catch (e) {
1923
1923
  }
1924
1924
  throw e;
1925
1925
  }
1926
- `),Q.set(_,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Y.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class K3{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Y){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Y})}setBudgets($){for(let[Y,Z]of Object.entries($))this.setBudget(Y,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Y,Z]of this.budgets.entries())$[Y]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Y=this.violationHandlers.indexOf($);if(Y!==-1)this.violationHandlers.splice(Y,1)}time($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=await Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Y){let Z=this.budgets.get($);if(!Z)return;let X=Y/Z.maxTime*100,Q=Z.warnThreshold!==void 0?Y>=Z.maxTime*Z.warnThreshold&&Y<Z.maxTime:!1,J=Y>=Z.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Y,budgetTime:Z.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 ${Y.toFixed(2)}ms (${X.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Y.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Z.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($,Y){let Z=this.metrics.get($);if(Z)Z.count++,Z.totalTime+=Y,Z.maxTime=Math.max(Z.maxTime,Y),Z.minTime=Math.min(Z.minTime,Y);else this.metrics.set($,{count:1,totalTime:Y,maxTime:Y,minTime:Y})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let X=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:X?.maxTime,budgetUtilization:X?Z.totalTime/Z.count/X.maxTime*100:void 0}}let Y={};for(let[Z,X]of this.metrics.entries()){let Q=this.budgets.get(Z);Y[Z]={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 Y}getViolations($){if($)return this.violations.filter((Y)=>Y.label===$);return[...this.violations]}getViolationStats(){let $={},Y=0,Z=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Y++;else Z++;return{total:this.violations.length,byLabel:$,warnings:Y,errors:Z}}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 vX(){if(!t9)t9=new K3;return t9}var T1,CX=500,C_,t9=null,q3;var I1=b(()=>{T1=new Map;C_=new G3;q3=new Proxy({},{get($,Y){return vX()[Y]}})});function U3($,Y=""){let Z=`${$}${Y}`,X=0;for(let Q=0;Q<Z.length;Q++){let J=Z.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function _3($,Y,Z={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Z;if(!$.trim())return"";let K=e9($),q=[],_=new Map;if(J)for(let U of K){let W=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let B=W[1],j=`${Y}_${B}`;_.set(B,j)}}for(let U of K){let W=W3(U,Y,X,Q,_,G);q.push(W)}return q.join(`
1926
+ `),Q.set(_,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Y.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class K3{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Y){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Y})}setBudgets($){for(let[Y,Z]of Object.entries($))this.setBudget(Y,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Y,Z]of this.budgets.entries())$[Y]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Y=this.violationHandlers.indexOf($);if(Y!==-1)this.violationHandlers.splice(Y,1)}time($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Y){if(!this.enabled)return Y();let Z=performance.now(),X=await Y(),Q=performance.now()-Z;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Y){let Z=this.budgets.get($);if(!Z)return;let X=Y/Z.maxTime*100,Q=Z.warnThreshold!==void 0?Y>=Z.maxTime*Z.warnThreshold&&Y<Z.maxTime:!1,J=Y>=Z.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Y,budgetTime:Z.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 ${Y.toFixed(2)}ms (${X.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Y.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Z.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($,Y){let Z=this.metrics.get($);if(Z)Z.count++,Z.totalTime+=Y,Z.maxTime=Math.max(Z.maxTime,Y),Z.minTime=Math.min(Z.minTime,Y);else this.metrics.set($,{count:1,totalTime:Y,maxTime:Y,minTime:Y})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let X=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:X?.maxTime,budgetUtilization:X?Z.totalTime/Z.count/X.maxTime*100:void 0}}let Y={};for(let[Z,X]of this.metrics.entries()){let Q=this.budgets.get(Z);Y[Z]={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 Y}getViolations($){if($)return this.violations.filter((Y)=>Y.label===$);return[...this.violations]}getViolationStats(){let $={},Y=0,Z=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Y++;else Z++;return{total:this.violations.length,byLabel:$,warnings:Y,errors:Z}}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 vX(){if(!t9)t9=new K3;return t9}var T1,CX=500,C_,t9=null,q3;var I1=S(()=>{T1=new Map;C_=new G3;q3=new Proxy({},{get($,Y){return vX()[Y]}})});function U3($,Y=""){let Z=`${$}${Y}`,X=0;for(let Q=0;Q<Z.length;Q++){let J=Z.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function _3($,Y,Z={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Z;if(!$.trim())return"";let K=e9($),q=[],_=new Map;if(J)for(let U of K){let W=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let B=W[1],j=`${Y}_${B}`;_.set(B,j)}}for(let U of K){let W=W3(U,Y,X,Q,_,G);q.push(W)}return q.join(`
1927
1927
 
1928
1928
  `)}function e9($){let Y=[],Z=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Z.length;K++){let q=Z[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let _=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(_){let[,U,W,B]=_;if(U==="keyframes")Y.push({selector:`@keyframes ${W.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let j=e9(B);Y.push({selector:`@${U} ${W.trim()}`,declarations:j.map((z)=>`${z.selector} { ${z.declarations} }`).join(`
1929
1929
  `)})}else Y.push({selector:`@${U} ${W.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let _=Q.match(/([^{]+)\{([^}]*)\}/);if(_)Y.push({selector:_[1].trim(),declarations:_[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Y}function W3($,Y,Z,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let W=e9(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>W3(B,Y,Z,X,Q,J)).join(`
1930
1930
  `);return`${G} {
1931
1931
  ${W}
1932
- }`}return`${G} { ${K} }`}let q=xX(G,Y,Z,X),_=K;for(let[U,W]of Q)_=_.replace(new RegExp(`\\b${U}\\b`,"g"),W);if(J)_=_.replace(/--([a-z-]+)/gi,`--${Y}-$1`);return`${q} { ${_} }`}function xX($,Y,Z,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 q=G.replace(/:host(\([^)]*\))?/,`.${Y}$1`);J.push(q)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Y}`);continue}let K=Z?`${Z} .${Y}`:`.${Y}`;J.push(`${K} ${G}`)}return J.join(", ")}function I5($,Y){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Z=U3(Y),X=`data-v-${Z}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,_)=>{G=!0;let U=fX(_,X),W=q.replace(/\bscoped\b/gi,"").trim(),B=W?` ${W}`:"";return`<style data-stx-scoped="${Z}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=gX(Q,X),{html:Q,hasScoped:!0}}function fX($,Y){return _3($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Y}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Y}]`)}function gX($,Y){let Z=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(Z.has(Q.toLowerCase()))return X;if(X.includes(Y))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Y}${J}`);if(X.endsWith("/>"))return`<${Q} ${Y} />`;return`<${Q} ${Y}>`})}var $$=()=>{};var B3=()=>{};function M0($,Y,Z,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let _=$[J];if(G&&q){q=!1,J++;continue}if(G&&_==="\\"){q=!0,J++;continue}if(q=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,J++;continue}if(_===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&_==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&_==="}"){K--,J++;continue}if(_==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(_===Y)Q++;else if(_===Z){if(Q--,Q===0)return J}J++}return-1}var Y$={};s(Y$,{useTitle:()=>pX,useSeoMeta:()=>D5,usePageTitle:()=>pX,useHead:()=>U1,resetHead:()=>mX,renderHtmlAttrs:()=>iX,renderHead:()=>cX,renderBodyAttrs:()=>nX,processTitleDirective:()=>rX,processMetaDirective:()=>aX,processHeadDirective:()=>sX,getPageMeta:()=>dX,getHead:()=>r1,definePageMeta:()=>lX,applyHead:()=>oX});function r1(){return r0}function dX(){return E5}function mX(){r0={},hX.length=0,E5={}}function U1($){r0=uX(r0,$)}function uX($,Y){return{title:Y.title??$.title,titleTemplate:Y.titleTemplate??$.titleTemplate,base:Y.base??$.base,meta:[...$.meta||[],...Y.meta||[]],link:[...$.link||[],...Y.link||[]],script:[...$.script||[],...Y.script||[]],style:[...$.style||[],...Y.style||[]],htmlAttrs:{...$.htmlAttrs,...Y.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Y.bodyAttrs}}}function D5($){let Y=[];if($.description)Y.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Y.push({name:"keywords",content:q})}if($.author)Y.push({name:"author",content:$.author});if($.robots)Y.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Z)Y.push({property:"og:title",content:Z});if(X)Y.push({property:"og:description",content:X});if($.ogImage)Y.push({property:"og:image",content:$.ogImage});if($.ogUrl)Y.push({property:"og:url",content:$.ogUrl});if($.ogType)Y.push({property:"og:type",content:$.ogType});if($.ogSiteName)Y.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Y.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Y.push({name:"twitter:card",content:$.twitterCard});if(Q)Y.push({name:"twitter:title",content:Q});if(J)Y.push({name:"twitter:description",content:J});if(G)Y.push({name:"twitter:image",content:G});if($.twitterSite)Y.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Y.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Y.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Y.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Y.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Y.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Y.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});U1({title:$.title,titleTemplate:$.titleTemplate,meta:Y,link:K})}function lX($){if(E5={...E5,...$},$.title||$.description)D5({title:$.title,description:$.description})}function pX($){let Y=typeof $==="function"?$():$;U1({title:Y})}function cX($=r0){let Y=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);Y.push(`<title>${q1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([X,Q])=>`${X}="${q1(Q)}"`).join(" ");Y.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${q1(String(J))}"`}).join(" ");Y.push(`<meta ${X}>`)}for(let Z of $.link||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${q1(String(J))}"`).join(" ");Y.push(`<link ${X}>`)}for(let Z of $.script||[]){let{content:X,...Q}=Z,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${q1(String(K))}"`}).filter(Boolean).join(" ");if(X)Y.push(`<script ${J}>${X}</script>`);else Y.push(`<script ${J}></script>`)}for(let Z of $.style||[]){let X=Z.type?` type="${Z.type}"`:"";Y.push(`<style${X}>${Z.content}</style>`)}return Y.join(`
1932
+ }`}return`${G} { ${K} }`}let q=xX(G,Y,Z,X),_=K;for(let[U,W]of Q)_=_.replace(new RegExp(`\\b${U}\\b`,"g"),W);if(J)_=_.replace(/--([a-z-]+)/gi,`--${Y}-$1`);return`${q} { ${_} }`}function xX($,Y,Z,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 q=G.replace(/:host(\([^)]*\))?/,`.${Y}$1`);J.push(q)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Y}`);continue}let K=Z?`${Z} .${Y}`:`.${Y}`;J.push(`${K} ${G}`)}return J.join(", ")}function I5($,Y){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Z=U3(Y),X=`data-v-${Z}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,_)=>{G=!0;let U=fX(_,X),W=q.replace(/\bscoped\b/gi,"").trim(),B=W?` ${W}`:"";return`<style data-stx-scoped="${Z}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=gX(Q,X),{html:Q,hasScoped:!0}}function fX($,Y){return _3($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Y}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Y}]`)}function gX($,Y){let Z=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(Z.has(Q.toLowerCase()))return X;if(X.includes(Y))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Y}${J}`);if(X.endsWith("/>"))return`<${Q} ${Y} />`;return`<${Q} ${Y}>`})}var $$=()=>{};var B3=()=>{};function M0($,Y,Z,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let _=$[J];if(G&&q){q=!1,J++;continue}if(G&&_==="\\"){q=!0,J++;continue}if(q=!1,(_==='"'||_==="'"||_==="`")&&!G){G=_,J++;continue}if(_===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&_==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&_==="}"){K--,J++;continue}if(_==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(_===Y)Q++;else if(_===Z){if(Q--,Q===0)return J}J++}return-1}var Y$={};r(Y$,{useTitle:()=>pX,useSeoMeta:()=>D5,usePageTitle:()=>pX,useHead:()=>U1,resetHead:()=>mX,renderHtmlAttrs:()=>iX,renderHead:()=>cX,renderBodyAttrs:()=>nX,processTitleDirective:()=>rX,processMetaDirective:()=>aX,processHeadDirective:()=>sX,getPageMeta:()=>dX,getHead:()=>r1,definePageMeta:()=>lX,applyHead:()=>oX});function r1(){return r0}function dX(){return E5}function mX(){r0={},hX.length=0,E5={}}function U1($){r0=uX(r0,$)}function uX($,Y){return{title:Y.title??$.title,titleTemplate:Y.titleTemplate??$.titleTemplate,base:Y.base??$.base,meta:[...$.meta||[],...Y.meta||[]],link:[...$.link||[],...Y.link||[]],script:[...$.script||[],...Y.script||[]],style:[...$.style||[],...Y.style||[]],htmlAttrs:{...$.htmlAttrs,...Y.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Y.bodyAttrs}}}function D5($){let Y=[];if($.description)Y.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Y.push({name:"keywords",content:q})}if($.author)Y.push({name:"author",content:$.author});if($.robots)Y.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Z)Y.push({property:"og:title",content:Z});if(X)Y.push({property:"og:description",content:X});if($.ogImage)Y.push({property:"og:image",content:$.ogImage});if($.ogUrl)Y.push({property:"og:url",content:$.ogUrl});if($.ogType)Y.push({property:"og:type",content:$.ogType});if($.ogSiteName)Y.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Y.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Y.push({name:"twitter:card",content:$.twitterCard});if(Q)Y.push({name:"twitter:title",content:Q});if(J)Y.push({name:"twitter:description",content:J});if(G)Y.push({name:"twitter:image",content:G});if($.twitterSite)Y.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Y.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Y.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Y.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Y.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Y.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Y.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});U1({title:$.title,titleTemplate:$.titleTemplate,meta:Y,link:K})}function lX($){if(E5={...E5,...$},$.title||$.description)D5({title:$.title,description:$.description})}function pX($){let Y=typeof $==="function"?$():$;U1({title:Y})}function cX($=r0){let Y=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);Y.push(`<title>${q1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([X,Q])=>`${X}="${q1(Q)}"`).join(" ");Y.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${q1(String(J))}"`}).join(" ");Y.push(`<meta ${X}>`)}for(let Z of $.link||[]){let X=Object.entries(Z).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${q1(String(J))}"`).join(" ");Y.push(`<link ${X}>`)}for(let Z of $.script||[]){let{content:X,...Q}=Z,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${q1(String(K))}"`}).filter(Boolean).join(" ");if(X)Y.push(`<script ${J}>${X}</script>`);else Y.push(`<script ${J}></script>`)}for(let Z of $.style||[]){let X=Z.type?` type="${Z.type}"`:"";Y.push(`<style${X}>${Z.content}</style>`)}return Y.join(`
1933
1933
  `)}function iX($=r0){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Y,Z])=>`${Y}="${q1(Z)}"`).join(" ")}function nX($=r0){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Y,Z])=>`${Y}="${q1(Z)}"`).join(" ")}function q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function oX($=r0){if(typeof document>"u")return;if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);document.title=Y}for(let Y of $.meta||[]){let Z=Y.name?`meta[name="${Y.name}"]`:Y.property?`meta[property="${Y.property}"]`:null;if(Z){let X=document.querySelector(Z);if(!X){if(X=document.createElement("meta"),Y.name)X.setAttribute("name",Y.name);if(Y.property)X.setAttribute("property",Y.property);document.head.appendChild(X)}X.setAttribute("content",Y.content)}}for(let Y of $.link||[]){let Z=`link[rel="${Y.rel}"]${Y.href?`[href="${Y.href}"]`:""}`,X=document.querySelector(Z);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Y))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Y,Z]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Y,Z);if($.bodyAttrs)for(let[Y,Z]of Object.entries($.bodyAttrs))document.body.setAttribute(Y,Z)}function sX($){let Y="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Y+=Q.trim()+`
1934
- `,""}),headContent:Y.trim()}}function rX($,Y){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,X,Q,J)=>{let G=X?Q:Y[(J||"").trim()]??J;return U1({title:G}),""})}function aX($,Y){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,X,Q,J,G,K)=>{let q=J?G:K,_=J?q:Y[(q||"").trim()]??q,W=Q.includes(":")?{property:Q,content:_}:{name:Q,content:_};return U1({meta:[W]}),""})}var r0,hX,E5;var a1=b(()=>{r0={},hX=[],E5={}});var k5={};s(k5,{stripTypeScript:()=>H3,hasVariables:()=>A3,extractVariables:()=>L3,extractScriptFromTemplate:()=>N3,convertToCommonJS:()=>X$});import E1 from"path";function tX($){let Y=[],Z=0,X=$.split(`
1934
+ `,""}),headContent:Y.trim()}}function rX($,Y){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,X,Q,J)=>{let G=X?Q:Y[(J||"").trim()]??J;return U1({title:G}),""})}function aX($,Y){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,X,Q,J,G,K)=>{let q=J?G:K,_=J?q:Y[(q||"").trim()]??q,W=Q.includes(":")?{property:Q,content:_}:{name:Q,content:_};return U1({meta:[W]}),""})}var r0,hX,E5;var a1=S(()=>{r0={},hX=[],E5={}});var k5={};r(k5,{stripTypeScript:()=>H3,hasVariables:()=>A3,extractVariables:()=>L3,extractScriptFromTemplate:()=>N3,convertToCommonJS:()=>X$});import E1 from"path";function tX($){let Y=[],Z=0,X=$.split(`
1935
1935
  `);for(let Q of X){let J=null,G=!1;for(let K=0;K<Q.length;K++){let q=Q[K];if(G){G=!1;continue}if(q==="\\"){G=!0;continue}if(J){if(q===J)J=null;continue}if(q==="'"||q==='"'||q==="`"){J=q;continue}if(q==="/"&&K+1<Q.length&&Q[K+1]==="/")break;if(q==="{")Z++;else if(q==="}")Z--}if(Z===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Y.push(K[1]);else{let q=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[1].slice(1,-1).split(",").map((W)=>{let B=W.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((W)=>/^\w+$/.test(W));Y.push(...U)}}}}return[...new Set(Y)]}function H3($){let Y=$;Y=Y.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Y=Y.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Y=Y.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Y=Y.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Y=Y.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let _=0;_<X.length;_++){let U=X[_];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((_)=>{let U=_.trim(),W=U.startsWith("..."),B=W?U.slice(3):U,j=-1,z=0;for(let R=0;R<B.length;R++)if(B[R]==="<")z++;else if(B[R]===">")z--;else if(B[R]===":"&&z===0){j=R;break}if(j===-1)return _;let L=B.substring(0,j).trim().replace(/\?$/,""),F=B.substring(j+1),H=-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){H=R;break}let N=W?"...":"";if(H!==-1)return`${N}${L} = ${F.substring(H+1).trim()}`;return`${N}${L}`}).join(", ")}Y=Y.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Z(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,_=0,U=null;while(q<Y.length&&K>0){let j=Y[q];if(U){if(j===U)U=null;q++;continue}if(j==='"'||j==="'"||j==="`"){U=j,q++;continue}if(j==="<")_++;else if(j===">"&&_>0)_--;else if(_===0){if(j==="(")K++;else if(j===")")K--}if(K>0)q++}if(K!==0)continue;let W=Y.substring(G+1,q);if(!W.includes(":"))continue;let B=Z(W);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];Y=Y.substring(0,K)+_+Y.substring(q)}}return Y=Y.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("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).join(", ")}) =>`}),Y=Y.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"),Y=Y.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Y=Y.replace(/(\b(?:defineProps|withDefaults|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Y=Y.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Y=Y.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Y=Y.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Y=Y.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Y=Y.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Y=Y.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Y=Y.replace(/\n\s*\n\s*\n/g,`
1936
1936
 
1937
- `),Y}async function L3($,Y,Z){if(!$.trim())return;let X;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:v0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=C.transformSync(v)}catch{X=H3($)}let Q={exports:{}},J=Q.exports,G=process.cwd(),K={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of q)try{let v=E1.resolve(G,"node_modules",C),x=E1.join(v,"package.json"),p=JSON.parse(e("fs").readFileSync(x,"utf8")),G0=p.main||"index.js";if(p.exports){let f=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof f==="string")G0=f;else if(f?.bun)G0=f.bun;else if(f?.import)G0=f.import;else if(f?.default)G0=f.default}K[C]=await import(E1.resolve(v,G0))}catch{}let _=(C)=>{if(K[C])return K[C];return e(C)},U=Y.props||{},W=Object.assign((C)=>{if(!C)return U;let v={};for(let[x,p]of Object.entries(C)){let G0=U[x];if(G0!==void 0)v[x]=G0;else if(typeof p==="function")v[x]=p();else v[x]=p}return v},U),B=()=>U,j=(C,v)=>{let x={...C};for(let[p,G0]of Object.entries(v))if(x[p]===void 0)if(typeof G0==="function")x[p]=G0();else x[p]=G0;return x},z=(C)=>{let v=()=>C;return v.set=(x)=>{},v.update=(x)=>{},v},O=(C)=>{let v,x=!1;return()=>{if(!x)try{v=C(),x=!0}catch{v=void 0}return v}},L=(C)=>{},F=(C)=>C(),H=(C)=>{},V=(C)=>{},N=(C)=>{},R=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),A=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),w=(C)=>{U1(C);let v=Y.__stx_runtime_head||{},x=C||{};Y.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},T=(C)=>{D5(C);let v=r1();Y.__stx_runtime_head={...Y.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},I=(C)=>({value:C}),M=(C)=>C,E=(C)=>({value:typeof C==="function"?C():C}),D=(C,v)=>{},P=(C)=>{},y=(C)=>{},S=(C)=>C?C():Promise.resolve(),k=(C)=>(v,...x)=>{},g=(C)=>{},h=(C,v)=>{},r=(C,v)=>v,U0=()=>({value:"light"}),z0=()=>({value:!1}),_0={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:{}},y0=new Proxy(_0,{get(C,v){if(v in C)return C[v];return},set(C,v,x){return C[v]=x,!0}}),d0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},j0=console;try{let C=X$(X,Z),v=new Set(Object.keys(U)),x=Object.keys(Y).filter((a)=>!v.has(a)&&a!=="props"),p=x.map((a)=>Y[a]),G0=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"]),f=[],i=[];for(let[a,N1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(G0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;f.push(a),i.push(N1)}let Y0=tX(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
1938
- `),q0=Y.params??{},E0=[],i0=[];for(let a=0;a<x.length;a++){if(x[a]==="params")continue;E0.push(x[a]),i0.push(p[a])}let O5=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...f,...E0,`return (async () => {
1939
- ${C}
1937
+ `),Y}async function L3($,Y,Z){if(!$.trim())return;let X;try{let y=new Bun.Transpiler({loader:"ts",target:"browser",define:v0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=y.transformSync(v)}catch{X=H3($)}let Q={exports:{}},J=Q.exports,G=process.cwd(),K={},q=[...X.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 q)try{let v=E1.resolve(G,"node_modules",y),f=E1.join(v,"package.json"),p=JSON.parse(e("fs").readFileSync(f,"utf8")),G0=p.main||"index.js";if(p.exports){let g=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof g==="string")G0=g;else if(g?.bun)G0=g.bun;else if(g?.import)G0=g.import;else if(g?.default)G0=g.default}K[y]=await import(E1.resolve(v,G0))}catch{}let _=(y)=>{if(K[y])return K[y];return e(y)},U=Y.props||{},W=Object.assign((y)=>{if(!y)return U;let v={};for(let[f,p]of Object.entries(y)){let G0=U[f];if(G0!==void 0)v[f]=G0;else if(typeof p==="function")v[f]=p();else v[f]=p}return v},U),B=()=>U,j=(y,v)=>{let f={...y};for(let[p,G0]of Object.entries(v))if(f[p]===void 0)if(typeof G0==="function")f[p]=G0();else f[p]=G0;return f},z=(y)=>{let v=()=>y;return v.set=(f)=>{},v.update=(f)=>{},v},O=(y)=>{let v,f=!1;return()=>{if(!f)try{v=y(),f=!0}catch{v=void 0}return v}},L=(y)=>{},F=(y)=>y(),H=(y)=>{},V=(y)=>{},N=(y)=>{},R=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),A=()=>({push:(y)=>{},replace:(y)=>{},back:()=>{},forward:()=>{},go:(y)=>{}}),w=(y)=>{U1(y);let v=Y.__stx_runtime_head||{},f=y||{};Y.__stx_runtime_head={...v,...f.title&&{title:f.title},meta:[...v.meta||[],...f.meta||[]],link:[...v.link||[],...f.link||[]],script:[...v.script||[],...f.script||[]],htmlAttrs:{...v.htmlAttrs||{},...f.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...f.bodyAttrs||{}}}},T=(y)=>{D5(y);let v=r1();Y.__stx_runtime_head={...Y.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},D=(y)=>({value:y}),I=(y)=>y,M=(y)=>({value:typeof y==="function"?y():y}),E=(y,v)=>{},C=(y)=>{},P=(y)=>{},k=(y)=>y?y():Promise.resolve(),b=(y)=>(v,...f)=>{},x=(y)=>{},d=(y,v)=>{},s=(y,v)=>v,K0=()=>({value:"light"}),z0=()=>({value:!1}),_0={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:{}},y0=new Proxy(_0,{get(y,v){if(v in y)return y[v];return},set(y,v,f){return y[v]=f,!0}}),d0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},j0=console;try{let y=X$(X,Z),v=new Set(Object.keys(U)),f=Object.keys(Y).filter((a)=>!v.has(a)&&a!=="props"),p=f.map((a)=>Y[a]),G0=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"]),g=[],i=[];for(let[a,N1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(G0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(y))continue;g.push(a),i.push(N1)}let Y0=tX(y).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
1938
+ `),U0=Y.params??{},E0=[],i0=[];for(let a=0;a<f.length;a++){if(f[a]==="params")continue;E0.push(f[a]),i0.push(p[a])}let O5=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","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...g,...E0,`return (async () => {
1939
+ ${y}
1940
1940
  ${Y0}
1941
1941
  return module.exports
1942
- })()`)(Q,J,_,U,W,B,j,z,O,L,F,H,V,N,R,A,w,T,I,M,E,D,P,y,S,k,g,h,r,U0,z0,y0,d0,j0,_0.confirm,_0.alert,_0.fetch,q0,...i,...i0);Object.assign(Y,O5);for(let[a,N1]of Object.entries(U))if(!(a in Y))Y[a]=N1}catch{try{await XJ(X,Y,Z)}catch{}}}function X$($,Y){let Z=Y?E1.dirname(Y):process.cwd(),X=$.split(`
1942
+ })()`)(Q,J,_,U,W,B,j,z,O,L,F,H,V,N,R,A,w,T,D,I,M,E,C,P,k,b,x,d,s,K0,z0,y0,d0,j0,_0.confirm,_0.alert,_0.fetch,U0,...i,...i0);Object.assign(Y,O5);for(let[a,N1]of Object.entries(U))if(!(a in Y))Y[a]=N1}catch{try{await XJ(X,Y,Z)}catch{}}}function X$($,Y){let Z=Y?E1.dirname(Y):process.cwd(),X=$.split(`
1943
1943
  `),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 _=J;_<X.length&&!q;_++){let U=null,W=!1,B=X[_];for(let j=0;j<B.length;j++){let z=B[j];if(W){W=!1;continue}if(z==="\\"){W=!0;continue}if(U){if(z===U)U=null;continue}if(z==='"'||z==="'"||z==="`"){U=z;continue}if(z==="(")K++;else if(z===")"){if(K--,K===0){J=_+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+['"](.+)['"]/),_=G.match(/^import\s+['"](.+)['"]/),U=(W)=>{if(W.startsWith("."))return E1.resolve(Z,W);return W};if(K){let[,W,B]=K,j=U(B);Q.push(`const ${W} = await import('${j}')`),Q.push(`module.exports.${W} = ${W};`)}else if(q){let[,W,B]=q,j=W.trim(),z=U(B);Q.push(`const { ${j} } = await import('${z}')`);for(let O of j.split(",")){let L=O.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(_){let W=U(_[1]);Q.push(`await import('${W}')`)}else Q.push(G);J++;continue}if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=z3(X,J),{type:q,name:_,value:U}=K;Q.push(`${q} ${_} = ${U};`),Q.push(`module.exports.${_} = ${_};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=Z$(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=z3(X,J),{type:q,name:_,value:U}=K;Q.push(`${q} ${_} = ${U};`),Q.push(`module.exports.${_} = ${_};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=Z$(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 _=Z$(q,J);if(Q.push(_.functionCode),_.name)Q.push(`module.exports.default = ${_.name};`);J=_.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],_=X[J].replace(/^export\s+/,""),U=0,W=J;for(;W<X.length;W++){let B=X[W];for(let j of B)if(j==="{")U++;else if(j==="}")U--;if(W>J)_+=`
1944
1944
  `+B;if(U<=0&&W>=J)break}Q.push(_),Q.push(`module.exports.${q} = ${q};`),J=W+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 eX(Q.join(`
1945
1945
  `),Z)}function eX($,Y){let Z=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Z){let _=$[Q],U=$[Q+1];if(G){if(X+=_,_===`
@@ -1955,11 +1955,11 @@ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}async function XJ($,Y,Z){let X=$.ma
1955
1955
  ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
1956
1956
  `)}
1957
1957
  return result;
1958
- `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Y))Y[q]=_})}catch{}}function N3($){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=Y?Y[1]:"",X=Y?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:X}}function A3($){let Y=$.trim();if(!Y)return!1;return/(?:const|let|var|function)\s+\w+/.test(Y)}var t1=b(()=>{a1();w1()});var E3={};s(E3,{renderSlot:()=>T3,processSlots:()=>I3,parseSlots:()=>w3,parseSlotElement:()=>QJ,extractSlotContent:()=>qJ,applySlots:()=>UJ});function JJ($,Y){let Z=1,X=Y,Q="<template",J="</template";while(X<$.length&&Z>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Z++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Z--,Z===0)return K+1;X=K+1;continue}}X++}return Z===0?X:-1}function w3($){let Y={default:"",named:new Map},Z=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],J;while((J=X.exec($))!==null){let[U,W,B,j,z]=J,O=W||B||j,L=J.index+U.length,F=JJ($,L);if(F!==-1){let H=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:O,content:H,propsBinding:z||void 0}),Y.named.set(O,{name:O,content:H,propsBinding:z||void 0})}}Q.sort((U,W)=>W.start-U.start);for(let U of Q)Z=Z.slice(0,U.start)+Z.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Z))!==null){let[U,W,B,j,z,O]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(L+F).trim(),V=`<${W}${H?" "+H:""}>${O}</${W}>`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=_.exec(Z))!==null){let[U,W,B,j,z]=q,O=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(O+L).trim(),H=`<${W}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:H})}G.sort((U,W)=>W.start-U.start);for(let U of G){let W=Y.named.get(U.slotName);if(W)W.content+=U.element;else Y.named.set(U.slotName,{name:U.slotName,content:U.element});Z=Z.slice(0,U.start)+Z.slice(U.end)}return Y.default=Z.trim(),Y}function QJ($){let Y=$.match(/name\s*=\s*["']([^"']+)["']/),Z=Y?Y[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Z,props:X,defaultContent:K}}async function T3($,Y,Z,X){if(!$)return Z;let Q=$.content;if($.propsBinding&&Object.keys(Y).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,U]=q.split(":").map((B)=>B.trim()),W=U||_;if(Y[_]!==void 0)G[W]=Y[_]}}else G[J]=Y;Q=GJ(Q,G)}return Q}function GJ($,Y){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,X)=>{try{let Q=X.trim(),J=M3(Q,Y);return K1(String(J??""))}catch{return`{{ ${X} }}`}})}function M3($,Y){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Y;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,X,Q,J]=Z,G=Y[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!t($))return;return $0($,Object.keys(Y))(...Object.values(Y))}catch{return}}async function I3($,Y,Z){let X=$;X=await KJ(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,_)=>{let U=Y.named.get(K),W=_?.trim()||"",B=q||"",j={},z=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=z.exec(B))!==null){let L=O[1],F=O[2];j[L]=M3(F,Z)}return await T3(U,j,W,Z)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Y.default||q}),X}async function KJ($,Y,Z){let X=[],Q=[];$.replace(Y,(K,...q)=>{let _=q[q.length-2];return Q.push({match:K,index:_}),X.push(Z(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:_}=Q[K];G=G.slice(0,_)+J[K]+G.slice(_+q.length)}return G}function qJ($){let Y=w3($);return{defaultSlot:Y.default,namedSlots:Y.named}}async function UJ($,Y,Z,X){return await I3($,{default:Y,named:Z},X)}var D3=b(()=>{p0();N0()});import _J from"fs";import u from"path";function BJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function Q1($){return!zJ($)}function G1($){try{let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:v0()}).transformSync(Y);for(let J=0;J<Z.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Z[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Z[J]);return Q}catch(Y){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Y);return $}}function jJ($){let Y=[],Z=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++;else if($[Q]==="}")U--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
1959
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},_=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let z=U[2].split(",").map((O)=>{let L=O.trim().split(":");return L[L.length-1].trim()});for(let O of z)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!Z.has(O))Y.push(O),Z.add(O);return}let W=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!Z.has(z))Y.push(z),Z.add(z);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!Z.has(z))Y.push(z),Z.add(z);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!Z.has(z))Y.push(z),Z.add(z)}};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])))_();Q++}return Y}async function _1($,Y,Z,X,Q,J,G,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (t1(),k5)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let W=new Set(U);W.add($);try{let B=(C)=>C.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z=$.endsWith(".stx")?$.slice(0,-4):$,O=null,L=Q.__importedComponents;if(L){let C=[z,z.toLowerCase(),B(z),j(z)];for(let v of C)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let C=[`${z}.stx`,`${B(z)}.stx`,`${j(z)}.stx`],v=[...new Set(C)],x=Q.__originalFilePath,p=[];if(x){let J0=u.join(u.dirname(x),"components");p.push(J0)}if(X)p.push(X);let G0=u.join(u.dirname(J),"components");if(!p.includes(G0))p.push(G0);if(G.componentsDir&&G.componentsDir!==X&&!p.includes(G.componentsDir))p.push(G.componentsDir);let f=process.cwd(),i=[u.resolve(f,"src/components"),u.resolve(f,"components"),u.resolve(import.meta.dir,"components")];for(let J0 of i)if(!p.includes(J0))p.push(J0);if(z.startsWith("./")||z.startsWith("../"))O=u.resolve(u.dirname(J),`${z}.stx`),F.push(O);else for(let J0 of p){if(!J0)continue;for(let Y0 of v){let q0=u.join(J0,Y0);if(F.push(q0),await c(q0)){O=q0;break}}if(O)break;if(!O)try{let Y0=await import("fs");if(!Y0.statSync(J0,{throwIfNoEntry:!1})?.isDirectory())continue;let E0=8,i0=[{path:J0,depth:0}];while(i0.length>0&&!O){let u1=i0.pop();if(u1.depth>=E0)continue;let O5;try{O5=Y0.readdirSync(u1.path,{withFileTypes:!0})}catch{continue}for(let a of O5){if(!a.isDirectory())continue;if(a.name==="node_modules"||a.name.startsWith("."))continue;let N1=u.join(u1.path,a.name);for(let W7 of v){let g9=u.join(N1,W7);if(F.push(g9),await c(g9)){O=g9;break}}if(O)break;i0.push({path:N1,depth:u1.depth+1})}}}catch{}if(O)break}}if(!O||!await c(O)){let C=F.length>0?`
1958
+ `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Y))Y[q]=_})}catch{}}function N3($){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=Y?Y[1]:"",X=Y?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:X}}function A3($){let Y=$.trim();if(!Y)return!1;return/(?:const|let|var|function)\s+\w+/.test(Y)}var t1=S(()=>{a1();w1()});var E3={};r(E3,{renderSlot:()=>T3,processSlots:()=>I3,parseSlots:()=>w3,parseSlotElement:()=>QJ,extractSlotContent:()=>qJ,applySlots:()=>UJ});function JJ($,Y){let Z=1,X=Y,Q="<template",J="</template";while(X<$.length&&Z>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Z++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Z--,Z===0)return K+1;X=K+1;continue}}X++}return Z===0?X:-1}function w3($){let Y={default:"",named:new Map},Z=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],J;while((J=X.exec($))!==null){let[U,W,B,j,z]=J,O=W||B||j,L=J.index+U.length,F=JJ($,L);if(F!==-1){let H=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:O,content:H,propsBinding:z||void 0}),Y.named.set(O,{name:O,content:H,propsBinding:z||void 0})}}Q.sort((U,W)=>W.start-U.start);for(let U of Q)Z=Z.slice(0,U.start)+Z.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Z))!==null){let[U,W,B,j,z,O]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(L+F).trim(),V=`<${W}${H?" "+H:""}>${O}</${W}>`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:V})}let _=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=_.exec(Z))!==null){let[U,W,B,j,z]=q,O=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(O+L).trim(),H=`<${W}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+U.length,slotName:j,element:H})}G.sort((U,W)=>W.start-U.start);for(let U of G){let W=Y.named.get(U.slotName);if(W)W.content+=U.element;else Y.named.set(U.slotName,{name:U.slotName,content:U.element});Z=Z.slice(0,U.start)+Z.slice(U.end)}return Y.default=Z.trim(),Y}function QJ($){let Y=$.match(/name\s*=\s*["']([^"']+)["']/),Z=Y?Y[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Z,props:X,defaultContent:K}}async function T3($,Y,Z,X){if(!$)return Z;let Q=$.content;if($.propsBinding&&Object.keys(Y).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,U]=q.split(":").map((B)=>B.trim()),W=U||_;if(Y[_]!==void 0)G[W]=Y[_]}}else G[J]=Y;Q=GJ(Q,G)}return Q}function GJ($,Y){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,X)=>{try{let Q=X.trim(),J=M3(Q,Y);return K1(String(J??""))}catch{return`{{ ${X} }}`}})}function M3($,Y){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Y;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,X,Q,J]=Z,G=Y[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!t($))return;return $0($,Object.keys(Y))(...Object.values(Y))}catch{return}}async function I3($,Y,Z){let X=$;X=await KJ(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,_)=>{let U=Y.named.get(K),W=_?.trim()||"",B=q||"",j={},z=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,O;while((O=z.exec(B))!==null){let L=O[1],F=O[2];j[L]=M3(F,Z)}return await T3(U,j,W,Z)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Y.default||q}),X}async function KJ($,Y,Z){let X=[],Q=[];$.replace(Y,(K,...q)=>{let _=q[q.length-2];return Q.push({match:K,index:_}),X.push(Z(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:_}=Q[K];G=G.slice(0,_)+J[K]+G.slice(_+q.length)}return G}function qJ($){let Y=w3($);return{defaultSlot:Y.default,namedSlots:Y.named}}async function UJ($,Y,Z,X){return await I3($,{default:Y,named:Z},X)}var D3=S(()=>{p0();N0()});import _J from"fs";import u from"path";function BJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zJ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function Q1($){return!zJ($)}function G1($){try{let Y=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Y=Y.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];Y=Y.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`}),Y=Y.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Z.length;return Z.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:v0()}).transformSync(Y);for(let J=0;J<Z.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Z[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Z[J]);return Q}catch(Y){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Y);return $}}function jJ($){let Y=[],Z=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++;else if($[Q]==="}")U--;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
1959
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},_=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let z=U[2].split(",").map((O)=>{let L=O.trim().split(":");return L[L.length-1].trim()});for(let O of z)if(O&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(O)&&!Z.has(O))Y.push(O),Z.add(O);return}let W=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!Z.has(z))Y.push(z),Z.add(z);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!Z.has(z))Y.push(z),Z.add(z);return}let j=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!Z.has(z))Y.push(z),Z.add(z)}};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])))_();Q++}return Y}async function _1($,Y,Z,X,Q,J,G,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (t1(),k5)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let W=new Set(U);W.add($);try{let B=(y)=>y.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(y)=>y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z=$.endsWith(".stx")?$.slice(0,-4):$,O=null,L=Q.__importedComponents;if(L){let y=[z,z.toLowerCase(),B(z),j(z)];for(let v of y)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let y=[`${z}.stx`,`${B(z)}.stx`,`${j(z)}.stx`],v=[...new Set(y)],f=Q.__originalFilePath,p=[];if(f){let J0=u.join(u.dirname(f),"components");p.push(J0)}if(X)p.push(X);let G0=u.join(u.dirname(J),"components");if(!p.includes(G0))p.push(G0);if(G.componentsDir&&G.componentsDir!==X&&!p.includes(G.componentsDir))p.push(G.componentsDir);let g=process.cwd(),i=[u.resolve(g,"src/components"),u.resolve(g,"components"),u.resolve(import.meta.dir,"components")];for(let J0 of i)if(!p.includes(J0))p.push(J0);if(z.startsWith("./")||z.startsWith("../"))O=u.resolve(u.dirname(J),`${z}.stx`),F.push(O);else for(let J0 of p){if(!J0)continue;for(let Y0 of v){let U0=u.join(J0,Y0);if(F.push(U0),await c(U0)){O=U0;break}}if(O)break;if(!O)try{let Y0=await import("fs");if(!Y0.statSync(J0,{throwIfNoEntry:!1})?.isDirectory())continue;let E0=8,i0=[{path:J0,depth:0}];while(i0.length>0&&!O){let u1=i0.pop();if(u1.depth>=E0)continue;let O5;try{O5=Y0.readdirSync(u1.path,{withFileTypes:!0})}catch{continue}for(let a of O5){if(!a.isDirectory())continue;if(a.name==="node_modules"||a.name.startsWith("."))continue;let N1=u.join(u1.path,a.name);for(let W7 of v){let g9=u.join(N1,W7);if(F.push(g9),await c(g9)){O=g9;break}}if(O)break;i0.push({path:N1,depth:u1.depth+1})}}}catch{}if(O)break}}if(!O||!await c(O)){let y=F.length>0?`
1960
1960
  Searched paths:
1961
1961
  ${F.map((v)=>` - ${v}`).join(`
1962
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(O);let H;if(J$.has(O))H=J$.get(O);else try{H=await Bun.file(O).text(),J$.set(O,H)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,v]of Object.entries(Q))if(!C.startsWith("__")||V.has(C))N[C]=v;let R={...N,...Y,props:Y,slot:Z,__processedComponents:W,__sections:{}},A=H,w=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)A=w[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...H.matchAll(T)],M=[];for(let C of I){let v=C[1]||"",x=C[2]||"",p=v.includes("server");if(Q1(v)&&x.trim())x=G1(x);if(p&&x)try{await _(x,R,O)}catch(f){}if(!p){let f=x.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),i=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");M.push(`<script${i}>${f}</script>`)}}let E=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=E?E[1]:"",P=E?E[2]:"",y="",S=D&&/\bscoped\b/i.test(D);if(E)y=`<style${D}>${P}</style>`;let k=A;if(k=k.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E)k=k.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Z&&k.includes("{{ text || slot }}"))k=k.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{extractSlotContent:g,applySlots:h}=await Promise.resolve().then(() => (D3(),E3)),{defaultSlot:r,namedSlots:U0}=g(Z);k=await h(k,r||Z,U0,R);for(let[C,v]of Object.entries(R))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let x=a9(v);R[C]=x}}let z0=M.some((C)=>/\b(state|derived|effect)\s*\(/.test(C)),_0={...G,componentsDir:u.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:z0,defaultLayout:void 0};R.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let y0=await b5(k,R,O,_0,q),d0=`stx_${z.replace(/[^a-zA-Z0-9]/g,"_")}_${++WJ}_${Math.random().toString(36).slice(2,8)}`,j0=y0;if(z0){let C="";if(Object.keys(Y).length>0)try{C=` data-stx-props="${BJ(JSON.stringify(Y))}"`}catch{}if(j0=`<div data-stx-scope="${d0}"${C}>${y0}</div>`,j0=M.map((x)=>{let p=x.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return x;let[,G0,f]=p,i=o0(f),J0=`
1962
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${y}`}q.add(O);let H;if(J$.has(O))H=J$.get(O);else try{H=await Bun.file(O).text(),J$.set(O,H)}catch(y){return`[Error loading component: ${y instanceof Error?y.message:String(y)}]`}let V=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[y,v]of Object.entries(Q))if(!y.startsWith("__")||V.has(y))N[y]=v;let R={...N,...Y,props:Y,slot:Z,__processedComponents:W,__sections:{}},A=H,w=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)A=w[1].trim();let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...H.matchAll(T)],I=[];for(let y of D){let v=y[1]||"",f=y[2]||"",p=v.includes("server");if(Q1(v)&&f.trim())f=G1(f);if(p&&f)try{await _(f,R,O)}catch(g){}if(!p){let g=f.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),i=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");I.push(`<script${i}>${g}</script>`)}}let M=H.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),E=M?M[1]:"",C=M?M[2]:"",P="",k=E&&/\bscoped\b/i.test(E);if(M)P=`<style${E}>${C}</style>`;let b=A;if(b=b.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),M)b=b.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Z&&b.includes("{{ text || slot }}"))b=b.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{extractSlotContent:x,applySlots:d}=await Promise.resolve().then(() => (D3(),E3)),{defaultSlot:s,namedSlots:K0}=x(Z);b=await d(b,s||Z,K0,R);for(let[y,v]of Object.entries(R))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let f=a9(v);R[y]=f}}let z0=I.some((y)=>/\b(state|derived|effect)\s*\(/.test(y)),_0={...G,componentsDir:u.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:z0,defaultLayout:void 0};R.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let y0=await b5(b,R,O,_0,q),d0=`stx_${z.replace(/[^a-zA-Z0-9]/g,"_")}_${++WJ}_${Math.random().toString(36).slice(2,8)}`,j0=y0;if(z0){let y="";if(Object.keys(Y).length>0)try{y=` data-stx-props="${BJ(JSON.stringify(Y))}"`}catch{}if(j0=`<div data-stx-scope="${d0}"${y}>${y0}</div>`,j0=I.map((f)=>{let p=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!p)return f;let[,G0,g]=p,i=o0(g),J0=`
1963
1963
  (function() {
1964
1964
  const { state, derived, effect, batch } = window.stx;
1965
1965
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -1983,11 +1983,11 @@ catch (e) {}
1983
1983
  Object.assign(__scopeVars, __localVars);
1984
1984
  })();`;return`<script data-stx-scoped${G0}>${J0}</script>`}).join(`
1985
1985
  `)+`
1986
- `+j0,y)j0+=`
1987
- `+y}else{if(y)j0+=`
1988
- `+y;if(M.length>0){let C=R.__stx_event_bindings||[],v=await Promise.all(M.map(async(x)=>{let p=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return x;return await A5(p[1],{eventBindings:C,templateContent:j0,filePath:O,projectRoot:process.cwd()})}));j0+=`
1986
+ `+j0,P)j0+=`
1987
+ `+P}else{if(P)j0+=`
1988
+ `+P;if(I.length>0){let y=R.__stx_event_bindings||[],v=await Promise.all(I.map(async(f)=>{let p=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!p)return f;return await A5(p[1],{eventBindings:y,templateContent:j0,filePath:O,projectRoot:process.cwd()})}));j0+=`
1989
1989
  `+v.join(`
1990
- `),R.__stx_event_bindings=[]}}if(S){let C=I5(j0,O);if(C.hasScoped)j0=C.html}return j0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function Q$($,Y){let Z=u.resolve(Y),X=u.resolve($),Q=Z.endsWith(u.sep)?Z:Z+u.sep;if(X===Z||X.startsWith(Q))return X;return null}async function G$($,Y,Z,X){let Q=await OJ($,Y,Z,X);if(Q===null)return null;let J=Q$(Q,process.cwd());if(J)return J;let G=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=u.isAbsolute(K)?K:u.resolve(process.cwd(),K);if(Q$(Q,q))return u.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Y})`),null}async function OJ($,Y,Z,X){if(Z.debug)console.log(`Resolving template path: ${$} from ${Y}`);let Q=u.dirname(Y),J=process.cwd();if($.startsWith("/")){let B=u.join(J,$),j=Q$(B,J);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Y})`),null;if(Z.debug)console.log(`Checking absolute path: ${j}`);if(await c(j)&&X)X.add(j);return j}let G=u.join(Q,$);if(await c(G)){if(Z.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let j=`${G}${B}`;if(await c(j)){if(Z.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let K="",q=u.resolve(Q),_=process.cwd();for(let B=0;B<10;B++){let j=u.join(q,"layouts"),z=!1;try{z=_J.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(z){K=j;break}let O=u.dirname(q);if(O===q||O.length<_.length)break;q=O}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,j=u.join(K,B);if(await c(j)){if(Z.debug)console.log(`Found in current layouts dir: ${j}`);if(X)X.add(j);return j}if(!B.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.layoutsDir){let B=u.isAbsolute(Z.layoutsDir)?Z.layoutsDir:u.resolve(process.cwd(),Z.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,z=u.join(B,j);if(await c(z)){if(Z.debug)console.log(`Found in options.layoutsDir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let O=`${z}.stx`;if(await c(O)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(X)X.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),j=u.join(Z.partialsDir||Q,"layouts",B[1]);if(await c(j)){if(Z.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in layouts path with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.partialsDir){if(K=u.join(Z.partialsDir,"layouts"),await c(K)){let B=u.join(K,$);if(await c(B)){if(Z.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}}let U=Z.partialsDir||u.join(process.cwd(),"views"),W=u.join(U,$);if(await c(W)){if(Z.debug)console.log(`Found in views path: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let B=`${W}.stx`;if(await c(B)){if(Z.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=u.join(u.dirname(Q),"layouts",$);if(await c(B)){if(Z.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Y})`);else console.warn(`Template not found: ${$} (referenced from ${Y})`);return null}function k3($,Y,Z){let X=0,Q="",J="";try{if(typeof Y==="number"&&Y>=0){let G=$.split(`
1990
+ `),R.__stx_event_bindings=[]}}if(k){let y=I5(j0,O);if(y.hasScoped)j0=y.html}return j0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function Q$($,Y){let Z=u.resolve(Y),X=u.resolve($),Q=Z.endsWith(u.sep)?Z:Z+u.sep;if(X===Z||X.startsWith(Q))return X;return null}async function G$($,Y,Z,X){let Q=await OJ($,Y,Z,X);if(Q===null)return null;let J=Q$(Q,process.cwd());if(J)return J;let G=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=u.isAbsolute(K)?K:u.resolve(process.cwd(),K);if(Q$(Q,q))return u.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Y})`),null}async function OJ($,Y,Z,X){if(Z.debug)console.log(`Resolving template path: ${$} from ${Y}`);let Q=u.dirname(Y),J=process.cwd();if($.startsWith("/")){let B=u.join(J,$),j=Q$(B,J);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Y})`),null;if(Z.debug)console.log(`Checking absolute path: ${j}`);if(await c(j)&&X)X.add(j);return j}let G=u.join(Q,$);if(await c(G)){if(Z.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let j=`${G}${B}`;if(await c(j)){if(Z.debug)console.log(`Found direct path with extension: ${j}`);if(X)X.add(j);return j}}let K="",q=u.resolve(Q),_=process.cwd();for(let B=0;B<10;B++){let j=u.join(q,"layouts"),z=!1;try{z=_J.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(z){K=j;break}let O=u.dirname(q);if(O===q||O.length<_.length)break;q=O}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,j=u.join(K,B);if(await c(j)){if(Z.debug)console.log(`Found in current layouts dir: ${j}`);if(X)X.add(j);return j}if(!B.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.layoutsDir){let B=u.isAbsolute(Z.layoutsDir)?Z.layoutsDir:u.resolve(process.cwd(),Z.layoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,z=u.join(B,j);if(await c(z)){if(Z.debug)console.log(`Found in options.layoutsDir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let O=`${z}.stx`;if(await c(O)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${O}`);if(X)X.add(O);return O}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),j=u.join(Z.partialsDir||Q,"layouts",B[1]);if(await c(j)){if(Z.debug)console.log(`Found in layouts path: ${j}`);if(X)X.add(j);return j}if(!j.endsWith(".stx")){let z=`${j}.stx`;if(await c(z)){if(Z.debug)console.log(`Found in layouts path with extension: ${z}`);if(X)X.add(z);return z}}}if(Z.partialsDir){if(K=u.join(Z.partialsDir,"layouts"),await c(K)){let B=u.join(K,$);if(await c(B)){if(Z.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}}let U=Z.partialsDir||u.join(process.cwd(),"views"),W=u.join(U,$);if(await c(W)){if(Z.debug)console.log(`Found in views path: ${W}`);if(X)X.add(W);return W}if(!$.endsWith(".stx")){let B=`${W}.stx`;if(await c(B)){if(Z.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=u.join(u.dirname(Q),"layouts",$);if(await c(B)){if(Z.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await c(j)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Y})`);else console.warn(`Template not found: ${$} (referenced from ${Y})`);return null}function k3($,Y,Z){let X=0,Q="",J="";try{if(typeof Y==="number"&&Y>=0){let G=$.split(`
1991
1991
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Y){X=q+1,Q=G[q].trim();let _=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(_,U).map((W,B)=>{let j=_+B+1;return`${j===X?"> ":" "}${j}: ${W}`}).join(`
1992
1992
  `);break}}else if(Z){let G=$.indexOf(Z);if(G>=0)return k3($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function X0($,Y,Z,X,Q,J){let{lineNumber:G,context:K}=k3(X,Q,J),q=Z.split("/").pop(),_=0;if(typeof Q==="number"&&Q>=0&&X){let W=X.lastIndexOf(`
1993
1993
  `,Math.max(0,Q-1));_=Q-(W+1)+1}let U="";if(G>0)U+=`
@@ -2002,8 +2002,8 @@ ${n.yellow}${n.bold}Message:${n.reset} ${Y}
2002
2002
  `,K)U+=`
2003
2003
  ${n.blue}${n.bold}Context:${n.reset}
2004
2004
  ${n.dim}${K}${n.reset}
2005
- `;return U}var J$,WJ=0,n;var V0=b(()=>{s9();p0();I1();K$();w1();$$();B3();t1();J$=new s1(500);n={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function b3($,Y,Z=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),_=q?q[1]:"",U=K+G[0].length,W=1,B=U,j=-1;while(W>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let H=$[L+9];if(H==="("||H===`
2006
- `||H==="\r"||H===" "||H===void 0)W++;B=L+9}else{if(W--,W===0){j=F;break}B=F+12}}if(j===-1)continue;let z=$.slice(U,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:_,content:z,index:K}),J.lastIndex=j+12}for(let{fullMatch:K,options:q,content:_,index:U}of Q)try{let W={};if(q)q.split(",").forEach((z)=>{let O=z.trim();if(O)W[O]=!0});let B={gfm:W.gfm??!0,breaks:W.breaks??!1},j=c1(_.trim(),B);X=X.split(K).join(j)}catch(W){let B=W instanceof Error?W.message:String(W),j=X0("Markdown Directive",`Error processing markdown: ${B}`,Z,$,U,K);X=X.split(K).join(j)}return X}async function S3($,Y,Z,X){let Q={gfm:!0,breaks:!1};return Y.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),c1($.trim(),Q)}var q$=b(()=>{V0()});function FJ($){if(HJ.set($.name,$),$.client)LJ.set($.name,$.client)}function S5($){return FJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,X,Q,J)=>{let G=VJ(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Z;if($.transform)K=await $.transform(Z,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function VJ($,Y){let Z={...Y};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[K]=q}else{let K=Object.keys(Z).filter((q)=>!Y||!(q in Y)).length;Z[K===0?"value":`arg${K}`]=X}}return Z}var HJ,LJ;var U$=b(()=>{HJ=new Map,LJ=new Map});function _$($,Y=D1,Z={},X){return Y.sort((Q,J)=>Q-J).map((Q)=>{return`${$5($,{...Z,w:Q,fm:X})} ${Q}w`}).join(", ")}function y3($,Y,Z=RJ,X={},Q){return Z.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Y*J);return`${$5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function W$($,Y="100vw"){if(!$||Object.keys($).length===0)return Y;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Y),X.join(", ")}function $5($,Y={}){let Z=Object.entries(Y).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Z.length===0)return $;let X=Z.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function B$($){return NJ[$]||"application/octet-stream"}var D1,RJ,e1,NJ;var z$=b(()=>{D1=[320,480,640,768,1024,1280,1536,1920,2560],RJ=[1,1.5,2,3],e1=["avif","webp","jpeg"],NJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function wJ(){try{return await import("ts-images")}catch{return null}}async function TJ($,Y={}){let Z={...AJ,...Y},X=await wJ();if(X)try{return await MJ($,Z,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return IJ($,Z)}async function MJ($,Y,Z){let{generatePlaceholder:X,generateThumbHash:Q}=Z,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Y.strategy]||"blur";if(Y.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Y.width,height:Y.height,quality:Y.quality,blurLevel:Y.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Y.strategy,dominantColor:K.dominantColor,css:K.css}}function IJ($,Y){let Z=Y.width||20,X=Y.height||Z,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}" viewBox="0 0 ${Z} ${X}"><rect fill="#e5e7eb" width="${Z}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Z,height:X,aspectRatio:Z/X,originalWidth:0,originalHeight:0,strategy:Y.strategy,dominantColor:"#e5e7eb"}}function P3($,Y,Z={}){let X=Z.transitionDuration||300,Q=Z.easing||"ease-out";return`
2005
+ `;return U}var J$,WJ=0,n;var V0=S(()=>{s9();p0();I1();K$();w1();$$();B3();t1();J$=new s1(500);n={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function b3($,Y,Z=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),_=q?q[1]:"",U=K+G[0].length,W=1,B=U,j=-1;while(W>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let H=$[L+9];if(H==="("||H===`
2006
+ `||H==="\r"||H===" "||H===void 0)W++;B=L+9}else{if(W--,W===0){j=F;break}B=F+12}}if(j===-1)continue;let z=$.slice(U,j),O=$.slice(K,j+12);Q.push({fullMatch:O,options:_,content:z,index:K}),J.lastIndex=j+12}for(let{fullMatch:K,options:q,content:_,index:U}of Q)try{let W={};if(q)q.split(",").forEach((z)=>{let O=z.trim();if(O)W[O]=!0});let B={gfm:W.gfm??!0,breaks:W.breaks??!1},j=c1(_.trim(),B);X=X.split(K).join(j)}catch(W){let B=W instanceof Error?W.message:String(W),j=X0("Markdown Directive",`Error processing markdown: ${B}`,Z,$,U,K);X=X.split(K).join(j)}return X}async function S3($,Y,Z,X){let Q={gfm:!0,breaks:!1};return Y.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),c1($.trim(),Q)}var q$=S(()=>{V0()});function FJ($){if(HJ.set($.name,$),$.client)LJ.set($.name,$.client)}function S5($){return FJ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,X,Q,J)=>{let G=VJ(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Z;if($.transform)K=await $.transform(Z,G,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function VJ($,Y){let Z={...Y};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[K]=q}else{let K=Object.keys(Z).filter((q)=>!Y||!(q in Y)).length;Z[K===0?"value":`arg${K}`]=X}}return Z}var HJ,LJ;var U$=S(()=>{HJ=new Map,LJ=new Map});function _$($,Y=D1,Z={},X){return Y.sort((Q,J)=>Q-J).map((Q)=>{return`${$5($,{...Z,w:Q,fm:X})} ${Q}w`}).join(", ")}function y3($,Y,Z=RJ,X={},Q){return Z.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Y*J);return`${$5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function W$($,Y="100vw"){if(!$||Object.keys($).length===0)return Y;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Y),X.join(", ")}function $5($,Y={}){let Z=Object.entries(Y).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Z.length===0)return $;let X=Z.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function B$($){return NJ[$]||"application/octet-stream"}var D1,RJ,e1,NJ;var z$=S(()=>{D1=[320,480,640,768,1024,1280,1536,1920,2560],RJ=[1,1.5,2,3],e1=["avif","webp","jpeg"],NJ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function wJ(){try{return await import("ts-images")}catch{return null}}async function TJ($,Y={}){let Z={...AJ,...Y},X=await wJ();if(X)try{return await MJ($,Z,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return IJ($,Z)}async function MJ($,Y,Z){let{generatePlaceholder:X,generateThumbHash:Q}=Z,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Y.strategy]||"blur";if(Y.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Y.width,height:Y.height,quality:Y.quality,blurLevel:Y.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Y.strategy,dominantColor:K.dominantColor,css:K.css}}function IJ($,Y){let Z=Y.width||20,X=Y.height||Z,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}" viewBox="0 0 ${Z} ${X}"><rect fill="#e5e7eb" width="${Z}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Z,height:X,aspectRatio:Z/X,originalWidth:0,originalHeight:0,strategy:Y.strategy,dominantColor:"#e5e7eb"}}function P3($,Y,Z={}){let X=Z.transitionDuration||300,Q=Z.easing||"ease-out";return`
2007
2007
  #${$} {
2008
2008
  --stx-img-transition-duration: ${X}ms;
2009
2009
  --stx-img-transition-easing: ${Q};
@@ -2020,7 +2020,7 @@ ${n.dim}${K}${n.reset}
2020
2020
  #${$}.stx-img-loaded img {
2021
2021
  opacity: 1;
2022
2022
  }
2023
- `.trim()}async function C3($,Y={}){let Z=`${$}:${JSON.stringify(Y)}`;if(j$.has(Z))return j$.get(Z);let X=await TJ($,Y);return j$.set(Z,X),X}var AJ,O$,j$;var v3=b(()=>{AJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},O$=`
2023
+ `.trim()}async function C3($,Y={}){let Z=`${$}:${JSON.stringify(Y)}`;if(j$.has(Z))return j$.get(Z);let X=await TJ($,Y);return j$.set(Z,X),X}var AJ,O$,j$;var v3=S(()=>{AJ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},O$=`
2024
2024
  .stx-img-placeholder {
2025
2025
  position: relative;
2026
2026
  overflow: hidden;
@@ -2049,20 +2049,20 @@ ${n.dim}${K}${n.reset}
2049
2049
  filter: blur(0);
2050
2050
  transform: scale(1);
2051
2051
  }
2052
- `.trim();j$=new Map});import{createHash as f3}from"crypto";import{readFile as EJ,stat as g3}from"fs/promises";async function A0($){try{let Y=await EJ($);return f3("sha256").update(Y).digest("hex").slice(0,16)}catch{return""}}function x3($){return f3("sha256").update($).digest("hex").slice(0,16)}function y5($,Y){let Z=JSON.stringify(Y,Object.keys(Y).sort());return`${x3($)}-${x3(Z)}`}async function H$($){try{return(await g3($)).mtimeMs}catch{return 0}}async function R0($){try{return await g3($),!0}catch{return!1}}var W1=()=>{};import{mkdir as DJ,readFile as kJ,writeFile as bJ,readdir as NW,rm as SJ,stat as AW}from"fs/promises";import{join as d3,dirname as yJ}from"path";async function PJ($){try{await DJ($,{recursive:!0})}catch{}}function m3($,Y,Z){return d3($,Z,`${Y}.json`)}async function h3($,Y,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await H$(Y)!==$.srcMtime)return!1;return!0}async function P5($,Y,Z,X=L$){if(!X.enabled)return null;let Q=y5($,Y),J=k1.get(Q);if(J){if(await h3(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;k1.delete(Q)}let G=m3(X.directory,Q,Z);if(await R0(G))try{let K=await kJ(G,"utf-8"),q=JSON.parse(K);if(await h3(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),k1.set(Q,q),q.data}catch{}return null}async function C5($,Y,Z,X,Q=L$){if(!Q.enabled)return;let J=y5($,Y),G=await A0($),K=await H$($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:y5("",Y),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};k1.set(J,q);let _=m3(Q.directory,J,X);try{await PJ(yJ(_)),await bJ(_,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function v5($,Y=L$){if($==="all")k1.clear();else k1.clear();let Z=$==="all"?["image","video"]:[$];for(let X of Z){let Q=d3(Y.directory,X);try{await SJ(Q,{recursive:!0,force:!0})}catch{}}}var k1,L$;var F$=b(()=>{W1();k1=new Map,L$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class f5{config;constructor($={}){this.config={...CJ,...$}}async get($,Y){return P5($,Y,"image",this.config)}async set($,Y,Z){return C5($,Y,Z,"image",this.config)}async clear(){return v5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function V$($){if(!x5)x5=new f5($);else if($)x5.updateConfig($);return x5}async function g5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return V$(X).get($,Y)}async function h5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return V$(Q).set($,Y,Z)}async function u3(){return V$().clear()}var CJ,x5=null;var R$=b(()=>{F$();CJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as vJ,basename as xJ,extname as fJ,join as gJ}from"path";import{mkdir as hJ}from"fs/promises";async function N$(){try{return await import("ts-images")}catch{return null}}function l3($){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 dJ($,Y){let Z=Y?l3(Y):l3("web"),X=$.formatQuality||{};return{jpeg:{...Z.jpeg,...X.jpeg},png:{...Z.png,...X.png},webp:{...Z.webp,...X.webp},avif:{...Z.avif,...X.avif}}}async function p3($,Y,Z){let X=await N$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await g5($,Y,Z);if(Q)return Q;try{let J=vJ($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=dJ(Z,Y.preset),K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await hJ(K,{recursive:!0});let _=await A0(J),U=xJ($,fJ($)),W=Y.outputFormat?[Y.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:_},j=null;if(Y.transformations&&Y.transformations.length>0)j=await A$(J,Y.transformations,X);for(let z of W){let O=G[z]||{},L=`${U}-${_}.${z}`,F=gJ(K,L);try{let H=await X.optimizeImage({input:j||J,output:F,format:z,quality:O.quality,progressive:O.progressive});if(H){if(B.variants.push({path:F,url:`${q}/${L}`,width:H.width||0,height:H.height||0,format:z,size:H.outputSize||0}),!B.originalWidth&&H.width)B.originalWidth=H.width,B.originalHeight=H.height}}catch(H){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${z}: ${H}`)}}if(Y.embedThumbhash||Y.placeholder==="thumbhash")try{let z=await X.generateThumbHash(J);B.placeholder=z.dataUrl}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${z}`)}if(Y.useDominantColor)try{let z=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=z.dominantColor}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${z}`)}return await h5($,Y,B,Z),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function c3($,Y,Z,X){let Q=await N$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Y,quality:Z}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function A$($,Y,Z){let X=Z||await N$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Y){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 i3=b(()=>{W1();R$()});import{resolve as mJ,basename as uJ,extname as lJ,join as pJ}from"path";import{mkdir as cJ}from"fs/promises";async function iJ(){try{return await import("ts-images")}catch{return null}}async function n3($,Y,Z){let X=await iJ();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=mJ($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Y.responsiveWidths||Z.breakpoints||nJ,G=Y.formats||Z.defaultFormats||["avif","webp","jpeg"],K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await cJ(K,{recursive:!0});let _=await A0(Q),U=uJ($,lJ($)),W=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let z of G){B.byFormat[z]=[];let O=[];for(let L of J){let F=`${U}-${L}w-${_}.${z}`,H=pJ(K,F),V=`${q}/${F}`;try{let N=W[z]?.quality||80;if(await R0(H)){B.byFormat[z].push({path:H,url:V,width:L,height:0,format:z,size:0}),O.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:H,format:z,quality:N,resize:{width:L}});if(R)B.byFormat[z].push({path:H,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:z,size:R.outputSize||0}),O.push(`${V} ${L}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${z} at ${L}w: ${N}`)}}B.srcsets[z]=O.join(", ")}let j=Y.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let z=await X.generateThumbHash(Q);B.placeholder={dataURL:z.dataUrl,width:z.width||32,height:z.height||32,strategy:"thumbhash"}}else{let z=await X.generatePlaceholder(Q,{strategy:j,width:20});B.placeholder={dataURL:z.dataURL,width:z.width,height:z.height,strategy:j}}}catch(z){console.warn(`[stx-media] Failed to generate placeholder: ${z}`)}return B.sizes=Y.sizes||oJ(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function oJ($){let Y=[...$].sort((X,Q)=>X-Q),Z=[];for(let X=0;X<Y.length-1;X++){let Q=Y[X];Z.push(`(max-width: ${Q}px) ${Q}px`)}return Z.push(`${Y[Y.length-1]}px`),Z.join(", ")}function o3($,Y="width"){if(!$||$.length===0)return"";if(Y==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var nJ;var s3=b(()=>{W1();nJ=[320,480,640,768,1024,1280,1536,1920]});var r3={};s(r3,{setCachedImageResult:()=>h5,processImage:()=>p3,optimizeImage:()=>c3,getCachedImageResult:()=>g5,generateSrcset:()=>o3,generateResponsiveVariants:()=>n3,clearImageCache:()=>u3,applyTransformations:()=>A$,ImageProcessorCache:()=>f5});var a3=b(()=>{i3();s3();R$()});async function sJ(){try{return await Promise.resolve().then(() => (a3(),r3))}catch($){if(!t3)console.warn("[stx-media] Image processor not available, some features disabled:",$),t3=!0;return null}}async function d5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return eJ(X,Z)}if(Z.processedResult?.processed)return I$($,Z.processedResult,Y);if(Z.responsiveVariants)return Z6($,Z.responsiveVariants,Y);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=D1,dpr:U,formats:W=e1,quality:B=w$,params:j={},placeholder:z="none",placeholderOptions:O={},lazy:L=!0,priority:F=!1,loading:H=F?"eager":u5,decoding:V=m5,fetchpriority:N,objectFit:R,objectPosition:A,crossorigin:w,referrerpolicy:T}=$,I=$.class,M=$.style,E=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Y;if(P&&!Y.optimize)return tJ($);let S,k,g=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!F)try{S=await C3(Q,{strategy:z,...O}),k=P3(g,S,O)}catch{}let h=U!==void 0&&G!==void 0,r;if(h)r=aJ($,g,S,Y);else r=await rJ($,g,S,Y);let U0;if(F){let y0=W.includes("webp")?"webp":W[0],d0=_$(Q,_,{...j,q:B},y0),j0=typeof q==="object"?W$(q):q||"100vw";U0=`<link rel="preload" as="image" imagesrcset="${d0}" imagesizes="${j0}" />`}let z0=[];if(!e3&&z!=="none")z0.push(O$),e3=!0;if(k)z0.push(k);let _0=L?Y6(g):void 0;return{html:r,preloadLink:U0,css:z0.length>0?z0.join(`
2053
- `):void 0,script:_0}}async function rJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=D1,formats:U=e1,quality:W=w$,params:B={},lazy:j=!0,priority:z=!1,loading:O=z?"eager":u5,decoding:L=m5,fetchpriority:F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R}=$,A=$.class,w=$.style,T=$.data||{},I=typeof q==="object"?W$(q):q||"100vw",M=[];for(let P of U){let y=_$(Q,_,{...B,q:W},P),S=B$(P);if(j&&!z)M.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else M.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let E=T$({src:$5(Q,{...B,q:W}),alt:J,width:G,height:K,loading:z?void 0:O,decoding:L,fetchpriority:z?"high":F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R,className:$6(A,Z),style:M$(w,H,V,Z),lazy:j&&!z,data:T}),D;if(Z){let P=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Y}" class="stx-img-placeholder" style="${P}">
2052
+ `.trim();j$=new Map});import{createHash as f3}from"crypto";import{readFile as EJ,stat as g3}from"fs/promises";async function A0($){try{let Y=await EJ($);return f3("sha256").update(Y).digest("hex").slice(0,16)}catch{return""}}function x3($){return f3("sha256").update($).digest("hex").slice(0,16)}function y5($,Y){let Z=JSON.stringify(Y,Object.keys(Y).sort());return`${x3($)}-${x3(Z)}`}async function H$($){try{return(await g3($)).mtimeMs}catch{return 0}}async function R0($){try{return await g3($),!0}catch{return!1}}var W1=()=>{};import{mkdir as DJ,readFile as kJ,writeFile as bJ,readdir as NW,rm as SJ,stat as AW}from"fs/promises";import{join as d3,dirname as yJ}from"path";async function PJ($){try{await DJ($,{recursive:!0})}catch{}}function m3($,Y,Z){return d3($,Z,`${Y}.json`)}async function h3($,Y,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await H$(Y)!==$.srcMtime)return!1;return!0}async function P5($,Y,Z,X=L$){if(!X.enabled)return null;let Q=y5($,Y),J=k1.get(Q);if(J){if(await h3(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;k1.delete(Q)}let G=m3(X.directory,Q,Z);if(await R0(G))try{let K=await kJ(G,"utf-8"),q=JSON.parse(K);if(await h3(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),k1.set(Q,q),q.data}catch{}return null}async function C5($,Y,Z,X,Q=L$){if(!Q.enabled)return;let J=y5($,Y),G=await A0($),K=await H$($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:y5("",Y),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};k1.set(J,q);let _=m3(Q.directory,J,X);try{await PJ(yJ(_)),await bJ(_,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function v5($,Y=L$){if($==="all")k1.clear();else k1.clear();let Z=$==="all"?["image","video"]:[$];for(let X of Z){let Q=d3(Y.directory,X);try{await SJ(Q,{recursive:!0,force:!0})}catch{}}}var k1,L$;var F$=S(()=>{W1();k1=new Map,L$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class f5{config;constructor($={}){this.config={...CJ,...$}}async get($,Y){return P5($,Y,"image",this.config)}async set($,Y,Z){return C5($,Y,Z,"image",this.config)}async clear(){return v5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function V$($){if(!x5)x5=new f5($);else if($)x5.updateConfig($);return x5}async function g5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return V$(X).get($,Y)}async function h5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return V$(Q).set($,Y,Z)}async function u3(){return V$().clear()}var CJ,x5=null;var R$=S(()=>{F$();CJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as vJ,basename as xJ,extname as fJ,join as gJ}from"path";import{mkdir as hJ}from"fs/promises";async function N$(){try{return await import("ts-images")}catch{return null}}function l3($){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 dJ($,Y){let Z=Y?l3(Y):l3("web"),X=$.formatQuality||{};return{jpeg:{...Z.jpeg,...X.jpeg},png:{...Z.png,...X.png},webp:{...Z.webp,...X.webp},avif:{...Z.avif,...X.avif}}}async function p3($,Y,Z){let X=await N$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await g5($,Y,Z);if(Q)return Q;try{let J=vJ($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=dJ(Z,Y.preset),K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await hJ(K,{recursive:!0});let _=await A0(J),U=xJ($,fJ($)),W=Y.outputFormat?[Y.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:_},j=null;if(Y.transformations&&Y.transformations.length>0)j=await A$(J,Y.transformations,X);for(let z of W){let O=G[z]||{},L=`${U}-${_}.${z}`,F=gJ(K,L);try{let H=await X.optimizeImage({input:j||J,output:F,format:z,quality:O.quality,progressive:O.progressive});if(H){if(B.variants.push({path:F,url:`${q}/${L}`,width:H.width||0,height:H.height||0,format:z,size:H.outputSize||0}),!B.originalWidth&&H.width)B.originalWidth=H.width,B.originalHeight=H.height}}catch(H){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${z}: ${H}`)}}if(Y.embedThumbhash||Y.placeholder==="thumbhash")try{let z=await X.generateThumbHash(J);B.placeholder=z.dataUrl}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${z}`)}if(Y.useDominantColor)try{let z=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=z.dominantColor}catch(z){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${z}`)}return await h5($,Y,B,Z),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function c3($,Y,Z,X){let Q=await N$();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Y,quality:Z}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function A$($,Y,Z){let X=Z||await N$();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Y){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 i3=S(()=>{W1();R$()});import{resolve as mJ,basename as uJ,extname as lJ,join as pJ}from"path";import{mkdir as cJ}from"fs/promises";async function iJ(){try{return await import("ts-images")}catch{return null}}async function n3($,Y,Z){let X=await iJ();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=mJ($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Y.responsiveWidths||Z.breakpoints||nJ,G=Y.formats||Z.defaultFormats||["avif","webp","jpeg"],K=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await cJ(K,{recursive:!0});let _=await A0(Q),U=uJ($,lJ($)),W=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let z of G){B.byFormat[z]=[];let O=[];for(let L of J){let F=`${U}-${L}w-${_}.${z}`,H=pJ(K,F),V=`${q}/${F}`;try{let N=W[z]?.quality||80;if(await R0(H)){B.byFormat[z].push({path:H,url:V,width:L,height:0,format:z,size:0}),O.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:H,format:z,quality:N,resize:{width:L}});if(R)B.byFormat[z].push({path:H,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:z,size:R.outputSize||0}),O.push(`${V} ${L}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${z} at ${L}w: ${N}`)}}B.srcsets[z]=O.join(", ")}let j=Y.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let z=await X.generateThumbHash(Q);B.placeholder={dataURL:z.dataUrl,width:z.width||32,height:z.height||32,strategy:"thumbhash"}}else{let z=await X.generatePlaceholder(Q,{strategy:j,width:20});B.placeholder={dataURL:z.dataURL,width:z.width,height:z.height,strategy:j}}}catch(z){console.warn(`[stx-media] Failed to generate placeholder: ${z}`)}return B.sizes=Y.sizes||oJ(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function oJ($){let Y=[...$].sort((X,Q)=>X-Q),Z=[];for(let X=0;X<Y.length-1;X++){let Q=Y[X];Z.push(`(max-width: ${Q}px) ${Q}px`)}return Z.push(`${Y[Y.length-1]}px`),Z.join(", ")}function o3($,Y="width"){if(!$||$.length===0)return"";if(Y==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var nJ;var s3=S(()=>{W1();nJ=[320,480,640,768,1024,1280,1536,1920]});var r3={};r(r3,{setCachedImageResult:()=>h5,processImage:()=>p3,optimizeImage:()=>c3,getCachedImageResult:()=>g5,generateSrcset:()=>o3,generateResponsiveVariants:()=>n3,clearImageCache:()=>u3,applyTransformations:()=>A$,ImageProcessorCache:()=>f5});var a3=S(()=>{i3();s3();R$()});async function sJ(){try{return await Promise.resolve().then(() => (a3(),r3))}catch($){if(!t3)console.warn("[stx-media] Image processor not available, some features disabled:",$),t3=!0;return null}}async function d5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return eJ(X,Z)}if(Z.processedResult?.processed)return I$($,Z.processedResult,Y);if(Z.responsiveVariants)return Z6($,Z.responsiveVariants,Y);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=D1,dpr:U,formats:W=e1,quality:B=w$,params:j={},placeholder:z="none",placeholderOptions:O={},lazy:L=!0,priority:F=!1,loading:H=F?"eager":u5,decoding:V=m5,fetchpriority:N,objectFit:R,objectPosition:A,crossorigin:w,referrerpolicy:T}=$,D=$.class,I=$.style,M=$.id,E=$.data||{},{isDev:C=!1,baseUrl:P=""}=Y;if(C&&!Y.optimize)return tJ($);let k,b,x=M||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!F)try{k=await C3(Q,{strategy:z,...O}),b=P3(x,k,O)}catch{}let d=U!==void 0&&G!==void 0,s;if(d)s=aJ($,x,k,Y);else s=await rJ($,x,k,Y);let K0;if(F){let y0=W.includes("webp")?"webp":W[0],d0=_$(Q,_,{...j,q:B},y0),j0=typeof q==="object"?W$(q):q||"100vw";K0=`<link rel="preload" as="image" imagesrcset="${d0}" imagesizes="${j0}" />`}let z0=[];if(!e3&&z!=="none")z0.push(O$),e3=!0;if(b)z0.push(b);let _0=L?Y6(x):void 0;return{html:s,preloadLink:K0,css:z0.length>0?z0.join(`
2053
+ `):void 0,script:_0}}async function rJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:_=D1,formats:U=e1,quality:W=w$,params:B={},lazy:j=!0,priority:z=!1,loading:O=z?"eager":u5,decoding:L=m5,fetchpriority:F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R}=$,A=$.class,w=$.style,T=$.data||{},D=typeof q==="object"?W$(q):q||"100vw",I=[];for(let C of U){let P=_$(Q,_,{...B,q:W},C),k=B$(C);if(j&&!z)I.push(` <source type="${k}" data-srcset="${P}" data-sizes="${D}" />`);else I.push(` <source type="${k}" srcset="${P}" sizes="${D}" />`)}let M=T$({src:$5(Q,{...B,q:W}),alt:J,width:G,height:K,loading:z?void 0:O,decoding:L,fetchpriority:z?"high":F,objectFit:H,objectPosition:V,crossorigin:N,referrerpolicy:R,className:$6(A,Z),style:M$(w,H,V,Z),lazy:j&&!z,data:T}),E;if(Z){let C=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Y}" class="stx-img-placeholder" style="${C}">
2054
2054
  <picture>
2055
- ${M.join(`
2055
+ ${I.join(`
2056
2056
  `)}
2057
- <img ${E} />
2057
+ <img ${M} />
2058
2058
  </picture>
2059
- </div>`}else D=`<picture${Y?` id="${Y}"`:""}>
2060
- ${M.join(`
2059
+ </div>`}else E=`<picture${Y?` id="${Y}"`:""}>
2060
+ ${I.join(`
2061
2061
  `)}
2062
- <img ${E} />
2063
- </picture>`;return D}function aJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:_=w$,params:U={},lazy:W=!0,priority:B=!1,loading:j=B?"eager":u5,decoding:z=m5,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V}=$,N=$.class,R=$.style,A=$.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),T=y3(Q,w,q,{...U,q:_}),I=T$({src:$5(Q,{...U,w,q:_}),alt:J,width:G,height:K,loading:B?void 0:j,decoding:z,fetchpriority:B?"high":O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V,className:$6(N,Z),style:M$(R,L,F,Z),lazy:W&&!B,data:A}),M=W&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let E=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Y}" class="stx-img-placeholder" style="${E}">
2064
- <img ${I} ${M} />
2065
- </div>`}return`<img ${Y?`id="${Y}" `:""}${I} ${M} />`}function tJ($){let{src:Y,alt:Z,width:X,height:Q,loading:J=u5,decoding:G=m5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,priority:B=!1}=$,j=$.class,z=$.style,O=$.id,L=$.data||{};return{html:`<img ${T$({src:Y,alt:Z,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,className:j,style:M$(z,q,_),id:O,data:L})} />`}}function T$($){let Y=[];if($.lazy)Y.push(`data-src="${P0($.src)}"`),Y.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Y.push(`src="${P0($.src)}"`);if(Y.push(`alt="${P0($.alt)}"`),$.width)Y.push(`width="${$.width}"`);if($.height)Y.push(`height="${$.height}"`);if($.loading)Y.push(`loading="${$.loading}"`);if($.decoding)Y.push(`decoding="${$.decoding}"`);if($.fetchpriority)Y.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Y.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Y.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Y.push(`class="${P0($.className)}"`);if($.style)Y.push(`style="${P0($.style)}"`);if($.id)Y.push(`id="${P0($.id)}"`);if($.data)for(let[Z,X]of Object.entries($.data))Y.push(`data-${Z}="${P0(X)}"`);if($.lazy)Y.push("data-stx-lazy");return Y.join(" ")}function $6($,Y){let Z=[];if($)Z.push($);if(Y)Z.push("stx-img-blur");return Z.join(" ")||""}function M$($,Y,Z,X){let Q=[];if(Y)Q.push(`object-fit: ${Y}`);if(Z)Q.push(`object-position: ${Z}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y6($){return`
2062
+ <img ${M} />
2063
+ </picture>`;return E}function aJ($,Y,Z,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:_=w$,params:U={},lazy:W=!0,priority:B=!1,loading:j=B?"eager":u5,decoding:z=m5,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V}=$,N=$.class,R=$.style,A=$.data||{},w=typeof G==="number"?G:Number.parseInt(String(G),10),T=y3(Q,w,q,{...U,q:_}),D=T$({src:$5(Q,{...U,w,q:_}),alt:J,width:G,height:K,loading:B?void 0:j,decoding:z,fetchpriority:B?"high":O,objectFit:L,objectPosition:F,crossorigin:H,referrerpolicy:V,className:$6(N,Z),style:M$(R,L,F,Z),lazy:W&&!B,data:A}),I=W&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let M=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Y}" class="stx-img-placeholder" style="${M}">
2064
+ <img ${D} ${I} />
2065
+ </div>`}return`<img ${Y?`id="${Y}" `:""}${D} ${I} />`}function tJ($){let{src:Y,alt:Z,width:X,height:Q,loading:J=u5,decoding:G=m5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,priority:B=!1}=$,j=$.class,z=$.style,O=$.id,L=$.data||{};return{html:`<img ${T$({src:Y,alt:Z,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W,className:j,style:M$(z,q,_),id:O,data:L})} />`}}function T$($){let Y=[];if($.lazy)Y.push(`data-src="${P0($.src)}"`),Y.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Y.push(`src="${P0($.src)}"`);if(Y.push(`alt="${P0($.alt)}"`),$.width)Y.push(`width="${$.width}"`);if($.height)Y.push(`height="${$.height}"`);if($.loading)Y.push(`loading="${$.loading}"`);if($.decoding)Y.push(`decoding="${$.decoding}"`);if($.fetchpriority)Y.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Y.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Y.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Y.push(`class="${P0($.className)}"`);if($.style)Y.push(`style="${P0($.style)}"`);if($.id)Y.push(`id="${P0($.id)}"`);if($.data)for(let[Z,X]of Object.entries($.data))Y.push(`data-${Z}="${P0(X)}"`);if($.lazy)Y.push("data-stx-lazy");return Y.join(" ")}function $6($,Y){let Z=[];if($)Z.push($);if(Y)Z.push("stx-img-blur");return Z.join(" ")||""}function M$($,Y,Z,X){let Q=[];if(Y)Q.push(`object-fit: ${Y}`);if(Z)Q.push(`object-position: ${Z}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y6($){return`
2066
2066
  (function() {
2067
2067
  const container = document.getElementById('${$}');
2068
2068
  if (!container) return;
@@ -2099,21 +2099,21 @@ ${M.join(`
2099
2099
 
2100
2100
  observer.observe(container);
2101
2101
  })();
2102
- `.trim()}async function eJ($,Y){let Z=await sJ();if(!Z)return d5({...$,process:!1},Y);let X=Y.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Z.generateResponsiveVariants($.src,$,X);if(J)return Z6($,J,Y)}else{let J=await Z.processImage($.src,$,X);if(J.processed)return I$($,J,Y)}return d5({...$,process:!1},Y)}async function I$($,Y,Z){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W}=$,B=$.class,j=$.style,z=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},L=Y.variants||[],F=L.find((k)=>k.format==="jpeg")||L.find((k)=>k.format==="webp")||L[0],H=F?.url||$.src,V=L.filter((k)=>k.format===(F?.format||"jpeg")).map((k)=>`${k.url} ${k.width}w`).join(", "),N=new Map;for(let k of L){if(!N.has(k.format))N.set(k.format,[]);N.get(k.format).push(k)}let R=[],A=["avif","webp","jpeg","png"];for(let k of A){let g=N.get(k);if(g&&g.length>0){let h=g.map((U0)=>`${U0.url} ${U0.width}w`).join(", "),r=B$(k);if(G&&!K)R.push(` <source type="${r}" data-srcset="${h}" />`);else R.push(` <source type="${r}" srcset="${h}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${P0(H)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${P0(H)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${P0(X)}"`);let T=Q||Y.originalWidth,I=J||Y.originalHeight;if(T)w.push(`width="${T}"`);if(I)w.push(`height="${I}"`);if(!K)w.push(`loading="${G?"lazy":"eager"}"`);if(w.push('decoding="async"'),K)w.push('fetchpriority="high"');if(U)w.push(`crossorigin="${U}"`);if(W)w.push(`referrerpolicy="${W}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(_)M.push(`object-position: ${_}`);if(Y.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)w.push(`style="${M.join("; ")}"`);let E=[];if(B)E.push(B);if(Y.placeholder)E.push("stx-img-blur");if(E.length>0)w.push(`class="${E.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[k,g]of Object.entries(O))w.push(`data-${k}="${P0(g)}"`);let D;if(Y.placeholder||Y.dominantColor&&$.useDominantColor){let k=Y.placeholder?`background-image: url('${Y.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Y.dominantColor};`;D=`<div id="${z}" class="stx-img-placeholder" style="${k}">
2102
+ `.trim()}async function eJ($,Y){let Z=await sJ();if(!Z)return d5({...$,process:!1},Y);let X=Y.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Z.generateResponsiveVariants($.src,$,X);if(J)return Z6($,J,Y)}else{let J=await Z.processImage($.src,$,X);if(J.processed)return I$($,J,Y)}return d5({...$,process:!1},Y)}async function I$($,Y,Z){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:U,referrerpolicy:W}=$,B=$.class,j=$.style,z=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,O=$.data||{},L=Y.variants||[],F=L.find((b)=>b.format==="jpeg")||L.find((b)=>b.format==="webp")||L[0],H=F?.url||$.src,V=L.filter((b)=>b.format===(F?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),N=new Map;for(let b of L){if(!N.has(b.format))N.set(b.format,[]);N.get(b.format).push(b)}let R=[],A=["avif","webp","jpeg","png"];for(let b of A){let x=N.get(b);if(x&&x.length>0){let d=x.map((K0)=>`${K0.url} ${K0.width}w`).join(", "),s=B$(b);if(G&&!K)R.push(` <source type="${s}" data-srcset="${d}" />`);else R.push(` <source type="${s}" srcset="${d}" />`)}}let w=[];if(G&&!K){if(w.push(`data-src="${P0(H)}"`),w.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)w.push(`data-srcset="${V}"`)}else if(w.push(`src="${P0(H)}"`),V)w.push(`srcset="${V}"`);w.push(`alt="${P0(X)}"`);let T=Q||Y.originalWidth,D=J||Y.originalHeight;if(T)w.push(`width="${T}"`);if(D)w.push(`height="${D}"`);if(!K)w.push(`loading="${G?"lazy":"eager"}"`);if(w.push('decoding="async"'),K)w.push('fetchpriority="high"');if(U)w.push(`crossorigin="${U}"`);if(W)w.push(`referrerpolicy="${W}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(_)I.push(`object-position: ${_}`);if(Y.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(j)I.push(j);if(I.length>0)w.push(`style="${I.join("; ")}"`);let M=[];if(B)M.push(B);if(Y.placeholder)M.push("stx-img-blur");if(M.length>0)w.push(`class="${M.join(" ")}"`);if(G&&!K)w.push("data-stx-lazy");for(let[b,x]of Object.entries(O))w.push(`data-${b}="${P0(x)}"`);let E;if(Y.placeholder||Y.dominantColor&&$.useDominantColor){let b=Y.placeholder?`background-image: url('${Y.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Y.dominantColor};`;E=`<div id="${z}" class="stx-img-placeholder" style="${b}">
2103
2103
  <picture>
2104
2104
  ${R.join(`
2105
2105
  `)}
2106
2106
  <img ${w.join(" ")} />
2107
2107
  </picture>
2108
- </div>`}else D=`<picture${z?` id="${z}"`:""}>
2108
+ </div>`}else E=`<picture${z?` id="${z}"`:""}>
2109
2109
  ${R.join(`
2110
2110
  `)}
2111
2111
  <img ${w.join(" ")} />
2112
- </picture>`;let P=[];if(Y.placeholder)P.push(O$);let y=G?Y6(z):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:P.length>0?P.join(`
2113
- `):void 0,script:y}}async function Z6($,Y,Z){let X={src:Y.src,processed:!0,variants:[],placeholder:Y.placeholder?.dataURL,originalWidth:Y.placeholder?.width,originalHeight:Y.placeholder?.height};for(let[Q,J]of Object.entries(Y.byFormat))if(J)X.variants.push(...J);return I$($,X,Z)}var t3=!1,w$=80,m5="async",u5="lazy",e3=!1;var X6=b(()=>{z$();v3()});function $Q(){return S5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Y,Z,X)=>{let{src:Q,alt:J,options:G}=YQ($,Y,Z);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||D1,formats:G.formats||e1,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=Z.__isDev||!1,_=await d5(K,{isDev:q}),U=_.html;if(_.preloadLink)U=_.preloadLink+`
2112
+ </picture>`;let C=[];if(Y.placeholder)C.push(O$);let P=G?Y6(z):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:C.length>0?C.join(`
2113
+ `):void 0,script:P}}async function Z6($,Y,Z){let X={src:Y.src,processed:!0,variants:[],placeholder:Y.placeholder?.dataURL,originalWidth:Y.placeholder?.width,originalHeight:Y.placeholder?.height};for(let[Q,J]of Object.entries(Y.byFormat))if(J)X.variants.push(...J);return I$($,X,Z)}var t3=!1,w$=80,m5="async",u5="lazy",e3=!1;var X6=S(()=>{z$();v3()});function $Q(){return S5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Y,Z,X)=>{let{src:Q,alt:J,options:G}=YQ($,Y,Z);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||D1,formats:G.formats||e1,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=Z.__isDev||!1,_=await d5(K,{isDev:q}),U=_.html;if(_.preloadLink)U=_.preloadLink+`
2114
2114
  `+U;if(_.css)U+=`
2115
2115
  <style>${_.css}</style>`;if(_.script)U+=`
2116
- <script>${_.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function YQ($,Y,Z){if(Y.src)return{src:String(Y.src),alt:String(Y.alt||""),options:Y.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=ZQ(X),J=E$(Q[0],Z)||"",G=E$(Q[1],Z)||"",K={};if(Q[2]){let q=E$(Q[2],Z);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 ZQ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function E$($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var J6;var Q6=b(()=>{U$();X6();z$();J6=$Q()});class p5{config;constructor($={}){this.config={...XQ,...$}}async get($,Y){return P5($,Y,"video",this.config)}async set($,Y,Z){return C5($,Y,Z,"video",this.config)}async clear(){return v5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function D$($){if(!l5)l5=new p5($);else if($)l5.updateConfig($);return l5}async function c5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return D$(X).get($,Y)}async function i5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return D$(Q).set($,Y,Z)}async function G6(){return D$().clear()}var XQ,l5=null;var k$=b(()=>{F$();XQ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as b$,basename as S$,extname as y$,join as n5}from"path";import{mkdir as P$}from"fs/promises";async function C$(){try{return await import("ts-videos")}catch{return null}}async function o5($,Y,Z,X){let Q=await C$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=b$($);if(!await R0(J))return null;await P$(Z,{recursive:!0});let G=await A0(J),K=S$($,y$($)),q=Y.format||"webp",_=Y.timestamp||0,U=`${K}-poster-${G}.${q}`,W=n5(Z,U),B=await Q.extractThumbnails(J,{timestamps:[_],width:Y.width||1280,height:Y.height,format:q,quality:Y.quality||85,outputDir:Z,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let j=B[0];return{path:W,url:`${X}/${U}`,width:j.width||Y.width||1280,height:j.height||720,timestamp:_,size:j.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function s5($,Y,Z,X){let Q=await C$();if(!Q)return[];try{let J=b$($);if(!await R0(J))return[];await P$(Z,{recursive:!0});let G=await A0(J),K=S$($,y$($)),q=Y.format||"webp",W=(await new Q.Input(J).getInfo()).duration||60,B=Y.count||10,j=Y.interval||W/B,z=[];for(let L=0;L<B&&L*j<W;L++)z.push(L*j);let O=await Q.extractThumbnails(J,{timestamps:z,width:Y.width||320,format:q,quality:Y.quality||80,outputDir:Z,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((L,F)=>({path:L.path||n5(Z,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Y.width||320,height:L.height||180,timestamp:z[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function K6($,Y,Z,X){let Q=await C$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=b$($);if(!await R0(J))return null;await P$(Z,{recursive:!0});let G=await A0(J),K=S$($,y$($)),U=(await new Q.Input(J).getInfo()).duration||60,W=Y.columns||10,B=Y.interval||5,j=Y.thumbnailWidth||160,z=Y.thumbnailHeight||90,O=Y.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/W),H=`${K}-sprite-${G}.${O}`,V=n5(Z,H),N=[];for(let A=0;A<L;A++)N.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:N,width:j,height:z,format:O,quality:Y.quality||70,outputDir:n5(Z,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),w=W*j,T=F*z,I=await A.createSprite({images:R.map((M)=>M.path),columns:W,padding:0,outputPath:V,format:O,quality:Y.quality||70});return{url:`${X}/${H}`,path:V,columns:W,rows:F,thumbnailWidth:j,thumbnailHeight:z,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 v$=b(()=>{W1()});import{resolve as U6,basename as _6,extname as W6,join as B1}from"path";import{mkdir as r5,writeFile as B6}from"fs/promises";async function z6(){try{return await import("ts-videos")}catch{return null}}async function a5($,Y,Z,X,Q){let J=await z6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=U6($);if(!await R0(G))return null;let K=await A0(G),q=_6($,W6($)),_=B1(Z,`${q}-${K}-hls`);await r5(_,{recursive:!0});let U=Y.length>0?Y:j6,W=Q?.segmentDuration||6,z=(await new J.Input(G).getInfo()).duration||0,O=[],L=0;for(let V of U){let N=B1(_,V.label);await r5(N,{recursive:!0});let R=`${V.label}.m3u8`,A=B1(N,R);try{let w=await J.generateHLS(G,{outputDir:N,segmentDuration:W,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)O.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=w.segmentCount||Math.ceil(z/W)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(O.length===0)return null;let F=B1(_,"master.m3u8"),H=JQ(O,X,q,K);return await B6(F,H),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:O,segmentCount:L,duration:z}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function JQ($,Y,Z,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(`
2116
+ <script>${_.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function YQ($,Y,Z){if(Y.src)return{src:String(Y.src),alt:String(Y.alt||""),options:Y.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=ZQ(X),J=E$(Q[0],Z)||"",G=E$(Q[1],Z)||"",K={};if(Q[2]){let q=E$(Q[2],Z);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 ZQ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function E$($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var J6;var Q6=S(()=>{U$();X6();z$();J6=$Q()});class p5{config;constructor($={}){this.config={...XQ,...$}}async get($,Y){return P5($,Y,"video",this.config)}async set($,Y,Z){return C5($,Y,Z,"video",this.config)}async clear(){return v5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function D$($){if(!l5)l5=new p5($);else if($)l5.updateConfig($);return l5}async function c5($,Y,Z){let X=Z?{directory:`${Z.outputDir}/../.cache`}:{};return D$(X).get($,Y)}async function i5($,Y,Z,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return D$(Q).set($,Y,Z)}async function G6(){return D$().clear()}var XQ,l5=null;var k$=S(()=>{F$();XQ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as b$,basename as S$,extname as y$,join as n5}from"path";import{mkdir as P$}from"fs/promises";async function C$(){try{return await import("ts-videos")}catch{return null}}async function o5($,Y,Z,X){let Q=await C$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=b$($);if(!await R0(J))return null;await P$(Z,{recursive:!0});let G=await A0(J),K=S$($,y$($)),q=Y.format||"webp",_=Y.timestamp||0,U=`${K}-poster-${G}.${q}`,W=n5(Z,U),B=await Q.extractThumbnails(J,{timestamps:[_],width:Y.width||1280,height:Y.height,format:q,quality:Y.quality||85,outputDir:Z,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let j=B[0];return{path:W,url:`${X}/${U}`,width:j.width||Y.width||1280,height:j.height||720,timestamp:_,size:j.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function s5($,Y,Z,X){let Q=await C$();if(!Q)return[];try{let J=b$($);if(!await R0(J))return[];await P$(Z,{recursive:!0});let G=await A0(J),K=S$($,y$($)),q=Y.format||"webp",W=(await new Q.Input(J).getInfo()).duration||60,B=Y.count||10,j=Y.interval||W/B,z=[];for(let L=0;L<B&&L*j<W;L++)z.push(L*j);let O=await Q.extractThumbnails(J,{timestamps:z,width:Y.width||320,format:q,quality:Y.quality||80,outputDir:Z,outputPattern:`${K}-thumb-${G}`});if(O&&O.length>0)return O.map((L,F)=>({path:L.path||n5(Z,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Y.width||320,height:L.height||180,timestamp:z[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function K6($,Y,Z,X){let Q=await C$();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=b$($);if(!await R0(J))return null;await P$(Z,{recursive:!0});let G=await A0(J),K=S$($,y$($)),U=(await new Q.Input(J).getInfo()).duration||60,W=Y.columns||10,B=Y.interval||5,j=Y.thumbnailWidth||160,z=Y.thumbnailHeight||90,O=Y.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/W),H=`${K}-sprite-${G}.${O}`,V=n5(Z,H),N=[];for(let A=0;A<L;A++)N.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:N,width:j,height:z,format:O,quality:Y.quality||70,outputDir:n5(Z,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),w=W*j,T=F*z,D=await A.createSprite({images:R.map((I)=>I.path),columns:W,padding:0,outputPath:V,format:O,quality:Y.quality||70});return{url:`${X}/${H}`,path:V,columns:W,rows:F,thumbnailWidth:j,thumbnailHeight:z,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 v$=S(()=>{W1()});import{resolve as U6,basename as _6,extname as W6,join as B1}from"path";import{mkdir as r5,writeFile as B6}from"fs/promises";async function z6(){try{return await import("ts-videos")}catch{return null}}async function a5($,Y,Z,X,Q){let J=await z6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=U6($);if(!await R0(G))return null;let K=await A0(G),q=_6($,W6($)),_=B1(Z,`${q}-${K}-hls`);await r5(_,{recursive:!0});let U=Y.length>0?Y:j6,W=Q?.segmentDuration||6,z=(await new J.Input(G).getInfo()).duration||0,O=[],L=0;for(let V of U){let N=B1(_,V.label);await r5(N,{recursive:!0});let R=`${V.label}.m3u8`,A=B1(N,R);try{let w=await J.generateHLS(G,{outputDir:N,segmentDuration:W,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(w)O.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=w.segmentCount||Math.ceil(z/W)}catch(w){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${w}`)}}if(O.length===0)return null;let F=B1(_,"master.m3u8"),H=JQ(O,X,q,K);return await B6(F,H),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:O,segmentCount:L,duration:z}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function JQ($,Y,Z,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(`
2117
2117
  `)}async function t5($,Y,Z,X,Q){let J=await z6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=U6($);if(!await R0(G))return null;let K=await A0(G),q=_6($,W6($)),_=B1(Z,`${q}-${K}-dash`);await r5(_,{recursive:!0});let U=Y.length>0?Y:j6,W=Q?.segmentDuration||4,B=Q?.minBufferTime||2,O=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of U){let A=B1(_,R.label);await r5(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:W,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(w){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${w}`)}}if(L.length===0)return null;let H=B1(_,"manifest.mpd"),V=QQ(L,F,O,W,B);await B6(H,V);let N=[{type:"video",representations:L}];if(F.length>0)N.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:H,adaptationSets:N,duration:O}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function QQ($,Y,Z,X,Q){let J=q6(Z),G=q6(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
2118
2118
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
2119
2119
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -2140,13 +2140,13 @@ ${R.join(`
2140
2140
  </Representation>
2141
2141
  `}K+=` </AdaptationSet>
2142
2142
  `}return K+=` </Period>
2143
- </MPD>`,K}function q6($){let Y=Math.floor($/3600),Z=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Y>0)Q+=`${Y}H`;if(Z>0)Q+=`${Z}M`;return Q+=`${X}S`,Q}var j6;var x$=b(()=>{W1();j6=[{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 O6,basename as GQ,extname as KQ,join as qQ}from"path";import{mkdir as UQ}from"fs/promises";async function H6(){try{return await import("ts-videos")}catch{return null}}function _Q($){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 WQ($){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 f$($){let Y=await H6();if(!Y)return null;try{let Z=O6($),Q=await new Y.Input(Z).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(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function L6($,Y,Z,X){let Q=await H6();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await c5($,Y,Z);if(J)return J;try{let G=O6($);if(!await R0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await UQ(K,{recursive:!0});let _=await A0(G),U=GQ($,KQ($)),W={src:$,processed:!0,hash:_};X?.({percentage:5,stage:"analyzing"}),W.metadata=await f$(G)||void 0;let B={};if(Y.quality)B.bitrate=_Q(Y.quality);if(Y.platform)Object.assign(B,WQ(Y.platform));if(Y.transcode)Object.assign(B,Y.transcode);if(Object.keys(B).length>0||Y.process){X?.({percentage:10,stage:"transcoding"});let j=`${U}-${_}.mp4`,z=qQ(K,j);try{let O=await BQ(G,z,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(O)W.transcoded={path:z,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:B.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(O){W.errors=W.errors||[],W.errors.push(`Transcoding failed: ${O}`)}}if(Y.generatePoster){X?.({percentage:65,stage:"generating-poster"});let j=typeof Y.generatePoster==="object"?Y.generatePoster:{timestamp:0},z=await o5(G,j,K,q);if(z)W.poster=z}if(Z.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let j=await s5(G,Z.thumbnails,K,q);if(j.length>0)W.thumbnails=j}if(Y.streaming){X?.({percentage:80,stage:"generating-manifests"});let j=typeof Y.streaming==="object"?Y.streaming:Z.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let z=await a5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,hls:z}}if(j.format==="dash"){let z=await t5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,dash:z}}}if(Y.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await i5($,Y,W,Z),W}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function BQ($,Y,Z,X,Q){try{let G=await new X.Conversion($,Y,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Z.maxWidth||0,height:G.height||Z.maxHeight||0,bitrate:G.bitrate||Z.bitrate||0,frameRate:G.frameRate||Z.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var F6=b(()=>{W1();k$();v$();x$()});var V6={};s(V6,{setCachedVideoResult:()=>i5,processVideo:()=>L6,getCachedVideoResult:()=>c5,generateThumbnails:()=>s5,generateSpriteSheet:()=>K6,generatePoster:()=>o5,generateHLSManifest:()=>a5,generateDASHManifest:()=>t5,clearVideoCache:()=>G6,analyzeVideo:()=>f$,VideoProcessorCache:()=>p5});var R6=b(()=>{F6();v$();x$();k$()});async function A6(){try{return await Promise.resolve().then(() => (R6(),V6))}catch($){if(!N6)console.warn("[stx-media] Video processor not available, some features disabled:",$),N6=!0;return null}}async function e5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return FQ(X,Z)}if(Z.processedResult?.processed)return I6($,Z.processedResult,Y);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await VQ(X,Z);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:_=w6,autoplay:U=!1,muted:W=!1,loop:B=!1,preload:j=T6,playsinline:z=!0,lazy:O=!0,player:L="native",type:F,width:H,height:V,crossorigin:N,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,w=Q||K,T=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return OQ($,Y);if(F&&F!=="video")return jQ(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:M6(J)}]:[],D=[`id="${M}"`];if(_)D.push("controls");if(U)D.push("autoplay");if(W)D.push("muted");if(B)D.push("loop");if(z)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(A)D.push("disableremoteplayback");if(N)D.push(`crossorigin="${N}"`);if(O){if(D.push(`data-preload="${j}"`),D.push('preload="none"'),w)D.push(`data-poster="${B0(w)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${j}"`),w)D.push(`poster="${B0(w)}"`);if(H)D.push(`width="${H}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${B0(T)}"`);if(I)D.push(`style="${B0(I)}"`);let P=E.map((k)=>{return` <source ${O?`data-src="${B0(k.src)}"`:`src="${B0(k.src)}"`} type="${k.type}"${k.media?` media="${k.media}"`:""} />`}).join(`
2144
- `),y=`<video ${D.join(" ")}>
2145
- ${P}
2143
+ </MPD>`,K}function q6($){let Y=Math.floor($/3600),Z=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Y>0)Q+=`${Y}H`;if(Z>0)Q+=`${Z}M`;return Q+=`${X}S`,Q}var j6;var x$=S(()=>{W1();j6=[{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 O6,basename as GQ,extname as KQ,join as qQ}from"path";import{mkdir as UQ}from"fs/promises";async function H6(){try{return await import("ts-videos")}catch{return null}}function _Q($){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 WQ($){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 f$($){let Y=await H6();if(!Y)return null;try{let Z=O6($),Q=await new Y.Input(Z).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(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function L6($,Y,Z,X){let Q=await H6();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await c5($,Y,Z);if(J)return J;try{let G=O6($);if(!await R0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await UQ(K,{recursive:!0});let _=await A0(G),U=GQ($,KQ($)),W={src:$,processed:!0,hash:_};X?.({percentage:5,stage:"analyzing"}),W.metadata=await f$(G)||void 0;let B={};if(Y.quality)B.bitrate=_Q(Y.quality);if(Y.platform)Object.assign(B,WQ(Y.platform));if(Y.transcode)Object.assign(B,Y.transcode);if(Object.keys(B).length>0||Y.process){X?.({percentage:10,stage:"transcoding"});let j=`${U}-${_}.mp4`,z=qQ(K,j);try{let O=await BQ(G,z,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(O)W.transcoded={path:z,url:`${q}/${j}`,duration:O.duration,size:O.size,video:{codec:B.codec||"h264",width:O.width,height:O.height,bitrate:O.bitrate,frameRate:O.frameRate},audio:O.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(O){W.errors=W.errors||[],W.errors.push(`Transcoding failed: ${O}`)}}if(Y.generatePoster){X?.({percentage:65,stage:"generating-poster"});let j=typeof Y.generatePoster==="object"?Y.generatePoster:{timestamp:0},z=await o5(G,j,K,q);if(z)W.poster=z}if(Z.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let j=await s5(G,Z.thumbnails,K,q);if(j.length>0)W.thumbnails=j}if(Y.streaming){X?.({percentage:80,stage:"generating-manifests"});let j=typeof Y.streaming==="object"?Y.streaming:Z.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let z=await a5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,hls:z}}if(j.format==="dash"){let z=await t5(G,j.qualities||Z.streaming?.defaultQualities||[],K,q);if(z)W.streaming={...W.streaming,dash:z}}}if(Y.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await i5($,Y,W,Z),W}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function BQ($,Y,Z,X,Q){try{let G=await new X.Conversion($,Y,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Z.maxWidth||0,height:G.height||Z.maxHeight||0,bitrate:G.bitrate||Z.bitrate||0,frameRate:G.frameRate||Z.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var F6=S(()=>{W1();k$();v$();x$()});var V6={};r(V6,{setCachedVideoResult:()=>i5,processVideo:()=>L6,getCachedVideoResult:()=>c5,generateThumbnails:()=>s5,generateSpriteSheet:()=>K6,generatePoster:()=>o5,generateHLSManifest:()=>a5,generateDASHManifest:()=>t5,clearVideoCache:()=>G6,analyzeVideo:()=>f$,VideoProcessorCache:()=>p5});var R6=S(()=>{F6();v$();x$();k$()});async function A6(){try{return await Promise.resolve().then(() => (R6(),V6))}catch($){if(!N6)console.warn("[stx-media] Video processor not available, some features disabled:",$),N6=!0;return null}}async function e5($,Y={}){let Z=Y,X=$;if(X.process&&!X.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return FQ(X,Z)}if(Z.processedResult?.processed)return I6($,Z.processedResult,Y);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await VQ(X,Z);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:_=w6,autoplay:U=!1,muted:W=!1,loop:B=!1,preload:j=T6,playsinline:z=!0,lazy:O=!0,player:L="native",type:F,width:H,height:V,crossorigin:N,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,w=Q||K,T=$.class,D=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return OQ($,Y);if(F&&F!=="video")return jQ(J||"",F,$);let M=G.length>0?G:J?[{src:J,type:M6(J)}]:[],E=[`id="${I}"`];if(_)E.push("controls");if(U)E.push("autoplay");if(W)E.push("muted");if(B)E.push("loop");if(z)E.push("playsinline");if(R)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(N)E.push(`crossorigin="${N}"`);if(O){if(E.push(`data-preload="${j}"`),E.push('preload="none"'),w)E.push(`data-poster="${B0(w)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${j}"`),w)E.push(`poster="${B0(w)}"`);if(H)E.push(`width="${H}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${B0(T)}"`);if(D)E.push(`style="${B0(D)}"`);let C=M.map((b)=>{return` <source ${O?`data-src="${B0(b.src)}"`:`src="${B0(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
2144
+ `),P=`<video ${E.join(" ")}>
2145
+ ${C}
2146
2146
  Your browser does not support the video tag.
2147
- </video>`,S;if(O)S=`
2147
+ </video>`,k;if(O)k=`
2148
2148
  (function() {
2149
- var video = document.getElementById('${M}');
2149
+ var video = document.getElementById('${I}');
2150
2150
  if (!video) return;
2151
2151
 
2152
2152
  var observer = new IntersectionObserver(function(entries) {
@@ -2179,7 +2179,7 @@ ${P}
2179
2179
 
2180
2180
  observer.observe(video);
2181
2181
  })();
2182
- `.trim();return{html:y,script:S}}function jQ($,Y,Z){let{width:X=640,height:Q=360}=Z,J=Z.class,G=Z.style,K=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Y){case"youtube":_=HQ($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=LQ($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${B0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${B0(J)}"`);if(G)U.push(`style="${B0(G)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2182
+ `.trim();return{html:P,script:k}}function jQ($,Y,Z){let{width:X=640,height:Q=360}=Z,J=Z.class,G=Z.style,K=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Y){case"youtube":_=HQ($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=LQ($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${B0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${B0(J)}"`);if(G)U.push(`style="${B0(G)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2183
2183
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2184
2184
  </div>`}}function OQ($,Y={}){let{src:Z,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:U=!0,lazy:W=!0,width:B,height:j}=$,z=$.class,O=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Z,autoplay:G,loop:q,muted:K,playsinline:U,preload:_,poster:Q,controls:J,title:$.title},H=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",O||""].filter(Boolean).join("; "),V=`
2185
2185
  <div
@@ -2348,12 +2348,12 @@ else {
2348
2348
  .ts-video-player__play-button svg {
2349
2349
  margin-left: 4px;
2350
2350
  }
2351
- `.trim();return{html:V,script:N,css:R}}function M6($){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 HQ($){let Y=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of Y){let X=$.match(Z);if(X)return X[1]}return null}function LQ($){let Y=$.match(/vimeo\.com\/(\d+)/);return Y?Y[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function FQ($,Y){let Z=await A6();if(!Z)return e5({...$,process:!1},Y);let X=Y.tsVideosConfig,Q=await Z.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return I6($,Q,Y);return e5({...$,process:!1},Y)}async function VQ($,Y){let Z=await A6();if(!Z||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Y.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function I6($,Y,Z){let{controls:X=w6,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=T6,playsinline:q=!0,lazy:_=!0,width:U,height:W,crossorigin:B,disablePictureInPicture:j=!1,disableRemotePlayback:z=!1}=$,O=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=M6(H);if(Y.transcoded)H=Y.transcoded.url,V="video/mp4";let N=Y.streaming?.hls||Y.streaming?.dash;if(N){if(Y.streaming?.hls)H=Y.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Y.streaming?.dash)H=Y.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Y.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(j)A.push("disablepictureinpicture");if(z)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(_){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${B0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${B0(R)}"`);let w=U||Y.metadata?.width,T=W||Y.metadata?.height;if(w)A.push(`width="${w}"`);if(T)A.push(`height="${T}"`);if(O)A.push(`class="${B0(O)}"`);if(L)A.push(`style="${B0(L)}"`);let M=` <source ${_?`data-src="${B0(H)}"`:`src="${B0(H)}"`} type="${V}" />`,E=`<video ${A.join(" ")}>
2352
- ${M}
2351
+ `.trim();return{html:V,script:N,css:R}}function M6($){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 HQ($){let Y=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of Y){let X=$.match(Z);if(X)return X[1]}return null}function LQ($){let Y=$.match(/vimeo\.com\/(\d+)/);return Y?Y[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function FQ($,Y){let Z=await A6();if(!Z)return e5({...$,process:!1},Y);let X=Y.tsVideosConfig,Q=await Z.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return I6($,Q,Y);return e5({...$,process:!1},Y)}async function VQ($,Y){let Z=await A6();if(!Z||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Y.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function I6($,Y,Z){let{controls:X=w6,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=T6,playsinline:q=!0,lazy:_=!0,width:U,height:W,crossorigin:B,disablePictureInPicture:j=!1,disableRemotePlayback:z=!1}=$,O=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,H=$.src,V=M6(H);if(Y.transcoded)H=Y.transcoded.url,V="video/mp4";let N=Y.streaming?.hls||Y.streaming?.dash;if(N){if(Y.streaming?.hls)H=Y.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Y.streaming?.dash)H=Y.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Y.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(j)A.push("disablepictureinpicture");if(z)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(_){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${B0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${B0(R)}"`);let w=U||Y.metadata?.width,T=W||Y.metadata?.height;if(w)A.push(`width="${w}"`);if(T)A.push(`height="${T}"`);if(O)A.push(`class="${B0(O)}"`);if(L)A.push(`style="${B0(L)}"`);let I=` <source ${_?`data-src="${B0(H)}"`:`src="${B0(H)}"`} type="${V}" />`,M=`<video ${A.join(" ")}>
2352
+ ${I}
2353
2353
  Your browser does not support the video tag.
2354
- </video>`;if(Y.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Y.spriteSheet.url)}" data-sprite-cols="${Y.spriteSheet.columns}" data-sprite-interval="${Y.spriteSheet.interval}">
2355
- ${E}
2356
- </div>`;let D;if(_)D=`
2354
+ </video>`;if(Y.spriteSheet)M=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Y.spriteSheet.url)}" data-sprite-cols="${Y.spriteSheet.columns}" data-sprite-interval="${Y.spriteSheet.interval}">
2355
+ ${M}
2356
+ </div>`;let E;if(_)E=`
2357
2357
  (function() {
2358
2358
  var video = document.getElementById('${F}');
2359
2359
  if (!video) return;
@@ -2388,7 +2388,7 @@ ${E}
2388
2388
 
2389
2389
  observer.observe(video);
2390
2390
  })();
2391
- `.trim();let P;if(N)P=`
2391
+ `.trim();let C;if(N)C=`
2392
2392
  .stx-video-wrapper {
2393
2393
  position: relative;
2394
2394
  width: 100%;
@@ -2397,9 +2397,9 @@ ${E}
2397
2397
  width: 100%;
2398
2398
  height: auto;
2399
2399
  }
2400
- `.trim();return{html:E,script:D,css:P}}var N6=!1,w6=!0,T6="metadata",zQ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var E6=b(()=>{h$()});function D6(){return S5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Y,Z,X)=>{let{src:Q,options:J}=RQ($,Y,Z);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},_=await e5(G,q),U=_.html;if(_.css)U+=`
2400
+ `.trim();return{html:M,script:E,css:C}}var N6=!1,w6=!0,T6="metadata",zQ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var E6=S(()=>{h$()});function D6(){return S5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Y,Z,X)=>{let{src:Q,options:J}=RQ($,Y,Z);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},_=await e5(G,q),U=_.html;if(_.css)U+=`
2401
2401
  <style>${_.css}</style>`;if(_.script)U+=`
2402
- <script>${_.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function RQ($,Y,Z){if(Y.src)return{src:String(Y.src),options:Y.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=NQ(X),J=k6(Q[0],Z)||"",G={};if(Q[1]){let K=k6(Q[1],Z);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function NQ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function k6($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var g$;var h$=b(()=>{U$();E6();g$=D6()});function AQ($,Y){let Z=Y.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2402
+ <script>${_.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function RQ($,Y,Z){if(Y.src)return{src:String(Y.src),options:Y.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=NQ(X),J=k6(Q[0],Z)||"",G={};if(Q[1]){let K=k6(Q[1],Z);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function NQ($){let Y=[],Z="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Z+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Y.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())Y.push(Z.trim());return Y}function k6($,Y){if(typeof $!=="string")return $;let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let X=Y[Z];if(X!==void 0)return X}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var g$;var h$=S(()=>{U$();E6();g$=D6()});function AQ($,Y){let Z=Y.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2403
2403
  ${$}
2404
2404
  </div>
2405
2405
  <script>
@@ -2698,7 +2698,7 @@ catch (error) {
2698
2698
  init();
2699
2699
  }
2700
2700
  })();
2701
- </script>`}function NB($){return[...$,...d$]}var IQ,EQ,DQ,kQ,d$;var m$=b(()=>{IQ={name:"pwa.installButton",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return AQ($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},EQ={name:"pwa.updatePrompt",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return wQ($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},DQ={name:"pwa.offlineIndicator",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return TQ($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},kQ={name:"pwa.pushSubscribe",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return MQ($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},d$=[IQ,EQ,DQ,kQ]});function u$($){for(let[Y,Z]of Object.entries(l))if(Z===$)return Y;return}var l;var $9=b(()=>{l={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 bQ(){return!1}function Y5(){return!bQ()||process.env.STX_DEBUG==="true"}import SQ from"path";function Y9(){return{...l$}}function Z9($){if(!l$.showRelativePaths||!$)return $;let Y=l$.baseDir||process.cwd();try{let Z=SQ.relative(Y,$);return Z.startsWith("..")?$:Z}catch{return $}}var yQ,l$,X9,z1,J9;var Q9=b(()=>{$9();yQ={showRelativePaths:!1,enableAutoRecovery:Y5(),logRecoveryWarnings:!0},l$={...yQ};X9=class X9 extends Error{code;filePath;line;column;context;numericCode;constructor($,Y,Z,X,Q,J,G){super($);this.code=Y;this.filePath=Z;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=Z9(this.filePath)}};z1=class z1 extends X9{constructor($,Y,Z,X,Q,J){super($,"stx_RUNTIME_ERROR",Y,Z,X,Q,J||l.EVALUATION_ERROR);this.name="StxRuntimeError"}};J9=class J9 extends X9{isFatal=!0;constructor($,Y,Z,X,Q,J){super($,"stx_VALIDATION_ERROR",Y,Z,X,Q,J||l.DOM_API_VIOLATION);this.name="StxValidationError"}}});function S6($){let{type:Y,message:Z,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:_,suggestion:U,format:W="text"}=$,B=J,j=G;if(!B&&K&&q!==void 0){let H=gQ(K,q);B=H.line,j=H.column}let z=Q?Z9(Q):void 0,O=X?u$(X):void 0,L={type:Y,code:X,codeName:O,message:Z,filePath:z,line:B,column:j,snippet:_,suggestion:U,timestamp:new Date().toISOString()},F;switch(W){case"html":F=CQ(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=vQ(L,K,q);break;case"text":default:F=PQ(L,K,q);break}return{formatted:F,data:L}}function PQ($,Y,Z){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(`
2701
+ </script>`}function NB($){return[...$,...d$]}var IQ,EQ,DQ,kQ,d$;var m$=S(()=>{IQ={name:"pwa.installButton",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return AQ($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},EQ={name:"pwa.updatePrompt",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return wQ($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},DQ={name:"pwa.offlineIndicator",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return TQ($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},kQ={name:"pwa.pushSubscribe",handler:($,Y,Z,X)=>{let Q=Z.__stx_options||{};return MQ($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},d$=[IQ,EQ,DQ,kQ]});function u$($){for(let[Y,Z]of Object.entries(l))if(Z===$)return Y;return}var l;var $9=S(()=>{l={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 bQ(){return!1}function Y5(){return!bQ()||process.env.STX_DEBUG==="true"}import SQ from"path";function Y9(){return{...l$}}function Z9($){if(!l$.showRelativePaths||!$)return $;let Y=l$.baseDir||process.cwd();try{let Z=SQ.relative(Y,$);return Z.startsWith("..")?$:Z}catch{return $}}var yQ,l$,X9,z1,J9;var Q9=S(()=>{$9();yQ={showRelativePaths:!1,enableAutoRecovery:Y5(),logRecoveryWarnings:!0},l$={...yQ};X9=class X9 extends Error{code;filePath;line;column;context;numericCode;constructor($,Y,Z,X,Q,J,G){super($);this.code=Y;this.filePath=Z;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||l.EVALUATION_ERROR,this.filePath)this.filePath=Z9(this.filePath)}};z1=class z1 extends X9{constructor($,Y,Z,X,Q,J){super($,"stx_RUNTIME_ERROR",Y,Z,X,Q,J||l.EVALUATION_ERROR);this.name="StxRuntimeError"}};J9=class J9 extends X9{isFatal=!0;constructor($,Y,Z,X,Q,J){super($,"stx_VALIDATION_ERROR",Y,Z,X,Q,J||l.DOM_API_VIOLATION);this.name="StxValidationError"}}});function S6($){let{type:Y,message:Z,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:_,suggestion:U,format:W="text"}=$,B=J,j=G;if(!B&&K&&q!==void 0){let H=gQ(K,q);B=H.line,j=H.column}let z=Q?Z9(Q):void 0,O=X?u$(X):void 0,L={type:Y,code:X,codeName:O,message:Z,filePath:z,line:B,column:j,snippet:_,suggestion:U,timestamp:new Date().toISOString()},F;switch(W){case"html":F=CQ(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=vQ(L,K,q);break;case"text":default:F=PQ(L,K,q);break}return{formatted:F,data:L}}function PQ($,Y,Z){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(`
2702
2702
  ${$.message}`),Y&&$.line){let J=xQ(Y,$.line,2);if(J)X.push(`
2703
2703
  ${J}`)}if($.snippet)X.push(`
2704
2704
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
@@ -2716,53 +2716,53 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
2716
2716
  `)}function fQ($,Y,Z){let X=$.split(`
2717
2717
  `),Q=Math.max(0,Y-Z-1),J=Math.min(X.length-1,Y+Z-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",_=[];for(let U=Q;U<=J;U++){let W=(U+1).toString().padStart(4),B=U===Y-1,j=B?"\x1B[31m>\x1B[0m":" ",z=B?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;_.push(`${j}\x1B[90m${W}\x1B[0m | ${z}`)}return _.join(`
2718
2718
  `)}function b6($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function gQ($,Y){let X=$.substring(0,Y).split(`
2719
- `);return{line:X.length,column:X[X.length-1].length}}function o($,Y,Z){return S6({type:$,message:Y,code:Z,format:"html"}).formatted}async function b1($,Y,Z){try{return await $()}catch(X){if(Z&&X instanceof Error)Z(X);return Y}}var y6=b(()=>{$9();Q9()});class c${errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Y,Z="error"){let X={timestamp:new Date,error:$,context:Y,level:Z};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Y=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Y.push(` Stack: ${$.error.stack.split(`
2719
+ `);return{line:X.length,column:X[X.length-1].length}}function o($,Y,Z){return S6({type:$,message:Y,code:Z,format:"html"}).formatted}async function b1($,Y,Z){try{return await $()}catch(X){if(Z&&X instanceof Error)Z(X);return Y}}var y6=S(()=>{$9();Q9()});class c${errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Y,Z="error"){let X={timestamp:new Date,error:$,context:Y,level:Z};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Y=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Y.push(` Stack: ${$.error.stack.split(`
2720
2720
  `).slice(1).join(`
2721
2721
  `)}`);if($.context)Y.push(` Context: ${JSON.stringify($.context)}`);return Y.join(`
2722
2722
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Y=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Y.existsSync(X))Y.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Y);let Q=`${this.formatEntry($)}
2723
2723
  `;Y.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Y){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Y)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let X=`${this.logFilePath}.${Z}`,Q=`${this.logFilePath}.${Z+1}`;if($.existsSync(X))if(Z>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Y){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Y)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Y)=>Y.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Y)=>Y.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Y={error:0,warning:0,info:0};for(let Z of this.errors){let X=Z.error.constructor.name;$[X]=($[X]||0)+1;let Q=Z.level||"error";Y[Q]=(Y[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Y}}async exportToFile($,Y="json"){let Z=await import("fs"),Q=(await import("path")).dirname($);if(!Z.existsSync(Q))Z.mkdirSync(Q,{recursive:!0});if(Y==="json"){let J=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Z.writeFileSync($,JSON.stringify(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Z.writeFileSync($,J.join(`
2724
2724
 
2725
- `),"utf-8")}}async flush(){await this.writeQueue}}var p$,C0,i$;var P6=b(()=>{Q9();p$={isEnabled(){return Y9().enableAutoRecovery},fixCommonSyntaxErrors($){let Y=Y9();if(!Y.enableAutoRecovery)return{fixed:$,fixes:[]};let Z=$,X=[],Q=(Z.match(/\{\{/g)||[]).length,J=(Z.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Z+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Z.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Z.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let U=q-_;for(let W=0;W<U;W++)Z+=`
2725
+ `),"utf-8")}}async flush(){await this.writeQueue}}var p$,C0,i$;var P6=S(()=>{Q9();p$={isEnabled(){return Y9().enableAutoRecovery},fixCommonSyntaxErrors($){let Y=Y9();if(!Y.enableAutoRecovery)return{fixed:$,fixes:[]};let Z=$,X=[],Q=(Z.match(/\{\{/g)||[]).length,J=(Z.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Z+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Z.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Z.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let U=q-_;for(let W=0;W<U;W++)Z+=`
2726
2726
  @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Y.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:X}},createFallbackContent($,Y){if(Y5())return`<!-- ${$} failed: ${Y.message} -->`;return"<!-- stx rendering error -->"}};C0=new c$,i$={isDevelopment(){return Y5()},logDetailedError($,Y){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Y)console.error("Context:",Y);console.error("========================")},createErrorReport($,Y){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Y)Z.push(`Context: ${JSON.stringify(Y,null,2)}`);return Z.push("========================"),Z.join(`
2727
- `)}}});var C6=()=>{};var v6=b(()=>{$9();y6();P6();C6();Q9()});var c0=b(()=>{v6()});function x6($,Y,Z,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,_)=>{if(!_&&q.includes(":")){let U=q.split(":"),W=q,B=U.length>1?U[1]:"";if(B&&Y[B])_=Y[B];else if(W.startsWith("og:")&&Y.openGraph&&Y.openGraph[U[1]])_=Y.openGraph[U[1]];else _="";return _?`<meta property="${d(W)}" content="${d(_)}">`:""}return _?`<meta name="${d(q)}" content="${d(_)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,_=1,U=q+1;while(U<Q.length&&_>0){if(Q[U]==="(")_++;else if(Q[U]===")"){if(_--,_===0)break}U++}if(_!==0)break;let W=Q.substring(q+1,U).trim(),B=U+1,j=(()=>{try{let z=H0(W,Y);if(!z)return"";let O="<meta";if(z.name)O+=` name="${d(String(z.name))}"`;if(z.property)O+=` property="${d(String(z.property))}"`;if(z.httpEquiv)O+=` http-equiv="${d(String(z.httpEquiv))}"`;if(z.content)O+=` content="${d(String(z.content))}"`;return O+=">",O}catch(z){let O=z instanceof Error?z.message:String(z);return o("MetaTag",O,l.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(B),J.lastIndex=0}return Q}function f6($,Y,Z){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,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)break;let U=X.substring(K+1,_).trim(),W=_+1,B=(()=>{try{let j=H0(U,Y);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let z=j instanceof Error?j.message:String(j);return o("StructuredData",z,l.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(W),Q.lastIndex=0}return X}function g6($,Y,Z,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,_=K+1,U=null,W=!1;while(_<Q.length&&q>0){let F=Q[_];if(W){W=!1,_++;continue}if(F==="\\"&&U){W=!0,_++;continue}if(U){if(F===U)U=null;_++;continue}if(F==='"'||F==="'"||F==="`"){U=F,_++;continue}if(F==="{")q++;else if(F==="}")q--;_++}if(q!==0)break;let B=Q.substring(_).match(/^\s*\)/);if(!B)break;let j=_+B[0].length,z=Q.substring(K,_),O=Q.substring(G.index,j),L=((F)=>{try{let H=H0(F,Y);if(!H)return"";let V="";if(H.title)V+=`<title>${d(H.title)}</title>
2728
- `,V+=`<meta name="title" content="${d(H.title)}">
2729
- `;if(H.description)V+=`<meta name="description" content="${d(H.description)}">
2730
- `;if(H.keywords){let N=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${d(N)}">
2731
- `}if(H.robots)V+=`<meta name="robots" content="${d(H.robots)}">
2732
- `;if(H.canonical)V+=`<link rel="canonical" href="${d(H.canonical)}">
2733
- `;if(H.openGraph){let N=H.openGraph;if(V+=`<meta property="og:type" content="${d(N.type||"website")}">
2734
- `,N.title||H.title){let R=N.title||H.title||"";V+=`<meta property="og:title" content="${d(R)}">
2735
- `}if(N.description||H.description){let R=N.description||H.description||"";V+=`<meta property="og:description" content="${d(R)}">
2736
- `}if(N.url||H.canonical){let R=N.url||H.canonical||"";V+=`<meta property="og:url" content="${d(R)}">
2737
- `}if(N.image){if(V+=`<meta property="og:image" content="${d(N.image)}">
2738
- `,N.imageAlt)V+=`<meta property="og:image:alt" content="${d(N.imageAlt)}">
2739
- `;if(N.imageWidth)V+=`<meta property="og:image:width" content="${d(String(N.imageWidth))}">
2740
- `;if(N.imageHeight)V+=`<meta property="og:image:height" content="${d(String(N.imageHeight))}">
2741
- `}if(N.siteName)V+=`<meta property="og:site_name" content="${d(N.siteName)}">
2742
- `}if(H.twitter){let N=H.twitter;if(V+=`<meta name="twitter:card" content="${d(N.card||"summary_large_image")}">
2743
- `,N.title||H.title){let R=N.title||H.title||"";V+=`<meta name="twitter:title" content="${d(R)}">
2744
- `}if(N.description||H.description){let R=N.description||H.description||"";V+=`<meta name="twitter:description" content="${d(R)}">
2745
- `}if(N.image||H.openGraph&&H.openGraph.image){let R=N.image||(H.openGraph?H.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${d(R)}">
2746
- `}if(N.site)V+=`<meta name="twitter:site" content="${d(N.site)}">
2747
- `;if(N.creator)V+=`<meta name="twitter:creator" content="${d(N.creator)}">
2727
+ `)}}});var C6=()=>{};var v6=S(()=>{$9();y6();P6();C6();Q9()});var c0=S(()=>{v6()});function x6($,Y,Z,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,_)=>{if(!_&&q.includes(":")){let U=q.split(":"),W=q,B=U.length>1?U[1]:"";if(B&&Y[B])_=Y[B];else if(W.startsWith("og:")&&Y.openGraph&&Y.openGraph[U[1]])_=Y.openGraph[U[1]];else _="";return _?`<meta property="${h(W)}" content="${h(_)}">`:""}return _?`<meta name="${h(q)}" content="${h(_)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,_=1,U=q+1;while(U<Q.length&&_>0){if(Q[U]==="(")_++;else if(Q[U]===")"){if(_--,_===0)break}U++}if(_!==0)break;let W=Q.substring(q+1,U).trim(),B=U+1,j=(()=>{try{let z=H0(W,Y);if(!z)return"";let O="<meta";if(z.name)O+=` name="${h(String(z.name))}"`;if(z.property)O+=` property="${h(String(z.property))}"`;if(z.httpEquiv)O+=` http-equiv="${h(String(z.httpEquiv))}"`;if(z.content)O+=` content="${h(String(z.content))}"`;return O+=">",O}catch(z){let O=z instanceof Error?z.message:String(z);return o("MetaTag",O,l.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+j+Q.substring(B),J.lastIndex=0}return Q}function f6($,Y,Z){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,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)break;let U=X.substring(K+1,_).trim(),W=_+1,B=(()=>{try{let j=H0(U,Y);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let z=j instanceof Error?j.message:String(j);return o("StructuredData",z,l.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(W),Q.lastIndex=0}return X}function g6($,Y,Z,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,_=K+1,U=null,W=!1;while(_<Q.length&&q>0){let F=Q[_];if(W){W=!1,_++;continue}if(F==="\\"&&U){W=!0,_++;continue}if(U){if(F===U)U=null;_++;continue}if(F==='"'||F==="'"||F==="`"){U=F,_++;continue}if(F==="{")q++;else if(F==="}")q--;_++}if(q!==0)break;let B=Q.substring(_).match(/^\s*\)/);if(!B)break;let j=_+B[0].length,z=Q.substring(K,_),O=Q.substring(G.index,j),L=((F)=>{try{let H=H0(F,Y);if(!H)return"";let V="";if(H.title)V+=`<title>${h(H.title)}</title>
2728
+ `,V+=`<meta name="title" content="${h(H.title)}">
2729
+ `;if(H.description)V+=`<meta name="description" content="${h(H.description)}">
2730
+ `;if(H.keywords){let N=Array.isArray(H.keywords)?H.keywords.join(", "):H.keywords;V+=`<meta name="keywords" content="${h(N)}">
2731
+ `}if(H.robots)V+=`<meta name="robots" content="${h(H.robots)}">
2732
+ `;if(H.canonical)V+=`<link rel="canonical" href="${h(H.canonical)}">
2733
+ `;if(H.openGraph){let N=H.openGraph;if(V+=`<meta property="og:type" content="${h(N.type||"website")}">
2734
+ `,N.title||H.title){let R=N.title||H.title||"";V+=`<meta property="og:title" content="${h(R)}">
2735
+ `}if(N.description||H.description){let R=N.description||H.description||"";V+=`<meta property="og:description" content="${h(R)}">
2736
+ `}if(N.url||H.canonical){let R=N.url||H.canonical||"";V+=`<meta property="og:url" content="${h(R)}">
2737
+ `}if(N.image){if(V+=`<meta property="og:image" content="${h(N.image)}">
2738
+ `,N.imageAlt)V+=`<meta property="og:image:alt" content="${h(N.imageAlt)}">
2739
+ `;if(N.imageWidth)V+=`<meta property="og:image:width" content="${h(String(N.imageWidth))}">
2740
+ `;if(N.imageHeight)V+=`<meta property="og:image:height" content="${h(String(N.imageHeight))}">
2741
+ `}if(N.siteName)V+=`<meta property="og:site_name" content="${h(N.siteName)}">
2742
+ `}if(H.twitter){let N=H.twitter;if(V+=`<meta name="twitter:card" content="${h(N.card||"summary_large_image")}">
2743
+ `,N.title||H.title){let R=N.title||H.title||"";V+=`<meta name="twitter:title" content="${h(R)}">
2744
+ `}if(N.description||H.description){let R=N.description||H.description||"";V+=`<meta name="twitter:description" content="${h(R)}">
2745
+ `}if(N.image||H.openGraph&&H.openGraph.image){let R=N.image||(H.openGraph?H.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${h(R)}">
2746
+ `}if(N.site)V+=`<meta name="twitter:site" content="${h(N.site)}">
2747
+ `;if(N.creator)V+=`<meta name="twitter:creator" content="${h(N.creator)}">
2748
2748
  `}if(H.structuredData){let N=JSON.stringify(H.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${N}</script>
2749
2749
  `}return V.trim()}catch(H){let V=H instanceof Error?H.message:String(H);return o("SEO",`Error processing @seo directive: ${V}`,l.EVALUATION_ERROR)}})(z);Q=Q.substring(0,G.index)+L+Q.substring(j),J.lastIndex=G.index+L.length}return Q}function h6($,Y,Z){if(Z.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return $;let X=Y.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((W)=>W.property==="og:title"||W.name==="og:title"||W.name==="twitter:title"||W.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(Y.title)G=Y.title;else if(Y.meta&&Y.meta.title)G=Y.meta.title;else if(Z.seo?.defaultConfig?.title)G=Z.seo.defaultConfig.title;else G=Z.defaultTitle||"stx Project";let K="";if(Y.description)K=Y.description;else if(Y.meta&&Y.meta.description)K=Y.meta.description;else if(Z.seo?.defaultConfig?.description)K=Z.seo.defaultConfig.description;else K=Z.defaultDescription||"A website built with stx templating engine";let q="";if(Y.image)q=Y.image;else if(Y.meta&&Y.meta.image)q=Y.meta.image;else if(Y.openGraph&&Y.openGraph.image)q=Y.openGraph.image;else if(Z.seo?.defaultImage)q=Z.seo.defaultImage;else if(Z.defaultImage)q=Z.defaultImage;let _=`
2750
2750
  <!-- stx SEO Tags -->
2751
- <meta name="title" content="${d(G)}">
2752
- <meta name="description" content="${d(K)}">
2753
- <meta property="og:title" content="${d(G)}">
2754
- <meta property="og:description" content="${d(K)}">
2751
+ <meta name="title" content="${h(G)}">
2752
+ <meta name="description" content="${h(K)}">
2753
+ <meta property="og:title" content="${h(G)}">
2754
+ <meta property="og:description" content="${h(K)}">
2755
2755
  <meta property="og:type" content="website">
2756
2756
  <meta name="twitter:card" content="summary_large_image">
2757
- <meta name="twitter:title" content="${d(G)}">
2758
- <meta name="twitter:description" content="${d(K)}">
2757
+ <meta name="twitter:title" content="${h(G)}">
2758
+ <meta name="twitter:description" content="${h(K)}">
2759
2759
  `;if(q)_+=`
2760
- <meta property="og:image" content="${d(q)}">
2761
- <meta name="twitter:image" content="${d(q)}">
2760
+ <meta property="og:image" content="${h(q)}">
2761
+ <meta name="twitter:image" content="${h(q)}">
2762
2762
  `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
2763
- <title>${d(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2763
+ <title>${h(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2764
2764
  ${_}
2765
- `)}function d($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var d6,m6;var n$=b(()=>{c0();N0();d6={name:"meta",handler:($,Y,Z,X)=>{if(Y.length<1)return o("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[1].replace(/['"]/g,""):"";return`<meta name="${d(Q)}" content="${d(J)}">`},hasEndTag:!1},m6={name:"structuredData",handler:($,Y,Z,X)=>{if($.trim()==="")return o("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return o("StructuredData","structuredData requires @type property",l.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return o("StructuredData",J,l.EVALUATION_ERROR)}},hasEndTag:!0}});import Z5 from"path";function hQ($,Y){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1].trim():"",Q=Y,J=[],G=!0;if(X){let W=X.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let B=W[1],j=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let z=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(z)J=z[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let O=B.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=_?_[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function dQ($){let{tag:Y,props:Z,template:X,styles:Q,shadowDOM:J}=$,G=Y.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Z.map((W)=>`'${W}'`).join(", "),U=Z.map((W)=>`
2765
+ `)}function h($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var d6,m6;var n$=S(()=>{c0();N0();d6={name:"meta",handler:($,Y,Z,X)=>{if(Y.length<1)return o("Meta","meta directive requires at least the meta name",l.INVALID_DIRECTIVE_SYNTAX);let Q=Y[0].replace(/['"]/g,""),J=Y.length>1?Y[1].replace(/['"]/g,""):"";return`<meta name="${h(Q)}" content="${h(J)}">`},hasEndTag:!1},m6={name:"structuredData",handler:($,Y,Z,X)=>{if($.trim()==="")return o("StructuredData","structuredData directive requires JSON-LD content",l.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return o("StructuredData","structuredData requires @type property",l.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return o("StructuredData",J,l.EVALUATION_ERROR)}},hasEndTag:!0}});import Z5 from"path";function hQ($,Y){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1].trim():"",Q=Y,J=[],G=!0;if(X){let W=X.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let B=W[1],j=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Q=j[1];let z=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(z)J=z[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let O=B.match(/shadowDOM\s*:\s*(true|false)/);if(O)G=O[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=_?_[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function dQ($){let{tag:Y,props:Z,template:X,styles:Q,shadowDOM:J}=$,G=Y.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Z.map((W)=>`'${W}'`).join(", "),U=Z.map((W)=>`
2766
2766
  get ${W}() {
2767
2767
  return this.getAttribute('${W}') || '';
2768
2768
  }
@@ -2815,14 +2815,14 @@ ${U}
2815
2815
  customElements.define('${Y}', ${G});
2816
2816
  `}async function u6($,Y,Z,X){if(Y.length<1)return o("WebComponent","@webcomponent directive requires at least the tag name parameter",l.INVALID_DIRECTIVE_SYNTAX);let Q=Y[0].replace(/['"]/g,""),G=(Z.__stx_options||{}).componentsDir||"components",K=[Z5.join(Z5.dirname(X),G,`${Q}.stx`),Z5.join(process.cwd(),G,`${Q}.stx`),Z5.join(Z5.dirname(X),`${Q}.stx`)],q=null;for(let W of K)if(await c(W)){q=await Bun.file(W).text();break}if(!q)return o("WebComponent",`Component file not found: ${Q}.stx`,l.FILE_NOT_FOUND);let _=hQ(q,Q);return`<script type="module">
2817
2817
  ${dQ(_)}
2818
- </script>`}var l6=b(()=>{c0();V0()});var p6={};s(p6,{timingPlugin:()=>cQ,pluginManager:()=>mQ,definePlugin:()=>G9,debugPlugin:()=>pQ,createVariablesPlugin:()=>iQ,createFilterPlugin:()=>lQ,createDirectivePlugin:()=>uQ,PluginManager:()=>o$});function G9($){return $}class o${plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Y){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Y);this.sortPlugins()}async unregister($){let Y=this.plugins.get($);if(!Y)return!1;for(let[Z,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(Y.onUnregister)await Y.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 Y of this.sortedPlugins)if(Y.registerDirectives)$.push(...Y.registerDirectives());return $}getAllFilters(){let $={};for(let Y of this.sortedPlugins)if(Y.registerFilters)Object.assign($,Y.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Y){return this.runDirectiveHooks("beforeDirective",$,Y)}async runAfterDirective($,Y){return this.runDirectiveHooks("afterDirective",$,Y)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Y of this.sortedPlugins)if(Y.onError)try{let Z=await Y.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${Y.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Y)=>($.priority??100)-(Y.priority??100))}async runHooks($,Y){let Z={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Z);if(J){if(J.template!==void 0)Z.template=J.template;if(J.context)Z.context={...Z.context,...J.context};if(J.metadata)Z.metadata={...Z.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Z}async runDirectiveHooks($,Y,Z){let X={...Z};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Y,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 uQ($,Y,Z={}){return{name:$,...Z,registerDirectives:()=>Y}}function lQ($,Y,Z={}){return{name:$,...Z,registerFilters:()=>Y}}function iQ($){return G9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Y){return{context:{...Y.context,...$}}}})}var mQ,pQ,cQ;var c6=b(()=>{mQ=new o$;pQ=G9({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($,Y){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Y){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)}}),cQ=G9({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Y=$.metadata.startTime;if(Y){let Z=performance.now()-Y;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var n6={};s(n6,{validateConfig:()=>rQ,loadStxConfig:()=>q9,defineStxConfig:()=>sQ,defaultConfig:()=>r$,config:()=>a$});import s$ from"fs";import w0 from"path";import{loadConfigWithResult as nQ}from"bunfig";function oQ($,Y){let Z=Y||"pages";if($)return{root:$,pagesDir:Z};let X=w0.join(process.cwd(),"resources","views"),Q=w0.join(process.cwd(),"resources","layouts");if(s$.existsSync(X)&&s$.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=w0.join(process.cwd(),"resources","views","pages");if(s$.existsSync(J))return{root:"resources/views",pagesDir:Z};return{root:".",pagesDir:Z}}async function q9($){if(!$){if(S1)return S1;if(K9)return K9}let Y=$?w0.resolve($):process.cwd(),Z=i6.get(Y);if(Z)return Z;let X=(async()=>{let J=(await nQ({name:"stx",alias:"ui",cwd:Y,defaultConfig:r$,verbose:!1})).config,G=oQ(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!w0.isAbsolute(J.partialsDir))J.partialsDir=w0.join(K,J.partialsDir);if(J.componentsDir&&!w0.isAbsolute(J.componentsDir))J.componentsDir=w0.join(K,J.componentsDir);if(J.layoutsDir&&!w0.isAbsolute(J.layoutsDir))J.layoutsDir=w0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (c6(),p6)),q=[],_=[];for(let U of J.plugins){let W=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let j,z;try{j=await import(W),z=w0.dirname(e.resolve(W))}catch{let L=w0.resolve(process.cwd(),W);j=await import(L),z=w0.dirname(L)}let O=j.default||j;if(K.register(O,J),O.components){let L=w0.resolve(z,O.components);q.push(L)}if(O.pages){let L=w0.resolve(z,O.pages),F=B.path||"/";_.push({dir:L,prefix:F})}if(O.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,H)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=H},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:z,config:J};await O.setup(B,L)}console.log(`[stx] Plugin loaded: ${O.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=_}return J})();if(i6.set(Y,X),!$)K9=X,X.then((Q)=>{S1=Q}).catch(()=>{});return X}function sQ($){return $}function rQ($){let Y=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Y.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Y.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Y.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Y.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)Y.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)Y.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))Y.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))Y.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)Y.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)Y.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))Y.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))Y.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))Y.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Y.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Y.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Y.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.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)Z.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)Y.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))Y.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))Y.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")Y.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Y.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))Y.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))Y.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))Y.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)Y.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)Y.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Z.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)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Y.length===0,errors:Y,warnings:Z}}var r$,S1=null,i6,K9=null,a$;var U9=b(()=>{l9();p9();c9();i9();q$();Q6();h$();m$();n$();l6();r$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:S3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:u6,hasEndTag:!1,description:"Include a web component in the template"},P7,C7,d6,m6,v7,f7,g7,x7,u7,c7,J6,g$,...d$],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}};i6=new Map;a$=new Proxy(r$,{get($,Y){if(S1&&Y in S1)return S1[Y];if(!K9)q9().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[Y]}})});import K0 from"path";async function r6($){try{let Y=await import($);if(Y&&Y.CSSGenerator)return{CSSGenerator:Y.CSSGenerator,config:Y.config,build:Y.build,defaultConfig:Y.defaultConfig}}catch{}return null}function aQ(){let $=[],Y=process.env.HOME||process.env.USERPROFILE||"",Z=process.cwd();while(Z!==K0.dirname(Z))$.push(K0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),Z=K0.dirname(Z);if(Y){let X=[K0.join(Y,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),K0.join(Y,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),K0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),K0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),K0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),K0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function tQ(){if(o6)return X5;o6=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Z of $){let X=await r6(Z);if(X)return X5=X,console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`),X5}let Y=aQ();for(let Z of Y)if(await Bun.file(Z).exists()){let X=await r6(Z);if(X)return X5=X,console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${K0.dirname(K0.dirname(Z))}`),X5}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 eQ($){try{let{loadConfigWithResult:Y}=await import("bunfig"),Z=await Y({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let X=K0.relative($,Z.path);return console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${X||Z.path}`),Z.config}catch(Y){if(Y instanceof Error&&Y.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Y instanceof Error?Y.message:Y),null}}function $G($){let Y=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,X=Z.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Y.add(G.trim());X=Z.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())Y.add(q.trim())}J=Q.exec($)}return Y}async function YG($,Y){try{let Z=await tQ();if(!Z)return"";let X=$G($);if(X.size===0)return"";let Q=[...X].sort().join(" "),J=s6.get(Q);if(J!==void 0)return J;let G=Y?K0.resolve(Y):process.cwd();if(!t$){let V=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (U9(),n6)),R=await N(G);if(R.css)if(typeof R.css==="string"){let A=K0.isAbsolute(R.css)?R.css:K0.resolve(G,R.css);if(await Bun.file(A).exists()){let w=await import(A);V=w.default||w,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=K0.isAbsolute(R.css.config)?R.css.config:K0.resolve(G,R.css.config);if(await Bun.file(A).exists()){let w=await import(A);V={...w.default||w,...V}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}t$=V||await eQ(G)}let K=Z.defaultConfig||Z.config,q=t$||{},_=K.theme||{},W=(q.theme||{}).extend||{},B={..._};if(Object.keys(W).length>0)B.extend=W;let j=[...K.safelist||[],...q.safelist||[]],z={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:j},O=new Z.CSSGenerator(z);for(let V of j)O.generate(V);for(let V of X)O.generate(V);let L=O.toCSS(!0,!1),F=z.shortcuts||q.shortcuts||{};for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}L=O.toCSS(!0,!1);let H=L.split(`
2819
- `);for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean),A=[],w=[];for(let T of R){let I=T.startsWith("dark:"),D=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let P=0;P<H.length;P++){let y=H[P].trim();if(y===`${D} {`||y.startsWith(`${D} {`)){let S=P,k="";while(S<H.length){if(k+=H[S],H[S].includes("}"))break;S++}let g=k.match(/\{([^}]+)\}/);if(g)if(I)w.push(g[1].trim());else A.push(g[1].trim());break}}}if(A.length)L+=`
2818
+ </script>`}var l6=S(()=>{c0();V0()});var p6={};r(p6,{timingPlugin:()=>cQ,pluginManager:()=>mQ,definePlugin:()=>G9,debugPlugin:()=>pQ,createVariablesPlugin:()=>iQ,createFilterPlugin:()=>lQ,createDirectivePlugin:()=>uQ,PluginManager:()=>o$});function G9($){return $}class o${plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Y){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Y);this.sortPlugins()}async unregister($){let Y=this.plugins.get($);if(!Y)return!1;for(let[Z,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(Y.onUnregister)await Y.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 Y of this.sortedPlugins)if(Y.registerDirectives)$.push(...Y.registerDirectives());return $}getAllFilters(){let $={};for(let Y of this.sortedPlugins)if(Y.registerFilters)Object.assign($,Y.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Y){return this.runDirectiveHooks("beforeDirective",$,Y)}async runAfterDirective($,Y){return this.runDirectiveHooks("afterDirective",$,Y)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Y of this.sortedPlugins)if(Y.onError)try{let Z=await Y.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${Y.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Y)=>($.priority??100)-(Y.priority??100))}async runHooks($,Y){let Z={...Y};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Z);if(J){if(J.template!==void 0)Z.template=J.template;if(J.context)Z.context={...Z.context,...J.context};if(J.metadata)Z.metadata={...Z.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Z}async runDirectiveHooks($,Y,Z){let X={...Z};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Y,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 uQ($,Y,Z={}){return{name:$,...Z,registerDirectives:()=>Y}}function lQ($,Y,Z={}){return{name:$,...Z,registerFilters:()=>Y}}function iQ($){return G9({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Y){return{context:{...Y.context,...$}}}})}var mQ,pQ,cQ;var c6=S(()=>{mQ=new o$;pQ=G9({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($,Y){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Y){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)}}),cQ=G9({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Y=$.metadata.startTime;if(Y){let Z=performance.now()-Y;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var n6={};r(n6,{validateConfig:()=>rQ,loadStxConfig:()=>q9,defineStxConfig:()=>sQ,defaultConfig:()=>r$,config:()=>a$});import s$ from"fs";import w0 from"path";import{loadConfigWithResult as nQ}from"bunfig";function oQ($,Y){let Z=Y||"pages";if($)return{root:$,pagesDir:Z};let X=w0.join(process.cwd(),"resources","views"),Q=w0.join(process.cwd(),"resources","layouts");if(s$.existsSync(X)&&s$.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=w0.join(process.cwd(),"resources","views","pages");if(s$.existsSync(J))return{root:"resources/views",pagesDir:Z};return{root:".",pagesDir:Z}}async function q9($){if(!$){if(S1)return S1;if(K9)return K9}let Y=$?w0.resolve($):process.cwd(),Z=i6.get(Y);if(Z)return Z;let X=(async()=>{let J=(await nQ({name:"stx",alias:"ui",cwd:Y,defaultConfig:r$,verbose:!1})).config,G=oQ(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!w0.isAbsolute(J.partialsDir))J.partialsDir=w0.join(K,J.partialsDir);if(J.componentsDir&&!w0.isAbsolute(J.componentsDir))J.componentsDir=w0.join(K,J.componentsDir);if(J.layoutsDir&&!w0.isAbsolute(J.layoutsDir))J.layoutsDir=w0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (c6(),p6)),q=[],_=[];for(let U of J.plugins){let W=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let j,z;try{j=await import(W),z=w0.dirname(e.resolve(W))}catch{let L=w0.resolve(process.cwd(),W);j=await import(L),z=w0.dirname(L)}let O=j.default||j;if(K.register(O,J),O.components){let L=w0.resolve(z,O.components);q.push(L)}if(O.pages){let L=w0.resolve(z,O.pages),F=B.path||"/";_.push({dir:L,prefix:F})}if(O.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,H)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=H},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:z,config:J};await O.setup(B,L)}console.log(`[stx] Plugin loaded: ${O.name||W}`)}catch(j){console.warn(`[stx] Failed to load plugin ${W}:`,j.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=_}return J})();if(i6.set(Y,X),!$)K9=X,X.then((Q)=>{S1=Q}).catch(()=>{});return X}function sQ($){return $}function rQ($){let Y=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Y.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Y.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Y.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Y.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)Y.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)Y.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))Y.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))Y.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)Y.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)Y.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))Y.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))Y.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))Y.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Y.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Y.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Y.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Y.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Y.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.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)Z.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)Y.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))Y.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))Y.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")Y.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Y.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))Y.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))Y.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))Y.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)Y.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)Y.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Z.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)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Y.length===0,errors:Y,warnings:Z}}var r$,S1=null,i6,K9=null,a$;var U9=S(()=>{l9();p9();c9();i9();q$();Q6();h$();m$();n$();l6();r$={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:S3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:u6,hasEndTag:!1,description:"Include a web component in the template"},P7,C7,d6,m6,v7,f7,g7,x7,u7,c7,J6,g$,...d$],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}};i6=new Map;a$=new Proxy(r$,{get($,Y){if(S1&&Y in S1)return S1[Y];if(!K9)q9().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[Y]}})});import q0 from"path";async function r6($){try{let Y=await import($);if(Y&&Y.CSSGenerator)return{CSSGenerator:Y.CSSGenerator,config:Y.config,build:Y.build,defaultConfig:Y.defaultConfig}}catch{}return null}function aQ(){let $=[],Y=process.env.HOME||process.env.USERPROFILE||"",Z=process.cwd();while(Z!==q0.dirname(Z))$.push(q0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(q0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(q0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),Z=q0.dirname(Z);if(Y){let X=[q0.join(Y,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join(Y,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join(Y,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join(Y,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function tQ(){if(o6)return X5;o6=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Z of $){let X=await r6(Z);if(X)return X5=X,console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`),X5}let Y=aQ();for(let Z of Y)if(await Bun.file(Z).exists()){let X=await r6(Z);if(X)return X5=X,console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(Z))}`),X5}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 eQ($){try{let{loadConfigWithResult:Y}=await import("bunfig"),Z=await Y({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let X=q0.relative($,Z.path);return console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${X||Z.path}`),Z.config}catch(Y){if(Y instanceof Error&&Y.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Y instanceof Error?Y.message:Y),null}}function $G($){let Y=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,X=Z.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Y.add(G.trim());X=Z.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())Y.add(q.trim())}J=Q.exec($)}return Y}async function YG($,Y){try{let Z=await tQ();if(!Z)return"";let X=$G($);if(X.size===0)return"";let Q=[...X].sort().join(" "),J=s6.get(Q);if(J!==void 0)return J;let G=Y?q0.resolve(Y):process.cwd();if(!t$){let V=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (U9(),n6)),R=await N(G);if(R.css)if(typeof R.css==="string"){let A=q0.isAbsolute(R.css)?R.css:q0.resolve(G,R.css);if(await Bun.file(A).exists()){let w=await import(A);V=w.default||w,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=q0.isAbsolute(R.css.config)?R.css.config:q0.resolve(G,R.css.config);if(await Bun.file(A).exists()){let w=await import(A);V={...w.default||w,...V}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}t$=V||await eQ(G)}let K=Z.defaultConfig||Z.config,q=t$||{},_=K.theme||{},W=(q.theme||{}).extend||{},B={..._};if(Object.keys(W).length>0)B.extend=W;let j=[...K.safelist||[],...q.safelist||[]],z={...K,...q,content:[],output:"",preflight:!0,minify:!1,theme:B,safelist:j},O=new Z.CSSGenerator(z);for(let V of j)O.generate(V);for(let V of X)O.generate(V);let L=O.toCSS(!0,!1),F=z.shortcuts||q.shortcuts||{};for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}L=O.toCSS(!0,!1);let H=L.split(`
2819
+ `);for(let[V,N]of Object.entries(F)){if(!X.has(V)&&!j.includes(V))continue;let R=N.split(/\s+/).filter(Boolean),A=[],w=[];for(let T of R){let D=T.startsWith("dark:"),E=`.${(D?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let C=0;C<H.length;C++){let P=H[C].trim();if(P===`${E} {`||P.startsWith(`${E} {`)){let k=C,b="";while(k<H.length){if(b+=H[k],H[k].includes("}"))break;k++}let x=b.match(/\{([^}]+)\}/);if(x)if(D)w.push(x[1].trim());else A.push(x[1].trim());break}}}if(A.length)L+=`
2820
2820
  .${V} { ${A.join(" ")} }`;if(w.length)L+=`
2821
2821
  @media (prefers-color-scheme: dark) { .dark .${V} { ${w.join(" ")} } }`}return s6.set(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function a6($,Y){if($.includes('data-crosswind="generated"'))return $;let Z=await YG($,Y);if(!Z)return $;let X=`<style data-crosswind="generated">
2822
2822
  ${Z}
2823
2823
  </style>`;if($.includes("</head>"))return $.replace("</head>",`${X}
2824
2824
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
2825
- ${X}`);return X+$}var X5=null,o6=!1,t$=null,s6;var t6=b(()=>{S7();s6=new Map});function e6(){return`
2825
+ ${X}`);return X+$}var X5=null,o6=!1,t$=null,s6;var t6=S(()=>{S7();s6=new Map});function e6(){return`
2826
2826
  // STX Lifecycle Runtime
2827
2827
  (function() {
2828
2828
  if (typeof window === 'undefined') return;
@@ -3167,7 +3167,7 @@ else {
3167
3167
 
3168
3168
  console.log('[stx] Lifecycle runtime initialized');
3169
3169
  })();
3170
- `}function e$($){return Symbol($)}var Cz,vz,xz;var $2=b(()=>{Cz=e$("theme"),vz=e$("router"),xz=e$("i18n")});import*as Z2 from"crypto";function Y2($){let Y=/\$(\w+)\./g,Z=[],X;while((X=Y.exec($))!==null)if(!Z.includes(X[1]))Z.push(X[1]);return Z}function ZG(){return`stx-${Z2.randomBytes(4).toString("hex")}`}function XG($){return/\$\w+\./.test($)}function JG($){let Y=[],Z=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 _=[],U=!1,W=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(B)];for(let L of j){let F=L[0],H=L[1],V=L[2];if(XG(V)){U=!0;let N=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(N){let R=N[1];if(_.push({attr:H,expr:R,fullMatch:F,originalAttr:H}),Y2(R).forEach((w)=>Z.add(w)),H==="text")W=W.replace(F,"");else if(H==="class")W=W.replace(F,'class=""');else if(H==="disabled"||H==="hidden")W=W.replace(F,"");else W=W.replace(F,`${H}=""`)}}}if(!U)return J;let z=W.match(/\bid\s*=\s*"([^"]+)"/),O;if(z)O=z[1];else O=ZG(),W=` id="${O}"${W}`;for(let L of _)Y.push({elementId:O,attribute:L.attr,expression:L.expr,stores:Y2(L.expr)});return`<${G}${W}${q}`}),{html:Q,bindings:Y,stores:Z}}function QG($,Y){if($.length===0)return"";let Z=Array.from(Y),X=`
3170
+ `}function e$($){return Symbol($)}var Cz,vz,xz;var $2=S(()=>{Cz=e$("theme"),vz=e$("router"),xz=e$("i18n")});import*as Z2 from"crypto";function Y2($){let Y=/\$(\w+)\./g,Z=[],X;while((X=Y.exec($))!==null)if(!Z.includes(X[1]))Z.push(X[1]);return Z}function ZG(){return`stx-${Z2.randomBytes(4).toString("hex")}`}function XG($){return/\$\w+\./.test($)}function JG($){let Y=[],Z=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 _=[],U=!1,W=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...K.matchAll(B)];for(let L of j){let F=L[0],H=L[1],V=L[2];if(XG(V)){U=!0;let N=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(N){let R=N[1];if(_.push({attr:H,expr:R,fullMatch:F,originalAttr:H}),Y2(R).forEach((w)=>Z.add(w)),H==="text")W=W.replace(F,"");else if(H==="class")W=W.replace(F,'class=""');else if(H==="disabled"||H==="hidden")W=W.replace(F,"");else W=W.replace(F,`${H}=""`)}}}if(!U)return J;let z=W.match(/\bid\s*=\s*"([^"]+)"/),O;if(z)O=z[1];else O=ZG(),W=` id="${O}"${W}`;for(let L of _)Y.push({elementId:O,attribute:L.attr,expression:L.expr,stores:Y2(L.expr)});return`<${G}${W}${q}`}),{html:Q,bindings:Y,stores:Z}}function QG($,Y){if($.length===0)return"";let Z=Array.from(Y),X=`
3171
3171
  <script>
3172
3172
  (function() {
3173
3173
  'use strict';
@@ -3436,7 +3436,7 @@ else {
3436
3436
  `)}
3437
3437
  })();
3438
3438
  </script>`}function LG($){let Y=W2($);if(Y.length===0)return{template:$,bindings:[]};let Z=$,X=[];for(let Q=Y.length-1;Q>=0;Q--){let J=Y[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(_,""),G=G.replace(U,"")}Z=Z.slice(0,J.startIndex)+G+Z.slice(J.endIndex),X.push(...J.events)}return{template:Z,bindings:X}}function B2($,Y,Z){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Y.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:_}=LG($),U=Y.__stx_event_bindings||[];return Y.__stx_event_bindings=[...U,..._],q}let Q=W2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let _=Q[q],U=_.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${_.elementId}"`);else{let W=U.match(/id=["']([^"']+)["']/);if(W)for(let B of _.events)B.elementId=W[1]}for(let W of _.events){let B=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(j,""),U=U.replace(z,"")}J=J.slice(0,_.startIndex)+U+J.slice(_.endIndex)}let G=HG(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
3439
- `+J.slice(K);else J+=G;return J}var K2,q2,BG,_2;var z2=b(()=>{K2=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),q2={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},BG=new Set(["ctrl","alt","shift","meta"]),_2={left:0,middle:1,right:2}});function _9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j2($,Y){let Z=$.match(new RegExp(`${Y}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let X=$.match(new RegExp(`${Y}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function VG($){let Y=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Z.exec($))!==null){let[Q,J,G]=X,K=X.index,q=j2(G,"x-data");if(!q)continue;let _=`__stx_scope_${H2++}`,U=j2(G,"x-init"),W=RG($,J,K+Q.length),B=$.slice(K,W.endIndex),j=NG(B);Y.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Y}function RG($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s|>)`,"gi"),G=new RegExp(`</${Y}>`,"gi"),K=new RegExp(`<${Y}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),_=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:_.index+_[0].length};Q=_.index+_[0].length}}return{endIndex:$.length}}function NG($){let Y=new Map,Z=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Z))!==null){let[,J,G]=Q,K=AG(J);Y.set(G,K)}return Y}function AG($){let Y=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Y)return Y[1];return`__stx_el_${FG++}`}function wG(){return`
3439
+ `+J.slice(K);else J+=G;return J}var K2,q2,BG,_2;var z2=S(()=>{K2=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),q2={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},BG=new Set(["ctrl","alt","shift","meta"]),_2={left:0,middle:1,right:2}});function _9($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j2($,Y){let Z=$.match(new RegExp(`${Y}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let X=$.match(new RegExp(`${Y}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function VG($){let Y=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Z.exec($))!==null){let[Q,J,G]=X,K=X.index,q=j2(G,"x-data");if(!q)continue;let _=`__stx_scope_${H2++}`,U=j2(G,"x-init"),W=RG($,J,K+Q.length),B=$.slice(K,W.endIndex),j=NG(B);Y.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Y}function RG($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s|>)`,"gi"),G=new RegExp(`</${Y}>`,"gi"),K=new RegExp(`<${Y}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),_=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:_.index+_[0].length};Q=_.index+_[0].length}}return{endIndex:$.length}}function NG($){let Y=new Map,Z=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=X.exec(Z))!==null){let[,J,G]=Q,K=AG(J);Y.set(G,K)}return Y}function AG($){let Y=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Y)return Y[1];return`__stx_el_${FG++}`}function wG(){return`
3440
3440
  // STX Reactive Runtime - x-cloak and transition CSS
3441
3441
  (function() {
3442
3442
  var style = document.createElement('style');
@@ -3655,11 +3655,11 @@ window.__stx_reactive = (function() {
3655
3655
  ${wG()}
3656
3656
  ${Z}
3657
3657
  </script>`}function L2($,Y,Z){if(H2=0,!IG($))return $;let X=VG($);if(X.length===0)return $;let Q=MG($,X),J=TG(X,Y),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3658
- `+Q.slice(G);else Q+=J;return Q}function MG($,Y){let Z=$;for(let X of Y){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${_9(X.stateExpr)}["']`,"gi").exec(Z);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*["']${_9(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Z);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${_9(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${_9(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Z=Z.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Z=Z.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Z=Z.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Z=Z.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Z}function IG($){return/x-data\s*=\s*["']/.test($)}var H2=0,FG=0;var F2=b(()=>{p0()});import EG from"fs";import $4 from"path";import{createHighlighter as DG}from"ts-syntax-highlighter";async function kG($,Y={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await EG.promises.stat($)).mtime.getTime();if(Y.cache&&Y4.has($)){let W=Y4.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:J,content:G}=n7(Q),K=Y.markdown||a$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=c1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await bG(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:_,data:J||{}};if(Y.cache)Y4.set($,{...U,updatedAt:X});return U}catch(Z){if(Y.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let X=Z instanceof Error?Z.message:String(Z);return{content:X0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function bG($,Y,Z){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W9)try{W9=await DG({theme:Y||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,_,U)=>{let W=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=_||(Z?"text":"");if(!B)return K;try{if(!W9.getSupportedLanguages().includes(B))return K;return(await W9.highlight(W,B,{theme:Y})).html}catch(j){console.error(`Error highlighting code block with language ${_}:`,j)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,_,U,W]=K,B=await Q(q,_,U,W);J=J.replace(q,B)}return J}async function V2($,Y,Z="",X={}){return await SG($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let U=K;if(!$4.isAbsolute(K))U=$4.resolve($4.dirname(Z),K);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let N=V.indexOf(":");if(N>0){let R=V.substring(0,N).trim(),A=V.substring(N+1).trim(),w=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(w||T)A=A.substring(1,A.length-1);W[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:j}=await kG(U,X),z={...Y,...j,...W},O=B,L=/\{\{([^}]+)\}\}/g;return O=O.replace(L,(F,H)=>{let V=H.trim();return z[V]!==void 0?String(z[V]):F}),O}catch(U){let W=U instanceof Error?U.message:String(U);return X0("Markdown File",`Error including markdown file: ${W}`,Z,$,_,G)}})}async function SG($,Y,Z){let X=[],Q;while((Q=Y.exec($))!==null){let K=Q[0],q=Q.index,_=Q;X.push(Z(..._).then((U)=>({match:K,replacement:U,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 Y4,W9=null;var R2=b(()=>{U9();V0();Y4=new Map});function a0($,Y){try{let Z=$.trim();if(t(Z))return $0(Z,Object.keys(Y))(...Object.values(Y));else return Z0(Z,Y)}catch{return!1}}var N2=b(()=>{N0()});function t0($,Y){let Z=yG($,Y);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function yG($,Y){let Z=Y;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let X=M0($,"(",")",Z);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,X),endPos:X+1}}function j1($,Y,Z,X){let Q=1,J=X,G=new RegExp(`@${Y}\\s*\\(`,"g"),K=new RegExp(`@${Z}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),_=K.exec($),U=q?q.index:1/0,W=_?_.index:1/0;if(U<W)Q++,J=U+q[0].length;else if(W<1/0){if(Q--,Q===0)return W;J=W+_[0].length}else break}return-1}function A2($,Y){let Z=$.slice(Y).match(/^@if\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=t0($,X);if(!Q)return null;let J=Q.endPos,G=j1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U="if",W=Q.expression,B=0,j=0;while(_<K.length){let z=K.indexOf("@",_);if(z===-1)break;_=z;let O=K.substring(z);if(/^@if\s*\(/.test(O)){j++,_++;continue}if(/^@endif(?![a-z])/.test(O)){j--,_+=6;continue}if(j===0){let L=O.match(/^@elseif\s*/);if(L){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_});let F=_+L[0].length,H=t0(K,F);if(!H){_++;continue}U="elseif",W=H.expression,_=H.endPos,B=_;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_}),U="else",W=void 0,_+=5,B=_;continue}}_++}return q.push({type:U,condition:W,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Y,G+6),branches:q,start:Y,end:G+6}}function Z4($){let Y=[],Z=/@if\s*\(/g,X=Z.exec($);while(X!==null){if(Y.some((G)=>X.index>G.start&&X.index<G.end)){X=Z.exec($);continue}let J=A2($,X.index);if(J)Y.push(J),Z.lastIndex=J.end;X=Z.exec($)}return Y}function B9($,Y,Z){let X=[],Q=new RegExp(`@${Y}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((O)=>J.index>O.start&&J.index<O.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,_=M0($,"(",")",q);if(_===-1){J=Q.exec($);continue}let U=$.slice(q+1,_),W=_+1,B=j1($,Y,Z,W);if(B===-1){J=Q.exec($);continue}let j=$.slice(W,B),z=B+`@${Z}`.length;X.push({fullMatch:$.slice(K,z),name:Y,params:U,content:j,start:K,end:z}),Q.lastIndex=z,J=Q.exec($)}return X}function X4($,Y){let Z=$.slice(Y).match(/^@switch\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=t0($,X);if(!Q)return null;let J=Q.endPos,G=j1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U=null,W=0;while(_<K.length){let B=K.slice(_),j=B.match(/^@switch\s*\(/),z=B.match(/^@endswitch(?![a-z])/);if(j){if(W++,U)U.content+=j[0];_+=j[0].length;continue}if(z){if(W--,U)U.content+=z[0];_+=z[0].length;continue}if(W>0){if(U)U.content+=K[_];_++;continue}let O=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(O&&B.startsWith("@case")){if(U)q.push(U);let H=_+O[0].length,V=t0(K,H);if(!V){_++;continue}U={type:"case",value:V.expression,content:""},_=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},_+=L[0].length}else if(F&&B.startsWith("@break"))_+=F[0].length;else{if(U)U.content+=K[_];_++}}if(U)q.push(U);return{fullMatch:$.slice(Y,G+10),expression:Q.expression,cases:q,start:Y,end:G+10}}var w2=()=>{};var T2=()=>{};var J4=b(()=>{w2();T2()});function xG($,Y,Z){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=X4(X,G);if(!K)break;try{let q;if(t(K.expression))q=$0(K.expression,Object.keys(Y))(...Object.values(Y));else q=Z0(K.expression,Y);let _="",U=!1;for(let W of K.cases)if(W.type==="default"){if(!U)_=W.content.trim()}else try{let B;if(W.value&&t(W.value))B=$0(W.value,Object.keys(Y))(...Object.values(Y));else if(W.value)B=Z0(W.value,Y);if(q===B){_=W.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+_+X.substring(K.end),Q=!0}catch(q){let _=q instanceof Error?q.message:String(q),U=o("Switch",`Error evaluating @switch expression: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function O1($,Y,Z){let X=$;X=xG(X,Y,Z);{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=t0(X,K+7);if(!q)break;let _=q.endPos,U=j1(X,"unless","endunless",_);if(U===-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 W=X.slice(_,U),B=q.expression,j=-1;{let O=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],N;while((N=L.exec(W))!==null)V.push({pos:N.index,type:"open"});while((N=F.exec(W))!==null)V.push({pos:N.index,type:"close"});while((N=H.exec(W))!==null)V.push({pos:N.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")O++;else if(R.type==="close")O--;else if(R.type==="else"&&O===0){j=R.pos;break}}let z;if(j!==-1){let O=W.slice(0,j),L=W.slice(j+5);z=`@if (${B})${L}@else ${O}@endif`}else z=`@if (!(${B}))${W}@endif`;X=X.substring(0,K)+z+X.substring(U+10),J=!0}}X=G4(X,Y,Z),X=K4(X,Y,Z),X=Q4(X,Y);let Q=()=>{let J=Z4(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",_=!1;for(let U of K.branches){if(_)break;if(U.type==="else")q=U.content,_=!0;else try{let W;if(U.condition&&t(U.condition))W=$0(U.condition,Object.keys(Y))(...Object.values(Y));else if(U.condition)W=Z0(U.condition,Y);if(W)q=U.content,_=!0}catch(W){q=o(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${W instanceof Error?W.message:String(W)}`,l.EVALUATION_ERROR),_=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),U=o("If",`Error processing @if block: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(Q());return X}function M2($){let Y=0;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let Z=$[Y];if(Z!=="'"&&Z!=='"')return null;Y++;let X=[];while(Y<$.length){let Q=$[Y];if(Q==="\\"&&Y+1<$.length){X.push($[Y+1]),Y+=2;continue}if(Q===Z){Y++;break}X.push(Q),Y++}while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return Y++,{value:X.join(""),consumed:Y}}function Q4($,Y){let Z=$;function X(K,q,_,U){let W=1,B=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${_}(?![a-z])`,"g");while(B<K.length&&W>0){j.lastIndex=B,z.lastIndex=B;let O=j.exec(K),L=z.exec(K),F=O?O.index:1/0,H=L?L.index:1/0;if(F<H)W++,B=F+O[0].length;else if(H<1/0){if(W--,W===0)return H;B=H+L[0].length}else break}return-1}function Q(K,q,_){let U=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${_}(?![a-z])`,"g"),j=/@else(?![a-z])/g,z=[],O;while((O=W.exec(K))!==null)z.push({pos:O.index,type:"open"});while((O=B.exec(K))!==null)z.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)z.push({pos:O.index,type:"else"});z.sort((L,F)=>L.pos-F.pos);for(let L of z)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+5),j=M2(B);if(j)U=j.value,W=_+5+j.consumed;else W=_+5;let z=X(Z,"auth","endauth",W);if(z===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"auth","endauth"),F;if(!Y.auth)F=!1;else F=U?a0(`auth?.check && auth?.user?.[${U}]`,Y):a0("auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+8),K=!0}}{let K=!0;while(K){K=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+6),j=M2(B);if(j)U=j.value,W=_+6+j.consumed;else W=_+6;let z=X(Z,"guest","endguest",W);if(z===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"guest","endguest"),F;if(!Y.auth)F=!0;else F=U?a0(`!auth?.check || !auth?.user?.[${U}]`,Y):a0("!auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+9),K=!0}}function J(K,q,_){if(Y.userCan&&typeof Y.userCan[K]==="boolean")return Y.userCan[K];if(Y.permissions?.check&&typeof Y.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(_){let W=a0(_,Y);U.push(W)}return Y.permissions.check(...U)}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}`,_=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=Z.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let B=W.index,j=Z.slice(B+`@${K}`.length),z=G(j);if(!z)break;let O=B+`@${K}`.length+z.paramsEnd,L=X(Z,K,q,O);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Z.slice(O,L),H=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${_}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],I;while((I=N.exec(F))!==null)T.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)T.push({pos:I.index,type:"close"});while((I=A.exec(F))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=w.exec(F))!==null)T.push({pos:I.index,type:"else"});T.sort((S,k)=>S.pos-k.pos);for(let S of T){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)H.push(S)}let M=[],E=0;for(let S=0;S<H.length;S++){let k=H[S];if(M.push({content:F.slice(E,k.pos),ability:void 0}),k.type==="elseDirective"){let g=F.slice(k.pos+`@${_}`.length),h=G(g);if(h){M[M.length-1]={content:F.slice(E,k.pos)},E=k.pos+`@${_}`.length+h.paramsEnd,M.push({content:"",ability:h.ability,type:h.type,id:h.id}),M.pop();let r=H[S+1],U0=r?r.pos:F.length;M.push({content:F.slice(E,U0),ability:h.ability,type:h.type,id:h.id}),E=U0}}else E=k.pos+5}if(E<F.length){let S=M[M.length-1];if(H.length>0&&H[H.length-1].type==="else")M.push({content:F.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:F.slice(E)})}let D=J(z.ability,z.type,z.id),P=K==="can"?D:!D,y="";if(P)y=M[0]?.content||"";else{let S=!1;for(let k=1;k<M.length;k++){let g=M[k];if(g.isFinalElse){y=g.content,S=!0;break}if(g.ability){let h=J(g.ability,g.type,g.id);if(K==="can"?h:!h){y=g.content,S=!0;break}}}if(!S&&M.length>0){let k=M[M.length-1];if(k.isFinalElse)y=k.content}}Z=Z.substring(0,B)+y+Z.substring(L+`@${q}`.length),U=!0}}return Z}function G4($,Y,Z){let X=$;function Q(J,G,K,q,_){let U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\s*\\(`),B=J.match(W);if(!B||B.index===void 0)break;let j=B.index,z=t0(J,j+`@${G}`.length);if(!z)break;let O=z.endPos,L=j1(J,G,K,O);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(O,L),H=z.expression,V=-1,N=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let w=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){N++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){N--,R=A+1;continue}if(N===0&&/^@else(?![a-z])/.test(w)){V=A;break}R=A+1}try{let A=q(H.trim()),w;if(V!==-1){let T=F.slice(0,V),I=F.slice(V+5);w=A?T:I}else w=A?F:"";J=J.substring(0,j)+w+J.substring(L+`@${K}`.length),U=!0}catch(A){let w=A instanceof Error?A.message:String(A),T=o(_,`Error processing @${G} directive: ${w}`,l.EVALUATION_ERROR);J=J.substring(0,j)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=a0(J,Y);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=a0(J,Y);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 K4($,Y,Z){let X=$,Q="development";function J(G,K,q,_){let U=new RegExp(`@${K}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),z=G,O=!0;while(O){O=!1,U.lastIndex=0;let L=U.exec(z);if(!L)break;let F=L.index,H=F+L[0].length;if(K==="env"){let D=z.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;H+=D[0].length,_=Q===D[2]}let V=1,N=H,R=-1;while(V>0&&N<z.length){U.lastIndex=N,W.lastIndex=N;let D=U.exec(z),P=W.exec(z),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,N=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}N=S+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=z.substring(H,R),w=-1,T=0,I=0;while(I<A.length){let D=A.indexOf("@",I);if(D===-1)break;let P=A.substring(D);if(B.test(P)){T++,I=D+1;continue}if(j.test(P)){T--,I=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){w=D;break}I=D+1}let M;if(w!==-1){let D=A.slice(0,w),P=A.slice(w+5);M=_?D:P}else M=_?A:"";let E=`@${q}`.length;z=z.substring(0,F)+M+z.substring(R+E),O=!0}return z}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 z9=b(()=>{N2();c0();J4();N0()});function E2($=16){let Y=new Uint8Array($);return crypto.getRandomValues(Y),btoa(String.fromCharCode(...Y))}function j9($,Y){if(!$)return Y?.nonceGenerator?.()??E2();let Z=I2.get($);if(!Z)Z=Y?.nonceGenerator?.()??E2(),I2.set($,Z);return Z}function fG($,Y){let Z=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Z.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Y&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Y}'`);if(J.length>0)Z.push(`${X} ${J.join(" ")}`)}}return Z.join("; ")}function D2($,Y){return`<meta http-equiv="Content-Security-Policy" content="${fG($,Y).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function k2($,Y,Z){if(!Y.enabled||!Y.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Y.useNonce?j9(Z,Y):void 0,Q=D2(Y.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3659
- ${Q}`)}function b2($,Y,Z,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?j9(Y,J):void 0;return D2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return j9(Y,J)}),J?.enabled&&J.useNonce)Y.cspNonce=j9(Y,J);return Q}var I2;var S2=b(()=>{I2=new WeakMap});import gG from"crypto";function dG($=hG){let Y=gG.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return q4=Y,Y}function mG(){if(!q4)dG();return q4}function uG($=y2){let Y=mG();return`<input type="hidden" name="${$}" value="${Y}">`}function P2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Y,Z,X)=>{return uG(X||y2)})}var hG=40,y2="_token",q4=null;var C2=()=>{};async function v2($,Y,Z,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 lG(Q,J,Y,Z,X);else Q=await pG(Q,J,Y,Z,X)}return Q}async function lG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=`@${J}`,q=`@end${J}`,_=$,U=M1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],B=U.exec(_);while(B!==null){let[j,z="",O=""]=B,L=B.index||0;try{let F=z?x2(z):[],H=O.trim(),V=await G(H,F,Z,X);W.push({original:j,processed:V,startIndex:L})}catch(F){let H=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);W.push({original:j,processed:o("CustomDirective",`Error in @${J}${z?`(${z})`:""}: ${H}`,l.EVALUATION_ERROR),startIndex:L})}B=U.exec(_)}for(let j=W.length-1;j>=0;j--){let{original:z,processed:O}=W[j];_=_.replace(z,O)}return _}async function pG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=$,q=M1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],U=q.exec(K);while(U!==null){let[j,z=""]=U,O=U.index||0;try{let L=x2(z),F=await G("",L,Z,X);_.push({original:j,processed:F,startIndex:O})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);_.push({original:j,processed:o("CustomDirective",`Error in @${J}(${z}): ${F}`,l.EVALUATION_ERROR),startIndex:O})}U=q.exec(K)}let W=M1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=W.exec(K);while(B!==null){let[j]=B,z=B.index||0;try{let O=await G("",[],Z,X);_.push({original:j,processed:O,startIndex:z})}catch(O){let L=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${J}:`,O);_.push({original:j,processed:o("CustomDirective",`Error in @${J}: ${L}`,l.EVALUATION_ERROR),startIndex:z})}B=W.exec(K)}for(let j=_.length-1;j>=0;j--){let{original:z,processed:O}=_[j];K=K.replace(z,O)}return K}function x2($){if(!$.trim())return[];let Y=[],Z="",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 Z+=G;else if(G===","&&!X)Y.push(Z.trim()),Z="";else Z+=G}if(Z.trim())Y.push(Z.trim());return Y.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 f2=b(()=>{c0();I1()});import cG from"crypto";function L0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function O9($,Y,Z,X){let Q=$||Y;return Z?`${Q} ${X}`:Q}function iG(){return cG.randomUUID()}function H9($,Y){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!Y.csrf||typeof Y.csrf!=="object"){let X=iG();Y.csrf={token:X}}if(Y.csrf.field)return Y.csrf.field;if(Y.csrf.token)return`<input type="hidden" name="_token" value="${L0(Y.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${L0(J)}">`;return X}),Z}function d2($,Y,Z=h2){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"POST",W=K||q||"",B=e0(_),j=U.toUpperCase(),z=["GET","POST"].includes(j)?j:"POST",O=`<form method="${L0(z)}" action="${L0(W)}"${B?` ${B}`:""}>`;if(O+=`
3658
+ `+Q.slice(G);else Q+=J;return Q}function MG($,Y){let Z=$;for(let X of Y){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${_9(X.stateExpr)}["']`,"gi").exec(Z);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*["']${_9(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Z);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${_9(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Z=Z.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${_9(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Z=Z.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Z=Z.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Z=Z.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Z=Z.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Z}function IG($){return/x-data\s*=\s*["']/.test($)}var H2=0,FG=0;var F2=S(()=>{p0()});import EG from"fs";import $4 from"path";import{createHighlighter as DG}from"ts-syntax-highlighter";async function kG($,Y={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await EG.promises.stat($)).mtime.getTime();if(Y.cache&&Y4.has($)){let W=Y4.get($);if(W.updatedAt>=X)return{content:W.content,data:W.data}}let Q=await Bun.file($).text(),{data:J,content:G}=n7(Q),K=Y.markdown||a$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=c1(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await bG(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:_,data:J||{}};if(Y.cache)Y4.set($,{...U,updatedAt:X});return U}catch(Z){if(Y.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let X=Z instanceof Error?Z.message:String(Z);return{content:X0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function bG($,Y,Z){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W9)try{W9=await DG({theme:Y||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,_,U)=>{let W=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=_||(Z?"text":"");if(!B)return K;try{if(!W9.getSupportedLanguages().includes(B))return K;return(await W9.highlight(W,B,{theme:Y})).html}catch(j){console.error(`Error highlighting code block with language ${_}:`,j)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,_,U,W]=K,B=await Q(q,_,U,W);J=J.replace(q,B)}return J}async function V2($,Y,Z="",X={}){return await SG($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,_)=>{try{let U=K;if(!$4.isAbsolute(K))U=$4.resolve($4.dirname(Z),K);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let H=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of H){let N=V.indexOf(":");if(N>0){let R=V.substring(0,N).trim(),A=V.substring(N+1).trim(),w=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(w||T)A=A.substring(1,A.length-1);W[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:j}=await kG(U,X),z={...Y,...j,...W},O=B,L=/\{\{([^}]+)\}\}/g;return O=O.replace(L,(F,H)=>{let V=H.trim();return z[V]!==void 0?String(z[V]):F}),O}catch(U){let W=U instanceof Error?U.message:String(U);return X0("Markdown File",`Error including markdown file: ${W}`,Z,$,_,G)}})}async function SG($,Y,Z){let X=[],Q;while((Q=Y.exec($))!==null){let K=Q[0],q=Q.index,_=Q;X.push(Z(..._).then((U)=>({match:K,replacement:U,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 Y4,W9=null;var R2=S(()=>{U9();V0();Y4=new Map});function a0($,Y){try{let Z=$.trim();if(t(Z))return $0(Z,Object.keys(Y))(...Object.values(Y));else return Z0(Z,Y)}catch{return!1}}var N2=S(()=>{N0()});function t0($,Y){let Z=yG($,Y);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function yG($,Y){let Z=Y;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let X=M0($,"(",")",Z);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,X),endPos:X+1}}function j1($,Y,Z,X){let Q=1,J=X,G=new RegExp(`@${Y}\\s*\\(`,"g"),K=new RegExp(`@${Z}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),_=K.exec($),U=q?q.index:1/0,W=_?_.index:1/0;if(U<W)Q++,J=U+q[0].length;else if(W<1/0){if(Q--,Q===0)return W;J=W+_[0].length}else break}return-1}function A2($,Y){let Z=$.slice(Y).match(/^@if\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=t0($,X);if(!Q)return null;let J=Q.endPos,G=j1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U="if",W=Q.expression,B=0,j=0;while(_<K.length){let z=K.indexOf("@",_);if(z===-1)break;_=z;let O=K.substring(z);if(/^@if\s*\(/.test(O)){j++,_++;continue}if(/^@endif(?![a-z])/.test(O)){j--,_+=6;continue}if(j===0){let L=O.match(/^@elseif\s*/);if(L){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_});let F=_+L[0].length,H=t0(K,F);if(!H){_++;continue}U="elseif",W=H.expression,_=H.endPos,B=_;continue}else if(/^@else(?![a-z])/.test(O)){q.push({type:U,condition:W,content:K.substring(B,_),start:J+B,end:J+_}),U="else",W=void 0,_+=5,B=_;continue}}_++}return q.push({type:U,condition:W,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Y,G+6),branches:q,start:Y,end:G+6}}function Z4($){let Y=[],Z=/@if\s*\(/g,X=Z.exec($);while(X!==null){if(Y.some((G)=>X.index>G.start&&X.index<G.end)){X=Z.exec($);continue}let J=A2($,X.index);if(J)Y.push(J),Z.lastIndex=J.end;X=Z.exec($)}return Y}function B9($,Y,Z){let X=[],Q=new RegExp(`@${Y}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((O)=>J.index>O.start&&J.index<O.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,_=M0($,"(",")",q);if(_===-1){J=Q.exec($);continue}let U=$.slice(q+1,_),W=_+1,B=j1($,Y,Z,W);if(B===-1){J=Q.exec($);continue}let j=$.slice(W,B),z=B+`@${Z}`.length;X.push({fullMatch:$.slice(K,z),name:Y,params:U,content:j,start:K,end:z}),Q.lastIndex=z,J=Q.exec($)}return X}function X4($,Y){let Z=$.slice(Y).match(/^@switch\s*/);if(!Z)return null;let X=Y+Z[0].length,Q=t0($,X);if(!Q)return null;let J=Q.endPos,G=j1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],_=0,U=null,W=0;while(_<K.length){let B=K.slice(_),j=B.match(/^@switch\s*\(/),z=B.match(/^@endswitch(?![a-z])/);if(j){if(W++,U)U.content+=j[0];_+=j[0].length;continue}if(z){if(W--,U)U.content+=z[0];_+=z[0].length;continue}if(W>0){if(U)U.content+=K[_];_++;continue}let O=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(O&&B.startsWith("@case")){if(U)q.push(U);let H=_+O[0].length,V=t0(K,H);if(!V){_++;continue}U={type:"case",value:V.expression,content:""},_=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},_+=L[0].length}else if(F&&B.startsWith("@break"))_+=F[0].length;else{if(U)U.content+=K[_];_++}}if(U)q.push(U);return{fullMatch:$.slice(Y,G+10),expression:Q.expression,cases:q,start:Y,end:G+10}}var w2=()=>{};var T2=()=>{};var J4=S(()=>{w2();T2()});function xG($,Y,Z){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=X4(X,G);if(!K)break;try{let q;if(t(K.expression))q=$0(K.expression,Object.keys(Y))(...Object.values(Y));else q=Z0(K.expression,Y);let _="",U=!1;for(let W of K.cases)if(W.type==="default"){if(!U)_=W.content.trim()}else try{let B;if(W.value&&t(W.value))B=$0(W.value,Object.keys(Y))(...Object.values(Y));else if(W.value)B=Z0(W.value,Y);if(q===B){_=W.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+_+X.substring(K.end),Q=!0}catch(q){let _=q instanceof Error?q.message:String(q),U=o("Switch",`Error evaluating @switch expression: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function O1($,Y,Z){let X=$;X=xG(X,Y,Z);{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=t0(X,K+7);if(!q)break;let _=q.endPos,U=j1(X,"unless","endunless",_);if(U===-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 W=X.slice(_,U),B=q.expression,j=-1;{let O=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,H=/@else(?![a-z])/g,V=[],N;while((N=L.exec(W))!==null)V.push({pos:N.index,type:"open"});while((N=F.exec(W))!==null)V.push({pos:N.index,type:"close"});while((N=H.exec(W))!==null)V.push({pos:N.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")O++;else if(R.type==="close")O--;else if(R.type==="else"&&O===0){j=R.pos;break}}let z;if(j!==-1){let O=W.slice(0,j),L=W.slice(j+5);z=`@if (${B})${L}@else ${O}@endif`}else z=`@if (!(${B}))${W}@endif`;X=X.substring(0,K)+z+X.substring(U+10),J=!0}}X=G4(X,Y,Z),X=K4(X,Y,Z),X=Q4(X,Y);let Q=()=>{let J=Z4(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",_=!1;for(let U of K.branches){if(_)break;if(U.type==="else")q=U.content,_=!0;else try{let W;if(U.condition&&t(U.condition))W=$0(U.condition,Object.keys(Y))(...Object.values(Y));else if(U.condition)W=Z0(U.condition,Y);if(W)q=U.content,_=!0}catch(W){q=o(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${W instanceof Error?W.message:String(W)}`,l.EVALUATION_ERROR),_=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),U=o("If",`Error processing @if block: ${_}`,l.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(Q());return X}function M2($){let Y=0;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let Z=$[Y];if(Z!=="'"&&Z!=='"')return null;Y++;let X=[];while(Y<$.length){let Q=$[Y];if(Q==="\\"&&Y+1<$.length){X.push($[Y+1]),Y+=2;continue}if(Q===Z){Y++;break}X.push(Q),Y++}while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return Y++,{value:X.join(""),consumed:Y}}function Q4($,Y){let Z=$;function X(K,q,_,U){let W=1,B=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${_}(?![a-z])`,"g");while(B<K.length&&W>0){j.lastIndex=B,z.lastIndex=B;let O=j.exec(K),L=z.exec(K),F=O?O.index:1/0,H=L?L.index:1/0;if(F<H)W++,B=F+O[0].length;else if(H<1/0){if(W--,W===0)return H;B=H+L[0].length}else break}return-1}function Q(K,q,_){let U=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${_}(?![a-z])`,"g"),j=/@else(?![a-z])/g,z=[],O;while((O=W.exec(K))!==null)z.push({pos:O.index,type:"open"});while((O=B.exec(K))!==null)z.push({pos:O.index,type:"close"});while((O=j.exec(K))!==null)z.push({pos:O.index,type:"else"});z.sort((L,F)=>L.pos-F.pos);for(let L of z)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+5),j=M2(B);if(j)U=j.value,W=_+5+j.consumed;else W=_+5;let z=X(Z,"auth","endauth",W);if(z===-1){console.warn(`[stx] @auth directive at position ${_} has no matching @endauth \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"auth","endauth"),F;if(!Y.auth)F=!1;else F=U?a0(`auth?.check && auth?.user?.[${U}]`,Y):a0("auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+8),K=!0}}{let K=!0;while(K){K=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let _=q.index,U,W,B=Z.slice(_+6),j=M2(B);if(j)U=j.value,W=_+6+j.consumed;else W=_+6;let z=X(Z,"guest","endguest",W);if(z===-1){console.warn(`[stx] @guest directive at position ${_} has no matching @endguest \u2014 the block was skipped.`);break}let O=Z.slice(W,z),L=Q(O,"guest","endguest"),F;if(!Y.auth)F=!0;else F=U?a0(`!auth?.check || !auth?.user?.[${U}]`,Y):a0("!auth?.check",Y);let H;if(L!==-1){let V=O.slice(0,L),N=O.slice(L+5);H=F?V:N}else H=F?O:"";Z=Z.substring(0,_)+H+Z.substring(z+9),K=!0}}function J(K,q,_){if(Y.userCan&&typeof Y.userCan[K]==="boolean")return Y.userCan[K];if(Y.permissions?.check&&typeof Y.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(_){let W=a0(_,Y);U.push(W)}return Y.permissions.check(...U)}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}`,_=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=Z.match(new RegExp(`@${K}\\s*\\(`));if(!W||W.index===void 0)break;let B=W.index,j=Z.slice(B+`@${K}`.length),z=G(j);if(!z)break;let O=B+`@${K}`.length+z.paramsEnd,L=X(Z,K,q,O);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Z.slice(O,L),H=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${_}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],D;while((D=N.exec(F))!==null)T.push({pos:D.index,type:"open"});while((D=R.exec(F))!==null)T.push({pos:D.index,type:"close"});while((D=A.exec(F))!==null)T.push({pos:D.index,type:"elseDirective"});while((D=w.exec(F))!==null)T.push({pos:D.index,type:"else"});T.sort((k,b)=>k.pos-b.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)H.push(k)}let I=[],M=0;for(let k=0;k<H.length;k++){let b=H[k];if(I.push({content:F.slice(M,b.pos),ability:void 0}),b.type==="elseDirective"){let x=F.slice(b.pos+`@${_}`.length),d=G(x);if(d){I[I.length-1]={content:F.slice(M,b.pos)},M=b.pos+`@${_}`.length+d.paramsEnd,I.push({content:"",ability:d.ability,type:d.type,id:d.id}),I.pop();let s=H[k+1],K0=s?s.pos:F.length;I.push({content:F.slice(M,K0),ability:d.ability,type:d.type,id:d.id}),M=K0}}else M=b.pos+5}if(M<F.length){let k=I[I.length-1];if(H.length>0&&H[H.length-1].type==="else")I.push({content:F.slice(M),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(M)})}let E=J(z.ability,z.type,z.id),C=K==="can"?E:!E,P="";if(C)P=I[0]?.content||"";else{let k=!1;for(let b=1;b<I.length;b++){let x=I[b];if(x.isFinalElse){P=x.content,k=!0;break}if(x.ability){let d=J(x.ability,x.type,x.id);if(K==="can"?d:!d){P=x.content,k=!0;break}}}if(!k&&I.length>0){let b=I[I.length-1];if(b.isFinalElse)P=b.content}}Z=Z.substring(0,B)+P+Z.substring(L+`@${q}`.length),U=!0}}return Z}function G4($,Y,Z){let X=$;function Q(J,G,K,q,_){let U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\s*\\(`),B=J.match(W);if(!B||B.index===void 0)break;let j=B.index,z=t0(J,j+`@${G}`.length);if(!z)break;let O=z.endPos,L=j1(J,G,K,O);if(L===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(O,L),H=z.expression,V=-1,N=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let w=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){N++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){N--,R=A+1;continue}if(N===0&&/^@else(?![a-z])/.test(w)){V=A;break}R=A+1}try{let A=q(H.trim()),w;if(V!==-1){let T=F.slice(0,V),D=F.slice(V+5);w=A?T:D}else w=A?F:"";J=J.substring(0,j)+w+J.substring(L+`@${K}`.length),U=!0}catch(A){let w=A instanceof Error?A.message:String(A),T=o(_,`Error processing @${G} directive: ${w}`,l.EVALUATION_ERROR);J=J.substring(0,j)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=a0(J,Y);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=a0(J,Y);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 K4($,Y,Z){let X=$,Q="development";function J(G,K,q,_){let U=new RegExp(`@${K}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),z=G,O=!0;while(O){O=!1,U.lastIndex=0;let L=U.exec(z);if(!L)break;let F=L.index,H=F+L[0].length;if(K==="env"){let E=z.substring(H).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;H+=E[0].length,_=Q===E[2]}let V=1,N=H,R=-1;while(V>0&&N<z.length){U.lastIndex=N,W.lastIndex=N;let E=U.exec(z),C=W.exec(z),P=E?E.index:1/0,k=C?C.index:1/0;if(P<k)V++,N=P+E[0].length;else if(k<1/0){if(V--,V===0){R=k;break}N=k+C[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=z.substring(H,R),w=-1,T=0,D=0;while(D<A.length){let E=A.indexOf("@",D);if(E===-1)break;let C=A.substring(E);if(B.test(C)){T++,D=E+1;continue}if(j.test(C)){T--,D=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){w=E;break}D=E+1}let I;if(w!==-1){let E=A.slice(0,w),C=A.slice(w+5);I=_?E:C}else I=_?A:"";let M=`@${q}`.length;z=z.substring(0,F)+I+z.substring(R+M),O=!0}return z}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 z9=S(()=>{N2();c0();J4();N0()});function E2($=16){let Y=new Uint8Array($);return crypto.getRandomValues(Y),btoa(String.fromCharCode(...Y))}function j9($,Y){if(!$)return Y?.nonceGenerator?.()??E2();let Z=I2.get($);if(!Z)Z=Y?.nonceGenerator?.()??E2(),I2.set($,Z);return Z}function fG($,Y){let Z=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Z.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Y&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Y}'`);if(J.length>0)Z.push(`${X} ${J.join(" ")}`)}}return Z.join("; ")}function D2($,Y){return`<meta http-equiv="Content-Security-Policy" content="${fG($,Y).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function k2($,Y,Z){if(!Y.enabled||!Y.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Y.useNonce?j9(Z,Y):void 0,Q=D2(Y.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3659
+ ${Q}`)}function b2($,Y,Z,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?j9(Y,J):void 0;return D2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return j9(Y,J)}),J?.enabled&&J.useNonce)Y.cspNonce=j9(Y,J);return Q}var I2;var S2=S(()=>{I2=new WeakMap});import gG from"crypto";function dG($=hG){let Y=gG.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return q4=Y,Y}function mG(){if(!q4)dG();return q4}function uG($=y2){let Y=mG();return`<input type="hidden" name="${$}" value="${Y}">`}function P2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Y,Z,X)=>{return uG(X||y2)})}var hG=40,y2="_token",q4=null;var C2=()=>{};async function v2($,Y,Z,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 lG(Q,J,Y,Z,X);else Q=await pG(Q,J,Y,Z,X)}return Q}async function lG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=`@${J}`,q=`@end${J}`,_=$,U=M1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],B=U.exec(_);while(B!==null){let[j,z="",O=""]=B,L=B.index||0;try{let F=z?x2(z):[],H=O.trim(),V=await G(H,F,Z,X);W.push({original:j,processed:V,startIndex:L})}catch(F){let H=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);W.push({original:j,processed:o("CustomDirective",`Error in @${J}${z?`(${z})`:""}: ${H}`,l.EVALUATION_ERROR),startIndex:L})}B=U.exec(_)}for(let j=W.length-1;j>=0;j--){let{original:z,processed:O}=W[j];_=_.replace(z,O)}return _}async function pG($,Y,Z,X,Q){let{name:J,handler:G}=Y,K=$,q=M1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),_=[],U=q.exec(K);while(U!==null){let[j,z=""]=U,O=U.index||0;try{let L=x2(z),F=await G("",L,Z,X);_.push({original:j,processed:F,startIndex:O})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);_.push({original:j,processed:o("CustomDirective",`Error in @${J}(${z}): ${F}`,l.EVALUATION_ERROR),startIndex:O})}U=q.exec(K)}let W=M1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=W.exec(K);while(B!==null){let[j]=B,z=B.index||0;try{let O=await G("",[],Z,X);_.push({original:j,processed:O,startIndex:z})}catch(O){let L=O instanceof Error?O.message:String(O);if(Q.debug)console.error(`Error processing custom directive @${J}:`,O);_.push({original:j,processed:o("CustomDirective",`Error in @${J}: ${L}`,l.EVALUATION_ERROR),startIndex:z})}B=W.exec(K)}for(let j=_.length-1;j>=0;j--){let{original:z,processed:O}=_[j];K=K.replace(z,O)}return K}function x2($){if(!$.trim())return[];let Y=[],Z="",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 Z+=G;else if(G===","&&!X)Y.push(Z.trim()),Z="";else Z+=G}if(Z.trim())Y.push(Z.trim());return Y.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 f2=S(()=>{c0();I1()});import cG from"crypto";function L0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function O9($,Y,Z,X){let Q=$||Y;return Z?`${Q} ${X}`:Q}function iG(){return cG.randomUUID()}function H9($,Y){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!Y.csrf||typeof Y.csrf!=="object"){let X=iG();Y.csrf={token:X}}if(Y.csrf.field)return Y.csrf.field;if(Y.csrf.token)return`<input type="hidden" name="_token" value="${L0(Y.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${L0(J)}">`;return X}),Z}function d2($,Y,Z=h2){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"POST",W=K||q||"",B=e0(_),j=U.toUpperCase(),z=["GET","POST"].includes(j)?j:"POST",O=`<form method="${L0(z)}" action="${L0(W)}"${B?` ${B}`:""}>`;if(O+=`
3660
3660
  ${H9("@csrf",Y)}`,!["GET","POST"].includes(j))O+=`
3661
- ${H9(`@method('${j}')`,Y)}`;return O}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"",W=K||q||"",B=e0(_),j=J5(U,Y),z=j!==void 0&&j!==null?j:W||"",O=B.match(/type=['"]([^'"]+)['"]/i),L=O?O[1]:"text",F=Q5(U,Y),H=B.match(/class=['"]([^'"]+)['"]/i),V=O9(H?H[1]:"",Z.input,F,Z.inputError),N=B.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${L0(L)}" name="${L0(U)}" value="${L0(z)}" class="${V}"${N?` ${N}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=e0(G),_=J5(J,Y)||K.trim(),U=Q5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=O9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${L0(J)}" class="${B}"${j?` ${j}`:""}>${L0(_)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=e0(G),_=J5(J,Y),U=Q5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=O9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),z=K;if(_!==void 0)z=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,L,F)=>{if((Array.isArray(_)?_.some((V)=>String(V)===F):String(_)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return O});return`<select name="${L0(J)}" class="${B}"${j?` ${j}`:""}>${z}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=e0(K),_=J5(J,Y),U=_!==void 0&&(Array.isArray(_)?_.some((z)=>String(z)===G):_===!0||String(_)===G),W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${L0(J)}" value="${L0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=e0(K),_=J5(J,Y),U=_!==void 0&&_===G,W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${L0(J)}" value="${L0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=e0(G),q=K.match(/accept=['"]([^'"]+)['"]/i),_=q?q[1]:"",U=K.includes("multiple"),W=Q5(J,Y),B=K.match(/class=['"]([^'"]+)['"]/i),j=O9(B?B[1]:"",Z.input,W,Z.inputError),z=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${L0(J)}"`,`class="${j}"`];if(_)O.push(`accept="${L0(_)}"`);if(U)O.push("multiple");if(z)O.push(z);return`${O.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=e0(G),_=q.match(/class=['"]([^'"]+)['"]/i),U=_?_[1]:Z.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${L0(J)}" class="${U}"${W?` ${W}`:""}>${K}</label>`}),X}function m2($,Y,Z=h2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(Q5(Q,Y))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return g2(Q,Y);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Y.errors?.first==="function")return Y.errors.first(Q);return g2(Q,Y)}let q=K.trim();if(t(q)){let _=Z0(q,Y);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function Q5($,Y){if(!Y.errors)return!1;if(typeof Y.errors.has==="function")return Y.errors.has($);if(typeof Y.errors==="object")return Object.prototype.hasOwnProperty.call(Y.errors,$);return!1}function g2($,Y){if(!Y.errors)return"";if(typeof Y.errors.get==="function")return Y.errors.get($);if(typeof Y.errors==="object"&&Object.prototype.hasOwnProperty.call(Y.errors,$)){let Z=Y.errors[$];return Array.isArray(Z)?Z[0]:String(Z)}return""}function J5($,Y){let Z;if(Y.old&&typeof Y.old==="function")return Y.old($);if(Y.old&&typeof Y.old==="object")return Y.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Z=Y[X],Z!==void 0)return Z}return Y[$]}function e0($){if(!$.trim())return"";let Y=[],Z=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Z))!==null){let[,J,,G]=Q;Y.push(`${J}="${G.trim()}"`)}return Y.join(" ")}var h2;var u2=b(()=>{N0();h2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import l2 from"path";function nG($,Y=0){if(Y<=0)return!1;return Date.now()-$.loadedAt>Y}async function oG($,Y){if({...B4,...Y.i18n}.cache&&W4[$]){let Q=W4[$],J=Y.i18n?.cacheMaxAge??0;if(!nG(Q,J))return Q.translations}if(G5[$]?.state==="loading")return G5[$].promise;U4[$]="loading";let X=i2($,Y).then((Q)=>{return U4[$]="loaded",delete G5[$],Q}).catch((Q)=>{throw U4[$]="error",G5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return G5[$]={promise:X,state:"loading"},X}async function i2($,Y){let Z={...B4,...Y.i18n},X=l2.resolve(import.meta.dir,"..",Z.translationsDir),Q=tG(Z.format),J=l2.join(X,`${$}${Q}`);try{let G={};try{let K=await import(J);G=K.default||K}catch(K){let q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")G=rG(q);else if(Z.format==="json")G=JSON.parse(q);else throw K}if(Z.cache)W4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Y.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==Z.defaultLocale)return i2(Z.defaultLocale,Y);return{}}}async function sG($,Y){return oG($,Y)}function rG($){let Y={},Z=$.split(`
3662
- `),X=[{obj:Y,indent:-1}];for(let Q of Z){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[,,_,U]=q,W=_.trim(),B=U.trim();if(B==="")K[W]={},X.push({obj:K[W],indent:G});else K[W]=aG(B)}}return Y}function aG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Y=$.toLowerCase();if(Y==="true"||Y==="yes")return!0;if(Y==="false"||Y==="no")return!1;if(Y==="null"||Y==="~")return null;let Z=Number($);if(!Number.isNaN(Z))return Z;return $}function tG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function eG($,Y){for(let Z of $){let X=Z.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Y===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(Y>=G&&Y<=K)return J[3];continue}}if($.length===2)return Y===1?$[0].trim():$[1].trim();if(Y<$.length)return $[Y].trim();return $[$.length-1].trim()}function $K($,Y={}){return n2($,Y)}function n2($,Y){let Z="",X=0;while(X<$.length)if($[X]==="{"){let Q=YK($,X);if(Q===-1){Z+=$[X],X++;continue}let J=$.slice(X+1,Q);Z+=ZK(J,Y),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Z+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Z+=$[X+1],X+=2;else Z+=$[X],X++;else Z+=$[X],X++;return Z}function YK($,Y){let Z=0;for(let X=Y;X<$.length;X++)if($[X]==="{")Z++;else if($[X]==="}"){if(Z--,Z===0)return X}return-1}function ZK($,Y){let Z=XK($);if(Z.length===0)return`{${$}}`;let X=Z[0].trim(),Q=Y[X];if(Z.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Z[1].trim().toLowerCase()){case"plural":return JK(Q,Z.slice(2).join(","),Y);case"select":return GK(Q,Z.slice(2).join(","));case"selectordinal":return KK(Q,Z.slice(2).join(","));case"number":return UK(Q,Z[2]?.trim());case"date":return _K(Q,Z[2]?.trim());case"time":return WK(Q,Z[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function XK($){let Y=[],Z="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Z+=J;else if(J==="}")X--,Z+=J;else if(J===","&&X===0)Y.push(Z),Z="";else Z+=J}if(Z)Y.push(Z);return Y}function JK($,Y,Z){let X=Number($)||0,Q=z4(Y),J=`=${X}`;if(Q[J])return _4(Q[J],X,Z);let G=QK(X);if(Q[G])return _4(Q[G],X,Z);if(Q.other)return _4(Q.other,X,Z);return String(X)}function _4($,Y,Z){let X=$.replace(/#/g,String(Y));return n2(X,Z)}function QK($){let Y=Math.abs($),Z=Math.floor(Y),X=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&X===0)return"one";return"other"}function GK($,Y){let Z=String($||""),X=z4(Y);if(X[Z])return X[Z];return X.other||String($)}function KK($,Y){let Z=Number($)||0,X=z4(Y),Q=qK(Z);if(X[Q])return X[Q].replace(/#/g,String(Z));if(X.other)return X.other.replace(/#/g,String(Z));return String(Z)}function qK($){let Y=Math.abs($),Z=Y%10,X=Y%100;if(Z===1&&X!==11)return"one";if(Z===2&&X!==12)return"two";if(Z===3&&X!==13)return"few";return"other"}function z4($){let Y={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Z.exec($);while(X!==null)Y[X[1]]=X[2],X=Z.exec($);return Y}function UK($,Y){let Z=Number($);if(Number.isNaN(Z))return String($);switch(Y){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function _K($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleDateString(void 0,X)}function WK($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleTimeString(void 0,X)}function BK($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function p2($,Y,Z=!0,X={}){let Q=$.split("."),J=Y;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Z?$:"";let G=String(J);if(BK(G))return $K(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=eG(q,K)}for(let[K,q]of Object.entries(X)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(q))}return G}async function o2($,Y,Z,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...B4,...X.i18n},K=await sG(G.locale,X);Y.__translations=K,Y.__locale=G.locale,Y.__i18nConfig=G,Q=await c2(Q,J,async(U,W,B,j,z)=>{try{let O={};if(B)try{let F=[()=>JSON.parse(B),()=>{let H=`{"data":${B}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return H0(B,Y)}];for(let H of F)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return p2(W,K,G.fallbackToKey,O)||j.trim()}catch(O){if(X.debug)console.error("Error processing @translate directive:",O);return o("Translate",`Error in @translate('${W}'): ${O instanceof Error?O.message:String(O)}`,l.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 U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((W,B)=>console.warn(`Match ${B}: ${W[0]}, Key: ${W[1]}, Params: ${W[2]||"none"}`))}return Q=await c2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,W,B,j)=>{try{let z={};if(B)try{let O=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return H0(B,Y)}];for(let L of O)try{if(z=L(),Object.keys(z).length>0)break}catch{}}catch(O){if(X.debug)console.error("Error parsing parameters for @translate directive:",O)}return p2(W,K,G.fallbackToKey,z)}catch(z){if(X.debug)console.error("Error processing @translate directive:",z);return o("Translate",`Error in @translate('${W}'): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR)}}),Q}async function c2($,Y,Z){let X=[];return $.replace(Y,(J,...G)=>{let K=Z(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 B4,W4,G5,U4;var s2=b(()=>{c0();N0();B4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},W4={},G5={},U4={}});var Z8={};s(Z8,{processLoops:()=>j4});function OK($,Y){let Z=/@component\s*\(/g,X=$,Q,J=[];while((Q=Z.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)continue;let U=X.substring(K+1,_),W=_+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let j=B[1],z=U.slice(B[0].length),O=z.match(/^\s*,\s*/);if(!O)continue;let L=z.slice(O[0].length).trim();if(!L)continue;try{let F=H0(L,Y),H=JSON.stringify(F),V=`@component('${j}', ${H})`;J.push({start:G,end:W,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];X=X.substring(0,K)+_+X.substring(q)}return X}function L9($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,_=K+1,U=null,W=!1;while(_<X.length&&q>0){let z=X[_];if(W){W=!1,_++;continue}if(z==="\\"&&U){W=!0,_++;continue}if(U){if(z===U)U=null;_++;continue}if(z==='"'||z==="'"||z==="`"){U=z,_++;continue}if(z==="(")q++;else if(z===")"){if(q--,q===0)break}_++}if(q!==0)break;let B=X.substring(K+1,_),j=Z(B);X=X.substring(0,G)+j+X.substring(_+1)}return X}function HK($,Y){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Y)return`:${Q}="${Q}"`;return X}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Y),K=Object.values(Y);i1(J);let _=$0(J,G)(...K),W=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${W}"`}catch(G){return X}}),Z}function LK($,Y){let Z=$;return Z=L9(Z,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(Z0(J,Y));return G?F9:""}catch{return""}}),Z=L9(Z,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(Z0(J,Y));return G?V9:""}catch{return""}}),Z}function FK($){let Y=$;return Y=Y.replace(/@break(?!\()/g,F9),Y=Y.replace(/@continue(?!\()/g,V9),Y}function r2($){let Y=$.includes(F9),Z=Y?$.substring(0,$.indexOf(F9)):$;return{hasBreak:Y,content:Z}}function a2($){let Y=$.includes(V9),Z=Y?$.substring(0,$.indexOf(V9)):$;return{hasContinue:Y,content:Z}}function e2($){let Y=$;return Y=L9(Y,"@break",(Z)=>{let X=Z.trim();if(!w5(X))return"";return`\`; if (${X}) { break; } result += \``}),Y=L9(Y,"@continue",(Z)=>{let X=Z.trim();if(!w5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Y=Y.replace(/@break(?!\()/g,"`; break; result += `"),Y=Y.replace(/@continue(?!\()/g,"`; continue; result += `"),Y}function VK($){let Y=/@forelse\s*\(/g,Z,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((U,W)=>U.pos-W.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function _(U){let W=0,B=K.length-1,j=0;while(W<=B){let z=W+B>>1;if(K[z].pos<=U)j=K[z].depth,W=z+1;else B=z-1}return j}while((Z=Y.exec($))!==null){if(_(Z.index)>0)continue;let U=Z.index,W=Z.index+Z[0].length-1,B=1,j=W+1,z=-1;while(j<$.length&&B>0){if($[j]==="(")B++;else if($[j]===")"){if(B--,B===0){z=j;break}}j++}if(z===-1)continue;let O=$.substring(W+1,z),L=O.indexOf(" as ");if(L===-1)continue;let F=O.substring(0,L).trim(),H=O.substring(L+4).trim(),V=z+1,N=1,R=V,A=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(N>0&&R<$.length){A.lastIndex=R,w.lastIndex=R;let y=A.exec($),S=w.exec($);if(!S)break;if(y&&y.index<S.index)N++,R=y.index+y[0].length;else{if(N--,N===0){T=S.index;break}R=S.index+11}}if(T===-1)continue;let I=$.substring(V,T),M=T+11,E=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){E=y;break}P=y+1}else P=y+1}if(E===-1)continue;return{start:U,end:M,arrayExpr:F,itemVar:H,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function t2($,Y){let Z=$;while(!0){let X=VK(Z);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=X;try{let U;if(t(G))U=$0(G,Object.keys(Y))(...Object.values(Y));else U=Z0(G,Y);let W;if(!Array.isArray(U)||U.length===0)W=_;else W=`@foreach (${G} as ${K})${q}@endforeach`;Z=Z.substring(0,Q)+W+Z.substring(J)}catch(U){let W=U instanceof Error?U.message:String(U),B=o("Forelse",`Error in @forelse(${G} as ${K}): ${W}`,l.EVALUATION_ERROR);Z=Z.substring(0,Q)+B+Z.substring(J)}}return Z}function j4($,Y,Z,X){let Q=$;Q=t2(Q,Y);function J(q){let _=/@foreach\s*\(/g,U;while((U=_.exec(q))!==null){let W=U.index,B=U.index+U[0].length-1,j=1,z=B+1,O=-1;while(z<q.length&&j>0){if(q[z]==="(")j++;else if(q[z]===")"){if(j--,j===0){O=z;break}}z++}if(O===-1)continue;let L=q.substring(B+1,O),F=L.indexOf(" as ");if(F===-1)continue;let H=W,V=L.substring(0,F),N=L.substring(F+4),R=O+1,A=1,w=R,T=/@foreach\s*\(/g,I=/@endforeach/g;while(A>0&&w<q.length){T.lastIndex=w,I.lastIndex=w;let M=T.exec(q),E=I.exec(q);if(!E)break;if(M&&M.index<E.index)A++,w=M.index+M[0].length;else{if(A--,A===0){let D=q.substring(R,E.index),P=E.index+11;return{start:H,end:P,arrayExpr:V,itemVar:N,content:D}}w=E.index+11}}}return null}function G(q,_){let U=q;while(!0){let W=J(U);if(!W)break;let{start:B,end:j,arrayExpr:z,itemVar:O,content:L}=W;try{let F=z.trim(),H;if(t(F))H=$0(F,Object.keys(_))(...Object.values(_));else H=Z0(F,_);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=o("Foreach",`Error in @foreach: ${F} is not iterable`,l.TYPE_ERROR);U=U.substring(0,B)+M+U.substring(j);continue}let N=X?.loops?.useAltLoopVariable??jK,R=O.trim(),A=null,w;if(R.includes("=>")){let M=R.split("=>").map((E)=>E.trim());if(M.length===2)A=M[0],w=M[1];else w=R}else w=R;let T="",I=H;for(let M=0;M<I.length;M++){let E=I[M],D={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},P={..._,loop:D,$loop:D};if(w.startsWith("[")&&w.endsWith("]")){let g=w.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(E))g.forEach((h,r)=>{if(h)P[h]=E[r]});else P[w]=E}else P[w]=E;if(A)if(V&&Array.isArray(E)&&E.length===2)P[A]=E[0],P[w]=E[1];else P[A]=M;let y=LK(L,P),S=a2(y);if(S.hasContinue){T+=S.content;continue}let k=r2(y);if(k.hasBreak){T+=k.content;break}if(y=t2(y,P),y=G(y,P),y=O1(y,P,Z),y=FK(y),k=r2(y),k.hasBreak){T+=k.content;break}if(S=a2(y),S.hasContinue){T+=S.content;continue}y=s0(y,P,Z),y=HK(y,P),y=OK(y,P),T+=y}U=U.substring(0,B)+T+U.substring(j)}catch(F){let H=o("Foreach",`Error in @foreach(${z.trim()} as ${O.trim()}): ${F instanceof Error?F.message:String(F)}`,l.EVALUATION_ERROR);U=U.substring(0,B)+H+U.substring(j)}}return U}Q=G(Q,Y),Q=Y8(Q,Y,Z,X);let K=X?.loops?.maxWhileIterations??zK;return Q=AK(Q,Y,K),Q}function $8($){return w5($)}function Y8($,Y,Z,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,_=M0(Q,"(",")",q);if(_===-1)break;let U=Q.slice(q+1,_),W=_+1,B=B9(Q.slice(K),"for","endfor");if(B.length===0)break;let j=B[0].content,z=K+B[0].end;if(!$8(U)){let O=o("For",`Unsafe expression in @for: ${U}`,l.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+O+Q.substring(z),J=!0;continue}try{let O=RK(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(O.length>0&&L){let A=NK({forExpr:U,content:j,iterVarNames:O,context:Y,filePath:Z,options:X});Q=Q.substring(0,K)+A+Q.substring(z),J=!0;continue}let F=Object.keys(Y),H=Object.values(Y),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,w)=>{return`\${${w}}`});V=e2(V);let R=Function(...F,`
3661
+ ${H9(`@method('${j}')`,Y)}`;return O}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,_="")=>{let U=J||G||"",W=K||q||"",B=e0(_),j=J5(U,Y),z=j!==void 0&&j!==null?j:W||"",O=B.match(/type=['"]([^'"]+)['"]/i),L=O?O[1]:"text",F=Q5(U,Y),H=B.match(/class=['"]([^'"]+)['"]/i),V=O9(H?H[1]:"",Z.input,F,Z.inputError),N=B.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${L0(L)}" name="${L0(U)}" value="${L0(z)}" class="${V}"${N?` ${N}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=e0(G),_=J5(J,Y)||K.trim(),U=Q5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=O9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${L0(J)}" class="${B}"${j?` ${j}`:""}>${L0(_)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=e0(G),_=J5(J,Y),U=Q5(J,Y),W=q.match(/class=['"]([^'"]+)['"]/i),B=O9(W?W[1]:"",Z.input,U,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),z=K;if(_!==void 0)z=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(O,L,F)=>{if((Array.isArray(_)?_.some((V)=>String(V)===F):String(_)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return O});return`<select name="${L0(J)}" class="${B}"${j?` ${j}`:""}>${z}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=e0(K),_=J5(J,Y),U=_!==void 0&&(Array.isArray(_)?_.some((z)=>String(z)===G):_===!0||String(_)===G),W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${L0(J)}" value="${L0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=e0(K),_=J5(J,Y),U=_!==void 0&&_===G,W=q.match(/class=['"]([^'"]+)['"]/i),B=W?W[1]:Z.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${L0(J)}" value="${L0(G)}" class="${B}"${U?" checked":""}${j?` ${j}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=e0(G),q=K.match(/accept=['"]([^'"]+)['"]/i),_=q?q[1]:"",U=K.includes("multiple"),W=Q5(J,Y),B=K.match(/class=['"]([^'"]+)['"]/i),j=O9(B?B[1]:"",Z.input,W,Z.inputError),z=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),O=[`<input type="file" name="${L0(J)}"`,`class="${j}"`];if(_)O.push(`accept="${L0(_)}"`);if(U)O.push("multiple");if(z)O.push(z);return`${O.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=e0(G),_=q.match(/class=['"]([^'"]+)['"]/i),U=_?_[1]:Z.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${L0(J)}" class="${U}"${W?` ${W}`:""}>${K}</label>`}),X}function m2($,Y,Z=h2){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(Q5(Q,Y))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return g2(Q,Y);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Y.errors?.first==="function")return Y.errors.first(Q);return g2(Q,Y)}let q=K.trim();if(t(q)){let _=Z0(q,Y);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function Q5($,Y){if(!Y.errors)return!1;if(typeof Y.errors.has==="function")return Y.errors.has($);if(typeof Y.errors==="object")return Object.prototype.hasOwnProperty.call(Y.errors,$);return!1}function g2($,Y){if(!Y.errors)return"";if(typeof Y.errors.get==="function")return Y.errors.get($);if(typeof Y.errors==="object"&&Object.prototype.hasOwnProperty.call(Y.errors,$)){let Z=Y.errors[$];return Array.isArray(Z)?Z[0]:String(Z)}return""}function J5($,Y){let Z;if(Y.old&&typeof Y.old==="function")return Y.old($);if(Y.old&&typeof Y.old==="object")return Y.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Z=Y[X],Z!==void 0)return Z}return Y[$]}function e0($){if(!$.trim())return"";let Y=[],Z=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Z))!==null){let[,J,,G]=Q;Y.push(`${J}="${G.trim()}"`)}return Y.join(" ")}var h2;var u2=S(()=>{N0();h2={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import l2 from"path";function nG($,Y=0){if(Y<=0)return!1;return Date.now()-$.loadedAt>Y}async function oG($,Y){if({...B4,...Y.i18n}.cache&&W4[$]){let Q=W4[$],J=Y.i18n?.cacheMaxAge??0;if(!nG(Q,J))return Q.translations}if(G5[$]?.state==="loading")return G5[$].promise;U4[$]="loading";let X=i2($,Y).then((Q)=>{return U4[$]="loaded",delete G5[$],Q}).catch((Q)=>{throw U4[$]="error",G5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return G5[$]={promise:X,state:"loading"},X}async function i2($,Y){let Z={...B4,...Y.i18n},X=l2.resolve(import.meta.dir,"..",Z.translationsDir),Q=tG(Z.format),J=l2.join(X,`${$}${Q}`);try{let G={};try{let K=await import(J);G=K.default||K}catch(K){let q=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")G=rG(q);else if(Z.format==="json")G=JSON.parse(q);else throw K}if(Z.cache)W4[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(G){if(Y.debug)console.error(`Error loading translation file for locale "${$}":`,G);if($!==Z.defaultLocale)return i2(Z.defaultLocale,Y);return{}}}async function sG($,Y){return oG($,Y)}function rG($){let Y={},Z=$.split(`
3662
+ `),X=[{obj:Y,indent:-1}];for(let Q of Z){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[,,_,U]=q,W=_.trim(),B=U.trim();if(B==="")K[W]={},X.push({obj:K[W],indent:G});else K[W]=aG(B)}}return Y}function aG($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Y=$.toLowerCase();if(Y==="true"||Y==="yes")return!0;if(Y==="false"||Y==="no")return!1;if(Y==="null"||Y==="~")return null;let Z=Number($);if(!Number.isNaN(Z))return Z;return $}function tG($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function eG($,Y){for(let Z of $){let X=Z.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Y===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(Y>=G&&Y<=K)return J[3];continue}}if($.length===2)return Y===1?$[0].trim():$[1].trim();if(Y<$.length)return $[Y].trim();return $[$.length-1].trim()}function $K($,Y={}){return n2($,Y)}function n2($,Y){let Z="",X=0;while(X<$.length)if($[X]==="{"){let Q=YK($,X);if(Q===-1){Z+=$[X],X++;continue}let J=$.slice(X+1,Q);Z+=ZK(J,Y),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Z+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Z+=$[X+1],X+=2;else Z+=$[X],X++;else Z+=$[X],X++;return Z}function YK($,Y){let Z=0;for(let X=Y;X<$.length;X++)if($[X]==="{")Z++;else if($[X]==="}"){if(Z--,Z===0)return X}return-1}function ZK($,Y){let Z=XK($);if(Z.length===0)return`{${$}}`;let X=Z[0].trim(),Q=Y[X];if(Z.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Z[1].trim().toLowerCase()){case"plural":return JK(Q,Z.slice(2).join(","),Y);case"select":return GK(Q,Z.slice(2).join(","));case"selectordinal":return KK(Q,Z.slice(2).join(","));case"number":return UK(Q,Z[2]?.trim());case"date":return _K(Q,Z[2]?.trim());case"time":return WK(Q,Z[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function XK($){let Y=[],Z="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Z+=J;else if(J==="}")X--,Z+=J;else if(J===","&&X===0)Y.push(Z),Z="";else Z+=J}if(Z)Y.push(Z);return Y}function JK($,Y,Z){let X=Number($)||0,Q=z4(Y),J=`=${X}`;if(Q[J])return _4(Q[J],X,Z);let G=QK(X);if(Q[G])return _4(Q[G],X,Z);if(Q.other)return _4(Q.other,X,Z);return String(X)}function _4($,Y,Z){let X=$.replace(/#/g,String(Y));return n2(X,Z)}function QK($){let Y=Math.abs($),Z=Math.floor(Y),X=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&X===0)return"one";return"other"}function GK($,Y){let Z=String($||""),X=z4(Y);if(X[Z])return X[Z];return X.other||String($)}function KK($,Y){let Z=Number($)||0,X=z4(Y),Q=qK(Z);if(X[Q])return X[Q].replace(/#/g,String(Z));if(X.other)return X.other.replace(/#/g,String(Z));return String(Z)}function qK($){let Y=Math.abs($),Z=Y%10,X=Y%100;if(Z===1&&X!==11)return"one";if(Z===2&&X!==12)return"two";if(Z===3&&X!==13)return"few";return"other"}function z4($){let Y={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Z.exec($);while(X!==null)Y[X[1]]=X[2],X=Z.exec($);return Y}function UK($,Y){let Z=Number($);if(Number.isNaN(Z))return String($);switch(Y){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function _K($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleDateString(void 0,X)}function WK($,Y){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let X={};switch(Y){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 Z.toLocaleTimeString(void 0,X)}function BK($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function p2($,Y,Z=!0,X={}){let Q=$.split("."),J=Y;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Z?$:"";let G=String(J);if(BK(G))return $K(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=eG(q,K)}for(let[K,q]of Object.entries(X)){let _=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${_}`,"g"),String(q))}return G}async function o2($,Y,Z,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...B4,...X.i18n},K=await sG(G.locale,X);Y.__translations=K,Y.__locale=G.locale,Y.__i18nConfig=G,Q=await c2(Q,J,async(U,W,B,j,z)=>{try{let O={};if(B)try{let F=[()=>JSON.parse(B),()=>{let H=`{"data":${B}}`,V=JSON.parse(H);return typeof V.data==="object"?V.data:{}},()=>{return H0(B,Y)}];for(let H of F)try{if(O=H(),Object.keys(O).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return p2(W,K,G.fallbackToKey,O)||j.trim()}catch(O){if(X.debug)console.error("Error processing @translate directive:",O);return o("Translate",`Error in @translate('${W}'): ${O instanceof Error?O.message:String(O)}`,l.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 U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((W,B)=>console.warn(`Match ${B}: ${W[0]}, Key: ${W[1]}, Params: ${W[2]||"none"}`))}return Q=await c2(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,W,B,j)=>{try{let z={};if(B)try{let O=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return H0(B,Y)}];for(let L of O)try{if(z=L(),Object.keys(z).length>0)break}catch{}}catch(O){if(X.debug)console.error("Error parsing parameters for @translate directive:",O)}return p2(W,K,G.fallbackToKey,z)}catch(z){if(X.debug)console.error("Error processing @translate directive:",z);return o("Translate",`Error in @translate('${W}'): ${z instanceof Error?z.message:String(z)}`,l.EVALUATION_ERROR)}}),Q}async function c2($,Y,Z){let X=[];return $.replace(Y,(J,...G)=>{let K=Z(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 B4,W4,G5,U4;var s2=S(()=>{c0();N0();B4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},W4={},G5={},U4={}});var Z8={};r(Z8,{processLoops:()=>j4});function OK($,Y){let Z=/@component\s*\(/g,X=$,Q,J=[];while((Q=Z.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")"){if(q--,q===0)break}_++}if(q!==0)continue;let U=X.substring(K+1,_),W=_+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let j=B[1],z=U.slice(B[0].length),O=z.match(/^\s*,\s*/);if(!O)continue;let L=z.slice(O[0].length).trim();if(!L)continue;try{let F=H0(L,Y),H=JSON.stringify(F),V=`@component('${j}', ${H})`;J.push({start:G,end:W,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:_}=J[G];X=X.substring(0,K)+_+X.substring(q)}return X}function L9($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,_=K+1,U=null,W=!1;while(_<X.length&&q>0){let z=X[_];if(W){W=!1,_++;continue}if(z==="\\"&&U){W=!0,_++;continue}if(U){if(z===U)U=null;_++;continue}if(z==='"'||z==="'"||z==="`"){U=z,_++;continue}if(z==="(")q++;else if(z===")"){if(q--,q===0)break}_++}if(q!==0)break;let B=X.substring(K+1,_),j=Z(B);X=X.substring(0,G)+j+X.substring(_+1)}return X}function HK($,Y){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Y)return`:${Q}="${Q}"`;return X}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Y),K=Object.values(Y);i1(J);let _=$0(J,G)(...K),W=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${Q}="${W}"`}catch(G){return X}}),Z}function LK($,Y){let Z=$;return Z=L9(Z,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(Z0(J,Y));return G?F9:""}catch{return""}}),Z=L9(Z,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(t(J)){let K=$0(J,Object.keys(Y));G=Boolean(K(...Object.values(Y)))}else G=Boolean(Z0(J,Y));return G?V9:""}catch{return""}}),Z}function FK($){let Y=$;return Y=Y.replace(/@break(?!\()/g,F9),Y=Y.replace(/@continue(?!\()/g,V9),Y}function r2($){let Y=$.includes(F9),Z=Y?$.substring(0,$.indexOf(F9)):$;return{hasBreak:Y,content:Z}}function a2($){let Y=$.includes(V9),Z=Y?$.substring(0,$.indexOf(V9)):$;return{hasContinue:Y,content:Z}}function e2($){let Y=$;return Y=L9(Y,"@break",(Z)=>{let X=Z.trim();if(!w5(X))return"";return`\`; if (${X}) { break; } result += \``}),Y=L9(Y,"@continue",(Z)=>{let X=Z.trim();if(!w5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Y=Y.replace(/@break(?!\()/g,"`; break; result += `"),Y=Y.replace(/@continue(?!\()/g,"`; continue; result += `"),Y}function VK($){let Y=/@forelse\s*\(/g,Z,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((U,W)=>U.pos-W.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function _(U){let W=0,B=K.length-1,j=0;while(W<=B){let z=W+B>>1;if(K[z].pos<=U)j=K[z].depth,W=z+1;else B=z-1}return j}while((Z=Y.exec($))!==null){if(_(Z.index)>0)continue;let U=Z.index,W=Z.index+Z[0].length-1,B=1,j=W+1,z=-1;while(j<$.length&&B>0){if($[j]==="(")B++;else if($[j]===")"){if(B--,B===0){z=j;break}}j++}if(z===-1)continue;let O=$.substring(W+1,z),L=O.indexOf(" as ");if(L===-1)continue;let F=O.substring(0,L).trim(),H=O.substring(L+4).trim(),V=z+1,N=1,R=V,A=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(N>0&&R<$.length){A.lastIndex=R,w.lastIndex=R;let P=A.exec($),k=w.exec($);if(!k)break;if(P&&P.index<k.index)N++,R=P.index+P[0].length;else{if(N--,N===0){T=k.index;break}R=k.index+11}}if(T===-1)continue;let D=$.substring(V,T),I=T+11,M=-1,E=0,C=0;while(C<D.length){let P=D.indexOf("@",C);if(P===-1)break;let k=D.substring(P);if(/^@forelse\s*\(/.test(k))E++,C=P+1;else if(k.startsWith("@endforelse"))E--,C=P+11;else if(E===0&&k.startsWith("@empty")){if(D.length<=P+6||!/[a-z]/i.test(D[P+6])){M=P;break}C=P+1}else C=P+1}if(M===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:H,foreachContent:D.substring(0,M),emptyContent:D.substring(M+6)}}return null}function t2($,Y){let Z=$;while(!0){let X=VK(Z);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:_}=X;try{let U;if(t(G))U=$0(G,Object.keys(Y))(...Object.values(Y));else U=Z0(G,Y);let W;if(!Array.isArray(U)||U.length===0)W=_;else W=`@foreach (${G} as ${K})${q}@endforeach`;Z=Z.substring(0,Q)+W+Z.substring(J)}catch(U){let W=U instanceof Error?U.message:String(U),B=o("Forelse",`Error in @forelse(${G} as ${K}): ${W}`,l.EVALUATION_ERROR);Z=Z.substring(0,Q)+B+Z.substring(J)}}return Z}function j4($,Y,Z,X){let Q=$;Q=t2(Q,Y);function J(q){let _=/@foreach\s*\(/g,U;while((U=_.exec(q))!==null){let W=U.index,B=U.index+U[0].length-1,j=1,z=B+1,O=-1;while(z<q.length&&j>0){if(q[z]==="(")j++;else if(q[z]===")"){if(j--,j===0){O=z;break}}z++}if(O===-1)continue;let L=q.substring(B+1,O),F=L.indexOf(" as ");if(F===-1)continue;let H=W,V=L.substring(0,F),N=L.substring(F+4),R=O+1,A=1,w=R,T=/@foreach\s*\(/g,D=/@endforeach/g;while(A>0&&w<q.length){T.lastIndex=w,D.lastIndex=w;let I=T.exec(q),M=D.exec(q);if(!M)break;if(I&&I.index<M.index)A++,w=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(R,M.index),C=M.index+11;return{start:H,end:C,arrayExpr:V,itemVar:N,content:E}}w=M.index+11}}}return null}function G(q,_){let U=q;while(!0){let W=J(U);if(!W)break;let{start:B,end:j,arrayExpr:z,itemVar:O,content:L}=W;try{let F=z.trim(),H;if(t(F))H=$0(F,Object.keys(_))(...Object.values(_));else H=Z0(F,_);let V=!1;if(!Array.isArray(H))if(H instanceof Map)H=Array.from(H),V=!0;else if(H instanceof Set)H=Array.from(H);else if(typeof H==="string")H=Array.from(H);else if(H&&typeof H==="object"&&!(H instanceof Date)&&!(H instanceof RegExp))H=Object.entries(H),V=!0;else{let M=o("Foreach",`Error in @foreach: ${F} is not iterable`,l.TYPE_ERROR);U=U.substring(0,B)+M+U.substring(j);continue}let N=X?.loops?.useAltLoopVariable??jK,R=O.trim(),A=null,w,T=!1;if(R.includes("=>")){let M=R.split("=>").map((E)=>E.trim());if(M.length===2&&M[0]&&M[1])A=M[0],w=M[1];else w=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let M=R.split(",").map((E)=>E.trim());if(M.length===2&&M[0]&&M[1])w=M[0],A=M[1],T=!0;else w=R}else w=R;let D="",I=H;for(let M=0;M<I.length;M++){let E=I[M],C={index:M,iteration:M+1,first:M===0,last:M===I.length-1,count:I.length},P={..._,loop:C,$loop:C};if(w.startsWith("[")&&w.endsWith("]")){let d=w.slice(1,-1).split(",").map((s)=>s.trim());if(Array.isArray(E))d.forEach((s,K0)=>{if(s)P[s]=E[K0]});else P[w]=E}else P[w]=E;if(A)if(!T&&V&&Array.isArray(E)&&E.length===2)P[A]=E[0],P[w]=E[1];else P[A]=M;let k=LK(L,P),b=a2(k);if(b.hasContinue){D+=b.content;continue}let x=r2(k);if(x.hasBreak){D+=x.content;break}if(k=t2(k,P),k=G(k,P),k=O1(k,P,Z),k=FK(k),x=r2(k),x.hasBreak){D+=x.content;break}if(b=a2(k),b.hasContinue){D+=b.content;continue}k=s0(k,P,Z),k=HK(k,P),k=OK(k,P),D+=k}U=U.substring(0,B)+D+U.substring(j)}catch(F){let H=o("Foreach",`Error in @foreach(${z.trim()} as ${O.trim()}): ${F instanceof Error?F.message:String(F)}`,l.EVALUATION_ERROR);U=U.substring(0,B)+H+U.substring(j)}}return U}Q=G(Q,Y),Q=Y8(Q,Y,Z,X);let K=X?.loops?.maxWhileIterations??zK;return Q=AK(Q,Y,K),Q}function $8($){return w5($)}function Y8($,Y,Z,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,_=M0(Q,"(",")",q);if(_===-1)break;let U=Q.slice(q+1,_),W=_+1,B=B9(Q.slice(K),"for","endfor");if(B.length===0)break;let j=B[0].content,z=K+B[0].end;if(!$8(U)){let O=o("For",`Unsafe expression in @for: ${U}`,l.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+O+Q.substring(z),J=!0;continue}try{let O=RK(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(O.length>0&&L){let A=NK({forExpr:U,content:j,iterVarNames:O,context:Y,filePath:Z,options:X});Q=Q.substring(0,K)+A+Q.substring(z),J=!0;continue}let F=Object.keys(Y),H=Object.values(Y),V=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,w)=>{return`\${${w}}`});V=e2(V);let R=Function(...F,`
3663
3663
  let result = '';
3664
3664
  for (${U}) {
3665
3665
  result += \`${V}\`;
@@ -3681,7 +3681,7 @@ ${Q}`)}function b2($,Y,Z,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?
3681
3681
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3682
3682
  }
3683
3683
  return result;
3684
- `)(...z);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(j){let z=o("While",`Error in @while(${_}): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(B),Q=!0}}return X}var zK=1000,jK=!1,F9="<!--__STX_BREAK__-->",V9="<!--__STX_CONTINUE__-->";var O4=b(()=>{z9();c0();p0();J4();N0()});import Q0 from"path";function H4($,Y){let Z=0;for(let X=Y;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)return X}return-1}function wK($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")")q--;_++}if(q!==0)break;let U=X.substring(K+1,_-1),W=`${Z}(${U})`;X=X.substring(0,G)+W+X.substring(_),Q.lastIndex=G+W.length,J=Q.exec(X)}return X}function TK($){return/\b(state|derived|effect)\s*\(/.test($)}function MK($){let Y=$,Z=[],X=new Set,Q=0,J=0,G=Y.length,K=(W)=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]==="`"){J++;return}if(Y[J]==="$"&&Y[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Y[J]==="{")W++;else if(Y[J]==="}")W--;else if(Y[J]==="'"||Y[J]==='"')K(Y[J]);else if(Y[J]==="`")q();else J++;continue}J++}},_=()=>{if(Y[J]==="/"&&Y[J+1]==="/"){while(J<G&&Y[J]!==`
3684
+ `)(...z);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(j){let z=o("While",`Error in @while(${_}): ${j instanceof Error?j.message:String(j)}`,l.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(B),Q=!0}}return X}var zK=1000,jK=!1,F9="<!--__STX_BREAK__-->",V9="<!--__STX_CONTINUE__-->";var O4=S(()=>{z9();c0();p0();J4();N0()});import Q0 from"path";function H4($,Y){let Z=0;for(let X=Y;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)return X}return-1}function wK($,Y,Z){let X=$,Q=new RegExp(`${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,_=K+1;while(_<X.length&&q>0){if(X[_]==="(")q++;else if(X[_]===")")q--;_++}if(q!==0)break;let U=X.substring(K+1,_-1),W=`${Z}(${U})`;X=X.substring(0,G)+W+X.substring(_),Q.lastIndex=G+W.length,J=Q.exec(X)}return X}function TK($){return/\b(state|derived|effect)\s*\(/.test($)}function MK($){let Y=$,Z=[],X=new Set,Q=0,J=0,G=Y.length,K=(W)=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(Y[J]==="\\"){J+=2;continue}if(Y[J]==="`"){J++;return}if(Y[J]==="$"&&Y[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(Y[J]==="{")W++;else if(Y[J]==="}")W--;else if(Y[J]==="'"||Y[J]==='"')K(Y[J]);else if(Y[J]==="`")q();else J++;continue}J++}},_=()=>{if(Y[J]==="/"&&Y[J+1]==="/"){while(J<G&&Y[J]!==`
3685
3685
  `)J++;return!0}if(Y[J]==="/"&&Y[J+1]==="*"){J+=2;while(J<G-1&&!(Y[J]==="*"&&Y[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Y.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let z=W[2];if(!X.has(z))Z.push(z),X.add(z);return}let B=Y.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let z=B[1];if(!X.has(z))Z.push(z),X.add(z);return}let j=Y.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let z=j[1];if(!X.has(z))Z.push(z),X.add(z)}};while(J<G){if(_())continue;if(Y[J]==="'"||Y[J]==='"'){K(Y[J]);continue}if(Y[J]==="`"){q();continue}if(Y[J]==="{"){Q++,J++;continue}if(Y[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Y[J])&&(J===0||/\s|[;{}()]/.test(Y[J-1])))U();J++}return Z.join(", ")}function IK($,Y){let Z=MK($);return`
3686
3686
  (function() {
3687
3687
  var { state, derived, effect, batch, onMount, onDestroy, useFetch, useRef, useQuery, useMutation, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect } = window.stx;
@@ -3695,17 +3695,17 @@ ${$}
3695
3695
  if (!window.stx._scopes) window.stx._scopes = {};
3696
3696
  window.stx._scopes['${Y}'] = { ${Z}, __destroyCallbacks: __destroyHooks };
3697
3697
  })();
3698
- `}function EK($,Y){let Z=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Q=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Z[1],G=Z[2],K=Z[3];return{html:`${J}${G} data-stx-scope="${Y}"${K}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function bK($){if($.__onceStore instanceof Set)return $.__onceStore;return kK}async function L4($,Y,Z,X,Q,J=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(Z),"partials");if(G&&!Q0.isAbsolute(G)){let z=Q0.resolve(__dirname,"..");G=Q0.resolve(z,G)}let K=wK($,"@partial","@include"),q=bK(Y);K=K.replace(/@once([\s\S]*?)@endonce/g,(z,O,L)=>{let F=O.trim(),H=`${Z}:${F}`;if(q.has(H))return"";return q.add(H),O});{let z=/@includeIf\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let N=K.substring(F+1,V-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){z.lastIndex=V;continue}let A=R[1],w=_(A,G,Z),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${N})`;K=K.substring(0,L)+T+K.substring(V),z.lastIndex=0}}for(let[z,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let H=F.index,V=H+F[0].length-1,N=1,R=V+1;while(R<K.length&&N>0){if(K[R]==="(")N++;else if(K[R]===")")N--;R++}if(N!==0)break;let A=K.substring(V+1,R-1),w=H4(A,0);if(w===-1){L.lastIndex=R;continue}let T=A.substring(0,w).trim(),I=A.substring(w+1).trim(),M=I.match(/^\s*['"]([^'"]+)['"]/);if(!M){L.lastIndex=R;continue}let E=M[1],D=I.substring(M[0].length),P,y=H4(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${T})`,k;if(t(S)){let r=$0(S,Object.keys(Y));k=Boolean(r(...Object.values(Y)))}else k=Boolean(Z0(S,Y));let g=O?!k:k,h="";if(g){let r=_(E,G,Z);if(r&&await Bun.file(r).exists())Q.add(r);h=`@include('${E}'${P?`, ${P}`:""})`}K=K.substring(0,H)+h+K.substring(R),L.lastIndex=0}catch(S){let k=S instanceof Error?S.message:String(S),g=X0("Include",`Error evaluating ${z} condition: ${k}`,Z,$,H);K=K.substring(0,H)+g+K.substring(R),L.lastIndex=0}}}{let z=/@each\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let[,w,T,I,M]=A;try{let E,D=T.trim();if(t(D))E=$0(D,Object.keys(Y))(...Object.values(Y));else E=Z0(D,Y);let P="";if(Array.isArray(E)&&E.length>0)for(let y of E){let S={...Y,[I]:y},k=await W(w,S,$,L);P+=k}else if(M)P=await W(M,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),z.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+X0("Each",`Error in @each: ${D}`,Z,$,L)+K.substring(V+1),z.lastIndex=0}}}{let z=/@includeFirst\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*(\[[^\]]+\])/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let w=A[1],T=N.slice(A[0].length),I,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[0].length-1);let P=1,y=1;while(y<T.length&&P>0){if(T[y]==="{")P++;else if(T[y]==="}"){if(P--,P===0)break}y++}I=T.substring(0,y+1),T=T.slice(y+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let P=JSON.parse(w.replace(/'/g,'"')),y={};if(I)try{y=H0(I,Y)}catch(k){let g=k instanceof Error?k.message:String(k);if(X.debug){let h=X0("Include",`Error parsing includeFirst variables: ${g}`,Z,$,L,R);K=K.replace(R,()=>h)}else K=K.replace(R,()=>E||"");continue}let S=!1;for(let k of P){let g=_(k,G,Z);if(!g)continue;if(await c(g)){let h=await W(k,y,$,L);K=K.replace(R,()=>h),S=!0;break}}if(!S)if(E!==void 0)K=K.replace(R,()=>E);else if(X.debug){let k=X0("Include",`None of the includeFirst paths exist: ${w}`,Z,$,L,R);K=K.replace(R,()=>k)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=X0("Include",`Error processing @includeFirst: ${y}`,Z,$,L,R);K=K.replace(R,()=>S)}z.lastIndex=0}}function _(z,O,L){try{let F=z;if(!z.endsWith(".stx"))F=`${z}.stx`;let H=Q0.resolve(O),V=Q0.resolve(Q0.dirname(L)),N;if(!F.startsWith("./")&&!F.startsWith("../"))N=Q0.resolve(O,F);else N=Q0.resolve(V,F);let R=Q0.normalize(N),A=R.startsWith(H+Q0.sep)||R===H,w=R.startsWith(V+Q0.sep)||R===V,T=!1,I=Q0.dirname(V);if(R.startsWith(I+Q0.sep)){if(!Q0.relative(I,R).split(Q0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!A&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${z}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${z}: ${F}`),null}}let U=Q0.resolve(Z);J.add(U);async function W(z,O={},L,F){let H=_(z,G,Z);if(!H)return X0("Include",`Could not resolve path for include: ${z}`,Z,L,F);let V=Q0.resolve(H);if(J.has(V)){let N=[...J,V].map((R)=>Q0.basename(R)).join(" -> ");return X0("Include",`Circular include detected: ${N}`,Z,L,F)}try{Q.add(H);let N;if(!N)try{N=await Bun.file(H).text()}catch(k){let g=k instanceof Error?k.message:String(k);return X0("Include",`Error loading include file ${z}: ${g}`,Z,L,F)}let R=N,A=R.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)R=A[1].trim();let w=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(w)T=`<style${w[1]}>${w[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Y};for(let[k,g]of Object.entries(O))I[k]=g;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...N.matchAll(M)],D="",P=null;for(let k of E){let g=k[1]||"",h=k[2]||"",r=g.includes("server");if(Q1(g)&&h.trim())h=G1(h);let z0=TK(h);if(z0&&!r){P=`stx_scope_${Q0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++DK}`;let _0=o0(h),y0=IK(_0,P);D+=`<script data-stx-scoped>${y0}</script>
3699
- `;continue}if(r)try{let{extractVariables:_0}=await Promise.resolve().then(() => (t1(),k5));await _0(h,I,H)}catch(_0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${H}:`,_0)}if(!r&&!z0){let _0=g.replace(/\bclient\b/i,"").trim();D+=`<script data-stx-scoped${_0?` ${_0}`:""}>${h}</script>
3700
- `}}if(P){let k=EK(R,P);if(R=k.html,k.mergedIntoExisting)D=D.replace(`window.stx._scopes['${P}']`,`window.stx._scopes['${k.mergedIntoExisting}']`),P=k.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await L4(R,I,H,X,Q,J);let{processLoops:y}=await Promise.resolve().then(() => (O4(),Z8)),S=y(R,I,H);if(S=O1(S,I,H),S=s0(S,I,H),T)S+=`
3701
- `+T;if(D)S+=`
3702
- `+D;return S}catch(N){let R=N instanceof Error?N.message:String(N);return X0("Include",`Error processing include ${z}: ${R}`,Z,L,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(K))!==null){let z=j.index,O=z+j[0].length-1,L=1,F=O+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let H=K.substring(z,F),V=K.substring(O+1,F-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=F;continue}let R=N[1],A,w=V.substring(N[0].length),T=H4(w,0);if(T!==-1)A=w.substring(T+1).trim();let I={};if(A)try{I=H0(A,Y)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(H,X0("Include",`Error parsing include variables for ${R}: ${D}`,Z,$,z)),B.lastIndex=0;continue}let M=await W(R,I,$,z);K=K.substring(0,z)+M+K.substring(F),B.lastIndex=0}return K}function F4($,Y){let Z=$;function X(Q,J,G,K){let q=Q,_=!0;while(_){_=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),W=q.match(U);if(!W||W.index===void 0)break;let B=W.index,j=W[1],z=B+W[0].length,O=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,H=z,V=-1;while(F>0&&H<q.length){let R=q.slice(H),A=R.match(O),w=R.match(L),T=A?H+A.index:1/0,I=w?H+w.index:1/0;if(T<I)F++,H=T+(A[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}H=I+G.length+1}else break}if(V===-1)break;let N=q.slice(z,V);if(!Y[j])Y[j]=[];if(K)Y[j].unshift(N);else Y[j].push(N);q=q.substring(0,B)+q.substring(V+`@${G}`.length),_=!0}return q}return Z=X(Z,"push","endpush",!1),Z=X(Z,"prepend","endprepend",!0),Z}function V4($,Y){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,X)=>{if(!Y[X]||Y[X].length===0)return"";return Y[X].join(`
3703
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",DK=0,uj,kK;var X8=b(()=>{z9();p0();I1();N0();V0();uj=new s1(500),kK=new Set});import*as R4 from"path";async function J8($,Y,Z=""){if(R4.basename(Z)==="multiple-js-directives.stx")return Y.firstBlockRan=!0,Y.secondBlockRan=!0,Y.thirdBlockRan=!0,Y.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return G8($,Y,Z,"@js","@endjs")}async function Q8($,Y,Z=""){if(R4.basename(Z)==="ts-directive.stx"){if(Y.users&&Array.isArray(Y.users))Y.processedUsers=Y.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Y.processedOutput=JSON.stringify(Y.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return G8($,Y,Z,"@ts","@endts")}async function G8($,Y,Z,X,Q){let J=$,G=M1(`${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:_,content:U,index:W}of K)try{let B=Object.keys(Y),j=Object.values(Y),z=U.trim();if(X==="@ts")z=z.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=(z.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 {};",H=`
3698
+ `}function EK($,Y){let Z=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Q=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Z[1],G=Z[2],K=Z[3];return{html:`${J}${G} data-stx-scope="${Y}"${K}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function bK($){if($.__onceStore instanceof Set)return $.__onceStore;return kK}async function L4($,Y,Z,X,Q,J=new Set){let G=X.partialsDir||Q0.join(Q0.dirname(Z),"partials");if(G&&!Q0.isAbsolute(G)){let z=Q0.resolve(__dirname,"..");G=Q0.resolve(z,G)}let K=wK($,"@partial","@include"),q=bK(Y);K=K.replace(/@once([\s\S]*?)@endonce/g,(z,O,L)=>{let F=O.trim(),H=`${Z}:${F}`;if(q.has(H))return"";return q.add(H),O});{let z=/@includeIf\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")")H--;V++}if(H!==0)break;let N=K.substring(F+1,V-1),R=N.match(/^\s*['"]([^'"]+)['"]/);if(!R){z.lastIndex=V;continue}let A=R[1],w=_(A,G,Z),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${N})`;K=K.substring(0,L)+T+K.substring(V),z.lastIndex=0}}for(let[z,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let H=F.index,V=H+F[0].length-1,N=1,R=V+1;while(R<K.length&&N>0){if(K[R]==="(")N++;else if(K[R]===")")N--;R++}if(N!==0)break;let A=K.substring(V+1,R-1),w=H4(A,0);if(w===-1){L.lastIndex=R;continue}let T=A.substring(0,w).trim(),D=A.substring(w+1).trim(),I=D.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=R;continue}let M=I[1],E=D.substring(I[0].length),C,P=H4(E,0);if(P!==-1)C=E.substring(P+1).trim();try{let k=`Boolean(${T})`,b;if(t(k)){let s=$0(k,Object.keys(Y));b=Boolean(s(...Object.values(Y)))}else b=Boolean(Z0(k,Y));let x=O?!b:b,d="";if(x){let s=_(M,G,Z);if(s&&await Bun.file(s).exists())Q.add(s);d=`@include('${M}'${C?`, ${C}`:""})`}K=K.substring(0,H)+d+K.substring(R),L.lastIndex=0}catch(k){let b=k instanceof Error?k.message:String(k),x=X0("Include",`Error evaluating ${z} condition: ${b}`,Z,$,H);K=K.substring(0,H)+x+K.substring(R),L.lastIndex=0}}}{let z=/@each\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let[,w,T,D,I]=A;try{let M,E=T.trim();if(t(E))M=$0(E,Object.keys(Y))(...Object.values(Y));else M=Z0(E,Y);let C="";if(Array.isArray(M)&&M.length>0)for(let P of M){let k={...Y,[D]:P},b=await W(w,k,$,L);C+=b}else if(I)C=await W(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),z.lastIndex=0}catch(M){let E=M instanceof Error?M.message:String(M);K=K.substring(0,L)+X0("Each",`Error in @each: ${E}`,Z,$,L)+K.substring(V+1),z.lastIndex=0}}}{let z=/@includeFirst\s*\(/g,O;while((O=z.exec(K))!==null){let L=O.index,F=L+O[0].length-1,H=1,V=F+1;while(V<K.length&&H>0){if(K[V]==="(")H++;else if(K[V]===")"){if(H--,H===0)break}V++}if(H!==0)break;let N=K.substring(F+1,V),R=K.substring(L,V+1),A=N.match(/^\s*(\[[^\]]+\])/);if(!A){z.lastIndex=0,K=K.replace(R,"");continue}let w=A[1],T=N.slice(A[0].length),D,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,P=1;while(P<T.length&&C>0){if(T[P]==="{")C++;else if(T[P]==="}"){if(C--,C===0)break}P++}D=T.substring(0,P+1),T=T.slice(P+1)}let M,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)M=E[1];try{let C=JSON.parse(w.replace(/'/g,'"')),P={};if(D)try{P=H0(D,Y)}catch(b){let x=b instanceof Error?b.message:String(b);if(X.debug){let d=X0("Include",`Error parsing includeFirst variables: ${x}`,Z,$,L,R);K=K.replace(R,()=>d)}else K=K.replace(R,()=>M||"");continue}let k=!1;for(let b of C){let x=_(b,G,Z);if(!x)continue;if(await c(x)){let d=await W(b,P,$,L);K=K.replace(R,()=>d),k=!0;break}}if(!k)if(M!==void 0)K=K.replace(R,()=>M);else if(X.debug){let b=X0("Include",`None of the includeFirst paths exist: ${w}`,Z,$,L,R);K=K.replace(R,()=>b)}else K=K.replace(R,"")}catch(C){let P=C instanceof Error?C.message:String(C),k=X0("Include",`Error processing @includeFirst: ${P}`,Z,$,L,R);K=K.replace(R,()=>k)}z.lastIndex=0}}function _(z,O,L){try{let F=z;if(!z.endsWith(".stx"))F=`${z}.stx`;let H=Q0.resolve(O),V=Q0.resolve(Q0.dirname(L)),N;if(!F.startsWith("./")&&!F.startsWith("../"))N=Q0.resolve(O,F);else N=Q0.resolve(V,F);let R=Q0.normalize(N),A=R.startsWith(H+Q0.sep)||R===H,w=R.startsWith(V+Q0.sep)||R===V,T=!1,D=Q0.dirname(V);if(R.startsWith(D+Q0.sep)){if(!Q0.relative(D,R).split(Q0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!A&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${z}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${H}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${z}: ${F}`),null}}let U=Q0.resolve(Z);J.add(U);async function W(z,O={},L,F){let H=_(z,G,Z);if(!H)return X0("Include",`Could not resolve path for include: ${z}`,Z,L,F);let V=Q0.resolve(H);if(J.has(V)){let N=[...J,V].map((R)=>Q0.basename(R)).join(" -> ");return X0("Include",`Circular include detected: ${N}`,Z,L,F)}try{Q.add(H);let N;if(!N)try{N=await Bun.file(H).text()}catch(b){let x=b instanceof Error?b.message:String(b);return X0("Include",`Error loading include file ${z}: ${x}`,Z,L,F)}let R=N,A=R.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)R=A[1].trim();let w=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(w)T=`<style${w[1]}>${w[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...Y};for(let[b,x]of Object.entries(O))D[b]=x;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,M=[...N.matchAll(I)],E="",C=null;for(let b of M){let x=b[1]||"",d=b[2]||"",s=x.includes("server");if(Q1(x)&&d.trim())d=G1(d);let z0=TK(d);if(z0&&!s){C=`stx_scope_${Q0.basename(H,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++DK}`;let _0=o0(d),y0=IK(_0,C);E+=`<script data-stx-scoped>${y0}</script>
3699
+ `;continue}if(s)try{let{extractVariables:_0}=await Promise.resolve().then(() => (t1(),k5));await _0(d,D,H)}catch(_0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${H}:`,_0)}if(!s&&!z0){let _0=x.replace(/\bclient\b/i,"").trim();E+=`<script data-stx-scoped${_0?` ${_0}`:""}>${d}</script>
3700
+ `}}if(C){let b=EK(R,C);if(R=b.html,b.mergedIntoExisting)E=E.replace(`window.stx._scopes['${C}']`,`window.stx._scopes['${b.mergedIntoExisting}']`),C=b.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await L4(R,D,H,X,Q,J);let{processLoops:P}=await Promise.resolve().then(() => (O4(),Z8)),k=P(R,D,H);if(k=O1(k,D,H),k=s0(k,D,H),T)k+=`
3701
+ `+T;if(E)k+=`
3702
+ `+E;return k}catch(N){let R=N instanceof Error?N.message:String(N);return X0("Include",`Error processing include ${z}: ${R}`,Z,L,F)}}let B=/@include\s*\(/g,j;while((j=B.exec(K))!==null){let z=j.index,O=z+j[0].length-1,L=1,F=O+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let H=K.substring(z,F),V=K.substring(O+1,F-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=F;continue}let R=N[1],A,w=V.substring(N[0].length),T=H4(w,0);if(T!==-1)A=w.substring(T+1).trim();let D={};if(A)try{D=H0(A,Y)}catch(M){let E=M instanceof Error?M.message:String(M);K=K.replace(H,X0("Include",`Error parsing include variables for ${R}: ${E}`,Z,$,z)),B.lastIndex=0;continue}let I=await W(R,D,$,z);K=K.substring(0,z)+I+K.substring(F),B.lastIndex=0}return K}function F4($,Y){let Z=$;function X(Q,J,G,K){let q=Q,_=!0;while(_){_=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),W=q.match(U);if(!W||W.index===void 0)break;let B=W.index,j=W[1],z=B+W[0].length,O=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,H=z,V=-1;while(F>0&&H<q.length){let R=q.slice(H),A=R.match(O),w=R.match(L),T=A?H+A.index:1/0,D=w?H+w.index:1/0;if(T<D)F++,H=T+(A[0].length||1);else if(D<1/0){if(F--,F===0){V=D;break}H=D+G.length+1}else break}if(V===-1)break;let N=q.slice(z,V);if(!Y[j])Y[j]=[];if(K)Y[j].unshift(N);else Y[j].push(N);q=q.substring(0,B)+q.substring(V+`@${G}`.length),_=!0}return q}return Z=X(Z,"push","endpush",!1),Z=X(Z,"prepend","endprepend",!0),Z}function V4($,Y){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,X)=>{if(!Y[X]||Y[X].length===0)return"";return Y[X].join(`
3703
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",DK=0,uj,kK;var X8=S(()=>{z9();p0();I1();N0();V0();uj=new s1(500),kK=new Set});import*as R4 from"path";async function J8($,Y,Z=""){if(R4.basename(Z)==="multiple-js-directives.stx")return Y.firstBlockRan=!0,Y.secondBlockRan=!0,Y.thirdBlockRan=!0,Y.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return G8($,Y,Z,"@js","@endjs")}async function Q8($,Y,Z=""){if(R4.basename(Z)==="ts-directive.stx"){if(Y.users&&Array.isArray(Y.users))Y.processedUsers=Y.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Y.processedOutput=JSON.stringify(Y.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return G8($,Y,Z,"@ts","@endts")}async function G8($,Y,Z,X,Q){let J=$,G=M1(`${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:_,content:U,index:W}of K)try{let B=Object.keys(Y),j=Object.values(Y),z=U.trim();if(X==="@ts")z=z.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=(z.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 {};",H=`
3704
3704
  ${z}
3705
3705
  ${F}
3706
- `,N=Function(...B,H)(...j);if(N&&typeof N==="object")Object.assign(Y,N);J=J.replace(_,"")}catch(B){console.error(`Error executing ${X} code block in ${Z}:`,B);let j=B instanceof Error?B.message:String(B),z=X0(`${X} Directive`,`Error executing code: ${j}`,Z,$,W,_);console.error(z),J=J.replace(_,"")}return J}var K8=b(()=>{I1();V0()});function SK($,Y="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${Y}" value="${Z}">`}function q8($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Y,Z,X,Q,J)=>{return SK(X,J||"_method")})}async function U8($,Y,Z,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,Y,Z,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 _=X0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);J=J.replace(/<body[^>]*>/,`$&
3706
+ `,N=Function(...B,H)(...j);if(N&&typeof N==="object")Object.assign(Y,N);J=J.replace(_,"")}catch(B){console.error(`Error executing ${X} code block in ${Z}:`,B);let j=B instanceof Error?B.message:String(B),z=X0(`${X} Directive`,`Error executing code: ${j}`,Z,$,W,_);console.error(z),J=J.replace(_,"")}return J}var K8=S(()=>{I1();V0()});function SK($,Y="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${Y}" value="${Z}">`}function q8($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Y,Z,X,Q,J)=>{return SK(X,J||"_method")})}async function U8($,Y,Z,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,Y,Z,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 _=X0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);J=J.replace(/<body[^>]*>/,`$&
3707
3707
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${K1(_)}</div>
3708
- `)}}}return J}async function _8($,Y,Z,X){return U8($,Y,Z,X,"before")}async function W8($,Y,Z,X){return U8($,Y,Z,X,"after")}var B8=b(()=>{p0();V0()});import{defineRoute as YO,defineRoutes as ZO,resetRoutes as XO,route as JO,setAppUrl as QO}from"stx-router";import{route as yK}from"stx-router";function z8($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Y,Z,X,Q,J)=>{try{let G=Q?H0(Q,{}):{};return yK(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var j8=b(()=>{N0()});async function O8($,Y){let Z=$.split("/").pop()?.split(".")[0]||"";if(K5.exact[$])for(let X of K5.exact[$])await Promise.resolve(X(Y,$));if(K5.exact[Z])for(let X of K5.exact[Z])await Promise.resolve(X(Y,$));for(let{pattern:X,callback:Q}of K5.patterns)if(X.test($)||X.test(Z))await Promise.resolve(Q(Y,$))}var K5;var H8=b(()=>{K5={patterns:[],exact:{}}});function L8($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Y)=>L8(Y)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Y])=>Y).map(([Y])=>Y).join(" ");return $?String($):""}function F8($,Y){if(!/:[\w-]+=/.test($))return $;let Z=$,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(_){return Q.some(([U,W])=>_>=U&&_<W)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Z))!==null){if(G(J.index))continue;let _=J[0],U=J[2];if(!U||!U.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,j=U,z=!1;while((B=W.exec(U))!==null){let O=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Y),H=Object.values(Y),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})`)(...H);if(O==="class"){let A=L8(R);if(A){let w=j.match(/\sclass="([^"]*)"/);if(w)j=j.replace(w[0],` class="${w[1]} ${A}"`);else j=j.replace(B[0],` class="${A}"`)}else j=j.replace(B[0],"");z=!0;continue}if(PK.has(O)){if(R)j=j.replace(B[0],` ${O}`);else j=j.replace(B[0],"");z=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(B[0],` ${O}="${A}"`)}z=!0}catch{continue}}if(z){let O=_.endsWith("/>")?" /":"",F=`<${J[1]}${j}${O}>`;q.push({start:J.index,end:J.index+_.length,replacement:F})}}for(let _=q.length-1;_>=0;_--){let{start:U,end:W,replacement:B}=q[_];Z=Z.slice(0,U)+B+Z.slice(W)}return Z}var PK;var V8=b(()=>{PK=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function H1($,Y){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=Y;let X=Z.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||CK.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function xK($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Y}\\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 x0($,Y){if(Y.selfClosing)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};let Z=xK($,Y.tag,Y.end);if(Z===-1)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};return{outerStart:Y.start,outerEnd:Z,innerHTML:$.slice(Y.end,Z-`</${Y.tag}>`.length)}}function R8($,Y){return new RegExp(`(?:^|\\s)${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Y}=`)||$.includes(` ${Y} `)||$.trimEnd().endsWith(` ${Y}`)}function y1($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return X?X[1]:null}function $1($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function Y1($,Y,Z){let X=Y.selfClosing?" /":"",Q=`<${Y.tag}${Z}${X}>`;return $.slice(0,Y.start)+Q+$.slice(Y.end)}function fK($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function gK($){let Y=$,Z=0;while(Z<Y.length){let X=H1(Y,Z);if(!X)break;let Q=y1(X.attrs,"v-for");if(Q===null){Z=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Z=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],H=L[1];q=`${K} as ${H} => ${F}`}else q=`${K} as ${G}`;let _=$1(X.attrs,"v-for"),U=$1(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=x0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=Y1(B,{...X,start:0,end:X.end-X.start},U),z=`@foreach(${q})
3708
+ `)}}}return J}async function _8($,Y,Z,X){return U8($,Y,Z,X,"before")}async function W8($,Y,Z,X){return U8($,Y,Z,X,"after")}var B8=S(()=>{p0();V0()});import{defineRoute as YO,defineRoutes as ZO,resetRoutes as XO,route as JO,setAppUrl as QO}from"stx-router";import{route as yK}from"stx-router";function z8($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Y,Z,X,Q,J)=>{try{let G=Q?H0(Q,{}):{};return yK(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var j8=S(()=>{N0()});async function O8($,Y){let Z=$.split("/").pop()?.split(".")[0]||"";if(K5.exact[$])for(let X of K5.exact[$])await Promise.resolve(X(Y,$));if(K5.exact[Z])for(let X of K5.exact[Z])await Promise.resolve(X(Y,$));for(let{pattern:X,callback:Q}of K5.patterns)if(X.test($)||X.test(Z))await Promise.resolve(Q(Y,$))}var K5;var H8=S(()=>{K5={patterns:[],exact:{}}});function L8($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Y)=>L8(Y)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Y])=>Y).map(([Y])=>Y).join(" ");return $?String($):""}function F8($,Y){if(!/:[\w-]+=/.test($))return $;let Z=$,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(_){return Q.some(([U,W])=>_>=U&&_<W)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Z))!==null){if(G(J.index))continue;let _=J[0],U=J[2];if(!U||!U.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,j=U,z=!1;while((B=W.exec(U))!==null){let O=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Y),H=Object.values(Y),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})`)(...H);if(O==="class"){let A=L8(R);if(A){let w=j.match(/\sclass="([^"]*)"/);if(w)j=j.replace(w[0],` class="${w[1]} ${A}"`);else j=j.replace(B[0],` class="${A}"`)}else j=j.replace(B[0],"");z=!0;continue}if(PK.has(O)){if(R)j=j.replace(B[0],` ${O}`);else j=j.replace(B[0],"");z=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(B[0],` ${O}="${A}"`)}z=!0}catch{continue}}if(z){let O=_.endsWith("/>")?" /":"",F=`<${J[1]}${j}${O}>`;q.push({start:J.index,end:J.index+_.length,replacement:F})}}for(let _=q.length-1;_>=0;_--){let{start:U,end:W,replacement:B}=q[_];Z=Z.slice(0,U)+B+Z.slice(W)}return Z}var PK;var V8=S(()=>{PK=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function H1($,Y){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=Y;let X=Z.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||CK.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function xK($,Y,Z){let X=1,Q=Z,J=new RegExp(`<${Y}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Y}\\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 x0($,Y){if(Y.selfClosing)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};let Z=xK($,Y.tag,Y.end);if(Z===-1)return{outerStart:Y.start,outerEnd:Y.end,innerHTML:""};return{outerStart:Y.start,outerEnd:Z,innerHTML:$.slice(Y.end,Z-`</${Y.tag}>`.length)}}function R8($,Y){return new RegExp(`(?:^|\\s)${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Y}=`)||$.includes(` ${Y} `)||$.trimEnd().endsWith(` ${Y}`)}function y1($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return X?X[1]:null}function $1($,Y){let Z=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function Y1($,Y,Z){let X=Y.selfClosing?" /":"",Q=`<${Y.tag}${Z}${X}>`;return $.slice(0,Y.start)+Q+$.slice(Y.end)}function fK($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function gK($){let Y=$,Z=0;while(Z<Y.length){let X=H1(Y,Z);if(!X)break;let Q=y1(X.attrs,"v-for");if(Q===null){Z=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Z=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],H=L[1];q=`${K} as ${H} => ${F}`}else q=`${K} as ${G}`;let _=$1(X.attrs,"v-for"),U=$1(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=x0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=Y1(B,{...X,start:0,end:X.end-X.start},U),z=`@foreach(${q})
3709
3709
  `,O=`${z}${j}
3710
3710
  @endforeach`;Y=Y.slice(0,W.outerStart)+O+Y.slice(W.outerEnd),Z=W.outerStart+z.length}return Y}function hK($){let Y=$,Z=0;while(Z<Y.length){let X=H1(Y,Z);if(!X)break;let Q=y1(X.attrs,"v-if");if(Q===null){Z=X.end;continue}let J=[],G=x0(Y,X),K=$1(X.attrs,"v-if"),q=Y1(Y.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 _=G.outerEnd,U=!0;while(U){let O=Y.slice(_).match(/^\s*/),L=O?O[0].length:0,F=H1(Y,_+L);if(!F){U=!1;break}let H=y1(F.attrs,"v-else-if"),V=R8(F.attrs,"v-else");if(H!==null){let N=x0(Y,F),R=$1(F.attrs,"v-else-if"),A=Y1(Y.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:H,outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:F}),_=N.outerEnd}else if(V){let N=x0(Y,F),R=$1(F.attrs,"v-else"),A=Y1(Y.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:_,outerEnd:N.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let W=[];for(let O of J)if(O.type==="if")W.push(`@if(${O.expr})
3711
3711
  ${O.element}`);else if(O.type==="else-if")W.push(`@elseif(${O.expr})
@@ -3713,7 +3713,7 @@ ${O.element}`);else W.push(`@else
3713
3713
  ${O.element}`);W.push("@endif");let B=W.join(`
3714
3714
  `),j=J[0].outerStart,z=J[J.length-1].outerEnd;Y=Y.slice(0,j)+B+Y.slice(z),Z=j+B.length}return Y}function dK($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function mK($){let Y=$,Z=0;while(Z<Y.length){let X=H1(Y,Z);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 U=K[1],W=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${B}" @update:${U}="${B} = $event"`,K=Q.match(G)}if(J){let U=x0(Y,X),W=Y.slice(U.outerStart,U.outerEnd),B=Y1(W,{...X,start:0,end:X.end-X.start},Q);Y=Y.slice(0,U.outerStart)+B+Y.slice(U.outerEnd),Z=U.outerStart+B.length;continue}let q=y1(X.attrs,"v-model");if(q===null){Z=X.end;continue}if(vK.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=x0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=Y1(B,{...X,start:0,end:X.end-X.start},U);Y=Y.slice(0,W.outerStart)+j+Y.slice(W.outerEnd),Z=W.outerStart+j.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=x0(Y,X),B=Y.slice(W.outerStart,W.outerEnd),j=Y1(B,{...X,start:0,end:X.end-X.start},U);Y=Y.slice(0,W.outerStart)+j+Y.slice(W.outerEnd),Z=W.outerStart+j.length}}return Y}function uK($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function lK($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function pK($){let Y=$,Z=0;while(Z<Y.length){let X=H1(Y,Z);if(!X)break;let Q=y1(X.attrs,"v-html");if(Q===null){Z=X.end;continue}if(X.selfClosing){Z=X.end;continue}let J=x0(Y,X),G=$1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function cK($){let Y=$,Z=0;while(Z<Y.length){let X=H1(Y,Z);if(!X)break;let Q=y1(X.attrs,"v-text");if(Q===null){Z=X.end;continue}if(X.selfClosing){Z=X.end;continue}let J=x0(Y,X),G=$1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function iK($){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 nK($){let Y=$,Z=0;while(Z<Y.length){let X=H1(Y,Z);if(!X)break;if(!R8(X.attrs,"v-once")){Z=X.end;continue}let Q=$1(X.attrs,"v-once"),J=x0(Y,X),G=Y.slice(J.outerStart,J.outerEnd),q=`@once
3715
3715
  ${Y1(G,{...X,start:0,end:X.end-X.start},Q)}
3716
- @endonce`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function oK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function sK($){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 N8($){if(!fK($))return $;let Y=$;return Y=gK(Y),Y=hK(Y),Y=nK(Y),Y=uK(Y),Y=lK(Y),Y=mK(Y),Y=dK(Y),Y=sK(Y),Y=pK(Y),Y=cK(Y),Y=iK(Y),Y=oK(Y),Y}var CK,vK;var A8=b(()=>{CK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vK=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"])});async function w8($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=Z0(U.expr,Y);if(!W||typeof W!=="string"){let H=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+H+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),j={},z=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=z.exec(B))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=Z0(V,Y)}catch{j[H]=V}else j[H]=V}let L=X.componentsDir||"components",F=await _1(W,j,U.slotContent,L,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J=await rK(J,Y,Z,X,Q),J}async function rK($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=Z0(U.expr,Y);if(!W||typeof W!=="string"){let z=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+z+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",j=await _1(W,{},"",B,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J}var T8=b(()=>{V0();N0()});function aK($,Y={},Z={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:_="",bodyAttrs:U={}}=Y,W=Z.title||X,z=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
3716
+ @endonce`;Y=Y.slice(0,J.outerStart)+q+Y.slice(J.outerEnd),Z=J.outerStart+q.length}return Y}function oK($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function sK($){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 N8($){if(!fK($))return $;let Y=$;return Y=gK(Y),Y=hK(Y),Y=nK(Y),Y=uK(Y),Y=lK(Y),Y=mK(Y),Y=dK(Y),Y=sK(Y),Y=pK(Y),Y=cK(Y),Y=iK(Y),Y=oK(Y),Y}var CK,vK;var A8=S(()=>{CK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vK=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"])});async function w8($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=Z0(U.expr,Y);if(!W||typeof W!=="string"){let H=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+H+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),j={},z=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,O;while((O=z.exec(B))!==null){let H=O[1]||O[2],V=O[3];if(O[1])try{j[H]=Z0(V,Y)}catch{j[H]=V}else j[H]=V}let L=X.componentsDir||"components",F=await _1(W,j,U.slotContent,L,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J=await rK(J,Y,Z,X,Q),J}async function rK($,Y,Z,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 _=K.length-1;_>=0;_--){let U=K[_];try{let W=Z0(U.expr,Y);if(!W||typeof W!=="string"){let z=`<!-- dynamic component: could not resolve "${U.expr}" -->`;J=J.slice(0,U.index)+z+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",j=await _1(W,{},"",B,Y,Z,X,new Set,Q??new Set);J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}catch(W){let j=`<!-- dynamic component error: ${W instanceof Error?W.message:String(W)} -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length)}}return J}var T8=S(()=>{V0();N0()});function aK($,Y={},Z={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:_="",bodyAttrs:U={}}=Y,W=Z.title||X,z=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
3717
3717
  `),O=G.map((R)=>{return` <link ${Object.entries(R).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
3718
3718
  `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([w])=>w!=="content").map(([w,T])=>`${w}="${T}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
3719
3719
  `),F=Object.entries(U).map(([R,A])=>` ${R}="${A}"`).join(""),H=_?` class="${_}"`:"",V=[z,` <title>${W}</title>`,O,L,q?` ${q}`:"",...(Z.styles||[]).map((R)=>` ${R}`),...(Z.headScripts||[]).map((R)=>` ${R}`),Z.headStack||""].filter(Boolean),N=[$,...(Z.bodyScripts||[]).map((R)=>R),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
@@ -3726,7 +3726,7 @@ ${V.join(`
3726
3726
  ${N.join(`
3727
3727
  `)}
3728
3728
  </body>
3729
- </html>`}function tK($){let Y=$.trim();while(Y.startsWith("<!--")){let Z=Y.indexOf("-->");if(Z===-1)break;Y=Y.slice(Z+3).trim()}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}function M8($,Y={},Z={}){if(tK($))return $;return aK($,Y,Z)}function N4($){let Y=$,Z=new Set,X=new Set,Q=()=>{if(k0)X.add(k0);return Y};return Q.set=(J)=>{if(!Object.is(J,Y)){let G=Y;if(Y=J,Z.forEach((K)=>K(Y,G)),q5)X.forEach((K)=>N9.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Y))},Q.subscribe=(J)=>{return Z.add(J),()=>Z.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function A4($){let Y,Z=!0,X=new Set,Q=()=>{if(!Z)if(Z=!0,q5)X.forEach((G)=>N9.add(G));else X.forEach((G)=>G())},J=()=>{if(k0)X.add(k0);if(Z){let G=k0;k0=Q,R9.push(Q);try{Y=$()}finally{R9.pop(),k0=G}Z=!1}return Y};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function w4($,Y={}){let Z,X=!1,Q=()=>{if(X)return;if(Z)Z(),Z=void 0;let J=k0;k0=Q,R9.push(Q);try{Z=$()}finally{R9.pop(),k0=J}};if(Y.immediate!==!1)Q();return()=>{if(X=!0,Z)Z()}}function T4($){if(q5){$();return}q5=!0;try{$()}finally{q5=!1,N9.forEach((Y)=>Y()),N9.clear()}}function M4($){eK.push($)}function I4($){$q.push($)}function A9($){return typeof $==="function"&&$._isSignal===!0}function w9($){return typeof $==="function"&&$._isDerived===!0}function E4($){if(A9($)||w9($))return $();return $}function D4($){let Y=k0;k0=null;try{return $()}finally{k0=Y}}var k0=null,R9,q5=!1,N9,eK,$q;var k4=b(()=>{R9=[],N9=new Set,eK=[],$q=[]});var b4={};s(b4,{untrack:()=>E4,state:()=>N4,peek:()=>D4,onMount:()=>M4,onDestroy:()=>I4,isSignal:()=>A9,isDerived:()=>w9,generateSignalsRuntimeDev:()=>T9,generateSignalsRuntime:()=>I8,effect:()=>w4,derived:()=>A4,default:()=>Yq,batch:()=>T4});function I8(){try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(T9());return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return T9()}}function T9(){return`
3729
+ </html>`}function tK($){let Y=$.trim();while(Y.startsWith("<!--")){let Z=Y.indexOf("-->");if(Z===-1)break;Y=Y.slice(Z+3).trim()}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}function M8($,Y={},Z={}){if(tK($))return $;return aK($,Y,Z)}function N4($){let Y=$,Z=new Set,X=new Set,Q=()=>{if(k0)X.add(k0);return Y};return Q.set=(J)=>{if(!Object.is(J,Y)){let G=Y;if(Y=J,Z.forEach((K)=>K(Y,G)),q5)X.forEach((K)=>N9.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Y))},Q.subscribe=(J)=>{return Z.add(J),()=>Z.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function A4($){let Y,Z=!0,X=new Set,Q=()=>{if(!Z)if(Z=!0,q5)X.forEach((G)=>N9.add(G));else X.forEach((G)=>G())},J=()=>{if(k0)X.add(k0);if(Z){let G=k0;k0=Q,R9.push(Q);try{Y=$()}finally{R9.pop(),k0=G}Z=!1}return Y};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function w4($,Y={}){let Z,X=!1,Q=()=>{if(X)return;if(Z)Z(),Z=void 0;let J=k0;k0=Q,R9.push(Q);try{Z=$()}finally{R9.pop(),k0=J}};if(Y.immediate!==!1)Q();return()=>{if(X=!0,Z)Z()}}function T4($){if(q5){$();return}q5=!0;try{$()}finally{q5=!1,N9.forEach((Y)=>Y()),N9.clear()}}function M4($){eK.push($)}function I4($){$q.push($)}function A9($){return typeof $==="function"&&$._isSignal===!0}function w9($){return typeof $==="function"&&$._isDerived===!0}function E4($){if(A9($)||w9($))return $();return $}function D4($){let Y=k0;k0=null;try{return $()}finally{k0=Y}}var k0=null,R9,q5=!1,N9,eK,$q;var k4=S(()=>{R9=[],N9=new Set,eK=[],$q=[]});var b4={};r(b4,{untrack:()=>E4,state:()=>N4,peek:()=>D4,onMount:()=>M4,onDestroy:()=>I4,isSignal:()=>A9,isDerived:()=>w9,generateSignalsRuntimeDev:()=>T9,generateSignalsRuntime:()=>I8,effect:()=>w4,derived:()=>A4,default:()=>Yq,batch:()=>T4});function I8(){try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(T9());return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return T9()}}function T9(){return`
3730
3730
  // STX Signals Runtime (Development Build)
3731
3731
  console.log('[stx] signals runtime loading');
3732
3732
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -7845,7 +7845,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
7845
7845
  }
7846
7846
  }
7847
7847
  })();
7848
- `}var Yq;var S4=b(()=>{k4();k4();Yq={state:N4,derived:A4,effect:w4,batch:T4,onMount:M4,onDestroy:I4,isSignal:A9,isDerived:w9,untrack:E4,peek:D4,generateSignalsRuntime:I8,generateSignalsRuntimeDev:T9}});var y4={};s(y4,{templateCache:()=>E8,readFileCached:()=>Zq,invalidateFileCacheByDir:()=>Jq,invalidateFileCache:()=>Xq,hashFilePath:()=>U5,getCachedSignalsRuntime:()=>Gq,getCachedRouterScript:()=>Kq,clearDevCaches:()=>qq,checkCache:()=>Uq,cacheTemplate:()=>_q});import Z1 from"fs";import P1 from"path";async function Zq($){let Z;for(let X=0;X<3;X++)try{let J=(await Z1.promises.stat($)).mtime.getTime(),G=L1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),_=(await Z1.promises.stat($)).mtime.getTime();if(_!==J)continue;return L1.set($,{content:K,mtime:_}),K}catch(Q){Z=Q;break}throw L1.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function Xq($){L1.delete($)}function Jq($){for(let Y of L1.keys())if(Y.startsWith($))L1.delete(Y)}async function Gq($=!1){if($){let{generateSignalsRuntimeDev:Y}=await Promise.resolve().then(() => (S4(),b4));return Y()}if(M9===null){let{generateSignalsRuntime:Y}=await Promise.resolve().then(() => (S4(),b4));M9=Y()}return M9}async function Kq(){if(I9===null){let{getRouterScript:$}=await import("stx-router");I9=$()}return I9}function qq(){L1.clear(),M9=null,Qq=null,I9=null}async function Uq($,Y){try{if(!Y.cachePath)return null;let Z=P1.resolve(Y.cachePath),X=P1.join(Z,`${U5($)}.html`),Q=P1.join(Z,`${U5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Y.cacheVersion)return null;if((await Z1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await Z1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function _q($,Y,Z,X){try{if(!X.cachePath)return;let Q=P1.resolve(X.cachePath);await Z1.promises.mkdir(Q,{recursive:!0});let J=P1.join(Q,`${U5($)}.html`),G=P1.join(Q,`${U5($)}.meta.json`),K=await Z1.promises.stat($);await Bun.write(J,Y);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:X.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),E8.set($,{output:Y,mtime:K.mtime.getTime(),dependencies:Z})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function U5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Wq)}var E8,L1,M9=null,Qq=null,I9=null,Wq=16;var P4=b(()=>{V0();E8=new Map,L1=new Map});function D8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Y=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Z="",X;while((X=Y.exec($))!==null)Z+=X[1]+`
7848
+ `}var Yq;var S4=S(()=>{k4();k4();Yq={state:N4,derived:A4,effect:w4,batch:T4,onMount:M4,onDestroy:I4,isSignal:A9,isDerived:w9,untrack:E4,peek:D4,generateSignalsRuntime:I8,generateSignalsRuntimeDev:T9}});var y4={};r(y4,{templateCache:()=>E8,readFileCached:()=>Zq,invalidateFileCacheByDir:()=>Jq,invalidateFileCache:()=>Xq,hashFilePath:()=>U5,getCachedSignalsRuntime:()=>Gq,getCachedRouterScript:()=>Kq,clearDevCaches:()=>qq,checkCache:()=>Uq,cacheTemplate:()=>_q});import Z1 from"fs";import P1 from"path";async function Zq($){let Z;for(let X=0;X<3;X++)try{let J=(await Z1.promises.stat($)).mtime.getTime(),G=L1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),_=(await Z1.promises.stat($)).mtime.getTime();if(_!==J)continue;return L1.set($,{content:K,mtime:_}),K}catch(Q){Z=Q;break}throw L1.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function Xq($){L1.delete($)}function Jq($){for(let Y of L1.keys())if(Y.startsWith($))L1.delete(Y)}async function Gq($=!1){if($){let{generateSignalsRuntimeDev:Y}=await Promise.resolve().then(() => (S4(),b4));return Y()}if(M9===null){let{generateSignalsRuntime:Y}=await Promise.resolve().then(() => (S4(),b4));M9=Y()}return M9}async function Kq(){if(I9===null){let{getRouterScript:$}=await import("stx-router");I9=$()}return I9}function qq(){L1.clear(),M9=null,Qq=null,I9=null}async function Uq($,Y){try{if(!Y.cachePath)return null;let Z=P1.resolve(Y.cachePath),X=P1.join(Z,`${U5($)}.html`),Q=P1.join(Z,`${U5($)}.meta.json`);if(!await c(X)||!await c(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Y.cacheVersion)return null;if((await Z1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await Z1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function _q($,Y,Z,X){try{if(!X.cachePath)return;let Q=P1.resolve(X.cachePath);await Z1.promises.mkdir(Q,{recursive:!0});let J=P1.join(Q,`${U5($)}.html`),G=P1.join(Q,`${U5($)}.meta.json`),K=await Z1.promises.stat($);await Bun.write(J,Y);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:X.cacheVersion,generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),E8.set($,{output:Y,mtime:K.mtime.getTime(),dependencies:Z})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function U5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Wq)}var E8,L1,M9=null,Qq=null,I9=null,Wq=16;var P4=S(()=>{V0();E8=new Map,L1=new Map});function D8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Y=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Z="",X;while((X=Y.exec($))!==null)Z+=X[1]+`
7849
7849
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Z+=X[1]+`
7850
7850
  `;if(!Z.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Z)}),K=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"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,_,U=!1;while((_=q.exec(Z))!==null)if(!K.has(_[1])){U=!0;break}if(!G&&!U)return $;let W=`<script type="module">
7851
7851
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -7863,7 +7863,7 @@ ${W}`);return W+`
7863
7863
  `+Q+$.slice(K+1)}return Q+`
7864
7864
  `+$}async function b8($,Y){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Z=Y?.router,X="";if(Z){let K={};if(Z.container)K.container=Z.container;if(Z.viewTransitions!==void 0)K.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)K.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)K.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)K.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)K.prefetch=Z.prefetch;if(Z.cache!==void 0)K.cache=Z.cache;if(Z.progressColor!==void 0)K.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)K.progressHeight=Z.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
7865
7865
  `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (P4(),y4)),J=Y?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
7866
- </body>`+$.slice(G+7)}var f8={};s(f8,{scanScriptTags:()=>P8,processSignals:()=>x4,processScriptSetup:()=>v8,parseLoopExpression:()=>C8,hasSignalsSyntax:()=>D9,extractExports:()=>x8,convertSignalLoopsToAttributes:()=>v4,convertSignalDirectivesToAttributes:()=>C4});function P8($,Y={}){let Z=[];E9.lastIndex=0;let X;while((X=E9.exec($))!==null){let Q=X[1],J=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",J);if(G===-1)break;let K=G+9;if(Y.skipAttrs&&Y.skipAttrs.test(Q)){E9.lastIndex=K;continue}Z.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),E9.lastIndex=K}return Z}function C8($){let Y=$.trim(),Z=Y.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let Q=Z[1].trim(),J=Z[2].trim(),{itemVar:G,indexVar:K}=S8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Y.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}=S8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function S8($){let Y=$.trim(),Z=Y.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let X=Y.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Y.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Y.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function D9($){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*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Z)=>Z.test($))}function zq($){let Y=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,X;while((X=Y.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Z++;else if(Q==="endif")Z--;else if(Z===0)return!0}return!1}function C4($){let Y=$,Z=/@if\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.substring(G,q-1).trim(),U=q,W=1,B=U,j=/@(if\s*\(|endif)/g;j.lastIndex=U;let z;while((z=j.exec(Y))!==null)if(z[1].startsWith("if"))W++;else if(z[1]==="endif"){if(W--,W===0){B=z.index+z[0].length;break}}if(W!==0)continue;let O=Y.substring(U,B-6).trim();if(zq(O))continue;let L=O.match(y8),F;if(L){let[,H,V,N]=L,R=_.replace(/"/g,"&quot;");F=`<${H}${V} @if="${R}">${N}</${H}>`}else F=`<template @if="${_.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:J,end:B,replacement:F})}for(let J=Q.length-1;J>=0;J--){let{start:G,end:K,replacement:q}=Q[J];Y=Y.substring(0,G)+q+Y.substring(K)}return Y}function v4($,Y){let Z=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,_=1,U=q;while(U<Z.length&&_>0){if(Z[U]==="(")_++;else if(Z[U]===")")_--;U++}if(_!==0)continue;let W=Z.substring(q,U-1).trim(),B=U,j=C8(W);if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Y){let w=A.split(/[.[(]/)[0].trim();if(w&&w in Y)continue}}if(j.style==="as")W=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let z=G==="for"?"@endfor":"@endforeach",O=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 H;while((H=F.exec(Z))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){L=H.index+H[0].length;break}if(O!==0)continue;let V=Z.substring(B,L-z.length).trim(),N=V.match(y8),R;if(N){let[,A,w,T]=N;R=`<${A}${w} @for="${W}">${T}</${A}>`}else R=`<template @for="${W}">${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:_}=J[G];Z=Z.substring(0,K)+_+Z.substring(q)}return Z}function jq($){let Y=new Set,Z=[],X=0,Q=0,J=$.length,G=(U)=>{let W=X+1;while(W<J){let B=$[W];if(B==="\\"){W+=2;continue}if(B===U)return W+1;W++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
7866
+ </body>`+$.slice(G+7)}var f8={};r(f8,{scanScriptTags:()=>P8,processSignals:()=>x4,processScriptSetup:()=>v8,parseLoopExpression:()=>C8,hasSignalsSyntax:()=>D9,extractExports:()=>x8,convertSignalLoopsToAttributes:()=>v4,convertSignalDirectivesToAttributes:()=>C4});function P8($,Y={}){let Z=[];E9.lastIndex=0;let X;while((X=E9.exec($))!==null){let Q=X[1],J=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",J);if(G===-1)break;let K=G+9;if(Y.skipAttrs&&Y.skipAttrs.test(Q)){E9.lastIndex=K;continue}Z.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),E9.lastIndex=K}return Z}function C8($){let Y=$.trim(),Z=Y.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let Q=Z[1].trim(),J=Z[2].trim(),{itemVar:G,indexVar:K}=S8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Y.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}=S8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function S8($){let Y=$.trim(),Z=Y.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let X=Y.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Y.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Y.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function D9($){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*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Z)=>Z.test($))}function zq($){let Y=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,X;while((X=Y.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Z++;else if(Q==="endif")Z--;else if(Z===0)return!0}return!1}function C4($){let Y=$,Z=/@if\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.substring(G,q-1).trim(),U=q,W=1,B=U,j=/@(if\s*\(|endif)/g;j.lastIndex=U;let z;while((z=j.exec(Y))!==null)if(z[1].startsWith("if"))W++;else if(z[1]==="endif"){if(W--,W===0){B=z.index+z[0].length;break}}if(W!==0)continue;let O=Y.substring(U,B-6).trim();if(zq(O))continue;let L=O.match(y8),F;if(L){let[,H,V,N]=L,R=_.replace(/"/g,"&quot;");F=`<${H}${V} @if="${R}">${N}</${H}>`}else F=`<template @if="${_.replace(/"/g,"&quot;")}">${O}</template>`;Q.push({start:J,end:B,replacement:F})}for(let J=Q.length-1;J>=0;J--){let{start:G,end:K,replacement:q}=Q[J];Y=Y.substring(0,G)+q+Y.substring(K)}return Y}function v4($,Y){let Z=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,_=1,U=q;while(U<Z.length&&_>0){if(Z[U]==="(")_++;else if(Z[U]===")")_--;U++}if(_!==0)continue;let W=Z.substring(q,U-1).trim(),B=U,j=C8(W);if(j.iterable){let A=j.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Y){let w=A.split(/[.[(]/)[0].trim();if(w&&w in Y)continue}}if(j.style==="as")W=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let z=G==="for"?"@endfor":"@endforeach",O=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 H;while((H=F.exec(Z))!==null)if(H[1].startsWith(G))O++;else if(O--,O===0){L=H.index+H[0].length;break}if(O!==0)continue;let V=Z.substring(B,L-z.length).trim(),N=V.match(y8),R;if(N){let[,A,w,T]=N;R=`<${A}${w} @for="${W}">${T}</${A}>`}else R=`<template @for="${W}">${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:_}=J[G];Z=Z.substring(0,K)+_+Z.substring(q)}return Z}function jq($){let Y=new Set,Z=[],X=0,Q=0,J=$.length,G=(U)=>{let W=X+1;while(W<J){let B=$[W];if(B==="\\"){W+=2;continue}if(B===U)return W+1;W++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
7867
7867
  `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},_=(U)=>{let W=U,B=0;while(W<J){let j=$[W];if(j==="/"&&$[W+1]==="/"){let z=W+2;while(z<J&&$[z]!==`
7868
7868
  `)z++;W=z;continue}if(j==="/"&&$[W+1]==="*"){let z=W+2;while(z<J-1&&!($[z]==="*"&&$[z+1]==="/"))z++;W=z+2;continue}if(j==='"'||j==="'"||j==="`"){let z=W+1;while(z<J){if($[z]==="\\"){z+=2;continue}if($[z]===j){z++;break}z++}W=z;continue}if(j==="("||j==="["||j==="{"){B++,W++;continue}if(j===")"||j==="]"||j==="}"){B--,W++;continue}if(j===";"&&B===0)return W+1;W++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let W=K();Z.push($.slice(X,W)),X=W;continue}if(U==="/"&&$[X+1]==="*"){let W=q();Z.push($.slice(X,W)),X=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);Z.push($.slice(X,W)),X=W;continue}if(U==="{"){Q++,Z.push(U),X++;continue}if(U==="}"){Q--,Z.push(U),X++;continue}if(Q===0){let W=X>0?$[X-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let z=j[2],O=_(X+j[0].length);if(Y.has(z)){Z.push(`/* stx: deduped const ${z} */`),X=O;continue}Y.add(z),Z.push($.slice(X,O)),X=O;continue}}}Z.push(U),X++}return Z.join("")}async function v8($,Y){let Z=P8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let j of Z){let z=j.body;if(Q1(j.attrs))z=G1(z);if(X.test(z))Q.push({fullMatch:j.fullMatch,attrs:j.attrs,content:z})}if(Q.length===0)return{output:$,setupCode:null};let J=`__stx_setup_${Date.now()}_${Bq++}`,{hasUserImports:G,bundleClientScript:K}=await Promise.resolve().then(() => (o9(),n9)),q=[];for(let j=0;j<Q.length;j++){let z=Q[j].content;if(G(z))console.log("[stx:bundler] bundling signal script imports"),z=await K(z,Y||"",{projectRoot:process.cwd()});z=z.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let O=o0(z);q.push(`// \u2500\u2500 merged signal script #${j+1} \u2500\u2500
7869
7869
  ${O}`)}let _=q.join(`
@@ -7880,19 +7880,19 @@ if(window.stx)window.stx._latestSetup=${J};
7880
7880
  `)J++;return!0}if(Y[J]==="/"&&Y[J+1]==="*"){J+=2;while(J<G-1&&!(Y[J]==="*"&&Y[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let W=Y.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let L=W[2];if(!X.has(L))Z.push(L),X.add(L);return}let B=Y.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(B){B[1].split(",").forEach((L)=>{let F=L.trim();if(!F)return;let H=F.indexOf(":"),N=(H>=0?F.slice(H+1).trim():F).split(/[\s=]/)[0];if(N&&!X.has(N))Z.push(N),X.add(N)});return}let j=Y.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){j[1].split(",").forEach((L)=>{let F=L.trim().replace(/^\.\.\./,"");if(!F)return;let H=F.split(/[\s=]/)[0];if(H&&!X.has(H))Z.push(H),X.add(H)});return}let z=Y.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let L=z[1];if(!X.has(L))Z.push(L),X.add(L);return}let O=Y.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let L=O[1];if(!X.has(L))Z.push(L),X.add(L)}};while(J<G){if(_())continue;if(Y[J]==="'"||Y[J]==='"'){K(Y[J]);continue}if(Y[J]==="`"){q();continue}if(Y[J]==="{"){Q++,J++;continue}if(Y[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Y[J])&&(J===0||/\s|[;{}()]/.test(Y[J-1])))U();J++}return Z.join(", ")}async function x4($,Y,Z){if(!D9($))return $;let X=$;if(Y.skipSignalsRuntime)return X;let{output:Q,setupCode:J}=await v8(X,Z);if(X=Q,X=await k8(X,Y),X=D8(X),J)if(X.includes("</head>"))X=X.replace("</head>",`${J}
7881
7881
  </head>`);else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
7882
7882
  ${J}`);else X=X+`
7883
- `+J;let G=X.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!J&&!K){if(X.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))X=X.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return X}var Bq=0,E9,y8;var f4=b(()=>{V0();E9=/<script\b([^>]*)>/gi,y8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import S0 from"path";import g4 from"fs";function g8($){return $.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join("")}function h8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class d8{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Y of $.aliases)this.builtins.set(Y.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Y,Z,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let j=[Q,Q.toLowerCase(),g8(Q),h8(Q)];for(let z of j)if(J.has(z))return J.get(z)}let G=[...new Set([`${Q}.stx`,`${g8(Q)}.stx`,`${h8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=S0.resolve(S0.dirname(Y),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=Z.componentsDir||"",_=X?.__originalFilePath;if(_)K.push(S0.join(S0.dirname(_),"components"));if(q)K.push(q);let U=S0.join(S0.dirname(Y),"components");if(!K.includes(U))K.push(U);let W=process.cwd(),B=[S0.resolve(W,"src/components"),S0.resolve(W,"components"),S0.resolve(import.meta.dir,"components")];for(let j of B)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let z of G){let O=S0.join(j,z);if(await c(O))return O}try{if(!g4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=g4.readdirSync(j,{withFileTypes:!0});for(let L of O)if(L.isDirectory()){let F=S0.join(j,L.name);for(let H of G){let V=S0.join(F,H);if(await c(V))return V}}}catch{}}return null}}var f0;var h4=b(()=>{V0();f0=new d8});function g0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Oq($){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 d4;var m4=b(()=>{d4={name:"StxLink",aliases:["stx-link"],render($,Y,Z){let X=Oq($),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="${g0(X.value)}"`);else q.push(`href="${g0(X.value)}"`);if(Q)q.push(`class="${g0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${g0(J)}"`),q.push(`data-stx-exact-active-class="${g0(G)}"`),K)q.push("data-stx-prefetch");for(let[U,W]of Object.entries($.events))q.push(`@${g0(U)}="${g0(W)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,W]of Object.entries($.static)){if(_.has(U))continue;if(typeof W==="boolean"){if(W)q.push(g0(U))}else q.push(`${g0(U)}="${g0(W)}"`)}return`<a ${q.join(" ")}>${Y}</a>`}}});function W0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T0($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function l4($,Y,Z=!1){let X=$.serverDynamic[Y];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Y];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Z}function m8($){if($.includes("(")||$.includes(","))return $;let Y=$.trim().split(/\s+/),Z=[];for(let X of Y)if(X.includes(":")){let[Q,J]=X.split(":"),G=Hq[Q];if(G)Z.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Z.push(`(max-width: ${K}px) ${J}`)}}else Z.push(X);return Z.join(", ")}function p4($,Y,Z,X){return Y.map((Q)=>`${_5($,Q,void 0,Z,X)} ${Q}w`).join(", ")}function Lq($,Y,Z,X,Q){return Y.map((J)=>{let G=Z?Z*J:void 0;return`${_5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function _5($,Y,Z,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Y)J.push(`w_${Y}`);if(Z)J.push(`h_${Z}`);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(Y)J.set("w",String(Y));if(Z)J.set("h",String(Z));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(Y)J.set("width",String(Y));if(Z)J.set("height",String(Z));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function Fq($,Y,Z="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Y}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Hq,u4,c4;var i4=b(()=>{Hq={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},u4=[320,640,768,1024,1280,1536,1920];c4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Y,Z){let X=T0($,"src")||"",Q=T0($,"alt")||"",J=T0($,"width"),G=T0($,"height"),K=T0($,"sizes"),q=T0($,"srcset"),_=T0($,"densities"),U=T0($,"format"),W=T0($,"placeholder"),B=T0($,"placeholderColor")||"#e5e7eb",j=T0($,"provider"),z=T0($,"class")||T0($,"className")||"",O=T0($,"style")||"",L=T0($,"quality"),F=l4($,"lazy",!0),H=l4($,"preload",!1),V=l4($,"picture",!1)||!!U,N=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",w="";if(!A&&K)A=p4(X,u4,j,U),w=m8(K);else if(!A&&_){let y=_.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));A=Lq(X,y,N,j,U)}else if(K)w=m8(K);let T=[];if(O)T.push(O);if(N&&R)T.push(`aspect-ratio:${N}/${R}`);if(W==="blur"||W==="color"){let y=Fq(N||16,R||9,B);T.push(`background-image:url(${y})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")T.push(`background-image:url(${W0(W)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=_5(X,N,R,j,U),M=[];if(M.push(`src="${W0(I)}"`),M.push(`alt="${W0(Q)}"`),J)M.push(`width="${W0(J)}"`);if(G)M.push(`height="${W0(G)}"`);if(F)M.push('loading="lazy"');if(M.push('decoding="async"'),z)M.push(`class="${W0(z)}"`);if(T.length>0)M.push(`style="${W0(T.join(";"))}"`);if(A)M.push(`srcset="${W0(A)}"`);if(w)M.push(`sizes="${W0(w)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[y,S]of Object.entries($.static)){if(E.has(y))continue;if(typeof S==="boolean"){if(S)M.push(W0(y))}else M.push(`${W0(y)}="${W0(S)}"`)}let D=`<img ${M.join(" ")} />`,P="";if(H){let S=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${W0(I)}"${S?` type="${S}"`:""}${A?` imagesrcset="${W0(A)}"`:""}${w?` imagesizes="${W0(w)}"`:""} />
7884
- `}if(V){let y=[];if(U==="avif"||U==="auto"){let S=_5(X,N,R,j,"avif"),k=A?p4(X,u4,j,"avif"):`${S}`;y.push(`<source type="image/avif" srcset="${W0(k)}"${w?` sizes="${W0(w)}"`:""} />`)}if(U==="webp"||U==="auto"){let S=_5(X,N,R,j,"webp"),k=A?p4(X,u4,j,"webp"):`${S}`;y.push(`<source type="image/webp" srcset="${W0(k)}"${w?` sizes="${W0(w)}"`:""} />`)}return`${P}<picture>
7885
- ${y.join(`
7883
+ `+J;let G=X.match(/<body([^>]*)>/i),K=G&&/data-stx/.test(G[1]);if(!J&&!K){if(X.includes("<body")&&G&&!/data-stx-auto/.test(G[1]))X=X.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return X}var Bq=0,E9,y8;var f4=S(()=>{V0();E9=/<script\b([^>]*)>/gi,y8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s});import S0 from"path";import g4 from"fs";function g8($){return $.split("-").map((Y)=>Y.charAt(0).toUpperCase()+Y.slice(1)).join("")}function h8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class d8{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Y of $.aliases)this.builtins.set(Y.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Y,Z,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let j=[Q,Q.toLowerCase(),g8(Q),h8(Q)];for(let z of j)if(J.has(z))return J.get(z)}let G=[...new Set([`${Q}.stx`,`${g8(Q)}.stx`,`${h8(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let j=S0.resolve(S0.dirname(Y),`${Q}.stx`);if(await c(j))return j;return null}let K=[],q=Z.componentsDir||"",_=X?.__originalFilePath;if(_)K.push(S0.join(S0.dirname(_),"components"));if(q)K.push(q);let U=S0.join(S0.dirname(Y),"components");if(!K.includes(U))K.push(U);let W=process.cwd(),B=[S0.resolve(W,"src/components"),S0.resolve(W,"components"),S0.resolve(import.meta.dir,"components")];for(let j of B)if(!K.includes(j))K.push(j);for(let j of K){if(!j)continue;for(let z of G){let O=S0.join(j,z);if(await c(O))return O}try{if(!g4.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let O=g4.readdirSync(j,{withFileTypes:!0});for(let L of O)if(L.isDirectory()){let F=S0.join(j,L.name);for(let H of G){let V=S0.join(F,H);if(await c(V))return V}}}catch{}}return null}}var f0;var h4=S(()=>{V0();f0=new d8});function g0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Oq($){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 d4;var m4=S(()=>{d4={name:"StxLink",aliases:["stx-link"],render($,Y,Z){let X=Oq($),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="${g0(X.value)}"`);else q.push(`href="${g0(X.value)}"`);if(Q)q.push(`class="${g0(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${g0(J)}"`),q.push(`data-stx-exact-active-class="${g0(G)}"`),K)q.push("data-stx-prefetch");for(let[U,W]of Object.entries($.events))q.push(`@${g0(U)}="${g0(W)}"`);let _=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,W]of Object.entries($.static)){if(_.has(U))continue;if(typeof W==="boolean"){if(W)q.push(g0(U))}else q.push(`${g0(U)}="${g0(W)}"`)}return`<a ${q.join(" ")}>${Y}</a>`}}});function W0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T0($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function l4($,Y,Z=!1){let X=$.serverDynamic[Y];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Y];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Z}function m8($){if($.includes("(")||$.includes(","))return $;let Y=$.trim().split(/\s+/),Z=[];for(let X of Y)if(X.includes(":")){let[Q,J]=X.split(":"),G=Hq[Q];if(G)Z.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Z.push(`(max-width: ${K}px) ${J}`)}}else Z.push(X);return Z.join(", ")}function p4($,Y,Z,X){return Y.map((Q)=>`${_5($,Q,void 0,Z,X)} ${Q}w`).join(", ")}function Lq($,Y,Z,X,Q){return Y.map((J)=>{let G=Z?Z*J:void 0;return`${_5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function _5($,Y,Z,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Y)J.push(`w_${Y}`);if(Z)J.push(`h_${Z}`);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(Y)J.set("w",String(Y));if(Z)J.set("h",String(Z));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(Y)J.set("width",String(Y));if(Z)J.set("height",String(Z));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function Fq($,Y,Z="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Y}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Hq,u4,c4;var i4=S(()=>{Hq={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},u4=[320,640,768,1024,1280,1536,1920];c4={name:"StxImage",aliases:["stx-image","stx-img"],render($,Y,Z){let X=T0($,"src")||"",Q=T0($,"alt")||"",J=T0($,"width"),G=T0($,"height"),K=T0($,"sizes"),q=T0($,"srcset"),_=T0($,"densities"),U=T0($,"format"),W=T0($,"placeholder"),B=T0($,"placeholderColor")||"#e5e7eb",j=T0($,"provider"),z=T0($,"class")||T0($,"className")||"",O=T0($,"style")||"",L=T0($,"quality"),F=l4($,"lazy",!0),H=l4($,"preload",!1),V=l4($,"picture",!1)||!!U,N=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",w="";if(!A&&K)A=p4(X,u4,j,U),w=m8(K);else if(!A&&_){let P=_.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));A=Lq(X,P,N,j,U)}else if(K)w=m8(K);let T=[];if(O)T.push(O);if(N&&R)T.push(`aspect-ratio:${N}/${R}`);if(W==="blur"||W==="color"){let P=Fq(N||16,R||9,B);T.push(`background-image:url(${P})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(W&&W!=="empty"&&W!=="none")T.push(`background-image:url(${W0(W)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let D=_5(X,N,R,j,U),I=[];if(I.push(`src="${W0(D)}"`),I.push(`alt="${W0(Q)}"`),J)I.push(`width="${W0(J)}"`);if(G)I.push(`height="${W0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),z)I.push(`class="${W0(z)}"`);if(T.length>0)I.push(`style="${W0(T.join(";"))}"`);if(A)I.push(`srcset="${W0(A)}"`);if(w)I.push(`sizes="${W0(w)}"`);let M=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[P,k]of Object.entries($.static)){if(M.has(P))continue;if(typeof k==="boolean"){if(k)I.push(W0(P))}else I.push(`${W0(P)}="${W0(k)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(H){let k=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${W0(D)}"${k?` type="${k}"`:""}${A?` imagesrcset="${W0(A)}"`:""}${w?` imagesizes="${W0(w)}"`:""} />
7884
+ `}if(V){let P=[];if(U==="avif"||U==="auto"){let k=_5(X,N,R,j,"avif"),b=A?p4(X,u4,j,"avif"):`${k}`;P.push(`<source type="image/avif" srcset="${W0(b)}"${w?` sizes="${W0(w)}"`:""} />`)}if(U==="webp"||U==="auto"){let k=_5(X,N,R,j,"webp"),b=A?p4(X,u4,j,"webp"):`${k}`;P.push(`<source type="image/webp" srcset="${W0(b)}"${w?` sizes="${W0(w)}"`:""} />`)}return`${C}<picture>
7885
+ ${P.join(`
7886
7886
  `)}
7887
- ${D}
7888
- </picture>`}return`${P}${D}`}}});function n4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function W5($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function k9($,Y,Z){let X=W5($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var o4;var s4=b(()=>{o4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Y,Z){let X=n4(W5($,"color")||"#6366f1"),Q=n4(W5($,"initialColor")||W5($,"initial-color")||""),J=n4(W5($,"height")||"3px"),G=k9($,"duration",2000),K=k9($,"throttle",200),q=k9($,"zIndex",999999)||k9($,"z-index",999999),_=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
7887
+ ${E}
7888
+ </picture>`}return`${C}${E}`}}});function n4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function W5($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function k9($,Y,Z){let X=W5($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var o4;var s4=S(()=>{o4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Y,Z){let X=n4(W5($,"color")||"#6366f1"),Q=n4(W5($,"initialColor")||W5($,"initial-color")||""),J=n4(W5($,"height")||"3px"),G=k9($,"duration",2000),K=k9($,"throttle",200),q=k9($,"zIndex",999999)||k9($,"z-index",999999),_=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
7889
7889
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${_};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
7890
7890
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
7891
7891
  </div>
7892
7892
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
7893
7893
  <script>
7894
7894
  (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()})})();
7895
- </script>`}}});function l8($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function Vq($,Y,Z){let X=l8($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var u8,r4;var a4=b(()=>{u8={"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%)"},r4={name:"StxToast",aliases:["stx-toast"],render($,Y,Z){let X=l8($,"position")||"top-right",Q=Vq($,"max",5),J=u8[X]||u8["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>
7895
+ </script>`}}});function l8($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}function Vq($,Y,Z){let X=l8($,Y);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Z}var u8,r4;var a4=S(()=>{u8={"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%)"},r4={name:"StxToast",aliases:["stx-toast"],render($,Y,Z){let X=l8($,"position")||"top-right",Q=Vq($,"max",5),J=u8[X]||u8["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>
7896
7896
  <style>
7897
7897
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
7898
7898
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -7900,7 +7900,7 @@ ${D}
7900
7900
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
7901
7901
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
7902
7902
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
7903
- </style>`}}});function b9($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var p8,t4;var e4=b(()=>{p8={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},t4={name:"StxModal",aliases:["stx-modal"],render($,Y,Z){let X=b9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=b9($,"size")||"md",J=b9($,"closeOnBackdrop")!=="false",G=b9($,"closeOnEscape")!=="false",K=p8[Q]||p8.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${J}" data-close-escape="${G}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
7903
+ </style>`}}});function b9($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var p8,t4;var e4=S(()=>{p8={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},t4={name:"StxModal",aliases:["stx-modal"],render($,Y,Z){let X=b9($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=b9($,"size")||"md",J=b9($,"closeOnBackdrop")!=="false",G=b9($,"closeOnEscape")!=="false",K=p8[Q]||p8.md;return`<div id="stx-modal-${X}" class="stx-modal-backdrop" data-stx-modal="${X}" data-close-backdrop="${J}" data-close-escape="${G}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
7904
7904
  <div class="stx-modal-panel" style="${K};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
7905
7905
  <div style="padding:1.5rem">${Y}</div>
7906
7906
  </div>
@@ -7909,7 +7909,7 @@ ${D}
7909
7909
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
7910
7910
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
7911
7911
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
7912
- </style>`}}});function C1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var c8,$7;var Y7=b(()=>{c8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},$7={name:"StxDrawer",aliases:["stx-drawer"],render($,Y,Z){let X=C1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=C1($,"side")||"right",J=C1($,"size")||"md",G=C1($,"closeOnBackdrop")!=="false",K=C1($,"closeOnEscape")!=="false",q=C1($,"overlay")!=="false",_=c8[J]||c8.md,U=Q==="left",W=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
7912
+ </style>`}}});function C1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let Z=$.static[Y];if(typeof Z==="string")return Z;return}var c8,$7;var Y7=S(()=>{c8={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},$7={name:"StxDrawer",aliases:["stx-drawer"],render($,Y,Z){let X=C1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=C1($,"side")||"right",J=C1($,"size")||"md",G=C1($,"closeOnBackdrop")!=="false",K=C1($,"closeOnEscape")!=="false",q=C1($,"overlay")!=="false",_=c8[J]||c8.md,U=Q==="left",W=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${X}" class="stx-drawer-backdrop" data-stx-drawer="${X}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
7913
7913
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${W};width:${_};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
7914
7914
  <div style="padding:1.5rem">${Y}</div>
7915
7915
  </div>
@@ -7918,24 +7918,24 @@ ${D}
7918
7918
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
7919
7919
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
7920
7920
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
7921
- </style>`}}});async function Rq($){if(B5.has($))return B5.get($);try{let Y=e.resolve(`@iconify/json/json/${$}.json`),Z=await Bun.file(Y).json();return B5.set($,Z.icons),Z.icons}catch{try{let Z=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,X=Bun.file(Z);if(await X.exists()){let Q=await X.json();return B5.set($,Q.icons),Q.icons}}catch{}}return null}function v1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);if($.static[Y]!==void 0)return String($.static[Y]);if($.clientReactive[Y]!==void 0)return $.clientReactive[Y];return}var B5,Z7;var X7=b(()=>{B5=new Map;Z7={name:"Icon",aliases:["icon","stx-icon"],render($,Y,Z){let X=v1($,"name")??v1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let H=X.split(":");Q=H[0],J=H[1]}let G=v1($,"size")||"24",K=v1($,"color")||"currentColor",q=v1($,"class")||"",_=v1($,"style")||"",U=B5.get(Q);if(!U)return Rq(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let W=U[J];if(!W)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=W.width||24,j=W.height||24,z=`0 0 ${B} ${j}`,O=W.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${z}" fill="none"${L}${F}>${O}</svg>`}}});function i8(){f0.registerBuiltin(d4),f0.registerBuiltin(c4),f0.registerBuiltin(o4),f0.registerBuiltin(r4),f0.registerBuiltin(t4),f0.registerBuiltin($7),f0.registerBuiltin(Z7)}var n8=b(()=>{m4();i4();s4();a4();e4();Y7();X7();h4();m4();i4();s4();a4();e4();Y7();X7()});function o8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function s8($,Y,Z){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Y.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Z&&Z.has(q.toLowerCase())){let O=J+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let _=J+1+q.length,U=null,W=_,B=-1,j=!1;while(_<$.length){let O=$[_];if(U){if(O==="\\"&&_+1<$.length){_+=2;continue}if(O===U)U=null;_++;continue}if(O==='"'||O==="'"){U=O,_++;continue}if(O==="/"&&_+1<$.length&&$[_+1]===">"){B=_+2,j=!0;break}if(O===">"){B=_+1;break}_++}if(B===-1){Q=J+1;continue}let z=$.slice(W,j?B-2:B-1).trim();if(j)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:z,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let O=`<${q}`,L=`</${q}>`,F=1,H=B,V=-1;while(F>0&&H<$.length){let A=$.indexOf(O,H),w=$.indexOf(L,H);if(w===-1)break;if(A!==-1&&A<w){let T=$[A+O.length];if(T===" "||T===">"||T==="/"||T===`
7922
- `||T==="\t")F++;H=A+O.length}else{if(F--,F===0){V=w;break}H=w+L.length}}if(V===-1){Q=B;continue}let N=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:z,content:N,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}var r8=b(()=>{N0();V0()});import x1 from"path";function Aq($,Y,Z){let X={static:{},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=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let _=J(q.slice(6));try{let U=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");X.serverDynamic[_]=JSON.parse(U)}catch(U){if(Z.debug)console.error(`Error parsing __stx_${_}:`,U);X.serverDynamic[_]=K}continue}if(q.startsWith(":")){let _=J(q.slice(1)),U=K==="true"?_:K;try{if(!t(U)){if(Z.debug)console.error(`Unsafe expression in :${_} binding: ${U}`);X.clientReactive[_]=U;continue}let W=Object.keys(Y),j=$0(U,W)(...Object.values(Y));if(j===void 0){let z=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(z.some((F)=>!O.has(F)&&!W.includes(F))){X.clientReactive[_]=U;continue}}X.serverDynamic[_]=j}catch{X.clientReactive[_]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let U=_[1];if(t(U)){let B=$0(U,Object.keys(Y))(...Object.values(Y));X.static[q]=B!=null?String(B):""}else{if(Z.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Z.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,W=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=W.exec(K))!==null)try{let j=B[1];if(!t(j)){if(Z.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=$0(j,Object.keys(Y))(...Object.values(Y));U=U.replace(B[0],String(O??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${q}:`,j)}X.static[q]=U}continue}X.static[q]=K}return X}function wq($){let Y={},Z=0,X=$.length;while(Z<X){while(Z<X&&/\s/.test($[Z]))Z++;if(Z>=X)break;let Q="";while(Z<X&&!/[\s=]/.test($[Z]))Q+=$[Z],Z++;if(!Q)break;while(Z<X&&/\s/.test($[Z]))Z++;if(Z<X&&$[Z]==="="){Z++;while(Z<X&&/\s/.test($[Z]))Z++;let J="";if(Z<X&&($[Z]==='"'||$[Z]==="'")){let G=$[Z];Z++;while(Z<X){let K=$[Z];if(K==="\\"&&Z+1<X){Z++,J+=$[Z],Z++;continue}if(K===G){Z++;break}J+=K,Z++}}else while(Z<X&&!/\s/.test($[Z]))J+=$[Z],Z++;Y[Q]=J}else Y[Q]="true"}return Y}async function Tq($,Y,Z,X,Q){let J=$;if(!Y.__importedComponents)Y.__importedComponents=new Map;let G=Y.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[_,U]=q,W=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of W){let j=B.split("/"),O=j[j.length-1].replace(/\.stx$/,""),L=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),F=null,H=[x1.resolve(x1.dirname(Z),`${B}.stx`),x1.resolve(x1.dirname(Z),B),x1.resolve(X.componentsDir||"components",`${B}.stx`),x1.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(O,F),G.set(O.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(_,""),K.lastIndex=0}return J}async function Mq($,Y,Z,X,Q){let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents,q=/@component\s*\(/g,_;while((_=q.exec(J))!==null){let U=_.index,W=U+_[0].length-1,B=1,j=W+1;while(j<J.length&&B>0){if(J[j]==="(")B++;else if(J[j]===")"){if(B--,B===0)break}j++}if(B!==0)break;let z=J.substring(W+1,j),O=j+1,L=z.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],H,V=z.slice(L[0].length),N=V.match(/^\s*,\s*/);if(N)H=V.slice(N[0].length).trim();let R={};if(H)try{R=H0(H,Y)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,O),`[Error parsing component props: ${D}]`);continue}let A="",w=O,I=J.substring(O).match(/^([\s\S]*?)@endcomponent/);if(I)A=I[1].trim(),w=O+I[0].length;let M=await _1(F,R,A,G,Y,Z,X,K,Q);J=J.substring(0,U)+M+J.substring(w),q.lastIndex=0}return J}async function Iq($,Y,Z,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents;return J=await W(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await W(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await W(J,/[a-z][a-z0-9]*/,!1,Nq),J;async function W(B,j,z,O){if(!B)return B;let L=B,F=s8(L,j,O);for(let H=F.length-1;H>=0;H--){let V=F[H],N=z?o8(V.tagName):V.tagName,R=wq(V.attributes),A=Aq(R,Y,X),w=f0.getBuiltin(V.tagName);if(w){let E={context:Y,filePath:Z,options:X,dependencies:Q},D=w.render(A,V.content,E);if(Object.keys(A.clientReactive).length>0)D=t8(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=Object.entries(A.events).map(([y,S])=>`${y}="${S.replace(/"/g,"&quot;")}"`).join(" ");D=D.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}L=L.substring(0,V.startIndex)+D+L.substring(V.endIndex);continue}let T={};for(let[E,D]of Object.entries(A.static))T[E]=D;for(let[E,D]of Object.entries(A.serverDynamic))T[E]=D;let M=await _1(N,T,V.content,G,Y,Z,X,K,Q);if(Object.keys(A.clientReactive).length>0)M=t8(M,A.clientReactive);if(Object.keys(A.events).length>0){let E=M.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(E){let D=Object.entries(A.events).map(([y,S])=>`${y}="${S}"`).join(" "),P=E[1].length+E[2].length;M=M.substring(0,P)+" "+D+M.substring(P)}}L=L.substring(0,V.startIndex)+M+L.substring(V.endIndex)}return L}}function t8($,Y){let Z=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Z)return $;let X=Object.entries(Y).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Z[1].length+Z[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function J7($,Y,Z,X,Q){if(!a8)i8(),a8=!0;let J=await Tq($,Y,Z,X,Q);J=await Mq(J,Y,Z,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await Iq(J,Y,Z,X,Q),J===K)break}return J}var a8=!1,Nq;var e8=b(()=>{h4();n8();r8();V0();N0();Nq=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"])});import f1 from"path";function $Y($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function YY($,Y,Z){try{let X;if($.startsWith("/")){let Q=Y;for(let J=0;J<5;J++){let G=f1.join(Q,$);if(e("fs").existsSync(G))return G;Q=f1.dirname(Q)}X=f1.join(Y,$)}else if($.startsWith("./")||$.startsWith("../"))X=f1.resolve(Y,$);else X=f1.resolve(Y,$);if(e("fs").existsSync(X))return X;return null}catch{return null}}async function ZY($,Y,Z){let X=$,Q=f1.dirname(Y),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[_,U,W,B]=G;if($Y(W))continue;let j=YY(W,Q,Y);if(j)try{let z=await Bun.file(j).text();if(Z.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let L=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:v0()});if(L.outputs.length>0)z=await L.outputs[0].text()}let O=`<script>
7921
+ </style>`}}});async function Rq($){if(B5.has($))return B5.get($);try{let Y=e.resolve(`@iconify/json/json/${$}.json`),Z=await Bun.file(Y).json();return B5.set($,Z.icons),Z.icons}catch{try{let Z=`${process.cwd()}/node_modules/@iconify/json/json/${$}.json`,X=Bun.file(Z);if(await X.exists()){let Q=await X.json();return B5.set($,Q.icons),Q.icons}}catch{}}return null}function v1($,Y){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);if($.static[Y]!==void 0)return String($.static[Y]);if($.clientReactive[Y]!==void 0)return $.clientReactive[Y];return}var B5,Z7;var X7=S(()=>{B5=new Map;Z7={name:"Icon",aliases:["icon","stx-icon"],render($,Y,Z){let X=v1($,"name")??v1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let H=X.split(":");Q=H[0],J=H[1]}let G=v1($,"size")||"24",K=v1($,"color")||"currentColor",q=v1($,"class")||"",_=v1($,"style")||"",U=B5.get(Q);if(!U)return Rq(Q),`<!-- Icon: collection "${Q}" not loaded -->`;let W=U[J];if(!W)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=W.width||24,j=W.height||24,z=`0 0 ${B} ${j}`,O=W.body;if(K!=="currentColor")O=O.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=_?` style="${_}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${z}" fill="none"${L}${F}>${O}</svg>`}}});function i8(){f0.registerBuiltin(d4),f0.registerBuiltin(c4),f0.registerBuiltin(o4),f0.registerBuiltin(r4),f0.registerBuiltin(t4),f0.registerBuiltin($7),f0.registerBuiltin(Z7)}var n8=S(()=>{m4();i4();s4();a4();e4();Y7();X7();h4();m4();i4();s4();a4();e4();Y7();X7()});function o8($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function s8($,Y,Z){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Y.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Z&&Z.has(q.toLowerCase())){let O=J+1+q.length;while(O<$.length&&$[O]!==">")O++;Q=O+1;continue}let _=J+1+q.length,U=null,W=_,B=-1,j=!1;while(_<$.length){let O=$[_];if(U){if(O==="\\"&&_+1<$.length){_+=2;continue}if(O===U)U=null;_++;continue}if(O==='"'||O==="'"){U=O,_++;continue}if(O==="/"&&_+1<$.length&&$[_+1]===">"){B=_+2,j=!0;break}if(O===">"){B=_+1;break}_++}if(B===-1){Q=J+1;continue}let z=$.slice(W,j?B-2:B-1).trim();if(j)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:z,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let O=`<${q}`,L=`</${q}>`,F=1,H=B,V=-1;while(F>0&&H<$.length){let A=$.indexOf(O,H),w=$.indexOf(L,H);if(w===-1)break;if(A!==-1&&A<w){let T=$[A+O.length];if(T===" "||T===">"||T==="/"||T===`
7922
+ `||T==="\t")F++;H=A+O.length}else{if(F--,F===0){V=w;break}H=w+L.length}}if(V===-1){Q=B;continue}let N=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:z,content:N,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}var r8=S(()=>{N0();V0()});import x1 from"path";function Aq($,Y,Z){let X={static:{},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=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let _=J(q.slice(6));try{let U=K.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");X.serverDynamic[_]=JSON.parse(U)}catch(U){if(Z.debug)console.error(`Error parsing __stx_${_}:`,U);X.serverDynamic[_]=K}continue}if(q.startsWith(":")){let _=J(q.slice(1)),U=K==="true"?_:K;try{if(!t(U)){if(Z.debug)console.error(`Unsafe expression in :${_} binding: ${U}`);X.clientReactive[_]=U;continue}let W=Object.keys(Y),j=$0(U,W)(...Object.values(Y));if(j===void 0){let z=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(z.some((F)=>!O.has(F)&&!W.includes(F))){X.clientReactive[_]=U;continue}}X.serverDynamic[_]=j}catch{X.clientReactive[_]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let _=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(_)try{let U=_[1];if(t(U)){let B=$0(U,Object.keys(Y))(...Object.values(Y));X.static[q]=B!=null?String(B):""}else{if(Z.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Z.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,W=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=W.exec(K))!==null)try{let j=B[1];if(!t(j)){if(Z.debug)console.error(`Unsafe expression in ${q}: ${j}`);continue}let O=$0(j,Object.keys(Y))(...Object.values(Y));U=U.replace(B[0],String(O??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${q}:`,j)}X.static[q]=U}continue}X.static[q]=K}return X}function wq($){let Y={},Z=0,X=$.length;while(Z<X){while(Z<X&&/\s/.test($[Z]))Z++;if(Z>=X)break;let Q="";while(Z<X&&!/[\s=]/.test($[Z]))Q+=$[Z],Z++;if(!Q)break;while(Z<X&&/\s/.test($[Z]))Z++;if(Z<X&&$[Z]==="="){Z++;while(Z<X&&/\s/.test($[Z]))Z++;let J="";if(Z<X&&($[Z]==='"'||$[Z]==="'")){let G=$[Z];Z++;while(Z<X){let K=$[Z];if(K==="\\"&&Z+1<X){Z++,J+=$[Z],Z++;continue}if(K===G){Z++;break}J+=K,Z++}}else while(Z<X&&!/\s/.test($[Z]))J+=$[Z],Z++;Y[Q]=J}else Y[Q]="true"}return Y}async function Tq($,Y,Z,X,Q){let J=$;if(!Y.__importedComponents)Y.__importedComponents=new Map;let G=Y.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[_,U]=q,W=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of W){let j=B.split("/"),O=j[j.length-1].replace(/\.stx$/,""),L=O.includes("-")?O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):O.charAt(0).toUpperCase()+O.slice(1),F=null,H=[x1.resolve(x1.dirname(Z),`${B}.stx`),x1.resolve(x1.dirname(Z),B),x1.resolve(X.componentsDir||"components",`${B}.stx`),x1.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of H)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(O,F),G.set(O.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(_,""),K.lastIndex=0}return J}async function Mq($,Y,Z,X,Q){let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents,q=/@component\s*\(/g,_;while((_=q.exec(J))!==null){let U=_.index,W=U+_[0].length-1,B=1,j=W+1;while(j<J.length&&B>0){if(J[j]==="(")B++;else if(J[j]===")"){if(B--,B===0)break}j++}if(B!==0)break;let z=J.substring(W+1,j),O=j+1,L=z.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],H,V=z.slice(L[0].length),N=V.match(/^\s*,\s*/);if(N)H=V.slice(N[0].length).trim();let R={};if(H)try{R=H0(H,Y)}catch(M){let E=M instanceof Error?M.message:String(M);J=J.replace(J.substring(U,O),`[Error parsing component props: ${E}]`);continue}let A="",w=O,D=J.substring(O).match(/^([\s\S]*?)@endcomponent/);if(D)A=D[1].trim(),w=O+D[0].length;let I=await _1(F,R,A,G,Y,Z,X,K,Q);J=J.substring(0,U)+I+J.substring(w),q.lastIndex=0}return J}async function Iq($,Y,Z,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Y.__processedComponents)Y.__processedComponents=new Set;let K=Y.__processedComponents;return J=await W(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await W(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await W(J,/[a-z][a-z0-9]*/,!1,Nq),J;async function W(B,j,z,O){if(!B)return B;let L=B,F=s8(L,j,O);for(let H=F.length-1;H>=0;H--){let V=F[H],N=z?o8(V.tagName):V.tagName,R=wq(V.attributes),A=Aq(R,Y,X),w=f0.getBuiltin(V.tagName);if(w){let M={context:Y,filePath:Z,options:X,dependencies:Q},E=w.render(A,V.content,M);if(Object.keys(A.clientReactive).length>0)E=t8(E,A.clientReactive);if(Object.keys(A.events).length>0){let C=Object.entries(A.events).map(([P,k])=>`${P}="${k.replace(/"/g,"&quot;")}"`).join(" ");E=E.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${C}`)}L=L.substring(0,V.startIndex)+E+L.substring(V.endIndex);continue}let T={};for(let[M,E]of Object.entries(A.static))T[M]=E;for(let[M,E]of Object.entries(A.serverDynamic))T[M]=E;let I=await _1(N,T,V.content,G,Y,Z,X,K,Q);if(Object.keys(A.clientReactive).length>0)I=t8(I,A.clientReactive);if(Object.keys(A.events).length>0){let M=I.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(M){let E=Object.entries(A.events).map(([P,k])=>`${P}="${k}"`).join(" "),C=M[1].length+M[2].length;I=I.substring(0,C)+" "+E+I.substring(C)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function t8($,Y){let Z=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Z)return $;let X=Object.entries(Y).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Z[1].length+Z[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function J7($,Y,Z,X,Q){if(!a8)i8(),a8=!0;let J=await Tq($,Y,Z,X,Q);J=await Mq(J,Y,Z,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await Iq(J,Y,Z,X,Q),J===K)break}return J}var a8=!1,Nq;var e8=S(()=>{h4();n8();r8();V0();N0();Nq=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"])});import f1 from"path";function $Y($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function YY($,Y,Z){try{let X;if($.startsWith("/")){let Q=Y;for(let J=0;J<5;J++){let G=f1.join(Q,$);if(e("fs").existsSync(G))return G;Q=f1.dirname(Q)}X=f1.join(Y,$)}else if($.startsWith("./")||$.startsWith("../"))X=f1.resolve(Y,$);else X=f1.resolve(Y,$);if(e("fs").existsSync(X))return X;return null}catch{return null}}async function ZY($,Y,Z){let X=$,Q=f1.dirname(Y),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[_,U,W,B]=G;if($Y(W))continue;let j=YY(W,Q,Y);if(j)try{let z=await Bun.file(j).text();if(Z.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let L=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:v0()});if(L.outputs.length>0)z=await L.outputs[0].text()}let O=`<script>
7923
7923
  // Source: ${W}
7924
7924
  ${z}
7925
7925
  </script>`;X=X.replace(_,O),J.lastIndex=0}catch(z){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[_,U,W,B]=q,j=U+B;if($Y(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let O=YY(W,Q,Y);if(O)try{let L=await Bun.file(O).text();Z.add(O);let F=`<style>
7926
7926
  /* Source: ${W} */
7927
7927
  ${L}
7928
- </style>`;X=X.replace(_,F),K.lastIndex=0}catch(L){}}}return X}var XY=b(()=>{w1()});function S9($,Y){let Z=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Z))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,_=null,U=!1;while(q<Z.length&&K>0){let V=Z[q];if(U){U=!1,q++;continue}if(V==="\\"&&_){U=!0,q++;continue}if(_){if(V===_)_=null;q++;continue}if(V==='"'||V==="'"||V==="`"){_=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let W=Z.substring(G+1,q).trim(),B=Z.substring(J,q+1),j=-1,z=0,O=null,L=!1;for(let V=0;V<W.length;V++){let N=W[V];if(L){L=!1;continue}if(N==="\\"&&O){L=!0;continue}if(O){if(N===O)O=null;continue}if(N==='"'||N==="'"||N==="`"){O=N;continue}if(N==="("||N==="["||N==="{")z++;else if(N===")"||N==="]"||N==="}")z--;if(N===","&&z===0){j=V;break}}let F=j>=0?W.substring(0,j).trim():W,H=j>=0?W.substring(j+1).trim():void 0;try{let V=F.trim(),N;if(t(V))N=$0(V,Object.keys(Y))(...Object.values(Y));else N=void 0;let R;if(H==="true")R=JSON.stringify(N,null,2);else R=JSON.stringify(N);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,J)+A+Z.substring(q+1),X.lastIndex=J+A.length}catch(V){C0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Z}function y9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function JY($){let Y=$,Z=/@memo\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.slice(G,q-1).trim(),U=q,W=Y.slice(U),B=W.indexOf("@endmemo");if(B===-1)continue;let j=W.slice(0,B),z=U+B+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),L=O?O[0].length:0,F=j.slice(L),H=j.match(/(\s*)$/),V=H?H[0].length:0,N=F.slice(0,F.length-V),R=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[w,T,I="",M]=R,E=`<${T}${I} data-stx-memo="${_}"${M}>`;A=j.slice(0,L)+E+N.slice(w.length)+j.slice(L+N.length)}else A=`${j.slice(0,L)}<div data-stx-memo="${_}">${N}</div>${j.slice(L+N.length)}`;Q.push({start:J,end:z,replacement:A}),Z.lastIndex=z}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Y=Y.slice(0,G.start)+G.replacement+Y.slice(G.end)}return Y.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Q7($){let Y=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Y=Y.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Y}function QY($){let Z=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=Z.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,_=!1,U=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(_){if(O==='"')_=!1}else if(O==="'")q=!0;else if(O==='"')_=!0;else if(O===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),j=B.indexOf("</"),z=j>=0?B.slice(0,j):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(z))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}var G7=b(()=>{c0();N0()});function P9($,Y,Z){let X=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Eq){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let U=$.split(`
7928
+ </style>`;X=X.replace(_,F),K.lastIndex=0}catch(L){}}}return X}var XY=S(()=>{w1()});function S9($,Y){let Z=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Z))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,_=null,U=!1;while(q<Z.length&&K>0){let V=Z[q];if(U){U=!1,q++;continue}if(V==="\\"&&_){U=!0,q++;continue}if(_){if(V===_)_=null;q++;continue}if(V==='"'||V==="'"||V==="`"){_=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let W=Z.substring(G+1,q).trim(),B=Z.substring(J,q+1),j=-1,z=0,O=null,L=!1;for(let V=0;V<W.length;V++){let N=W[V];if(L){L=!1;continue}if(N==="\\"&&O){L=!0;continue}if(O){if(N===O)O=null;continue}if(N==='"'||N==="'"||N==="`"){O=N;continue}if(N==="("||N==="["||N==="{")z++;else if(N===")"||N==="]"||N==="}")z--;if(N===","&&z===0){j=V;break}}let F=j>=0?W.substring(0,j).trim():W,H=j>=0?W.substring(j+1).trim():void 0;try{let V=F.trim(),N;if(t(V))N=$0(V,Object.keys(Y))(...Object.values(Y));else N=void 0;let R;if(H==="true")R=JSON.stringify(N,null,2);else R=JSON.stringify(N);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,J)+A+Z.substring(q+1),X.lastIndex=J+A.length}catch(V){C0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Z}function y9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function JY($){let Y=$,Z=/@memo\s*\(/g,X,Q=[];while((X=Z.exec(Y))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Y.length&&K>0){if(Y[q]==="(")K++;else if(Y[q]===")")K--;q++}if(K!==0)continue;let _=Y.slice(G,q-1).trim(),U=q,W=Y.slice(U),B=W.indexOf("@endmemo");if(B===-1)continue;let j=W.slice(0,B),z=U+B+8,O=j.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)/),L=O?O[0].length:0,F=j.slice(L),H=j.match(/(\s*)$/),V=H?H[0].length:0,N=F.slice(0,F.length-V),R=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[w,T,D="",I]=R,M=`<${T}${D} data-stx-memo="${_}"${I}>`;A=j.slice(0,L)+M+N.slice(w.length)+j.slice(L+N.length)}else A=`${j.slice(0,L)}<div data-stx-memo="${_}">${N}</div>${j.slice(L+N.length)}`;Q.push({start:J,end:z,replacement:A}),Z.lastIndex=z}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Y=Y.slice(0,G.start)+G.replacement+Y.slice(G.end)}return Y.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Q7($){let Y=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Y=Y.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Y}function QY($){let Z=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=Z.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,_=!1,U=-1;while(K<$.length){let O=$[K];if(q){if(O==="'")q=!1}else if(_){if(O==='"')_=!1}else if(O==="'")q=!0;else if(O==='"')_=!0;else if(O===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),j=B.indexOf("</"),z=j>=0?B.slice(0,j):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(z))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}var G7=S(()=>{c0();N0()});function P9($,Y,Z){let X=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Eq){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let _=$.match(G);if(_&&_.length>0){let U=$.split(`
7929
7929
  `),W=[];U.forEach((j,z)=>{if(G.lastIndex=0,G.test(j))W.push(z+1)});let B=W.length>0?` (line${W.length>1?"s":""}: ${W.join(", ")})`:"";J.push(` \u2717 ${K}${B}
7930
7930
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Y.split("/").pop()||Y}:
7931
7931
  ${J.join(`
7932
7932
  `)}
7933
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Eq;var K7=b(()=>{Eq=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var GY={};s(GY,{getStoreScript:()=>Dq,clearStoreCache:()=>kq});import C9 from"path";async function Dq($){let Y;if($)Y=C9.resolve($);else{let U=await q9();Y=C9.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Z=g1.get(Y);if(Z!==void 0)return Z||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Y,absolute:!0})){let W=C9.basename(U,".ts");if(["index","types"].includes(W))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return g1.set(Y,""),null}if(Q.length===0)return g1.set(Y,""),null;let J=[];for(let U of Q){let W=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(W)})}J.sort((U,W)=>{if(U.hasUseStore===W.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:v0()});for(let U of G)try{let W=await Bun.file(U).text(),B=C9.basename(U,".ts");W=W.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),W=W.replace(/^export\s+(default\s+)?/gm,""),W=q.transformSync(W),K.push(`// Store: ${B}
7933
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Eq;var K7=S(()=>{Eq=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var GY={};r(GY,{getStoreScript:()=>Dq,clearStoreCache:()=>kq});import C9 from"path";async function Dq($){let Y;if($)Y=C9.resolve($);else{let U=await q9();Y=C9.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Z=g1.get(Y);if(Z!==void 0)return Z||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Y,absolute:!0})){let W=C9.basename(U,".ts");if(["index","types"].includes(W))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return g1.set(Y,""),null}if(Q.length===0)return g1.set(Y,""),null;let J=[];for(let U of Q){let W=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(W)})}J.sort((U,W)=>{if(U.hasUseStore===W.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:v0()});for(let U of G)try{let W=await Bun.file(U).text(),B=C9.basename(U,".ts");W=W.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),W=W.replace(/^export\s+(default\s+)?/gm,""),W=q.transformSync(W),K.push(`// Store: ${B}
7934
7934
  ${W.trim()}`)}catch(W){console.warn(`[stx] Failed to load store ${U}:`,W)}if(K.length===0)return g1.set(Y,""),null;let _=`;(function(){
7935
7935
  ${K.join(`
7936
7936
 
7937
7937
  `)}
7938
- })();`;return g1.set(Y,_),_}function kq(){g1.clear()}var g1;var KY=b(()=>{U9();w1();g1=new Map});var UY={};s(UY,{processDeferDirectives:()=>Cq});function bq(){return`stx-defer-${++qY}`}function Sq($){let Y=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Y)return{trigger:Y[1],value:Y[2]};return{trigger:"immediate"}}function yq($,Y,Z){let{trigger:X,value:Q}=Sq(Y),J=Z,G,K,q,_=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)G=_[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let W=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(W)q=W[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function Pq($,Y){let{trigger:Z,triggerValue:X}=Y,Q;switch(Z){case"visible":Q=`
7938
+ })();`;return g1.set(Y,_),_}function kq(){g1.clear()}var g1;var KY=S(()=>{U9();w1();g1=new Map});var UY={};r(UY,{processDeferDirectives:()=>Cq});function bq(){return`stx-defer-${++qY}`}function Sq($){let Y=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Y)return{trigger:Y[1],value:Y[2]};return{trigger:"immediate"}}function yq($,Y,Z){let{trigger:X,value:Q}=Sq(Y),J=Z,G,K,q,_=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)G=_[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let W=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(W)q=W[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function Pq($,Y){let{trigger:Z,triggerValue:X}=Y,Q;switch(Z){case"visible":Q=`
7939
7939
  const observer = new IntersectionObserver((entries) => {
7940
7940
  if (entries[0].isIntersecting) {
7941
7941
  observer.disconnect();
@@ -8016,7 +8016,7 @@ else {
8016
8016
  ${W}
8017
8017
  </div>
8018
8018
  ${j}
8019
- `})}var qY=0;var WY={};s(WY,{processTeleportDirectives:()=>gq,ensureTeleportTargets:()=>hq});function vq(){return`stx-teleport-${++_Y}`}function xq($){let Y=$.split(",").map((Q)=>Q.trim()),Z=Y[0].replace(/['"]/g,""),X;for(let Q=1;Q<Y.length;Q++){let J=Y[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Z,disabled:X}}function fq($,Y){return`
8019
+ `})}var qY=0;var WY={};r(WY,{processTeleportDirectives:()=>gq,ensureTeleportTargets:()=>hq});function vq(){return`stx-teleport-${++_Y}`}function xq($){let Y=$.split(",").map((Q)=>Q.trim()),Z=Y[0].replace(/['"]/g,""),X;for(let Q=1;Q<Y.length;Q++){let J=Y[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Z,disabled:X}}function fq($,Y){return`
8020
8020
  <script>
8021
8021
  (function() {
8022
8022
  const source = document.getElementById('${$}');
@@ -8074,7 +8074,7 @@ else {
8074
8074
  });
8075
8075
  })();
8076
8076
  </script>
8077
- `}var _Y=0;var OY={};s(OY,{processTransitionDirectives:()=>lq,processTransitionAttributes:()=>nq,performLeave:()=>uq,performEnter:()=>mq,generateTransitionRuntime:()=>iq,generateTransitionCSS:()=>cq});function BY($,Y={}){return{enterFrom:Y.enterClass||`${$}-enter-from`,enterActive:Y.enterActiveClass||`${$}-enter-active`,enterTo:Y.enterToClass||`${$}-enter-to`,leaveFrom:Y.leaveClass||`${$}-leave-from`,leaveActive:Y.leaveActiveClass||`${$}-leave-active`,leaveTo:Y.leaveToClass||`${$}-leave-to`}}function dq($){let Y=getComputedStyle($),Z=Y.transitionDuration||"0s",X=Y.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Z),Q(X))}function zY($,Y){return new Promise((Z)=>{let X=Y??dq($);if(X===0){Z();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Z()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function jY($){$.offsetHeight}async function mq($,Y={}){let Z=Y.name||"stx",X=BY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.enter:Y.duration;if(Y.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),jY($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Y.onEnter)await new Promise((J)=>{Y.onEnter($,J)});else await zY($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Y.onAfterEnter?.($)}async function uq($,Y={}){let Z=Y.name||"stx",X=BY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.leave:Y.duration;if(Y.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),jY($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Y.onLeave)await new Promise((J)=>{Y.onLeave($,J)});else await zY($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Y.onAfterLeave?.($)}function lq($,Y={},Z){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=pq(J),q=K.name||"stx",_=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8077
+ `}var _Y=0;var OY={};r(OY,{processTransitionDirectives:()=>lq,processTransitionAttributes:()=>nq,performLeave:()=>uq,performEnter:()=>mq,generateTransitionRuntime:()=>iq,generateTransitionCSS:()=>cq});function BY($,Y={}){return{enterFrom:Y.enterClass||`${$}-enter-from`,enterActive:Y.enterActiveClass||`${$}-enter-active`,enterTo:Y.enterToClass||`${$}-enter-to`,leaveFrom:Y.leaveClass||`${$}-leave-from`,leaveActive:Y.leaveActiveClass||`${$}-leave-active`,leaveTo:Y.leaveToClass||`${$}-leave-to`}}function dq($){let Y=getComputedStyle($),Z=Y.transitionDuration||"0s",X=Y.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Z),Q(X))}function zY($,Y){return new Promise((Z)=>{let X=Y??dq($);if(X===0){Z();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Z()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function jY($){$.offsetHeight}async function mq($,Y={}){let Z=Y.name||"stx",X=BY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.enter:Y.duration;if(Y.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),jY($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Y.onEnter)await new Promise((J)=>{Y.onEnter($,J)});else await zY($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Y.onAfterEnter?.($)}async function uq($,Y={}){let Z=Y.name||"stx",X=BY(Z,Y),Q=typeof Y.duration==="object"?Y.duration.leave:Y.duration;if(Y.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),jY($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Y.onLeave)await new Promise((J)=>{Y.onLeave($,J)});else await zY($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Y.onAfterLeave?.($)}function lq($,Y={},Z){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=pq(J),q=K.name||"stx",_=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8078
8078
  <div
8079
8079
  class="stx-transition-wrapper"
8080
8080
  data-transition="${q}"
@@ -8392,7 +8392,7 @@ else {
8392
8392
 
8393
8393
  console.log('[stx] Transition runtime initialized');
8394
8394
  })();
8395
- `}function nq($){let Y=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Y,(Z,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var LY={};s(LY,{withErrorBoundary:()=>HY,processErrorBoundaryDirectives:()=>rq,generateErrorBoundaryRuntime:()=>YU,generateErrorBoundaryCSS:()=>$U,createErrorBoundary:()=>eq});function sq(){return`eb-${++oq}-${Date.now().toString(36)}`}function rq($,Y={},Z){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=sq(),_=aq(J||"");return tq(q,G.trim(),K.trim(),_)})}function aq($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Y.id=J;break;case"logErrors":Y.logErrors=J==="true";break}}return Y}function tq($,Y,Z,X){let Q=X.logErrors!==!1;return`
8395
+ `}function nq($){let Y=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Y,(Z,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var LY={};r(LY,{withErrorBoundary:()=>HY,processErrorBoundaryDirectives:()=>rq,generateErrorBoundaryRuntime:()=>YU,generateErrorBoundaryCSS:()=>$U,createErrorBoundary:()=>eq});function sq(){return`eb-${++oq}-${Date.now().toString(36)}`}function rq($,Y={},Z){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=sq(),_=aq(J||"");return tq(q,G.trim(),K.trim(),_)})}function aq($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Y.id=J;break;case"logErrors":Y.logErrors=J==="true";break}}return Y}function tq($,Y,Z,X){let Q=X.logErrors!==!1;return`
8396
8396
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
8397
8397
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
8398
8398
  ${Y}
@@ -8621,7 +8621,7 @@ else {
8621
8621
 
8622
8622
  console.log('[stx] Error boundary runtime initialized');
8623
8623
  })();
8624
- `}var oq=0;var FY={};s(FY,{renderSSRSuspense:()=>qU,processSuspenseDirectives:()=>JU,generateSuspenseRuntime:()=>_U,generateSuspenseCSS:()=>UU,createSSRSuspense:()=>KU});function XU(){return`suspense-${++ZU}-${Date.now().toString(36)}`}function JU($,Y={},Z){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=XU(),_=QU(J||"");return GU(q,G.trim(),K.trim(),_)})}function QU($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Y.id=J;break;case"timeout":Y.timeout=G?parseInt(G,10):void 0;break}}return Y}function GU($,Y,Z,X){let Q=X.timeout||30000,J=X.id||$;return`
8624
+ `}var oq=0;var FY={};r(FY,{renderSSRSuspense:()=>qU,processSuspenseDirectives:()=>JU,generateSuspenseRuntime:()=>_U,generateSuspenseCSS:()=>UU,createSSRSuspense:()=>KU});function XU(){return`suspense-${++ZU}-${Date.now().toString(36)}`}function JU($,Y={},Z){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=XU(),_=QU(J||"");return GU(q,G.trim(),K.trim(),_)})}function QU($){let Y={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Y.id=J;break;case"timeout":Y.timeout=G?parseInt(G,10):void 0;break}}return Y}function GU($,Y,Z,X){let Q=X.timeout||30000,J=X.id||$;return`
8625
8625
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
8626
8626
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
8627
8627
  ${Z}
@@ -8959,7 +8959,7 @@ else {
8959
8959
 
8960
8960
  console.log('[stx] Suspense runtime initialized');
8961
8961
  })();
8962
- `}var ZU=0;var AY={};s(AY,{processAsyncDirectives:()=>BU,isAsyncComponent:()=>jU,generateAsyncComponentRuntime:()=>HU,generateAsyncComponentCSS:()=>OU,defineAsyncComponent:()=>zU});function VY(){return`async-${++WU}-${Date.now().toString(36)}`}function BU($,Y={},Z){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,_)=>{let U=VY(),W=RY(K);return NY(U,W,q.trim(),_.trim())}),J=J.replace(Q,(G,K,q)=>{let _=VY(),U=RY(K);return NY(_,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function RY($){let Y={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Y.component=J||K||"";break;case"timeout":Y.timeout=G?parseInt(G,10):30000;break;case"delay":Y.delay=G?parseInt(G,10):200;break;case"suspensible":Y.suspensible=K==="true";break;case"retries":Y.retries=G?parseInt(G,10):0;break;case"loadingComponent":Y.loadingComponent=J||K;break;case"errorComponent":Y.errorComponent=J||K;break}}return Y}function NY($,Y,Z,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Y;return`
8962
+ `}var ZU=0;var AY={};r(AY,{processAsyncDirectives:()=>BU,isAsyncComponent:()=>jU,generateAsyncComponentRuntime:()=>HU,generateAsyncComponentCSS:()=>OU,defineAsyncComponent:()=>zU});function VY(){return`async-${++WU}-${Date.now().toString(36)}`}function BU($,Y={},Z){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,_)=>{let U=VY(),W=RY(K);return NY(U,W,q.trim(),_.trim())}),J=J.replace(Q,(G,K,q)=>{let _=VY(),U=RY(K);return NY(_,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function RY($){let Y={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Y.component=J||K||"";break;case"timeout":Y.timeout=G?parseInt(G,10):30000;break;case"delay":Y.delay=G?parseInt(G,10):200;break;case"suspensible":Y.suspensible=K==="true";break;case"retries":Y.retries=G?parseInt(G,10):0;break;case"loadingComponent":Y.loadingComponent=J||K;break;case"errorComponent":Y.errorComponent=J||K;break}}return Y}function NY($,Y,Z,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Y;return`
8963
8963
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
8964
8964
  <div class="stx-async-loading" data-async-loading="${$}">
8965
8965
  ${Z}
@@ -9272,7 +9272,7 @@ catch (error) {
9272
9272
 
9273
9273
  console.log('[stx] Async component runtime initialized');
9274
9274
  })();
9275
- `}var WU=0;var TY={};s(TY,{shouldCacheComponent:()=>AU,processKeepAliveDirectives:()=>FU,onDeactivated:()=>IU,onActivated:()=>MU,generateKeepAliveRuntime:()=>TU,generateKeepAliveCSS:()=>wU,createKeepAliveCache:()=>NU});function wY(){return`keep-alive-${++LU}-${Date.now().toString(36)}`}function FU($,Y={},Z){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=wY(),q=VU(J||"");return RU(K,G.trim(),q)})}function VU($){let Y={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Y.max=G?parseInt(G,10):10;break;case"include":Y.include=J;break;case"exclude":Y.exclude=J;break;case"id":Y.id=J;break}}return Y}function RU($,Y,Z){let{max:X,include:Q,exclude:J}=Z,G=Z.id||$;return`
9275
+ `}var WU=0;var TY={};r(TY,{shouldCacheComponent:()=>AU,processKeepAliveDirectives:()=>FU,onDeactivated:()=>IU,onActivated:()=>MU,generateKeepAliveRuntime:()=>TU,generateKeepAliveCSS:()=>wU,createKeepAliveCache:()=>NU});function wY(){return`keep-alive-${++LU}-${Date.now().toString(36)}`}function FU($,Y={},Z){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=wY(),q=VU(J||"");return RU(K,G.trim(),q)})}function VU($){let Y={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Z.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Y.max=G?parseInt(G,10):10;break;case"include":Y.include=J;break;case"exclude":Y.exclude=J;break;case"id":Y.id=J;break}}return Y}function RU($,Y,Z){let{max:X,include:Q,exclude:J}=Z,G=Z.id||$;return`
9276
9276
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
9277
9277
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
9278
9278
  ${Y}
@@ -9620,7 +9620,7 @@ else {
9620
9620
 
9621
9621
  console.log('[stx] Keep-alive runtime initialized');
9622
9622
  })();
9623
- `}function MU($){if(typeof document<"u")document.addEventListener("stx:activated",(Y)=>{$(Y.detail)})}function IU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Y)=>{$(Y.detail)})}var LU=0;var kY={};s(kY,{useVirtualList:()=>IY,processVirtualListDirectives:()=>U7,processVirtualGridDirectives:()=>DY,processInfiniteListDirectives:()=>EY,generateVirtualListCSS:()=>MY,default:()=>EU,createVirtualList:()=>q7});function q7($,Y){let{itemHeight:Z,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Z,direction:q="vertical"}=Y,_=[...$],U=0,W=new Map;function B(){if(G)return j();let A=Math.max(0,Math.floor(U/Z)-Q),w=Math.ceil(X/Z),T=Math.min(_.length-1,A+w+Q*2);return{startIndex:A,endIndex:T}}function j(){let A=0,w=0,T=_.length-1;for(let I=0;I<_.length;I++){let M=W.get(I)||K;if(A+M>U){w=Math.max(0,I-Q);break}A+=M}A=0;for(let I=0;I<_.length;I++){let M=W.get(I)||K;if(A+=M,A>U+X){T=Math.min(_.length-1,I+Q);break}}return{startIndex:w,endIndex:T}}function z(){if(G){let A=0;for(let w=0;w<_.length;w++)A+=W.get(w)||K;return A}return _.length*Z}function O(A){if(G){let w=0;for(let T=0;T<A;T++)w+=W.get(T)||K;return w}return A*Z}function L(){let{startIndex:A,endIndex:w}=B();return{startIndex:A,endIndex:w,scrollTop:U,totalHeight:z(),visibleItems:_.slice(A,w+1),itemHeights:new Map(W)}}function F(A,w="auto"){let T=O(A);H(T,w)}function H(A,w="auto"){U=Math.max(0,Math.min(A,z()-X))}function V(){B()}function N(A){_=[...A],W.clear(),V()}function R(){_=[],W.clear()}return{scrollToIndex:F,scrollToOffset:H,getState:L,refresh:V,setItems:N,destroy:R}}function U7($,Y={},Z){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();U={...U,...V}}catch{}let W=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),j=U.overscan||3,z=0,O=Math.min(_.length-1,B+j),L="";for(let H=z;H<=O&&H<_.length;H++){let V=_[H],N=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(H));L+=`
9623
+ `}function MU($){if(typeof document<"u")document.addEventListener("stx:activated",(Y)=>{$(Y.detail)})}function IU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Y)=>{$(Y.detail)})}var LU=0;var kY={};r(kY,{useVirtualList:()=>IY,processVirtualListDirectives:()=>U7,processVirtualGridDirectives:()=>DY,processInfiniteListDirectives:()=>EY,generateVirtualListCSS:()=>MY,default:()=>EU,createVirtualList:()=>q7});function q7($,Y){let{itemHeight:Z,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Z,direction:q="vertical"}=Y,_=[...$],U=0,W=new Map;function B(){if(G)return j();let A=Math.max(0,Math.floor(U/Z)-Q),w=Math.ceil(X/Z),T=Math.min(_.length-1,A+w+Q*2);return{startIndex:A,endIndex:T}}function j(){let A=0,w=0,T=_.length-1;for(let D=0;D<_.length;D++){let I=W.get(D)||K;if(A+I>U){w=Math.max(0,D-Q);break}A+=I}A=0;for(let D=0;D<_.length;D++){let I=W.get(D)||K;if(A+=I,A>U+X){T=Math.min(_.length-1,D+Q);break}}return{startIndex:w,endIndex:T}}function z(){if(G){let A=0;for(let w=0;w<_.length;w++)A+=W.get(w)||K;return A}return _.length*Z}function O(A){if(G){let w=0;for(let T=0;T<A;T++)w+=W.get(T)||K;return w}return A*Z}function L(){let{startIndex:A,endIndex:w}=B();return{startIndex:A,endIndex:w,scrollTop:U,totalHeight:z(),visibleItems:_.slice(A,w+1),itemHeights:new Map(W)}}function F(A,w="auto"){let T=O(A);H(T,w)}function H(A,w="auto"){U=Math.max(0,Math.min(A,z()-X))}function V(){B()}function N(A){_=[...A],W.clear(),V()}function R(){_=[],W.clear()}return{scrollToIndex:F,scrollToOffset:H,getState:L,refresh:V,setItems:N,destroy:R}}function U7($,Y={},Z){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let H=G.trim(),V=Function(`return ${H}`)();U={...U,...V}}catch{}let W=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),j=U.overscan||3,z=0,O=Math.min(_.length-1,B+j),L="";for(let H=z;H<=O&&H<_.length;H++){let V=_[H],N=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(H));L+=`
9624
9624
  <div class="virtual-item ${U.itemClass||""}"
9625
9625
  style="position: absolute; top: ${H*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
9626
9626
  data-index="${H}">
@@ -9763,11 +9763,11 @@ else {
9763
9763
  ${q}
9764
9764
  </div>
9765
9765
  </div>
9766
- `})}function DY($,Y={},Z){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let W=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(_.length/U.columns),j=B*(U.rowHeight+(U.gap||0)),z=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),O=U.overscan||2,L=0,F=Math.min(B-1,z+O),H="";for(let V=L;V<=F;V++)for(let N=0;N<U.columns;N++){let R=V*U.columns+N;if(R>=_.length)break;let A=_[R],w=N*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof A==="object"&&A!==null)return String(A[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));H+=`
9766
+ `})}function DY($,Y={},Z){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),_=Y[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let W=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(_.length/U.columns),j=B*(U.rowHeight+(U.gap||0)),z=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),O=U.overscan||2,L=0,F=Math.min(B-1,z+O),H="";for(let V=L;V<=F;V++)for(let N=0;N<U.columns;N++){let R=V*U.columns+N;if(R>=_.length)break;let A=_[R],w=N*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),D=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,M)=>{if(typeof A==="object"&&A!==null)return String(A[M]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));H+=`
9767
9767
  <div class="virtual-grid-item"
9768
9768
  style="position: absolute; top: ${T}px; left: ${w}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
9769
9769
  data-index="${R}">
9770
- ${I}
9770
+ ${D}
9771
9771
  </div>`}return`
9772
9772
  <div id="${W}"
9773
9773
  class="virtual-grid-container"
@@ -9833,7 +9833,7 @@ else {
9833
9833
  });
9834
9834
  })();
9835
9835
  </script>
9836
- `})}var EU;var bY=b(()=>{EU={createVirtualList:q7,processVirtualListDirectives:U7,processInfiniteListDirectives:EY,processVirtualGridDirectives:DY,generateVirtualListCSS:MY,useVirtualList:IY}});function SY(){return`<script data-stx-hydration-runtime>
9836
+ `})}var EU;var bY=S(()=>{EU={createVirtualList:q7,processVirtualListDirectives:U7,processInfiniteListDirectives:EY,processVirtualGridDirectives:DY,generateVirtualListCSS:MY,useVirtualList:IY}});function SY(){return`<script data-stx-hydration-runtime>
9837
9837
  (function() {
9838
9838
  'use strict';
9839
9839
 
@@ -9993,7 +9993,7 @@ else {
9993
9993
  stxIslands.initIslands();
9994
9994
  }
9995
9995
  })();
9996
- </script>`}function yY($){let Y=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Y)return Y[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function PY($,Y){let Z={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Y)Z[J]=Y[G];else Z[J]=G}return Z}var pY={};s(pY,{processStaticDirectives:()=>uY,processPartialHydrationDirectives:()=>vY,onHydrated:()=>mY,isHydrated:()=>dY,hydrateIsland:()=>fY,hydrateByStrategy:()=>gY,hydrateAll:()=>hY,generatePartialHydrationCSS:()=>xY,generateIslandManifest:()=>lY,default:()=>vU,createIslandRegistry:()=>CY});function CY(){let $=new Map;return{islands:$,register(Y){$.set(Y.id,Y)},get(Y){return $.get(Y)},async hydrate(Y){let Z=$.get(Y);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Y,component:Z.component}}))},async hydrateAll(){let Y=Array.from($.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all(Y)}}}function DU($){return`
9996
+ </script>`}function yY($){let Y=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Y)return Y[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function PY($,Y){let Z={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Y)Z[J]=Y[G];else Z[J]=G}return Z}var pY={};r(pY,{processStaticDirectives:()=>uY,processPartialHydrationDirectives:()=>vY,onHydrated:()=>mY,isHydrated:()=>dY,hydrateIsland:()=>fY,hydrateByStrategy:()=>gY,hydrateAll:()=>hY,generatePartialHydrationCSS:()=>xY,generateIslandManifest:()=>lY,default:()=>vU,createIslandRegistry:()=>CY});function CY(){let $=new Map;return{islands:$,register(Y){$.set(Y.id,Y)},get(Y){return $.get(Y)},async hydrate(Y){let Z=$.get(Y);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Y,component:Z.component}}))},async hydrateAll(){let Y=Array.from($.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all(Y)}}}function DU($){return`
9997
9997
  <script data-hydrate="${$}">
9998
9998
  (function() {
9999
9999
  const island = document.querySelector('[data-island="${$}"]');
@@ -10221,7 +10221,7 @@ else {
10221
10221
  <script type="application/json" id="stx-island-manifest">
10222
10222
  ${JSON.stringify(Y)}
10223
10223
  </script>
10224
- `}var vU;var cY=b(()=>{vU={processPartialHydrationDirectives:vY,processStaticDirectives:uY,generatePartialHydrationCSS:xY,generateIslandManifest:lY,createIslandRegistry:CY,hydrateIsland:fY,hydrateByStrategy:gY,hydrateAll:hY,isHydrated:dY,onHydrated:mY}});var ZZ={};s(ZZ,{watchMultiple:()=>rY,watchEffect:()=>aY,watch:()=>sY,unref:()=>iY,toRefs:()=>nY,throttledComputed:()=>YZ,stxWatchMultiple:()=>rY,stxWatchEffect:()=>aY,stxWatch:()=>sY,stxUnref:()=>iY,stxToRefs:()=>nY,stxThrottledComputed:()=>YZ,stxShallowRef:()=>oY,stxRef:()=>d1,stxIsRef:()=>X1,stxDebouncedComputed:()=>$Z,stxComputed:()=>j5,shallowRef:()=>oY,ref:()=>d1,processWatchDirectives:()=>eY,processComputedDirectives:()=>tY,isRef:()=>X1,default:()=>xU,debouncedComputed:()=>$Z,computed:()=>j5});function d1($){let Y=$,Z=new Set,X={get value(){if(h0){let Q=z5.get(X);if(!Q)Q=new Set,z5.set(X,Q);Q.add(h0)}return Y},set value(Q){if(!Object.is(Y,Q)){Y=Q,Z.forEach((G)=>G(Q));let J=z5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Z.add(Q),()=>Z.delete(Q)},peek(){return Y}};return X}function X1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function iY($){return X1($)?$.value:$}function nY($){let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=d1($[Z]);return Y}function oY($){return d1($)}function j5($){let Y=typeof $==="function",Z=Y?$:$.get,X=Y?void 0:$.set,Q=Y?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,_=()=>{if(G=!0,q.size>0){let B=W.value;q.forEach((j)=>j(B))}};function U(){K.clear();let B=h0;h0=_,v9.push(_);try{return Z()}finally{v9.pop(),h0=B}}let W={get value(){if(h0){let B=z5.get(W);if(!B)B=new Set,z5.set(W,B);B.add(h0)}if(G){let B=U();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=Z(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return W}function sY($,Y,Z={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Z,K,q=!0,_=!1,U=()=>{if(X1($))return Q?F1($.value):$.value;return $()},W=()=>{if(!q||_)return;let z=U();if(K!==void 0&&Object.is(K,z)&&!Q)return;let O=()=>{if(Y(z,K),K=Q?F1(z):z,G)j()};if(J==="sync")O();else if(J==="post")queueMicrotask(O);else Promise.resolve().then(O)},B=null;if(X1($))B=$.subscribe(()=>W());else B=j5($).subscribe(()=>W());if(X)K=void 0,W();else K=U();let j=()=>{if(q=!1,B)B(),B=null};return j.pause=()=>{_=!0},j.resume=()=>{_=!1},j}function rY($,Y,Z={}){let{immediate:X=!1,once:Q=!1}=Z,J=$.map((W)=>X1(W)?W.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let W=$.map((B)=>X1(B)?B.value:void 0);if(Y(W,J),J=[...W],Q)U()},_=$.map((W)=>{if(X1(W))return W.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,_.forEach((W)=>W())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function aY($,Y={}){let{flush:Z="pre"}=Y,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=h0;h0=G,v9.push(G);try{X=$()}finally{v9.pop(),h0=q}};if(Z==="sync")G();else if(Z==="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 tY($,Y={},Z){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Y),`return ${G}`)(...Object.values(Y));return Y[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function eY($,Y={},Z){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
10224
+ `}var vU;var cY=S(()=>{vU={processPartialHydrationDirectives:vY,processStaticDirectives:uY,generatePartialHydrationCSS:xY,generateIslandManifest:lY,createIslandRegistry:CY,hydrateIsland:fY,hydrateByStrategy:gY,hydrateAll:hY,isHydrated:dY,onHydrated:mY}});var ZZ={};r(ZZ,{watchMultiple:()=>rY,watchEffect:()=>aY,watch:()=>sY,unref:()=>iY,toRefs:()=>nY,throttledComputed:()=>YZ,stxWatchMultiple:()=>rY,stxWatchEffect:()=>aY,stxWatch:()=>sY,stxUnref:()=>iY,stxToRefs:()=>nY,stxThrottledComputed:()=>YZ,stxShallowRef:()=>oY,stxRef:()=>d1,stxIsRef:()=>X1,stxDebouncedComputed:()=>$Z,stxComputed:()=>j5,shallowRef:()=>oY,ref:()=>d1,processWatchDirectives:()=>eY,processComputedDirectives:()=>tY,isRef:()=>X1,default:()=>xU,debouncedComputed:()=>$Z,computed:()=>j5});function d1($){let Y=$,Z=new Set,X={get value(){if(h0){let Q=z5.get(X);if(!Q)Q=new Set,z5.set(X,Q);Q.add(h0)}return Y},set value(Q){if(!Object.is(Y,Q)){Y=Q,Z.forEach((G)=>G(Q));let J=z5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Z.add(Q),()=>Z.delete(Q)},peek(){return Y}};return X}function X1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function iY($){return X1($)?$.value:$}function nY($){let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=d1($[Z]);return Y}function oY($){return d1($)}function j5($){let Y=typeof $==="function",Z=Y?$:$.get,X=Y?void 0:$.set,Q=Y?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,_=()=>{if(G=!0,q.size>0){let B=W.value;q.forEach((j)=>j(B))}};function U(){K.clear();let B=h0;h0=_,v9.push(_);try{return Z()}finally{v9.pop(),h0=B}}let W={get value(){if(h0){let B=z5.get(W);if(!B)B=new Set,z5.set(W,B);B.add(h0)}if(G){let B=U();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=Z(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return W}function sY($,Y,Z={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Z,K,q=!0,_=!1,U=()=>{if(X1($))return Q?F1($.value):$.value;return $()},W=()=>{if(!q||_)return;let z=U();if(K!==void 0&&Object.is(K,z)&&!Q)return;let O=()=>{if(Y(z,K),K=Q?F1(z):z,G)j()};if(J==="sync")O();else if(J==="post")queueMicrotask(O);else Promise.resolve().then(O)},B=null;if(X1($))B=$.subscribe(()=>W());else B=j5($).subscribe(()=>W());if(X)K=void 0,W();else K=U();let j=()=>{if(q=!1,B)B(),B=null};return j.pause=()=>{_=!0},j.resume=()=>{_=!1},j}function rY($,Y,Z={}){let{immediate:X=!1,once:Q=!1}=Z,J=$.map((W)=>X1(W)?W.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let W=$.map((B)=>X1(B)?B.value:void 0);if(Y(W,J),J=[...W],Q)U()},_=$.map((W)=>{if(X1(W))return W.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,_.forEach((W)=>W())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function aY($,Y={}){let{flush:Z="pre"}=Y,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=h0;h0=G,v9.push(G);try{X=$()}finally{v9.pop(),h0=q}};if(Z==="sync")G();else if(Z==="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 tY($,Y={},Z){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Y),`return ${G}`)(...Object.values(Y));return Y[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function eY($,Y={},Z){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
10225
10225
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
10226
10226
  (function() {
10227
10227
  // Watch implementation for ${J}
@@ -10233,9 +10233,9 @@ else {
10233
10233
  }
10234
10234
  })();
10235
10235
  </script>
10236
- `})}function F1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>F1(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((X,Q)=>Z.set(F1(Q),F1(X))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((X)=>Z.add(F1(X))),Z}let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=F1($[Z]);return Y}function $Z($,Y=100){let Z=d1($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Z.value=$()},Y)};return j5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function YZ($,Y=100){let Z=d1($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Y)X=G,Z.value=$()};return j5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var h0=null,v9,z5,xU;var XZ=b(()=>{v9=[],z5=new WeakMap;xU={ref:d1,computed:j5,watch:sY,watchMultiple:rY,watchEffect:aY,isRef:X1,unref:iY,toRefs:nY,shallowRef:oY,debouncedComputed:$Z,throttledComputed:YZ,processComputedDirectives:tY,processWatchDirectives:eY}});var KZ={};s(KZ,{v:()=>fU,processHasErrorsDirective:()=>GZ,processFormValidationDirectives:()=>hU,processErrorsDirective:()=>QZ,processErrorDirective:()=>JZ,defineForm:()=>gU,Validator:()=>m1});class m1{rules=[];defaultValue="";addRule($){let Y=new m1;return Y.rules=[...this.rules,$],Y.defaultValue=this.defaultValue,Y}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Y)=>{if(Y===null||Y===void 0)return $;if(typeof Y==="string"&&Y.trim()==="")return $;if(Array.isArray(Y)&&Y.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Y)=>{if(!Y)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Y))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Y)=>{if(!Y)return!0;try{return new URL(String(Y)),!0}catch{return $}}})}min($,Y){let Z=Y||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Z}})}max($,Y){let Z=Y||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Z}})}length($,Y,Z){let X=Z||`Must be between ${$} and ${Y} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Y||X}})}pattern($,Y="Invalid format"){return this.addRule({name:"pattern",message:Y,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||Y}})}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:(Y)=>{if(!Y)return!0;return!String(Y).includes(" ")||$}})}number($="Must be a number"){let Y=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return Y.defaultValue=0,Y}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number.isInteger(Number(Y))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<0||$}})}minValue($,Y){let Z=Y||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Z}})}maxValue($,Y){let Z=Y||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Z}})}between($,Y,Z){let X=Z||`Must be between ${$} and ${Y}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Y||X}})}matches($,Y){let Z=Y||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Z}})}oneOf($,Y){let Z=Y||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(X)=>{if(!X)return!0;return $.includes(X)||Z}})}notOneOf($,Y){let Z=Y||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Y)=>{if(!Y)return!0;let Z=new Date(String(Y));return!Number.isNaN(Z.getTime())||$}})}before($,Y){let Z=new Date($),X=Y||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Z||X}})}after($,Y){let Z=new Date($),X=Y||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Z||X}})}custom($,Y="Invalid value"){return this.addRule({name:"custom",message:Y,validate:$})}async($,Y="Invalid value"){return this.addRule({name:"async",message:Y,async:!0,validate:$})}when($,Y){let Z=new m1;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let X of Y.getRules())Z.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Y=new m1;return Y.rules=[...this.rules],Y.defaultValue=$,Y}async validate($,Y){let Z=[];for(let X of this.rules){let Q=await X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}validateSync($,Y){let Z=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}}function gU($,Y){let Z=Object.keys($),X={},Q={},J={},G={},K={};for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function _(H){K[H]=!0;let V=await $[H].validate(X[H],X);return Q[H]=V,K[H]=!1,V.length===0}async function U(){q=!0;let H=await Promise.all(Z.map(_));return q=!1,H.every(Boolean)}function W(){for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1}function B(H){for(let V of Z)if(V in H)X[V]=H[V],G[V]=!0}function j(H,V){X[H]=V,G[H]=!0}function z(H,V=!0){if(J[H]=V,V)_(H)}function O(H){return{value:X[H],errors:Q[H],touched:J[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function L(H){return async(V)=>{V?.preventDefault?.();for(let R of Z)J[R]=!0;if(await U())await H(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Z.every((H)=>Q[H].length===0)},get isValidating(){return q||Z.some((H)=>K[H])},get isDirty(){return Z.some((H)=>G[H])},validate:U,validateField:_,reset:W,setValues:B,setFieldValue:j,setFieldTouched:z,getFieldState:O,handleSubmit:L}}function JZ($,Y,Z){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
10236
+ `})}function F1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>F1(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((X,Q)=>Z.set(F1(Q),F1(X))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((X)=>Z.add(F1(X))),Z}let Y={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))Y[Z]=F1($[Z]);return Y}function $Z($,Y=100){let Z=d1($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Z.value=$()},Y)};return j5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function YZ($,Y=100){let Z=d1($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Y)X=G,Z.value=$()};return j5($).subscribe(()=>Q()),{get value(){return Z.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var h0=null,v9,z5,xU;var XZ=S(()=>{v9=[],z5=new WeakMap;xU={ref:d1,computed:j5,watch:sY,watchMultiple:rY,watchEffect:aY,isRef:X1,unref:iY,toRefs:nY,shallowRef:oY,debouncedComputed:$Z,throttledComputed:YZ,processComputedDirectives:tY,processWatchDirectives:eY}});var KZ={};r(KZ,{v:()=>fU,processHasErrorsDirective:()=>GZ,processFormValidationDirectives:()=>hU,processErrorsDirective:()=>QZ,processErrorDirective:()=>JZ,defineForm:()=>gU,Validator:()=>m1});class m1{rules=[];defaultValue="";addRule($){let Y=new m1;return Y.rules=[...this.rules,$],Y.defaultValue=this.defaultValue,Y}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Y)=>{if(Y===null||Y===void 0)return $;if(typeof Y==="string"&&Y.trim()==="")return $;if(Array.isArray(Y)&&Y.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Y)=>{if(!Y)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Y))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Y)=>{if(!Y)return!0;try{return new URL(String(Y)),!0}catch{return $}}})}min($,Y){let Z=Y||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Z}})}max($,Y){let Z=Y||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Z}})}length($,Y,Z){let X=Z||`Must be between ${$} and ${Y} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Y||X}})}pattern($,Y="Invalid format"){return this.addRule({name:"pattern",message:Y,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||Y}})}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:(Y)=>{if(!Y)return!0;return!String(Y).includes(" ")||$}})}number($="Must be a number"){let Y=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return Y.defaultValue=0,Y}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number.isInteger(Number(Y))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<0||$}})}minValue($,Y){let Z=Y||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Z}})}maxValue($,Y){let Z=Y||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Z}})}between($,Y,Z){let X=Z||`Must be between ${$} and ${Y}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Y||X}})}matches($,Y){let Z=Y||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Z}})}oneOf($,Y){let Z=Y||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(X)=>{if(!X)return!0;return $.includes(X)||Z}})}notOneOf($,Y){let Z=Y||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Y)=>{if(!Y)return!0;let Z=new Date(String(Y));return!Number.isNaN(Z.getTime())||$}})}before($,Y){let Z=new Date($),X=Y||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Z||X}})}after($,Y){let Z=new Date($),X=Y||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Z||X}})}custom($,Y="Invalid value"){return this.addRule({name:"custom",message:Y,validate:$})}async($,Y="Invalid value"){return this.addRule({name:"async",message:Y,async:!0,validate:$})}when($,Y){let Z=new m1;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let X of Y.getRules())Z.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Y=new m1;return Y.rules=[...this.rules],Y.defaultValue=$,Y}async validate($,Y){let Z=[];for(let X of this.rules){let Q=await X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}validateSync($,Y){let Z=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Y);if(Q!==!0)Z.push(Q)}return Z}}function gU($,Y){let Z=Object.keys($),X={},Q={},J={},G={},K={};for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1,K[H]=!1;let q=!1;async function _(H){K[H]=!0;let V=await $[H].validate(X[H],X);return Q[H]=V,K[H]=!1,V.length===0}async function U(){q=!0;let H=await Promise.all(Z.map(_));return q=!1,H.every(Boolean)}function W(){for(let H of Z)X[H]=Y?.[H]??$[H].getDefaultValue(),Q[H]=[],J[H]=!1,G[H]=!1}function B(H){for(let V of Z)if(V in H)X[V]=H[V],G[V]=!0}function j(H,V){X[H]=V,G[H]=!0}function z(H,V=!0){if(J[H]=V,V)_(H)}function O(H){return{value:X[H],errors:Q[H],touched:J[H],dirty:G[H],valid:Q[H].length===0,validating:K[H]}}function L(H){return async(V)=>{V?.preventDefault?.();for(let R of Z)J[R]=!0;if(await U())await H(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Z.every((H)=>Q[H].length===0)},get isValidating(){return q||Z.some((H)=>K[H])},get isDirty(){return Z.some((H)=>G[H])},validate:U,validateField:_,reset:W,setValues:B,setFieldValue:j,setFieldTouched:z,getFieldState:O,handleSubmit:L}}function JZ($,Y,Z){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
10237
10237
  `)}catch{return""}})}function QZ($,Y,Z){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
10238
- `)}catch{return""}})}function GZ($,Y,Z){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function hU($,Y,Z){let X=$;return X=JZ(X,Y,Z),X=QZ(X,Y,Z),X=GZ(X,Y,Z),X}var fU;var qZ=b(()=>{fU=new m1});var WZ={};s(WZ,{processXElementDirectives:()=>dU,hasXElementDirectives:()=>_Z,generateXElementRuntime:()=>UZ});function UZ(){return`<script data-stx-scoped>
10238
+ `)}catch{return""}})}function GZ($,Y,Z){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Y;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return G}catch{return""}})}function hU($,Y,Z){let X=$;return X=JZ(X,Y,Z),X=QZ(X,Y,Z),X=GZ(X,Y,Z),X}var fU;var qZ=S(()=>{fU=new m1});var WZ={};r(WZ,{processXElementDirectives:()=>dU,hasXElementDirectives:()=>_Z,generateXElementRuntime:()=>UZ});function UZ(){return`<script data-stx-scoped>
10239
10239
  (function() {
10240
10240
  'use strict';
10241
10241
 
@@ -10521,27 +10521,27 @@ else {
10521
10521
  })();
10522
10522
  </script>`}function _Z($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function dU($){if(!_Z($))return $;let Y=UZ(),Z=$.lastIndexOf("</body>");if(Z!==-1)return $.slice(0,Z)+Y+`
10523
10523
  `+$.slice(Z);return $+`
10524
- `+Y}var zZ={};s(zZ,{validateClientScript:()=>P9,processOnceDirective:()=>y9,processJsonDirective:()=>S9,processDirectives:()=>b5,injectRouterScript:()=>b8});import I0 from"path";function mU($,Y){let Z=$.length,X=Y,Q=!0,J=[],G=(K)=>K+9<=Z&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Z){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
10524
+ `+Y}var zZ={};r(zZ,{validateClientScript:()=>P9,processOnceDirective:()=>y9,processJsonDirective:()=>S9,processDirectives:()=>b5,injectRouterScript:()=>b8});import I0 from"path";function mU($,Y){let Z=$.length,X=Y,Q=!0,J=[],G=(K)=>K+9<=Z&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Z){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
10525
10525
  `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(K==="/"&&Q){let q=X+1,_=!1;while(q<Z){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")_=!0;else if(U==="]")_=!1;else if(U==="/"&&!_){q++;break}else if(U===`
10526
10526
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Z&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Z){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
10527
10527
  `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Z){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<Z){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}async function b5($,Y,Z,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Y.__stxProcessingDepth;if(!Y.__stxProcessingDepth)Y.__stxProcessingDepth=0;if(Y.__stxProcessingDepth++,!Y.__onceStore)Y.__onceStore=new Set;try{return await q3.timeAsync("template-processing",async()=>{let G=await uU($,Y,Z,X,Q);if(J)G=Q7(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},_=(Y.__stx_runtime_head||null)??r1(),U={...K,..._.title&&{title:_.title},meta:[...K.meta||[],..._.meta||[]],link:[...K.link||[],..._.link||[]],script:[...K.script||[],..._.script||[]],..._.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},..._.htmlAttrs}},..._.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},..._.bodyAttrs}}};G=M8(G,U);let W=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(W&&G.includes("<head")){let j=W[1];G=G.replace("<head>",`<head>
10528
10528
  <meta name="stx-layout" content="${j}">`)}let B=G.match(/function (__stx_setup_\d+_\d+)\(/);if(B&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${B[1]}">`);let j=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${B[1]}"`,"i");G=G.replace(j,"$1")}}if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (KY(),GY)),q=X.storesDir,_=await K(q);if(_){let U=`<script data-stx-stores>${_}</script>`,W=G.indexOf("<script data-stx-scoped>");if(W!==-1){let B=G.indexOf("</script>",W+24);if(B!==-1){let j=B+9;G=G.slice(0,j)+`
10529
10529
  `+U+G.slice(j)}}}}catch{}if(J&&Y.__stx_inject_css!==!1)G=await a6(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof J9)throw G;let K=G instanceof Error?G.message:String(G),q=new z1(`Template processing failed: ${K}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(C0.log(q,{filePath:Z,context:Y}),i$.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),X.debug)throw q;return p$.createFallbackContent("Template Processing",q)}}async function uU($,Y,Z,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!I0.isAbsolute(X.partialsDir)?I0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!I0.isAbsolute(X.componentsDir)?I0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!I0.isAbsolute(X.layoutsDir)?I0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let _="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,L)=>{return`{{ ${L} }}`}),q=N8(q),q=await ZY(q,Z,Q);let U={};q=F4(q,U);let W={...Y.__sections||{}},B="",j=/@nolayout\b/.test(q);if(j)q=q.replace(/@nolayout\b\s*/g,"");let z=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(z)B=z[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!B&&!j&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),L=/@section\s*\(/.test(q);if(!O||L){let F="",H=I0.dirname(Z),V=K.layoutsDir?I0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let R=I0.join(H,"_layout.stx");if(await c(R)){F=R;break}let A=I0.dirname(H);if(A===H||A.length<V.length)break;H=A}if(F)B=F;else if(K.layoutsDir){let N=I0.isAbsolute(K.layoutsDir)?K.layoutsDir:I0.resolve(process.cwd(),K.layoutsDir),R=I0.join(N,`${K.defaultLayout}.stx`);if(await c(R))B=R}if(B&&!L)q=`@section('content')
10530
10530
  ${q.trim()}
10531
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,F)=>{return W[L]=F,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,F)=>{if(F.includes("@parent"))W[L]=F.replace("@parent",V1);else W[L]=F.trim();return""}),Y.__sections=W,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,F)=>{return W[L]||F||""}),!("slot"in Y)||Y.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""});if(q=V4(q,U),B)try{let O=I0.isAbsolute(B)?B:await b1(()=>G$(B,Z,G,Q),null,()=>{throw new z1(`Failed to resolve layout path: ${B}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!O){let R=`Layout not found: ${B} (referenced from ${Z})`;if(C0.log(Error(R),{layoutPath:B,filePath:Z},"warning"),G.debug)throw new z1(R,Z);return q}let L=await b1(()=>Bun.file(O).text(),"",()=>{throw new z1(`Failed to read layout file: ${O}`,Z,void 0,void 0,"Layout content could not be loaded")}),F=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(G.debug)console.log(`Found nested layout: ${F[1]} in ${O}`);let R={},A=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return R[M]=E.trim(),""});for(let[I,M]of Object.entries(R))if(W[I]&&W[I].includes(V1)){let E=W[I].indexOf(V1);W[I]=W[I].slice(0,E)+M+W[I].slice(E+V1.length)}else if(!W[I])W[I]=M;let w={...Y,__sections:W},T=`@layout('${F[1]}')${A}`;return await b5(T,w,O,G,Q)}let H=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=F4(H,U),N={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(R,A,w)=>{return N[A]=w.trim(),`@slot('${A}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(R,A,w)=>{if(W[A]){let T=W[A];if(T.includes(V1)){let I=N[A]||"",M=T.indexOf(V1);T=T.slice(0,M)+I+T.slice(M+V1.length)}return T}return w||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""}),V=V4(V,U),Y.__originalFilePath=Z,q=await BZ(V,Y,O,G,Q),q=`<!-- stx-layout: ${B} -->
10532
- ${q}`,q}catch(O){return C0.log(O instanceof Error?O:Error(String(O)),{layoutPath:B,filePath:Z},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await BZ(q,Y,Z,G,Q)}async function BZ($,Y,Z,X,Q){let J=$;Y.__stx_sfc_mode=!0;let G=X;if(await b1(()=>O8(Z,Y),void 0,(f)=>{C0.log(f,{filePath:Z,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${Z}: ${f.message}`)}),Y.__stx_options=G,G.buildMode)Y.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[f,i]of Object.entries(process.env))if(f.startsWith(K)&&i!==void 0)q[f]=i;Y.$env=q,J=await b1(()=>_8(J,Y,Z,G),J,(f)=>{C0.log(f,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${f.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=_.exec(J))!==null){let f=U[1],i=U[2];if(/\bserver\b/.test(f)&&i.trim())try{let{extractVariables:Y0}=await Promise.resolve().then(() => (t1(),k5));await Y0(i,Y,Z)}catch(Y0){let q0=Y0 instanceof Error?Y0:Error(String(Y0));C0.log(q0,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${q0.message}`)}}try{let{interpolateScriptsInTemplate:f}=await Promise.resolve().then(() => (p0(),Q3));J=f(J,Y,{skipServer:!0})}catch(f){let i=f instanceof Error?f:Error(String(f));C0.log(i,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${i.message}`)}if(J=await J8(J,Y,Z),J=await Q8(J,Y,Z),J=await v2(J,Y,Z,G),M5(J))J=C4(J),J=v4(J,Y);J=j4(J,Y,Z,G),J=await J7(J,Y,Z,G,Q),J=await w8(J,Y,Z,G,Q),J=h7(J,Y,Z,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => UY);J=W(J,Y,Z);let{processTeleportDirectives:B}=await Promise.resolve().then(() => WY);J=B(J,Y,Z);let{processTransitionDirectives:j,processTransitionAttributes:z}=await Promise.resolve().then(() => OY);J=j(J,Y,Z),J=z(J);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => LY);J=O(J,Y,Z);let{processSuspenseDirectives:L}=await Promise.resolve().then(() => FY);J=L(J,Y,Z);let{processAsyncDirectives:F}=await Promise.resolve().then(() => AY);J=F(J,Y,Z);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => TY);J=H(J,Y,Z);let{processVirtualListDirectives:V,processVirtualGridDirectives:N,processInfiniteListDirectives:R}=await Promise.resolve().then(() => (bY(),kY));J=V(J,Y,Z),J=N(J,Y,Z),J=R(J,Y,Z);let{processPartialHydrationDirectives:A,processStaticDirectives:w}=await Promise.resolve().then(() => (cY(),pY));J=A(J,Y,Z),J=w(J);let{processComputedDirectives:T,processWatchDirectives:I}=await Promise.resolve().then(() => (XZ(),ZZ));J=T(J,Y,Z),J=I(J,Y,Z);let{processFormValidationDirectives:M}=await Promise.resolve().then(() => (qZ(),KZ));J=M(J,Y,Z);let{processHeadDirective:E,processTitleDirective:D,processMetaDirective:P,resetHead:y}=await Promise.resolve().then(() => (a1(),Y$));if(!Y.__stx_head_preset&&!Y.__stx_runtime_head)y();let S=E(J);if(J=S.content,J=D(J,Y),J=P(J,Y),J=z8(J),J=Q4(J,Y),J=P2(J),J=q8(J),J=await L4(J,Y,Z,G,Q),J=await J7(J,Y,Z,G,Q),J=Q7(J),J=O1(J,Y,Z),J=G4(J,Y),J=K4(J,Y),J=H9(J,Y),J=d2(J,Y),J=m2(J,Y),J=await V2(J,Y,Z,G),J=await b3(J,Y,Z),J=await o2(J,Y,Z,G),J=y7(J,Y,Z,G),J=x6(J,Y,Z,G),J=f6(J,Y,Z),J=g6(J,Y,Z,G),J=b2(J,Y,Z,G),J=S9(J,Y),J=y9(J),J=JY(J),!G.skipEventDirectives)J=B2(J,Y,Z);if(J=L2(J,Y,Z),G.debug){let f=/\bx-data\s*=/.test(J),i=D9($);if(f&&i)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10531
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,L,F)=>{return W[L]=F,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,L,F)=>{if(F.includes("@parent"))W[L]=F.replace("@parent",V1);else W[L]=F.trim();return""}),Y.__sections=W,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,L,F)=>{return W[L]||F||""}),!("slot"in Y)||Y.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""});if(q=V4(q,U),B)try{let O=I0.isAbsolute(B)?B:await b1(()=>G$(B,Z,G,Q),null,()=>{throw new z1(`Failed to resolve layout path: ${B}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!O){let R=`Layout not found: ${B} (referenced from ${Z})`;if(C0.log(Error(R),{layoutPath:B,filePath:Z},"warning"),G.debug)throw new z1(R,Z);return q}let L=await b1(()=>Bun.file(O).text(),"",()=>{throw new z1(`Failed to read layout file: ${O}`,Z,void 0,void 0,"Layout content could not be loaded")}),F=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(G.debug)console.log(`Found nested layout: ${F[1]} in ${O}`);let R={},A=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,M)=>{return R[I]=M.trim(),""});for(let[D,I]of Object.entries(R))if(W[D]&&W[D].includes(V1)){let M=W[D].indexOf(V1);W[D]=W[D].slice(0,M)+I+W[D].slice(M+V1.length)}else if(!W[D])W[D]=I;let w={...Y,__sections:W},T=`@layout('${F[1]}')${A}`;return await b5(T,w,O,G,Q)}let H=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),V=F4(H,U),N={};return V=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(R,A,w)=>{return N[A]=w.trim(),`@slot('${A}')`}),V=V.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(R,A,w)=>{if(W[A]){let T=W[A];if(T.includes(V1)){let D=N[A]||"",I=T.indexOf(V1);T=T.slice(0,I)+D+T.slice(I+V1.length)}return T}return w||""}),V=V.replace(/\{\{\s*slot\s*\}\}/g,()=>{return W.content||""}),V=V4(V,U),Y.__originalFilePath=Z,q=await BZ(V,Y,O,G,Q),q=`<!-- stx-layout: ${B} -->
10532
+ ${q}`,q}catch(O){return C0.log(O instanceof Error?O:Error(String(O)),{layoutPath:B,filePath:Z},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return await BZ(q,Y,Z,G,Q)}async function BZ($,Y,Z,X,Q){let J=$;Y.__stx_sfc_mode=!0;let G=X;if(await b1(()=>O8(Z,Y),void 0,(g)=>{C0.log(g,{filePath:Z,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${Z}: ${g.message}`)}),Y.__stx_options=G,G.buildMode)Y.__stx_buildMode=G.buildMode;let K=G.envPrefix||"STX_PUBLIC_",q={};for(let[g,i]of Object.entries(process.env))if(g.startsWith(K)&&i!==void 0)q[g]=i;Y.$env=q,J=await b1(()=>_8(J,Y,Z,G),J,(g)=>{C0.log(g,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${g.message}`)});let _=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=_.exec(J))!==null){let g=U[1],i=U[2];if(/\bserver\b/.test(g)&&i.trim())try{let{extractVariables:Y0}=await Promise.resolve().then(() => (t1(),k5));await Y0(i,Y,Z)}catch(Y0){let U0=Y0 instanceof Error?Y0:Error(String(Y0));C0.log(U0,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${U0.message}`)}}try{let{interpolateScriptsInTemplate:g}=await Promise.resolve().then(() => (p0(),Q3));J=g(J,Y,{skipServer:!0})}catch(g){let i=g instanceof Error?g:Error(String(g));C0.log(i,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${i.message}`)}if(J=await J8(J,Y,Z),J=await Q8(J,Y,Z),J=await v2(J,Y,Z,G),M5(J))J=C4(J),J=v4(J,Y);J=j4(J,Y,Z,G),J=await J7(J,Y,Z,G,Q),J=await w8(J,Y,Z,G,Q),J=h7(J,Y,Z,G);let{processDeferDirectives:W}=await Promise.resolve().then(() => UY);J=W(J,Y,Z);let{processTeleportDirectives:B}=await Promise.resolve().then(() => WY);J=B(J,Y,Z);let{processTransitionDirectives:j,processTransitionAttributes:z}=await Promise.resolve().then(() => OY);J=j(J,Y,Z),J=z(J);let{processErrorBoundaryDirectives:O}=await Promise.resolve().then(() => LY);J=O(J,Y,Z);let{processSuspenseDirectives:L}=await Promise.resolve().then(() => FY);J=L(J,Y,Z);let{processAsyncDirectives:F}=await Promise.resolve().then(() => AY);J=F(J,Y,Z);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => TY);J=H(J,Y,Z);let{processVirtualListDirectives:V,processVirtualGridDirectives:N,processInfiniteListDirectives:R}=await Promise.resolve().then(() => (bY(),kY));J=V(J,Y,Z),J=N(J,Y,Z),J=R(J,Y,Z);let{processPartialHydrationDirectives:A,processStaticDirectives:w}=await Promise.resolve().then(() => (cY(),pY));J=A(J,Y,Z),J=w(J);let{processComputedDirectives:T,processWatchDirectives:D}=await Promise.resolve().then(() => (XZ(),ZZ));J=T(J,Y,Z),J=D(J,Y,Z);let{processFormValidationDirectives:I}=await Promise.resolve().then(() => (qZ(),KZ));J=I(J,Y,Z);let{processHeadDirective:M,processTitleDirective:E,processMetaDirective:C,resetHead:P}=await Promise.resolve().then(() => (a1(),Y$));if(!Y.__stx_head_preset&&!Y.__stx_runtime_head)P();let k=M(J);if(J=k.content,J=E(J,Y),J=C(J,Y),J=z8(J),J=Q4(J,Y),J=P2(J),J=q8(J),J=await L4(J,Y,Z,G,Q),J=await J7(J,Y,Z,G,Q),J=Q7(J),J=O1(J,Y,Z),J=G4(J,Y),J=K4(J,Y),J=H9(J,Y),J=d2(J,Y),J=m2(J,Y),J=await V2(J,Y,Z,G),J=await b3(J,Y,Z),J=await o2(J,Y,Z,G),J=y7(J,Y,Z,G),J=x6(J,Y,Z,G),J=f6(J,Y,Z),J=g6(J,Y,Z,G),J=b2(J,Y,Z,G),J=S9(J,Y),J=y9(J),J=JY(J),!G.skipEventDirectives)J=B2(J,Y,Z);if(J=L2(J,Y,Z),G.debug){let g=/\bx-data\s*=/.test(J),i=D9($);if(g&&i)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10533
10533
  Both work on the same page, but they manage separate scopes.
10534
- Prefer signals (state/derived/effect) for new components.`)}J=F8(J,Y),J=await s0(J,Y,Z),J=QY(J),J=X2(J);let{processXElementDirectives:k}=await Promise.resolve().then(() => WZ);J=k(J);let g=Y.__originalFilePath||Z;if(J=await x4(J,G,g),J=await W8(J,Y,Z,G),G.seo?.enabled)J=h6(J,Y,G);let{renderHead:h,getHead:r}=await Promise.resolve().then(() => (a1(),Y$)),U0=Y.__stx_runtime_head,z0=U0&&(U0.title||U0.meta?.length||U0.link?.length)?U0:r();if(z0.title||z0.meta?.length||z0.link?.length){let f=h(z0);if(f){if(J.includes("</head>"))J=J.replace("</head>",`${f}
10534
+ Prefer signals (state/derived/effect) for new components.`)}J=F8(J,Y),J=await s0(J,Y,Z),J=QY(J),J=X2(J);let{processXElementDirectives:b}=await Promise.resolve().then(() => WZ);J=b(J);let x=Y.__originalFilePath||Z;if(J=await x4(J,G,x),J=await W8(J,Y,Z,G),G.seo?.enabled)J=h6(J,Y,G);let{renderHead:d,getHead:s}=await Promise.resolve().then(() => (a1(),Y$)),K0=Y.__stx_runtime_head,z0=K0&&(K0.title||K0.meta?.length||K0.link?.length)?K0:s();if(z0.title||z0.meta?.length||z0.link?.length){let g=d(z0);if(g){if(J.includes("</head>"))J=J.replace("</head>",`${g}
10535
10535
  </head>`);else if(J.includes("<head>"))J=J.replace("<head>",`<head>
10536
- ${f}`)}}if(S.headContent){if(J.includes("</head>"))J=J.replace("</head>",`${S.headContent}
10536
+ ${g}`)}}if(k.headContent){if(J.includes("</head>"))J=J.replace("</head>",`${k.headContent}
10537
10537
  </head>`);else if(J.includes("<head>"))J=J.replace("<head>",`<head>
10538
- ${S.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)J=k2(J,G.csp,Y);if(G.analytics?.enabled)J=Q2(J,G);if(G.heatmap?.enabled)J=p7(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:f}=await Promise.resolve().then(() => (N5(),k7));J=f(J,G)}let _0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),y0=/\bSTX\.\w+/.test(J),d0=/window\.STX\s*=/.test(J);if(_0&&y0&&!d0){let i=`<script data-stx-scoped>
10538
+ ${k.headContent}`)}if(G.csp?.enabled&&G.csp.addMetaTag)J=k2(J,G.csp,Y);if(G.analytics?.enabled)J=Q2(J,G);if(G.heatmap?.enabled)J=p7(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:g}=await Promise.resolve().then(() => (N5(),k7));J=g(J,G)}let _0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),y0=/\bSTX\.\w+/.test(J),d0=/window\.STX\s*=/.test(J);if(_0&&y0&&!d0){let i=`<script data-stx-scoped>
10539
10539
  ${e6()}
10540
- </script>`;if(J.includes("</head>")){let J0=J.indexOf("</head>"),q0=J.slice(0,J0).indexOf("<script");if(q0!==-1){let E0=J.slice(0,q0),i0=J.slice(q0);J=E0+i+`
10540
+ </script>`;if(J.includes("</head>")){let J0=J.indexOf("</head>"),U0=J.slice(0,J0).indexOf("<script");if(U0!==-1){let E0=J.slice(0,U0),i0=J.slice(U0);J=E0+i+`
10541
10541
  `+i0}else J=J.replace("</head>",`${i}
10542
10542
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
10543
10543
  ${i}`);else J=i+`
10544
- `+J}{let f=/<script\s+server\b[^>]*>/gi,i,J0=[];while((i=f.exec(J))!==null){let Y0=i.index+i[0].length,q0=mU(J,Y0);if(q0===-1)continue;let E0=q0+9;while(E0<J.length&&/\s/.test(J[E0]))E0++;J0.push({start:i.index,end:E0})}for(let Y0=J0.length-1;Y0>=0;Y0--){let{start:q0,end:E0}=J0[Y0];J=J.substring(0,q0)+J.substring(E0)}}let j0=I5(J,Z);if(j0.hasScoped)J=j0.html;let C=Y.__stx_event_bindings||[],v=!1,x=[],p=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:G0}=await Promise.resolve().then(() => (f4(),f8));for(let f of G0(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))x.push({match:f.fullMatch,attrs:f.attrs,content:f.body});for(let{match:f,attrs:i,content:J0}of x){v=!0;let Y0=J0;P9(J0,Z,X.strict);let q0=await A5(J0,{eventBindings:C,attrs:i,hasColonDirectives:p,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:X.buildMode==="compile"});J=J.replace(f,()=>q0)}if(v)Y.__stx_event_bindings=[];return J}var V1="<!--PARENT_CONTENT_PLACEHOLDER-->";var K$=b(()=>{t6();l9();$2();J2();G2();i9();p9();z2();s9();F2();R2();z9();S2();C2();f2();c0();a1();p0();u2();s2();X8();K8();O4();q$();B8();I1();j8();n$();V0();H8();V8();A8();T8();$$();f4();e8();XY();G7();K7();G7();K7()});import nU from"fs";import _7 from"path";import AZ from"fs";import m0 from"path";var j7=[72,96,128,144,152,192,384,512],O7=[120,152,167,180],H7=[16,32];async function L7($,Y){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let Q=m0.isAbsolute(X.src)?X.src:m0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Z.errors.push(`Source icon not found: ${Q}`),Z.success=!1,Z;let J=m0.resolve(Y,X.outputDir||"pwa-icons");try{AZ.mkdirSync(J,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${J}`),Z.success=!1,Z}let G=X.sizes||j7,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let _;try{_=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
10544
+ `+J}{let g=/<script\s+server\b[^>]*>/gi,i,J0=[];while((i=g.exec(J))!==null){let Y0=i.index+i[0].length,U0=mU(J,Y0);if(U0===-1)continue;let E0=U0+9;while(E0<J.length&&/\s/.test(J[E0]))E0++;J0.push({start:i.index,end:E0})}for(let Y0=J0.length-1;Y0>=0;Y0--){let{start:U0,end:E0}=J0[Y0];J=J.substring(0,U0)+J.substring(E0)}}let j0=I5(J,Z);if(j0.hasScoped)J=j0.html;let y=Y.__stx_event_bindings||[],v=!1,f=[],p=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:G0}=await Promise.resolve().then(() => (f4(),f8));for(let g of G0(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}))f.push({match:g.fullMatch,attrs:g.attrs,content:g.body});for(let{match:g,attrs:i,content:J0}of f){v=!0;let Y0=J0;P9(J0,Z,X.strict);let U0=await A5(J0,{eventBindings:y,attrs:i,hasColonDirectives:p,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:X.buildMode==="compile"});J=J.replace(g,()=>U0)}if(v)Y.__stx_event_bindings=[];return J}var V1="<!--PARENT_CONTENT_PLACEHOLDER-->";var K$=S(()=>{t6();l9();$2();J2();G2();i9();p9();z2();s9();F2();R2();z9();S2();C2();f2();c0();a1();p0();u2();s2();X8();K8();O4();q$();B8();I1();j8();n$();V0();H8();V8();A8();T8();$$();f4();e8();XY();G7();K7();G7();K7()});import nU from"fs";import _7 from"path";import AZ from"fs";import m0 from"path";var j7=[72,96,128,144,152,192,384,512],O7=[120,152,167,180],H7=[16,32];async function L7($,Y){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let Q=m0.isAbsolute(X.src)?X.src:m0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Z.errors.push(`Source icon not found: ${Q}`),Z.success=!1,Z;let J=m0.resolve(Y,X.outputDir||"pwa-icons");try{AZ.mkdirSync(J,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${J}`),Z.success=!1,Z}let G=X.sizes||j7,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let _;try{_=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
10545
10545
  Icon generation requires the sharp package for image processing.`),Z.success=!1,Z}let W=await _.default(Q).metadata();if(W.width&&W.width<512)Z.warnings.push(`Source icon is ${W.width}x${W.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=m0.join(J,`icon-${L}x${L}.png`);if(await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Z.generatedFiles.push(F),K){let H=m0.join(J,`icon-${L}x${L}.webp`);await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(H),Z.generatedFiles.push(H)}}if(q){for(let F of O7){let H=m0.join(J,`apple-touch-icon-${F}x${F}.png`);await _.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Z.generatedFiles.push(H)}let L=m0.join(J,"apple-touch-icon.png");await _.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Z.generatedFiles.push(L)}for(let L of H7){let F=m0.join(J,`favicon-${L}x${L}.png`);await _.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Z.generatedFiles.push(F)}let B=512,j=m0.join(J,`icon-maskable-${B}x${B}.png`),z=Math.floor(B*0.1),O=B-z*2;await _.default(Q).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:z,bottom:z,left:z,right:z,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(j),Z.generatedFiles.push(j)}catch(_){let U=_ instanceof Error?_.message:String(_);Z.errors.push(`Icon generation failed: ${U}`),Z.success=!1}return Z}function aU($){let Y=$.sizes||j7,Z=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Y)if(J.push(`${Z}/icon-${G}x${G}.png`),X)J.push(`${Z}/icon-${G}x${G}.webp`);if(Q){J.push(`${Z}/apple-touch-icon.png`);for(let G of O7)J.push(`${Z}/apple-touch-icon-${G}x${G}.png`)}for(let G of H7)J.push(`${Z}/favicon-${G}x${G}.png`);return J.push(`${Z}/icon-maskable-512x512.png`),J}async function F7(){try{return await import("sharp"),!0}catch{return!1}}N5();function lZ($,Y,Z,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Y}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Z)Q.push({src:`${Y}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function pZ($){return $.map((Y)=>({name:Y.name,short_name:Y.shortName,description:Y.description,url:Y.url,icons:Y.icons?.map((Z)=>({src:Z.src,sizes:Z.sizes,type:Z.type}))}))}function cZ($){let Y=$.pwa?.shareTarget;if(!Y?.enabled)return;let Z={action:Y.action||"/share",method:Y.method||"POST",enctype:Y.enctype||"multipart/form-data",params:{title:Y.params?.title||"title",text:Y.params?.text||"text",url:Y.params?.url||"url"}};if(Y.acceptFiles&&Y.acceptFiles.length>0)Z.params.files=Y.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Z}function iZ($){let Y=$.pwa?.fileHandlers;if(!Y?.enabled||!Y.accept)return;let Z=[{action:Y.action||"/",accept:Y.accept,launch_type:Y.launchType||"single-client"}];if(Y.icons)Z[0].icons=Y.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Z}function nZ($){let Y=$.pwa?.protocolHandlers;if(!Y||Y.length===0)return;return Y.map((Z)=>({protocol:Z.protocol,url:Z.url}))}function oZ($){let Y=$.pwa;if(!Y?.enabled||!Y.manifest)return null;let{manifest:Z,icons:X}=Y,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:Z.name,short_name:Z.shortName||Z.name,description:Z.description,start_url:Z.startUrl||"/",display:Z.display||"standalone",display_override:Z.displayOverride,orientation:Z.orientation,theme_color:Z.themeColor,background_color:Z.backgroundColor,scope:Z.scope||"/",lang:Z.lang,dir:Z.dir,id:Z.id,categories:Z.categories,icons:lZ(Q,J,G,K)};if(Z.shortcuts&&Z.shortcuts.length>0)q.shortcuts=pZ(Z.shortcuts);if(Z.screenshots&&Z.screenshots.length>0)q.screenshots=Z.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let _=cZ($);if(_)q.share_target=_;let U=iZ($);if(U)q.file_handlers=U;let W=nZ($);if(W)q.protocol_handlers=W;if(Z.launchHandler)q.launch_handler={client_mode:Z.launchHandler};if(Z.handleLinks)q.handle_links=Z.handleLinks;if(Z.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Z.edgeSidePanel.preferredWidth};return q}function b7($){let Y=oZ($);if(!Y)return"";let Z=JSON.parse(JSON.stringify(Y));return JSON.stringify(Z,null,2)}function K_($,Y){return{...Y,...$,shortcuts:$.shortcuts||Y.shortcuts,screenshots:$.screenshots||Y.screenshots,categories:$.categories||Y.categories}}function q_($){let Y=[],Z=$.pwa;if(!Z?.enabled)return Y;let X=Z.manifest;if(!X)return Y.push("PWA manifest configuration is missing"),Y;if(!X.name)Y.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Y.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))Y.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Y.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Y.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Z.shareTarget?.enabled){if(!Z.shareTarget.action)Y.push("Share target action URL is required")}if(Z.fileHandlers?.enabled){if(!Z.fileHandlers.accept||Object.keys(Z.fileHandlers.accept).length===0)Y.push("File handlers must specify accepted MIME types")}if(Z.protocolHandlers)for(let K of Z.protocolHandlers){if(!K.protocol)Y.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Y.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Y}import jZ from"path";async function OZ($){let Y=$.pwa?.offline;if(!Y?.enabled)return"";if(Y.page){let Z=jZ.isAbsolute(Y.page)?Y.page:jZ.resolve(process.cwd(),Y.page);if(await Bun.file(Z).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (K$(),zZ)),Q=await Bun.file(Z).text();return await X(Q,{},Z,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Z}`)}return lU($)}function lU($){let Y=$.pwa?.offline,Z=$.pwa?.manifest,X=Y?.fallbackTitle||"You are offline",Q=Y?.fallbackMessage||"Please check your internet connection and try again.",J=Z?.themeColor||"#4f46e5",G=Z?.shortName||Z?.name||"App";return`<!DOCTYPE html>
10546
10546
  <html lang="en">
10547
10547
  <head>