@stacksjs/stx 0.2.91 → 0.2.92

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 (95) hide show
  1. package/dist/app-shell.js +1 -1
  2. package/dist/assets.js +1 -1
  3. package/dist/build-mode-detector.js +1 -1
  4. package/dist/build-views.js +1 -1
  5. package/dist/build.js +1 -1
  6. package/dist/builtins/index.js +1 -1
  7. package/dist/caching.js +1 -1
  8. package/dist/{chunk-fk6ted7p.js → chunk-14kfmww0.js} +1 -1
  9. package/dist/{chunk-7m6jbrky.js → chunk-3ewtm19c.js} +1 -1
  10. package/dist/{chunk-xnf61ake.js → chunk-646pxdd1.js} +1 -1
  11. package/dist/{chunk-vbysnq00.js → chunk-6t76k6ry.js} +1 -1
  12. package/dist/{chunk-2hnv9414.js → chunk-7bd8bw2z.js} +1 -1
  13. package/dist/{chunk-nsbwxkj5.js → chunk-87rkm7qf.js} +1 -1
  14. package/dist/{chunk-j55xkgq8.js → chunk-8fhv0xaw.js} +1 -1
  15. package/dist/{chunk-pthx7bxa.js → chunk-9tksycj5.js} +1 -1
  16. package/dist/{chunk-0n11c9hw.js → chunk-9w7021bx.js} +1 -1
  17. package/dist/{chunk-j0mbt7fb.js → chunk-ewytyv0p.js} +1 -1
  18. package/dist/{chunk-y248bdr9.js → chunk-fnqf7293.js} +1 -1
  19. package/dist/{chunk-sx35cb80.js → chunk-ftzqtv1k.js} +1 -1
  20. package/dist/{chunk-tqzv7g2r.js → chunk-g22tv0ed.js} +1 -1
  21. package/dist/{chunk-4bpb2es7.js → chunk-g9gksn68.js} +1 -1
  22. package/dist/{chunk-crjrbczd.js → chunk-gfsk93gv.js} +2 -2
  23. package/dist/{chunk-w7bgs9ze.js → chunk-hz7qnpx1.js} +1 -1
  24. package/dist/{chunk-4e3yxhkd.js → chunk-mqnymcn5.js} +1 -1
  25. package/dist/{chunk-bdp5z6mt.js → chunk-ms9rebfj.js} +1 -1
  26. package/dist/{chunk-4wsmprpm.js → chunk-nwfa5766.js} +10 -10
  27. package/dist/{chunk-krxvy5wr.js → chunk-qhzdkgg3.js} +1 -1
  28. package/dist/{chunk-syffx53n.js → chunk-r5sggjdv.js} +1 -1
  29. package/dist/{chunk-t88cgftn.js → chunk-rhyxeb33.js} +1 -1
  30. package/dist/chunk-tzd81m7r.js +1539 -0
  31. package/dist/{chunk-gfj0a29j.js → chunk-vy0k2prz.js} +1 -1
  32. package/dist/{chunk-xxgdw2s8.js → chunk-zx43nkm1.js} +1 -1
  33. package/dist/cli.js +478 -478
  34. package/dist/client-script.js +1 -1
  35. package/dist/component-processing.js +1 -1
  36. package/dist/component-registry.js +1 -1
  37. package/dist/component-renderer.js +1 -1
  38. package/dist/components.js +1 -1
  39. package/dist/config.js +1 -1
  40. package/dist/dev-server/crosswind.js +1 -1
  41. package/dist/dev-server/index.js +1 -1
  42. package/dist/dev-server/serve-app.js +1 -1
  43. package/dist/dev-server/serve-file.js +1 -1
  44. package/dist/dev-server/serve-markdown.js +1 -1
  45. package/dist/dev-server/serve-multi.js +1 -1
  46. package/dist/dev-server.js +1 -1
  47. package/dist/docs.js +1 -1
  48. package/dist/dynamic-components.js +1 -1
  49. package/dist/expressions.js +1 -1
  50. package/dist/includes.js +1 -1
  51. package/dist/index.js +1 -1
  52. package/dist/interactive.js +1 -1
  53. package/dist/js-ts.js +1 -1
  54. package/dist/loops.js +1 -1
  55. package/dist/markdown.js +1 -1
  56. package/dist/middleware.js +1 -1
  57. package/dist/plugin.js +1 -1
  58. package/dist/process.js +1 -1
  59. package/dist/production-builder.js +1 -1
  60. package/dist/production-server.js +1 -1
  61. package/dist/pwa/index.js +1 -1
  62. package/dist/pwa/offline.js +1 -1
  63. package/dist/pwa.js +318 -318
  64. package/dist/reactive.js +1 -1
  65. package/dist/render.js +1 -1
  66. package/dist/runtime-injection.js +1 -1
  67. package/dist/serve.js +1 -1
  68. package/dist/signal-processing.js +1 -1
  69. package/dist/site-builder/build.js +1 -1
  70. package/dist/site-builder/index.js +1 -1
  71. package/dist/slots.js +1 -1
  72. package/dist/ssg.js +310 -310
  73. package/dist/ssr.js +1 -1
  74. package/dist/store-loader.js +1 -1
  75. package/dist/story/cli.js +1 -1
  76. package/dist/story/commands/dev.js +1 -1
  77. package/dist/story/commands/index.js +1 -1
  78. package/dist/story/index.js +1 -1
  79. package/dist/story/renderer.js +1 -1
  80. package/dist/story/server.js +1 -1
  81. package/dist/story/visual-testing.js +1 -1
  82. package/dist/streaming.js +1 -1
  83. package/dist/template-compiler.js +1 -1
  84. package/dist/template-hydrator.js +1 -1
  85. package/dist/testing.js +1 -1
  86. package/dist/utils.js +1 -1
  87. package/dist/variable-extractor.js +1 -1
  88. package/dist/web-components.js +1 -1
  89. package/package.json +5 -6
  90. package/dist/chunk-qjn5xmeh.js +0 -1539
  91. /package/dist/{chunk-29qrr0nc.js → chunk-0t75nh4z.js} +0 -0
  92. /package/dist/{chunk-fze9db64.js → chunk-pcngkyjr.js} +0 -0
  93. /package/dist/{chunk-tfjem6g3.js → chunk-r3cxnszy.js} +0 -0
  94. /package/dist/{chunk-04jkv9xx.js → chunk-v0s45ek4.js} +0 -0
  95. /package/dist/{chunk-dcpbe8a1.js → chunk-wbrqpv9f.js} +0 -0
package/dist/pwa.js CHANGED
@@ -1,26 +1,26 @@
1
1
  // @bun
2
- var{defineProperty:D4,getOwnPropertyNames:sX,getOwnPropertyDescriptor:rX}=Object,aX=Object.prototype.hasOwnProperty;function tX($){return this[$]}var U6=($)=>{var Z=(q6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=D4({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of sX($))if(!aX.call(Z,X))D4(Z,X,{get:tX.bind($,X),enumerable:!(Y=rX($,X))||Y.enumerable})}return q6.set($,Z),Z},q6;var eX=($)=>$;function $J($,Z){this[$]=eX.bind(null,Z)}var n=($,Z)=>{for(var Y in Z)D4($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:$J.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var J0=import.meta.require;import d5 from"fs";import m5 from"path";function XJ($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function JJ($,Z){let Y=m5.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function QJ($,Z,Y){let X=m5.extname($).toLowerCase(),Q=YJ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&JJ($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function H6($,Z,Y,X){let Q=d5.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=m5.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;H6(G,Z,Y,X)}else if(J.isFile()){let K=d5.statSync(G),q=m5.relative(Z,G);if(QJ(q,K.size,Y)){let W=d5.readFileSync(G),U=XJ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function H1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!d5.existsSync($))return{entries:[],totalSize:0,fileCount:0};H6($,$,Y,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 u5($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:E$,getOwnPropertyNames:aX,getOwnPropertyDescriptor:tX}=Object,eX=Object.prototype.hasOwnProperty;function $J($){return this[$]}var _6=($)=>{var Z=(B6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=E$({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of aX($))if(!eX.call(Z,X))E$(Z,X,{get:$J.bind($,X),enumerable:!(Y=tX($,X))||Y.enumerable})}return B6.set($,Z),Z},B6;var ZJ=($)=>$;function YJ($,Z){this[$]=ZJ.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)E$($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:YJ.bind(Z,Y)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var G0=import.meta.require;import u5 from"fs";import l5 from"path";function QJ($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function GJ($,Z){let Y=l5.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function KJ($,Z,Y){let X=l5.extname($).toLowerCase(),Q=JJ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&GJ($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function V6($,Z,Y,X){let Q=u5.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;V6(G,Z,Y,X)}else if(J.isFile()){let K=u5.statSync(G),q=l5.relative(Z,G);if(KJ(q,K.size,Y)){let W=u5.readFileSync(G),U=QJ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function O1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!u5.existsSync($))return{entries:[],totalSize:0,fileCount:0};V6($,$,Y,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 p5($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function O6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var YJ;var J5=b(()=>{YJ={".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 GJ($){let Z={"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 Z[$]||Z["network-first"]}function E4($){return GJ($).className}function L6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=E4(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function w6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var JJ;var Q5=S(()=>{JJ={".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 qJ($){let Z={"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 Z[$]||Z["network-first"]}function k$($){return qJ($).className}function R6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=k$(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${W},
7
7
  ${U?`maxAgeSeconds: ${U},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(J.strategy==="network-first"||J.strategy==="stale-while-revalidate")K.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let q=KJ(J.pattern);Q.push(`
11
+ })`);let q=UJ(J.pattern);Q.push(`
12
12
  // ${J.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${J.cacheName||UJ(J.pattern)}',
16
+ cacheName: '${J.cacheName||zJ(J.pattern)}',
17
17
  ${K.length>0?`plugins: [
18
18
  ${K.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return Q.join(`
23
- `)}function KJ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${qJ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${WJ($).replace(/\\\*/g,".*")}')`}function qJ($){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 UJ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function WJ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var R6={};n(R6,{isWorkboxEnabled:()=>w6,getServiceWorkerGenerator:()=>HJ,generateWorkboxServiceWorker:()=>V6,generateWorkboxConfig:()=>F6});function F6($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(E4(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?H1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function V6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=F6($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?H1(Z,$):null,q=K?u5(K):"[]",W=zJ(X.modules),U=L6($);return`/**
23
+ `)}function UJ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${WJ(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${BJ($).replace(/\\\*/g,".*")}')`}function WJ($){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 zJ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function BJ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var M6={};o(M6,{isWorkboxEnabled:()=>T6,getServiceWorkerGenerator:()=>LJ,generateWorkboxServiceWorker:()=>N6,generateWorkboxConfig:()=>A6});function A6($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(k$(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?O1(Z,$):void 0;return{mode:"generate",modules:J,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function N6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=A6($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?O1(Z,$):null,q=K?p5(K):"[]",W=_J(X.modules),U=R6($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${J?.enabled?_J(J):"// Push notifications disabled"}
172
+ ${J?.enabled?HJ(J):"// Push notifications disabled"}
173
173
 
174
- ${G?.enabled?jJ(G):"// Background sync disabled"}
174
+ ${G?.enabled?OJ(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function zJ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${BJ(X)};`)}return Z.join(`
178
- `)}function BJ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function _J($){return`
177
+ `}function _J($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${jJ(X)};`)}return Z.join(`
178
+ `)}function jJ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function HJ($){return`
179
179
  // ============================================================================
180
180
  // Push Notifications
181
181
  // ============================================================================
@@ -244,7 +244,7 @@ self.addEventListener('notificationclick', (event) => {
244
244
  })
245
245
  );
246
246
  });
247
- `}function jJ($){return`
247
+ `}function OJ($){return`
248
248
  // ============================================================================
249
249
  // Background Sync
250
250
  // ============================================================================
@@ -306,7 +306,7 @@ self.addEventListener('message', (event) => {
306
306
  event.waitUntil(syncQueue.pushRequest({ request }));
307
307
  }
308
308
  });
309
- `}function w6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function HJ($){if(w6($))return V6;let{generateServiceWorker:Z}=(Q5(),U6(N6));return Z}var A6=b(()=>{J5()});var N6={};n(N6,{isWorkboxEnabled:()=>T6,getServiceWorkerFileName:()=>x1,generateServiceWorkerAuto:()=>FJ,generateServiceWorker:()=>l5});function l5($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,U=Y.cacheStorage,z=Z?H1(Z,$):null,B=z?u5(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function T6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function LJ($){if(T6($))return N6;let{generateServiceWorker:Z}=(G5(),_6(D6));return Z}var I6=S(()=>{Q5()});var D6={};o(D6,{isWorkboxEnabled:()=>E6,getServiceWorkerFileName:()=>g1,generateServiceWorkerAuto:()=>wJ,generateServiceWorker:()=>c5});function c5($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,U=Y.cacheStorage,z=Z?O1(Z,$):null,B=z?p5(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -320,7 +320,7 @@ self.addEventListener('message', (event) => {
320
320
  * Additional features:
321
321
  * - Push notifications: ${q?.enabled?"enabled":"disabled"}
322
322
  * - Background sync: ${W?.enabled?"enabled":"disabled"}
323
- * - Cache limits: ${U?.maxSize?`${O6(U.maxSize*1024*1024)}`:"unlimited"}
323
+ * - Cache limits: ${U?.maxSize?`${w6(U.maxSize*1024*1024)}`:"unlimited"}
324
324
  */
325
325
 
326
326
  const CACHE_VERSION = '${J}';
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?OJ():"// Push notifications disabled"}
504
+ ${q?.enabled?FJ():"// Push notifications disabled"}
505
505
 
506
- ${W?.enabled?LJ():"// Background sync disabled"}
506
+ ${W?.enabled?VJ():"// Background sync disabled"}
507
507
 
508
508
  /**
509
509
  * Check if a route should be excluded from caching
@@ -868,7 +868,7 @@ async function purgeByEntryCount(entries, cache, maxEntries) {
868
868
  }
869
869
 
870
870
  console.log('[SW] Service Worker loaded - Version:', CACHE_VERSION);
871
- `}function OJ(){return`
871
+ `}function FJ(){return`
872
872
  /**
873
873
  * Push event - handle incoming push notifications
874
874
  */
@@ -950,7 +950,7 @@ self.addEventListener('notificationclose', (event) => {
950
950
  // Could send analytics here
951
951
  }
952
952
  });
953
- `}function LJ(){return`
953
+ `}function VJ(){return`
954
954
  /**
955
955
  * Background sync queue storage (IndexedDB)
956
956
  */
@@ -1132,14 +1132,14 @@ self.addEventListener('message', (event) => {
1132
1132
  event.waitUntil(registerFormSync(event.data.payload));
1133
1133
  }
1134
1134
  });
1135
- `}function x1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function T6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function FJ($,Z){if(!$.pwa?.enabled)return"";if(T6($)){let{generateWorkboxServiceWorker:Y}=(A6(),U6(R6));return Y($,Z)}return l5($,Z)}var Q5=b(()=>{J5()});var M6={};n(M6,{injectPwaTags:()=>S4,generateThemeColorMeta:()=>RJ,generateSwRegistrationScript:()=>VJ,generatePwaTags:()=>p5,generateManifestLink:()=>wJ});function p5($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=x1($),J=`
1135
+ `}function g1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function E6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function wJ($,Z){if(!$.pwa?.enabled)return"";if(E6($)){let{generateWorkboxServiceWorker:Y}=(I6(),_6(M6));return Y($,Z)}return c5($,Z)}var G5=S(()=>{Q5()});var k6={};o(k6,{injectPwaTags:()=>S$,generateThemeColorMeta:()=>NJ,generateSwRegistrationScript:()=>RJ,generatePwaTags:()=>i5,generateManifestLink:()=>AJ});function i5($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=g1($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
- <meta name="theme-color" content="${k4(Y?.themeColor||"#000000")}">
1138
+ <meta name="theme-color" content="${b$(Y?.themeColor||"#000000")}">
1139
1139
  <meta name="mobile-web-app-capable" content="yes">
1140
1140
  <meta name="apple-mobile-web-app-capable" content="yes">
1141
1141
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
1142
- <meta name="apple-mobile-web-app-title" content="${k4(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
1142
+ <meta name="apple-mobile-web-app-title" content="${b$(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)J+=`
1143
1143
  <link rel="apple-touch-icon" href="${X}/apple-touch-icon.png">
1144
1144
  <link rel="apple-touch-icon" sizes="120x120" href="${X}/apple-touch-icon-120x120.png">
1145
1145
  <link rel="apple-touch-icon" sizes="152x152" href="${X}/apple-touch-icon-152x152.png">
@@ -1176,12 +1176,12 @@ if ('serviceWorker' in navigator) {
1176
1176
  });
1177
1177
  }
1178
1178
  </script>
1179
- <!-- End stx PWA -->`,J}function S4($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=p5(Z);return $.slice(0,Q)+J+`
1180
- `+$.slice(Q)}return $+p5(Z)}let X=p5(Z);return $.replace("</head>",`${X}
1181
- </head>`)}function VJ($){if(!$.pwa?.enabled)return"";return`<script>
1179
+ <!-- End stx PWA -->`,J}function S$($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=i5(Z);return $.slice(0,Q)+J+`
1180
+ `+$.slice(Q)}return $+i5(Z)}let X=i5(Z);return $.replace("</head>",`${X}
1181
+ </head>`)}function RJ($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
- navigator.serviceWorker.register('/${x1($)}')
1184
+ navigator.serviceWorker.register('/${g1($)}')
1185
1185
  .then(function(registration) {
1186
1186
  console.log('[PWA] Service Worker registered:', registration.scope);
1187
1187
  })
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function wJ(){return'<link rel="manifest" href="/manifest.json">'}function RJ($){return`<meta name="theme-color" content="${k4($)}">`}function k4($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var c5=b(()=>{Q5()});var j0;var D6=b(()=>{j0={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 E6($,Z,Y,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 k6,S6;var b4=b(()=>{k6={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},S6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function EJ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...r0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1193
+ </script>`}function AJ(){return'<link rel="manifest" href="/manifest.json">'}function NJ($){return`<meta name="theme-color" content="${b$($)}">`}function b$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var n5=S(()=>{G5()});var j0;var S6=S(()=>{j0={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 y6($,Z,Y,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 P6,C6;var y$=S(()=>{P6={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},C6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function bJ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...r0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1194
1194
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1195
1195
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${J==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1196
1196
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1200,7 +1200,7 @@ if ('serviceWorker' in navigator) {
1200
1200
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1201
1201
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${J==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(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);"}
1202
1202
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1203
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function kJ(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function SJ(){return`
1204
1204
  <script data-stx-scoped>
1205
1205
  // Motion preferences handling
1206
1206
  (function() {
@@ -1228,7 +1228,7 @@ else {
1228
1228
  });
1229
1229
  })();
1230
1230
  </script>
1231
- `}function SJ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function bJ($=0.1,Z="0px"){return`
1231
+ `}function yJ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test($))}function PJ($=0.1,Z="0px"){return`
1232
1232
  <script data-stx-scoped>
1233
1233
  // Intersection Observer for scroll animations
1234
1234
  (function() {
@@ -1271,7 +1271,7 @@ else {
1271
1271
  }
1272
1272
  })();
1273
1273
  </script>
1274
- `}function yJ(){return`
1274
+ `}function CJ(){return`
1275
1275
  <style id="stx-animation-base">
1276
1276
  :root {
1277
1277
  --stx-transition-duration: 300ms;
@@ -1386,7 +1386,7 @@ else {
1386
1386
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1387
1387
  }
1388
1388
  </style>
1389
- `}function PJ($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1389
+ `}function vJ($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1390
1390
  <script data-stx-scoped>
1391
1391
  // Animation Group: ${$}
1392
1392
  (function() {
@@ -1423,11 +1423,11 @@ else {
1423
1423
  }
1424
1424
  })();
1425
1425
  </script>
1426
- `}function v6($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!SJ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=yJ();Q=Q.replace("</head>",`${K}
1427
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=bJ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
- `+Q.slice(W)}}return Q}var r0,b6,y6,P6,C6;var y4=b(()=>{r0={duration:300,delay:0,ease:"ease",direction:"both"};b6={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||r0.duration:r0.duration,G=Z.length>2?Z[2]||r0.ease:r0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||r0.delay:r0.delay,q=Z.length>4?Z[4]||r0.direction:r0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=EJ(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${z} ${B} ${q==="out"?"stx-out":""}"
1429
- style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},y6={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},P6={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=PJ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},C6={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=kJ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as x6}from"stx-router";var f6=b(()=>{P4()});async function CJ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=x6();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var g6;var P4=b(()=>{f6();g6={name:"stxRouter",handler:CJ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function h6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...vJ,...Z};return`
1426
+ `}function h6($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!yJ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=CJ();Q=Q.replace("</head>",`${K}
1427
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=PJ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
+ `+Q.slice(W)}}return Q}var r0,v6,x6,f6,g6;var P$=S(()=>{r0={duration:300,delay:0,ease:"ease",direction:"both"};v6={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||r0.duration:r0.duration,G=Z.length>2?Z[2]||r0.ease:r0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||r0.delay:r0.delay,q=Z.length>4?Z[4]||r0.direction:r0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=bJ(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${z} ${B} ${q==="out"?"stx-out":""}"
1429
+ style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},x6={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},f6={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=vJ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},g6={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=SJ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as d6}from"stx-router";var m6=S(()=>{C$()});async function xJ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=d6();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var u6;var C$=S(()=>{m6();u6={name:"stxRouter",handler:xJ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function l6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...fJ,...Z};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,10 +1810,10 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function d6($,Z){let Y=h6(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function xJ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var vJ,m6;var C4=b(()=>{vJ={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};m6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=xJ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return h6(Q)}}});function $1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function u6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function l6($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
1814
- `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=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[W]=U}return{data:J,content:Q.trim()}}function G5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,B)=>{let _=J.length,j=z?` class="language-${$1(z)}"`:"";return J.push(`<pre><code${j}>${$1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${$1(z)}</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>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,B)=>{return`<img src="${u6(B)?$1(B):""}" alt="${$1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,B)=>{return`<a href="${u6(B)?$1(B):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
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>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,B)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${$1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
1816
- `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${$1(O)}</td>`).join("")}</tr>`}).join(`
1813
+ `}function p6($,Z){let Y=l6(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function gJ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var fJ,c6;var v$=S(()=>{fJ={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};c6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=gJ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return l6(Q)}}});function Z1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function i6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function n6($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
1814
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=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[W]=U}return{data:J,content:Q.trim()}}function K5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,B)=>{let _=J.length,j=z?` class="language-${Z1(z)}"`:"";return J.push(`<pre><code${j}>${Z1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${Z1(z)}</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>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,B)=>{return`<img src="${i6(B)?Z1(B):""}" alt="${Z1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,B)=>{return`<a href="${i6(B)?Z1(B):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
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>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,B)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${Z1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
1816
+ `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${Z1(O)}</td>`).join("")}</tr>`}).join(`
1817
1817
  `);return`<table>
1818
1818
  <thead>
1819
1819
  ${j}
@@ -1830,23 +1830,23 @@ ${H}
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 a0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import fJ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(fJ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var f1=()=>{};var i5={};n(i5,{hasUserImports:()=>gJ,bundleClientScript:()=>dJ});import W0 from"path";import v0 from"fs";function gJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!p6.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(/\.css(?:\?.*)?$/.test(G))continue;if(!p6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function hJ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:W0.dirname(J),q=W0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,W0.join(q,"index.ts"),W0.join(q,"index.tsx"),W0.join(q,"index.js"),W0.join(q,"index.mjs")];for(let U of W)try{if(v0.existsSync(U)&&v0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=W0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,W0.join(K,"index.ts"),W0.join(K,"index.tsx"),W0.join(K,"index.js"),W0.join(K,"index.mjs")];for(let W of q)if(v0.existsSync(W)&&v0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function dJ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||W0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=W0.join(J,`${K}.js`),W=W0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let R=Bun.file(W),A=!0;if(await R.exists())try{let N=JSON.parse(await R.text());for(let T of N.files)try{if(v0.statSync(T.path).mtimeMs!==T.mtimeMs){A=!1;break}}catch{A=!1;break}}catch{A=!1}if(A)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=W0.join(X,".stx","bundle-tmp"),B=W0.join(z,`${K}.ts`),_=W0.join(z,"out",K);v0.mkdirSync(z,{recursive:!0}),v0.mkdirSync(_,{recursive:!0});let j=W0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((R)=>{let A=R.split(":")[0].trim();if(A)H.push(A)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1834
- export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",W0.basename(Z));let w=new Set;try{let R=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[hJ(X,j,B,w)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!R.success){let M=R.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let A="";for(let M of R.outputs){A=await M.text();break}let N=[];for(let M of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])N.push([D[2],D[1]])}if(A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),N.length>0){let M=N.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");A+=`
1835
- var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),v0.mkdirSync(J,{recursive:!0}),await Bun.write(q,A);let T=Array.from(w).map((M)=>{try{return{path:M,mtimeMs:v0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),A}catch(R){let A=R instanceof Error?R.message:String(R),N=R?.errors,T=Array.isArray(N)&&N.length>0?`
1833
+ `}),$}import hJ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(hJ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var h1=()=>{};var o5={};o(o5,{hasUserImports:()=>dJ,bundleClientScript:()=>uJ});import z0 from"path";import x0 from"fs";function dJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!o6.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(/\.css(?:\?.*)?$/.test(G))continue;if(!o6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function mJ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:z0.dirname(J),q=z0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,z0.join(q,"index.ts"),z0.join(q,"index.tsx"),z0.join(q,"index.js"),z0.join(q,"index.mjs")];for(let U of W)try{if(x0.existsSync(U)&&x0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=z0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,z0.join(K,"index.ts"),z0.join(K,"index.tsx"),z0.join(K,"index.js"),z0.join(K,"index.mjs")];for(let W of q)if(x0.existsSync(W)&&x0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function uJ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||z0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=z0.join(J,`${K}.js`),W=z0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let R=Bun.file(W),A=!0;if(await R.exists())try{let N=JSON.parse(await R.text());for(let T of N.files)try{if(x0.statSync(T.path).mtimeMs!==T.mtimeMs){A=!1;break}}catch{A=!1;break}}catch{A=!1}if(A)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=z0.join(X,".stx","bundle-tmp"),B=z0.join(z,`${K}.ts`),_=z0.join(z,"out",K);x0.mkdirSync(z,{recursive:!0}),x0.mkdirSync(_,{recursive:!0});let j=z0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((R)=>{let A=R.split(":")[0].trim();if(A)H.push(A)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1834
+ export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",z0.basename(Z));let w=new Set;try{let R=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[mJ(X,j,B,w)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!R.success){let M=R.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let A="";for(let M of R.outputs){A=await M.text();break}let N=[];for(let M of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])N.push([D[2],D[1]])}if(A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),N.length>0){let M=N.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");A+=`
1835
+ var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),x0.mkdirSync(J,{recursive:!0}),await Bun.write(q,A);let T=Array.from(w).map((M)=>{try{return{path:M,mtimeMs:x0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),A}catch(R){let A=R instanceof Error?R.message:String(R),N=R?.errors,T=Array.isArray(N)&&N.length>0?`
1836
1836
  ${N.map((M)=>`- ${M?.message??M}`).join(`
1837
- `)}`:"";return console.warn(`[stx:bundler] error: ${A}${T}`),$}finally{try{v0.rmSync(B,{force:!0}),v0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var p6;var n5=b(()=>{f1();p6=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var o6={};n(o6,{renderVendorStyleTags:()=>n6,processClientScript:()=>U5,generateServerDataBridge:()=>o5,extractBridgeData:()=>q5,extractAndStripCssImports:()=>i6});import O1 from"path";import K5 from"fs";function uJ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function lJ($,Z){let Y=Z;while(!0){let X=O1.join(Y,"node_modules",$,"package.json");if(K5.existsSync(X))return O1.dirname(X);let Q=O1.dirname(Y);if(Q===Y)return null;Y=Q}}function pJ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function cJ($,Z){let Y=uJ($);if(!Y||!Y.subpath)return null;let X=lJ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(K5.readFileSync(O1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=pJ(Q.exports,J);if(!G)return null;let K=O1.resolve(X,G);return K5.existsSync(K)?K:null}function i6($,Z){let Y=Z.filePath?O1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(mJ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:O1.resolve(Y,q),!K5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=cJ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=K5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function iJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${iJ(Z.source)}" data-stx-layer="vendor">
1837
+ `)}`:"";return console.warn(`[stx:bundler] error: ${A}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var o6;var s5=S(()=>{h1();o6=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var t6={};o(t6,{renderVendorStyleTags:()=>a6,processClientScript:()=>W5,generateServerDataBridge:()=>r5,extractBridgeData:()=>U5,extractAndStripCssImports:()=>r6});import L1 from"path";import q5 from"fs";function pJ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function cJ($,Z){let Y=Z;while(!0){let X=L1.join(Y,"node_modules",$,"package.json");if(q5.existsSync(X))return L1.dirname(X);let Q=L1.dirname(Y);if(Q===Y)return null;Y=Q}}function iJ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function nJ($,Z){let Y=pJ($);if(!Y||!Y.subpath)return null;let X=cJ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(q5.readFileSync(L1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=iJ(Q.exports,J);if(!G)return null;let K=L1.resolve(X,G);return q5.existsSync(K)?K:null}function r6($,Z){let Y=Z.filePath?L1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(lJ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:L1.resolve(Y,q),!q5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=nJ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=q5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function oJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function a6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${oJ(Z.source)}" data-stx-layer="vendor">
1838
1838
  @layer vendor {
1839
1839
  ${Z.contents}
1840
1840
  }
1841
1841
  </style>`}).join(`
1842
1842
  `)}
1843
- `}function rJ($){let Z=new Set,Y=/\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=Y.exec($))!==null)if(!sJ.has(X[1]))Z.add(X[1]);return Array.from(Z)}function aJ($){let Z=new Set,Y=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],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of nJ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of oJ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=rJ(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function tJ($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1843
+ `}function tJ($){let Z=new Set,Y=/\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=Y.exec($))!==null)if(!aJ.has(X[1]))Z.add(X[1]);return Array.from(Z)}function eJ($){let Z=new Set,Y=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],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of sJ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of rJ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=tJ(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function $Q($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1844
1844
  ${Y.join(`
1845
1845
  `)}
1846
- `;return""}function q5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function o5($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1846
+ `;return""}function U5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function r5($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1847
1847
  ${Y.join(`
1848
1848
  `)}
1849
- `}function $Q($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=eJ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function ZQ($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=$Q(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(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function z(B){return`var scope = $el.closest('[data-stx-scope]');
1849
+ `}function YQ($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=ZQ[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function XQ($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=YQ(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(", ")} }`:"",W="";if(G)W+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function z(B){return`var scope = $el.closest('[data-stx-scope]');
1850
1850
  if (scope && scope.__stx_execute) {
1851
1851
  scope.__stx_execute('${U}', $event, $el);
1852
1852
  }
@@ -1882,11 +1882,11 @@ else {
1882
1882
  else {
1883
1883
  ${Q}
1884
1884
  }
1885
- }${q})`}function YQ($){if($.length===0)return"";return`
1885
+ }${q})`}function JQ($){if($.length===0)return"";return`
1886
1886
  // STX: auto-generated event bindings
1887
- ${$.map((Y,X)=>ZQ(Y,X)).join(`
1888
- `)}`}function c6($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1889
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}}G++}return Z}function JQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!XQ.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function U5($,Z={}){let Y=$,X="",Q=!1,J=i6(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=J.code;let G=n6(J.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (n5(),i5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=aJ(Y);Y=L.code,X=tJ(L.stxImports,L.browserImports)}if(X=`${o5(Y,Z.serverData)}${X}`,Y=a0(Y),!Q&&L1(Z.attrs||""))Y=F1(Y);let W=YQ(Z.eventBindings||[]),U=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
1887
+ ${$.map((Y,X)=>XQ(Y,X)).join(`
1888
+ `)}`}function s6($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1889
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}}G++}return Z}function GQ($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!QQ.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function W5($,Z={}){let Y=$,X="",Q=!1,J=r6(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=J.code;let G=a6(J.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (s5(),o5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=eJ(Y);Y=L.code,X=$Q(L.stxImports,L.browserImports)}if(X=`${r5(Y,Z.serverData)}${X}`,Y=a0(Y),!Q&&F1(Z.attrs||""))Y=V1(Y);let W=JQ(Z.eventBindings||[]),U=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let L=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
1890
1890
  ${X}${Y}
1891
1891
  ${W}
1892
1892
  </script>`}let B=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),_=/function __stx_setup_/.test(Y),j=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function H(L){let F=L.length>0?`
@@ -1895,12 +1895,12 @@ window.stx.mount(function() {
1895
1895
  'use strict';
1896
1896
  ${X}${Y}
1897
1897
  ${W}${F}
1898
- })</script>`}if(!j&&!_){if(B)return H(c6($));if(Z.templateContent){let L=c6($);if(L.length>0){let F=JQ(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
1898
+ })</script>`}if(!j&&!_){if(B)return H(s6($));if(Z.templateContent){let L=s6($);if(L.length>0){let F=GQ(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
1899
1899
  ;(function() {
1900
1900
  'use strict';
1901
1901
  ${X}${Y}
1902
1902
  ${W}
1903
- })()</script>`}var mJ,nJ,oJ,sJ,eJ,XQ;var W5=b(()=>{H0();mJ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;nJ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","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","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],oJ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],sJ=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"]);eJ={left:0,middle:1,right:2};XQ=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 qQ($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function UQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(GQ.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&t6.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function WQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!t6.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function s5($){let Z=$.trim(),Y=qQ(Z);UQ(Y,Z),WQ(Z);for(let X of a6)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!r6.allowBracketNotation&&KQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function zQ($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||a6.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=v4(X);else Z[Y]=X}return Z}function v4($,Z=0){if(Z>=r6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>v4(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=v4(Q,Z+1);else Y[X]=Q}return Y}function $0($,Z){try{let Y=zQ(Z),X=Object.keys(Y),Q=Object.values(Y);return Y0($,X)(...Q)}catch{return}}function Z0($){try{return s5($),!0}catch{return!1}}function O0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Y0($,Z){let Y=s5($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(e6.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1903
+ })()</script>`}var lJ,sJ,rJ,aJ,ZQ,QQ;var z5=S(()=>{H0();lJ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;sJ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","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","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],rJ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],aJ=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"]);ZQ={left:0,middle:1,right:2};QQ=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 WQ($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function zQ($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(qQ.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&Y9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function BQ($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!Y9.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function a5($){let Z=$.trim(),Y=WQ(Z);zQ(Y,Z),BQ(Z);for(let X of Z9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!$9.allowBracketNotation&&UQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function _Q($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||Z9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=x$(X);else Z[Y]=X}return Z}function x$($,Z=0){if(Z>=$9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>x$(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=x$(Q,Z+1);else Y[X]=Q}return Y}function $0($,Z){try{let Y=_Q(Z),X=Object.keys(Y),Q=Object.values(Y);return J0($,X)(...Q)}catch{return}}function X0($){try{return a5($),!0}catch{return!1}}function O0($,Z){try{let Y=$0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function J0($,Z){let Y=a5($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(X9.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1904
1904
  'use strict';
1905
1905
  try {
1906
1906
  return ${Y};
@@ -1911,7 +1911,7 @@ catch (e) {
1911
1911
  }
1912
1912
  throw e;
1913
1913
  }
1914
- `),K=G([]);if(J.length===Z.length)return s6(K,J,G);return s6((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function s6($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",_=J.exec(B);if(!(z instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||e6.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function r5($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var QQ,r6,a6,GQ,t6,KQ,e6;var L0=b(()=>{QQ={maxSanitizeDepth:10,allowBracketNotation:!1},r6={...QQ},a6=[/\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/],GQ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),t6=new Set(["__proto__","constructor","prototype"]),KQ=/[\w)\]]\s*\[\s*['"]/;e6=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 a5($,Z){let Y=BQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return _Q.set(X,{type:$,expression:Z}),X}var BQ=0,_Q;var $9=b(()=>{_Q=new Map});function Z9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function t5($,Z){return Z9($,Z,jQ,HQ)}function Y9($,Z){return Z9($,Z,OQ,LQ)}function X9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function z5($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let W=$[J];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;J++;continue}if(W==="<"){let U=Z($,J);if(U>J){Q+=Y($.slice(J,U),X.length),X.push($.slice(J,U)),J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=W,J++;continue}Q+=W,J++}return{output:Q,tokens:X}}function x4($){let{output:Z,tokens:Y}=z5($,t5,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function f4($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var jQ,HQ,OQ,LQ;var e5=b(()=>{jQ=/<script\b[^>]*>/iy,HQ=/<\/script\s*>/ig,OQ=/<style\b[^>]*>/iy,LQ=/<\/style\s*>/ig});var W9={};n(W9,{usesSignalsInScript:()=>g1,unescapeHtml:()=>g4,registerFilters:()=>VQ,registerFilter:()=>G9,processExpressions:()=>p0,interpolateScriptsInTemplate:()=>RQ,interpolateScriptExpressions:()=>q9,getAllFilters:()=>K9,evaluateExpression:()=>x0,escapeHtml:()=>g0,defaultFilters:()=>_5,clearCustomFilters:()=>wQ,applyFilters:()=>U9});function FQ($){let Z=J9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),J9.set($,Z)}return Z.lastIndex=0,Z}function G9($,Z){if($ in _5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);B5[$]=Z}function VQ($){for(let[Z,Y]of Object.entries($))G9(Z,Y)}function K9(){return{..._5,...B5}}function wQ(){for(let $ of Object.keys(B5))delete B5[$]}function g0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function g1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[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;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function Q9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++;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 W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function q9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=x0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function RQ($,Z,Y={}){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(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=q9(J,Z);return`<script${Q}>${G}</script>`})}function p0($,Z,Y,X){let Q=$,J=(U,z)=>{let B=Y9(U,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(z,B))?-1:B},G=(U,z,B,_)=>{let j=B.length,{output:H,tokens:L}=z5(U,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`);let q=[];Q=G(Q,t5,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=X?.forceSignals===!0||g1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,z,B)=>{try{let _=x0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,U)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(U,z,B)=>{try{let _=x0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return a5("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return a5("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,U)}}),Q=G(Q,t5,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(U,z,B)=>{let _=z.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=_.match(V),R=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let A=x0(z,Z);if(A===void 0&&W&&!Q9(_,Z))return U;if(A===void 0&&Z.__stx_buildMode==="compile"&&!W)return a5("expr",_);return A!==void 0&&A!==null?g0(String(A)):""}catch(A){if(W&&!Q9(_,Z))return U;if(R)return U;let N=A instanceof Error?A.message:String(A);return Q0("Expression",`Error evaluating: {{ ${_} }}: ${N}`,Y,$,B,U)}});for(let U=0;U<q.length;U++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>q[U]);for(let U=0;U<K.length;U++)Q=Q.replace(`<!--__STX_STYLE_${U}__-->`,()=>K[U]);return Q}function U9($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=B5[G]||_5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(K9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[x0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(j){if(_+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=w}if(_)B.push(_);q=B.map((V)=>{let w=V.trim();return x0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function AQ($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function x0($,Z,Y=!1){try{let X=$.trim(),Q=AQ(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=x0(J,Z,!0);return U9(K,G,Z)}if(!Z0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return $0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Y0(X,J)(...G)}catch{return $0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=NQ(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function NQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=TQ($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function TQ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function g4($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var B5,J9,_5;var c0=b(()=>{L0();H0();$9();e5();B5={},J9=new Map;_5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return g0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(FQ(q),String(W))}),K},t:($,Z,Y={})=>{return _5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});class j5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function d1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!h1.has(Y)){if(h1.size>=MQ){let X=h1.keys().next().value;if(X)h1.delete(X)}h1.set(Y,new RegExp($,Z))}return h1.get(Y)}class z9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1914
+ `),K=G([]);if(J.length===Z.length)return e6(K,J,G);return e6((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function e6($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",_=J.exec(B);if(!(z instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||X9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function t5($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var KQ,$9,Z9,qQ,Y9,UQ,X9;var L0=S(()=>{KQ={maxSanitizeDepth:10,allowBracketNotation:!1},$9={...KQ},Z9=[/\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/],qQ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),Y9=new Set(["__proto__","constructor","prototype"]),UQ=/[\w)\]]\s*\[\s*['"]/;X9=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 e5($,Z){let Y=jQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return HQ.set(X,{type:$,expression:Z}),X}var jQ=0,HQ;var J9=S(()=>{HQ=new Map});function Q9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function $4($,Z){return Q9($,Z,OQ,LQ)}function G9($,Z){return Q9($,Z,FQ,VQ)}function K9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function B5($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let W=$[J];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;J++;continue}if(W==="<"){let U=Z($,J);if(U>J){Q+=Y($.slice(J,U),X.length),X.push($.slice(J,U)),J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=W,J++;continue}Q+=W,J++}return{output:Q,tokens:X}}function f$($){let{output:Z,tokens:Y}=B5($,$4,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function g$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var OQ,LQ,FQ,VQ;var Z4=S(()=>{OQ=/<script\b[^>]*>/iy,LQ=/<\/script\s*>/ig,FQ=/<style\b[^>]*>/iy,VQ=/<\/style\s*>/ig});var j9={};o(j9,{usesSignalsInScript:()=>d1,unescapeHtml:()=>h$,registerFilters:()=>RQ,registerFilter:()=>W9,processExpressions:()=>p0,interpolateScriptsInTemplate:()=>NQ,interpolateScriptExpressions:()=>B9,getAllFilters:()=>z9,evaluateExpression:()=>f0,escapeHtml:()=>h0,defaultFilters:()=>j5,clearCustomFilters:()=>AQ,applyFilters:()=>_9});function wQ($){let Z=q9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),q9.set($,Z)}return Z.lastIndex=0,Z}function W9($,Z){if($ in j5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);_5[$]=Z}function RQ($){for(let[Z,Y]of Object.entries($))W9(Z,Y)}function z9(){return{...j5,..._5}}function AQ(){for(let $ of Object.keys(_5))delete _5[$]}function h0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function d1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[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;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function U9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++;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 W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function B9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=f0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=f0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function NQ($,Z,Y={}){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(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=B9(J,Z);return`<script${Q}>${G}</script>`})}function p0($,Z,Y,X){let Q=$,J=(U,z)=>{let B=G9(U,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(z,B))?-1:B},G=(U,z,B,_)=>{let j=B.length,{output:H,tokens:L}=B5(U,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`);let q=[];Q=G(Q,$4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=X?.forceSignals===!0||d1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,z,B)=>{try{let _=f0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,U)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(U,z,B)=>{try{let _=f0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return e5("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return e5("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,U)}}),Q=G(Q,$4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(U,z,B)=>{let _=z.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=_.match(V),R=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let A=f0(z,Z);if(A===void 0&&W&&!U9(_,Z))return U;if(A===void 0&&Z.__stx_buildMode==="compile"&&!W)return e5("expr",_);return A!==void 0&&A!==null?h0(String(A)):""}catch(A){if(W&&!U9(_,Z))return U;if(R)return U;let N=A instanceof Error?A.message:String(A);return K0("Expression",`Error evaluating: {{ ${_} }}: ${N}`,Y,$,B,U)}});for(let U=0;U<q.length;U++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>q[U]);for(let U=0;U<K.length;U++)Q=Q.replace(`<!--__STX_STYLE_${U}__-->`,()=>K[U]);return Q}function _9($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=_5[G]||j5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(z9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[f0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let w=z[V];if(O){_+=w,O=!1;continue}if(w==="\\"){_+=w,O=!0;continue}if(j){if(_+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,_+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=w}if(_)B.push(_);q=B.map((V)=>{let w=V.trim();return f0(w,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function TQ($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function f0($,Z,Y=!1){try{let X=$.trim(),Q=TQ(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=f0(J,Z,!0);return _9(K,G,Z)}if(!X0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return $0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return J0(X,J)(...G)}catch{return $0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=MQ(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function MQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=IQ($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function IQ($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function h$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var _5,q9,j5;var c0=S(()=>{L0();H0();J9();Z4();_5={},q9=new Map;j5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return h0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(wQ(q),String(W))}),K},t:($,Z,Y={})=>{return j5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});class H5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function u1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!m1.has(Y)){if(m1.size>=DQ){let X=m1.keys().next().value;if(X)m1.delete(X)}m1.set(Y,new RegExp($,Z))}return m1.get(Y)}class H9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1915
1915
  'use strict';
1916
1916
  try {
1917
1917
  return ${q};
@@ -1922,42 +1922,42 @@ catch (e) {
1922
1922
  }
1923
1923
  throw e;
1924
1924
  }
1925
- `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class B9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function IQ(){if(!h4)h4=new B9;return h4}var h1,MQ=500,D_,h4=null,_9;var m1=b(()=>{h1=new Map;D_=new z9;_9=new Proxy({},{get($,Z){return IQ()[Z]}})});function j9($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function H9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=d4($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;W.set(B,_)}}for(let U of K){let z=O9(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1925
+ `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class O9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function EQ(){if(!d$)d$=new O9;return d$}var m1,DQ=500,k_,d$=null,L9;var l1=S(()=>{m1=new Map;k_=new H9;L9=new Proxy({},{get($,Z){return EQ()[Z]}})});function F9($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function V9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=m$($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;W.set(B,_)}}for(let U of K){let z=w9(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1926
1926
 
1927
- `)}function d4($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,B]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=d4(B);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
1928
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function O9($,Z,Y,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 z=d4(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>O9(B,Z,Y,X,Q,J)).join(`
1927
+ `)}function m$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,B]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=m$(B);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
1928
+ `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function w9($,Z,Y,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 z=m$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>w9(B,Z,Y,X,Q,J)).join(`
1929
1929
  `);return`${G} {
1930
1930
  ${z}
1931
- }`}return`${G} { ${K} }`}let q=DQ(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function DQ($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(q)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`)}return J.join(", ")}function $$($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=j9(Z),X=`data-v-${Y}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=EQ(W,X),z=q.replace(/\bscoped\b/gi,"").trim(),B=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=kQ(Q,X),{html:Q,hasScoped:!0}}function EQ($,Z){return H9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function kQ($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var m4=()=>{};var L9=()=>{};function D0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var u4={};n(u4,{useTitle:()=>vQ,useSeoMeta:()=>Y$,usePageTitle:()=>vQ,useHead:()=>w1,resetHead:()=>yQ,renderHtmlAttrs:()=>fQ,renderHead:()=>xQ,renderBodyAttrs:()=>gQ,processTitleDirective:()=>mQ,processMetaDirective:()=>uQ,processHeadDirective:()=>dQ,getPageMeta:()=>bQ,getHead:()=>H5,definePageMeta:()=>CQ,applyHead:()=>hQ});function H5(){return Z1}function bQ(){return Z$}function yQ(){Z1={},SQ.length=0,Z$={}}function w1($){Z1=PQ(Z1,$)}function PQ($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function Y$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});w1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function CQ($){if(Z$={...Z$,...$},$.title||$.description)Y$({title:$.title,description:$.description})}function vQ($){let Z=typeof $==="function"?$():$;w1({title:Z})}function xQ($=Z1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${V1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${V1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${V1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${V1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${V1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1932
- `)}function fQ($=Z1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${V1(Y)}"`).join(" ")}function gQ($=Z1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${V1(Y)}"`).join(" ")}function V1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function hQ($=Z1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function dQ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1933
- `,""}),headContent:Z.trim()}}function mQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J;return w1({title:G}),""})}function uQ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W};return w1({meta:[z]}),""})}var Z1,SQ,Z$;var O5=b(()=>{Z1={},SQ=[],Z$={}});var X$={};n(X$,{stripTypeScript:()=>A9,hasVariables:()=>D9,extractVariables:()=>R1,extractScriptFromTemplate:()=>I9,convertToCommonJS:()=>p4});import u1 from"path";import L5 from"process";function lQ($){let Z=[],Y=0,X=$.split(`
1934
- `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...z)}}}}return[...new Set(Z)]}function A9($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];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((W)=>{let U=W.trim(),z=U.startsWith("..."),B=z?U.slice(3):U,_=-1,j=0;for(let R=0;R<B.length;R++)if(B[R]==="<")j++;else if(B[R]===">")j--;else if(B[R]===":"&&j===0){_=R;break}if(_===-1)return W;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){O=R;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let _=Z[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let B=Y(z);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1935
-
1936
- `),Z}async function R1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let S=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=S.transformSync(v)}catch{Q=A9($)}let J={exports:{}},G=J.exports,K=L5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!S.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S));for(let S of W)try{let v=u1.resolve(K,"node_modules",S),x=u1.join(v,"package.json"),g=JSON.parse(J0("fs").readFileSync(x,"utf8")),u=g.main||"index.js";if(g.exports){let s=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof s==="string")u=s;else if(s?.bun)u=s.bun;else if(s?.import)u=s.import;else if(s?.default)u=s.default}q[S]=await import(u1.resolve(v,u))}catch{}let U=(S)=>{if(q[S])return q[S];return J0(S)},z=Z.props||{},B=Object.assign((S)=>{if(!S)return z;let v={};for(let[x,g]of Object.entries(S)){let u=z[x];if(u!==void 0)v[x]=u;else if(typeof g==="function")v[x]=g();else v[x]=g}return v},z),_=(S)=>{if(!S)return z;let v={...z};for(let[x,g]of Object.entries(S)){let u=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[x]===void 0&&u.default!==void 0)v[x]=typeof u.default==="function"?u.default():u.default}return v},j=()=>Z.slots||{},H=(S,v)=>{let x={...S};for(let[g,u]of Object.entries(v))if(x[g]===void 0)if(typeof u==="function")x[g]=u();else x[g]=u;return x},L=(S)=>{let v=()=>S;return v.set=(x)=>{},v.update=(x)=>{},v},F=(S)=>{let v,x=!1;return()=>{if(!x)try{v=S(),x=!0}catch{v=void 0}return v}},O=(S)=>{},V=(S)=>S(),w=(S)=>{},R=(S)=>{},A=(S)=>{},N=()=>{let S=Z.__stxServeContext,v=Z.__stxServeSearch??S?.search??"",x=S?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:x,name:"",fullPath:x+v,hash:"",matched:[]}},T=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),M=(S)=>{w1(S);let v=Z.__stx_runtime_head||{},x=S||{};Z.__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||{}}}},I=(S)=>{Y$(S);let v=H5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},D=(S)=>({value:S}),E=(S)=>S,P=(S)=>({value:typeof S==="function"?S():S}),k=(S,v)=>{},y=(S)=>{},C=(S)=>{},d=(S)=>S?S():Promise.resolve(),f=(S)=>(v,...x)=>{},m=(S)=>{},o=(S,v)=>{},R0=(S,v)=>v,o0=()=>({value:"light"}),S0=()=>({value:!1}),I0={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:{}},e=new Proxy(I0,{get(S,v){if(v in S)return S[v];return},set(S,v,x){return S[v]=x,!0}}),_0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},U0=console;try{let S=p4(Q,Y),v=new Set(Object.keys(z)),x=Object.keys(Z).filter((t)=>!v.has(t)&&t!=="props"),g=x.map((t)=>Z[t]),u=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"]),s=[],G0=[];for(let[t,u0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(u.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(S))continue;s.push(t),G0.push(u0)}let b0=lQ(S).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
1937
- `),_1=Z.params??{},q0=[],j1=[];for(let t=0;t<x.length;t++){if(x[t]==="params")continue;q0.push(x[t]),j1.push(g[t])}let g5=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...s,...q0,`return (async () => {
1938
- ${S}
1939
- ${b0}
1931
+ }`}return`${G} { ${K} }`}let q=kQ(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function kQ($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(q)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`)}return J.join(", ")}function Y4($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=F9(Z),X=`data-v-${Y}`,Q=$,J=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=bQ(W,X),z=q.replace(/\bscoped\b/gi,"").trim(),B=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=SQ(Q,X),{html:Q,hasScoped:!0}}function bQ($,Z){return V9($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function SQ($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var u$=()=>{};var R9=()=>{};function D0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var l$={};o(l$,{useTitle:()=>fQ,useSeoMeta:()=>J4,usePageTitle:()=>fQ,useHead:()=>R1,resetHead:()=>CQ,renderHtmlAttrs:()=>hQ,renderHead:()=>gQ,renderBodyAttrs:()=>dQ,processTitleDirective:()=>lQ,processMetaDirective:()=>pQ,processHeadDirective:()=>uQ,getPageMeta:()=>PQ,getHead:()=>O5,definePageMeta:()=>xQ,applyHead:()=>mQ});function O5(){return Y1}function PQ(){return X4}function CQ(){Y1={},yQ.length=0,X4={}}function R1($){Y1=vQ(Y1,$)}function vQ($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function J4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});R1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function xQ($){if(X4={...X4,...$},$.title||$.description)J4({title:$.title,description:$.description})}function fQ($){let Z=typeof $==="function"?$():$;R1({title:Z})}function gQ($=Y1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${w1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${w1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${w1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${w1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${w1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1932
+ `)}function hQ($=Y1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${w1(Y)}"`).join(" ")}function dQ($=Y1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${w1(Y)}"`).join(" ")}function w1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function mQ($=Y1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function uQ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1933
+ `,""}),headContent:Z.trim()}}function lQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J;return R1({title:G}),""})}function pQ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W};return R1({meta:[z]}),""})}var Y1,yQ,X4;var L5=S(()=>{Y1={},yQ=[],X4={}});var Q4={};o(Q4,{stripTypeScript:()=>I9,hasVariables:()=>S9,extractVariables:()=>A1,extractScriptFromTemplate:()=>b9,convertToCommonJS:()=>c$});import p1 from"path";import F5 from"process";function cQ($){let Z=[],Y=0,X=$.split(`
1934
+ `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...z)}}}}return[...new Set(Z)]}function I9($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];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((W)=>{let U=W.trim(),z=U.startsWith("..."),B=z?U.slice(3):U,_=-1,j=0;for(let R=0;R<B.length;R++)if(B[R]==="<")j++;else if(B[R]===">")j--;else if(B[R]===":"&&j===0){_=R;break}if(_===-1)return W;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){O=R;break}let w=z?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let _=Z[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let B=Y(z);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
1935
+
1936
+ `),Z}async function A1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=v.transformSync(f)}catch{Q=I9($)}let J={exports:{}},G=J.exports,K=F5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let f=p1.resolve(K,"node_modules",v),y=p1.join(f,"package.json"),x=JSON.parse(G0("fs").readFileSync(y,"utf8")),u=x.main||"index.js";if(x.exports){let l=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof l==="string")u=l;else if(l?.bun)u=l.bun;else if(l?.import)u=l.import;else if(l?.default)u=l.default}q[v]=await import(p1.resolve(f,u))}catch{}let U=(v)=>{if(q[v])return q[v];return G0(v)},z=Z.props||{},B=(v)=>{if(!v)return z;let f={};for(let[y,x]of Object.entries(v)){let u=z[y];if(u!==void 0)f[y]=u;else if(typeof x==="function")f[y]=x();else f[y]=x}return f};for(let[v,f]of Object.entries(z))Object.defineProperty(B,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let _=(v)=>{if(!v)return z;let f={...z};for(let[y,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[y]===void 0&&u.default!==void 0)f[y]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let y={...v};for(let[x,u]of Object.entries(f))if(y[x]===void 0)if(typeof u==="function")y[x]=u();else y[x]=u;return y},L=(v)=>{let f=()=>v;return f.set=(y)=>{},f.update=(y)=>{},f},F=(v)=>{let f,y=!1;return()=>{if(!y)try{f=v(),y=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),w=(v)=>{},R=(v)=>{},A=(v)=>{},N=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",y=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:y,name:"",fullPath:y+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{R1(v);let f=Z.__stx_runtime_head||{},y=v||{};Z.__stx_runtime_head={...f,...y.title&&{title:y.title},meta:[...f.meta||[],...y.meta||[]],link:[...f.link||[],...y.link||[]],script:[...f.script||[],...y.script||[]],htmlAttrs:{...f.htmlAttrs||{},...y.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...y.bodyAttrs||{}}}},I=(v)=>{J4(v);let f=O5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},D=(v)=>({value:v}),E=(v)=>v,C=(v)=>({value:typeof v==="function"?v():v}),b=(v,f)=>{},k=(v)=>{},P=(v)=>{},d=(v)=>v?v():Promise.resolve(),g=(v)=>(f,...y)=>{},m=(v)=>{},s=(v,f)=>{},Z0=(v,f)=>f,o0=()=>({value:"light"}),P0=()=>({value:!1}),T0={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:{}},e=new Proxy(T0,{get(v,f){if(f in v)return v[f];return},set(v,f,y){return v[f]=y,!0}}),M0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},C0=console;try{let v=c$(Q,Y),f=new Set(Object.keys(z)),y=Object.keys(Z).filter((r)=>!f.has(r)&&r!=="props"),x=y.map((r)=>Z[r]),u=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"]),l=[],Y0=[];for(let[r,H1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r))continue;if(u.has(r))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${r}\\b`).test(v))continue;l.push(r),Y0.push(H1)}let I0=cQ(v).map((r)=>`module.exports.${r} = typeof ${r} !== 'undefined' ? ${r} : module.exports.${r};`).join(`
1937
+ `),f1=Z.params??{},v0=[],$1=[];for(let r=0;r<y.length;r++){if(y[r]==="params")continue;v0.push(y[r]),$1.push(x[r])}let j1=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...l,...v0,`return (async () => {
1938
+ ${v}
1939
+ ${I0}
1940
1940
  return module.exports
1941
- })()`)(J,G,U,z,B,_,H,L,F,O,V,w,R,A,N,T,M,I,D,E,P,k,y,C,d,f,m,j,o,R0,o0,S0,e,_0,U0,I0.confirm,I0.alert,I0.fetch,_1,...G0,...j1);if(X.preserveExisting){for(let[t,u0]of Object.entries(g5))if(!(t in Z)||Z[t]===void 0)Z[t]=u0}else Object.assign(Z,g5);for(let[t,u0]of Object.entries(z))if(!(t in Z))Z[t]=u0}catch(S){if(L5.env.STX_DEBUG){let v=S instanceof Error?S.message:String(S);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await oQ(Q,Z,Y)}catch(v){if(L5.env.STX_DEBUG){let x=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function p4($,Z){let Y=Z?u1.dirname(Z):L5.cwd(),X=$.split(`
1942
- `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let U=null,z=!1,B=X[W];for(let _=0;_<B.length;_++){let j=B[_];if(z){z=!1;continue}if(j==="\\"){z=!0;continue}if(U){if(j===U)U=null;continue}if(j==='"'||j==="'"||j==="`"){U=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),U=(z)=>{if(z.startsWith("."))return u1.resolve(Y,z);return z};if(K){let[,z,B]=K,_=U(B);Q.push(`const ${z} = await import('${_}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,B]=q,_=z.trim(),j=U(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let z=U(W[1]);Q.push(`await import('${z}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=F9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=l4(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=F9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=l4(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=l4(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),U=0,z=J;for(;z<X.length;z++){let B=X[z];for(let _ of B)if(_==="{")U++;else if(_==="}")U--;if(z>J)W+=`
1943
- `+B;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+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 pQ(Q.join(`
1944
- `),Y)}function pQ($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1945
- `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=cQ($,Q);if(z){let{quote:B,path:_,end:j}=z;if(_.startsWith(".")){let H=u1.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=W,Q++}return X}function cQ($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function N9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=D0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function T9($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=N9(Y,X);if(K){let q=T9(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function F9($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=Y.slice(W[0].length),z=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let _=U.startsWith("{")?"}":"]",j=U;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),z=H,$[H].includes(_))break;U=j}let B=N9(U,0);if(B){let _=W[1],j=B.pattern,H=U.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(z,Z);if(V9(L)){let A=w9($,O,L);F=A.value,O=A.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=T9(j),w=`__stx_src_${Z}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
1941
+ })()`)(J,G,U,z,B,_,H,L,F,O,V,w,R,A,N,T,M,I,D,E,C,b,k,P,d,g,m,j,s,Z0,o0,P0,e,M0,C0,T0.confirm,T0.alert,T0.fetch,f1,...Y0,...$1);if(X.preserveExisting){for(let[r,H1]of Object.entries(j1))if(!(r in Z)||Z[r]===void 0)Z[r]=H1}else Object.assign(Z,j1);for(let[r,H1]of Object.entries(z))if(!(r in Z))Z[r]=H1}catch(v){if(F5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await rQ(Q,Z,Y)}catch(f){if(F5.env.STX_DEBUG){let y=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${y}`)}}}}function c$($,Z){let Y=Z?p1.dirname(Z):F5.cwd(),X=$.split(`
1942
+ `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let U=null,z=!1,B=X[W];for(let _=0;_<B.length;_++){let j=B[_];if(z){z=!1;continue}if(j==="\\"){z=!0;continue}if(U){if(j===U)U=null;continue}if(j==='"'||j==="'"||j==="`"){U=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),U=(z)=>{if(z.startsWith("."))return p1.resolve(Y,z);return z};if(K){let[,z,B]=K,_=U(B);Q.push(`const ${z} = await import('${_}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,B]=q,_=z.trim(),j=U(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let z=U(W[1]);Q.push(`await import('${z}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=A9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=p$(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=A9(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=p$(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=p$(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),U=0,z=J;for(;z<X.length;z++){let B=X[z];for(let _ of B)if(_==="{")U++;else if(_==="}")U--;if(z>J)W+=`
1943
+ `+B;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+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 iQ(Q.join(`
1944
+ `),Y)}function iQ($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1945
+ `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=nQ($,Q);if(z){let{quote:B,path:_,end:j}=z;if(_.startsWith(".")){let H=p1.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=W,Q++}return X}function nQ($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function D9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=D0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function E9($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=D9(Y,X);if(K){let q=E9(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function A9($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=Y.slice(W[0].length),z=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let _=U.startsWith("{")?"}":"]",j=U;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),z=H,$[H].includes(_))break;U=j}let B=D9(U,0);if(B){let _=W[1],j=B.pattern,H=U.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(z,Z);if(N9(L)){let A=T9($,O,L);F=A.value,O=A.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=E9(j),w=`__stx_src_${Z}`,R=V.map((A)=>`module.exports.${A} = ${A};`).join(`
1946
1946
  `);return{type:_,name:w,value:`${F}; ${_} ${j} = ${w};
1947
- ${R}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(V9(G)){let W=w9($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
1948
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function l4($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(iQ(Y)){let K=nQ($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function V9($){let Z=$.trim();if(Z.startsWith("{"))return D0(Z,"{","}",0)===-1;if(Z.startsWith("["))return D0(Z,"[","]",0)===-1;return!M9(Z)}function M9($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function iQ($){let Z=$.indexOf("{");if(Z===-1)return!0;return D0($,"{","}",Z)===-1}function w9($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!M9(X)){let J=$[Q];X+=`
1947
+ ${R}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(N9(G)){let W=T9($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
1948
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function p$($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(oQ(Y)){let K=sQ($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function N9($){let Z=$.trim();if(Z.startsWith("{"))return D0(Z,"{","}",0)===-1;if(Z.startsWith("["))return D0(Z,"[","]",0)===-1;return!k9(Z)}function k9($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function oQ($){let Z=$.indexOf("{");if(Z===-1)return!0;return D0($,"{","}",Z)===-1}function T9($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!k9(X)){let J=$[Q];X+=`
1949
1949
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1950
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function nQ($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(D0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1951
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function R9($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...L5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function oQ($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=R9(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=R9(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function I9($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function D9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var F5=b(()=>{O5();f1();L0()});var y9={};n(y9,{renderSlot:()=>k9,processSlots:()=>b9,parseSlots:()=>E9,parseSlotElement:()=>rQ,extractSlotContent:()=>eQ,applySlots:()=>$G});function sQ($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function E9($){let Z={default:"",named:new Map},Y=$,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,z,B,_,j]=J,H=z||B||_,L=J.index+U.length,F=sQ($,L);if(F!==-1){let O=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}Q.sort((U,z)=>z.start-U.start);for(let U of Q)Y=Y.slice(0,U.start)+Y.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[U,z,B,_,j,H]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${z}${O?" "+O:""}>${H}</${z}>`;G.push({start:q.index,end:q.index+U.length,slotName:_,element:V})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=W.exec(Y))!==null){let[U,z,B,_,j]=q,H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${z}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+U.length,slotName:_,element:O})}G.sort((U,z)=>z.start-U.start);for(let U of G){let z=Z.named.get(U.slotName);if(z)z.content+=U.element;else Z.named.set(U.slotName,{name:U.slotName,content:U.element});Y=Y.slice(0,U.start)+Y.slice(U.end)}return Z.default=Y.trim(),Z}function rQ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[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:Y,props:X,defaultContent:K}}async function k9($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).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[W,U]=q.split(":").map((B)=>B.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=aQ(Q,G)}return Q}function aQ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=S9(Q,Z);return g0(String(J??""))}catch{return`{{ ${X} }}`}})}function S9($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[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(!Z0($))return;return Y0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function b9($,Z,Y){let X=$;X=await tQ(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=S9(F,Y)}return await k9(U,_,z,Y)});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 Z.default||q}),X}async function tQ($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(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:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function eQ($){let Z=E9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function $G($,Z,Y,X){return await b9($,{default:Z,named:Y},X)}var P9=b(()=>{c0();L0()});import ZG from"fs";import h from"path";function C9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function XG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function L1($){return!XG($)}function F1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function JG($){let Z=[],Y=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++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
1952
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function QG($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function GG($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function KG($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of QG(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=GG(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=W.slice(U+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[z]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function v9($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?h.resolve(Q.root):void 0,z=U??h.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(h.join(h.dirname(j),"components"));_(Z),_(h.join(h.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(U)_(h.resolve(U,"resources/views/components")),_(h.resolve(U,"resources/components")),_(h.resolve(U,"src/components")),_(h.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return c(h.resolve(h.dirname(X),`${J}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of W)if(await c(h.join(F,O)))return!0}return!1}function qG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function A1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (F5(),X$)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&qG(B)?B:"";try{let j=(S)=>S.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),H=(S)=>S.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let S=[L,L.toLowerCase(),j(L),H(L)];for(let v of S)if(O.has(v)){F=O.get(v);break}}let V=[];if(!F){let S=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],v=[...new Set(S)],x=Q.__originalFilePath,g=[];if(x){let q0=h.join(h.dirname(x),"components");g.push(q0)}if(X)g.push(X);let u=h.join(h.dirname(J),"components");if(!g.includes(u))g.push(u);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let s=G._pluginComponentDirs;if(Array.isArray(s)){for(let q0 of s)if(typeof q0==="string"&&!g.includes(q0))g.push(q0)}let G0=typeof G.root==="string"?h.resolve(G.root):void 0,A0=G0??h.dirname(J),b0=[];if(G0)b0.push(h.resolve(G0,"resources/views/components")),b0.push(h.resolve(G0,"resources/components")),b0.push(h.resolve(G0,"src/components")),b0.push(h.resolve(G0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let q0 of b0)if(!g.includes(q0))g.push(q0);let _1=[...new Set(g.map((q0)=>{if(!q0)return q0;return h.isAbsolute(q0)?q0:h.resolve(A0,q0)}))];if(g.length=0,g.push(..._1),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(J),`${L}.stx`),V.push(F);else for(let q0 of g){if(!q0)continue;for(let j1 of v){let X5=h.join(q0,j1);if(V.push(X5),await c(X5)){F=X5;break}}if(F)break;if(!F)try{let j1=await import("fs");if(!j1.statSync(q0,{throwIfNoEntry:!1})?.isDirectory())continue;let g5=8,t=[{path:q0,depth:0}];while(t.length>0&&!F){let u0=t.pop();if(u0.depth>=g5)continue;let M4;try{M4=j1.readdirSync(u0.path,{withFileTypes:!0})}catch{continue}for(let h5 of M4){if(!h5.isDirectory())continue;if(h5.name==="node_modules"||h5.name.startsWith("."))continue;let K6=h.join(u0.path,h5.name);for(let oX of v){let I4=h.join(K6,oX);if(V.push(I4),await c(I4)){F=I4;break}}if(F)break;t.push({path:K6,depth:u0.depth+1})}}}catch{}if(F)break}}if(!F||!await c(F)){let S=V.length>0?`
1950
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function sQ($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(D0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1951
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function M9($,Z){let Y=$0($,Z)??$0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...F5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function rQ($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=M9(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=M9(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function b9($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function S9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var V5=S(()=>{L5();h1();L0()});var i$={};o(i$,{renderSlot:()=>P9,processSlots:()=>v9,parseSlots:()=>y9,parseSlotElement:()=>tQ,extractSlotContent:()=>ZG,applySlots:()=>YG});function aQ($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function y9($){let Z={default:"",named:new Map},Y=$,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,z,B,_,j]=J,H=z||B||_,L=J.index+U.length,F=aQ($,L);if(F!==-1){let O=$.slice(L,F-11).trim();Q.push({start:J.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}Q.sort((U,z)=>z.start-U.start);for(let U of Q)Y=Y.slice(0,U.start)+Y.slice(U.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[U,z,B,_,j,H]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${z}${O?" "+O:""}>${H}</${z}>`;G.push({start:q.index,end:q.index+U.length,slotName:_,element:V})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=W.exec(Y))!==null){let[U,z,B,_,j]=q,H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${z}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+U.length,slotName:_,element:O})}G.sort((U,z)=>z.start-U.start);for(let U of G){let z=Z.named.get(U.slotName);if(z)z.content+=U.element;else Z.named.set(U.slotName,{name:U.slotName,content:U.element});Y=Y.slice(0,U.start)+Y.slice(U.end)}return Z.default=Y.trim(),Z}function tQ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[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:Y,props:X,defaultContent:K}}async function P9($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).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[W,U]=q.split(":").map((B)=>B.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=eQ(Q,G)}return Q}function eQ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=C9(Q,Z);return h0(String(J??""))}catch{return`{{ ${X} }}`}})}function C9($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[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(!X0($))return;return J0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function v9($,Z,Y){let X=$;X=await $G(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=C9(F,Y)}return await P9(U,_,z,Y)});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 Z.default||q}),X}async function $G($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(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:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function ZG($){let Z=y9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function YG($,Z,Y,X){return await v9($,{default:Z,named:Y},X)}var n$=S(()=>{c0();L0()});import XG from"fs";import h from"path";function x9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function QG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function F1($){return!QG($)}function V1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function GG($){let Z=[],Y=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++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
1952
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function KG($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function qG($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function UG($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of KG(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=qG(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=W.slice(U+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[z]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function f9($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?h.resolve(Q.root):void 0,z=U??h.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(h.join(h.dirname(j),"components"));_(Z),_(h.join(h.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(U)_(h.resolve(U,"resources/views/components")),_(h.resolve(U,"resources/components")),_(h.resolve(U,"src/components")),_(h.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return i(h.resolve(h.dirname(X),`${J}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of W)if(await i(h.join(F,O)))return!0}return!1}function WG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function N1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (V5(),Q4)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&WG(B)?B:"";try{let j=(y)=>y.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(y)=>y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let y=[L,L.toLowerCase(),j(L),H(L)];for(let x of y)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let y=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(y)],u=Q.__originalFilePath,l=[];if(u){let W0=h.join(h.dirname(u),"components");l.push(W0)}if(X)l.push(X);let Y0=h.join(h.dirname(J),"components");if(!l.includes(Y0))l.push(Y0);if(G.componentsDir&&G.componentsDir!==X&&!l.includes(G.componentsDir))l.push(G.componentsDir);let q0=G._pluginComponentDirs;if(Array.isArray(q0)){for(let W0 of q0)if(typeof W0==="string"&&!l.includes(W0))l.push(W0)}let I0=typeof G.root==="string"?h.resolve(G.root):void 0,f1=I0??h.dirname(J),v0=[];if(I0)v0.push(h.resolve(I0,"resources/views/components")),v0.push(h.resolve(I0,"resources/components")),v0.push(h.resolve(I0,"src/components")),v0.push(h.resolve(I0,"components"));v0.push(h.resolve(import.meta.dir,"components"));for(let W0 of v0)if(!l.includes(W0))l.push(W0);let $1=[...new Set(l.map((W0)=>{if(!W0)return W0;return h.isAbsolute(W0)?W0:h.resolve(f1,W0)}))];if(l.length=0,l.push(...$1),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(J),`${L}.stx`),V.push(F);else for(let W0 of l){if(!W0)continue;for(let j1 of x){let r=h.join(W0,j1);if(V.push(r),await i(r)){F=r;break}}if(F)break;if(!F)try{let j1=await import("fs");if(!j1.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let H1=8,h5=[{path:W0,depth:0}];while(h5.length>0&&!F){let d5=h5.pop();if(d5.depth>=H1)continue;let W6;try{W6=j1.readdirSync(d5.path,{withFileTypes:!0})}catch{continue}for(let m5 of W6){if(!m5.isDirectory())continue;if(m5.name==="node_modules"||m5.name.startsWith("."))continue;let z6=h.join(d5.path,m5.name);for(let rX of x){let D$=h.join(z6,rX);if(V.push(D$),await i(D$)){F=D$;break}}if(F)break;h5.push({path:z6,depth:d5.depth+1})}}}catch{}if(F)break}}if(!F||!await i(F)){let y=V.length>0?`
1953
1953
  Searched paths:
1954
- ${V.map((v)=>` - ${v}`).join(`
1955
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${S}`}q.add(F);let w;if(c4.has(F))w=c4.get(F);else try{w=await Bun.file(F).text(),c4.set(F,w)}catch(S){return`[Error loading component: ${S instanceof Error?S.message:String(S)}]`}let R=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[S,v]of Object.entries(Q))if(!S.startsWith("__")||R.has(S))A[S]=v;let N={...A,...Z,props:Z,slot:Y,__processedComponents:z,__sections:{}};KG(w,N);let T=w,M=T.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(M)T=M[1].trim();let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(I)],E=[];for(let S of D){let v=S[1]||"",x=S[2]||"",g=v.includes("server");if(L1(v)&&x.trim())x=F1(x);if(g&&x)try{await W(x,N,F)}catch(s){}if(!g){let s=x.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(s.includes("{{")&&s.includes("}}"))s=p0(s,N,F);let G0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");E.push(`<script${G0}>${s}</script>`)}}let P=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k=P?P[1]:"",y=P?P[2]:"",C="",d=k&&/\bscoped\b/i.test(k);if(P)C=`<style${k}>${y}</style>`;let f=T;if(f=f.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),P)f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let S=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(f=f.replace(S,(x,g)=>{let u=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(u)v.push(`<style${u[1]}>${u[2]}</style>`);return""}),f=f.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)C=`${C}${v.join(`
1956
- `)}`}if(Y&&f.includes("{{ text || slot }}"))f=f.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:m,applySlots:o}=await Promise.resolve().then(() => (P9(),y9)),{defaultSlot:R0,namedSlots:o0}=m(Y);f=await o(f,R0||Y,o0,N);for(let[S,v]of Object.entries(N))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let x=g4(v);N[S]=x}}let S0=E.some((S)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(S)),I0={...G,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:S0,defaultLayout:void 0};N.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let e=await F0(f,N,F,I0,q),_0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++YG}_${Math.random().toString(36).slice(2,8)}`,U0=e;if(S0){let S="";if(Object.keys(Z).length>0)try{S=` data-stx-props="${C9(JSON.stringify(Z))}"`}catch{}let v=_?` stx-hydrate="${C9(_)}"`:"";if(U0=`<div data-stx-scope="${_0}"${S}${v}>${e}</div>`,U0=E.map((g)=>{let u=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!u)return g;let[,s,G0]=u,A0=a0(G0),b0=`
1954
+ ${V.map((x)=>` - ${x}`).join(`
1955
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${y}`}q.add(F);let w;if(o$.has(F))w=o$.get(F);else try{w=await Bun.file(F).text(),o$.set(F,w)}catch(y){return`[Error loading component: ${y instanceof Error?y.message:String(y)}]`}let R=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[y,x]of Object.entries(Q))if(!y.startsWith("__")||R.has(y))A[y]=x;let{extractSlotContent:N}=await Promise.resolve().then(() => (n$(),i$)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[y,x]of T.namedSlots)M[y]=x.content;let I={...A,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{}};UG(w,I);let D=w,E=D.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)D=E[1].trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(C)],k=[];for(let y of b){let x=y[1]||"",u=y[2]||"",l=x.includes("server");if(F1(x)&&u.trim())u=V1(u);if(l&&u)try{await W(u,I,F)}catch(q0){}if(!l){let q0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(q0.includes("{{")&&q0.includes("}}"))q0=p0(q0,I,F);let I0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${I0}>${q0}</script>`)}}let P=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d=P?P[1]:"",g=P?P[2]:"",m="",s=d&&/\bscoped\b/i.test(d);if(P)m=`<style${d}>${g}</style>`;let Z0=D;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),P)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let y=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(Z0=Z0.replace(y,(u,l)=>{let Y0=l.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Y0)x.push(`<style${Y0[1]}>${Y0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
1956
+ `)}`}if(Y&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:o0}=await Promise.resolve().then(() => (n$(),i$)),{defaultSlot:P0,namedSlots:T0}=T;Z0=await o0(Z0,P0||Y,T0,I);for(let[y,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=h$(x);I[y]=u}}let e=k.some((y)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(y)),M0={...G,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:e,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let C0=await F0(Z0,I,F,M0,q),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++JG}_${Math.random().toString(36).slice(2,8)}`,f=C0;if(e){let y="";if(Object.keys(Z).length>0)try{y=` data-stx-props="${x9(JSON.stringify(Z))}"`}catch{}let x=_?` stx-hydrate="${x9(_)}"`:"";if(f=`<div data-stx-scope="${v}"${y}${x}>${C0}</div>`,f=k.map((l)=>{let Y0=l.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Y0)return l;let[,q0,I0]=Y0,f1=a0(I0),v0=`
1957
1957
  (function() {
1958
1958
  const { state, derived, effect, batch, defineEmits, defineExpose, defineSlots, defineProps, withDefaults, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, inject, ref, reactive, computed, watch, watchEffect, nextTick } = window.stx;
1959
1959
  const __scope = window.stx._scopes = window.stx._scopes || {};
1960
- const __scopeVars = __scope['${_0}'] = __scope['${_0}'] || {};
1960
+ const __scopeVars = __scope['${v}'] = __scope['${v}'] || {};
1961
1961
 
1962
1962
  // Scope-specific lifecycle callbacks
1963
1963
  __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
@@ -1965,39 +1965,39 @@ ${V.map((v)=>` - ${v}`).join(`
1965
1965
  const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
1966
1966
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
1967
1967
 
1968
- ${A0}
1968
+ ${f1}
1969
1969
 
1970
1970
  // Register all defined signals and functions in this scope
1971
1971
  const __localVars = {};
1972
1972
  try {
1973
- ${JG(A0).map((_1)=>`if (typeof ${_1} !== 'undefined') __localVars['${_1}'] = ${_1};`).join(`
1973
+ ${GG(f1).map(($1)=>`if (typeof ${$1} !== 'undefined') __localVars['${$1}'] = ${$1};`).join(`
1974
1974
  `)}
1975
1975
  }
1976
1976
  catch (e) {}
1977
1977
  Object.assign(__scopeVars, __localVars);
1978
- })();`;if(_)return`<script type="stx/island" data-stx-island="${_0}" data-stx-scoped${s}>${b0}</script>`;return`<script data-stx-scoped${s}>${b0}</script>`}).join(`
1978
+ })();`;if(_)return`<script type="stx/island" data-stx-island="${v}" data-stx-scoped${q0}>${v0}</script>`;return`<script data-stx-scoped${q0}>${v0}</script>`}).join(`
1979
1979
  `)+`
1980
- `+U0,C)U0+=`
1981
- `+C}else{if(C)U0+=`
1982
- `+C;if(E.length>0){let S=N.__stx_event_bindings||[],v=q5(N),x=await Promise.all(E.map(async(g)=>{let u=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!u)return g;return await U5(u[1],{eventBindings:S,templateContent:U0,filePath:F,projectRoot:process.cwd(),serverData:v})}));U0+=`
1983
- `+x.join(`
1984
- `),N.__stx_event_bindings=[]}}if(d){let S=$$(U0,F);if(S.hasScoped)U0=S.html}return U0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete($)}}async function c($){return Bun.file($).exists()}function i4($,Z){let Y=h.resolve(Z),X=h.resolve($),Q=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(Q))return X;return null}async function n4($,Z,Y,X){let Q=await UG($,Z,Y,X);if(Q===null)return null;let J=i4(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(i4(Q,q))return h.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function UG($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=h.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=h.join(J,$),_=i4(B,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await c(_)&&X)X.add(_);return _}let G=h.join(Q,$);if(await c(G)){if(Y.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 _=`${G}${B}`;if(await c(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=h.resolve(Q),W=process.cwd();for(let B=0;B<10;B++){let _=h.join(q,"layouts"),j=!1;try{j=ZG.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=h.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,B);if(await c(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=h.join(B,_);if(await c(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=h.join(Y.partialsDir||Q,"layouts",B[1]);if(await c(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await c(K)){let B=h.join(K,$);if(await c(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(U,$);if(await c(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=h.join(h.dirname(Q),"layouts",$);if(await c(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function x9($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
1980
+ `+f,m)f+=`
1981
+ `+m}else{if(m)f+=`
1982
+ `+m;if(k.length>0){let y=I.__stx_event_bindings||[],x=U5(I),u=await Promise.all(k.map(async(l)=>{let Y0=l.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Y0)return l;return await W5(Y0[1],{eventBindings:y,templateContent:f,filePath:F,projectRoot:process.cwd(),serverData:x})}));f+=`
1983
+ `+u.join(`
1984
+ `),I.__stx_event_bindings=[]}}if(s){let y=Y4(f,F);if(y.hasScoped)f=y.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete($)}}async function i($){return Bun.file($).exists()}function s$($,Z){let Y=h.resolve(Z),X=h.resolve($),Q=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(Q))return X;return null}async function r$($,Z,Y,X){let Q=await zG($,Z,Y,X);if(Q===null)return null;let J=s$(Q,process.cwd());if(J)return J;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(s$(Q,q))return h.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function zG($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=h.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=h.join(J,$),_=s$(B,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await i(_)&&X)X.add(_);return _}let G=h.join(Q,$);if(await i(G)){if(Y.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 _=`${G}${B}`;if(await i(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=h.resolve(Q),W=process.cwd();for(let B=0;B<10;B++){let _=h.join(q,"layouts"),j=!1;try{j=XG.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=h.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,B);if(await i(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=h.join(B,_);if(await i(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=h.join(Y.partialsDir||Q,"layouts",B[1]);if(await i(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await i(K)){let B=h.join(K,$);if(await i(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(U,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=h.join(h.dirname(Q),"layouts",$);if(await i(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function g9($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
1985
1985
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let W=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(W,U).map((z,B)=>{let _=W+B+1;return`${_===X?"> ":" "}${_}: ${z}`}).join(`
1986
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return x9($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function Q0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=x9(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
1986
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return g9($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function K0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=g9(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
1987
1987
  `,Math.max(0,Q-1));W=Q-(z+1)+1}let U="";if(G>0)U+=`
1988
1988
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
1989
1989
  `;if(U+=`
1990
- ${r.bold}${r.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${r.reset}
1991
- `,U+=`${r.bold}${r.red}\u2502${r.reset} ${r.bold}${r.bgRed} ERROR ${r.reset} ${r.red}${$} Error${r.reset}${" ".repeat(Math.max(0,43-$.length))}${r.bold}${r.red}\u2502${r.reset}
1992
- `,U+=`${r.bold}${r.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${r.reset}
1990
+ ${a.bold}${a.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${a.reset}
1991
+ `,U+=`${a.bold}${a.red}\u2502${a.reset} ${a.bold}${a.bgRed} ERROR ${a.reset} ${a.red}${$} Error${a.reset}${" ".repeat(Math.max(0,43-$.length))}${a.bold}${a.red}\u2502${a.reset}
1992
+ `,U+=`${a.bold}${a.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${a.reset}
1993
1993
  `,U+=`
1994
- ${r.cyan}${r.bold}File:${r.reset} ${r.dim}${q}${r.reset}`,G>0)U+=` ${r.gray}(line ${G}${W>0?`, col ${W}`:""})${r.reset}`;if(U+=`
1995
- ${r.yellow}${r.bold}Message:${r.reset} ${Z}
1994
+ ${a.cyan}${a.bold}File:${a.reset} ${a.dim}${q}${a.reset}`,G>0)U+=` ${a.gray}(line ${G}${W>0?`, col ${W}`:""})${a.reset}`;if(U+=`
1995
+ ${a.yellow}${a.bold}Message:${a.reset} ${Z}
1996
1996
  `,K)U+=`
1997
- ${r.blue}${r.bold}Context:${r.reset}
1998
- ${r.dim}${K}${r.reset}
1999
- `;return U}var c4,YG=0,r;var H0=b(()=>{W5();c0();m1();J$();f1();m4();L9();F5();c4=new j5(500);r={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 f9($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,B=U,_=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
2000
- `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:j,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},_=G5(W.trim(),B);X=X.split(K).join(_)}catch(z){let B=z instanceof Error?z.message:String(z),_=Q0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function g9($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),G5($.trim(),Q)}var o4=b(()=>{H0()});function BG($){if(WG.set($.name,$),$.client)zG.set($.name,$.client)}function Q$($){return BG($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=_G(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,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 _G($,Z){let Y={...Z};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{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var WG,zG;var s4=b(()=>{WG=new Map,zG=new Map});function r4($,Z=l1,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${w5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function h9($,Z,Y=jG,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${w5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function a4($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;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(Z),X.join(", ")}function w5($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function t4($){return HG[$]||"application/octet-stream"}var l1,jG,V5,HG;var e4=b(()=>{l1=[320,480,640,768,1024,1280,1536,1920,2560],jG=[1,1.5,2,3],V5=["avif","webp","jpeg"],HG={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function LG(){try{return await import("ts-images")}catch{return null}}async function FG($,Z={}){let Y={...OG,...Z},X=await LG();if(X)try{return await VG($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return wG($,Y)}async function VG($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.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:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function wG($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function d9($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
1997
+ ${a.blue}${a.bold}Context:${a.reset}
1998
+ ${a.dim}${K}${a.reset}
1999
+ `;return U}var o$,JG=0,a;var H0=S(()=>{z5();c0();l1();G4();h1();u$();R9();V5();o$=new H5(500);a={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 h9($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,B=U,_=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
2000
+ `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:j,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},_=K5(W.trim(),B);X=X.split(K).join(_)}catch(z){let B=z instanceof Error?z.message:String(z),_=K0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function d9($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),K5($.trim(),Q)}var a$=S(()=>{H0()});function jG($){if(BG.set($.name,$),$.client)_G.set($.name,$.client)}function K4($){return jG($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=HG(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,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 HG($,Z){let Y={...Z};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{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var BG,_G;var t$=S(()=>{BG=new Map,_G=new Map});function e$($,Z=c1,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${R5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function m9($,Z,Y=OG,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${R5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function $7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;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(Z),X.join(", ")}function R5($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function Z7($){return LG[$]||"application/octet-stream"}var c1,OG,w5,LG;var Y7=S(()=>{c1=[320,480,640,768,1024,1280,1536,1920,2560],OG=[1,1.5,2,3],w5=["avif","webp","jpeg"],LG={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function VG(){try{return await import("ts-images")}catch{return null}}async function wG($,Z={}){let Y={...FG,...Z},X=await VG();if(X)try{return await RG($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return AG($,Y)}async function RG($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.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:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function AG($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function u9($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
2001
2001
  #${$} {
2002
2002
  --stx-img-transition-duration: ${X}ms;
2003
2003
  --stx-img-transition-easing: ${Q};
@@ -2014,7 +2014,7 @@ ${r.dim}${K}${r.reset}
2014
2014
  #${$}.stx-img-loaded img {
2015
2015
  opacity: 1;
2016
2016
  }
2017
- `.trim()}async function m9($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if($7.has(Y))return $7.get(Y);let X=await FG($,Z);return $7.set(Y,X),X}var OG,Z7,$7;var u9=b(()=>{OG={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Z7=`
2017
+ `.trim()}async function l9($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(X7.has(Y))return X7.get(Y);let X=await wG($,Z);return X7.set(Y,X),X}var FG,J7,X7;var p9=S(()=>{FG={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},J7=`
2018
2018
  .stx-img-placeholder {
2019
2019
  position: relative;
2020
2020
  overflow: hidden;
@@ -2043,8 +2043,8 @@ ${r.dim}${K}${r.reset}
2043
2043
  filter: blur(0);
2044
2044
  transform: scale(1);
2045
2045
  }
2046
- `.trim();$7=new Map});import{createHash as p9}from"crypto";import{readFile as RG,stat as c9}from"fs/promises";async function N0($){try{let Z=await RG($);return p9("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function l9($){return p9("sha256").update($).digest("hex").slice(0,16)}function G$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${l9($)}-${l9(Y)}`}async function Y7($){try{return(await c9($)).mtimeMs}catch{return 0}}async function w0($){try{return await c9($),!0}catch{return!1}}var N1=()=>{};import{mkdir as AG,readFile as NG,writeFile as TG,readdir as Oj,rm as MG,stat as Lj}from"fs/promises";import{join as n9,dirname as IG}from"path";async function DG($){try{await AG($,{recursive:!0})}catch{}}function o9($,Z,Y){return n9($,Y,`${Z}.json`)}async function i9($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Y7(Z)!==$.srcMtime)return!1;return!0}async function K$($,Z,Y,X=X7){if(!X.enabled)return null;let Q=G$($,Z),J=p1.get(Q);if(J){if(await i9(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;p1.delete(Q)}let G=o9(X.directory,Q,Y);if(await w0(G))try{let K=await NG(G,"utf-8"),q=JSON.parse(K);if(await i9(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),p1.set(Q,q),q.data}catch{}return null}async function q$($,Z,Y,X,Q=X7){if(!Q.enabled)return;let J=G$($,Z),G=await N0($),K=await Y7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:G$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};p1.set(J,q);let W=o9(Q.directory,J,X);try{await DG(IG(W)),await TG(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function U$($,Z=X7){if($==="all")p1.clear();else p1.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=n9(Z.directory,X);try{await MG(Q,{recursive:!0,force:!0})}catch{}}}var p1,X7;var J7=b(()=>{N1();p1=new Map,X7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class z${config;constructor($={}){this.config={...EG,...$}}async get($,Z){return K$($,Z,"image",this.config)}async set($,Z,Y){return q$($,Z,Y,"image",this.config)}async clear(){return U$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function Q7($){if(!W$)W$=new z$($);else if($)W$.updateConfig($);return W$}async function B$($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Q7(X).get($,Z)}async function _$($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return Q7(Q).set($,Z,Y)}async function s9(){return Q7().clear()}var EG,W$=null;var G7=b(()=>{J7();EG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as kG,basename as SG,extname as bG,join as yG}from"path";import{mkdir as PG}from"fs/promises";async function K7(){try{return await import("ts-images")}catch{return null}}function r9($){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 CG($,Z){let Y=Z?r9(Z):r9("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function a9($,Z,Y){let X=await K7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await B$($,Z,Y);if(Q)return Q;try{let J=kG($);if(!await w0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=CG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await PG(K,{recursive:!0});let W=await N0(J),U=SG($,bG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await q7(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=yG(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await _$($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function t9($,Z,Y,X){let Q=await K7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function q7($,Z,Y){let X=Y||await K7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var e9=b(()=>{N1();G7()});import{resolve as vG,basename as xG,extname as fG,join as gG}from"path";import{mkdir as hG}from"fs/promises";async function dG(){try{return await import("ts-images")}catch{return null}}async function $8($,Z,Y){let X=await dG();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=vG($);if(!await w0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||mG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await hG(K,{recursive:!0});let W=await N0(Q),U=xG($,fG($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=gG(K,F),V=`${q}/${F}`;try{let w=z[j]?.quality||80;if(await w0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(R)B.byFormat[j].push({path:O,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:j,size:R.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||uG(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function uG($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function Z8($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var mG;var Y8=b(()=>{N1();mG=[320,480,640,768,1024,1280,1536,1920]});var X8={};n(X8,{setCachedImageResult:()=>_$,processImage:()=>a9,optimizeImage:()=>t9,getCachedImageResult:()=>B$,generateSrcset:()=>Z8,generateResponsiveVariants:()=>$8,clearImageCache:()=>s9,applyTransformations:()=>q7,ImageProcessorCache:()=>z$});var J8=b(()=>{e9();Y8();G7()});async function lG(){try{return await Promise.resolve().then(() => (J8(),X8))}catch($){if(!Q8)console.warn("[stx-media] Image processor not available, some features disabled:",$),Q8=!0;return null}}async function j$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return nG(X,Y)}if(Y.processedResult?.processed)return B7($,Y.processedResult,Z);if(Y.responsiveVariants)return U8($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=l1,dpr:U,formats:z=V5,quality:B=U7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":O$,decoding:V=H$,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:P=!1,baseUrl:k=""}=Z;if(P&&!Z.optimize)return iG($);let y,C,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{y=await m9(Q,{strategy:j,...H}),C=d9(d,y,H)}catch{}let f=U!==void 0&&G!==void 0,m;if(f)m=cG($,d,y,Z);else m=await pG($,d,y,Z);let o;if(F){let S0=z.includes("webp")?"webp":z[0],I0=r4(Q,W,{..._,q:B},S0),e=typeof q==="object"?a4(q):q||"100vw";o=`<link rel="preload" as="image" imagesrcset="${I0}" imagesizes="${e}" />`}let R0=[];if(!G8&&j!=="none")R0.push(Z7),G8=!0;if(C)R0.push(C);let o0=L?q8(d):void 0;return{html:m,preloadLink:o,css:R0.length>0?R0.join(`
2047
- `):void 0,script:o0}}async function pG($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=l1,formats:U=V5,quality:z=U7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":O$,decoding:L=H$,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?a4(q):q||"100vw",I=[];for(let P of U){let k=r4(Q,W,{...B,q:z},P),y=t4(P);if(_&&!j)I.push(` <source type="${y}" data-srcset="${k}" data-sizes="${M}" />`);else I.push(` <source type="${y}" srcset="${k}" sizes="${M}" />`)}let D=W7({src:w5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R,className:K8(A,Y),style:z7(N,O,V,Y),lazy:_&&!j,data:T}),E;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
2046
+ `.trim();X7=new Map});import{createHash as i9}from"crypto";import{readFile as NG,stat as n9}from"fs/promises";async function R0($){try{let Z=await NG($);return i9("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function c9($){return i9("sha256").update($).digest("hex").slice(0,16)}function q4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${c9($)}-${c9(Y)}`}async function Q7($){try{return(await n9($)).mtimeMs}catch{return 0}}async function w0($){try{return await n9($),!0}catch{return!1}}var T1=()=>{};import{mkdir as TG,readFile as MG,writeFile as IG,readdir as Fj,rm as DG,stat as Vj}from"fs/promises";import{join as s9,dirname as EG}from"path";async function kG($){try{await TG($,{recursive:!0})}catch{}}function r9($,Z,Y){return s9($,Y,`${Z}.json`)}async function o9($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Q7(Z)!==$.srcMtime)return!1;return!0}async function U4($,Z,Y,X=G7){if(!X.enabled)return null;let Q=q4($,Z),J=i1.get(Q);if(J){if(await o9(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;i1.delete(Q)}let G=r9(X.directory,Q,Y);if(await w0(G))try{let K=await MG(G,"utf-8"),q=JSON.parse(K);if(await o9(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),i1.set(Q,q),q.data}catch{}return null}async function W4($,Z,Y,X,Q=G7){if(!Q.enabled)return;let J=q4($,Z),G=await R0($),K=await Q7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:q4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};i1.set(J,q);let W=r9(Q.directory,J,X);try{await kG(EG(W)),await IG(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function z4($,Z=G7){if($==="all")i1.clear();else i1.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=s9(Z.directory,X);try{await DG(Q,{recursive:!0,force:!0})}catch{}}}var i1,G7;var K7=S(()=>{T1();i1=new Map,G7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class _4{config;constructor($={}){this.config={...bG,...$}}async get($,Z){return U4($,Z,"image",this.config)}async set($,Z,Y){return W4($,Z,Y,"image",this.config)}async clear(){return z4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function q7($){if(!B4)B4=new _4($);else if($)B4.updateConfig($);return B4}async function j4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return q7(X).get($,Z)}async function H4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return q7(Q).set($,Z,Y)}async function a9(){return q7().clear()}var bG,B4=null;var U7=S(()=>{K7();bG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as SG,basename as yG,extname as PG,join as CG}from"path";import{mkdir as vG}from"fs/promises";async function W7(){try{return await import("ts-images")}catch{return null}}function t9($){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 xG($,Z){let Y=Z?t9(Z):t9("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function e9($,Z,Y){let X=await W7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await j4($,Z,Y);if(Q)return Q;try{let J=SG($);if(!await w0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=xG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await vG(K,{recursive:!0});let W=await R0(J),U=yG($,PG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await z7(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=CG(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await H4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function $8($,Z,Y,X){let Q=await W7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function z7($,Z,Y){let X=Y||await W7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var Z8=S(()=>{T1();U7()});import{resolve as fG,basename as gG,extname as hG,join as dG}from"path";import{mkdir as mG}from"fs/promises";async function uG(){try{return await import("ts-images")}catch{return null}}async function Y8($,Z,Y){let X=await uG();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=fG($);if(!await w0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||lG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await mG(K,{recursive:!0});let W=await R0(Q),U=gG($,hG($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=dG(K,F),V=`${q}/${F}`;try{let w=z[j]?.quality||80;if(await w0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let R=await X.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(R)B.byFormat[j].push({path:O,url:V,width:L,height:R.height||Math.round(L*(R.height||1)/(R.width||1)),format:j,size:R.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||pG(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function pG($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function X8($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var lG;var J8=S(()=>{T1();lG=[320,480,640,768,1024,1280,1536,1920]});var Q8={};o(Q8,{setCachedImageResult:()=>H4,processImage:()=>e9,optimizeImage:()=>$8,getCachedImageResult:()=>j4,generateSrcset:()=>X8,generateResponsiveVariants:()=>Y8,clearImageCache:()=>a9,applyTransformations:()=>z7,ImageProcessorCache:()=>_4});var G8=S(()=>{Z8();J8();U7()});async function cG(){try{return await Promise.resolve().then(() => (G8(),Q8))}catch($){if(!K8)console.warn("[stx-media] Image processor not available, some features disabled:",$),K8=!0;return null}}async function O4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return sG(X,Y)}if(Y.processedResult?.processed)return H7($,Y.processedResult,Z);if(Y.responsiveVariants)return z8($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=c1,dpr:U,formats:z=w5,quality:B=B7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":F4,decoding:V=L4,fetchpriority:w,objectFit:R,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:C=!1,baseUrl:b=""}=Z;if(C&&!Z.optimize)return oG($);let k,P,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await l9(Q,{strategy:j,...H}),P=u9(d,k,H)}catch{}let g=U!==void 0&&G!==void 0,m;if(g)m=nG($,d,k,Z);else m=await iG($,d,k,Z);let s;if(F){let P0=z.includes("webp")?"webp":z[0],T0=e$(Q,W,{..._,q:B},P0),e=typeof q==="object"?$7(q):q||"100vw";s=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${e}" />`}let Z0=[];if(!q8&&j!=="none")Z0.push(J7),q8=!0;if(P)Z0.push(P);let o0=L?W8(d):void 0;return{html:m,preloadLink:s,css:Z0.length>0?Z0.join(`
2047
+ `):void 0,script:o0}}async function iG($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=c1,formats:U=w5,quality:z=B7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":F4,decoding:L=L4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,A=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?$7(q):q||"100vw",I=[];for(let C of U){let b=e$(Q,W,{...B,q:z},C),k=Z7(C);if(_&&!j)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${M}" />`)}let D=_7({src:R5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:R,className:U8(A,Y),style:j7(N,O,V,Y),lazy:_&&!j,data:T}),E;if(Y){let C=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${C}">
2048
2048
  <picture>
2049
2049
  ${I.join(`
2050
2050
  `)}
@@ -2054,9 +2054,9 @@ ${I.join(`
2054
2054
  ${I.join(`
2055
2055
  `)}
2056
2056
  <img ${D} />
2057
- </picture>`;return E}function cG($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=U7,params:U={},lazy:z=!0,priority:B=!1,loading:_=B?"eager":O$,decoding:j=H$,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=h9(Q,N,q,{...U,q:W}),M=W7({src:w5(Q,{...U,w:N,q:W}),alt:J,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:K8(w,Y),style:z7(R,L,F,Y),lazy:z&&!B,data:A}),I=z&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
2057
+ </picture>`;return E}function nG($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=B7,params:U={},lazy:z=!0,priority:B=!1,loading:_=B?"eager":F4,decoding:j=L4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,R=$.style,A=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=m9(Q,N,q,{...U,q:W}),M=_7({src:R5(Q,{...U,w:N,q:W}),alt:J,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:U8(w,Y),style:j7(R,L,F,Y),lazy:z&&!B,data:A}),I=z&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
2058
2058
  <img ${M} ${I} />
2059
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function iG($){let{src:Z,alt:Y,width:X,height:Q,loading:J=O$,decoding:G=H$,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${W7({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:z7(j,q,W),id:H,data:L})} />`}}function W7($){let Z=[];if($.lazy)Z.push(`data-src="${h0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${h0($.src)}"`);if(Z.push(`alt="${h0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${h0($.className)}"`);if($.style)Z.push(`style="${h0($.style)}"`);if($.id)Z.push(`id="${h0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${h0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function K8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function z7($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function h0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function q8($){return`
2059
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function oG($){let{src:Z,alt:Y,width:X,height:Q,loading:J=F4,decoding:G=L4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${_7({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:j7(j,q,W),id:H,data:L})} />`}}function _7($){let Z=[];if($.lazy)Z.push(`data-src="${d0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${d0($.src)}"`);if(Z.push(`alt="${d0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${d0($.className)}"`);if($.style)Z.push(`style="${d0($.style)}"`);if($.id)Z.push(`id="${d0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${d0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function U8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function j7($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function d0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function W8($){return`
2060
2060
  (function() {
2061
2061
  const container = document.getElementById('${$}');
2062
2062
  if (!container) return;
@@ -2093,7 +2093,7 @@ ${I.join(`
2093
2093
 
2094
2094
  observer.observe(container);
2095
2095
  })();
2096
- `.trim()}async function nG($,Z){let Y=await lG();if(!Y)return j$({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return U8($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return B7($,J,Z)}return j$({...$,process:!1},Z)}async function B7($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((C)=>C.format==="jpeg")||L.find((C)=>C.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of L){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],A=["avif","webp","jpeg","png"];for(let C of A){let d=w.get(C);if(d&&d.length>0){let f=d.map((o)=>`${o.url} ${o.width}w`).join(", "),m=t4(C);if(G&&!K)R.push(` <source type="${m}" data-srcset="${f}" />`);else R.push(` <source type="${m}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${h0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${h0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${h0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(U)N.push(`crossorigin="${U}"`);if(z)N.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let D=[];if(B)D.push(B);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)N.push(`class="${D.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[C,d]of Object.entries(H))N.push(`data-${C}="${h0(d)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${C}">
2096
+ `.trim()}async function sG($,Z){let Y=await cG();if(!Y)return O4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return z8($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return H7($,J,Z)}return O4({...$,process:!1},Z)}async function H7($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((P)=>P.format==="jpeg")||L.find((P)=>P.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),w=new Map;for(let P of L){if(!w.has(P.format))w.set(P.format,[]);w.get(P.format).push(P)}let R=[],A=["avif","webp","jpeg","png"];for(let P of A){let d=w.get(P);if(d&&d.length>0){let g=d.map((s)=>`${s.url} ${s.width}w`).join(", "),m=Z7(P);if(G&&!K)R.push(` <source type="${m}" data-srcset="${g}" />`);else R.push(` <source type="${m}" srcset="${g}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${d0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${d0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${d0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(U)N.push(`crossorigin="${U}"`);if(z)N.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let D=[];if(B)D.push(B);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)N.push(`class="${D.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[P,d]of Object.entries(H))N.push(`data-${P}="${d0(d)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let P=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${P}">
2097
2097
  <picture>
2098
2098
  ${R.join(`
2099
2099
  `)}
@@ -2103,12 +2103,12 @@ ${R.join(`
2103
2103
  ${R.join(`
2104
2104
  `)}
2105
2105
  <img ${N.join(" ")} />
2106
- </picture>`;let P=[];if(Z.placeholder)P.push(Z7);let k=G?q8(j):void 0,y;if(K&&V)y=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:y,css:P.length>0?P.join(`
2107
- `):void 0,script:k}}async function U8($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return B7($,X,Y)}var Q8=!1,U7=80,H$="async",O$="lazy",G8=!1;var W8=b(()=>{e4();u9()});function oG(){return Q$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=sG($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||l1,formats:G.formats||V5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await j$(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
2106
+ </picture>`;let C=[];if(Z.placeholder)C.push(J7);let b=G?W8(j):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(`
2107
+ `):void 0,script:b}}async function z8($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return H7($,X,Y)}var K8=!1,B7=80,L4="async",F4="lazy",q8=!1;var B8=S(()=>{Y7();p9()});function rG(){return K4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=aG($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||c1,formats:G.formats||w5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await O4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
2108
2108
  `+U;if(W.css)U+=`
2109
2109
  <style>${W.css}</style>`;if(W.script)U+=`
2110
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function sG($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=rG(X),J=_7(Q[0],Y)||"",G=_7(Q[1],Y)||"",K={};if(Q[2]){let q=_7(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function rG($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function _7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var z8;var B8=b(()=>{s4();W8();e4();z8=oG()});class F${config;constructor($={}){this.config={...aG,...$}}async get($,Z){return K$($,Z,"video",this.config)}async set($,Z,Y){return q$($,Z,Y,"video",this.config)}async clear(){return U$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function j7($){if(!L$)L$=new F$($);else if($)L$.updateConfig($);return L$}async function V$($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return j7(X).get($,Z)}async function w$($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return j7(Q).set($,Z,Y)}async function _8(){return j7().clear()}var aG,L$=null;var H7=b(()=>{J7();aG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as O7,basename as L7,extname as F7,join as R$}from"path";import{mkdir as V7}from"fs/promises";async function w7(){try{return await import("ts-videos")}catch{return null}}async function A$($,Z,Y,X){let Q=await w7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=O7($);if(!await w0(J))return null;await V7(Y,{recursive:!0});let G=await N0(J),K=L7($,F7($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=R$(Y,U),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:z,url:`${X}/${U}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function N$($,Z,Y,X){let Q=await w7();if(!Q)return[];try{let J=O7($);if(!await w0(J))return[];await V7(Y,{recursive:!0});let G=await N0(J),K=L7($,F7($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,_=Z.interval||z/B,j=[];for(let L=0;L<B&&L*_<z;L++)j.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||R$(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function j8($,Z,Y,X){let Q=await w7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=O7($);if(!await w0(J))return null;await V7(Y,{recursive:!0});let G=await N0(J),K=L7($,F7($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=R$(Y,O),w=[];for(let A=0;A<L;A++)w.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:w,width:_,height:j,format:H,quality:Z.quality||70,outputDir:R$(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),N=z*_,T=F*j,M=await A.createSprite({images:R.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var R7=b(()=>{N1()});import{resolve as O8,basename as L8,extname as F8,join as T1}from"path";import{mkdir as T$,writeFile as V8}from"fs/promises";async function w8(){try{return await import("ts-videos")}catch{return null}}async function M$($,Z,Y,X,Q){let J=await w8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=O8($);if(!await w0(G))return null;let K=await N0(G),q=L8($,F8($)),W=T1(Y,`${q}-${K}-hls`);await T$(W,{recursive:!0});let U=Z.length>0?Z:R8,z=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=T1(W,V.label);await T$(w,{recursive:!0});let R=`${V.label}.m3u8`,A=T1(w,R);try{let N=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=T1(W,"master.m3u8"),O=tG(H,X,q,K);return await V8(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function tG($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
2111
- `)}async function I$($,Z,Y,X,Q){let J=await w8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=O8($);if(!await w0(G))return null;let K=await N0(G),q=L8($,F8($)),W=T1(Y,`${q}-${K}-dash`);await T$(W,{recursive:!0});let U=Z.length>0?Z:R8,z=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of U){let A=T1(W,R.label);await T$(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:z,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(L.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${N}`)}}if(L.length===0)return null;let O=T1(W,"manifest.mpd"),V=eG(L,F,H,z,B);await V8(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function eG($,Z,Y,X,Q){let J=H8(Y),G=H8(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
2110
+ <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function aG($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=tG(X),J=O7(Q[0],Y)||"",G=O7(Q[1],Y)||"",K={};if(Q[2]){let q=O7(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function tG($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function O7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var _8;var j8=S(()=>{t$();B8();Y7();_8=rG()});class w4{config;constructor($={}){this.config={...eG,...$}}async get($,Z){return U4($,Z,"video",this.config)}async set($,Z,Y){return W4($,Z,Y,"video",this.config)}async clear(){return z4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function L7($){if(!V4)V4=new w4($);else if($)V4.updateConfig($);return V4}async function R4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return L7(X).get($,Z)}async function A4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return L7(Q).set($,Z,Y)}async function H8(){return L7().clear()}var eG,V4=null;var F7=S(()=>{K7();eG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as V7,basename as w7,extname as R7,join as N4}from"path";import{mkdir as A7}from"fs/promises";async function N7(){try{return await import("ts-videos")}catch{return null}}async function T4($,Z,Y,X){let Q=await N7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=V7($);if(!await w0(J))return null;await A7(Y,{recursive:!0});let G=await R0(J),K=w7($,R7($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=N4(Y,U),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:z,url:`${X}/${U}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function M4($,Z,Y,X){let Q=await N7();if(!Q)return[];try{let J=V7($);if(!await w0(J))return[];await A7(Y,{recursive:!0});let G=await R0(J),K=w7($,R7($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,_=Z.interval||z/B,j=[];for(let L=0;L<B&&L*_<z;L++)j.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||N4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function O8($,Z,Y,X){let Q=await N7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=V7($);if(!await w0(J))return null;await A7(Y,{recursive:!0});let G=await R0(J),K=w7($,R7($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=N4(Y,O),w=[];for(let A=0;A<L;A++)w.push(A*B);let R=await Q.extractThumbnails(J,{timestamps:w,width:_,height:j,format:H,quality:Z.quality||70,outputDir:N4(Y,".temp")});if(!R||R.length===0)return null;try{let A=await import("ts-images"),N=z*_,T=F*j,M=await A.createSprite({images:R.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var T7=S(()=>{T1()});import{resolve as F8,basename as V8,extname as w8,join as M1}from"path";import{mkdir as I4,writeFile as R8}from"fs/promises";async function A8(){try{return await import("ts-videos")}catch{return null}}async function D4($,Z,Y,X,Q){let J=await A8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=F8($);if(!await w0(G))return null;let K=await R0(G),q=V8($,w8($)),W=M1(Y,`${q}-${K}-hls`);await I4(W,{recursive:!0});let U=Z.length>0?Z:N8,z=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let w=M1(W,V.label);await I4(w,{recursive:!0});let R=`${V.label}.m3u8`,A=M1(w,R);try{let N=await J.generateHLS(G,{outputDir:w,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:A}),L+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=M1(W,"master.m3u8"),O=$K(H,X,q,K);return await R8(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function $K($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
2111
+ `)}async function E4($,Z,Y,X,Q){let J=await A8();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=F8($);if(!await w0(G))return null;let K=await R0(G),q=V8($,w8($)),W=M1(Y,`${q}-${K}-dash`);await I4(W,{recursive:!0});let U=Z.length>0?Z:N8,z=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let R of U){let A=M1(W,R.label);await I4(A,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:A,segmentDuration:z,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(L.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${N}`)}}if(L.length===0)return null;let O=M1(W,"manifest.mpd"),V=ZK(L,F,H,z,B);await R8(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function ZK($,Z,Y,X,Q){let J=L8(Y),G=L8(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
2112
2112
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
2113
2113
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2114
2114
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -2134,11 +2134,11 @@ ${R.join(`
2134
2134
  </Representation>
2135
2135
  `}K+=` </AdaptationSet>
2136
2136
  `}return K+=` </Period>
2137
- </MPD>`,K}function H8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var R8;var A7=b(()=>{N1();R8=[{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 A8,basename as $K,extname as ZK,join as YK}from"path";import{mkdir as XK}from"fs/promises";async function N8(){try{return await import("ts-videos")}catch{return null}}function JK($){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 QK($){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 N7($){let Z=await N8();if(!Z)return null;try{let Y=A8($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function T8($,Z,Y,X){let Q=await N8();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await V$($,Z,Y);if(J)return J;try{let G=A8($);if(!await w0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await XK(K,{recursive:!0});let W=await N0(G),U=$K($,ZK($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await N7(G)||void 0;let B={};if(Z.quality)B.bitrate=JK(Z.quality);if(Z.platform)Object.assign(B,QK(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,j=YK(K,_);try{let H=await GK(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await A$(G,_,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await N$(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await M$(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(_.format==="dash"){let j=await I$(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await w$($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function GK($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var M8=b(()=>{N1();H7();R7();A7()});var I8={};n(I8,{setCachedVideoResult:()=>w$,processVideo:()=>T8,getCachedVideoResult:()=>V$,generateThumbnails:()=>N$,generateSpriteSheet:()=>j8,generatePoster:()=>A$,generateHLSManifest:()=>M$,generateDASHManifest:()=>I$,clearVideoCache:()=>_8,analyzeVideo:()=>N7,VideoProcessorCache:()=>F$});var D8=b(()=>{M8();R7();A7();H7()});async function k8(){try{return await Promise.resolve().then(() => (D8(),I8))}catch($){if(!E8)console.warn("[stx-media] Video processor not available, some features disabled:",$),E8=!0;return null}}async function D$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return BK(X,Y)}if(Y.processedResult?.processed)return P8($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await _K(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=S8,autoplay:U=!1,muted:z=!1,loop:B=!1,preload:_=b8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,N=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return UK($,Z);if(F&&F!=="video")return qK(J||"",F,$);let D=G.length>0?G:J?[{src:J,type:y8(J)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(U)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(j)E.push("playsinline");if(R)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${_}"`),E.push('preload="none"'),N)E.push(`data-poster="${B0(N)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${_}"`),N)E.push(`poster="${B0(N)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${B0(T)}"`);if(M)E.push(`style="${B0(M)}"`);let P=D.map((C)=>{return` <source ${H?`data-src="${B0(C.src)}"`:`src="${B0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
2138
- `),k=`<video ${E.join(" ")}>
2139
- ${P}
2137
+ </MPD>`,K}function L8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var N8;var M7=S(()=>{T1();N8=[{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 T8,basename as YK,extname as XK,join as JK}from"path";import{mkdir as QK}from"fs/promises";async function M8(){try{return await import("ts-videos")}catch{return null}}function GK($){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 KK($){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 I7($){let Z=await M8();if(!Z)return null;try{let Y=T8($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function I8($,Z,Y,X){let Q=await M8();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await R4($,Z,Y);if(J)return J;try{let G=T8($);if(!await w0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await QK(K,{recursive:!0});let W=await R0(G),U=YK($,XK($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await I7(G)||void 0;let B={};if(Z.quality)B.bitrate=GK(Z.quality);if(Z.platform)Object.assign(B,KK(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,j=JK(K,_);try{let H=await qK(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await T4(G,_,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await M4(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await D4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(_.format==="dash"){let j=await E4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await A4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function qK($,Z,Y,X,Q){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var D8=S(()=>{T1();F7();T7();M7()});var E8={};o(E8,{setCachedVideoResult:()=>A4,processVideo:()=>I8,getCachedVideoResult:()=>R4,generateThumbnails:()=>M4,generateSpriteSheet:()=>O8,generatePoster:()=>T4,generateHLSManifest:()=>D4,generateDASHManifest:()=>E4,clearVideoCache:()=>H8,analyzeVideo:()=>I7,VideoProcessorCache:()=>w4});var k8=S(()=>{D8();T7();M7();F7()});async function S8(){try{return await Promise.resolve().then(() => (k8(),E8))}catch($){if(!b8)console.warn("[stx-media] Video processor not available, some features disabled:",$),b8=!0;return null}}async function k4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return jK(X,Y)}if(Y.processedResult?.processed)return v8($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await HK(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=y8,autoplay:U=!1,muted:z=!1,loop:B=!1,preload:_=P8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:A=!1}=$,N=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return zK($,Z);if(F&&F!=="video")return WK(J||"",F,$);let D=G.length>0?G:J?[{src:J,type:C8(J)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(U)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(j)E.push("playsinline");if(R)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${_}"`),E.push('preload="none"'),N)E.push(`data-poster="${_0(N)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${_}"`),N)E.push(`poster="${_0(N)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${_0(T)}"`);if(M)E.push(`style="${_0(M)}"`);let C=D.map((P)=>{return` <source ${H?`data-src="${_0(P.src)}"`:`src="${_0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
2138
+ `),b=`<video ${E.join(" ")}>
2139
+ ${C}
2140
2140
  Your browser does not support the video tag.
2141
- </video>`,y;if(H)y=`
2141
+ </video>`,k;if(H)k=`
2142
2142
  (function() {
2143
2143
  var video = document.getElementById('${I}');
2144
2144
  if (!video) return;
@@ -2173,12 +2173,12 @@ ${P}
2173
2173
 
2174
2174
  observer.observe(video);
2175
2175
  })();
2176
- `.trim();return{html:k,script:y}}function qK($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=WK($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=zK($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&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(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2176
+ `.trim();return{html:b,script:k}}function WK($,Z,Y){let{width:X=640,height:Q=360}=Y,J=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=BK($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=_K($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${K}"`,`src="${_0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${_0(J)}"`);if(G)U.push(`style="${_0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2177
2177
  <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2178
- </div>`}}function UK($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
2178
+ </div>`}}function zK($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
2179
2179
  <div
2180
2180
  id="${L}"
2181
- class="ts-video-player${j?" "+B0(j):""}"
2181
+ class="ts-video-player${j?" "+_0(j):""}"
2182
2182
  style="${O}"
2183
2183
  data-ts-video-player
2184
2184
  data-config='${JSON.stringify(F)}'
@@ -2186,7 +2186,7 @@ ${P}
2186
2186
  >
2187
2187
  <div class="ts-video-player__container">
2188
2188
  ${Q?`
2189
- <div class="ts-video-player__placeholder" style="background-image: url('${B0(Q)}');">
2189
+ <div class="ts-video-player__placeholder" style="background-image: url('${_0(Q)}');">
2190
2190
  <button class="ts-video-player__play-button" aria-label="Play video">
2191
2191
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
2192
2192
  <path d="M8 5v14l11-7z"/>
@@ -2212,7 +2212,7 @@ ${P}
2212
2212
 
2213
2213
  // Load ts-video-player from CDN
2214
2214
  var script = document.createElement('script');
2215
- script.src = '${KK}';
2215
+ script.src = '${UK}';
2216
2216
  script.onload = initPlayer;
2217
2217
  script.onerror = function() {
2218
2218
  console.error('[stx] Failed to load ts-video-player');
@@ -2342,10 +2342,10 @@ else {
2342
2342
  .ts-video-player__play-button svg {
2343
2343
  margin-left: 4px;
2344
2344
  }
2345
- `.trim();return{html:V,script:w,css:R}}function y8($){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 WK($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function zK($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function BK($,Z){let Y=await k8();if(!Y)return D$({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return P8($,Q,Z);return D$({...$,process:!1},Z)}async function _K($,Z){let Y=await k8();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function P8($,Z,Y){let{controls:X=S8,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=b8,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=y8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(_)A.push("disablepictureinpicture");if(j)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(W){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${B0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${B0(R)}"`);let N=U||Z.metadata?.width,T=z||Z.metadata?.height;if(N)A.push(`width="${N}"`);if(T)A.push(`height="${T}"`);if(H)A.push(`class="${B0(H)}"`);if(L)A.push(`style="${B0(L)}"`);let I=` <source ${W?`data-src="${B0(O)}"`:`src="${B0(O)}"`} type="${V}" />`,D=`<video ${A.join(" ")}>
2345
+ `.trim();return{html:V,script:w,css:R}}function C8($){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 BK($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function _K($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function _0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function jK($,Z){let Y=await S8();if(!Y)return k4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return v8($,Q,Z);return k4({...$,process:!1},Z)}async function HK($,Z){let Y=await S8();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function v8($,Z,Y){let{controls:X=y8,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=P8,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=C8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,A=[`id="${F}"`];if(X)A.push("controls");if(Q)A.push("autoplay");if(J)A.push("muted");if(G)A.push("loop");if(q)A.push("playsinline");if(_)A.push("disablepictureinpicture");if(j)A.push("disableremoteplayback");if(B)A.push(`crossorigin="${B}"`);if(W){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),R)A.push(`data-poster="${_0(R)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),R)A.push(`poster="${_0(R)}"`);let N=U||Z.metadata?.width,T=z||Z.metadata?.height;if(N)A.push(`width="${N}"`);if(T)A.push(`height="${T}"`);if(H)A.push(`class="${_0(H)}"`);if(L)A.push(`style="${_0(L)}"`);let I=` <source ${W?`data-src="${_0(O)}"`:`src="${_0(O)}"`} type="${V}" />`,D=`<video ${A.join(" ")}>
2346
2346
  ${I}
2347
2347
  Your browser does not support the video tag.
2348
- </video>`;if(Z.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${B0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
2348
+ </video>`;if(Z.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${_0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
2349
2349
  ${D}
2350
2350
  </div>`;let E;if(W)E=`
2351
2351
  (function() {
@@ -2382,7 +2382,7 @@ ${D}
2382
2382
 
2383
2383
  observer.observe(video);
2384
2384
  })();
2385
- `.trim();let P;if(w)P=`
2385
+ `.trim();let C;if(w)C=`
2386
2386
  .stx-video-wrapper {
2387
2387
  position: relative;
2388
2388
  width: 100%;
@@ -2391,9 +2391,9 @@ ${D}
2391
2391
  width: 100%;
2392
2392
  height: auto;
2393
2393
  }
2394
- `.trim();return{html:D,script:E,css:P}}var E8=!1,S8=!0,b8="metadata",KK="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var C8=b(()=>{M7()});function v8(){return Q$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=jK($,Z,Y);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:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await D$(G,q),U=W.html;if(W.css)U+=`
2394
+ `.trim();return{html:D,script:E,css:C}}var b8=!1,y8=!0,P8="metadata",UK="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var x8=S(()=>{E7()});function f8(){return K4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=OK($,Z,Y);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:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await k4(G,q),U=W.html;if(W.css)U+=`
2395
2395
  <style>${W.css}</style>`;if(W.script)U+=`
2396
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function jK($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=HK(X),J=x8(Q[0],Y)||"",G={};if(Q[1]){let K=x8(Q[1],Y);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 HK($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function x8($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var T7;var M7=b(()=>{s4();C8();T7=v8()});function OK($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2396
+ <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function OK($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=LK(X),J=g8(Q[0],Y)||"",G={};if(Q[1]){let K=g8(Q[1],Y);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 LK($){let Z=[],Y="",X=!1,Q="",J=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function g8($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var D7;var E7=S(()=>{t$();x8();D7=f8()});function FK($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2397
2397
  ${$}
2398
2398
  </div>
2399
2399
  <script>
@@ -2438,7 +2438,7 @@ ${D}
2438
2438
  }
2439
2439
  }
2440
2440
  })();
2441
- </script>`}function LK($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
2441
+ </script>`}function VK($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
2442
2442
  <div class="stx-pwa-update-banner" style="
2443
2443
  position: fixed;
2444
2444
  bottom: 0;
@@ -2549,7 +2549,7 @@ else {
2549
2549
  // Also listen for custom event
2550
2550
  window.addEventListener('pwa-update-available', showUpdate);
2551
2551
  })();
2552
- </script>`}function FK($,Z){let Y=$.trim().length>0,X=`
2552
+ </script>`}function wK($,Z){let Y=$.trim().length>0,X=`
2553
2553
  <div class="stx-offline-indicator" style="
2554
2554
  position: fixed;
2555
2555
  top: 16px;
@@ -2610,7 +2610,7 @@ else {
2610
2610
  window.addEventListener('offline', updateStatus);
2611
2611
  updateStatus();
2612
2612
  })();
2613
- </script>`}function VK($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2613
+ </script>`}function RK($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2614
2614
  ${$}
2615
2615
  </div>
2616
2616
  <script>
@@ -2692,71 +2692,71 @@ catch (error) {
2692
2692
  init();
2693
2693
  }
2694
2694
  })();
2695
- </script>`}function OH($){return[...$,...I7]}var wK,RK,AK,NK,I7;var D7=b(()=>{wK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return OK($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},RK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return LK($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},AK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return FK($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},NK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return VK($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},I7=[wK,RK,AK,NK]});function E7($){for(let[Z,Y]of Object.entries(i))if(Y===$)return Z;return}var i;var E$=b(()=>{i={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 R5(){return!1}function A5(){return!R5()||process.env.STX_DEBUG==="true"}function k$(){return!1}import TK from"path";function S$(){return{...k7}}function b$($){if(!k7.showRelativePaths||!$)return $;let Z=k7.baseDir||process.cwd();try{let Y=TK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var MK,k7,y$,M1,P$;var C$=b(()=>{E$();MK={showRelativePaths:!1,enableAutoRecovery:A5(),logRecoveryWarnings:!0},k7={...MK};y$=class y$ extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||i.EVALUATION_ERROR,this.filePath)this.filePath=b$(this.filePath)}};M1=class M1 extends y${constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||i.EVALUATION_ERROR);this.name="StxRuntimeError"}};P$=class P$ extends y${isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||i.DOM_API_VIOLATION);this.name="StxValidationError"}}});function g8($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=bK(K,q);B=O.line,_=O.column}let j=Q?b$(Q):void 0,H=X?E7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=DK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=EK(L,K,q);break;case"text":default:F=IK(L,K,q);break}return{formatted:F,data:L}}function IK($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
2696
- ${$.message}`),Z&&$.line){let J=kK(Z,$.line,2);if(J)X.push(`
2695
+ </script>`}function FH($){return[...$,...k7]}var AK,NK,TK,MK,k7;var b7=S(()=>{AK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return FK($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},NK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return VK($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},TK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return wK($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},MK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return RK($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},k7=[AK,NK,TK,MK]});function S7($){for(let[Z,Y]of Object.entries(n))if(Y===$)return Z;return}var n;var b4=S(()=>{n={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 A5(){return!1}function N5(){return!A5()||process.env.STX_DEBUG==="true"}function S4(){return!1}import IK from"path";function y4(){return{...y7}}function P4($){if(!y7.showRelativePaths||!$)return $;let Z=y7.baseDir||process.cwd();try{let Y=IK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var DK,y7,C4,I1,v4;var x4=S(()=>{b4();DK={showRelativePaths:!1,enableAutoRecovery:N5(),logRecoveryWarnings:!0},y7={...DK};C4=class C4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||n.EVALUATION_ERROR,this.filePath)this.filePath=P4(this.filePath)}};I1=class I1 extends C4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||n.EVALUATION_ERROR);this.name="StxRuntimeError"}};v4=class v4 extends C4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||n.DOM_API_VIOLATION);this.name="StxValidationError"}}});function d8($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=PK(K,q);B=O.line,_=O.column}let j=Q?P4(Q):void 0,H=X?S7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=kK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=bK(L,K,q);break;case"text":default:F=EK(L,K,q);break}return{formatted:F,data:L}}function EK($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
2696
+ ${$.message}`),Z&&$.line){let J=SK(Z,$.line,2);if(J)X.push(`
2697
2697
  ${J}`)}if($.snippet)X.push(`
2698
2698
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
2699
- Suggestion: ${$.suggestion}`);return X.join(" ")}function DK($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${f8($.message)}`;if($.suggestion)X+=` | Suggestion: ${f8($.suggestion)}`;return X+=" -->",X}function EK($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
2699
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function kK($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${h8($.message)}`;if($.suggestion)X+=` | Suggestion: ${h8($.suggestion)}`;return X+=" -->",X}function bK($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
2700
2700
  \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
2701
2701
 
2702
- ${$.message}`),Z&&$.line){let z=SK(Z,$.line,2);if(z)W.push(`
2702
+ ${$.message}`),Z&&$.line){let z=yK(Z,$.line,2);if(z)W.push(`
2703
2703
 
2704
2704
  \x1B[90mContext:\x1B[0m
2705
2705
  ${z}`)}if($.suggestion)W.push(`
2706
2706
 
2707
2707
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
2708
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function kK($,Z,Y){let X=$.split(`
2708
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function SK($,Z,Y){let X=$.split(`
2709
2709
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G=[];for(let K=Q;K<=J;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${X[K]}`)}return G.join(`
2710
- `)}function SK($,Z,Y){let X=$.split(`
2710
+ `)}function yK($,Z,Y){let X=$.split(`
2711
2711
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let U=Q;U<=J;U++){let z=(U+1).toString().padStart(4),B=U===Z-1,_=B?"\x1B[31m>\x1B[0m":" ",j=B?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;W.push(`${_}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
2712
- `)}function f8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function bK($,Z){let X=$.substring(0,Z).split(`
2713
- `);return{line:X.length,column:X[X.length-1].length}}function a($,Z,Y){return g8({type:$,message:Z,code:Y,format:"html"}).formatted}async function c1($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var h8=b(()=>{E$();C$()});class b7{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($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))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 Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
2712
+ `)}function h8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function PK($,Z){let X=$.substring(0,Z).split(`
2713
+ `);return{line:X.length,column:X[X.length-1].length}}function t($,Z,Y){return d8({type:$,message:Z,code:Y,format:"html"}).formatted}async function n1($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var m8=S(()=>{b4();x4()});class C7{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($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))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 Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
2714
2714
  `).slice(1).join(`
2715
2715
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
2716
2716
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(X))Z.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
2717
2717
  `;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.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 $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="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}));Y.writeFileSync($,JSON.stringify(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,J.join(`
2718
2718
 
2719
- `),"utf-8")}}async flush(){await this.writeQueue}}var S7,d0,y7;var d8=b(()=>{C$();S7={isEnabled(){return S$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=S$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
2720
- @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.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:Y,fixes:X}},createFallbackContent($,Z){if(A5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};d0=new b7,y7={isDevelopment(){return A5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
2721
- `)}}});var m8=()=>{};var u8=b(()=>{E$();h8();d8();m8();C$()});var t0=b(()=>{u8()});function l8($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,B=U.length>1?U[1]:"";if(B&&Z[B])W=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${l(z)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),B=U+1,_=(()=>{try{let j=O0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${l(String(j.name))}"`;if(j.property)H+=` property="${l(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${l(String(j.httpEquiv))}"`;if(j.content)H+=` content="${l(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return a("MetaTag",H,i.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),J.lastIndex=0}return Q}function p8($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let _=O0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return a("StructuredData",j,i.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),Q.lastIndex=0}return X}function c8($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let B=Q.substring(W).match(/^\s*\)/);if(!B)break;let _=W+B[0].length,j=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=O0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
2722
- `,V+=`<meta name="title" content="${l(O.title)}">
2723
- `;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
2724
- `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
2725
- `}if(O.robots)V+=`<meta name="robots" content="${l(O.robots)}">
2726
- `;if(O.canonical)V+=`<link rel="canonical" href="${l(O.canonical)}">
2727
- `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${l(w.type||"website")}">
2728
- `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta property="og:title" content="${l(R)}">
2729
- `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta property="og:description" content="${l(R)}">
2730
- `}if(w.url||O.canonical){let R=w.url||O.canonical||"";V+=`<meta property="og:url" content="${l(R)}">
2731
- `}if(w.image){if(V+=`<meta property="og:image" content="${l(w.image)}">
2732
- `,w.imageAlt)V+=`<meta property="og:image:alt" content="${l(w.imageAlt)}">
2733
- `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${l(String(w.imageWidth))}">
2734
- `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${l(String(w.imageHeight))}">
2735
- `}if(w.siteName)V+=`<meta property="og:site_name" content="${l(w.siteName)}">
2736
- `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${l(w.card||"summary_large_image")}">
2737
- `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta name="twitter:title" content="${l(R)}">
2738
- `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta name="twitter:description" content="${l(R)}">
2739
- `}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${l(R)}">
2740
- `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
2741
- `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
2719
+ `),"utf-8")}}async flush(){await this.writeQueue}}var P7,m0,v7;var u8=S(()=>{x4();P7={isEnabled(){return y4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=y4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let z=0;z<U;z++)Y+=`
2720
+ @end${K}`;X.push(`Added ${U} missing @end${K}`)}}if(X.length>0&&Z.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:Y,fixes:X}},createFallbackContent($,Z){if(N5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};m0=new C7,v7={isDevelopment(){return N5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
2721
+ `)}}});var l8=()=>{};var p8=S(()=>{b4();m8();u8();l8();x4()});var t0=S(()=>{p8()});function c8($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,B=U.length>1?U[1]:"";if(B&&Z[B])W=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${p(z)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),B=U+1,_=(()=>{try{let j=O0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return t("MetaTag",H,n.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),J.lastIndex=0}return Q}function i8($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=X.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let _=O0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return t("StructuredData",j,n.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),Q.lastIndex=0}return X}function n8($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let B=Q.substring(W).match(/^\s*\)/);if(!B)break;let _=W+B[0].length,j=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=O0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
2722
+ `,V+=`<meta name="title" content="${p(O.title)}">
2723
+ `;if(O.description)V+=`<meta name="description" content="${p(O.description)}">
2724
+ `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${p(w)}">
2725
+ `}if(O.robots)V+=`<meta name="robots" content="${p(O.robots)}">
2726
+ `;if(O.canonical)V+=`<link rel="canonical" href="${p(O.canonical)}">
2727
+ `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${p(w.type||"website")}">
2728
+ `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta property="og:title" content="${p(R)}">
2729
+ `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta property="og:description" content="${p(R)}">
2730
+ `}if(w.url||O.canonical){let R=w.url||O.canonical||"";V+=`<meta property="og:url" content="${p(R)}">
2731
+ `}if(w.image){if(V+=`<meta property="og:image" content="${p(w.image)}">
2732
+ `,w.imageAlt)V+=`<meta property="og:image:alt" content="${p(w.imageAlt)}">
2733
+ `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${p(String(w.imageWidth))}">
2734
+ `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${p(String(w.imageHeight))}">
2735
+ `}if(w.siteName)V+=`<meta property="og:site_name" content="${p(w.siteName)}">
2736
+ `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${p(w.card||"summary_large_image")}">
2737
+ `,w.title||O.title){let R=w.title||O.title||"";V+=`<meta name="twitter:title" content="${p(R)}">
2738
+ `}if(w.description||O.description){let R=w.description||O.description||"";V+=`<meta name="twitter:description" content="${p(R)}">
2739
+ `}if(w.image||O.openGraph&&O.openGraph.image){let R=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${p(R)}">
2740
+ `}if(w.site)V+=`<meta name="twitter:site" content="${p(w.site)}">
2741
+ `;if(w.creator)V+=`<meta name="twitter:creator" content="${p(w.creator)}">
2742
2742
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
2743
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return a("SEO",`Error processing @seo directive: ${V}`,i.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function i8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
2743
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return t("SEO",`Error processing @seo directive: ${V}`,n.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function o8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
2744
2744
  <!-- stx SEO Tags -->
2745
- <meta name="title" content="${l(G)}">
2746
- <meta name="description" content="${l(K)}">
2747
- <meta property="og:title" content="${l(G)}">
2748
- <meta property="og:description" content="${l(K)}">
2745
+ <meta name="title" content="${p(G)}">
2746
+ <meta name="description" content="${p(K)}">
2747
+ <meta property="og:title" content="${p(G)}">
2748
+ <meta property="og:description" content="${p(K)}">
2749
2749
  <meta property="og:type" content="website">
2750
2750
  <meta name="twitter:card" content="summary_large_image">
2751
- <meta name="twitter:title" content="${l(G)}">
2752
- <meta name="twitter:description" content="${l(K)}">
2751
+ <meta name="twitter:title" content="${p(G)}">
2752
+ <meta name="twitter:description" content="${p(K)}">
2753
2753
  `;if(q)W+=`
2754
- <meta property="og:image" content="${l(q)}">
2755
- <meta name="twitter:image" content="${l(q)}">
2754
+ <meta property="og:image" content="${p(q)}">
2755
+ <meta name="twitter:image" content="${p(q)}">
2756
2756
  `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
2757
- <title>${l(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2757
+ <title>${p(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
2758
2758
  ${W}
2759
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var n8,o8;var P7=b(()=>{t0();L0();n8={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return a("Meta","meta directive requires at least the meta name",i.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(J)}">`},hasEndTag:!1},o8={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return a("StructuredData","structuredData directive requires JSON-LD content",i.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return a("StructuredData","structuredData requires @type property",i.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 a("StructuredData",J,i.EVALUATION_ERROR)}},hasEndTag:!0}});import N5 from"path";function yK($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let B=z[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function PK($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
2759
+ `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var s8,r8;var x7=S(()=>{t0();L0();s8={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return t("Meta","meta directive requires at least the meta name",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},r8={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return t("StructuredData","structuredData directive requires JSON-LD content",n.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return t("StructuredData","structuredData requires @type property",n.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 t("StructuredData",J,n.EVALUATION_ERROR)}},hasEndTag:!0}});import T5 from"path";function CK($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let B=z[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function vK($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
2760
2760
  get ${z}() {
2761
2761
  return this.getAttribute('${z}') || '';
2762
2762
  }
@@ -2807,16 +2807,16 @@ ${U}
2807
2807
  }
2808
2808
 
2809
2809
  customElements.define('${Z}', ${G});
2810
- `}async function s8($,Z,Y,X){if(Z.length<1)return a("WebComponent","@webcomponent directive requires at least the tag name parameter",i.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[N5.join(N5.dirname(X),G,`${Q}.stx`),N5.join(process.cwd(),G,`${Q}.stx`),N5.join(N5.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await c(z)){q=await Bun.file(z).text();break}if(!q)return a("WebComponent",`Component file not found: ${Q}.stx`,i.FILE_NOT_FOUND);let W=yK(q,Q);return`<script type="module">
2811
- ${PK(W)}
2812
- </script>`}var r8=b(()=>{t0();H0()});var a8={};n(a8,{timingPlugin:()=>gK,pluginManager:()=>CK,definePlugin:()=>v$,debugPlugin:()=>fK,createVariablesPlugin:()=>hK,createFilterPlugin:()=>xK,createDirectivePlugin:()=>vK,PluginManager:()=>C7});function v$($){return $}class C7{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function vK($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function xK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function hK($){return v$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var CK,fK,gK;var t8=b(()=>{CK=new C7;fK=v$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),gK=v$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var $Z={};n($Z,{validateConfig:()=>lK,loadStxConfig:()=>f$,defineStxConfig:()=>uK,defaultConfig:()=>I1,config:()=>x7});import v7 from"fs";import T0 from"path";import{loadConfigWithResult as dK}from"bunfig";function mK($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=T0.join(process.cwd(),"resources","views"),Q=T0.join(process.cwd(),"resources","layouts");if(v7.existsSync(X)&&v7.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=T0.join(process.cwd(),"resources","views","pages");if(v7.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function f$($){if(!$){if(i1)return i1;if(x$)return x$}let Z=$?T0.resolve($):process.cwd(),Y=e8.get(Z);if(Y)return Y;let X=(async()=>{let J=(await dK({name:"stx",alias:"ui",cwd:Z,defaultConfig:I1,verbose:!1})).config,G=mK(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!T0.isAbsolute(J.partialsDir))J.partialsDir=T0.join(K,J.partialsDir);if(J.componentsDir&&!T0.isAbsolute(J.componentsDir))J.componentsDir=T0.join(K,J.componentsDir);if(J.layoutsDir&&!T0.isAbsolute(J.layoutsDir))J.layoutsDir=T0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (t8(),a8)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let _,j;try{_=await import(z),j=T0.dirname(J0.resolve(z))}catch{let L=T0.resolve(process.cwd(),z);_=await import(L),j=T0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=T0.resolve(j,H.components);q.push(L)}if(H.pages){let L=T0.resolve(j,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(e8.set(Z,X),!$)x$=X,X.then((Q)=>{i1=Q}).catch(()=>{});return X}function uK($){return $}function lK($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var I1,i1=null,e8,x$=null,x7;var T5=b(()=>{b4();y4();P4();C4();o4();B8();M7();D7();P7();r8();I1={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:g9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:s8,hasEndTag:!1,description:"Include a web component in the template"},k6,S6,n8,o8,b6,P6,C6,y6,g6,m6,z8,T7,...I7],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}};e8=new Map;x7=new Proxy(I1,{get($,Z){if(i1&&Z in i1)return i1[Z];if(!x$)f$().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import ZZ from"fs";import X0 from"path";function h7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function g7($,Z){if(D1.has($))D1.delete($);else if(D1.size>=pK)D1.delete(D1.keys().next().value);D1.set($,Z)}async function cK($){if(!Y1)return null;try{let Z=Bun.file(X0.join(Y1,`cw-${h7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function iK($,Z){if(!Y1)return;try{if(!ZZ.existsSync(Y1))ZZ.mkdirSync(Y1,{recursive:!0});await Bun.write(X0.join(Y1,`cw-${h7($)}.css`),Z)}catch{}}async function XZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function nK(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==X0.dirname(Y))$.push(X0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=X0.dirname(Y);if(Z){let X=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function oK(){if(YZ)return M5;YZ=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await XZ(Y);if(X){if(M5=X,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded`);return M5}}let Z=nK();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await XZ(Y);if(X){if(M5=X,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Y))}`);return M5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${j0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${j0.reset}`),console.warn(`${j0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${j0.reset}`),null}}async function sK($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=X0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${j0.yellow}[Crosswind]${j0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function rK($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function aK($,Z){try{let Y=await oK();if(!Y)return"";let X=rK($);if(X.size===0)return"";let Q=Z?X0.resolve(Z):process.cwd();if(!Y1)Y1=X0.join(Q,".stx/cache");let J=[...X].sort().join(" "),G=`${f7||"default"}::${J}`,K=D1.get(G);if(K!==void 0)return g7(G,K),K;let q=await cK(G);if(q!==null)return g7(G,q),q;if(!g$){let R=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (T5(),$Z)),N=await A(Q);if(N.css)if(typeof N.css==="string"){let T=X0.isAbsolute(N.css)?N.css:X0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);R=M.default||M,console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(R={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=X0.isAbsolute(N.css.config)?N.css.config:X0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);R={...M.default||M,...R}}}console.log(`${j0.green}[Crosswind]${j0.reset} Using inline CSS config from stx.config.ts`)}}catch{}g$=R||await sK(Q);try{f7=h7(JSON.stringify(g$??{}))}catch{f7="unhashable"}}let W=Y.defaultConfig||Y.config,U=g$||{},z=W.theme||{},_=(U.theme||{}).extend||{},j={...z};if(Object.keys(_).length>0)j.extend=_;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let R of H)F.generate(R);for(let R of X)F.generate(R);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
2813
- `);for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of N){let D=I.startsWith("dark:"),k=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<w.length;y++){let C=w[y].trim();if(C===`${k} {`||C.startsWith(`${k} {`)){let d=y,f="";while(d<w.length){if(f+=w[d],w[d].includes("}"))break;d++}let m=f.match(/\{([^}]+)\}/);if(m)if(D)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
2810
+ `}async function a8($,Z,Y,X){if(Z.length<1)return t("WebComponent","@webcomponent directive requires at least the tag name parameter",n.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[T5.join(T5.dirname(X),G,`${Q}.stx`),T5.join(process.cwd(),G,`${Q}.stx`),T5.join(T5.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await i(z)){q=await Bun.file(z).text();break}if(!q)return t("WebComponent",`Component file not found: ${Q}.stx`,n.FILE_NOT_FOUND);let W=CK(q,Q);return`<script type="module">
2811
+ ${vK(W)}
2812
+ </script>`}var t8=S(()=>{t0();H0()});var e8={};o(e8,{timingPlugin:()=>dK,pluginManager:()=>xK,definePlugin:()=>f4,debugPlugin:()=>hK,createVariablesPlugin:()=>mK,createFilterPlugin:()=>gK,createDirectivePlugin:()=>fK,PluginManager:()=>f7});function f4($){return $}class f7{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return X}}function fK($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function gK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function mK($){return f4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var xK,hK,dK;var $Z=S(()=>{xK=new f7;hK=f4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),dK=f4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var YZ={};o(YZ,{validateConfig:()=>cK,loadStxConfig:()=>h4,defineStxConfig:()=>pK,defaultConfig:()=>D1,config:()=>h7});import g7 from"fs";import A0 from"path";import{loadConfigWithResult as uK}from"bunfig";function lK($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=A0.join(process.cwd(),"resources","views"),Q=A0.join(process.cwd(),"resources","layouts");if(g7.existsSync(X)&&g7.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=A0.join(process.cwd(),"resources","views","pages");if(g7.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function h4($){if(!$){if(o1)return o1;if(g4)return g4}let Z=$?A0.resolve($):process.cwd(),Y=ZZ.get(Z);if(Y)return Y;let X=(async()=>{let J=(await uK({name:"stx",alias:"ui",cwd:Z,defaultConfig:D1,verbose:!1})).config,G=lK(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!A0.isAbsolute(J.partialsDir))J.partialsDir=A0.join(K,J.partialsDir);if(J.componentsDir&&!A0.isAbsolute(J.componentsDir))J.componentsDir=A0.join(K,J.componentsDir);if(J.layoutsDir&&!A0.isAbsolute(J.layoutsDir))J.layoutsDir=A0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => ($Z(),e8)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let _,j;try{_=await import(z),j=A0.dirname(G0.resolve(z))}catch{let L=A0.resolve(process.cwd(),z);_=await import(L),j=A0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=A0.resolve(j,H.components);q.push(L)}if(H.pages){let L=A0.resolve(j,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(ZZ.set(Z,X),!$)g4=X,X.then((Q)=>{o1=Q}).catch(()=>{});return X}function pK($){return $}function cK($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var D1,o1=null,ZZ,g4=null,h7;var M5=S(()=>{y$();P$();C$();v$();a$();j8();E7();b7();x7();t8();D1={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:d9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:a8,hasEndTag:!1,description:"Include a web component in the template"},P6,C6,s8,r8,v6,f6,g6,x6,u6,c6,_8,D7,...k7],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}};ZZ=new Map;h7=new Proxy(D1,{get($,Z){if(o1&&Z in o1)return o1[Z];if(!g4)h4().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import XZ from"fs";import Q0 from"path";function u7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function m7($,Z){if(E1.has($))E1.delete($);else if(E1.size>=iK)E1.delete(E1.keys().next().value);E1.set($,Z)}async function nK($){if(!X1)return null;try{let Z=Bun.file(Q0.join(X1,`cw-${u7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function oK($,Z){if(!X1)return;try{if(!XZ.existsSync(X1))XZ.mkdirSync(X1,{recursive:!0});await Bun.write(Q0.join(X1,`cw-${u7($)}.css`),Z)}catch{}}async function QZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function sK(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Q0.dirname(Y))$.push(Q0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Q0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=Q0.dirname(Y);if(Z){let X=[Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Q0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Q0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Q0.join(Z,"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 rK(){if(JZ)return I5;JZ=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await QZ(Y);if(X){if(I5=X,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded`);return I5}}let Z=sK();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await QZ(Y);if(X){if(I5=X,!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} CSS engine loaded from ${Q0.dirname(Q0.dirname(Y))}`);return I5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${j0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${j0.reset}`),console.warn(`${j0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${j0.reset}`),null}}async function aK($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=Q0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${j0.yellow}[Crosswind]${j0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function tK($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}J=Q.exec($)}return Z}async function eK($,Z){try{let Y=await rK();if(!Y)return"";let X=tK($);if(X.size===0)return"";let Q=Z?Q0.resolve(Z):process.cwd();if(!X1)X1=Q0.join(Q,".stx/cache");let J=[...X].sort().join(" "),G=`${d7||"default"}::${J}`,K=E1.get(G);if(K!==void 0)return m7(G,K),K;let q=await nK(G);if(q!==null)return m7(G,q),q;if(!d4){let R=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (M5(),YZ)),N=await A(Q);if(N.css)if(typeof N.css==="string"){let T=Q0.isAbsolute(N.css)?N.css:Q0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);R=M.default||M,console.log(`${j0.green}[Crosswind]${j0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(R={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=Q0.isAbsolute(N.css.config)?N.css.config:Q0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);R={...M.default||M,...R}}}console.log(`${j0.green}[Crosswind]${j0.reset} Using inline CSS config from stx.config.ts`)}}catch{}d4=R||await aK(Q);try{d7=u7(JSON.stringify(d4??{}))}catch{d7="unhashable"}}let W=Y.defaultConfig||Y.config,U=d4||{},z=W.theme||{},_=(U.theme||{}).extend||{},j={...z};if(Object.keys(_).length>0)j.extend=_;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let R of H)F.generate(R);for(let R of X)F.generate(R);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
2813
+ `);for(let[R,A]of Object.entries(V)){if(!X.has(R)&&!H.includes(R))continue;let N=A.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of N){let D=I.startsWith("dark:"),b=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let P=w[k].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let d=k,g="";while(d<w.length){if(g+=w[d],w[d].includes("}"))break;d++}let m=g.match(/\{([^}]+)\}/);if(m)if(D)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
2814
2814
  .${R} { ${T.join(" ")} }`;if(M.length)O+=`
2815
- @media (prefers-color-scheme: dark) { .dark .${R} { ${M.join(" ")} } }`}return g7(G,O),iK(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function JZ($,Z){let Y=await aK($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
2815
+ @media (prefers-color-scheme: dark) { .dark .${R} { ${M.join(" ")} } }`}return m7(G,O),oK(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function GZ($,Z){let Y=await eK($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
2816
2816
  ${Y}
2817
2817
  </style>`,Q=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(Q.test($)){let J=!1;return $.replace(Q,()=>{if(J)return"";return J=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
2818
2818
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
2819
- ${X}`);return X+$}var M5=null,YZ=!1,g$=null,pK=256,D1,Y1=null,f7=null;var QZ=b(()=>{D6();D1=new Map});function GZ(){return`
2819
+ ${X}`);return X+$}var I5=null,JZ=!1,d4=null,iK=256,E1,X1=null,d7=null;var KZ=S(()=>{S6();E1=new Map});function qZ(){return`
2820
2820
  // STX Lifecycle Runtime
2821
2821
  (function() {
2822
2822
  if (typeof window === 'undefined') return;
@@ -3161,7 +3161,7 @@ else {
3161
3161
 
3162
3162
  console.log('[stx] Lifecycle runtime initialized');
3163
3163
  })();
3164
- `}function d7($){return Symbol($)}var SO,bO,yO;var KZ=b(()=>{SO=d7("theme"),bO=d7("router"),yO=d7("i18n")});import*as UZ from"crypto";function qZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function tK(){return`stx-${UZ.randomBytes(4).toString("hex")}`}function eK($){return/\$\w+\./.test($)}function $q($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(eK(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:O,expr:R,fullMatch:F,originalAttr:O}),qZ(R).forEach((N)=>Y.add(N)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=tK(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:qZ(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function Zq($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3164
+ `}function l7($){return Symbol($)}var yO,PO,CO;var UZ=S(()=>{yO=l7("theme"),PO=l7("router"),CO=l7("i18n")});import*as zZ from"crypto";function WZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function $q(){return`stx-${zZ.randomBytes(4).toString("hex")}`}function Zq($){return/\$\w+\./.test($)}function Yq($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(Zq(V)){U=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:O,expr:R,fullMatch:F,originalAttr:O}),WZ(R).forEach((N)=>Y.add(N)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=$q(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:WZ(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function Xq($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3165
3165
  <script>
3166
3166
  (function() {
3167
3167
  'use strict';
@@ -3319,10 +3319,10 @@ else {
3319
3319
  }
3320
3320
  })();
3321
3321
  </script>
3322
- `,X}function WZ($){let{html:Z,bindings:Y,stores:X}=$q($);if(Y.length===0)return $;let Q=Zq(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var zZ=()=>{};function Yq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Xq(Z);case"google-analytics":return Jq(Z);case"plausible":return Qq(Z);case"self-hosted":return Gq(Z);case"custom":return Kq(Z);default:return""}}function Xq($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${y0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${y0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
3322
+ `,X}function BZ($){let{html:Z,bindings:Y,stores:X}=Yq($);if(Y.length===0)return $;let Q=Xq(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var _Z=()=>{};function Jq($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Qq(Z);case"google-analytics":return Gq(Z);case"plausible":return Kq(Z);case"self-hosted":return qq(Z);case"custom":return Uq(Z);default:return""}}function Qq($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${b0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${b0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
3323
3323
  <!-- Fathom Analytics -->
3324
- <script src="${y0(Y)}" ${Q.join(" ")}${X}></script>
3325
- `}function Jq($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=y0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
3324
+ <script src="${b0(Y)}" ${Q.join(" ")}${X}></script>
3325
+ `}function Gq($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=b0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
3326
3326
  <!-- Google Analytics -->
3327
3327
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
3328
3328
  <script>
@@ -3332,10 +3332,10 @@ else {
3332
3332
  gtag('config', '${Y}');
3333
3333
  ${X}
3334
3334
  </script>
3335
- `}function Qq($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${y0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
3335
+ `}function Kq($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${b0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
3336
3336
  <!-- Plausible Analytics -->
3337
- <script defer data-domain="${y0(Z.domain)}" src="${y0(Q)}"></script>
3338
- `}function Gq($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=y0(Z.siteId),X=y0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
3337
+ <script defer data-domain="${b0(Z.domain)}" src="${b0(Q)}"></script>
3338
+ `}function qq($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=b0(Z.siteId),X=b0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
3339
3339
  d.addEventListener('click',function(e){
3340
3340
  var a=e.target.closest('a');
3341
3341
  if(a&&a.hostname!==location.hostname){
@@ -3368,15 +3368,15 @@ else {
3368
3368
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
3369
3369
  })();
3370
3370
  </script>
3371
- `}function Kq($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
3371
+ `}function Uq($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
3372
3372
  <!-- Custom Analytics -->
3373
3373
  <script>
3374
3374
  ${Z.inlineScript}
3375
3375
  </script>
3376
- `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${y0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${y0(Q)}="${y0(J)}"`);return`
3376
+ `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${b0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${b0(Q)}="${b0(J)}"`);return`
3377
3377
  <!-- Custom Analytics -->
3378
- <script${Y.length>0?` ${Y.join(" ")}`:""} src="${y0(Z.scriptUrl)}" defer></script>
3379
- `}function BZ($,Z){let Y=Yq(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function y0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var _Z=()=>{};function OZ($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(qq.has(X))Z.systemKeys.push(X);else if(X in LZ)Z.mouse=X;else if(X in HZ||/^[a-z]$/.test(X))Z.keys.push(HZ[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function FZ($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!jZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:OZ(F.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!jZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:OZ(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function Uq($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=LZ[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Wq($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function zq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Uq($),Q=Wq($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3378
+ <script${Y.length>0?` ${Y.join(" ")}`:""} src="${b0(Z.scriptUrl)}" defer></script>
3379
+ `}function jZ($,Z){let Y=Jq(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var HZ=()=>{};function FZ($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(Wq.has(X))Z.systemKeys.push(X);else if(X in VZ)Z.mouse=X;else if(X in LZ||/^[a-z]$/.test(X))Z.keys.push(LZ[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function wZ($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!OZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:FZ(F.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!OZ.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:FZ(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function zq($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=VZ[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Bq($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function _q($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=zq($),Q=Bq($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3380
3380
  (function() {
3381
3381
  var $el = document.getElementById('${Y}');
3382
3382
  if (!$el) return;
@@ -3430,7 +3430,7 @@ else {
3430
3430
  __stx_runHandler('${K}', $event, $el);
3431
3431
  }
3432
3432
  }${G});
3433
- })();`}function Bq($){if($.length===0)return"";return`
3433
+ })();`}function jq($){if($.length===0)return"";return`
3434
3434
  <script data-stx-events>
3435
3435
  (function() {
3436
3436
  'use strict';
@@ -3478,11 +3478,11 @@ else {
3478
3478
  }
3479
3479
 
3480
3480
  // Event listeners
3481
- ${$.flatMap((Y)=>Y.events).map(zq).join(`
3481
+ ${$.flatMap((Y)=>Y.events).map(_q).join(`
3482
3482
  `)}
3483
3483
  })();
3484
- </script>`}function _q($){let Z=FZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[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,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function VZ($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=_q($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=FZ($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let B of W.events)B.elementId=z[1]}for(let z of W.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(j,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=Bq(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
3485
- `+J.slice(K);else J+=G;return J}var jZ,HZ,qq,LZ;var wZ=b(()=>{jZ=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"]),HZ={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"},qq=new Set(["ctrl","alt","shift","meta"]),LZ={left:0,middle:1,right:2}});function h$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function RZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function Hq($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=RZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${NZ++}`,U=RZ(G,"x-init"),z=Oq($,J,K+Q.length),B=$.slice(K,z.endIndex),_=Lq(B);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function Oq($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function Lq($){let Z=new Map,Y=$.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(Y))!==null){let[,J,G]=Q,K=Fq(J);Z.set(G,K)}return Z}function Fq($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${jq++}`}function Vq(){return`
3484
+ </script>`}function Hq($){let Z=wZ($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[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,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function RZ($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=Hq($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=wZ($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let B of W.events)B.elementId=z[1]}for(let z of W.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(j,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=jq(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
3485
+ `+J.slice(K);else J+=G;return J}var OZ,LZ,Wq,VZ;var AZ=S(()=>{OZ=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"]),LZ={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"},Wq=new Set(["ctrl","alt","shift","meta"]),VZ={left:0,middle:1,right:2}});function m4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function NZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function Lq($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=NZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${MZ++}`,U=NZ(G,"x-init"),z=Fq($,J,K+Q.length),B=$.slice(K,z.endIndex),_=Vq(B);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function Fq($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function Vq($){let Z=new Map,Y=$.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(Y))!==null){let[,J,G]=Q,K=wq(J);Z.set(G,K)}return Z}function wq($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Oq++}`}function Rq(){return`
3486
3486
  // STX Reactive Runtime - x-cloak and transition CSS
3487
3487
  (function() {
3488
3488
  var style = document.createElement('style');
@@ -3689,7 +3689,7 @@ window.__stx_reactive = (function() {
3689
3689
 
3690
3690
  return { initScope: initScope, reactive: reactive };
3691
3691
  })();
3692
- `}function AZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=x0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function wq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=AZ(X.stateExpr,Z),G=X.initExpr?AZ(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
3692
+ `}function TZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=f0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=f0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function Aq($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=TZ(X.stateExpr,Z),G=X.initExpr?TZ(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
3693
3693
  (function() {
3694
3694
  var scopeEl = document.querySelector('${X.selector}');
3695
3695
  if (!scopeEl) return;
@@ -3698,14 +3698,14 @@ window.__stx_reactive = (function() {
3698
3698
  })();`}).join(`
3699
3699
  `);return`
3700
3700
  <script data-stx-scoped data-stx-reactive>
3701
- ${Vq()}
3701
+ ${Rq()}
3702
3702
  ${Y}
3703
- </script>`}function TZ($,Z,Y){if(NZ=0,!Aq($))return $;let X=Hq($);if(X.length===0)return $;let Q=Rq($,X),J=wq(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3704
- `+Q.slice(G);else Q+=J;return Q}function Rq($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${h$(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${h$(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${h$(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${h$(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Aq($){return/x-data\s*=\s*["']/.test($)}var NZ=0,jq=0;var MZ=b(()=>{c0()});import Nq from"fs";import m7 from"path";import{createHighlighter as Tq}from"ts-syntax-highlighter";async function Mq($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await Nq.promises.stat($)).mtime.getTime();if(Z.cache&&u7.has($)){let z=u7.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=l6(Q),K=Z.markdown||x7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=G5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Iq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)u7.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:Q0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function Iq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!d$)try{d$=await Tq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!d$.getSupportedLanguages().includes(B))return K;return(await d$.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function IZ($,Z,Y="",X={}){return await Dq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!m7.isAbsolute(K))U=m7.resolve(m7.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(N||T)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await Mq(U,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return Q0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function Dq($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).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 u7,d$=null;var DZ=b(()=>{T5();H0();u7=new Map});function X1($,Z){try{let Y=$.trim();if(Z0(Y))return Y0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var EZ=b(()=>{L0()});function J1($,Z){let Y=Eq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function Eq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=D0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function E1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function kZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=J1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,_=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=J1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function I5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=kZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function m$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=D0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=E1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function l7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=J1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=J1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var SZ=()=>{};var bZ=()=>{};var u$=b(()=>{SZ();bZ()});function yq($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=l7(X,G);if(!K)break;try{let q;if(Z0(K.expression))q=Y0(K.expression,Object.keys(Z))(...Object.values(Z));else q=$0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let B;if(z.value&&Z0(z.value))B=Y0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=$0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=a("Switch",`Error evaluating @switch expression: ${W}`,i.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function k1($,Z,Y){let X=$;X=yq(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=J1(X,K+7);if(!q)break;let W=q.endPos,U=E1(X,"unless","endunless",W);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 z=X.slice(W,U),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")H++;else if(R.type==="close")H--;else if(R.type==="else"&&H===0){_=R.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=c7(X,Z,Y),X=i7(X,Z,Y),X=p7(X,Z);let Q=()=>{let J=I5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&Z0(U.condition))z=Y0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=$0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=a(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,i.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=a("If",`Error processing @if block: ${W}`,i.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function yZ($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function p7($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")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=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),_=yZ(B);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?X1(`auth?.check && auth?.user?.[${U}]`,Z):X1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),_=yZ(B);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?X1(`!auth?.check || !auth?.user?.[${U}]`,Z):X1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=X1(W,Z);U.push(z)}return Z.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}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((y,C)=>y.pos-C.pos);for(let y of T){if(y.type==="open"){V++;continue}if(y.type==="close"){V--;continue}if(V===0)O.push(y)}let I=[],D=0;for(let y=0;y<O.length;y++){let C=O[y];if(I.push({content:F.slice(D,C.pos),ability:void 0}),C.type==="elseDirective"){let d=F.slice(C.pos+`@${W}`.length),f=G(d);if(f){I[I.length-1]={content:F.slice(D,C.pos)},D=C.pos+`@${W}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[y+1],o=m?m.pos:F.length;I.push({content:F.slice(D,o),ability:f.ability,type:f.type,id:f.id}),D=o}}else D=C.pos+5}if(D<F.length){let y=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),P=K==="can"?E:!E,k="";if(P)k=I[0]?.content||"";else{let y=!1;for(let C=1;C<I.length;C++){let d=I[C];if(d.isFinalElse){k=d.content,y=!0;break}if(d.ability){let f=J(d.ability,d.type,d.id);if(K==="can"?f:!f){k=d.content,y=!0;break}}}if(!y&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)k=C.content}}Y=Y.substring(0,B)+k+Y.substring(L+`@${q}`.length),U=!0}}return Y}function c7($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let _=B.index,j=J1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=E1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){V=A;break}R=A+1}try{let A=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=A?T:M}else N=A?F:"";J=J.substring(0,_)+N+J.substring(L+`@${K}`.length),U=!0}catch(A){let N=A instanceof Error?A.message:String(A),T=a(W,`Error processing @${G} directive: ${N}`,i.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=X1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=X1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function i7($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,R=-1;while(V>0&&w<j.length){U.lastIndex=w,z.lastIndex=w;let E=U.exec(j),P=z.exec(j),k=E?E.index:1/0,y=P?P.index:1/0;if(k<y)V++,w=k+E[0].length;else if(y<1/0){if(V--,V===0){R=y;break}w=y+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=j.substring(O,R),N=-1,T=0,M=0;while(M<A.length){let E=A.indexOf("@",M);if(E===-1)break;let P=A.substring(E);if(B.test(P)){T++,M=E+1;continue}if(_.test(P)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){N=E;break}M=E+1}let I;if(N!==-1){let E=A.slice(0,N),P=A.slice(N+5);I=W?E:P}else I=W?A:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(R+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var l$=b(()=>{EZ();t0();u$();L0()});function CZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function p$($,Z){if(!$)return Z?.nonceGenerator?.()??CZ();let Y=PZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??CZ(),PZ.set($,Y);return Y}function Pq($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function vZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${Pq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function xZ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?p$(Y,Z):void 0,Q=vZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3705
- ${Q}`)}function fZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?p$(Z,J):void 0;return vZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return p$(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=p$(Z,J);return Q}var PZ;var gZ=b(()=>{PZ=new WeakMap});import Cq from"crypto";function xq($=vq){let Z=Cq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return n7=Z,Z}function fq(){if(!n7)xq();return n7}function gq($=hZ){let Z=fq();return`<input type="hidden" name="${$}" value="${Z}">`}function dZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return gq(X||hZ)})}var vq=40,hZ="_token",n7=null;var mZ=()=>{};async function uZ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await hq(Q,J,Z,Y,X);else Q=await dq(Q,J,Z,Y,X)}return Q}async function hq($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=d1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?lZ(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:_,processed:a("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,i.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];W=W.replace(j,H)}return W}async function dq($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=d1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,j=""]=U,H=U.index||0;try{let L=lZ(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:a("CustomDirective",`Error in @${J}(${j}): ${F}`,i.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=d1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:a("CustomDirective",`Error in @${J}: ${L}`,i.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function lZ($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var pZ=b(()=>{t0();m1()});import mq from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function c$($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function uq(){return mq.randomUUID()}function i$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=uq();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${V0(J)}">`;return X}),Y}function nZ($,Z,Y=iZ){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=Q1(W),_=U.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${V0(j)}" action="${V0(z)}"${B?` ${B}`:""}>`;if(H+=`
3706
- ${i$("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
3707
- ${i$(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",B=Q1(W),_=D5(U,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=E5(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=c$(O?O[1]:"",Y.input,F,Y.inputError),w=B.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(L)}" name="${V0(U)}" value="${V0(j)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=Q1(G),W=D5(J,Z)||K.trim(),U=E5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=c$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${V0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=Q1(G),W=D5(J,Z),U=E5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=c$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=Q1(K),W=D5(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=Q1(K),W=D5(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=Q1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=E5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=c$(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${V0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${V0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=Q1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function oZ($,Z,Y=iZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(E5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return cZ(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return cZ(Q,Z)}let q=K.trim();if(Z0(q)){let W=$0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function E5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function cZ($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function D5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function Q1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var iZ;var sZ=b(()=>{L0();iZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import r7 from"path";async function lq(){if(k5!==void 0)return k5;try{k5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{k5=null}return k5}function pq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function cq($,Z){if({...e7,...Z.i18n}.cache&&a7[$]){let Q=a7[$],J=Z.i18n?.cacheMaxAge??0;if(!pq(Q,J))return Q.translations}if(S5[$]?.state==="loading")return S5[$].promise;o7[$]="loading";let X=t7($,Z).then((Q)=>{return o7[$]="loaded",delete S5[$],Q}).catch((Q)=>{throw o7[$]="error",S5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return S5[$]={promise:X,state:"loading"},X}async function t7($,Z){let Y={...e7,...Z.i18n},X=r7.isAbsolute(Y.translationsDir)?Y.translationsDir:r7.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await lq(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:rq(Y.format)}):await iq($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return t7(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)a7[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return t7(Y.defaultLocale,Z);return{}}}async function iq($,Z,Y){let X=r7.join(Y,`${$}${nq(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return oq(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function nq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function oq($){let Z={},Y=$.split(`
3708
- `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=sq(B)}}return Z}function sq($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function rq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function aq($,Z){return cq($,Z)}function tq($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function eq($,Z={}){return tZ($,Z)}function tZ($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=$U($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=ZU(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function $U($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function ZU($,Z){let Y=YU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return XU(Q,Y.slice(2).join(","),Z);case"select":return QU(Q,Y.slice(2).join(","));case"selectordinal":return GU(Q,Y.slice(2).join(","));case"number":return qU(Q,Y[2]?.trim());case"date":return UU(Q,Y[2]?.trim());case"time":return WU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function YU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function XU($,Z,Y){let X=Number($)||0,Q=$3(Z),J=`=${X}`;if(Q[J])return s7(Q[J],X,Y);let G=JU(X);if(Q[G])return s7(Q[G],X,Y);if(Q.other)return s7(Q.other,X,Y);return String(X)}function s7($,Z,Y){let X=$.replace(/#/g,String(Z));return tZ(X,Y)}function JU($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function QU($,Z){let Y=String($||""),X=$3(Z);if(X[Y])return X[Y];return X.other||String($)}function GU($,Z){let Y=Number($)||0,X=$3(Z),Q=KU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function KU($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function $3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function qU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function UU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function WU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function zU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function rZ($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(zU(G))return eq(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=tq(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function eZ($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...e7,...X.i18n},K=await aq(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await aZ(Q,J,async(U,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return O0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return rZ(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return a("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,i.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((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await aZ(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return rZ(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return a("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,i.EVALUATION_ERROR)}}),Q}async function aZ($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var k5,e7,a7,S5,o7;var $2=b(()=>{t0();L0();e7={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},a7={},S5={},o7={}});var X3={};n(X3,{streamingSuspenseDirective:()=>X2,streamToResponse:()=>NU,streamTemplateSimple:()=>VU,streamTemplate:()=>_U,renderStreamingPage:()=>HU,registerStreamingDirectives:()=>RU,processStreamDirectives:()=>LU,processSectionDirectives:()=>AU,islandDirective:()=>J2,generateHydrationRuntime:()=>TU,extractStreamBoundaries:()=>FU,createStreamRenderer:()=>wU,buildSuspenseResolveScript:()=>Y3,SUSPENSE_RESOLVER_RUNTIME:()=>Y2});import n$ from"path";function BU($){let Z=[],Y=0,X;Z2.lastIndex=0;while((X=Z2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function _U($,Z={},Y={}){let X={...I1,...Y,streaming:{...Z3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:n$.dirname($)};if(q.trim())await R1(q,U,$);let z=BU(W),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(S1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await F0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(S1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let N=W.slice(w,R.start);if(N.trim()){let T=await F0(N,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let A=await F0(R.content,U,$,X,B);J.enqueue(A),await new Promise((N)=>setTimeout(N,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let A=await F0(R,U,$,X,B);J.enqueue(A)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await F0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3703
+ </script>`}function IZ($,Z,Y){if(MZ=0,!Tq($))return $;let X=Lq($);if(X.length===0)return $;let Q=Nq($,X),J=Aq(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3704
+ `+Q.slice(G);else Q+=J;return Q}function Nq($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${m4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${m4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${m4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${m4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Tq($){return/x-data\s*=\s*["']/.test($)}var MZ=0,Oq=0;var DZ=S(()=>{c0()});import Mq from"fs";import p7 from"path";import{createHighlighter as Iq}from"ts-syntax-highlighter";async function Dq($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await Mq.promises.stat($)).mtime.getTime();if(Z.cache&&c7.has($)){let z=c7.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=n6(Q),K=Z.markdown||h7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=K5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Eq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)c7.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function Eq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!u4)try{u4=await Iq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!u4.getSupportedLanguages().includes(B))return K;return(await u4.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function EZ($,Z,Y="",X={}){return await kq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!p7.isAbsolute(K))U=p7.resolve(p7.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),A=V.substring(w+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(N||T)A=A.substring(1,A.length-1);z[R]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await Dq(U,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return K0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function kq($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).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 c7,u4=null;var kZ=S(()=>{M5();H0();c7=new Map});function J1($,Z){try{let Y=$.trim();if(X0(Y))return J0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var bZ=S(()=>{L0()});function Q1($,Z){let Y=bq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function bq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=D0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function k1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function SZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=k1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,_=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=Q1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function D5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=SZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function l4($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=D0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=k1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function i7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=k1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=Q1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var yZ=()=>{};var PZ=()=>{};var p4=S(()=>{yZ();PZ()});function Cq($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=i7(X,G);if(!K)break;try{let q;if(X0(K.expression))q=J0(K.expression,Object.keys(Z))(...Object.values(Z));else q=$0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let B;if(z.value&&X0(z.value))B=J0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=$0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=t("Switch",`Error evaluating @switch expression: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function b1($,Z,Y){let X=$;X=Cq(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=Q1(X,K+7);if(!q)break;let W=q.endPos,U=k1(X,"unless","endunless",W);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 z=X.slice(W,U),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(z))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(z))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(z))!==null)V.push({pos:w.index,type:"else"});V.sort((R,A)=>R.pos-A.pos);for(let R of V)if(R.type==="open")H++;else if(R.type==="close")H--;else if(R.type==="else"&&H===0){_=R.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=o7(X,Z,Y),X=s7(X,Z,Y),X=n7(X,Z);let Q=()=>{let J=D5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&X0(U.condition))z=J0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=$0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=t(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,n.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=t("If",`Error processing @if block: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function CZ($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function n7($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")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=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),_=CZ(B);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?J1(`auth?.check && auth?.user?.[${U}]`,Z):J1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),_=CZ(B);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?J1(`!auth?.check || !auth?.user?.[${U}]`,Z):J1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=J1(W,Z);U.push(z)}return Z.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}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,P)=>k.pos-P.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let P=O[k];if(I.push({content:F.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let d=F.slice(P.pos+`@${W}`.length),g=G(d);if(g){I[I.length-1]={content:F.slice(D,P.pos)},D=P.pos+`@${W}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let m=O[k+1],s=m?m.pos:F.length;I.push({content:F.slice(D,s),ability:g.ability,type:g.type,id:g.id}),D=s}}else D=P.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),C=K==="can"?E:!E,b="";if(C)b=I[0]?.content||"";else{let k=!1;for(let P=1;P<I.length;P++){let d=I[P];if(d.isFinalElse){b=d.content,k=!0;break}if(d.ability){let g=J(d.ability,d.type,d.id);if(K==="can"?g:!g){b=d.content,k=!0;break}}}if(!k&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)b=P.content}}Y=Y.substring(0,B)+b+Y.substring(L+`@${q}`.length),U=!0}}return Y}function o7($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let _=B.index,j=Q1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=k1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,w=0,R=0;while(R<F.length){let A=F.indexOf("@",R);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){w++,R=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){w--,R=A+1;continue}if(w===0&&/^@else(?![a-z])/.test(N)){V=A;break}R=A+1}try{let A=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=A?T:M}else N=A?F:"";J=J.substring(0,_)+N+J.substring(L+`@${K}`.length),U=!0}catch(A){let N=A instanceof Error?A.message:String(A),T=t(W,`Error processing @${G} directive: ${N}`,n.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=J1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=J1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function s7($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,R=-1;while(V>0&&w<j.length){U.lastIndex=w,z.lastIndex=w;let E=U.exec(j),C=z.exec(j),b=E?E.index:1/0,k=C?C.index:1/0;if(b<k)V++,w=b+E[0].length;else if(k<1/0){if(V--,V===0){R=k;break}w=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=j.substring(O,R),N=-1,T=0,M=0;while(M<A.length){let E=A.indexOf("@",M);if(E===-1)break;let C=A.substring(E);if(B.test(C)){T++,M=E+1;continue}if(_.test(C)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){N=E;break}M=E+1}let I;if(N!==-1){let E=A.slice(0,N),C=A.slice(N+5);I=W?E:C}else I=W?A:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(R+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var c4=S(()=>{bZ();t0();p4();L0()});function xZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function i4($,Z){if(!$)return Z?.nonceGenerator?.()??xZ();let Y=vZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??xZ(),vZ.set($,Y);return Y}function vq($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function fZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${vq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function gZ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?i4(Y,Z):void 0,Q=fZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3705
+ ${Q}`)}function hZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?i4(Z,J):void 0;return fZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return i4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=i4(Z,J);return Q}var vZ;var dZ=S(()=>{vZ=new WeakMap});import xq from"crypto";function gq($=fq){let Z=xq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return r7=Z,Z}function hq(){if(!r7)gq();return r7}function dq($=mZ){let Z=hq();return`<input type="hidden" name="${$}" value="${Z}">`}function uZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return dq(X||mZ)})}var fq=40,mZ="_token",r7=null;var lZ=()=>{};async function pZ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await mq(Q,J,Z,Y,X);else Q=await uq(Q,J,Z,Y,X)}return Q}async function mq($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=u1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?cZ(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:_,processed:t("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,n.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];W=W.replace(j,H)}return W}async function uq($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=u1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,j=""]=U,H=U.index||0;try{let L=cZ(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:t("CustomDirective",`Error in @${J}(${j}): ${F}`,n.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=u1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:t("CustomDirective",`Error in @${J}: ${L}`,n.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function cZ($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var iZ=S(()=>{t0();l1()});import lq from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function n4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function pq(){return lq.randomUUID()}function o4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=pq();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${V0(J)}">`;return X}),Y}function sZ($,Z,Y=oZ){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=G1(W),_=U.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${V0(j)}" action="${V0(z)}"${B?` ${B}`:""}>`;if(H+=`
3706
+ ${o4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
3707
+ ${o4(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",B=G1(W),_=E5(U,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=k5(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=n4(O?O[1]:"",Y.input,F,Y.inputError),w=B.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(L)}" name="${V0(U)}" value="${V0(j)}" class="${V}"${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=G1(G),W=E5(J,Z)||K.trim(),U=k5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=n4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${V0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=G1(G),W=E5(J,Z),U=k5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=n4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=G1(K),W=E5(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=G1(K),W=E5(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=G1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=k5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=n4(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${V0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${V0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=G1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function rZ($,Z,Y=oZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(k5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return nZ(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return nZ(Q,Z)}let q=K.trim();if(X0(q)){let W=$0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function k5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function nZ($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function E5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function G1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var oZ;var aZ=S(()=>{L0();oZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import e7 from"path";async function cq(){if(b5!==void 0)return b5;try{b5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{b5=null}return b5}function iq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function nq($,Z){if({...Y3,...Z.i18n}.cache&&$3[$]){let Q=$3[$],J=Z.i18n?.cacheMaxAge??0;if(!iq(Q,J))return Q.translations}if(S5[$]?.state==="loading")return S5[$].promise;a7[$]="loading";let X=Z3($,Z).then((Q)=>{return a7[$]="loaded",delete S5[$],Q}).catch((Q)=>{throw a7[$]="error",S5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return S5[$]={promise:X,state:"loading"},X}async function Z3($,Z){let Y={...Y3,...Z.i18n},X=e7.isAbsolute(Y.translationsDir)?Y.translationsDir:e7.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await cq(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:tq(Y.format)}):await oq($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return Z3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)$3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return Z3(Y.defaultLocale,Z);return{}}}async function oq($,Z,Y){let X=e7.join(Y,`${$}${sq(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return rq(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function sq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function rq($){let Z={},Y=$.split(`
3708
+ `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=aq(B)}}return Z}function aq($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function tq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function eq($,Z){return nq($,Z)}function $U($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function ZU($,Z={}){return $2($,Z)}function $2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=YU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=XU(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function YU($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function XU($,Z){let Y=JU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return QU(Q,Y.slice(2).join(","),Z);case"select":return KU(Q,Y.slice(2).join(","));case"selectordinal":return qU(Q,Y.slice(2).join(","));case"number":return WU(Q,Y[2]?.trim());case"date":return zU(Q,Y[2]?.trim());case"time":return BU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function JU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function QU($,Z,Y){let X=Number($)||0,Q=X3(Z),J=`=${X}`;if(Q[J])return t7(Q[J],X,Y);let G=GU(X);if(Q[G])return t7(Q[G],X,Y);if(Q.other)return t7(Q.other,X,Y);return String(X)}function t7($,Z,Y){let X=$.replace(/#/g,String(Z));return $2(X,Y)}function GU($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function KU($,Z){let Y=String($||""),X=X3(Z);if(X[Y])return X[Y];return X.other||String($)}function qU($,Z){let Y=Number($)||0,X=X3(Z),Q=UU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function UU($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function X3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function WU($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function zU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function BU($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function _U($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function tZ($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(_U(G))return ZU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=$U(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function Z2($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...Y3,...X.i18n},K=await eq(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await eZ(Q,J,async(U,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return O0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return tZ(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return t("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,n.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((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await eZ(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return tZ(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return t("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,n.EVALUATION_ERROR)}}),Q}async function eZ($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var b5,Y3,$3,S5,a7;var Y2=S(()=>{t0();L0();Y3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},$3={},S5={},a7={}});var G3={};o(G3,{streamingSuspenseDirective:()=>Q2,streamToResponse:()=>MU,streamTemplateSimple:()=>RU,streamTemplate:()=>HU,renderStreamingPage:()=>LU,registerStreamingDirectives:()=>NU,processStreamDirectives:()=>VU,processSectionDirectives:()=>TU,islandDirective:()=>G2,generateHydrationRuntime:()=>IU,extractStreamBoundaries:()=>wU,createStreamRenderer:()=>AU,buildSuspenseResolveScript:()=>Q3,SUSPENSE_RESOLVER_RUNTIME:()=>J2});import s4 from"path";function jU($){let Z=[],Y=0,X;X2.lastIndex=0;while((X=X2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function HU($,Z={},Y={}){let X={...D1,...Y,streaming:{...J3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:s4.dirname($)};if(q.trim())await A1(q,U,$);let z=jU(W),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(S1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await F0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(S1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let N=W.slice(w,R.start);if(N.trim()){let T=await F0(N,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let A=await F0(R.content,U,$,X,B);J.enqueue(A),await new Promise((N)=>setTimeout(N,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let A=await F0(R,U,$,X,B);J.enqueue(A)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await F0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3709
3709
  <template data-suspense-fallback>Loading...</template>
3710
3710
  </div>`),j.set(L.name,F0(L.content,U,$,X,B))}J.enqueue(`
3711
3711
  <script>
@@ -3723,13 +3723,13 @@ ${Q}`)}function fZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?
3723
3723
  }
3724
3724
  };
3725
3725
  })();
3726
- </script>`);let H=Array.from(j.entries()).map(async([L,F])=>{J.enqueue(await Y3(L,F))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function Y3($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
3726
+ </script>`);let H=Array.from(j.entries()).map(async([L,F])=>{J.enqueue(await Q3(L,F))});await Promise.all(H)}J.close()}catch(G){J.error(G)}}})}async function Q3($,Z){try{let X=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
3727
3727
  <script>
3728
3728
  window.__stxSuspense.resolve('${$}', \`${X}\`);
3729
3729
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
3730
3730
  <script>
3731
- window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${g0(X)}</div>');
3732
- </script>`}}function jU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function HU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(Y2),await Promise.all(Z.map(async(J)=>{let G=jU(J.render(),X,J.id);Q.enqueue(await Y3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function LU($,Z){return $.replace(OU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function FU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function VU($,Z={},Y={}){let X={...I1,...Y,streaming:{...Z3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:n$.dirname($)};if(q.trim())await R1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(S1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await F0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(S1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let R=W.slice(O,V.start);if(R.trim()){let A=await F0(R,U,$,X,z);J.enqueue(A)}}let w=await F0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await F0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function wU($,Z={}){let Y={...I1,...Z,streaming:{...Z3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;S1.lastIndex=0;while((W=S1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let U=G.replace(S1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:n$.dirname($)};return await R1(J,_,$),F0(U,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${g0(B)}" not found in template "${g0($)}"</div>`;let j={..._,__filename:$,__dirname:n$.dirname($)};await R1(J,j,$);let H=new Set;return await F0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return Q0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function RU($={}){let Z=[];if($.streaming?.enabled)Z.push(X2);if($.hydration?.enabled)Z.push(J2);return Z}async function AU($,Z,Y,X={}){return $}function NU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function TU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
3731
+ window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${h0(X)}</div>');
3732
+ </script>`}}function OU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function LU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(J2),await Promise.all(Z.map(async(J)=>{let G=OU(J.render(),X,J.id);Q.enqueue(await Q3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function VU($,Z){return $.replace(FU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function wU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function RU($,Z={},Y={}){let X={...D1,...Y,streaming:{...J3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:s4.dirname($)};if(q.trim())await A1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(S1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await F0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(S1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let R=W.slice(O,V.start);if(R.trim()){let A=await F0(R,U,$,X,z);J.enqueue(A)}}let w=await F0(V.content,U,$,X,z);J.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await F0(V,U,$,X,z);J.enqueue(w)}}}J.close()}catch(G){J.error(G)}}})}async function AU($,Z={}){let Y={...D1,...Z,streaming:{...J3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;S1.lastIndex=0;while((W=S1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let U=G.replace(S1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:s4.dirname($)};return await A1(J,_,$),F0(U,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${h0(B)}" not found in template "${h0($)}"</div>`;let j={..._,__filename:$,__dirname:s4.dirname($)};await A1(J,j,$);let H=new Set;return await F0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return K0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function NU($={}){let Z=[];if($.streaming?.enabled)Z.push(Q2);if($.hydration?.enabled)Z.push(G2);return Z}async function TU($,Z,Y,X={}){return $}function MU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function IU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
3733
3733
  `);if(Z==="loader")return`
3734
3734
  (function() {
3735
3735
  window.__stx = window.__stx || {};
@@ -3871,7 +3871,7 @@ else {
3871
3871
  else {
3872
3872
  stx.hydrate();
3873
3873
  }
3874
- })();`}var Z3,S1,Z2,Y2=`
3874
+ })();`}var J3,S1,X2,J2=`
3875
3875
  <script>
3876
3876
  (function(){
3877
3877
  window.__stxSuspense = window.__stxSuspense || {
@@ -3891,25 +3891,25 @@ else {
3891
3891
  }
3892
3892
  };
3893
3893
  })();
3894
- </script>`,OU,X2,J2;var J3=b(()=>{T5();c0();J$();H0();Z3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},S1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,Z2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;OU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;X2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},J2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
3894
+ </script>`,FU,Q2,G2;var K3=S(()=>{M5();c0();G4();H0();J3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},S1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,X2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;FU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;Q2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},G2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
3895
3895
  ${W}
3896
3896
  <script type="application/json" data-island-props="${G}">
3897
3897
  ${q?`{${q}}`:"{}"}
3898
3898
  </script>
3899
- </div>`}}});var K2={};n(K2,{warnUnbalancedTags:()=>Q3,findUnbalancedTags:()=>G2});function G1($){return $.replace(/[^\n]/g," ")}function G2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,G1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,G1).replace(/<!--[\s\S]*?-->/g,G1).replace(/\{\{\{[\s\S]*?\}\}\}/g,G1).replace(/\{\{[\s\S]*?\}\}/g,G1).replace(/\{!![\s\S]*?!!\}/g,G1).replace(/"[^"]*"/g,G1).replace(/'[^']*'/g,G1),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(MU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
3900
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(IU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function Q3($,Z){let Y;try{Y=G2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(Q2.has(X))return;Q2.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var MU,IU,Q2;var G3=b(()=>{MU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),IU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);Q2=new Set});import f0 from"path";import K3 from"fs";function q2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function U2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class W2{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),q2(Q),U2(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${q2(Q)}.stx`,`${U2(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=f0.resolve(f0.dirname(Z),`${Q}.stx`);if(await c(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(f0.join(f0.dirname(W),"components"));if(q)K.push(q);let U=f0.join(f0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[f0.resolve(z,"src/components"),f0.resolve(z,"components"),f0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=f0.join(_,j);if(await c(H))return H}try{if(!K3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=K3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=f0.join(_,L.name);for(let O of G){let V=f0.join(F,O);if(await c(V))return V}}}catch{}}return null}}var E0;var q3=b(()=>{H0();E0=new W2});function K1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function DU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var U3;var W3=b(()=>{U3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=DU($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${K1(X.value)}"`);else q.push(`href="${K1(X.value)}"`);if(Q)q.push(`class="${K1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${K1(J)}"`),q.push(`data-stx-exact-active-class="${K1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,z]of Object.entries($.static)){if(W.has(U))continue;if(typeof z==="boolean"){if(z)q.push(K1(U))}else q.push(`${K1(U)}="${K1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function B3($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function z2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=EU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function _3($,Z,Y,X){return Z.map((Q)=>`${b5($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function kU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${b5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function b5($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function SU($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var EU,z3,j3;var H3=b(()=>{EU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},z3=[320,640,768,1024,1280,1536,1920];j3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=M0($,"src")||"",Q=M0($,"alt")||"",J=M0($,"width"),G=M0($,"height"),K=M0($,"sizes"),q=M0($,"srcset"),W=M0($,"densities"),U=M0($,"format"),z=M0($,"placeholder"),B=M0($,"placeholderColor")||"#e5e7eb",_=M0($,"provider"),j=M0($,"class")||M0($,"className")||"",H=M0($,"style")||"",L=M0($,"quality"),F=B3($,"lazy",!0),O=B3($,"preload",!1),V=B3($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=_3(X,z3,_,U),N=z2(K);else if(!A&&W){let k=W.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));A=kU(X,k,w,_,U)}else if(K)N=z2(K);let T=[];if(H)T.push(H);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let k=SU(w||16,R||9,B);T.push(`background-image:url(${k})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=b5(X,w,R,_,U),I=[];if(I.push(`src="${z0(M)}"`),I.push(`alt="${z0(Q)}"`),J)I.push(`width="${z0(J)}"`);if(G)I.push(`height="${z0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${z0(j)}"`);if(T.length>0)I.push(`style="${z0(T.join(";"))}"`);if(A)I.push(`srcset="${z0(A)}"`);if(N)I.push(`sizes="${z0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[k,y]of Object.entries($.static)){if(D.has(k))continue;if(typeof y==="boolean"){if(y)I.push(z0(k))}else I.push(`${z0(k)}="${z0(y)}"`)}let E=`<img ${I.join(" ")} />`,P="";if(O){let y=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${z0(M)}"${y?` type="${y}"`:""}${A?` imagesrcset="${z0(A)}"`:""}${N?` imagesizes="${z0(N)}"`:""} />
3901
- `}if(V){let k=[];if(U==="avif"||U==="auto"){let y=b5(X,w,R,_,"avif"),C=A?_3(X,z3,_,"avif"):`${y}`;k.push(`<source type="image/avif" srcset="${z0(C)}"${N?` sizes="${z0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let y=b5(X,w,R,_,"webp"),C=A?_3(X,z3,_,"webp"):`${y}`;k.push(`<source type="image/webp" srcset="${z0(C)}"${N?` sizes="${z0(N)}"`:""} />`)}return`${P}<picture>
3902
- ${k.join(`
3899
+ </div>`}}});var U2={};o(U2,{warnUnbalancedTags:()=>q3,findUnbalancedTags:()=>q2});function K1($){return $.replace(/[^\n]/g," ")}function q2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,K1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,K1).replace(/<!--[\s\S]*?-->/g,K1).replace(/\{\{\{[\s\S]*?\}\}\}/g,K1).replace(/\{\{[\s\S]*?\}\}/g,K1).replace(/\{!![\s\S]*?!!\}/g,K1).replace(/"[^"]*"/g,K1).replace(/'[^']*'/g,K1),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(DU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
3900
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(EU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function q3($,Z){let Y;try{Y=q2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(K2.has(X))return;K2.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var DU,EU,K2;var U3=S(()=>{DU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),EU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);K2=new Set});import g0 from"path";import W3 from"fs";function W2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function z2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class B2{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),W2(Q),z2(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${W2(Q)}.stx`,`${z2(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=g0.resolve(g0.dirname(Z),`${Q}.stx`);if(await i(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(g0.join(g0.dirname(W),"components"));if(q)K.push(q);let U=g0.join(g0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[g0.resolve(z,"src/components"),g0.resolve(z,"components"),g0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=g0.join(_,j);if(await i(H))return H}try{if(!W3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=W3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=g0.join(_,L.name);for(let O of G){let V=g0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var E0;var z3=S(()=>{H0();E0=new B2});function q1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kU($){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 B3;var _3=S(()=>{B3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=kU($),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="${q1(X.value)}"`);else q.push(`href="${q1(X.value)}"`);if(Q)q.push(`class="${q1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${q1(J)}"`),q.push(`data-stx-exact-active-class="${q1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,z]of Object.entries($.static)){if(W.has(U))continue;if(typeof z==="boolean"){if(z)q.push(q1(U))}else q.push(`${q1(U)}="${q1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function H3($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function _2($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=bU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function O3($,Z,Y,X){return Z.map((Q)=>`${y5($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function SU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${y5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function y5($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function yU($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var bU,j3,L3;var F3=S(()=>{bU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},j3=[320,640,768,1024,1280,1536,1920];L3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=N0($,"src")||"",Q=N0($,"alt")||"",J=N0($,"width"),G=N0($,"height"),K=N0($,"sizes"),q=N0($,"srcset"),W=N0($,"densities"),U=N0($,"format"),z=N0($,"placeholder"),B=N0($,"placeholderColor")||"#e5e7eb",_=N0($,"provider"),j=N0($,"class")||N0($,"className")||"",H=N0($,"style")||"",L=N0($,"quality"),F=H3($,"lazy",!0),O=H3($,"preload",!1),V=H3($,"picture",!1)||!!U,w=J?Number.parseInt(J):void 0,R=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=O3(X,j3,_,U),N=_2(K);else if(!A&&W){let b=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));A=SU(X,b,w,_,U)}else if(K)N=_2(K);let T=[];if(H)T.push(H);if(w&&R)T.push(`aspect-ratio:${w}/${R}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=yU(w||16,R||9,B);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${B0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=y5(X,w,R,_,U),I=[];if(I.push(`src="${B0(M)}"`),I.push(`alt="${B0(Q)}"`),J)I.push(`width="${B0(J)}"`);if(G)I.push(`height="${B0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${B0(j)}"`);if(T.length>0)I.push(`style="${B0(T.join(";"))}"`);if(A)I.push(`srcset="${B0(A)}"`);if(N)I.push(`sizes="${B0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,k]of Object.entries($.static)){if(D.has(b))continue;if(typeof k==="boolean"){if(k)I.push(B0(b))}else I.push(`${B0(b)}="${B0(k)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(O){let k=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${B0(M)}"${k?` type="${k}"`:""}${A?` imagesrcset="${B0(A)}"`:""}${N?` imagesizes="${B0(N)}"`:""} />
3901
+ `}if(V){let b=[];if(U==="avif"||U==="auto"){let k=y5(X,w,R,_,"avif"),P=A?O3(X,j3,_,"avif"):`${k}`;b.push(`<source type="image/avif" srcset="${B0(P)}"${N?` sizes="${B0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let k=y5(X,w,R,_,"webp"),P=A?O3(X,j3,_,"webp"):`${k}`;b.push(`<source type="image/webp" srcset="${B0(P)}"${N?` sizes="${B0(N)}"`:""} />`)}return`${C}<picture>
3902
+ ${b.join(`
3903
3903
  `)}
3904
3904
  ${E}
3905
- </picture>`}return`${P}${E}`}}});function q1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function n1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var bU="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",O3;var L3=b(()=>{O3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=n1($,"src")||"",Q=n1($,"alt")||"",J=n1($,"fallback")||"/images/safe-image-default.svg",G=n1($,"class")||n1($,"className")||"",K=n1($,"fallbackClassName")||"",q=[];if(q.push(`src="${q1(X)}"`),q.push(`alt="${q1(Q)}"`),G)q.push(`class="${q1(G)}"`);if(q.push(`data-fallback="${q1(J)}"`),K)q.push(`data-fallback-class="${q1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(W.has(B))continue;if(typeof _==="boolean"){if(_)q.push(q1(B))}else q.push(`${q1(B)}="${q1(_)}"`)}let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${bU}${U}`;return U}}});function F3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function o$($,Z,Y){let X=y5($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var V3;var w3=b(()=>{V3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=F3(y5($,"color")||"#6366f1"),Q=F3(y5($,"initialColor")||y5($,"initial-color")||""),J=F3(y5($,"height")||"3px"),G=o$($,"duration",2000),K=o$($,"throttle",200),q=o$($,"zIndex",999999)||o$($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
3905
+ </picture>`}return`${C}${E}`}}});function U1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var PU="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",V3;var w3=S(()=>{V3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=s1($,"src")||"",Q=s1($,"alt")||"",J=s1($,"fallback")||"/images/safe-image-default.svg",G=s1($,"class")||s1($,"className")||"",K=s1($,"fallbackClassName")||"",q=[];if(q.push(`src="${U1(X)}"`),q.push(`alt="${U1(Q)}"`),G)q.push(`class="${U1(G)}"`);if(q.push(`data-fallback="${U1(J)}"`),K)q.push(`data-fallback-class="${U1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(W.has(B))continue;if(typeof _==="boolean"){if(_)q.push(U1(B))}else q.push(`${U1(B)}="${U1(_)}"`)}let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${PU}${U}`;return U}}});function R3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function P5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function r4($,Z,Y){let X=P5($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var A3;var N3=S(()=>{A3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=R3(P5($,"color")||"#6366f1"),Q=R3(P5($,"initialColor")||P5($,"initial-color")||""),J=R3(P5($,"height")||"3px"),G=r4($,"duration",2000),K=r4($,"throttle",200),q=r4($,"zIndex",999999)||r4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
3906
3906
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3907
3907
  <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>
3908
3908
  </div>
3909
3909
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3910
3910
  <script>
3911
3911
  (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()})})();
3912
- </script>`}}});function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function yU($,Z,Y){let X=_2($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var B2,R3;var A3=b(()=>{B2={"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%)"},R3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=m0(_2($,"position")||"top-right"),Q=yU($,"max",5),J=B2[X]||B2["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>
3912
+ </script>`}}});function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function H2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function CU($,Z,Y){let X=H2($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var j2,T3;var M3=S(()=>{j2={"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%)"},T3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=u0(H2($,"position")||"top-right"),Q=CU($,"max",5),J=j2[X]||j2["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>
3913
3913
  <style>
3914
3914
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3915
3915
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3917,7 +3917,7 @@ ${E}
3917
3917
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3918
3918
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3919
3919
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3920
- </style>`}}});function s$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var j2,N3;var T3=b(()=>{j2={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)"},N3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=s$($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=m0(X),J=s$($,"size")||"md",G=s$($,"closeOnBackdrop")!=="false",K=s$($,"closeOnEscape")!=="false",q=j2[J]||j2.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" 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">
3920
+ </style>`}}});function a4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var O2,I3;var D3=S(()=>{O2={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)"},I3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=a4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=u0(X),J=a4($,"size")||"md",G=a4($,"closeOnBackdrop")!=="false",K=a4($,"closeOnEscape")!=="false",q=O2[J]||O2.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" 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">
3921
3921
  <div class="stx-modal-panel" style="${q};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)">
3922
3922
  <div style="padding:1.5rem">${Z}</div>
3923
3923
  </div>
@@ -3926,7 +3926,7 @@ ${E}
3926
3926
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3927
3927
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3928
3928
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3929
- </style>`}}});function o1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var H2,M3;var I3=b(()=>{H2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},M3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=o1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=m0(X),J=o1($,"side")||"right",G=o1($,"size")||"md",K=o1($,"closeOnBackdrop")!=="false",q=o1($,"closeOnEscape")!=="false",W=o1($,"overlay")!=="false",U=H2[G]||H2.md,z=J==="left",B=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"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">
3929
+ </style>`}}});function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var L2,E3;var k3=S(()=>{L2={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},E3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=r1($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=u0(X),J=r1($,"side")||"right",G=r1($,"size")||"md",K=r1($,"closeOnBackdrop")!=="false",q=r1($,"closeOnEscape")!=="false",W=r1($,"overlay")!=="false",U=L2[G]||L2.md,z=J==="left",B=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"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">
3930
3930
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${U};max-width:100vw;transform:${_};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">
3931
3931
  <div style="padding:1.5rem">${Z}</div>
3932
3932
  </div>
@@ -3935,18 +3935,18 @@ ${E}
3935
3935
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3936
3936
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3937
3937
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3938
- </style>`}}});import{existsSync as PU,readFileSync as CU}from"fs";function vU($){try{return J0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(PU(Y))return Y;return null}function xU($){if(r$.has($))return r$.get($);let Z=vU($);if(!Z)return null;try{let Y=JSON.parse(CU(Z,"utf8"));return r$.set($,Y.icons),Y.icons}catch{return null}}function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var r$,D3;var E3=b(()=>{r$=new Map;D3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=s1($,"name")??s1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=m0(s1($,"size")||"24"),K=m0(s1($,"color")||"currentColor"),q=m0(s1($,"class")||""),W=m0(s1($,"style")||""),U=r$.get(Q)??xU(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function O2($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function L2($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var k3;var S3=b(()=>{k3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=L2(Z,"fallback"),Q=X.rest,J=L2(Q,"error"),G=J.rest,K=X.region??O2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??O2($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function a$($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var b3;var y3=b(()=>{b3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(a$($,"name")||"v").replace(/["'<>]/g,""),Q=(a$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=a$($,"class"),G=a$($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function F2(){E0.registerBuiltin(U3),E0.registerBuiltin(j3),E0.registerBuiltin(O3),E0.registerBuiltin(V3),E0.registerBuiltin(R3),E0.registerBuiltin(N3),E0.registerBuiltin(M3),E0.registerBuiltin(D3),E0.registerBuiltin(k3),E0.registerBuiltin(b3)}var V2=b(()=>{W3();H3();L3();w3();A3();T3();I3();E3();S3();y3();q3();W3();H3();L3();w3();A3();T3();I3();E3();S3();y3()});function w2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function R2($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(A!==-1&&A<N){let T=$[A+H.length];if(T===" "||T===">"||T==="/"||T===`
3939
- `||T==="\t")F++;O=A+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let w=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:j,content:w,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}function A2($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var N2=b(()=>{L0();H0();e5()});var k2={};n(k2,{processESImports:()=>E2,processComponents:()=>e$});import t$ from"fs";import P0 from"path";function gU($,Z,Y){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 W=J(q.slice(6));X.serverDynamic[W]=A2(K,Y);continue}if(q.startsWith(":")){let W=J(q.slice(1)),U=K==="true"?W:K;try{if(!Z0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);X.clientReactive[W]=U;continue}let z=Object.keys(Z),_=Y0(U,z)(...Object.values(Z));if(_===void 0){let j=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[W]=U;continue}}X.serverDynamic[W]=_}catch{X.clientReactive[W]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(Z0(U)){let B=Y0(U,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!Z0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=Y0(_,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=U}continue}X.static[q]=K}return X}function hU($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]="true"}return Z}function M2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(E0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function mU($){let Z=I2.get($);if(Z)return Z;let Y=new Map,X=[P0.join($,"src"),P0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=t$.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=P0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return I2.set($,Y),Y}function uU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=P0.join(Y,"node_modules",$);try{if(t$.statSync(X).isDirectory())return X}catch{}let Q=P0.dirname(Y);if(Q===Y)return null;Y=Q}}async function E2($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=P0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let T=P0.resolve(G,V);if(T.endsWith(".stx"))R=T;else{let M=`${T}.stx`;try{if(t$.statSync(M).isFile())R=M}catch{try{if(t$.statSync(T).isDirectory())w=T}catch{}}}}else w=uU(V,G);if(!w&&!R)continue;let A=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&R)N(O,R),A=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=w?mU(w):null;for(let{source:I,local:D}of T){let E=null;if(R)E=R;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)N(D,E),A=!0}}if(A)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function lU($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[P0.resolve(P0.dirname(Y),`${B}.stx`),P0.resolve(P0.dirname(Y),B),P0.resolve(X.componentsDir||"components",`${B}.stx`),P0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function pU($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,_=z+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let R={};if(O)try{R=O0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let A="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)A=M[1].trim(),N=H+M[0].length;let I=await A1(F,R,A,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(N),q.lastIndex=0}return J}async function cU($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=x4(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,fU),J=f4(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=R2(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],R=H?w2(w.tagName):w.tagName,A=hU(w.attributes),N=gU(A,Z,X),T=E0.getBuiltin(w.tagName),M=T?await v9(R,G,Z,Y,X):!1;if(T&&!M){let P={context:Z,filePath:Y,options:X,dependencies:Q},k=T.render(N,w.content,P);if(Object.keys(N.clientReactive).length>0)k=D2(k,N.clientReactive);if(Object.keys(N.events).length>0){let y=Object.entries(N.events).map(([C,d])=>`${C}="${M2(d)}"`).join(" ");k=k.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}F=F.substring(0,w.startIndex)+k+F.substring(w.endIndex);continue}let I={};for(let[P,k]of Object.entries(N.static))I[P]=k;for(let[P,k]of Object.entries(N.serverDynamic))I[P]=k;let E=await A1(R,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)E=D2(E,N.clientReactive);if(Object.keys(N.events).length>0){let P=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(P){let k=Object.entries(N.events).map(([C,d])=>`${C}="${M2(d)}"`).join(" "),y=P[1].length+P[2].length;E=E.substring(0,y)+" "+k+E.substring(y)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function D2($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function e$($,Z,Y,X,Q){if(!T2)F2(),T2=!0;let J=await E2($,Z,Y,X,Q);J=await lU(J,Z,Y,X,Q),J=await pU(J,Z,Y,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await cU(J,Z,Y,X,Q),J===K)break}if(X.debug){let G=dU(J);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var T2=!1,fU,I2;var P3=b(()=>{q3();V2();N2();H0();L0();fU=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"]);I2=new Map});var x2={};n(x2,{processLoops:()=>C3});function oU($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=U.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=O0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function $4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function sU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);s5(J);let W=Y0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function rU($,Z){let Y=$;return Y=$4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(Z0(J)){let K=Y0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?Z4:""}catch{return""}}),Y=$4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(Z0(J)){let K=Y0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?Y4:""}catch{return""}}),Y}function aU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,Z4),Z=Z.replace(/@continue(?!\()/g,Y4),Z}function S2($){let Z=$.includes(Z4),Y=Z?$.substring(0,$.indexOf(Z4)):$;return{hasBreak:Z,content:Y}}function b2($){let Z=$.includes(Y4),Y=Z?$.substring(0,$.indexOf(Y4)):$;return{hasContinue:Z,content:Y}}function P2($){let Z=$;return Z=$4(Z,"@break",(Y)=>{let X=Y.trim();if(!r5(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=$4(Z,"@continue",(Y)=>{let X=Y.trim();if(!r5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function tU($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=U)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,R=V,A=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){A.lastIndex=R,N.lastIndex=R;let k=A.exec($),y=N.exec($);if(!y)break;if(k&&k.index<y.index)w++,R=k.index+k[0].length;else{if(w--,w===0){T=y.index;break}R=y.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,P=0;while(P<M.length){let k=M.indexOf("@",P);if(k===-1)break;let y=M.substring(k);if(/^@forelse\s*\(/.test(y))E++,P=k+1;else if(y.startsWith("@endforelse"))E--,P=k+11;else if(E===0&&y.startsWith("@empty")){if(M.length<=k+6||!/[a-z]/i.test(M[k+6])){D=k;break}P=k+1}else P=k+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function y2($,Z){let Y=$;while(!0){let X=tU(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(Z0(G))U=Y0(G,Object.keys(Z))(...Object.values(Z));else U=$0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),B=a("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,i.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function C3($,Z,Y,X){let Q=$;Q=y2(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),R=H+1,A=1,N=R,T=/@foreach\s*\(/g,M=/@endforeach/g;while(A>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(R,D.index),P=D.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:E}}N=D.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(Z0(F))O=Y0(F,Object.keys(W))(...Object.values(W));else O=$0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=a("Foreach",`Error in @foreach: ${F} is not iterable`,i.TYPE_ERROR);U=U.substring(0,B)+D+U.substring(_);continue}let w=X?.loops?.useAltLoopVariable??nU,R=H.trim(),A=null,N,T=!1;if(R.includes("=>")){let D=R.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])A=D[0],N=D[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let D=R.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],A=D[1],T=!0;else N=R}else N=R;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],P={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},k={...W,loop:P,$loop:P};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))f.forEach((m,o)=>{if(m)k[m]=E[o]});else k[N]=E}else k[N]=E;if(A)if(!T&&V&&Array.isArray(E)&&E.length===2)k[A]=E[0],k[N]=E[1];else k[A]=D;let y=rU(L,k),C=b2(y);if(C.hasContinue){M+=C.content;continue}let d=S2(y);if(d.hasBreak){M+=d.content;break}if(y=y2(y,k),y=G(y,k),y=k1(y,k,Y),y=aU(y),d=S2(y),d.hasBreak){M+=d.content;break}if(C=b2(y),C.hasContinue){M+=C.content;continue}y=p0(y,k,Y),y=sU(y,k),y=oU(y,k),M+=y}U=U.substring(0,B)+M+U.substring(_)}catch(F){let O=a("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,i.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=v2(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??iU;return Q=ZW(Q,Z,K),Q}function C2($){return r5($)}function v2($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=D0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=m$(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!C2(U)){let H=a("For",`Unsafe expression in @for: ${U}`,i.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=eU(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let A=$W({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=P2(V);let R=Function(...F,`
3938
+ </style>`}}});import{existsSync as vU,readFileSync as xU}from"fs";function fU($){try{return G0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(vU(Y))return Y;return null}function gU($){if(t4.has($))return t4.get($);let Z=fU($);if(!Z)return null;try{let Y=JSON.parse(xU(Z,"utf8"));return t4.set($,Y.icons),Y.icons}catch{return null}}function a1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var t4,b3;var S3=S(()=>{t4=new Map;b3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=a1($,"name")??a1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=u0(a1($,"size")||"24"),K=u0(a1($,"color")||"currentColor"),q=u0(a1($,"class")||""),W=u0(a1($,"style")||""),U=t4.get(Q)??gU(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function F2($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function V2($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var y3;var P3=S(()=>{y3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=V2(Z,"fallback"),Q=X.rest,J=V2(Q,"error"),G=J.rest,K=X.region??F2($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??F2($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function e4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var C3;var v3=S(()=>{C3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(e4($,"name")||"v").replace(/["'<>]/g,""),Q=(e4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=e4($,"class"),G=e4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function w2(){E0.registerBuiltin(B3),E0.registerBuiltin(L3),E0.registerBuiltin(V3),E0.registerBuiltin(A3),E0.registerBuiltin(T3),E0.registerBuiltin(I3),E0.registerBuiltin(E3),E0.registerBuiltin(b3),E0.registerBuiltin(y3),E0.registerBuiltin(C3)}var R2=S(()=>{_3();F3();w3();N3();M3();D3();k3();S3();P3();v3();z3();_3();F3();w3();N3();M3();D3();k3();S3();P3();v3()});function A2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function N2($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(A!==-1&&A<N){let T=$[A+H.length];if(T===" "||T===">"||T==="/"||T===`
3939
+ `||T==="\t")F++;O=A+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let w=$.slice(B,V),R=V+L.length;X.push({fullMatch:$.slice(J,R),tagName:q,attributes:j,content:w,startIndex:J,endIndex:R,isSelfClosing:!1}),Q=R}}return X}function T2($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var M2=S(()=>{L0();H0();Z4()});var S2={};o(S2,{processESImports:()=>b2,processComponents:()=>Z$});import $$ from"fs";import S0 from"path";function dU($,Z,Y){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 W=J(q.slice(6));X.serverDynamic[W]=T2(K,Y);continue}if(q.startsWith(":")){let W=J(q.slice(1)),U=K==="true"?W:K;try{if(!X0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);X.clientReactive[W]=U;continue}let z=Object.keys(Z),_=J0(U,z)(...Object.values(Z));if(_===void 0){let j=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[W]=U;continue}}X.serverDynamic[W]=_}catch{X.clientReactive[W]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(X0(U)){let B=J0(U,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!X0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=J0(_,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=U}continue}X.static[q]=K}return X}function mU($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]="true"}return Z}function D2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(E0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function lU($){let Z=E2.get($);if(Z)return Z;let Y=new Map,X=[S0.join($,"src"),S0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=$$.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=S0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return E2.set($,Y),Y}function pU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=S0.join(Y,"node_modules",$);try{if($$.statSync(X).isDirectory())return X}catch{}let Q=S0.dirname(Y);if(Q===Y)return null;Y=Q}}async function b2($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=S0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let T=S0.resolve(G,V);if(T.endsWith(".stx"))R=T;else{let M=`${T}.stx`;try{if($$.statSync(M).isFile())R=M}catch{try{if($$.statSync(T).isDirectory())w=T}catch{}}}}else w=pU(V,G);if(!w&&!R)continue;let A=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&R)N(O,R),A=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=w?lU(w):null;for(let{source:I,local:D}of T){let E=null;if(R)E=R;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)N(D,E),A=!0}}if(A)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function cU($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[S0.resolve(S0.dirname(Y),`${B}.stx`),S0.resolve(S0.dirname(Y),B),S0.resolve(X.componentsDir||"components",`${B}.stx`),S0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function iU($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,_=z+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let R={};if(O)try{R=O0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let A="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)A=M[1].trim(),N=H+M[0].length;let I=await N1(F,R,A,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(N),q.lastIndex=0}return J}async function nU($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=f$(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,hU),J=g$(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=N2(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],R=H?A2(w.tagName):w.tagName,A=mU(w.attributes),N=dU(A,Z,X),T=E0.getBuiltin(w.tagName),M=T?await f9(R,G,Z,Y,X):!1;if(T&&!M){let C={context:Z,filePath:Y,options:X,dependencies:Q},b=T.render(N,w.content,C);if(Object.keys(N.clientReactive).length>0)b=k2(b,N.clientReactive);if(Object.keys(N.events).length>0){let k=Object.entries(N.events).map(([P,d])=>`${P}="${D2(d)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+b+F.substring(w.endIndex);continue}let I={};for(let[C,b]of Object.entries(N.static))I[C]=b;for(let[C,b]of Object.entries(N.serverDynamic))I[C]=b;let E=await N1(R,I,w.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)E=k2(E,N.clientReactive);if(Object.keys(N.events).length>0){let C=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(C){let b=Object.entries(N.events).map(([P,d])=>`${P}="${D2(d)}"`).join(" "),k=C[1].length+C[2].length;E=E.substring(0,k)+" "+b+E.substring(k)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function k2($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function Z$($,Z,Y,X,Q){if(!I2)w2(),I2=!0;let J=await b2($,Z,Y,X,Q);J=await cU(J,Z,Y,X,Q),J=await iU(J,Z,Y,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await nU(J,Z,Y,X,Q),J===K)break}if(X.debug){let G=uU(J);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return J}var I2=!1,hU,E2;var x3=S(()=>{z3();R2();M2();H0();L0();hU=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"]);E2=new Map});var g2={};o(g2,{processLoops:()=>f3});function rU($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=U.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=O0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function Y$($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function aU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);a5(J);let W=J0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function tU($,Z){let Y=$;return Y=Y$(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?X$:""}catch{return""}}),Y=Y$(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?J$:""}catch{return""}}),Y}function eU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,X$),Z=Z.replace(/@continue(?!\()/g,J$),Z}function y2($){let Z=$.includes(X$),Y=Z?$.substring(0,$.indexOf(X$)):$;return{hasBreak:Z,content:Y}}function P2($){let Z=$.includes(J$),Y=Z?$.substring(0,$.indexOf(J$)):$;return{hasContinue:Z,content:Y}}function v2($){let Z=$;return Z=Y$(Z,"@break",(Y)=>{let X=Y.trim();if(!t5(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=Y$(Z,"@continue",(Y)=>{let X=Y.trim();if(!t5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function $W($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=U)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,R=V,A=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(w>0&&R<$.length){A.lastIndex=R,N.lastIndex=R;let b=A.exec($),k=N.exec($);if(!k)break;if(b&&b.index<k.index)w++,R=b.index+b[0].length;else{if(w--,w===0){T=k.index;break}R=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,C=0;while(C<M.length){let b=M.indexOf("@",C);if(b===-1)break;let k=M.substring(b);if(/^@forelse\s*\(/.test(k))E++,C=b+1;else if(k.startsWith("@endforelse"))E--,C=b+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}C=b+1}else C=b+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function C2($,Z){let Y=$;while(!0){let X=$W(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(X0(G))U=J0(G,Object.keys(Z))(...Object.values(Z));else U=$0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),B=t("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,n.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function f3($,Z,Y,X){let Q=$;Q=C2(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),w=L.substring(F+4),R=H+1,A=1,N=R,T=/@foreach\s*\(/g,M=/@endforeach/g;while(A>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(R,D.index),C=D.index+11;return{start:O,end:C,arrayExpr:V,itemVar:w,content:E}}N=D.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(X0(F))O=J0(F,Object.keys(W))(...Object.values(W));else O=$0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=t("Foreach",`Error in @foreach: ${F} is not iterable`,n.TYPE_ERROR);U=U.substring(0,B)+D+U.substring(_);continue}let w=X?.loops?.useAltLoopVariable??sU,R=H.trim(),A=null,N,T=!1;if(R.includes("=>")){let D=R.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])A=D[0],N=D[1];else N=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let D=R.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],A=D[1],T=!0;else N=R}else N=R;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],C={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...W,loop:C,$loop:C};if(N.startsWith("[")&&N.endsWith("]")){let g=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))g.forEach((m,s)=>{if(m)b[m]=E[s]});else b[N]=E}else b[N]=E;if(A)if(!T&&V&&Array.isArray(E)&&E.length===2)b[A]=E[0],b[N]=E[1];else b[A]=D;let k=tU(L,b),P=P2(k);if(P.hasContinue){M+=P.content;continue}let d=y2(k);if(d.hasBreak){M+=d.content;break}if(k=C2(k,b),k=G(k,b),k=b1(k,b,Y),k=eU(k),d=y2(k),d.hasBreak){M+=d.content;break}if(P=P2(k),P.hasContinue){M+=P.content;continue}k=p0(k,b,Y),k=aU(k,b),k=rU(k,b),M+=k}U=U.substring(0,B)+M+U.substring(_)}catch(F){let O=t("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,n.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=f2(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??oU;return Q=XW(Q,Z,K),Q}function x2($){return t5($)}function f2($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=D0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=l4(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!x2(U)){let H=t("For",`Unsafe expression in @for: ${U}`,n.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=ZW(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let A=YW({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+A+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=v2(V);let R=Function(...F,`
3940
3940
  let result = '';
3941
3941
  for (${U}) {
3942
3942
  result += \`${V}\`;
3943
3943
  }
3944
3944
  return result;
3945
- `)(...O);Q=Q.substring(0,K)+R+Q.substring(j),J=!0}catch(H){let L=a("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,i.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function eU($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function $W($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
3945
+ `)(...O);Q=Q.substring(0,K)+R+Q.substring(j),J=!0}catch(H){let L=t("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function ZW($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function YW($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
3946
3946
  for (${Z}) {
3947
3947
  __pushIter([${X.join(", ")}])
3948
3948
  }
3949
- `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",B="";for(let _ of U){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=v2(Y,j,J,G);H=k1(H,j,z),H=p0(H,j,z),B+=H}return B}function ZW($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=D0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=m$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!C2(W)){let _=a("While",`Unsafe expression in @while: ${W}`,i.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=P2(H);let F=Function(..._,`
3949
+ `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",B="";for(let _ of U){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=f2(Y,j,J,G);H=b1(H,j,z),H=p0(H,j,z),B+=H}return B}function XW($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=D0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=l4(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!x2(W)){let _=t("While",`Unsafe expression in @while: ${W}`,n.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=v2(H);let F=Function(..._,`
3950
3950
  let result = '';
3951
3951
  let maxIterations = ${Y}; // Configurable safety limit
3952
3952
  let counter = 0;
@@ -3958,8 +3958,8 @@ ${E}
3958
3958
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3959
3959
  }
3960
3960
  return result;
3961
- `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=a("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,i.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var iU=1000,nU=!1,Z4="<!--__STX_BREAK__-->",Y4="<!--__STX_CONTINUE__-->";var v3=b(()=>{l$();t0();c0();u$();L0()});import K0 from"path";function x3($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function YW($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function XW($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function JW($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
3962
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function g2($,Z=""){return`
3961
+ `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=t("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,n.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var oU=1000,sU=!1,X$="<!--__STX_BREAK__-->",J$="<!--__STX_CONTINUE__-->";var g3=S(()=>{c4();t0();c0();p4();L0()});import U0 from"path";function h3($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function JW($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function QW($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function GW($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
3962
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function d2($,Z=""){return`
3963
3963
  (function() {
3964
3964
  var { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
3965
3965
  var __destroyHooks = [];
@@ -3968,11 +3968,11 @@ ${E}
3968
3968
 
3969
3969
  ${$}
3970
3970
  ${Z}})();
3971
- `}function QW($,Z){let J=`
3971
+ `}function KW($,Z){let J=`
3972
3972
  // Register scope variables for STX runtime
3973
3973
  if (!window.stx._scopes) window.stx._scopes = {};
3974
3974
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3975
- ${JW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
3975
+ ${GW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
3976
3976
  `)}
3977
3977
  // #1767: when the bundler renamed a component const that collided with an
3978
3978
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -3989,33 +3989,33 @@ ${JW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeR
3989
3989
  } finally {
3990
3990
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3991
3991
  }
3992
- })();`;return G+g2($,J)+`
3992
+ })();`;return G+d2($,J)+`
3993
3993
  } finally {
3994
3994
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3995
3995
  }
3996
- })();`}function GW($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function qW($){if($.__onceStore instanceof Set)return $.__onceStore;return KW}async function f3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||K0.join(K0.dirname(Y),"partials");if(G&&!K0.isAbsolute(G))G=K0.resolve(process.cwd(),G);let K=YW($,"@partial","@include"),q=qW(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=V;continue}let A=R[1],N=W(A,G,Y),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),N=x3(A,0);if(N===-1){L.lastIndex=R;continue}let T=A.substring(0,N).trim(),M=A.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=R;continue}let D=I[1],E=M.substring(I[0].length),P,k=x3(E,0);if(k!==-1)P=E.substring(k+1).trim();try{let y=`Boolean(${T})`,C;if(Z0(y)){let m=Y0(y,Object.keys(Z));C=Boolean(m(...Object.values(Z)))}else C=Boolean($0(y,Z));let d=H?!C:C,f="";if(d){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);f=`@include('${D}'${P?`, ${P}`:""})`}K=K.substring(0,O)+f+K.substring(R),L.lastIndex=0}catch(y){let C=y instanceof Error?y.message:String(y),d=Q0("Include",`Error evaluating ${j} condition: ${C}`,Y,$,O);K=K.substring(0,O)+d+K.substring(R),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){j.lastIndex=0,K=K.replace(R,"");continue}let[,N,T,M,I]=A;try{let D,E=T.trim();if(Z0(E))D=Y0(E,Object.keys(Z))(...Object.values(Z));else D=$0(E,Z);let P="";if(Array.isArray(D)&&D.length>0)for(let k of D){let y={...Z,[M]:k},C=await z(N,y,$,L);P+=C}else if(I)P=await z(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+Q0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){j.lastIndex=0,K=K.replace(R,"");continue}let N=A[1],T=w.slice(A[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,k=1;while(k<T.length&&P>0){if(T[k]==="{")P++;else if(T[k]==="}"){if(P--,P===0)break}k++}M=T.substring(0,k+1),T=T.slice(k+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let P=JSON.parse(N.replace(/'/g,'"')),k={};if(M)try{k=O0(M,Z)}catch(C){let d=C instanceof Error?C.message:String(C);if(X.debug){let f=Q0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,R);K=K.replace(R,()=>f)}else K=K.replace(R,()=>D||"");continue}let y=!1;for(let C of P){let d=W(C,G,Y);if(!d)continue;if(await c(d)){let f=await z(C,k,$,L);K=K.replace(R,()=>f),y=!0;break}}if(!y)if(D!==void 0)K=K.replace(R,()=>D);else if(X.debug){let C=Q0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let k=P instanceof Error?P.message:String(P),y=Q0("Include",`Error processing @includeFirst: ${k}`,Y,$,L,R);K=K.replace(R,()=>y)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=K0.resolve(H),V=K0.resolve(K0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=K0.resolve(H,F);else w=K0.resolve(V,F);let R=K0.normalize(w),A=R.startsWith(O+K0.sep)||R===O,N=R.startsWith(V+K0.sep)||R===V,T=!1,M=K0.dirname(V);if(R.startsWith(M+K0.sep)){if(!K0.relative(M,R).split(K0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!A&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=K0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return Q0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=K0.resolve(O);if(J.has(V)){let w=[...J,V].map((R)=>K0.basename(R)).join(" -> ");return Q0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return Q0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (J3(),X3));w=f(w,Z)}if(w&&(X.debug||!R5()&&!k$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (G3(),K2));f(w,O)}catch{}let R=w;try{let{processESImports:f}=await Promise.resolve().then(() => (P3(),k2));await f(w,Z,O,X,Q)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let 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 T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],P="",k=null;for(let f of E){let m=f[1]||"",o=f[2]||"",R0=m.includes("server"),o0=L1(m),S0="";try{let{extractAndStripCssImports:e,renderVendorStyleTags:_0}=await Promise.resolve().then(() => (W5(),o6)),U0=e(o,{filePath:O,projectRoot:process.cwd()});o=U0.code,S0=_0(U0.styles)}catch(e){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,e instanceof Error?e.message:e)}if(o0&&o.trim())o=F1(o);if(!R0)try{let{hasUserImports:e,bundleClientScript:_0}=await Promise.resolve().then(() => (n5(),i5));if(e(o))o=await _0(o,O,{projectRoot:process.cwd()})}catch(e){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,e instanceof Error?e.message:e)}let I0=XW(o);if(I0&&!R0){k=`stx_scope_${K0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++f2}`;let e=a0(o),_0=QW(e,k);P+=`${S0}<script data-stx-scoped>${_0}</script>
3997
- `;continue}if(R0)try{let{extractVariables:e}=await Promise.resolve().then(() => (F5(),X$));await e(o,I,O)}catch(e){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,e)}if(!R0&&!I0){let e=m.replace(/\bclient\b/i,"").trim();k=`stx_scope_${K0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++f2}`;let _0=a0(o),U0=`
3996
+ })();`}function qW($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function WW($){if($.__onceStore instanceof Set)return $.__onceStore;return UW}async function d3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=JW($,"@partial","@include"),q=WW(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=V;continue}let A=R[1],N=W(A,G,Y),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let A=K.substring(V+1,R-1),N=h3(A,0);if(N===-1){L.lastIndex=R;continue}let T=A.substring(0,N).trim(),M=A.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=R;continue}let D=I[1],E=M.substring(I[0].length),C,b=h3(E,0);if(b!==-1)C=E.substring(b+1).trim();try{let k=`Boolean(${T})`,P;if(X0(k)){let m=J0(k,Object.keys(Z));P=Boolean(m(...Object.values(Z)))}else P=Boolean($0(k,Z));let d=H?!P:P,g="";if(d){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);g=`@include('${D}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(R),L.lastIndex=0}catch(k){let P=k instanceof Error?k.message:String(k),d=K0("Include",`Error evaluating ${j} condition: ${P}`,Y,$,O);K=K.substring(0,O)+d+K.substring(R),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){j.lastIndex=0,K=K.replace(R,"");continue}let[,N,T,M,I]=A;try{let D,E=T.trim();if(X0(E))D=J0(E,Object.keys(Z))(...Object.values(Z));else D=$0(E,Z);let C="";if(Array.isArray(D)&&D.length>0)for(let b of D){let k={...Z,[M]:b},P=await z(N,k,$,L);C+=P}else if(I)C=await z(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+K0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),R=K.substring(L,V+1),A=w.match(/^\s*(\[[^\]]+\])/);if(!A){j.lastIndex=0,K=K.replace(R,"");continue}let N=A[1],T=w.slice(A[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,b=1;while(b<T.length&&C>0){if(T[b]==="{")C++;else if(T[b]==="}"){if(C--,C===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let C=JSON.parse(N.replace(/'/g,'"')),b={};if(M)try{b=O0(M,Z)}catch(P){let d=P instanceof Error?P.message:String(P);if(X.debug){let g=K0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,R);K=K.replace(R,()=>g)}else K=K.replace(R,()=>D||"");continue}let k=!1;for(let P of C){let d=W(P,G,Y);if(!d)continue;if(await i(d)){let g=await z(P,b,$,L);K=K.replace(R,()=>g),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(R,()=>D);else if(X.debug){let P=K0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,R);K=K.replace(R,()=>P)}else K=K.replace(R,"")}catch(C){let b=C instanceof Error?C.message:String(C),k=K0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,R);K=K.replace(R,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let R=U0.normalize(w),A=R.startsWith(O+U0.sep)||R===O,N=R.startsWith(V+U0.sep)||R===V,T=!1,M=U0.dirname(V);if(R.startsWith(M+U0.sep)){if(!U0.relative(M,R).split(U0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!A&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return K0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let w=[...J,V].map((R)=>U0.basename(R)).join(" -> ");return K0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(g){let m=g instanceof Error?g.message:String(g);return K0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (K3(),G3));w=g(w,Z)}if(w&&(X.debug||!A5()&&!S4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (U3(),U2));g(w,O)}catch{}let R=w;try{let{processESImports:g}=await Promise.resolve().then(() => (x3(),S2));await g(w,Z,O,X,Q)}catch(g){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let A=R.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(A)R=A[1].trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[g,m]of Object.entries(H))I[g]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],C="",b=null;for(let g of E){let m=g[1]||"",s=g[2]||"",Z0=m.includes("server"),o0=F1(m),P0="";try{let{extractAndStripCssImports:e,renderVendorStyleTags:M0}=await Promise.resolve().then(() => (z5(),t6)),C0=e(s,{filePath:O,projectRoot:process.cwd()});s=C0.code,P0=M0(C0.styles)}catch(e){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,e instanceof Error?e.message:e)}if(o0&&s.trim())s=V1(s);if(!Z0)try{let{hasUserImports:e,bundleClientScript:M0}=await Promise.resolve().then(() => (s5(),o5));if(e(s))s=await M0(s,O,{projectRoot:process.cwd()})}catch(e){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,e instanceof Error?e.message:e)}let T0=QW(s);if(T0&&!Z0){b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++h2}`;let e=a0(s),M0=KW(e,b);C+=`${P0}<script data-stx-scoped>${M0}</script>
3997
+ `;continue}if(Z0)try{let{extractVariables:e}=await Promise.resolve().then(() => (V5(),Q4));await e(s,I,O)}catch(e){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,e)}if(!Z0&&!T0){let e=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++h2}`;let M0=a0(s),C0=`
3998
3998
  if (!window.stx._scopes) window.stx._scopes = {};
3999
- window.stx._scopes['${k}'] = { __destroyCallbacks: __destroyHooks };
4000
- `,S=g2(_0,U0);P+=`${S0}<script data-stx-scoped${e?` ${e}`:""}>${S}</script>
4001
- `}}if(k){let f=GW(R,k);if(R=f.html,f.mergedIntoExisting)P=P.replace(`window.stx._scopes['${k}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),k=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await f3(R,I,O,X,Q,J);let{processLoops:y}=await Promise.resolve().then(() => (v3(),x2)),C=y(R,I,O);C=k1(C,I,O);let d=g1(w);if(C=p0(C,I,O,{forceSignals:d}),M)C+=`
4002
- `+M;if(P)C+=`
4003
- `+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return Q0("Include",`Error processing include ${j}: ${R}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=F;continue}let R=w[1],A,N=V.substring(w[0].length),T=x3(N,0);if(T!==-1)A=N.substring(T+1).trim();let M={};if(A)try{M=O0(A,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,Q0("Include",`Error parsing include variables for ${R}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(R,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function g3($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let R=q.slice(O),A=R.match(H),N=R.match(L),T=A?O+A.index:1/0,M=N?O+N.index:1/0;if(T<M)F++,O=T+(A[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function h3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
4004
- `)})}var f2=0,sF,KW;var h2=b(()=>{l$();c0();m1();L0();H0();sF=new j5(500),KW=new Set});import*as d3 from"path";async function d2($,Z,Y=""){if(d3.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return u2($,Z,Y,"@js","@endjs")}async function m2($,Z,Y=""){if(d3.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return u2($,Z,Y,"@ts","@endts")}async function u2($,Z,Y,X,Q){let J=$,G=d1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=U.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
3999
+ window.stx._scopes['${b}'] = { __destroyCallbacks: __destroyHooks };
4000
+ `,v=d2(M0,C0);C+=`${P0}<script data-stx-scoped${e?` ${e}`:""}>${v}</script>
4001
+ `}}if(b){let g=qW(R,b);if(R=g.html,g.mergedIntoExisting)C=C.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),b=g.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await d3(R,I,O,X,Q,J);let{processLoops:k}=await Promise.resolve().then(() => (g3(),g2)),P=k(R,I,O);P=b1(P,I,O);let d=d1(w);if(P=p0(P,I,O,{forceSignals:d}),M)P+=`
4002
+ `+M;if(C)P+=`
4003
+ `+C;return P}catch(w){let R=w instanceof Error?w.message:String(w);return K0("Include",`Error processing include ${j}: ${R}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){B.lastIndex=F;continue}let R=w[1],A,N=V.substring(w[0].length),T=h3(N,0);if(T!==-1)A=N.substring(T+1).trim();let M={};if(A)try{M=O0(A,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,K0("Include",`Error parsing include variables for ${R}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(R,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function m3($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let R=q.slice(O),A=R.match(H),N=R.match(L),T=A?O+A.index:1/0,M=N?O+N.index:1/0;if(T<M)F++,O=T+(A[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(w);else Z[_].push(w);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function u3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
4004
+ `)})}var h2=0,aF,UW;var m2=S(()=>{c4();c0();l1();L0();H0();aF=new H5(500),UW=new Set});import*as l3 from"path";async function u2($,Z,Y=""){if(l3.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return p2($,Z,Y,"@js","@endjs")}async function l2($,Z,Y=""){if(l3.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return p2($,Z,Y,"@ts","@endts")}async function p2($,Z,Y,X,Q){let J=$,G=u1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=U.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
4005
4005
  ${j}
4006
4006
  ${F}
4007
- `,w=Function(...B,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=Q0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var l2=b(()=>{m1();H0()});function UW($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function p2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return UW(X,J||"_method")})}async function c2($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=Q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
4008
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${g0(W)}</div>
4009
- `)}}}return J}async function i2($,Z,Y,X){return c2($,Z,Y,X,"before")}async function n2($,Z,Y,X){return c2($,Z,Y,X,"after")}var o2=b(()=>{c0();H0()});import{defineRoute as qV,defineRoutes as UV,resetRoutes as WV,route as zV,setAppUrl as BV}from"stx-router";import{route as WW}from"stx-router";function s2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?O0(Q,{}):{};return WW(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var r2=b(()=>{L0()});async function a2($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(P5.exact[$])for(let X of P5.exact[$])await Promise.resolve(X(Z,$));if(P5.exact[Y])for(let X of P5.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of P5.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var P5;var t2=b(()=>{P5={patterns:[],exact:{}}});function e2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>e2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $Y($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=U,j=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=e2(R);if(A){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${A}"`);else _=_.replace(B[0],` class="${A}"`)}else _=_.replace(B[0],"");j=!0;continue}if(zW.has(H)){if(R)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(R===null||R===void 0||R===!1)_=_.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${A}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var zW;var ZY=b(()=>{zW=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function b1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||BW.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function jW($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=jW($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function YY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function r1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function U1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function W1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function HW($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function OW($){let Z=$,Y=0;while(Y<Z.length){let X=b1(Z,Y);if(!X)break;let Q=r1(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=U1(X.attrs,"v-for"),U=U1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
4007
+ `,w=Function(...B,O)(..._);if(w&&typeof w==="object")Object.assign(Z,w);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=K0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var c2=S(()=>{l1();H0()});function zW($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function i2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return zW(X,J||"_method")})}async function n2($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=K0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
4008
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${h0(W)}</div>
4009
+ `)}}}return J}async function o2($,Z,Y,X){return n2($,Z,Y,X,"before")}async function s2($,Z,Y,X){return n2($,Z,Y,X,"after")}var r2=S(()=>{c0();H0()});import{defineRoute as WV,defineRoutes as zV,resetRoutes as BV,route as _V,setAppUrl as jV}from"stx-router";import{route as BW}from"stx-router";function a2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?O0(Q,{}):{};return BW(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var t2=S(()=>{L0()});async function e2($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(C5.exact[$])for(let X of C5.exact[$])await Promise.resolve(X(Z,$));if(C5.exact[Y])for(let X of C5.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of C5.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var C5;var $Y=S(()=>{C5={patterns:[],exact:{}}});function ZY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>ZY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function YY($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=U,j=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=ZY(R);if(A){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${A}"`);else _=_.replace(B[0],` class="${A}"`)}else _=_.replace(B[0],"");j=!0;continue}if(_W.has(H)){if(R)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(R===null||R===void 0||R===!1)_=_.replace(B[0],"");else{let A=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${A}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var _W;var XY=S(()=>{_W=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function y1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||jW.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function OW($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=OW($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function JY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function t1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function W1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function z1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function LW($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function FW($){let Z=$,Y=0;while(Y<Z.length){let X=y1(Z,Y);if(!X)break;let Q=t1(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=W1(X.attrs,"v-for"),U=W1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=z1(B,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
4010
4010
  `,H=`${j}${_}
4011
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function LW($){let Z=$,Y=0;while(Y<Z.length){let X=b1(Z,Y);if(!X)break;let Q=r1(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=i0(Z,X),K=U1(X.attrs,"v-if"),q=W1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=b1(Z,W+L);if(!F){U=!1;break}let O=r1(F.attrs,"v-else-if"),V=YY(F.attrs,"v-else");if(O!==null){let w=i0(Z,F),R=U1(F.attrs,"v-else-if"),A=W1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),W=w.outerEnd}else if(V){let w=i0(Z,F),R=U1(F.attrs,"v-else"),A=W1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
4011
+ @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function VW($){let Z=$,Y=0;while(Y<Z.length){let X=y1(Z,Y);if(!X)break;let Q=t1(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=i0(Z,X),K=W1(X.attrs,"v-if"),q=z1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=y1(Z,W+L);if(!F){U=!1;break}let O=t1(F.attrs,"v-else-if"),V=JY(F.attrs,"v-else");if(O!==null){let w=i0(Z,F),R=W1(F.attrs,"v-else-if"),A=z1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),W=w.outerEnd}else if(V){let w=i0(Z,F),R=W1(F.attrs,"v-else"),A=z1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);J.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:A,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
4012
4012
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
4013
4013
  ${H.element}`);else z.push(`@else
4014
4014
  ${H.element}`);z.push("@endif");let B=z.join(`
4015
- `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function FW($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function VW($){let Z=$,Y=0;while(Y<Z.length){let X=b1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=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=i0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=W1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=r1(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(_W.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function wW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function RW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function AW($){let Z=$,Y=0;while(Y<Z.length){let X=b1(Z,Y);if(!X)break;let Q=r1(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function NW($){let Z=$,Y=0;while(Y<Z.length){let X=b1(Z,Y);if(!X)break;let Q=r1(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function TW($){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 MW($){let Z=$,Y=0;while(Y<Z.length){let X=b1(Z,Y);if(!X)break;if(!YY(X.attrs,"v-once")){Y=X.end;continue}let Q=U1(X.attrs,"v-once"),J=i0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
4016
- ${W1(G,{...X,start:0,end:X.end-X.start},Q)}
4017
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function IW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function DW($){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 XY($){if(!HW($))return $;let Z=$;return Z=OW(Z),Z=LW(Z),Z=MW(Z),Z=wW(Z),Z=RW(Z),Z=VW(Z),Z=FW(Z),Z=DW(Z),Z=AW(Z),Z=NW(Z),Z=TW(Z),Z=IW(Z),Z}var BW,_W;var JY=b(()=>{BW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),_W=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function X4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function QY($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${X4(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=$0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await A1(z,_,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${X4(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await EW(J,Z,Y,X,Q),J}async function EW($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${X4(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",_=await A1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${X4(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var GY=b(()=>{H0();L0()});function KY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
4018
- ${$.slice(Z)}`}function kW($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([N,T])=>`${N}="${T}"`).join(" ")}>`}).join(`
4015
+ `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function wW($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function RW($){let Z=$,Y=0;while(Y<Z.length){let X=y1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=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=i0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=z1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=t1(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(HW.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=z1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=z1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function AW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function NW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function TW($){let Z=$,Y=0;while(Y<Z.length){let X=y1(Z,Y);if(!X)break;let Q=t1(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=W1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function MW($){let Z=$,Y=0;while(Y<Z.length){let X=y1(Z,Y);if(!X)break;let Q=t1(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=W1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function IW($){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 DW($){let Z=$,Y=0;while(Y<Z.length){let X=y1(Z,Y);if(!X)break;if(!JY(X.attrs,"v-once")){Y=X.end;continue}let Q=W1(X.attrs,"v-once"),J=i0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
4016
+ ${z1(G,{...X,start:0,end:X.end-X.start},Q)}
4017
+ @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function EW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function kW($){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 QY($){if(!LW($))return $;let Z=$;return Z=FW(Z),Z=VW(Z),Z=DW(Z),Z=AW(Z),Z=NW(Z),Z=RW(Z),Z=wW(Z),Z=kW(Z),Z=TW(Z),Z=MW(Z),Z=IW(Z),Z=EW(Z),Z}var jW,HW;var GY=S(()=>{jW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),HW=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function Q$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function KY($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${Q$(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=$0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await N1(z,_,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${Q$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await bW(J,Z,Y,X,Q),J}async function bW($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${Q$(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",_=await N1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${Q$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var qY=S(()=>{H0();L0()});function UY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
4018
+ ${$.slice(Z)}`}function SW($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((R)=>{return` <meta ${Object.entries(R).map(([N,T])=>`${N}="${T}"`).join(" ")}>`}).join(`
4019
4019
  `),H=G.map((R)=>{return` <link ${Object.entries(R).map(([N,T])=>`${N}="${T}"`).join(" ")}>`}).join(`
4020
4020
  `),L=K.map((R)=>{if(R.src)return` <script ${Object.entries(R).filter(([N])=>N!=="content").map(([N,T])=>`${N}="${T}"`).join(" ")}></script>`;if(R.content)return` <script>${R.content}</script>`;return""}).filter(Boolean).join(`
4021
4021
  `),F=Object.entries(U).map(([R,A])=>` ${R}="${A}"`).join(""),O=W?` class="${W}"`:"",V=[j,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((R)=>` ${R}`),...(Y.headScripts||[]).map((R)=>` ${R}`),Y.headStack||""].filter(Boolean),w=[$,...(Y.bodyScripts||[]).map((R)=>R),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
@@ -4028,9 +4028,9 @@ ${V.join(`
4028
4028
  ${w.join(`
4029
4029
  `)}
4030
4030
  </body>
4031
- </html>`}function m3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function qY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
4031
+ </html>`}function p3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function WY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
4032
4032
  `)}
4033
- ${$.slice(Y)}`}function UY($,Z={},Y={}){if(m3($))return $;return kW($,Z,Y)}function G4($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(C0)X.add(C0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),C5)X.forEach((K)=>Q4.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function K4($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,C5)X.forEach((G)=>Q4.add(G));else X.forEach((G)=>G())},J=()=>{if(C0)X.add(C0);if(Y){let G=C0;C0=Q,J4.push(Q);try{Z=$()}finally{J4.pop(),C0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function q4($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=C0;C0=Q,J4.push(Q);try{Y=$()}finally{J4.pop(),C0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function u3($){if(C5){$();return}C5=!0;try{$()}finally{C5=!1,Q4.forEach((Z)=>Z()),Q4.clear()}}function l3($){SW.push($)}function p3($){bW.push($)}function U4($){return typeof $==="function"&&$._isSignal===!0}function W4($){return typeof $==="function"&&$._isDerived===!0}function c3($){if(U4($)||W4($))return $();return $}function z4($){let Z=C0;C0=null;try{return $()}finally{C0=Z}}function yW($,Z){let Y=typeof $==="function"?$:()=>$,X=G4([]),Q=K4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return q4(()=>{if(Y(),!J){J=!0;return}if(z4(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var C0=null,J4,C5=!1,Q4,SW,bW;var i3=b(()=>{J4=[],Q4=new Set,SW=[],bW=[]});var zY={};n(zY,{useOptimistic:()=>yW,untrack:()=>c3,state:()=>G4,peek:()=>z4,onMount:()=>l3,onDestroy:()=>p3,isSignal:()=>U4,isDerived:()=>W4,generateSignalsRuntimeDev:()=>B4,generateSignalsRuntime:()=>WY,effect:()=>q4,derived:()=>K4,default:()=>CW,batch:()=>u3});function WY(){try{let $=PW(B4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return B4()}}function PW($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function B4(){return`
4033
+ ${$.slice(Y)}`}function zY($,Z={},Y={}){if(p3($))return $;return SW($,Z,Y)}function q$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(y0)X.add(y0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),v5)X.forEach((K)=>K$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function U$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,v5)X.forEach((G)=>K$.add(G));else X.forEach((G)=>G())},J=()=>{if(y0)X.add(y0);if(Y){let G=y0;y0=Q,G$.push(Q);try{Z=$()}finally{G$.pop(),y0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function W$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=y0;y0=Q,G$.push(Q);try{Y=$()}finally{G$.pop(),y0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function c3($){if(v5){$();return}v5=!0;try{$()}finally{v5=!1,K$.forEach((Z)=>Z()),K$.clear()}}function i3($){yW.push($)}function n3($){PW.push($)}function z$($){return typeof $==="function"&&$._isSignal===!0}function B$($){return typeof $==="function"&&$._isDerived===!0}function o3($){if(z$($)||B$($))return $();return $}function _$($){let Z=y0;y0=null;try{return $()}finally{y0=Z}}function CW($,Z){let Y=typeof $==="function"?$:()=>$,X=q$([]),Q=U$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return W$(()=>{if(Y(),!J){J=!0;return}if(_$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var y0=null,G$,v5=!1,K$,yW,PW;var s3=S(()=>{G$=[],K$=new Set,yW=[],PW=[]});var _Y={};o(_Y,{useOptimistic:()=>CW,untrack:()=>o3,state:()=>q$,peek:()=>_$,onMount:()=>i3,onDestroy:()=>n3,isSignal:()=>z$,isDerived:()=>B$,generateSignalsRuntimeDev:()=>j$,generateSignalsRuntime:()=>BY,effect:()=>W$,derived:()=>U$,default:()=>xW,batch:()=>c3});function BY(){try{let $=vW(j$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return j$()}}function vW($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function j$(){return`
4034
4034
  // STX Signals Runtime (Development Build)
4035
4035
  console.log('[stx] signals runtime loading');
4036
4036
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -9251,7 +9251,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
9251
9251
  }
9252
9252
  }
9253
9253
  })();
9254
- `}var CW;var BY=b(()=>{i3();i3();CW={state:G4,derived:K4,effect:q4,batch:u3,onMount:l3,onDestroy:p3,isSignal:U4,isDerived:W4,untrack:c3,peek:z4,generateSignalsRuntime:WY,generateSignalsRuntimeDev:B4}});var n3={};n(n3,{templateCache:()=>_Y,readFileCached:()=>vW,invalidateFileCacheByDir:()=>fW,invalidateFileCache:()=>xW,hashFilePath:()=>v5,getCachedSignalsRuntime:()=>dW,getCachedRouterScript:()=>mW,clearDevCaches:()=>uW,checkCache:()=>lW,cacheTemplate:()=>pW,__setSignalsGeneratorsForTest:()=>hW});import z1 from"fs";import a1 from"path";async function vW($){let Y;for(let X=0;X<3;X++)try{let J=(await z1.promises.stat($)).mtime.getTime(),G=y1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await z1.promises.stat($)).mtime.getTime();if(W!==J)continue;return y1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw y1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function xW($){y1.delete($)}function fW($){for(let Z of y1.keys())if(Z.startsWith($))y1.delete(Z)}function hW($){jY=$}async function dW($=!1){let Z=jY??await Promise.resolve().then(() => (BY(),zY));if($)return Z.generateSignalsRuntimeDev();if(_4===null)_4=Z.generateSignalsRuntime();return _4}async function mW(){if(j4===null){let{getRouterScript:$}=await import("stx-router");j4=$()}return j4}function uW(){y1.clear(),_4=null,gW=null,j4=null}function HY($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function lW($,Z){try{if(!Z.cachePath)return null;let Y=a1.resolve(Z.cachePath),X=a1.join(Y,`${v5($)}.html`),Q=a1.join(Y,`${v5($)}.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!==Z.cacheVersion)return null;if(G.optionsSignature!==HY(Z))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(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function pW($,Z,Y,X){try{if(!X.cachePath)return;let Q=a1.resolve(X.cachePath);await z1.promises.mkdir(Q,{recursive:!0});let J=a1.join(Q,`${v5($)}.html`),G=a1.join(Q,`${v5($)}.meta.json`),K=await z1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:HY(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),_Y.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function v5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,cW)}var _Y,y1,_4=null,gW=null,jY=null,j4=null,cW=16;var o3=b(()=>{H0();_Y=new Map,y1=new Map});function OY($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9254
+ `}var xW;var jY=S(()=>{s3();s3();xW={state:q$,derived:U$,effect:W$,batch:c3,onMount:i3,onDestroy:n3,isSignal:z$,isDerived:B$,untrack:o3,peek:_$,generateSignalsRuntime:BY,generateSignalsRuntimeDev:j$}});var r3={};o(r3,{templateCache:()=>HY,readFileCached:()=>fW,invalidateFileCacheByDir:()=>hW,invalidateFileCache:()=>gW,hashFilePath:()=>x5,getCachedSignalsRuntime:()=>uW,getCachedRouterScript:()=>lW,clearDevCaches:()=>pW,checkCache:()=>cW,cacheTemplate:()=>iW,__setSignalsGeneratorsForTest:()=>mW});import B1 from"fs";import e1 from"path";async function fW($){let Y;for(let X=0;X<3;X++)try{let J=(await B1.promises.stat($)).mtime.getTime(),G=P1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await B1.promises.stat($)).mtime.getTime();if(W!==J)continue;return P1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw P1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function gW($){P1.delete($)}function hW($){for(let Z of P1.keys())if(Z.startsWith($))P1.delete(Z)}function mW($){OY=$}async function uW($=!1){let Z=OY??await Promise.resolve().then(() => (jY(),_Y));if($)return Z.generateSignalsRuntimeDev();if(H$===null)H$=Z.generateSignalsRuntime();return H$}async function lW(){if(O$===null){let{getRouterScript:$}=await import("stx-router");O$=$()}return O$}function pW(){P1.clear(),H$=null,dW=null,O$=null}function LY($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function cW($,Z){try{if(!Z.cachePath)return null;let Y=e1.resolve(Z.cachePath),X=e1.join(Y,`${x5($)}.html`),Q=e1.join(Y,`${x5($)}.meta.json`);if(!await i(X)||!await i(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==LY(Z))return null;if((await B1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await B1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function iW($,Z,Y,X){try{if(!X.cachePath)return;let Q=e1.resolve(X.cachePath);await B1.promises.mkdir(Q,{recursive:!0});let J=e1.join(Q,`${x5($)}.html`),G=e1.join(Q,`${x5($)}.meta.json`),K=await B1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:LY(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),HY.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function x5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,nW)}var HY,P1,H$=null,dW=null,OY=null,O$=null,nW=16;var a3=S(()=>{H0();HY=new Map,P1=new Map});function FY($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9255
9255
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Y+=X[1]+`
9256
9256
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),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,W,U=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){U=!0;break}if(!G&&!U)return $;let z=`<script type="module">
9257
9257
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -9260,22 +9260,22 @@ import '@stacksjs/browser'
9260
9260
  `+$.slice(j);return $.replace("</head>",`${z}
9261
9261
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
9262
9262
  ${z}`);return z+`
9263
- `+$}async function LY($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9263
+ `+$}async function VY($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9264
9264
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9265
9265
  `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
9266
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (o3(),n3)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
9266
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (a3(),r3)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
9267
9267
  `+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
9268
9268
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
9269
9269
  `+Q+$.slice(K+1)}return Q+`
9270
- `+$}async function FY($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
9271
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (o3(),n3)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
9272
- </body>`+$.slice(G+7)}var DY={};n(DY,{scanScriptTags:()=>NY,processSignals:()=>e3,processScriptSetup:()=>MY,preEvalLiteralReactiveIfs:()=>a3,parseLoopExpression:()=>TY,hasSignalsSyntax:()=>L4,extractExports:()=>IY,convertSignalLoopsToAttributes:()=>t3,convertSignalDirectivesToAttributes:()=>r3});function NY($,Z={}){let Y=[];H4.lastIndex=0;let X;while((X=H4.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(Z.skipAttrs&&Z.skipAttrs.test(Q)){H4.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),H4.lastIndex=K}return Y}function TY($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=VY(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=VY(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function VY($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function L4($){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((Y)=>Y.test($))}function nW($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function oW($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function sW($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function RY($,Z,Y){if(!$)return!1;let X=sW($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(wY.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(wY.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function O4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(AY);if(J&&rW(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function rW($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function r3($,Z){let Y=$,X=oW($),Q=/@if\s*\(/g,J,G=[];while((J=Q.exec(Y))!==null){let K=J.index,q=K+J[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=1,j=B,H=/@(if\s*\(|endif)/g;H.lastIndex=B;let L;while((L=H.exec(Y))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){j=L.index+L[0].length;break}}if(_!==0)continue;let F=Y.substring(B,j-6).trim(),O;if(nW(F)){let V=I5(Y.substring(K,j));if(V.length===0)continue;let w=V[0].branches.filter((N)=>N.type!=="else");if(!(w.length>0&&w.every((N)=>RY(N.condition,X,Z))))continue;O=V[0].branches.map((N)=>{if(N.type==="elseif")return O4(N.content,"@else-if",N.condition??"");if(N.type==="else")return O4(N.content,"@else");return O4(N.content,"@if",N.condition??"")}).join(`
9273
- `)}else{if(!RY(z,X,Z))continue;O=O4(F,"@if",z)}G.push({start:K,end:j,replacement:O})}for(let K=G.length-1;K>=0;K--){let{start:q,end:W,replacement:U}=G[K];Y=Y.substring(0,q)+U+Y.substring(W)}return Y}function aW($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function tW($,Z,Y,X){if(s3.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||s3.has(Q)))K++}q=B+1}return-1}function $z($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return eW.test(J)}function a3($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([B,_])=>z>=B&&z<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,B,_,j,H,L,F]=K,O=aW(H);if(O===void 0)continue;let V=K.index,w=V+z.length,N=!!F||/\/\s*>$/.test(z)||s3.has(B.toLowerCase())?w:tW($,V,B,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&$z($,N)){J.lastIndex=w;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:N,replacement:""}),J.lastIndex=N}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:_,replacement:j}=q[z];U=U.substring(0,B)+j+U.substring(_)}return U}function t3($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=TY(z);if(_.iterable){let A=_.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Z){let N=A.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),w=V.match(AY),R;if(w){let[,A,N,T]=w;R=`<${A}${N} @for="${z}">${T}</${A}>`}else R=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function Zz($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
9270
+ `+$}async function wY($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
9271
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (a3(),r3)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
9272
+ </body>`+$.slice(G+7)}var kY={};o(kY,{scanScriptTags:()=>MY,processSignals:()=>Y6,processScriptSetup:()=>DY,preEvalLiteralReactiveIfs:()=>$6,parseLoopExpression:()=>IY,hasSignalsSyntax:()=>V$,extractExports:()=>EY,convertSignalLoopsToAttributes:()=>Z6,convertSignalDirectivesToAttributes:()=>e3});function MY($,Z={}){let Y=[];L$.lastIndex=0;let X;while((X=L$.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(Z.skipAttrs&&Z.skipAttrs.test(Q)){L$.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),L$.lastIndex=K}return Y}function IY($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=RY(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=RY(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function RY($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function V$($){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((Y)=>Y.test($))}function sW($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function rW($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function aW($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function NY($,Z,Y){if(!$)return!1;let X=aW($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(AY.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(AY.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function F$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(TY);if(J&&tW(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function tW($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function e3($,Z){let Y=$,X=rW($),Q=/@if\s*\(/g,J,G=[];while((J=Q.exec(Y))!==null){let K=J.index,q=K+J[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=1,j=B,H=/@(if\s*\(|endif)/g;H.lastIndex=B;let L;while((L=H.exec(Y))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){j=L.index+L[0].length;break}}if(_!==0)continue;let F=Y.substring(B,j-6).trim(),O;if(sW(F)){let V=D5(Y.substring(K,j));if(V.length===0)continue;let w=V[0].branches.filter((N)=>N.type!=="else");if(!(w.length>0&&w.every((N)=>NY(N.condition,X,Z))))continue;O=V[0].branches.map((N)=>{if(N.type==="elseif")return F$(N.content,"@else-if",N.condition??"");if(N.type==="else")return F$(N.content,"@else");return F$(N.content,"@if",N.condition??"")}).join(`
9273
+ `)}else{if(!NY(z,X,Z))continue;O=F$(F,"@if",z)}G.push({start:K,end:j,replacement:O})}for(let K=G.length-1;K>=0;K--){let{start:q,end:W,replacement:U}=G[K];Y=Y.substring(0,q)+U+Y.substring(W)}return Y}function eW($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function $z($,Z,Y,X){if(t3.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||t3.has(Q)))K++}q=B+1}return-1}function Yz($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return Zz.test(J)}function $6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([B,_])=>z>=B&&z<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,B,_,j,H,L,F]=K,O=eW(H);if(O===void 0)continue;let V=K.index,w=V+z.length,N=!!F||/\/\s*>$/.test(z)||t3.has(B.toLowerCase())?w:$z($,V,B,w);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&Yz($,N)){J.lastIndex=w;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:N,replacement:""}),J.lastIndex=N}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:_,replacement:j}=q[z];U=U.substring(0,B)+j+U.substring(_)}return U}function Z6($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=IY(z);if(_.iterable){let A=_.iterable.trim();if(A.startsWith("[")||A.startsWith("{")||A.startsWith("'")||A.startsWith('"')||A.startsWith("`")||/^-?\d/.test(A))continue;if(Z){let N=A.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),w=V.match(TY),R;if(w){let[,A,N,T]=w;R=`<${A}${N} @for="${z}">${T}</${A}>`}else R=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:R})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function Xz($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
9274
9274
  `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},W=(U)=>{let z=U,B=0;while(z<J){let _=$[z];if(_==="/"&&$[z+1]==="/"){let j=z+2;while(j<J&&$[j]!==`
9275
- `)j++;z=j;continue}if(_==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}z=j;continue}if(_==="("||_==="["||_==="{"){B++,z++;continue}if(_===")"||_==="]"||_==="}"){B--,z++;continue}if(_===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function MY($,Z,Y){let X=NY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let H of X){let L=H.body;if(L1(H.attrs))L=F1(L);if(Q.test(L))J.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${iW++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (n5(),i5)),W=[];for(let H=0;H<J.length;H++){let L=J[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.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 F=a0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
9275
+ `)j++;z=j;continue}if(_==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}z=j;continue}if(_==="("||_==="["||_==="{"){B++,z++;continue}if(_===")"||_==="]"||_==="}"){B--,z++;continue}if(_===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function DY($,Z,Y){let X=MY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let H of X){let L=H.body;if(F1(H.attrs))L=V1(L);if(Q.test(L))J.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${oW++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (s5(),o5)),W=[];for(let H=0;H<J.length;H++){let L=J[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.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 F=a0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
9276
9276
  ${F}`)}let U=W.join(`
9277
9277
 
9278
- `);U=Zz(U);let z=IY(U),B=o5(U,Y),_=`
9278
+ `);U=Xz(U);let z=EY(U),B=r5(U,Y),_=`
9279
9279
  <script data-stx-scoped>
9280
9280
  function ${G}() {
9281
9281
  const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
@@ -9283,28 +9283,28 @@ ${B}${U}
9283
9283
  return { ${z} };
9284
9284
  }
9285
9285
  if(window.stx)window.stx._latestSetup=${G};
9286
- </script>`,j=$;for(let H of J)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:_}}function IY($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
9286
+ </script>`,j=$;for(let H of J)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:_}}function EY($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
9287
9287
  `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},z=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')U(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},B=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
9288
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function e3($,Z,Y,X){if(!L4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await MY(Q,Y,X);if(Q=J,Q=await LY(Q,Z),Q=OY(Q),G)if(Q.includes("</head>"))Q=Q.replace("</head>",`${G}
9288
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),N=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function Y6($,Z,Y,X){if(!V$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await DY(Q,Y,X);if(Q=J,Q=await VY(Q,Z),Q=FY(Q),G)if(Q.includes("</head>"))Q=Q.replace("</head>",`${G}
9289
9289
  </head>`);else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
9290
9290
  ${G}`);else Q=Q+`
9291
- `+G;let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=/<(script|style)\b[\s\S]*?<\/\1>/gi,B=[],_;while((_=z.exec(Q))!==null)B.push([_.index,_.index+_[0].length]);let j=0,H=-1;while(j<Q.length){U.lastIndex=j;let L=U.exec(Q.slice(j));if(!L)break;let F=j+L.index;if(!B.some(([V,w])=>F>=V&&F<w)){H=F;break}j=F+L[0].length}if(H!==-1){let L=Q.slice(0,H),F=Q.slice(H).replace(U,(O)=>O.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=L+F}}return Q}var iW=0,H4,AY,wY,s3,eW;var $6=b(()=>{W5();u$();H0();H4=/<script\b([^>]*)>/gi,AY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;wY=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);s3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);eW=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import t1 from"path";function EY($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function kY($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=t1.join(Q,$);if(await Bun.file(G).exists())return G;Q=t1.dirname(Q)}X=t1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=t1.resolve(Z,$);else X=t1.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function SY($,Z,Y){let X=$,Q=t1.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(EY(z))continue;let _=await kY(z,Q,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
9291
+ `+G;let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=/<(script|style)\b[\s\S]*?<\/\1>/gi,B=[],_;while((_=z.exec(Q))!==null)B.push([_.index,_.index+_[0].length]);let j=0,H=-1;while(j<Q.length){U.lastIndex=j;let L=U.exec(Q.slice(j));if(!L)break;let F=j+L.index;if(!B.some(([V,w])=>F>=V&&F<w)){H=F;break}j=F+L[0].length}if(H!==-1){let L=Q.slice(0,H),F=Q.slice(H).replace(U,(O)=>O.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=L+F}}return Q}var oW=0,L$,TY,AY,t3,Zz;var X6=S(()=>{z5();p4();H0();L$=/<script\b([^>]*)>/gi,TY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;AY=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);t3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Zz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import $5 from"path";function bY($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function SY($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=$5.join(Q,$);if(await Bun.file(G).exists())return G;Q=$5.dirname(Q)}X=$5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=$5.resolve(Z,$);else X=$5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function yY($,Z,Y){let X=$,Q=$5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(bY(z))continue;let _=await SY(z,Q,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
9292
9292
  // Source: ${z}
9293
9293
  ${j}
9294
- </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,B]=q,_=U+B;if(EY(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await kY(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9294
+ </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,B]=q,_=U+B;if(bY(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await SY(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9295
9295
  /* Source: ${z} */
9296
9296
  ${L}
9297
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var bY=b(()=>{f1()});function F4($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(Z0(V))w=Y0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+A+Y.substring(q+1),X.lastIndex=J+A.length}catch(V){d0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function V4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function yY($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=U+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[N,T,M="",I]=R,D=`<${T}${M} data-stx-memo="${W}"${I}>`;A=_.slice(0,L)+D+w.slice(N.length)+_.slice(L+w.length)}else A=`${_.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${_.slice(L+w.length)}`;Q.push({start:J,end:j,replacement:A}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Z6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function PY($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function CY($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!Yz.test(z))continue;let B=$[U-1]==="/",_=B?U-1:U;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var Yz;var Y6=b(()=>{t0();L0();Yz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function w4($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Xz){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
9297
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var PY=S(()=>{h1()});function w$($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let w=z[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),w;if(X0(V))w=J0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(O==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let A=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+A+Y.substring(q+1),X.lastIndex=J+A.length}catch(V){m0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function R$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function CY($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=U+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(R){let[N,T,M="",I]=R,D=`<${T}${M} data-stx-memo="${W}"${I}>`;A=_.slice(0,L)+D+w.slice(N.length)+_.slice(L+w.length)}else A=`${_.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${_.slice(L+w.length)}`;Q.push({start:J,end:j,replacement:A}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function J6($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function vY($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function xY($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!Jz.test(z))continue;let B=$[U-1]==="/",_=B?U-1:U;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var Jz;var Q6=S(()=>{t0();L0();Jz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function A$($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Qz){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
9298
9298
  `),z=[];U.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))z.push(j+1)});let B=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${B}
9299
9299
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9300
9300
  ${J.join(`
9301
9301
  `)}
9302
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Xz;var X6=b(()=>{Xz=[{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 vY={};n(vY,{getStoreScript:()=>Jz,clearStoreCache:()=>Qz});import R4 from"path";async function Jz($){let Z;if($)Z=R4.resolve($);else{let U=await f$();Z=R4.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=e1.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=R4.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return e1.set(Z,""),null}if(Q.length===0)return e1.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.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:l0()});for(let U of G)try{let z=await Bun.file(U).text(),B=R4.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9303
- ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return e1.set(Z,""),null;let W=`;(function(){
9302
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Qz;var G6=S(()=>{Qz=[{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 fY={};o(fY,{getStoreScript:()=>Gz,clearStoreCache:()=>Kz});import N$ from"path";async function Gz($){let Z;if($)Z=N$.resolve($);else{let U=await h4();Z=N$.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=Z5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=N$.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return Z5.set(Z,""),null}if(Q.length===0)return Z5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.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:l0()});for(let U of G)try{let z=await Bun.file(U).text(),B=N$.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9303
+ ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return Z5.set(Z,""),null;let W=`;(function(){
9304
9304
  ${K.join(`
9305
9305
 
9306
9306
  `)}
9307
- })();`;return e1.set(Z,W),W}function Qz(){e1.clear()}var e1;var xY=b(()=>{T5();f1();e1=new Map});var gY={};n(gY,{processDeferDirectives:()=>Wz});function Gz(){return`stx-defer-${++fY}`}function Kz($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function qz($,Z,Y){let{trigger:X,value:Q}=Kz(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[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 Uz($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9307
+ })();`;return Z5.set(Z,W),W}function Kz(){Z5.clear()}var Z5;var gY=S(()=>{M5();h1();Z5=new Map});var dY={};o(dY,{processDeferDirectives:()=>Bz});function qz(){return`stx-defer-${++hY}`}function Uz($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function Wz($,Z,Y){let{trigger:X,value:Q}=Uz(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[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 zz($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9308
9308
  const observer = new IntersectionObserver((entries) => {
9309
9309
  if (entries[0].isIntersecting) {
9310
9310
  observer.disconnect();
@@ -9377,7 +9377,7 @@ else {
9377
9377
  ${Q}
9378
9378
  })();
9379
9379
  </script>
9380
- `}function Wz($,Z,Y){fY=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=Gz(),q=qz(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=Uz(K,q);return`
9380
+ `}function Bz($,Z,Y){hY=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=qz(),q=Wz(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=zz(K,q);return`
9381
9381
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
9382
9382
  ${W}
9383
9383
  ${U}
@@ -9385,7 +9385,7 @@ else {
9385
9385
  ${z}
9386
9386
  </div>
9387
9387
  ${_}
9388
- `})}var fY=0;var dY={};n(dY,{processTeleportDirectives:()=>jz,ensureTeleportTargets:()=>Hz});function zz(){return`stx-teleport-${++hY}`}function Bz($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function _z($,Z){return`
9388
+ `})}var hY=0;var uY={};o(uY,{processTeleportDirectives:()=>Oz,ensureTeleportTargets:()=>Lz});function _z(){return`stx-teleport-${++mY}`}function jz($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function Hz($,Z){return`
9389
9389
  <script>
9390
9390
  (function() {
9391
9391
  const source = document.getElementById('${$}');
@@ -9431,12 +9431,12 @@ else {
9431
9431
  });
9432
9432
  })();
9433
9433
  </script>
9434
- `}function jz($,Z,Y){hY=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=zz(),{target:q,disabled:W}=Bz(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=_z(K,q);return`
9434
+ `}function Oz($,Z,Y){mY=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=_z(),{target:q,disabled:W}=jz(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=Hz(K,q);return`
9435
9435
  <div id="${K}" class="stx-teleport-source" style="display: none;">
9436
9436
  <template>${U}</template>
9437
9437
  </div>
9438
9438
  ${z}
9439
- `})}function Hz(){return`
9439
+ `})}function Lz(){return`
9440
9440
  <script>
9441
9441
  (function() {
9442
9442
  // Common teleport targets
@@ -9453,7 +9453,7 @@ else {
9453
9453
  });
9454
9454
  })();
9455
9455
  </script>
9456
- `}var hY=0;var pY={};n(pY,{processTransitionDirectives:()=>Vz,processTransitionAttributes:()=>Nz,performLeave:()=>Fz,performEnter:()=>Lz,generateTransitionRuntime:()=>Az,generateTransitionCSS:()=>Rz});function mY($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function Oz($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.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(Y),Q(X))}function uY($,Z){return new Promise((Y)=>{let X=Z??Oz($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function lY($){$.offsetHeight}async function Lz($,Z={}){let Y=Z.name||"stx",X=mY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),lY($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await uY($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function Fz($,Z={}){let Y=Z.name||"stx",X=mY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),lY($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await uY($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function Vz($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=wz(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9456
+ `}var mY=0;var iY={};o(iY,{processTransitionDirectives:()=>Rz,processTransitionAttributes:()=>Mz,performLeave:()=>wz,performEnter:()=>Vz,generateTransitionRuntime:()=>Tz,generateTransitionCSS:()=>Nz});function lY($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function Fz($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.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(Y),Q(X))}function pY($,Z){return new Promise((Y)=>{let X=Z??Fz($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function cY($){$.offsetHeight}async function Vz($,Z={}){let Y=Z.name||"stx",X=lY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),cY($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await pY($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function wz($,Z={}){let Y=Z.name||"stx",X=lY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),cY($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await pY($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function Rz($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=Az(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9457
9457
  <div
9458
9458
  class="stx-transition-wrapper"
9459
9459
  data-transition="${q}"
@@ -9495,7 +9495,7 @@ else {
9495
9495
  });
9496
9496
  })();
9497
9497
  </script>
9498
- `})}function wz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function Rz(){return`
9498
+ `})}function Az($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function Nz(){return`
9499
9499
  /* STX Transition Presets */
9500
9500
 
9501
9501
  /* Fade */
@@ -9682,7 +9682,7 @@ else {
9682
9682
  opacity: 1;
9683
9683
  max-height: 1000px;
9684
9684
  }
9685
- `}function Az(){return`
9685
+ `}function Tz(){return`
9686
9686
  // STX Transition Runtime
9687
9687
  (function() {
9688
9688
  if (typeof window === 'undefined') return;
@@ -9771,7 +9771,7 @@ else {
9771
9771
 
9772
9772
  console.log('[stx] Transition runtime initialized');
9773
9773
  })();
9774
- `}function Nz($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,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 iY={};n(iY,{withErrorBoundary:()=>cY,processErrorBoundaryDirectives:()=>Iz,generateErrorBoundaryRuntime:()=>bz,generateErrorBoundaryCSS:()=>Sz,createErrorBoundary:()=>kz});function Mz(){return`eb-${++Tz}-${Date.now().toString(36)}`}function Iz($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=Mz(),W=Dz(J||"");return Ez(q,G.trim(),K.trim(),W)})}function Dz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function Ez($,Z,Y,X){let Q=X.logErrors!==!1;return`
9774
+ `}function Mz($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,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 oY={};o(oY,{withErrorBoundary:()=>nY,processErrorBoundaryDirectives:()=>Ez,generateErrorBoundaryRuntime:()=>Pz,generateErrorBoundaryCSS:()=>yz,createErrorBoundary:()=>Sz});function Dz(){return`eb-${++Iz}-${Date.now().toString(36)}`}function Ez($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=Dz(),W=kz(J||"");return bz(q,G.trim(),K.trim(),W)})}function kz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function bz($,Z,Y,X){let Q=X.logErrors!==!1;return`
9775
9775
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
9776
9776
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
9777
9777
  ${Z}
@@ -9891,7 +9891,7 @@ else {
9891
9891
  };
9892
9892
  })();
9893
9893
  </script>
9894
- `}async function cY($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function kz($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>cY(X,$,Y)}function Sz(){return`
9894
+ `}async function nY($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function Sz($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>nY(X,$,Y)}function yz(){return`
9895
9895
  /* STX Error Boundary Styles */
9896
9896
  .stx-error-boundary {
9897
9897
  position: relative;
@@ -9935,7 +9935,7 @@ else {
9935
9935
  color: #fecaca;
9936
9936
  }
9937
9937
  }
9938
- `}function bz(){return`
9938
+ `}function Pz(){return`
9939
9939
  // STX Error Boundary Runtime
9940
9940
  (function() {
9941
9941
  if (typeof window === 'undefined') return;
@@ -10000,7 +10000,7 @@ else {
10000
10000
 
10001
10001
  console.log('[stx] Error boundary runtime initialized');
10002
10002
  })();
10003
- `}var Tz=0;var nY={};n(nY,{renderSSRSuspense:()=>gz,processSuspenseDirectives:()=>Cz,generateSuspenseRuntime:()=>dz,generateSuspenseCSS:()=>hz,createSSRSuspense:()=>fz});function Pz(){return`suspense-${++yz}-${Date.now().toString(36)}`}function Cz($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=Pz(),W=vz(J||"");return xz(q,G.trim(),K.trim(),W)})}function vz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function xz($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10003
+ `}var Iz=0;var sY={};o(sY,{renderSSRSuspense:()=>dz,processSuspenseDirectives:()=>xz,generateSuspenseRuntime:()=>uz,generateSuspenseCSS:()=>mz,createSSRSuspense:()=>hz});function vz(){return`suspense-${++Cz}-${Date.now().toString(36)}`}function xz($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=vz(),W=fz(J||"");return gz(q,G.trim(),K.trim(),W)})}function fz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function gz($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10004
10004
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
10005
10005
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10006
10006
  ${Y}
@@ -10190,7 +10190,7 @@ else {
10190
10190
  }, 0);
10191
10191
  })();
10192
10192
  </script>
10193
- `}function fz($,Z,Y){return{id:$,fallback:Y,content:Z}}async function gz($){let Z=$.map((X)=>`
10193
+ `}function hz($,Z,Y){return{id:$,fallback:Y,content:Z}}async function dz($){let Z=$.map((X)=>`
10194
10194
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
10195
10195
  ${X.fallback}
10196
10196
  </div>
@@ -10215,7 +10215,7 @@ else {
10215
10215
  }
10216
10216
  })();
10217
10217
  </script>
10218
- `}}return{initial:Z,streaming:Y()}}function hz(){return`
10218
+ `}}return{initial:Z,streaming:Y()}}function mz(){return`
10219
10219
  /* STX Suspense Styles */
10220
10220
  .stx-suspense {
10221
10221
  position: relative;
@@ -10271,7 +10271,7 @@ else {
10271
10271
  background-size: 200% 100%;
10272
10272
  }
10273
10273
  }
10274
- `}function dz(){return`
10274
+ `}function uz(){return`
10275
10275
  // STX Suspense Runtime
10276
10276
  (function() {
10277
10277
  if (typeof window === 'undefined') return;
@@ -10338,7 +10338,7 @@ else {
10338
10338
 
10339
10339
  console.log('[stx] Suspense runtime initialized');
10340
10340
  })();
10341
- `}var yz=0;var aY={};n(aY,{processAsyncDirectives:()=>uz,isAsyncComponent:()=>pz,generateAsyncComponentRuntime:()=>iz,generateAsyncComponentCSS:()=>cz,defineAsyncComponent:()=>lz});function oY(){return`async-${++mz}-${Date.now().toString(36)}`}function uz($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=oY(),z=sY(K);return rY(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=oY(),U=sY(K);return rY(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function sY($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function rY($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10341
+ `}var Cz=0;var eY={};o(eY,{processAsyncDirectives:()=>pz,isAsyncComponent:()=>iz,generateAsyncComponentRuntime:()=>oz,generateAsyncComponentCSS:()=>nz,defineAsyncComponent:()=>cz});function rY(){return`async-${++lz}-${Date.now().toString(36)}`}function pz($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=rY(),z=aY(K);return tY(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=rY(),U=aY(K);return tY(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function aY($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function tY($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10342
10342
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
10343
10343
  <div class="stx-async-loading" data-async-loading="${$}">
10344
10344
  ${Y}
@@ -10565,7 +10565,7 @@ catch (error) {
10565
10565
  loadComponent();
10566
10566
  })();
10567
10567
  </script>
10568
- `}function lz($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function pz($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function cz(){return`
10568
+ `}function cz($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function iz($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function nz(){return`
10569
10569
  /* STX Async Component Styles */
10570
10570
  .stx-async-component {
10571
10571
  position: relative;
@@ -10639,7 +10639,7 @@ catch (error) {
10639
10639
  background-size: 200% 100%;
10640
10640
  }
10641
10641
  }
10642
- `}function iz(){return`
10642
+ `}function oz(){return`
10643
10643
  // STX Async Component Runtime
10644
10644
  (function() {
10645
10645
  if (typeof window === 'undefined') return;
@@ -10693,7 +10693,7 @@ catch (error) {
10693
10693
 
10694
10694
  console.log('[stx] Async component runtime initialized');
10695
10695
  })();
10696
- `}var mz=0;var eY={};n(eY,{shouldCacheComponent:()=>tz,processKeepAliveDirectives:()=>oz,onDeactivated:()=>YB,onActivated:()=>ZB,generateKeepAliveRuntime:()=>$B,generateKeepAliveCSS:()=>ez,createKeepAliveCache:()=>az});function tY(){return`keep-alive-${++nz}-${Date.now().toString(36)}`}function oz($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=tY(),q=sz(J||"");return rz(K,G.trim(),q)})}function sz($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function rz($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10696
+ `}var lz=0;var ZX={};o(ZX,{shouldCacheComponent:()=>$B,processKeepAliveDirectives:()=>rz,onDeactivated:()=>JB,onActivated:()=>XB,generateKeepAliveRuntime:()=>YB,generateKeepAliveCSS:()=>ZB,createKeepAliveCache:()=>ez});function $X(){return`keep-alive-${++sz}-${Date.now().toString(36)}`}function rz($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=$X(),q=az(J||"");return tz(K,G.trim(),q)})}function az($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function tz($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10697
10697
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
10698
10698
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
10699
10699
  ${Z}
@@ -10980,7 +10980,7 @@ else {
10980
10980
  });
10981
10981
  })();
10982
10982
  </script>
10983
- `}function az($={}){return{id:$.id||tY(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function tz($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function ez(){return`
10983
+ `}function ez($={}){return{id:$.id||$X(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function $B($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function ZB(){return`
10984
10984
  /* STX Keep-Alive Styles */
10985
10985
  .stx-keep-alive {
10986
10986
  position: relative;
@@ -11005,7 +11005,7 @@ else {
11005
11005
  .stx-keep-alive-content > [data-activated] {
11006
11006
  opacity: 1;
11007
11007
  }
11008
- `}function $B(){return`
11008
+ `}function YB(){return`
11009
11009
  // STX Keep-Alive Runtime
11010
11010
  (function() {
11011
11011
  if (typeof window === 'undefined') return;
@@ -11041,7 +11041,7 @@ else {
11041
11041
 
11042
11042
  console.log('[stx] Keep-alive runtime initialized');
11043
11043
  })();
11044
- `}function ZB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function YB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var nz=0;var JX={};n(JX,{useVirtualList:()=>ZX,processVirtualListDirectives:()=>Q6,processVirtualGridDirectives:()=>XX,processInfiniteListDirectives:()=>YX,generateVirtualListCSS:()=>$X,default:()=>XB,createVirtualList:()=>J6});function J6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return _();let A=Math.max(0,Math.floor(U/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,A+N+Q*2);return{startIndex:A,endIndex:T}}function _(){let A=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+I>U){N=Math.max(0,M-Q);break}A+=I}A=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+=I,A>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function j(){if(G){let A=0;for(let N=0;N<W.length;N++)A+=z.get(N)||K;return A}return W.length*Y}function H(A){if(G){let N=0;for(let T=0;T<A;T++)N+=z.get(T)||K;return N}return A*Y}function L(){let{startIndex:A,endIndex:N}=B();return{startIndex:A,endIndex:N,scrollTop:U,totalHeight:j(),visibleItems:W.slice(A,N+1),itemHeights:new Map(z)}}function F(A,N="auto"){let T=H(A);O(T,N)}function O(A,N="auto"){U=Math.max(0,Math.min(A,j()-X))}function V(){B()}function w(A){W=[...A],z.clear(),V()}function R(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:R}}function Q6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11044
+ `}function XB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function JB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var sz=0;var GX={};o(GX,{useVirtualList:()=>XX,processVirtualListDirectives:()=>q6,processVirtualGridDirectives:()=>QX,processInfiniteListDirectives:()=>JX,generateVirtualListCSS:()=>YX,default:()=>QB,createVirtualList:()=>K6});function K6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return _();let A=Math.max(0,Math.floor(U/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,A+N+Q*2);return{startIndex:A,endIndex:T}}function _(){let A=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+I>U){N=Math.max(0,M-Q);break}A+=I}A=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(A+=I,A>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function j(){if(G){let A=0;for(let N=0;N<W.length;N++)A+=z.get(N)||K;return A}return W.length*Y}function H(A){if(G){let N=0;for(let T=0;T<A;T++)N+=z.get(T)||K;return N}return A*Y}function L(){let{startIndex:A,endIndex:N}=B();return{startIndex:A,endIndex:N,scrollTop:U,totalHeight:j(),visibleItems:W.slice(A,N+1),itemHeights:new Map(z)}}function F(A,N="auto"){let T=H(A);O(T,N)}function O(A,N="auto"){U=Math.max(0,Math.min(A,j()-X))}function V(){B()}function w(A){W=[...A],z.clear(),V()}function R(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:R}}function q6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,A)=>{if(typeof V==="object"&&V!==null)return String(V[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11045
11045
  <div class="virtual-item ${U.itemClass||""}"
11046
11046
  style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
11047
11047
  data-index="${O}">
@@ -11118,7 +11118,7 @@ else {
11118
11118
  };
11119
11119
  })();
11120
11120
  </script>
11121
- `})}function $X(){return`
11121
+ `})}function YX(){return`
11122
11122
  .virtual-list-container {
11123
11123
  position: relative;
11124
11124
  overflow-y: auto;
@@ -11166,7 +11166,7 @@ else {
11166
11166
  0% { background-position: 200% 0; }
11167
11167
  100% { background-position: -200% 0; }
11168
11168
  }
11169
- `}function ZX($,Z){let Y=null,X=()=>{if(!Y)Y=J6($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function YX($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();z={...z,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=Q6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
11169
+ `}function XX($,Z){let Y=null,X=()=>{if(!Y)Y=K6($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function JX($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();z={...z,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=q6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
11170
11170
  // Infinite scroll detection
11171
11171
  container.addEventListener('scroll', function() {
11172
11172
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -11184,7 +11184,7 @@ else {
11184
11184
  ${q}
11185
11185
  </div>
11186
11186
  </div>
11187
- `})}function XX($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let 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 z=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/U.columns),_=B*(U.rowHeight+(U.gap||0)),j=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let R=V*U.columns+w;if(R>=W.length)break;let A=W[R],N=w*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof A==="object"&&A!==null)return String(A[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));O+=`
11187
+ `})}function QX($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let 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 z=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/U.columns),_=B*(U.rowHeight+(U.gap||0)),j=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<U.columns;w++){let R=V*U.columns+w;if(R>=W.length)break;let A=W[R],N=w*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof A==="object"&&A!==null)return String(A[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));O+=`
11188
11188
  <div class="virtual-grid-item"
11189
11189
  style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
11190
11190
  data-index="${R}">
@@ -11254,7 +11254,7 @@ else {
11254
11254
  });
11255
11255
  })();
11256
11256
  </script>
11257
- `})}var XB;var QX=b(()=>{XB={createVirtualList:J6,processVirtualListDirectives:Q6,processInfiniteListDirectives:YX,processVirtualGridDirectives:XX,generateVirtualListCSS:$X,useVirtualList:ZX}});function GX(){return`<script data-stx-hydration-runtime>
11257
+ `})}var QB;var KX=S(()=>{QB={createVirtualList:K6,processVirtualListDirectives:q6,processInfiniteListDirectives:JX,processVirtualGridDirectives:QX,generateVirtualListCSS:YX,useVirtualList:XX}});function qX(){return`<script data-stx-hydration-runtime>
11258
11258
  (function() {
11259
11259
  'use strict';
11260
11260
 
@@ -11414,7 +11414,7 @@ else {
11414
11414
  stxIslands.initIslands();
11415
11415
  }
11416
11416
  })();
11417
- </script>`}function KX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function qX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var VX={};n(VX,{processStaticDirectives:()=>LX,processPartialHydrationDirectives:()=>WX,onHydrated:()=>OX,isHydrated:()=>HX,hydrateIsland:()=>BX,hydrateByStrategy:()=>_X,hydrateAll:()=>jX,generatePartialHydrationCSS:()=>zX,generateIslandManifest:()=>FX,default:()=>zB,createIslandRegistry:()=>UX});function UX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function JB($){return`
11417
+ </script>`}function UX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function WX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var RX={};o(RX,{processStaticDirectives:()=>VX,processPartialHydrationDirectives:()=>BX,onHydrated:()=>FX,isHydrated:()=>LX,hydrateIsland:()=>jX,hydrateByStrategy:()=>HX,hydrateAll:()=>OX,generatePartialHydrationCSS:()=>_X,generateIslandManifest:()=>wX,default:()=>_B,createIslandRegistry:()=>zX});function zX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function GB($){return`
11418
11418
  <script data-hydrate="${$}">
11419
11419
  (function() {
11420
11420
  const island = document.querySelector('[data-island="${$}"]');
@@ -11425,7 +11425,7 @@ else {
11425
11425
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
11426
11426
  })();
11427
11427
  </script>
11428
- `}function QB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
11428
+ `}function KB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
11429
11429
  <script data-hydrate="${$}">
11430
11430
  (function() {
11431
11431
  const island = document.querySelector('[data-island="${$}"]');
@@ -11461,7 +11461,7 @@ else {
11461
11461
  }
11462
11462
  })();
11463
11463
  </script>
11464
- `}function GB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
11464
+ `}function qB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
11465
11465
  <script data-hydrate="${$}">
11466
11466
  (function() {
11467
11467
  const island = document.querySelector('[data-island="${$}"]');
@@ -11494,7 +11494,7 @@ else {
11494
11494
  }
11495
11495
  })();
11496
11496
  </script>
11497
- `}function KB($,Z){let Y=Z.media||"(min-width: 768px)";return`
11497
+ `}function UB($,Z){let Y=Z.media||"(min-width: 768px)";return`
11498
11498
  <script data-hydrate="${$}">
11499
11499
  (function() {
11500
11500
  const island = document.querySelector('[data-island="${$}"]');
@@ -11523,7 +11523,7 @@ else {
11523
11523
  }
11524
11524
  })();
11525
11525
  </script>
11526
- `}function qB($){return`
11526
+ `}function WB($){return`
11527
11527
  <script data-hydrate="${$}">
11528
11528
  (function() {
11529
11529
  const island = document.querySelector('[data-island="${$}"]');
@@ -11545,7 +11545,7 @@ else {
11545
11545
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
11546
11546
  })();
11547
11547
  </script>
11548
- `}function UB($,Z){let Y=Z.event||"stx:activate";return`
11548
+ `}function zB($,Z){let Y=Z.event||"stx:activate";return`
11549
11549
  <script data-hydrate="${$}">
11550
11550
  (function() {
11551
11551
  const island = document.querySelector('[data-island="${$}"]');
@@ -11566,9 +11566,9 @@ else {
11566
11566
  });
11567
11567
  })();
11568
11568
  </script>
11569
- `}function WX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=$5(X,"load",Z),X=$5(X,"idle",Z),X=$5(X,"visible",Z),X=$5(X,"media",Z),X=WB(X),X=$5(X,"hover",Z),X=$5(X,"event",Z),Q=J&&X!==$,Q)X+=`
11570
- `+GX();return X}function $5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=KX(G.trim()),U=qX(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
11571
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=JB(q);break;case"idle":j=QB(q,K);break;case"visible":j=GB(q,K);break;case"media":j=KB(q,K);break;case"hover":j=qB(q);break;case"event":j=UB(q,K);break}return`
11569
+ `}function BX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=Y5(X,"load",Z),X=Y5(X,"idle",Z),X=Y5(X,"visible",Z),X=Y5(X,"media",Z),X=BB(X),X=Y5(X,"hover",Z),X=Y5(X,"event",Z),Q=J&&X!==$,Q)X+=`
11570
+ `+qX();return X}function Y5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=UX(G.trim()),U=WX(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
11571
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=GB(q);break;case"idle":j=KB(q,K);break;case"visible":j=qB(q,K);break;case"media":j=UB(q,K);break;case"hover":j=WB(q);break;case"event":j=zB(q,K);break}return`
11572
11572
  <div data-island="${q}"
11573
11573
  data-strategy="${Z}"
11574
11574
  ${z.join(`
@@ -11578,7 +11578,7 @@ else {
11578
11578
  ${G.trim()}${_}
11579
11579
  </div>
11580
11580
  ${j}
11581
- `})}function WB($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11581
+ `})}function BB($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11582
11582
  <div data-island="${Q}"
11583
11583
  data-strategy="only"
11584
11584
  class="stx-island stx-client-only">
@@ -11597,7 +11597,7 @@ else {
11597
11597
  }
11598
11598
  })();
11599
11599
  </script>
11600
- `})}function zX(){return`
11600
+ `})}function _X(){return`
11601
11601
  /* Island base styles */
11602
11602
  .stx-island {
11603
11603
  display: contents;
@@ -11638,11 +11638,11 @@ else {
11638
11638
  .stx-island.hydrated {
11639
11639
  opacity: 1;
11640
11640
  }
11641
- `}function BX($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function _X($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function jX(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function HX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function OX($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function LX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function FX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11641
+ `}function jX($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function HX($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function OX(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function LX($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function FX($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function VX($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function wX($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
11642
11642
  <script type="application/json" id="stx-island-manifest">
11643
11643
  ${JSON.stringify(Z)}
11644
11644
  </script>
11645
- `}var zB;var wX=b(()=>{zB={processPartialHydrationDirectives:WX,processStaticDirectives:LX,generatePartialHydrationCSS:zX,generateIslandManifest:FX,createIslandRegistry:UX,hydrateIsland:BX,hydrateByStrategy:_X,hydrateAll:jX,isHydrated:HX,onHydrated:OX}});var bX={};n(bX,{watchMultiple:()=>MX,watchEffect:()=>IX,watch:()=>TX,unref:()=>RX,toRefs:()=>AX,throttledComputed:()=>SX,stxWatchMultiple:()=>MX,stxWatchEffect:()=>IX,stxWatch:()=>TX,stxUnref:()=>RX,stxToRefs:()=>AX,stxThrottledComputed:()=>SX,stxShallowRef:()=>NX,stxRef:()=>Z5,stxIsRef:()=>B1,stxDebouncedComputed:()=>kX,stxComputed:()=>f5,shallowRef:()=>NX,ref:()=>Z5,processWatchDirectives:()=>EX,processComputedDirectives:()=>DX,isRef:()=>B1,default:()=>BB,debouncedComputed:()=>kX,computed:()=>f5});function Z5($){let Z=$,Y=new Set,X={get value(){if(n0){let Q=x5.get(X);if(!Q)Q=new Set,x5.set(X,Q);Q.add(n0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=x5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function B1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function RX($){return B1($)?$.value:$}function AX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=Z5($[Y]);return Z}function NX($){return Z5($)}function f5($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function U(){K.clear();let B=n0;n0=W,A4.push(W);try{return Y()}finally{A4.pop(),n0=B}}let z={get value(){if(n0){let B=x5.get(z);if(!B)B=new Set,x5.set(z,B);B.add(n0)}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=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function TX($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(B1($))return Q?P1($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?P1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(B1($))B=$.subscribe(()=>z());else B=f5($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function MX($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>B1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>B1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(B1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function IX($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=n0;n0=G,A4.push(G);try{X=$()}finally{A4.pop(),n0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function DX($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function EX($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11645
+ `}var _B;var AX=S(()=>{_B={processPartialHydrationDirectives:BX,processStaticDirectives:VX,generatePartialHydrationCSS:_X,generateIslandManifest:wX,createIslandRegistry:zX,hydrateIsland:jX,hydrateByStrategy:HX,hydrateAll:OX,isHydrated:LX,onHydrated:FX}});var PX={};o(PX,{watchMultiple:()=>DX,watchEffect:()=>EX,watch:()=>IX,unref:()=>NX,toRefs:()=>TX,throttledComputed:()=>yX,stxWatchMultiple:()=>DX,stxWatchEffect:()=>EX,stxWatch:()=>IX,stxUnref:()=>NX,stxToRefs:()=>TX,stxThrottledComputed:()=>yX,stxShallowRef:()=>MX,stxRef:()=>X5,stxIsRef:()=>_1,stxDebouncedComputed:()=>SX,stxComputed:()=>g5,shallowRef:()=>MX,ref:()=>X5,processWatchDirectives:()=>bX,processComputedDirectives:()=>kX,isRef:()=>_1,default:()=>jB,debouncedComputed:()=>SX,computed:()=>g5});function X5($){let Z=$,Y=new Set,X={get value(){if(n0){let Q=f5.get(X);if(!Q)Q=new Set,f5.set(X,Q);Q.add(n0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=f5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function _1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function NX($){return _1($)?$.value:$}function TX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=X5($[Y]);return Z}function MX($){return X5($)}function g5($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function U(){K.clear();let B=n0;n0=W,T$.push(W);try{return Y()}finally{T$.pop(),n0=B}}let z={get value(){if(n0){let B=f5.get(z);if(!B)B=new Set,f5.set(z,B);B.add(n0)}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=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function IX($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(_1($))return Q?C1($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?C1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(_1($))B=$.subscribe(()=>z());else B=g5($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function DX($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>_1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>_1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(_1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function EX($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=n0;n0=G,T$.push(G);try{X=$()}finally{T$.pop(),n0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function kX($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function bX($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11646
11646
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
11647
11647
  (function() {
11648
11648
  // Watch implementation for ${J}
@@ -11654,9 +11654,9 @@ else {
11654
11654
  }
11655
11655
  })();
11656
11656
  </script>
11657
- `})}function P1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>P1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(P1(Q),P1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(P1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=P1($[Y]);return Z}function kX($,Z=100){let Y=Z5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return f5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function SX($,Z=100){let Y=Z5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return f5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var n0=null,A4,x5,BB;var yX=b(()=>{A4=[],x5=new WeakMap;BB={ref:Z5,computed:f5,watch:TX,watchMultiple:MX,watchEffect:IX,isRef:B1,unref:RX,toRefs:AX,shallowRef:NX,debouncedComputed:kX,throttledComputed:SX,processComputedDirectives:DX,processWatchDirectives:EX}});var xX={};n(xX,{v:()=>_B,processHasErrorsDirective:()=>vX,processFormValidationDirectives:()=>HB,processErrorsDirective:()=>CX,processErrorDirective:()=>PX,defineForm:()=>jB,Validator:()=>Y5});class Y5{rules=[];defaultValue="";addRule($){let Z=new Y5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new Y5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new Y5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function jB($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let R of Y)J[R]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function PX($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
11658
- `)}catch{return""}})}function CX($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
11659
- `)}catch{return""}})}function vX($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function HB($,Z,Y){let X=$;return X=PX(X,Z,Y),X=CX(X,Z,Y),X=vX(X,Z,Y),X}var _B;var fX=b(()=>{_B=new Y5});var dX={};n(dX,{processXElementDirectives:()=>OB,hasXElementDirectives:()=>hX,generateXElementRuntime:()=>gX});function gX(){return`<script data-stx-scoped>
11657
+ `})}function C1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>C1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(C1(Q),C1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(C1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=C1($[Y]);return Z}function SX($,Z=100){let Y=X5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return g5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function yX($,Z=100){let Y=X5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return g5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var n0=null,T$,f5,jB;var CX=S(()=>{T$=[],f5=new WeakMap;jB={ref:X5,computed:g5,watch:IX,watchMultiple:DX,watchEffect:EX,isRef:_1,unref:NX,toRefs:TX,shallowRef:MX,debouncedComputed:SX,throttledComputed:yX,processComputedDirectives:kX,processWatchDirectives:bX}});var gX={};o(gX,{v:()=>HB,processHasErrorsDirective:()=>fX,processFormValidationDirectives:()=>LB,processErrorsDirective:()=>xX,processErrorDirective:()=>vX,defineForm:()=>OB,Validator:()=>J5});class J5{rules=[];defaultValue="";addRule($){let Z=new J5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new J5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new J5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function OB($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let R of Y)J[R]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function vX($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
11658
+ `)}catch{return""}})}function xX($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
11659
+ `)}catch{return""}})}function fX($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function LB($,Z,Y){let X=$;return X=vX(X,Z,Y),X=xX(X,Z,Y),X=fX(X,Z,Y),X}var HB;var hX=S(()=>{HB=new J5});var uX={};o(uX,{processXElementDirectives:()=>FB,hasXElementDirectives:()=>mX,generateXElementRuntime:()=>dX});function dX(){return`<script data-stx-scoped>
11660
11660
  (function() {
11661
11661
  'use strict';
11662
11662
 
@@ -11940,42 +11940,42 @@ else {
11940
11940
  // Expose for manual initialization
11941
11941
  window.XElement = XElement;
11942
11942
  })();
11943
- </script>`}function hX($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function OB($){if(!hX($))return $;let Z=gX(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
11943
+ </script>`}function mX($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function FB($){if(!mX($))return $;let Z=dX(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
11944
11944
  `+$.slice(Y);return $+`
11945
- `+Z}var mX={};n(mX,{rewriteImagesWithSiblings:()=>VB});import e0 from"path";async function VB($,Z){let Y=Z.formats??FB;if(!Z.publicDir)return $;let X=AB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(NB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await wB(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${TB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function wB($,Z,Y){if(!RB($))return[];let X=e0.extname($).toLowerCase();if(!LB.has(X))return[];if(!$.startsWith("/"))return[];let Q=e0.join(Z,$.slice(1)),J=e0.dirname(Q),G=e0.basename(Q,X),K=e0.resolve(J),q=e0.resolve(Z);if(!K.startsWith(q))return[];let W=e0.posix.dirname($),U=Y.map(async(B)=>{let _=e0.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:e0.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function RB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function AB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function NB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function TB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var LB,FB;var uX=b(()=>{LB=new Set([".jpg",".jpeg",".png",".gif"]),FB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var cX={};n(cX,{validateClientScript:()=>w4,processOnceDirective:()=>V4,processJsonDirective:()=>F4,processDirectives:()=>F0,injectRouterScript:()=>FY});import k0 from"path";import{deriveLayoutGroup as MB}from"stx-router/layout-metadata";function lX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function IB($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[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<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
11945
+ `+Z}var lX={};o(lX,{rewriteImagesWithSiblings:()=>RB});import e0 from"path";async function RB($,Z){let Y=Z.formats??wB;if(!Z.publicDir)return $;let X=TB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(MB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await AB(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${IB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function AB($,Z,Y){if(!NB($))return[];let X=e0.extname($).toLowerCase();if(!VB.has(X))return[];if(!$.startsWith("/"))return[];let Q=e0.join(Z,$.slice(1)),J=e0.dirname(Q),G=e0.basename(Q,X),K=e0.resolve(J),q=e0.resolve(Z);if(!K.startsWith(q))return[];let W=e0.posix.dirname($),U=Y.map(async(B)=>{let _=e0.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:e0.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function NB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function TB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function MB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function IB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var VB,wB;var pX=S(()=>{VB=new Set([".jpg",".jpeg",".png",".gif"]),wB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var nX={};o(nX,{validateClientScript:()=>A$,processOnceDirective:()=>R$,processJsonDirective:()=>w$,processDirectives:()=>F0,injectRouterScript:()=>wY});import k0 from"path";import{deriveLayoutGroup as DB}from"stx-router/layout-metadata";function cX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function EB($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[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<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
11946
11946
  `,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,W=!1;while(q<Y){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
11947
11947
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
11948
- `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}async function F0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!R5()&&!k$())&&Y&&Y.endsWith(".stx"))Q3($,Y);try{return await _9.timeAsync("template-processing",async()=>{let G=await DB($,Z,Y,X,Q);if(J)G=Z6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??H5(),U=(Z.__stx_head_raw||"").trim(),z,B=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),U=U.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
11949
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=m3(G);if(G=UY(G,H),L)G=qY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=MB(V);G=G.replace("<head>",`<head>
11950
- <meta name="stx-layout" content="${lX(V)}">
11951
- <meta name="stx-layout-group" content="${lX(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=KY(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (xY(),vY)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=G.indexOf("<script data-stx-scoped>");if(z!==-1){let B=G.indexOf("</script>",z+24);if(B!==-1){let _=B+9;G=G.slice(0,_)+`
11952
- `+U+G.slice(_)}}}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await JZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof P$)throw G;let K=G instanceof Error?G.message:String(G),q=new M1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(d0.log(q,{filePath:Y,context:Z}),y7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return S7.createFallbackContent("Template Processing",q)}}async function DB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!k0.isAbsolute(X.partialsDir)?k0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!k0.isAbsolute(X.componentsDir)?k0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!k0.isAbsolute(X.layoutsDir)?k0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await SB(Y,Z),kB(Z,K),q=await c1(()=>i2(q,Z,Y,K),q,(O)=>{d0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=z5(q,X9,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=XY(q),q=await SY(q,Y,Q);let _={};q=g3(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",R=k0.dirname(Y),A=K.layoutsDir?k0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=k0.join(R,"_layout.stx");if(await c(T)){w=T;break}let M=k0.dirname(R);if(M===R||M.length<A.length)break;R=M}if(w)H=w;else if(K.layoutsDir){let N=k0.isAbsolute(K.layoutsDir)?K.layoutsDir:k0.resolve(process.cwd(),K.layoutsDir),T=k0.join(N,`${K.defaultLayout}.stx`);if(await c(T))H=T}if(H&&!V)q=`@section('content')
11948
+ `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}async function F0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!A5()&&!S4())&&Y&&Y.endsWith(".stx"))q3($,Y);try{return await L9.timeAsync("template-processing",async()=>{let G=await kB($,Z,Y,X,Q);if(J)G=J6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??O5(),U=(Z.__stx_head_raw||"").trim(),z,B=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),U=U.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
11949
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=p3(G);if(G=zY(G,H),L)G=WY(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=DB(V);G=G.replace("<head>",`<head>
11950
+ <meta name="stx-layout" content="${cX(V)}">
11951
+ <meta name="stx-layout-group" content="${cX(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=UY(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (gY(),fY)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=G.indexOf("<script data-stx-scoped>");if(z!==-1){let B=G.indexOf("</script>",z+24);if(B!==-1){let _=B+9;G=G.slice(0,_)+`
11952
+ `+U+G.slice(_)}}}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await GZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof v4)throw G;let K=G instanceof Error?G.message:String(G),q=new I1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(m0.log(q,{filePath:Y,context:Z}),v7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return P7.createFallbackContent("Template Processing",q)}}async function kB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!k0.isAbsolute(X.partialsDir)?k0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!k0.isAbsolute(X.componentsDir)?k0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!k0.isAbsolute(X.layoutsDir)?k0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await yB(Y,Z),SB(Z,K),q=await n1(()=>o2(q,Z,Y,K),q,(O)=>{m0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=B5(q,K9,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>U[Number(w)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=QY(q),q=await yY(q,Y,Q);let _={};q=m3(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",R=k0.dirname(Y),A=K.layoutsDir?k0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=k0.join(R,"_layout.stx");if(await i(T)){w=T;break}let M=k0.dirname(R);if(M===R||M.length<A.length)break;R=M}if(w)H=w;else if(K.layoutsDir){let N=k0.isAbsolute(K.layoutsDir)?K.layoutsDir:k0.resolve(process.cwd(),K.layoutsDir),T=k0.join(N,`${K.defaultLayout}.stx`);if(await i(T))H=T}if(H&&!V)q=`@section('content')
11953
11953
  ${q.trim()}
11954
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let R=$0(w.trim(),Z);if(R===void 0)return O;return j[V]=String(R??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",C1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=h3(q,_),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
11954
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let R=$0(w.trim(),Z);if(R===void 0)return O;return j[V]=String(R??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",v1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=u3(q,_),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
11955
11955
  `);j.content=j.content?`${j.content}
11956
- ${V}`:V,Z.__sections=j}}if(H)try{let O;if(k0.isAbsolute(H))O=H,Q.add(H);else O=await c1(()=>n4(H,Y,G,Q),null,()=>{throw new M1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(d0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new M1(T,Y);return q}let V=await c1(()=>Bun.file(O).text(),"",()=>{throw new M1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,P,k)=>{return T[P]=k.trim(),""});for(let[E,P]of Object.entries(T))if(j[E]&&j[E].includes(C1)){let k=j[E].indexOf(C1);j[E]=j[E].slice(0,k)+P+j[E].slice(k+C1.length)}else if(!j[E])j[E]=P;let I={...Z,__sections:j},D=`@layout('${w[1]}')${M}`;return await F0(D,I,O,G,Q)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=g3(R,_),N={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(C1)){let E=N[M]||"",P=D.indexOf(C1);D=D.slice(0,P)+E+D.slice(P+C1.length)}return D}return I||""}),A=EB(A,j),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),A=h3(A,_),Z.__originalFilePath=Y,q=await pX(A,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
11957
- ${q}`,z(q)}catch(O){return d0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await pX(q,Z,Y,G,Q))}function EB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function kB($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function SB($,Z){await c1(()=>a2($,Z),void 0,(Y)=>{d0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function bB($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (F5(),X$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));d0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function yB($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (c0(),W9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return d0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function pX($,Z,Y,X,Q){let J=$,G=X;if(await bB(J,Z,Y),J=await yB(J,Z,Y),J=await d2(J,Z,Y),J=await m2(J,Z,Y),J=await uZ(J,Z,Y,G),g1(J))J=r3(J,Z),J=t3(J,Z);J=a3(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (J3(),X3));J=K(J,Z),J=C3(J,Z,Y,G),J=await e$(J,Z,Y,G,Q),J=await QY(J,Z,Y,G,Q),J=v6(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => gY);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => dY);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => pY);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => iY);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => nY);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => aY);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => eY);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (QX(),JX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (wX(),VX));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:R,processWatchDirectives:A}=await Promise.resolve().then(() => (yX(),bX));J=R(J,Z,Y),J=A(J,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (fX(),xX));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (O5(),u4));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
11958
- `;if(J=M(J,Z),J=I(J,Z),J=s2(J),J=p7(J,Z),J=dZ(J),J=p2(J),J=await f3(J,Z,Y,G,Q),J=await e$(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=Z6(J),J=k1(J,Z,Y),J=c7(J,Z),J=i7(J,Z),J=i$(J,Z),J=nZ(J,Z),J=oZ(J,Z),J=await IZ(J,Z,Y,G),J=await f9(J,Z,Y),J=await eZ(J,Z,Y,G),J=E6(J,Z,Y,G),J=l8(J,Z,Y,G),J=p8(J,Z,Y),J=c8(J,Z,Y,G),J=fZ(J,Z,Y,G),J=F4(J,Z),J=V4(J),J=yY(J),!G.skipEventDirectives)J=VZ(J,Z,Y);if(J=TZ(J,Z,Y),G.debug){let x=/\bx-data\s*=/.test(J),g=L4($);if(x&&g)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
11956
+ ${V}`:V,Z.__sections=j}}if(H)try{let O;if(k0.isAbsolute(H))O=H,Q.add(H);else O=await n1(()=>r$(H,Y,G,Q),null,()=>{throw new I1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(m0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new I1(T,Y);return q}let V=await n1(()=>Bun.file(O).text(),"",()=>{throw new I1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,b)=>{return T[C]=b.trim(),""});for(let[E,C]of Object.entries(T))if(j[E]&&j[E].includes(v1)){let b=j[E].indexOf(v1);j[E]=j[E].slice(0,b)+C+j[E].slice(b+v1.length)}else if(!j[E])j[E]=C;let I={...Z,__sections:j},D=`@layout('${w[1]}')${M}`;return await F0(D,I,O,G,Q)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=m3(R,_),N={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(v1)){let E=N[M]||"",C=D.indexOf(v1);D=D.slice(0,C)+E+D.slice(C+v1.length)}return D}return I||""}),A=bB(A,j),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),A=u3(A,_),Z.__originalFilePath=Y,q=await iX(A,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
11957
+ ${q}`,z(q)}catch(O){return m0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await iX(q,Z,Y,G,Q))}function bB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function SB($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function yB($,Z){await n1(()=>e2($,Z),void 0,(Y)=>{m0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function PB($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (V5(),Q4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));m0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function CB($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (c0(),j9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return m0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function iX($,Z,Y,X,Q){let J=$,G=X;if(await PB(J,Z,Y),J=await CB(J,Z,Y),J=await u2(J,Z,Y),J=await l2(J,Z,Y),J=await pZ(J,Z,Y,G),d1(J))J=e3(J,Z),J=Z6(J,Z);J=$6(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (K3(),G3));J=K(J,Z),J=f3(J,Z,Y,G),J=await Z$(J,Z,Y,G,Q),J=await KY(J,Z,Y,G,Q),J=h6(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => dY);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => uY);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => iY);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => oY);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => sY);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => eY);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => ZX);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (KX(),GX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (AX(),RX));J=V(J,Z,Y),J=w(J);let{processComputedDirectives:R,processWatchDirectives:A}=await Promise.resolve().then(() => (CX(),PX));J=R(J,Z,Y),J=A(J,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (hX(),gX));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (L5(),l$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
11958
+ `;if(J=M(J,Z),J=I(J,Z),J=a2(J),J=n7(J,Z),J=uZ(J),J=i2(J),J=await d3(J,Z,Y,G,Q),J=await Z$(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=J6(J),J=b1(J,Z,Y),J=o7(J,Z),J=s7(J,Z),J=o4(J,Z),J=sZ(J,Z),J=rZ(J,Z),J=await EZ(J,Z,Y,G),J=await h9(J,Z,Y),J=await Z2(J,Z,Y,G),J=y6(J,Z,Y,G),J=c8(J,Z,Y,G),J=i8(J,Z,Y),J=n8(J,Z,Y,G),J=hZ(J,Z,Y,G),J=w$(J,Z),J=R$(J),J=CY(J),!G.skipEventDirectives)J=RZ(J,Z,Y);if(J=IZ(J,Z,Y),G.debug){let y=/\bx-data\s*=/.test(J),x=V$($);if(y&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
11959
11959
  Both work on the same page, but they manage separate scopes.
11960
- Prefer signals (state/derived/effect) for new components.`)}J=$Y(J,Z),J=await p0(J,Z,Y),J=PY(J),J=CY(J),J=WZ(J);let{processXElementDirectives:P}=await Promise.resolve().then(() => dX);J=P(J);let k=Z.__originalFilePath||Y,y=q5(Z);if(J=await e3(J,G,k,y),J=await n2(J,Z,Y,G),G.media?.image?.autoSiblings){let x=G.publicDir||"public",{rewriteImagesWithSiblings:g}=await Promise.resolve().then(() => (uX(),mX));J=await g(J,{publicDir:x})}if(G.seo?.enabled)J=i8(J,Z,G);let C=(x,g)=>{if(!g)return x;if(/<\/head>/i.test(x))return x.replace(/<\/head>/i,`${g}
11961
- </head>`);if(/<head\b[^>]*>/i.test(x))return x.replace(/(<head\b[^>]*>)/i,`$1
11962
- ${g}`);if(/<html\b[^>]*>/i.test(x))return x.replace(/(<html\b[^>]*>)/i,`$1
11960
+ Prefer signals (state/derived/effect) for new components.`)}J=YY(J,Z),J=await p0(J,Z,Y),J=vY(J),J=xY(J),J=BZ(J);let{processXElementDirectives:C}=await Promise.resolve().then(() => uX);J=C(J);let b=Z.__originalFilePath||Y,k=U5(Z);if(J=await Y6(J,G,b,k),J=await s2(J,Z,Y,G),G.media?.image?.autoSiblings){let y=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (pX(),lX));J=await x(J,{publicDir:y})}if(G.seo?.enabled)J=o8(J,Z,G);let P=(y,x)=>{if(!x)return y;if(/<\/head>/i.test(y))return y.replace(/<\/head>/i,`${x}
11961
+ </head>`);if(/<head\b[^>]*>/i.test(y))return y.replace(/(<head\b[^>]*>)/i,`$1
11962
+ ${x}`);if(/<html\b[^>]*>/i.test(y))return y.replace(/(<html\b[^>]*>)/i,`$1
11963
11963
  <head>
11964
- ${g}
11965
- </head>`);return x},{renderHead:d,getHead:f}=await Promise.resolve().then(() => (O5(),u4)),m=Z.__stx_runtime_head,o=m&&(m.title||m.meta?.length||m.link?.length)?m:f();if(o.title||o.meta?.length||o.link?.length){let x=d(o);if(x)J=C(J,x)}if(E.headContent)J=C(J,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)J=xZ(J,G.csp,Z);if(G.analytics?.enabled)J=BZ(J,G);if(G.heatmap?.enabled)J=d6(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:x}=await Promise.resolve().then(() => (c5(),M6));J=x(J,G)}let R0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),o0=/\bSTX\.\w+/.test(J),S0=/window\.STX\s*=/.test(J);if(R0&&o0&&!S0){let g=`<script data-stx-scoped>
11966
- ${GZ()}
11967
- </script>`;if(J.includes("</head>")){let u=J.indexOf("</head>"),G0=J.slice(0,u).indexOf("<script");if(G0!==-1){let A0=J.slice(0,G0),b0=J.slice(G0);J=A0+g+`
11968
- `+b0}else J=J.replace("</head>",`${g}
11964
+ ${x}
11965
+ </head>`);return y},{renderHead:d,getHead:g}=await Promise.resolve().then(() => (L5(),l$)),m=Z.__stx_runtime_head,s=m&&(m.title||m.meta?.length||m.link?.length)?m:g();if(s.title||s.meta?.length||s.link?.length){let y=d(s);if(y)J=P(J,y)}if(E.headContent)J=P(J,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)J=gZ(J,G.csp,Z);if(G.analytics?.enabled)J=jZ(J,G);if(G.heatmap?.enabled)J=p6(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:y}=await Promise.resolve().then(() => (n5(),k6));J=y(J,G)}let Z0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),o0=/\bSTX\.\w+/.test(J),P0=/window\.STX\s*=/.test(J);if(Z0&&o0&&!P0){let x=`<script data-stx-scoped>
11966
+ ${qZ()}
11967
+ </script>`;if(J.includes("</head>")){let u=J.indexOf("</head>"),Y0=J.slice(0,u).indexOf("<script");if(Y0!==-1){let q0=J.slice(0,Y0),I0=J.slice(Y0);J=q0+x+`
11968
+ `+I0}else J=J.replace("</head>",`${x}
11969
11969
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
11970
- ${g}`);else J=g+`
11971
- `+J}{let x=/<script\s+server\b[^>]*>/gi,g,u=[];while((g=x.exec(J))!==null){let s=g.index+g[0].length,G0=IB(J,s);if(G0===-1)continue;let A0=G0+9;while(A0<J.length&&/\s/.test(J[A0]))A0++;u.push({start:g.index,end:A0}),x.lastIndex=A0}for(let s=u.length-1;s>=0;s--){let{start:G0,end:A0}=u[s];J=J.substring(0,G0)+J.substring(A0)}}let I0=$$(J,Y);if(I0.hasScoped)J=I0.html;let e=Z.__stx_event_bindings||[],_0=!1,U0=[],S=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:v}=await Promise.resolve().then(() => ($6(),DY));for(let x of v(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))U0.push({match:x.fullMatch,attrs:x.attrs,content:x.body});for(let{match:x,attrs:g,content:u}of U0){_0=!0;let s=u;w4(u,Y,X.strict);let G0=await U5(u,{eventBindings:e,attrs:g,hasColonDirectives:S,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:y});J=J.replace(x,()=>G0)}if(_0)Z.__stx_event_bindings=[];return J}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";var J$=b(()=>{QZ();e5();b4();KZ();zZ();_Z();C4();y4();wZ();W5();MZ();DZ();l$();gZ();mZ();pZ();t0();O5();c0();sZ();$2();h2();l2();v3();o4();o2();m1();r2();P7();H0();t2();ZY();JY();GY();m4();$6();P3();bY();Y6();X6();L0();G3();Y6();X6()});import fB from"fs";import G6 from"path";import ZJ from"fs";import s0 from"path";var W6=[72,96,128,144,152,192,384,512],z6=[120,152,167,180],B6=[16,32];async function _6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=s0.isAbsolute(X.src)?X.src:s0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=s0.resolve(Z,X.outputDir||"pwa-icons");try{ZJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||W6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
11972
- Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=s0.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=s0.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of z6){let O=s0.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=s0.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of B6){let F=s0.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=s0.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function mB($){let Z=$.sizes||W6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of z6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of B6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function j6(){try{return await import("sharp"),!0}catch{return!1}}c5();function AJ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function NJ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function TJ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function MJ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function IJ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function DJ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:AJ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=NJ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=TJ($);if(W)q.share_target=W;let U=MJ($);if(U)q.file_handlers=U;let z=IJ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function I6($){let Z=DJ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function aB($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function tB($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import iX from"path";async function nX($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=iX.isAbsolute(Z.page)?Z.page:iX.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (J$(),cX)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return PB($)}function PB($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
11970
+ ${x}`);else J=x+`
11971
+ `+J}{let y=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=y.exec(J))!==null){let l=x.index+x[0].length,Y0=EB(J,l);if(Y0===-1)continue;let q0=Y0+9;while(q0<J.length&&/\s/.test(J[q0]))q0++;u.push({start:x.index,end:q0}),y.lastIndex=q0}for(let l=u.length-1;l>=0;l--){let{start:Y0,end:q0}=u[l];J=J.substring(0,Y0)+J.substring(q0)}}let T0=Y4(J,Y);if(T0.hasScoped)J=T0.html;let e=Z.__stx_event_bindings||[],M0=!1,C0=[],v=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:f}=await Promise.resolve().then(() => (X6(),kY));for(let y of f(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))C0.push({match:y.fullMatch,attrs:y.attrs,content:y.body});for(let{match:y,attrs:x,content:u}of C0){M0=!0;let l=u;A$(u,Y,X.strict);let Y0=await W5(u,{eventBindings:e,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:k});J=J.replace(y,()=>Y0)}if(M0)Z.__stx_event_bindings=[];return J}var v1="<!--PARENT_CONTENT_PLACEHOLDER-->";var G4=S(()=>{KZ();Z4();y$();UZ();_Z();HZ();v$();P$();AZ();z5();DZ();kZ();c4();dZ();lZ();iZ();t0();L5();c0();aZ();Y2();m2();c2();g3();a$();r2();l1();t2();x7();H0();$Y();XY();GY();qY();u$();X6();x3();PY();Q6();G6();L0();U3();Q6();G6()});import hB from"fs";import U6 from"path";import XJ from"fs";import s0 from"path";var j6=[72,96,128,144,152,192,384,512],H6=[120,152,167,180],O6=[16,32];async function L6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=s0.isAbsolute(X.src)?X.src:s0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=s0.resolve(Z,X.outputDir||"pwa-icons");try{XJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||j6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
11972
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=s0.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=s0.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of H6){let O=s0.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=s0.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of O6){let F=s0.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=s0.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function lB($){let Z=$.sizes||j6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of H6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of O6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function F6(){try{return await import("sharp"),!0}catch{return!1}}n5();function TJ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function MJ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function IJ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function DJ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function EJ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function kJ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:TJ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=MJ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=IJ($);if(W)q.share_target=W;let U=DJ($);if(U)q.file_handlers=U;let z=EJ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function b6($){let Z=kJ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function eB($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function $_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import oX from"path";async function sX($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=oX.isAbsolute(Z.page)?Z.page:oX.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (G4(),nX)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return vB($)}function vB($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
11973
11973
  <html lang="en">
11974
11974
  <head>
11975
11975
  <meta charset="UTF-8">
11976
11976
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
11977
11977
  <meta name="theme-color" content="${J}">
11978
- <title>${N4(X)} - ${N4(G)}</title>
11978
+ <title>${M$(X)} - ${M$(G)}</title>
11979
11979
  <style>
11980
11980
  :root {
11981
11981
  --theme-color: ${J};
@@ -12145,8 +12145,8 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
12145
12145
  <circle cx="12" cy="20" r="1"/>
12146
12146
  </svg>
12147
12147
 
12148
- <h1>${N4(X)}</h1>
12149
- <p>${N4(Q)}</p>
12148
+ <h1>${M$(X)}</h1>
12149
+ <p>${M$(Q)}</p>
12150
12150
 
12151
12151
  <button class="retry-btn" onclick="window.location.reload()">
12152
12152
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -12202,9 +12202,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
12202
12202
  }, 5000);
12203
12203
  </script>
12204
12204
  </body>
12205
- </html>`}function N4($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}J5();Q5();import v1 from"fs";import T4 from"path";function CB($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function vB($){let Z=[],Y=T4.join($,"manifest.json"),X=v1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(v1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=T4.join($,"sw.js"),J=v1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=T4.join($,"offline.html"),K=v1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=T4.join($,"pwa-icons");if(v1.existsSync(q)){let U=v1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function xB($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function iw($,Z){let Y=CB($),X=Z&&v1.existsSync(Z)?vB(Z):[];return xB([...Y,...X])}function nw($){let Z=[];Z.push(`
12205
+ </html>`}function M$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}Q5();G5();import x1 from"fs";import I$ from"path";function xB($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function fB($){let Z=[],Y=I$.join($,"manifest.json"),X=x1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(x1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=I$.join($,"sw.js"),J=x1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=I$.join($,"offline.html"),K=x1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=I$.join($,"pwa-icons");if(x1.existsSync(q)){let U=x1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function gB($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function ow($,Z){let Y=xB($),X=Z&&x1.existsSync(Z)?fB(Z):[];return gB([...Y,...X])}function sw($){let Z=[];Z.push(`
12206
12206
  === PWA Audit Report ===
12207
12207
  `);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
12208
12208
  `);let X=["required","recommended","optional"];for(let Q of X){let J=$.checks.filter((G)=>G.category===Q);if(J.length===0)continue;Z.push(`
12209
12209
  ${Q.toUpperCase()}:`);for(let G of J){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${G.name}: ${G.message}`),G.details)Z.push(` ${G.details}`)}}return Z.push(""),Z.join(`
12210
- `)}D7();c5();J5();Q5();async function XR($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{fB.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=I6($);if(J){let G=G6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await j6()){let G=await _6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await nX($);if(J){let G=G6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=H1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=l5($,Z);if(J){let G=x1($),K=G6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function JR($,Z){return S4($,Z)}function QR($){return $.pwa?.enabled===!0}export{tB as validateManifest,iw as runPwaAudit,OH as registerPwaDirectives,RK as pwaUpdateDirective,NK as pwaPushDirective,AK as pwaOfflineDirective,wK as pwaInstallDirective,I7 as pwaDirectives,JR as processPwaHtml,aB as mergeManifestConfig,T6 as isWorkboxEnabled,j6 as isSharpAvailable,QR as isPwaEnabled,S4 as injectPwaTags,x1 as getServiceWorkerFileName,mB as getExpectedIconPaths,RJ as generateThemeColorMeta,VJ as generateSwRegistrationScript,FJ as generateServiceWorkerAuto,l5 as generateServiceWorker,p5 as generatePwaTags,_6 as generatePwaIcons,u5 as generatePrecacheManifestJs,H1 as generatePrecacheManifest,nX as generateOfflinePage,wJ as generateManifestLink,I6 as generateManifestJson,DJ as generateManifest,O6 as formatSize,nw as formatAuditResult,xB as calculateAuditResult,XR as buildPwaAssets,CB as auditConfig,vB as auditBuildOutput,B6 as FAVICON_SIZES,W6 as DEFAULT_ICON_SIZES,z6 as APPLE_TOUCH_ICON_SIZES};
12210
+ `)}b7();n5();Q5();G5();async function QR($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{hB.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=b6($);if(J){let G=U6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await F6()){let G=await L6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await sX($);if(J){let G=U6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=O1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=c5($,Z);if(J){let G=g1($),K=U6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function GR($,Z){return S$($,Z)}function KR($){return $.pwa?.enabled===!0}export{$_ as validateManifest,ow as runPwaAudit,FH as registerPwaDirectives,NK as pwaUpdateDirective,MK as pwaPushDirective,TK as pwaOfflineDirective,AK as pwaInstallDirective,k7 as pwaDirectives,GR as processPwaHtml,eB as mergeManifestConfig,E6 as isWorkboxEnabled,F6 as isSharpAvailable,KR as isPwaEnabled,S$ as injectPwaTags,g1 as getServiceWorkerFileName,lB as getExpectedIconPaths,NJ as generateThemeColorMeta,RJ as generateSwRegistrationScript,wJ as generateServiceWorkerAuto,c5 as generateServiceWorker,i5 as generatePwaTags,L6 as generatePwaIcons,p5 as generatePrecacheManifestJs,O1 as generatePrecacheManifest,sX as generateOfflinePage,AJ as generateManifestLink,b6 as generateManifestJson,kJ as generateManifest,w6 as formatSize,sw as formatAuditResult,gB as calculateAuditResult,QR as buildPwaAssets,xB as auditConfig,fB as auditBuildOutput,O6 as FAVICON_SIZES,j6 as DEFAULT_ICON_SIZES,H6 as APPLE_TOUCH_ICON_SIZES};