@stacksjs/stx 0.2.158 → 0.2.159

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pwa.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var{defineProperty:m7,getOwnPropertyNames:WK,getOwnPropertyDescriptor:zK}=Object,UK=Object.prototype.hasOwnProperty;function jK($){return this[$]}var t9=($)=>{var Z=(a9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=m7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of WK($))if(!UK.call(Z,X))m7(Z,X,{get:jK.bind($,X),enumerable:!(Y=zK($,X))||Y.enumerable})}return a9.set($,Z),Z},a9;var BK=($)=>$;function HK($,Z){this[$]=BK.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)m7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:HK.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var q0=import.meta.require;import x$ from"fs";import f$ from"path";function FK($){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 LK($,Z){let Y=f$.basename($);for(let X of Z)if(X.startsWith("*.")){let J=X.slice(1);if(Y.endsWith(J))return!0}else if(X.includes("*")){let J=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(J.test(Y)||J.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function VK($,Z,Y){let X=f$.extname($).toLowerCase(),J=OK[X],Q=(Y.maxFileSizeKB||500)*1024;if(Z>Q)return!1;if(Y.exclude&&LK($,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(J&&Y[J]===!0)return!0;if(!J)return!1;return!1}function J8($,Z,Y,X){let J=x$.readdirSync($,{withFileTypes:!0});for(let Q of J){let G=f$.join($,Q.name);if(Q.isDirectory()){if(["node_modules",".git",".stx"].includes(Q.name))continue;J8(G,Z,Y,X)}else if(Q.isFile()){let K=x$.statSync(G),q=f$.relative(Z,G);if(VK(q,K.size,Y)){let W=x$.readFileSync(G),z=FK(W),U=`/${q.replace(/\\/g,"/")}`;X.push({url:U,revision:z,size:K.size})}}}}function f1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!x$.existsSync($))return{entries:[],totalSize:0,fileCount:0};J8($,$,Y,X),X.sort((Q,G)=>Q.url.localeCompare(G.url));let J=X.reduce((Q,G)=>Q+G.size,0);return{entries:X,totalSize:J,fileCount:X.length}}function g$($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:m7,getOwnPropertyNames:WK,getOwnPropertyDescriptor:zK}=Object,UK=Object.prototype.hasOwnProperty;function jK($){return this[$]}var t9=($)=>{var Z=(a9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=m7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of WK($))if(!UK.call(Z,X))m7(Z,X,{get:jK.bind($,X),enumerable:!(Y=zK($,X))||Y.enumerable})}return a9.set($,Z),Z},a9;var BK=($)=>$;function HK($,Z){this[$]=BK.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)m7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:HK.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var W0=import.meta.require;import x$ from"fs";import f$ from"path";function FK($){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 LK($,Z){let Y=f$.basename($);for(let X of Z)if(X.startsWith("*.")){let J=X.slice(1);if(Y.endsWith(J))return!0}else if(X.includes("*")){let J=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(J.test(Y)||J.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function VK($,Z,Y){let X=f$.extname($).toLowerCase(),J=OK[X],Q=(Y.maxFileSizeKB||500)*1024;if(Z>Q)return!1;if(Y.exclude&&LK($,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(J&&Y[J]===!0)return!0;if(!J)return!1;return!1}function J8($,Z,Y,X){let J=x$.readdirSync($,{withFileTypes:!0});for(let Q of J){let G=f$.join($,Q.name);if(Q.isDirectory()){if(["node_modules",".git",".stx"].includes(Q.name))continue;J8(G,Z,Y,X)}else if(Q.isFile()){let K=x$.statSync(G),q=f$.relative(Z,G);if(VK(q,K.size,Y)){let W=x$.readFileSync(G),z=FK(W),U=`/${q.replace(/\\/g,"/")}`;X.push({url:U,revision:z,size:K.size})}}}}function f1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!x$.existsSync($))return{entries:[],totalSize:0,fileCount:0};J8($,$,Y,X),X.sort((Q,G)=>Q.url.localeCompare(G.url));let J=X.reduce((Q,G)=>Q+G.size,0);return{entries:X,totalSize:J,fileCount:X.length}}function g$($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
5
  ]`}function Q8($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var OK;var p5=b(()=>{OK={".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 wK($){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 d7($){return wK($).className}function G8($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,J=[];for(let Q of Y){let G=d7(Q.strategy),K=[];if(Q.maxAgeSeconds||Q.maxEntries||X?.maxEntries){let W=Q.maxEntries||X?.maxEntries||100,z=Q.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
@@ -1828,7 +1828,7 @@ ${_}
1828
1828
  `:`
1829
1829
  `)}</p>`);if(J=K.join(`
1830
1830
  `),X)J=J.replace(/\n/g,`<br />
1831
- `);for(let z=0;z<Q.length;z++)J=J.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function B5($="const",Z=[],Y){let X=Z.length?W1.filter((J)=>!Z.includes(J)):W1;if(Y!==void 0)X=X.filter((J)=>{let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}function s7($){if(!$)return!1;return eK.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function r7($){if(!$)return!1;let Z=u8($);if($q.some((Y)=>Y.test(Z)))return!0;return s7(Z)}function g8($){if(!$)return!1;return Zq.test(u8($))||r7($)}function d8(){return`{${h8.map(($)=>`'${$}':1`).join(",")}}`}function u8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(X,J,Q)=>J??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var W1,f8,tK,eK,$q,Zq,h8,Yq,m8;var e0=b(()=>{W1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],f8=["onMount","onDestroy"];tK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],eK=W1.filter(($)=>!tK.includes($));$q=[/@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*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],Zq=/\s@[a-z][\w.:-]*\s*=/i;h8=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],Yq=["x-init","x-transition","x-effect","x-on"],m8=[...h8,...Yq]});function c8($){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(Xq.has(X))Z.systemKeys.push(X);else if(X in i8)Z.mouse=X;else if(X in l8||/^[a-z]$/.test(X))Z.keys.push(l8[X]||X.toUpperCase());else if(X.startsWith("debounce")){let J=X.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(X.startsWith("throttle")){let J=X.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function n8($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=X.exec($))!==null){let[Q,G,K]=J,q=J.index,W=q+Q.length,z=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function Jq($){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((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=i8[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 Qq($,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 a7($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function Gq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Jq($),J=Qq(a7($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
1831
+ `);for(let z=0;z<Q.length;z++)J=J.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function B5($="const",Z=[],Y){let X=Z.length?W1.filter((J)=>!Z.includes(J)):W1;if(Y!==void 0)X=X.filter((J)=>{let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}function s7($){if(!$)return!1;return eK.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function r7($){if(!$)return!1;let Z=u8($);if($q.some((Y)=>Y.test(Z)))return!0;return s7(Z)}function g8($){if(!$)return!1;return Zq.test(u8($))||r7($)}function d8(){return`{${h8.map(($)=>`'${$}':1`).join(",")}}`}function u8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(X,J,Q)=>J??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var W1,f8,tK,eK,$q,Zq,h8,Yq,m8;var $1=b(()=>{W1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],f8=["onMount","onDestroy"];tK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],eK=W1.filter(($)=>!tK.includes($));$q=[/@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*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],Zq=/\s@[a-z][\w.:-]*\s*=/i;h8=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],Yq=["x-init","x-transition","x-effect","x-on"],m8=[...h8,...Yq]});function c8($){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(Xq.has(X))Z.systemKeys.push(X);else if(X in i8)Z.mouse=X;else if(X in l8||/^[a-z]$/.test(X))Z.keys.push(l8[X]||X.toUpperCase());else if(X.startsWith("debounce")){let J=X.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(X.startsWith("throttle")){let J=X.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function n8($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=X.exec($))!==null){let[Q,G,K]=J,q=J.index,W=q+Q.length,z=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function Jq($){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((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=i8[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 Qq($,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 a7($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function Gq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Jq($),J=Qq(a7($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
1832
1832
  (function() {
1833
1833
  var $el = document.getElementById('${Y}');
1834
1834
  if (!$el) return;
@@ -1941,9 +1941,9 @@ else {
1941
1941
  `)}
1942
1942
  })();
1943
1943
  </script>`}function Kq($){let Z=n8($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let J=Z.length-1;J>=0;J--){let Q=Z[J],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of Q.events)q.elementId=K[1]}for(let K of Q.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(z,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),X.push(...Q.events)}return{template:Y,bindings:X}}function o8($,Z,Y){if(r7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:q}=Kq($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...q],K}let X=n8($);if(X.length===0)return $;let J=$;for(let K=X.length-1;K>=0;K--){let q=X[K],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let U of q.events)U.elementId=z[1]}for(let z of q.events){let U=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");W=W.replace(j,""),W=W.replace(H,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let Q=t7(X.flatMap((K)=>K.events)),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
1944
- `+J.slice(G);else J+=Q;return J}var p8,l8,Xq,i8;var e7=b(()=>{e0();p8=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"]),l8={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"},Xq=new Set(["ctrl","alt","shift","meta"]),i8={left:0,middle:1,right:2}});function x0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1944
+ `+J.slice(G);else J+=Q;return J}var p8,l8,Xq,i8;var e7=b(()=>{$1();p8=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"]),l8={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"},Xq=new Set(["ctrl","alt","shift","meta"]),i8={left:0,middle:1,right:2}});function x0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1945
1945
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1946
- `}),$}function p$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function qq(){let $=globalThis;return $[s8]??=new Map,$[s8]}function a($,Z){let Y=qq(),X=`${import.meta.url}\x00${$}`,J=Y.get(X);if(J)return J;let Q=Z();return Y.set(X,Q),Q.catch(()=>{if(Y.get(X)===Q)Y.delete(X)}),Q}var s8;var r5=b(()=>{s8=Symbol.for("stx.lazy-module-promises")});function H5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Wq,"<\\/$1")}var Wq;var $3=b(()=>{Wq=/<\/(script)/gi});import zq from"process";function y0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(zq.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}var V1=()=>{};function Uq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function jq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function Z3($,Z){let Y=[];for(let X of jq($)){if(Uq(X)){let J=X.position||void 0;Y.push({file:Z||J?.file,line:J?.line,column:J?.column,message:X.message??"",lineText:J?.lineText});continue}Y.push({file:Z,message:X instanceof Error?X.message:String(X)})}return Y}function r8($,Z){return Z3($,Z).map((Y)=>{let X=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",J=Y.lineText?`
1946
+ `}),$}function p$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function qq(){let $=globalThis;return $[s8]??=new Map,$[s8]}function t($,Z){let Y=qq(),X=`${import.meta.url}\x00${$}`,J=Y.get(X);if(J)return J;let Q=Z();return Y.set(X,Q),Q.catch(()=>{if(Y.get(X)===Q)Y.delete(X)}),Q}var s8;var r5=b(()=>{s8=Symbol.for("stx.lazy-module-promises")});function H5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Wq,"<\\/$1")}var Wq;var $3=b(()=>{Wq=/<\/(script)/gi});import zq from"process";function y0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(zq.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}var V1=()=>{};function Uq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function jq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function Z3($,Z){let Y=[];for(let X of jq($)){if(Uq(X)){let J=X.position||void 0;Y.push({file:Z||J?.file,line:J?.line,column:J?.column,message:X.message??"",lineText:J?.lineText});continue}Y.push({file:Z,message:X instanceof Error?X.message:String(X)})}return Y}function r8($,Z){return Z3($,Z).map((Y)=>{let X=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",J=Y.lineText?`
1947
1947
  ${Y.lineText.trim()}`:"";return X?`${X}: ${Y.message}${J}`:`${Y.message}${J}`}).join(`
1948
1948
  `)}var a5={};o(a5,{shouldLogBundlerDiagnostics:()=>$Z,setBundlerFallbackMode:()=>Oq,resolveBundlerFallback:()=>YZ,recordBundleFailure:()=>ZZ,queueClientBundleBuild:()=>XZ,hasUserImports:()=>Fq,getBundleFailures:()=>Hq,clearBundleFailures:()=>_q,bundleClientScript:()=>Vq});import _0 from"path";import P0 from"fs";function $Z($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function g1(...$){if($Z())console.log("[stx:bundler]",...$)}function ZZ($,Z,Y){J3.push({filePath:$||"<inline>",message:Z,details:Y})}function Hq(){return J3.slice()}function _q(){J3.length=0}function Oq($){X3=$}function YZ(){if(X3)return X3;try{return e5.strict?.bundlerFallback??"warn"}catch{return"warn"}}function Fq($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(!a8.some((G)=>G.test(J)))return g1("detected user import:",J),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let J=Y[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!a8.some((G)=>G.test(J)))return g1("detected side-effect import:",J),!0}return!1}function Lq($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:_0.dirname(Q),q=_0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,_0.join(q,"index.ts"),_0.join(q,"index.tsx"),_0.join(q,"index.js"),_0.join(q,"index.mjs")];for(let z of W)try{if(P0.existsSync(z)&&P0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(P0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=_0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,_0.join(K,"index.ts"),_0.join(K,"index.tsx"),_0.join(K,"index.js"),_0.join(K,"index.mjs")];for(let W of q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return g1(`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}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=_0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:P0.readFileSync(G.path,"utf8"),loader:q}})}}}function XZ($){let Z=globalThis,X=(Z[t8]??Promise.resolve()).then($,$);return Z[t8]=X.then(()=>{return},()=>{return}),X}async function Vq($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||n5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${Bq}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=_0.join(Q,`${K}.js`),W=_0.join(Q,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let H=Bun.file(W),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==e8||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(P0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return g1("cache hit:",K),await z.text();g1("cache invalidated by dep change:",K)}let U=Y3.get(K);if(U)return await U;let j=XZ(()=>wq($,Z,{projectRoot:X,minify:J,cacheDir:Q,hash:K,cachePath:q,depsPath:W}));Y3.set(K,j);try{return await j}finally{Y3.delete(K)}}async function wq($,Z,Y){let{projectRoot:X,minify:J,cacheDir:Q,hash:G,cachePath:K,depsPath:q}=Y,W=n5(X,"bundle-tmp"),z=_0.join(W,`${G}.ts`),U=_0.join(W,"out",G);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(U,{recursive:!0});let j=_0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let F=H.length>0?`
1949
1949
  export { ${H.join(", ")} }`:"";await Bun.write(z,$+F),g1("bundling:",G,"from:",_0.basename(Z));let L=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:J,plugins:[Lq(X,j,z,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...y0()},root:X});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let y=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){R.push([y[2],y[1]]);continue}let S=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))R.push([S,S])}let N=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let A=`__stxBundle_${G}`,M=R.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),I=R.map(([D])=>`var ${D} = undefined;`).join(`
@@ -2033,7 +2033,7 @@ else {
2033
2033
  // STX: auto-generated event bindings
2034
2034
  ${$.map((Y,X)=>hq(Y,X)).join(`
2035
2035
  `)}`}function GZ($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),J=0,Q=X.length,G=0;while(G<Q){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<Q){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<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
2036
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){J++,G++;continue}if(K==="}"){J--,G++;continue}if(J===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function uq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!dq.has(B))Z.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)X(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function Y$($,Z={}){let Y=$,X="",J=!1,Q=[],G=l$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=c$(G.styles),q=_5(Y);Y=q.code,Q=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:z}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(W(Y))Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let L=UZ(Y);Y=L.code,X=Q3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(X=`${n$(Y,Z.serverData)}${X}`,Y=x0(Y),!J&&m1(Z.attrs||""))Y=d1(Y);let U=mq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
2036
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){J++,G++;continue}if(K==="}"){J--,G++;continue}if(J===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function uq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!dq.has(B))Z.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)X(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function Y$($,Z={}){let Y=$,X="",J=!1,Q=[],G=l$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=c$(G.styles),q=_5(Y);Y=q.code,Q=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:z}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(W(Y))Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let L=UZ(Y);Y=L.code,X=Q3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(X=`${n$(Y,Z.serverData)}${X}`,Y=x0(Y),!J&&m1(Z.attrs||""))Y=d1(Y);let U=mq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
2037
2037
  ${H5(`${X}${Y}
2038
2038
  ${U}`)}
2039
2039
  </script>`}let B=s7($),_=/function __stx_setup_/.test(Y),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(L){let V=L.length>0?`
@@ -2047,7 +2047,7 @@ ${U}${V}`)}
2047
2047
  'use strict';
2048
2048
  ${H5(`${X}${Y}
2049
2049
  ${U}`)}
2050
- })()</script>`}var Rq,KZ,qZ,Dq,vq,QZ,fq,dq;var X$=b(()=>{e7();R0();r5();e0();$3();Rq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;KZ=W1,qZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Dq=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"]);vq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,QZ=new Set;fq={left:0,middle:1,right:2};dq=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"])});import{createHash as pq}from"crypto";function BZ($){let Z=$[o$];return Z instanceof Map?Z:null}function HZ($){$[o$]=new Map}function _Z($,Z){let Y=BZ($);if(!Y)return null;let X=pq("sha256").update(Z).digest("hex").slice(0,16),J=Y.get(X);if(J)J.instances++;else Y.set(X,{body:Z,instances:1});return X}function OZ($,Z){let Y=BZ(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(z,(U,j)=>`(${W.body})(${j});`)}let J=[...Y].filter(([,q])=>q.instances>1);if(J.length===0)return X;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2050
+ })()</script>`}var Rq,KZ,qZ,Dq,vq,QZ,fq,dq;var X$=b(()=>{e7();R0();r5();$1();$3();Rq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;KZ=W1,qZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Dq=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"]);vq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,QZ=new Set;fq={left:0,middle:1,right:2};dq=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"])});import{createHash as pq}from"crypto";function BZ($){let Z=$[o$];return Z instanceof Map?Z:null}function HZ($){$[o$]=new Map}function _Z($,Z){let Y=BZ($);if(!Y)return null;let X=pq("sha256").update(Z).digest("hex").slice(0,16),J=Y.get(X);if(J)J.instances++;else Y.set(X,{body:Z,instances:1});return X}function OZ($,Z){let Y=BZ(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(z,(U,j)=>`(${W.body})(${j});`)}let J=[...Y].filter(([,q])=>q.instances>1);if(J.length===0)return X;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2051
2051
  (function() {
2052
2052
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
2053
2053
  ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
@@ -2056,7 +2056,7 @@ ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.str
2056
2056
  })();
2057
2057
  </script>`,K=X.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
2058
2058
  ${X}`;return`${X.slice(0,K)}${G}
2059
- ${X.slice(K)}`}var o$="__stx_component_client_factories";var G3=()=>{};function nq($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function oq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(cq.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&wZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function sq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!wZ.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function s$($){let Z=$.trim(),Y=nq(Z);oq(Y,Z),sq(Z);for(let X of VZ)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!LZ.allowBracketNotation&&iq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function rq($){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("__")||VZ.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=K3(X);else Z[Y]=X}return Z}function K3($,Z=0){if(Z>=LZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>K3(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=K3(J,Z+1);else Y[X]=J}return Y}function Z0($,Z){try{let Y=rq(Z),X=Object.keys(Y),J=Object.values(Y);return Q0($,X)(...J)}catch{return}}function J0($){try{return s$($),!0}catch{return!1}}function O0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=s$($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!X.test(z))continue;if(RZ.has(z))continue;J.push(W),Q.push(z)}let G=(W)=>Function(...Q,...W,`
2059
+ ${X.slice(K)}`}var o$="__stx_component_client_factories";var G3=()=>{};function nq($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function oq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(cq.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&wZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function sq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!wZ.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function s$($){let Z=$.trim(),Y=nq(Z);oq(Y,Z),sq(Z);for(let X of VZ)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!LZ.allowBracketNotation&&iq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function rq($){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("__")||VZ.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=K3(X);else Z[Y]=X}return Z}function K3($,Z=0){if(Z>=LZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>K3(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=K3(J,Z+1);else Y[X]=J}return Y}function Z0($,Z){try{let Y=rq(Z),X=Object.keys(Y),J=Object.values(Y);return G0($,X)(...J)}catch{return}}function Q0($){try{return s$($),!0}catch{return!1}}function O0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=s$($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!X.test(z))continue;if(RZ.has(z))continue;J.push(W),Q.push(z)}let G=(W)=>Function(...Q,...W,`
2060
2060
  'use strict';
2061
2061
  try {
2062
2062
  return ${Y};
@@ -2067,7 +2067,7 @@ catch (e) {
2067
2067
  }
2068
2068
  throw e;
2069
2069
  }
2070
- `),K=G([]);if(Q.length===Z.length)return FZ(K,Q,G);return FZ((...W)=>{let z=Array(J.length);for(let U=0;U<J.length;U++)z[U]=W[J[U]];return K(...z)},Q,G,(W)=>{K=G(W)})}function FZ($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(q.has(B)||RZ.has(B))return;q.add(B),K.push(B),G=Y(K),X?.(K)}return}}function r$($){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 lq,LZ,VZ,cq,wZ,iq,RZ;var F0=b(()=>{lq={maxSanitizeDepth:10,allowBracketNotation:!1},LZ={...lq},VZ=[/\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/],cq=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"]),wZ=new Set(["__proto__","constructor","prototype"]),iq=/[\w)\]]\s*\[\s*['"]/;RZ=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 a$($,Z){let Y=aq++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return tq.set(X,{type:$,expression:Z}),X}var aq=0,tq;var NZ=b(()=>{tq=new Map});function DZ($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function R1($,Z){return DZ($,Z,AZ,MZ)}function O5($,Z){return DZ($,Z,TZ,IZ)}function J$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function eq($,Z){if($.startsWith("<!--",Z)){let Y=J$($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[AZ,MZ],[TZ,IZ]]){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)continue;X.lastIndex=Y.lastIndex;let Q=X.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function q3($,Z){let Y=[],X=0,J=$.length,Q=!1,G=null;while(X<J){let K=$[X];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=eq($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))Q=!0;X++}return Y}function $1($,Z,Y){let X=q3($,Z);if(X.length===0)return{output:$,tokens:[]};let J=X.map((K)=>K.token),Q="",G=0;for(let K=0;K<X.length;K++){let q=X[K];Q+=$.slice(G,q.start),Q+=Y(q.token,K),G=q.end}return Q+=$.slice(G),{output:Q,tokens:J}}function N1($){let{output:Z,tokens:Y}=$1($,R1,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function Q$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var AZ,MZ,TZ,IZ;var u1=b(()=>{AZ=/<script\b[^>]*>/iy,MZ=/<\/script\s*>/ig,TZ=/<style\b[^>]*>/iy,IZ=/<\/style\s*>/ig});var PZ={};o(PZ,{usesSignalsInScript:()=>z1,unescapeHtml:()=>KW,registerFilters:()=>ZW,registerFilter:()=>bZ,processExpressions:()=>A1,interpolateScriptsInTemplate:()=>XW,interpolateScriptExpressions:()=>t$,getAllFilters:()=>SZ,evaluateExpression:()=>p0,escapeHtml:()=>o0,defaultFilters:()=>K$,clearCustomFilters:()=>YW,applyFilters:()=>yZ});function $W($){let Z=EZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),EZ.set($,Z)}return Z.lastIndex=0,Z}function bZ($,Z){if($ in K$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G$[$]=Z}function ZW($){for(let[Z,Y]of Object.entries($))bZ(Z,Y)}function SZ(){return{...K$,...G$}}function YW(){for(let $ of Object.keys(G$))delete G$[$]}function o0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function z1($){let{scripts:Z}=N1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let J=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))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 kZ($,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,""),J="",Q=!1,G=0;for(let W=0;W<X.length;W++){let z=X[W];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&X[W+1]==="{"){G++,W++,J+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){J+=z;continue}continue}J+=z}X=J;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/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 t$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=p0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=p0(J,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),Y}function XW($,Z,Y={}){let{output:X,scripts:J}=N1($),Q=J.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let j=t$(U,Z);return q[0]+j+G.slice(W)});return Q$(X,Q)}function A1($,Z,Y){let X=$,J=(U,j)=>{let H=O5(U,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,H))?-1:H},Q=(U,j,H,B)=>{let _=H.length,{output:O,tokens:F}=$1(U,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=Z?.__stx_signals_gate===!0||z1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=p0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return W0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,U)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=p0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return a$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return a$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return W0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,U)}}),X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(U,j,H)=>{let B=j.trim();if(z.has(B))return U;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&W.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=B.match(R),A=N&&!_.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=p0(j,Z);if(w)return U;if(q&&!kZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!q)return a$("expr",B);return M!==void 0&&M!==null?o0(String(M)):""}catch(M){if(w)return U;if(q&&!kZ(B,Z))return U;if(A)return U;let I=M instanceof Error?M.message:String(M);return W0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,U)}});for(let U=0;U<K.length;U++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)X=X.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return X}function yZ($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=G$[G]||K$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(SZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,z=1;while(W>0&&z<J.length){if(J[z]==="(")W++;if(J[z]===")")W--;z++}if(W===0){let U=J.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[p0(`(${U})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);q=j.map((V)=>{let w=V.trim();return p0(w,Y,!0)})}}catch{q=[U]}J=J.substring(z).trim()}}try{X=K(X,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function JW($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&J===0&&Q===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function p0($,Z,Y=!1){try{let X=$.trim(),J=JW(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=p0(Q,Z,!0);return yZ(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return Q0(X,Q)(...G)}catch{return Z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=QW(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function QW($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=GW($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}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 GW($,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,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+q)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function KW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var G$,EZ,K$;var Z1=b(()=>{F0();R0();NZ();u1();G$={},EZ=new Map;K$={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 o0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace($W(q),String(W))}),K},t:($,Z,Y={})=>{return K$.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={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 J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},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 J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"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 J=10**Y;return Math.round(X*J)/J}}});class p1{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 L5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!F5.has(Y)){if(F5.size>=qW){let X=F5.keys().next().value;if(X)F5.delete(X)}F5.set(Y,new RegExp($,Z))}return F5.get(Y)}class CZ{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 J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=J.get(W);if(!z){if(J.size>=Q){let U=J.keys().next().value;if(U)J.delete(U)}z=Function(...Z,`
2070
+ `),K=G([]);if(Q.length===Z.length)return FZ(K,Q,G);return FZ((...W)=>{let z=Array(J.length);for(let U=0;U<J.length;U++)z[U]=W[J[U]];return K(...z)},Q,G,(W)=>{K=G(W)})}function FZ($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(q.has(B)||RZ.has(B))return;q.add(B),K.push(B),G=Y(K),X?.(K)}return}}function r$($){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 lq,LZ,VZ,cq,wZ,iq,RZ;var F0=b(()=>{lq={maxSanitizeDepth:10,allowBracketNotation:!1},LZ={...lq},VZ=[/\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/],cq=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"]),wZ=new Set(["__proto__","constructor","prototype"]),iq=/[\w)\]]\s*\[\s*['"]/;RZ=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 a$($,Z){let Y=aq++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return tq.set(X,{type:$,expression:Z}),X}var aq=0,tq;var NZ=b(()=>{tq=new Map});function DZ($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function R1($,Z){return DZ($,Z,AZ,MZ)}function O5($,Z){return DZ($,Z,TZ,IZ)}function J$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function eq($,Z){if($.startsWith("<!--",Z)){let Y=J$($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[AZ,MZ],[TZ,IZ]]){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)continue;X.lastIndex=Y.lastIndex;let Q=X.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function q3($,Z){let Y=[],X=0,J=$.length,Q=!1,G=null;while(X<J){let K=$[X];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=eq($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))Q=!0;X++}return Y}function Z1($,Z,Y){let X=q3($,Z);if(X.length===0)return{output:$,tokens:[]};let J=X.map((K)=>K.token),Q="",G=0;for(let K=0;K<X.length;K++){let q=X[K];Q+=$.slice(G,q.start),Q+=Y(q.token,K),G=q.end}return Q+=$.slice(G),{output:Q,tokens:J}}function N1($){let{output:Z,tokens:Y}=Z1($,R1,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function Q$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var AZ,MZ,TZ,IZ;var u1=b(()=>{AZ=/<script\b[^>]*>/iy,MZ=/<\/script\s*>/ig,TZ=/<style\b[^>]*>/iy,IZ=/<\/style\s*>/ig});var PZ={};o(PZ,{usesSignalsInScript:()=>z1,unescapeHtml:()=>KW,registerFilters:()=>ZW,registerFilter:()=>bZ,processExpressions:()=>A1,interpolateScriptsInTemplate:()=>XW,interpolateScriptExpressions:()=>t$,getAllFilters:()=>SZ,evaluateExpression:()=>p0,escapeHtml:()=>s0,defaultFilters:()=>K$,clearCustomFilters:()=>YW,applyFilters:()=>yZ});function $W($){let Z=EZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),EZ.set($,Z)}return Z.lastIndex=0,Z}function bZ($,Z){if($ in K$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G$[$]=Z}function ZW($){for(let[Z,Y]of Object.entries($))bZ(Z,Y)}function SZ(){return{...K$,...G$}}function YW(){for(let $ of Object.keys(G$))delete G$[$]}function s0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function z1($){let{scripts:Z}=N1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let J=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))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 kZ($,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,""),J="",Q=!1,G=0;for(let W=0;W<X.length;W++){let z=X[W];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&X[W+1]==="{"){G++,W++,J+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){J+=z;continue}continue}J+=z}X=J;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/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 t$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=p0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=p0(J,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),Y}function XW($,Z,Y={}){let{output:X,scripts:J}=N1($),Q=J.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let j=t$(U,Z);return q[0]+j+G.slice(W)});return Q$(X,Q)}function A1($,Z,Y){let X=$,J=(U,j)=>{let H=O5(U,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,H))?-1:H},Q=(U,j,H,B)=>{let _=H.length,{output:O,tokens:F}=Z1(U,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=Z?.__stx_signals_gate===!0||z1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=p0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,U)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=p0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return a$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return a$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,U)}}),X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(U,j,H)=>{let B=j.trim();if(z.has(B))return U;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&W.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=B.match(R),A=N&&!_.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=p0(j,Z);if(w)return U;if(q&&!kZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!q)return a$("expr",B);return M!==void 0&&M!==null?s0(String(M)):""}catch(M){if(w)return U;if(q&&!kZ(B,Z))return U;if(A)return U;let I=M instanceof Error?M.message:String(M);return z0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,U)}});for(let U=0;U<K.length;U++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)X=X.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return X}function yZ($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=G$[G]||K$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(SZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,z=1;while(W>0&&z<J.length){if(J[z]==="(")W++;if(J[z]===")")W--;z++}if(W===0){let U=J.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[p0(`(${U})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);q=j.map((V)=>{let w=V.trim();return p0(w,Y,!0)})}}catch{q=[U]}J=J.substring(z).trim()}}try{X=K(X,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function JW($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&J===0&&Q===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function p0($,Z,Y=!1){try{let X=$.trim(),J=JW(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=p0(Q,Z,!0);return yZ(K,G,Z)}if(!Q0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(X,Q)(...G)}catch{return Z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=QW(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function QW($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=GW($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}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 GW($,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,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+q)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function KW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var G$,EZ,K$;var Y1=b(()=>{F0();R0();NZ();u1();G$={},EZ=new Map;K$={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 s0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace($W(q),String(W))}),K},t:($,Z,Y={})=>{return K$.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={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 J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},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 J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"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 J=10**Y;return Math.round(X*J)/J}}});class p1{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 L5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!F5.has(Y)){if(F5.size>=qW){let X=F5.keys().next().value;if(X)F5.delete(X)}F5.set(Y,new RegExp($,Z))}return F5.get(Y)}class CZ{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 J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=J.get(W);if(!z){if(J.size>=Q){let U=J.keys().next().value;if(U)J.delete(U)}z=Function(...Z,`
2071
2071
  'use strict';
2072
2072
  try {
2073
2073
  return ${q};
@@ -2084,17 +2084,17 @@ catch (e) {
2084
2084
  `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(Q)G+=q;else J+=q}return Z}function hZ($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=z3(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>hZ(j,Z,Y,X,J,Q)).join(`
2085
2085
  `);return`${G} {
2086
2086
  ${U}
2087
- }`}return`${G} { ${K} }`}let q=zW(G,Z,Y,X),W=K;for(let[z,U]of J)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function zW($,Z,Y,X){let J=$.split(",").map((G)=>G.trim()),Q=[];for(let G of J){if(G.startsWith(":host")){if(X)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let q=UW(G,Z);if(q)Q.push(Y?`${Y} ${q}`:q)}return Q.join(", ")}function UW($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let J=$.slice(0,X),Q=$.slice(X);if(!J)return"";let G=J.length,K=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${J.slice(0,G)}.${Z}${J.slice(G)}${Q}`}function dZ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function e$($,Z){if(!jW.test($))return{html:$,hasScoped:!1};let Y=fZ(Z),X=`data-v-${Y}`,J=$,Q=new RegExp(`<style\\s+([^>]*${U3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(J=J.replace(Q,(K,q,W)=>{G=!0;let z=BW(W,X),U=q.replace(new RegExp(U3,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return J=_W(J,X),{html:J,hasScoped:!0}}function BW($,Z){return gZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function _W($,Z){let Y=$1($,(J,Q)=>{let G=R1(J,Q);return G>Q?G:O5(J,Q)},(J,Q)=>HW(Q)),X=OW(Y.output,Z);return mZ.lastIndex=0,X.replace(mZ,(J,Q)=>Y.tokens[Number(Q)])}function OW($,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,J,Q)=>{if(Y.has(J.toLowerCase()))return X;if(X.includes(Z))return X;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return X;if(Q)return X.replace(`<${J}${Q}`,`<${J} ${Z}${Q}`);if(X.endsWith("/>"))return`<${J} ${Z} />`;return`<${J} ${Z}>`})}var U3,jW,HW=($)=>`\x00stx-scope-mask-${$}\x00`,mZ;var j3=b(()=>{u1();U3=String.raw`(?<![\w-])scoped(?![\w-])`,jW=new RegExp(`<style\\s+[^>]*${U3}`,"i");mZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function LW($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return FW.test(Z)}function $4($){q$.lastIndex=0;let Z;while((Z=q$.exec($))!==null){if(Z[0].startsWith("</")||LW(Z[0]))continue;let Y=Z.index,X=q$.lastIndex,J=1,Q;while((Q=q$.exec($))!==null)if(Q[0].startsWith("</")){if(J--,J===0){let G=Q.index;return{start:Y,openEnd:X,closeStart:G,end:q$.lastIndex,content:$.slice(X,G)}}}else J++;return null}return null}var q$,FW;var B3=b(()=>{q$=/<\/?template\b[^>]*>/gi,FW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var uZ=()=>{};function M0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,q=!1;while(Q<$.length){let W=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&W==="\\"){q=!0,Q++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&W==="}"){K--,Q++;continue}if(W==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)J++;else if(W===Y){if(J--,J===0)return Q}Q++}return-1}var O3={};o(O3,{useTitle:()=>AW,useSeoMeta:()=>pZ,usePageTitle:()=>AW,useHead:()=>_3,seoMetaToHeadConfig:()=>Y4,resetHead:()=>RW,renderHtmlAttrs:()=>TW,renderHead:()=>MW,renderBodyAttrs:()=>IW,processTitleDirective:()=>kW,processMetaDirective:()=>bW,processHeadDirective:()=>EW,mergeHeadConfigs:()=>w5,getPageMeta:()=>wW,getHead:()=>H3,definePageMeta:()=>NW,applyHead:()=>DW});function H3(){return M1}function wW(){return Z4}function RW(){M1={},VW.length=0,Z4={}}function _3($){M1=w5(M1,$)}function w5($,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 pZ($){_3(Y4($))}function Y4($){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 J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function NW($){if(Z4={...Z4,...$},$.title||$.description)pZ({title:$.title,description:$.description})}function AW($){let Z=typeof $==="function"?$():$;_3({title:Z})}function MW($=M1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${l1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${l1(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${l1(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${l1(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${l1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
2087
+ }`}return`${G} { ${K} }`}let q=zW(G,Z,Y,X),W=K;for(let[z,U]of J)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function zW($,Z,Y,X){let J=$.split(",").map((G)=>G.trim()),Q=[];for(let G of J){if(G.startsWith(":host")){if(X)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let q=UW(G,Z);if(q)Q.push(Y?`${Y} ${q}`:q)}return Q.join(", ")}function UW($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let J=$.slice(0,X),Q=$.slice(X);if(!J)return"";let G=J.length,K=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${J.slice(0,G)}.${Z}${J.slice(G)}${Q}`}function dZ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function e$($,Z){if(!jW.test($))return{html:$,hasScoped:!1};let Y=fZ(Z),X=`data-v-${Y}`,J=$,Q=new RegExp(`<style\\s+([^>]*${U3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(J=J.replace(Q,(K,q,W)=>{G=!0;let z=BW(W,X),U=q.replace(new RegExp(U3,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return J=_W(J,X),{html:J,hasScoped:!0}}function BW($,Z){return gZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function _W($,Z){let Y=Z1($,(J,Q)=>{let G=R1(J,Q);return G>Q?G:O5(J,Q)},(J,Q)=>HW(Q)),X=OW(Y.output,Z);return mZ.lastIndex=0,X.replace(mZ,(J,Q)=>Y.tokens[Number(Q)])}function OW($,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,J,Q)=>{if(Y.has(J.toLowerCase()))return X;if(X.includes(Z))return X;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return X;if(Q)return X.replace(`<${J}${Q}`,`<${J} ${Z}${Q}`);if(X.endsWith("/>"))return`<${J} ${Z} />`;return`<${J} ${Z}>`})}var U3,jW,HW=($)=>`\x00stx-scope-mask-${$}\x00`,mZ;var j3=b(()=>{u1();U3=String.raw`(?<![\w-])scoped(?![\w-])`,jW=new RegExp(`<style\\s+[^>]*${U3}`,"i");mZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function LW($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return FW.test(Z)}function $4($){q$.lastIndex=0;let Z;while((Z=q$.exec($))!==null){if(Z[0].startsWith("</")||LW(Z[0]))continue;let Y=Z.index,X=q$.lastIndex,J=1,Q;while((Q=q$.exec($))!==null)if(Q[0].startsWith("</")){if(J--,J===0){let G=Q.index;return{start:Y,openEnd:X,closeStart:G,end:q$.lastIndex,content:$.slice(X,G)}}}else J++;return null}return null}var q$,FW;var B3=b(()=>{q$=/<\/?template\b[^>]*>/gi,FW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var uZ=()=>{};function M0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,q=!1;while(Q<$.length){let W=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&W==="\\"){q=!0,Q++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&W==="}"){K--,Q++;continue}if(W==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)J++;else if(W===Y){if(J--,J===0)return Q}Q++}return-1}var O3={};o(O3,{useTitle:()=>AW,useSeoMeta:()=>pZ,usePageTitle:()=>AW,useHead:()=>_3,seoMetaToHeadConfig:()=>Y4,resetHead:()=>RW,renderHtmlAttrs:()=>TW,renderHead:()=>MW,renderBodyAttrs:()=>IW,processTitleDirective:()=>kW,processMetaDirective:()=>bW,processHeadDirective:()=>EW,mergeHeadConfigs:()=>w5,getPageMeta:()=>wW,getHead:()=>H3,definePageMeta:()=>NW,applyHead:()=>DW});function H3(){return M1}function wW(){return Z4}function RW(){M1={},VW.length=0,Z4={}}function _3($){M1=w5(M1,$)}function w5($,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 pZ($){_3(Y4($))}function Y4($){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 J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function NW($){if(Z4={...Z4,...$},$.title||$.description)pZ({title:$.title,description:$.description})}function AW($){let Z=typeof $==="function"?$():$;_3({title:Z})}function MW($=M1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${l1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${l1(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${l1(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${l1(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${l1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
2088
2088
  `)}function TW($=M1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${l1(Y)}"`).join(" ")}function IW($=M1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${l1(Y)}"`).join(" ")}function l1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function DW($=M1){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[J,Q]of Object.entries(Z))if(Q!==void 0)X.setAttribute(J,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))if(Z==="class")for(let X of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(X);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function EW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
2089
2089
  `,""}),headContent:Z.trim()}}function kW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(K,{title:G}),""})}function bW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let q=Q?G:K,W=Q?q:Z[(q||"").trim()]??q,U=J.includes(":")?{property:J,content:W}:{name:J,content:W},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(j,{meta:[U]}),""})}var M1,VW,Z4;var W$=b(()=>{M1={},VW=[],Z4={}});var X4={};o(X4,{stripTypeScript:()=>oZ,splitDeclaration:()=>$2,isModuleResolutionFailure:()=>sZ,isMissingBindingFailure:()=>rZ,isCompleteImport:()=>aZ,hasVariables:()=>J2,extractVariables:()=>c1,extractScriptFromTemplate:()=>X2,convertToCommonJS:()=>L3});import T1 from"path";import R5 from"process";function SW($){let Z=[],Y=0,X=$.split(`
2090
2090
  `);for(let J of X){let Q=Y,G=null,K=!1;for(let q=0;q<J.length;q++){let W=J[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<J.length&&J[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(Q===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function oZ($){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 J=[],Q="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let z=X[W];if(q){if(Q+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){J.push(Q),Q="";continue}Q+=z}if(Q)J.push(Q);return J.map((W)=>{let z=W.trim(),U=z.startsWith("..."),j=U?z.slice(3):z,H=-1,B=0;for(let R=0;R<j.length;R++)if(j[R]==="<")B++;else if(j[R]===">")B--;else if(j[R]===":"&&B===0){H=R;break}if(H===-1)return W;let O=j.substring(0,H).trim().replace(/\?$/,""),F=j.substring(H+1),L=-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){L=R;break}let w=U?"...":"";if(L!==-1)return`${w}${O} = ${F.substring(L+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,J,Q)=>{if(!Q.includes(":"))return X;return`${J}(${Y(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=X.exec(Z))!==null){let G=J.index+J[0].length-1,K=1,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let H=Z[q];if(z){if(H===z)z=null;q++;continue}if(H==='"'||H==="'"||H==="`"){z=H,q++;continue}if(H==="<")W++;else if(H===">"&&W>0)W--;else if(W===0){if(H==="(")K++;else if(H===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let j=Y(U);Q.push({start:G+1,end:q,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,J)=>{if(!J.includes(":"))return X;if(J.includes("{")||J.includes("}"))return X;return`(${J.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,`
2091
2091
 
2092
- `),Z}function sZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function rZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function c1($,Z,Y,X={}){if(!$.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=oZ($)}let Q={exports:{}},G=Q.exports,K=R5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=T1.resolve(K,"node_modules",E),h=T1.join(v,"package.json"),g=JSON.parse(q0("fs").readFileSync(h,"utf8")),t=g.main||"index.js";if(g.exports){let z0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof z0==="string")t=z0;else if(z0?.bun)t=z0.bun;else if(z0?.import)t=z0.import;else if(z0?.default)t=z0.default}q[E]=await import(T1.resolve(v,t))}catch{}let z=(E)=>{if(q[E])return q[E];return q0(E)},U=Z.props||{},j=(E)=>{if(!E)return U;let v={};for(let[h,g]of Object.entries(E)){let t=U[h];if(t!==void 0)v[h]=t;else if(typeof g==="function")v[h]=g();else v[h]=g}return v};for(let[E,v]of Object.entries(U))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return U;let v={...U};for(let[h,g]of Object.entries(E)){let t=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[h]===void 0&&t.default!==void 0)v[h]=typeof t.default==="function"?t.default():t.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let h={...E};for(let[g,t]of Object.entries(v))if(h[g]===void 0)if(typeof t==="function")h[g]=t();else h[g]=t;return h},O=(E)=>{let v=()=>E;return v.set=(h)=>{},v.update=(h)=>{},v},F=(E)=>{let v,h=!1;return()=>{if(!h)try{v=E(),h=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function N(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function A(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let M=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",h=E?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:h,name:"",fullPath:h+v,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=w5(v,E||{})},k=(E)=>{T(Y4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},d=(E)=>E?E():Promise.resolve(),u=(E)=>(v,...h)=>{},Y0=(E)=>{},d0=(E,v)=>{},V0=(E,v)=>v,i0=()=>({value:"light"}),p=()=>O(!1),B0=(E)=>O(!1),u0=()=>O(!1),_1=()=>B0("(prefers-color-scheme: dark)"),q5=()=>B0("(prefers-color-scheme: light)"),W5=()=>B0("(prefers-reduced-motion: reduce)"),n=()=>B0("(prefers-contrast: more)"),r={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:{}},K0=new Proxy(r,{get(E,v){if(v in E)return E[v];return},set(E,v,h){return E[v]=h,!0}}),A0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},X0=console;try{let E=L3(J,Y),v=new Set(Object.keys(U)),h=(i)=>/^[a-z_$][\w$]*$/i.test(i),g=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&h(i)),t=g.map((i)=>Z[i]),z0=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"]),Q1=[],S0=[];for(let[i,t0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(z0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(E))continue;Q1.push(i),S0.push(t0)}let n0=SW(E).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
2093
- `),z5=Z.params??{},O1=[],F1=[];for(let i=0;i<g.length;i++){if(g[i]==="params")continue;O1.push(g[i]),F1.push(t[i])}let a0=await Function("module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...Q1,...O1,`return (async () => {
2092
+ `),Z}function sZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function rZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function c1($,Z,Y,X={}){if(!$.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=oZ($)}let Q={exports:{}},G=Q.exports,K=R5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=T1.resolve(K,"node_modules",E),h=T1.join(v,"package.json"),g=JSON.parse(W0("fs").readFileSync(h,"utf8")),a=g.main||"index.js";if(g.exports){let Y0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Y0==="string")a=Y0;else if(Y0?.bun)a=Y0.bun;else if(Y0?.import)a=Y0.import;else if(Y0?.default)a=Y0.default}q[E]=await import(T1.resolve(v,a))}catch{}let z=(E)=>{if(q[E])return q[E];return W0(E)},U=Z.props||{},j=(E)=>{if(!E)return U;let v={};for(let[h,g]of Object.entries(E)){let a=U[h];if(a!==void 0)v[h]=a;else if(typeof g==="function")v[h]=g();else v[h]=g}return v};for(let[E,v]of Object.entries(U))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return U;let v={...U};for(let[h,g]of Object.entries(E)){let a=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[h]===void 0&&a.default!==void 0)v[h]=typeof a.default==="function"?a.default():a.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let h={...E};for(let[g,a]of Object.entries(v))if(h[g]===void 0)if(typeof a==="function")h[g]=a();else h[g]=a;return h},O=(E)=>{let v=()=>E;return v.set=(h)=>{},v.update=(h)=>{},v},F=(E)=>{let v,h=!1;return()=>{if(!h)try{v=E(),h=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function N(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function A(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let M=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",h=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),a=Z.query,Y0=Object.keys(g).length>0?g:a??{},n0=v||(Object.keys(Y0).length>0?`?${new URLSearchParams(Y0).toString()}`:"");return{params:Z.params??{},query:Y0,path:h,name:"",fullPath:h+n0,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=w5(v,E||{})},k=(E)=>{T(Y4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},d=(E)=>E?E():Promise.resolve(),u=(E)=>(v,...h)=>{},X0=(E)=>{},d0=(E,v)=>{},V0=(E,v)=>v,i0=()=>({value:"light"}),p=()=>O(!1),B0=(E)=>O(!1),u0=()=>O(!1),_1=()=>B0("(prefers-color-scheme: dark)"),q5=()=>B0("(prefers-color-scheme: light)"),W5=()=>B0("(prefers-reduced-motion: reduce)"),n=()=>B0("(prefers-contrast: more)"),r={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:{}},q0=new Proxy(r,{get(E,v){if(v in E)return E[v];return},set(E,v,h){return E[v]=h,!0}}),A0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},J0=console;try{let E=L3(J,Y),v=new Set(Object.keys(U)),h=(i)=>/^[a-z_$][\w$]*$/i.test(i),g=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&h(i)),a=g.map((i)=>Z[i]),Y0=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"]),n0=[],S0=[];for(let[i,e0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(Y0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(E))continue;n0.push(i),S0.push(e0)}let o0=SW(E).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
2093
+ `),z5=Z.params??{},O1=[],F1=[];for(let i=0;i<g.length;i++){if(g[i]==="params")continue;O1.push(g[i]),F1.push(a[i])}let t0=await Function("module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...n0,...O1,`return (async () => {
2094
2094
  ${E}
2095
- ${n0}
2095
+ ${o0}
2096
2096
  return module.exports
2097
- })()`)(Q,G,z,U,j,H,_,A,O,F,L,V,w,R,N,M,I,T,k,D,P,y,S,C,x,d,u,Y0,B,d0,V0,i0,p,B0,u0,_1,q5,W5,n,K0,A0,X0,r.confirm,r.alert,r.fetch,z5,...S0,...F1);if(X.preserveExisting){for(let[i,t0]of Object.entries(a0))if(!(i in Z)||Z[i]===void 0)Z[i]=t0}else Object.assign(Z,a0);for(let[i,t0]of Object.entries(U))if(!(i in Z))Z[i]=t0}catch(E){let v=E instanceof Error?E.message:String(E);if(sZ(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(rZ(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(R5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await xW(J,Z,Y)}catch(h){if(R5.env.STX_DEBUG){let g=h instanceof Error?h.message:String(h);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${g}`)}}}}function aZ($){let Z=0,Y=null,X=!1,J=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,X||Z===0)J=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return Y===null&&Z===0&&J}function L3($,Z){let Y=Z?T1.dirname(Z):R5.cwd(),X=R5.cwd(),J=$.split(`
2097
+ })()`)(Q,G,z,U,j,H,_,A,O,F,L,V,w,R,N,M,I,T,k,D,P,y,S,C,x,d,u,X0,B,d0,V0,i0,p,B0,u0,_1,q5,W5,n,q0,A0,J0,r.confirm,r.alert,r.fetch,z5,...S0,...F1);if(X.preserveExisting){for(let[i,e0]of Object.entries(t0))if(!(i in Z)||Z[i]===void 0)Z[i]=e0}else Object.assign(Z,t0);for(let[i,e0]of Object.entries(U))if(!(i in Z))Z[i]=e0}catch(E){let v=E instanceof Error?E.message:String(E);if(sZ(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(rZ(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(R5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await xW(J,Z,Y)}catch(h){if(R5.env.STX_DEBUG){let g=h instanceof Error?h.message:String(h);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${g}`)}}}}function aZ($){let Z=0,Y=null,X=!1,J=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,X||Z===0)J=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return Y===null&&Z===0&&J}function L3($,Z){let Y=Z?T1.dirname(Z):R5.cwd(),X=R5.cwd(),J=$.split(`
2098
2098
  `),Q=[],G=0;while(G<J.length){let K=J[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let q=0;for(;G<J.length;G++){for(let W of J[G])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let q=0,W=!1,z=G;for(let H=G;H<J.length&&!W;H++){let B=null,_=!1,O=J[H];for(let F=0;F<O.length;F++){let L=O[F];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){G=H+1,W=!0;break}}}}if(!W)G=J.length;let U=J.slice(z,G).join(`
2099
2099
  `),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let q=K,W=0;while(!aZ(q)&&G+W+1<J.length)W++,q=`${q} ${J[G+W].trim()}`;G+=W;let z=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=q.match(/^import\s+['"](.+?)['"]/),H=q,B=(_)=>{if(_.startsWith("."))return T1.resolve(Y,_);if(_.startsWith("~/")||_.startsWith("@/"))return T1.resolve(X,_.slice(2));return _};if(z){let[,_,O]=z,F=B(O);Q.push(`const ${_} = await import('${F}')`),Q.push(`module.exports.${_} = ${_};`)}else if(U){let[,_,O]=U,F=B(O),L=[],V=[];for(let w of _.split(",")){let R=w.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[A,M]=[N[0].trim(),N[1].trim()];L.push(`${A}: ${M}`),V.push(M)}else L.push(R),V.push(R)}Q.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let w of V)Q.push(`module.exports.${w} = ${w};`)}else if(j){let _=B(j[1]);Q.push(`await import('${_}')`)}else Q.push(H);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(J[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let q=lZ(J,G),{type:W,name:z,value:U}=q;Q.push(`${W} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=q.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let q=F3(J,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let q=lZ(J,G),{type:W,name:z,value:U}=q;Q.push(`${W} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=q.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let q=F3(J,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let q=J[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[G]=q;let z=F3(W,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(K.startsWith("export default ")){let q=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${q};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let q=K.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],z=J[G].replace(/^export\s+/,""),U=0,j=G;for(;j<J.length;j++){let H=J[j];for(let B of H)if(B==="{")U++;else if(B==="}")U--;if(j>G)z+=`
2100
2100
  `+H;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${W} = ${W};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return yW(Q.join(`
@@ -2105,7 +2105,7 @@ ${N}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}l
2105
2105
  ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:W}}function F3($,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[,J]=X,Q=Y.replace(/^export\s+/,""),G=Z;if(CW(Y)){let K=vW($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function cZ($){let Z=$.trim();if(Z.startsWith("{"))return M0(Z,"{","}",0)===-1;if(Z.startsWith("["))return M0(Z,"[","]",0)===-1;return!Z2(Z)}function Z2($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let J=0;J<$.length;J++){let Q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[J+1]==="{"){X++,J++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function Y2($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let Y=M0($,"(",")",Z);if(Y===-1)return-1;return $.indexOf("{",Y)}function CW($){let Z=Y2($);if(Z===-1)return!0;return M0($,"{","}",Z)===-1}function iZ($,Z,Y){let X=Y,J=Z+1;while(J<$.length&&!Z2(X)){let Q=$[J];X+=`
2106
2106
  ${Q}`,J++}while(J<$.length){let Q=$[J].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
2107
2107
  ${$[J]}`,J++;else break}return{value:X,nextIndex:J}}function vW($,Z,Y){let X=Y,J=Z+1;while(J<$.length){let Q=Y2(X);if(Q!==-1){if(M0(X,"{","}",Q)!==-1)break}let G=$[J];X+=`
2108
- ${G}`,J++}return{functionCode:X,nextIndex:J}}function nZ($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...R5.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 xW($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,K]=Q;try{let q=K.trim().replace(/;$/,""),W=nZ(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=nZ(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function X2($){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 J2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var z$=b(()=>{W$();V1();F0()});var V3={};o(V3,{renderSlot:()=>G2,processSlots:()=>q2,parseSlots:()=>Q2,parseSlotElement:()=>dW,extractSlotContent:()=>lW,applySlots:()=>cW});function fW($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function hW($,Z){let Y=null;for(let X=Z;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"){Y=J;continue}if(J===">")return X+1}return-1}function mW($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);J=j===-1?$.length:j+3;continue}let G=hW($,Q+1);if(G===-1)break;let K=$.slice(Q,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=G;continue}let W=q[1]==="/",z=q[2].toLowerCase();if(W){let j=Y.lastIndexOf(z);if(j!==-1)Y.splice(j);J=G;continue}if(z==="template"&&Y.length===0){let j=K.match(X);if(j){let H=fW($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),J=H;continue}}}if(!/\/\s*>$/.test(K)&&!gW.has(z)){if(Y.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){J=j;continue}}}J=G}return Z}function Q2($){let Z={default:"",named:new Map},Y=$,X=mW($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let J=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[q,W,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${W}${O?" "+O:""}>${H}</${W}>`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${W}${_?" "+_:""} />`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:O})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function dW($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function G2($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,z]=q.split(":").map((j)=>j.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[Q]=Z;J=uW(J,G)}return J}function uW($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=K2(J,Z);return o0(String(Q??""))}catch{return`{{ ${X} }}`}})}function K2($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!J0($))return;return Q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function q2($,Z,Y){let X=$;X=await pW(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",j=q||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=K2(F,Y)}return await G2(z,H,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function pW($,Z,Y){let X=[],J=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return J.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:q,index:W}=J[K];G=G.slice(0,W)+Q[K]+G.slice(W+q.length)}return G}function lW($){let Z=Q2($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function cW($,Z,Y,X){return await q2($,{default:Z,named:Y},X)}var gW;var w3=b(()=>{Z1();F0();gW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function I1($,Z){let Y=iW($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function iW($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=M0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function nW($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function i1($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)J++,Q=z+q[0].length;else if(U<1/0){if(J--,J===0)return U;Q=U+W[0].length}else break}return-1}function W2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z="if",U=J.expression,j=0,H=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let _=K.substring(B);if(nW(K,B)){W++;continue}if(/^@if\s*\(/.test(_)){H++,W++;continue}if(/^@endif(?![a-z])/.test(_)){H--,W+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W});let F=W+O[0].length,L=I1(K,F);if(!L){W++;continue}z="elseif",U=L.expression,W=L.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W}),z="else",U=void 0,W+=5,j=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function U$($){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 Q=W2($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function J4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=J.exec($);continue}let K=Q.index,q=K+Q[0].length-1,W=M0($,"(",")",q);if(W===-1){Q=J.exec($);continue}let z=$.slice(q+1,W),U=W+1,j=i1($,Z,Y,U);if(j===-1){Q=J.exec($);continue}let H=$.slice(U,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),J.lastIndex=B,Q=J.exec($)}return X}function R3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z=null,U=0;while(W<K.length){let j=K.slice(W),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];W+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];W+=B[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)q.push(z);let L=W+_[0].length,V=I1(K,L);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(O&&j.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=O[0].length}else if(F&&j.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:q,start:Z,end:G+10}}var z2=()=>{};var U2=()=>{};var Q4=b(()=>{z2();U2()});import{matchRoute as KV,Router as aW}from"stx-router";import{findErrorPage as zV,formatRoutes as UV,generateRouteManifest as jV,generateRouteTypes as BV,matchRoute as HV}from"stx-router";function j2($,Z={}){return new aW($,Z).routes}var B2=()=>{};async function _2($){let Z=$;if(!Z)try{Z=(await D1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,X=H2.get(Y);if(X)return X;let J=[];try{J=j2(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{J=[]}return H2.set(Y,J),J}var H2;var O2=b(()=>{B2();w1();H2=new Map});function tW($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function F2($){return tW(JSON.stringify($))}function G4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),X=/<body\b([^>]*)>/i.exec(Y);if(!X)return null;let J=Z+X.index,Q=-1,G="";for(let q of eW){let W=q.open.exec(Y);if(!W)continue;let z=Z+W.index;if(z<J&&(Q===-1||z<Q))Q=z,G=q.close}if(Q===-1)return{index:J,tag:X[0],attrs:X[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function N3($,Z){let Y=G4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var eW;var A3=b(()=>{eW=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function E1($){let Z=$,Y=new Set,X=new Set,J=()=>{if(f0)X.add(f0);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),j$)X.forEach((K)=>q4.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(Q)=>J.set(Q),configurable:!0}),J}function z4($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,j$)X.forEach((G)=>q4.add(G));else X.forEach((G)=>G())},Q=()=>{if(f0)X.add(f0);if(Y){let G=f0;f0=J,K4.push(J);try{Z=$()}finally{K4.pop(),f0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function U4($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=f0;f0=J,K4.push(J);try{let G=$();Y=typeof G==="function"?G:void 0}finally{K4.pop(),f0=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function T3($){if(j$){$();return}j$=!0;try{$()}finally{j$=!1,q4.forEach((Z)=>Z()),q4.clear()}}function I3($){M3.push($)}function D3($){W4.push($)}function $z(){L2(M3,"onMount",W4)}function Zz(){L2(W4,"onDestroy")}function L2($,Z,Y){let X=$.splice(0,$.length);for(let J of X)try{let Q=J();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function Yz(){return{mount:M3.length,destroy:W4.length}}function j4($){return typeof $==="function"&&$._isSignal===!0}function B4($){return typeof $==="function"&&$._isDerived===!0}function E3($){if(j4($)||B4($))return $();return $}function H4($){let Z=f0;f0=null;try{return $()}finally{f0=Z}}function Xz($,Z){let Y=typeof $==="function"?$:()=>$,X=E1([]),J=z4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return U4(()=>{if(Y(),!Q){Q=!0;return}if(H4(()=>X().length))X.set([])}),[J,(K,q)=>{let W={action:K};X.set([...X(),W]);let z=()=>{let U=X().filter((j)=>j!==W);if(U.length!==X().length)X.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var f0=null,K4,j$=!1,q4,M3,W4;var _4=b(()=>{K4=[],q4=new Set,M3=[],W4=[]});var w2={};o(w2,{useOptimistic:()=>Xz,untrack:()=>E3,state:()=>E1,runMountCallbacks:()=>$z,runDestroyCallbacks:()=>Zz,pendingLifecycleCounts:()=>Yz,peek:()=>H4,onMount:()=>I3,onDestroy:()=>D3,isSignal:()=>j4,isDerived:()=>B4,generateSignalsRuntimeDev:()=>k3,generateSignalsRuntime:()=>V2,effect:()=>U4,derived:()=>z4,default:()=>Qz,batch:()=>T3});function V2(){let $=Jz(k3());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function Jz($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let J=$.indexOf(X,Y);if(J===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,J));let Q=1,G=J+X.length;while(G<$.length&&Q>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==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function k3(){return`
2108
+ ${G}`,J++}return{functionCode:X,nextIndex:J}}function nZ($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...R5.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 xW($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,K]=Q;try{let q=K.trim().replace(/;$/,""),W=nZ(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=nZ(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function X2($){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 J2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var z$=b(()=>{W$();V1();F0()});var V3={};o(V3,{renderSlot:()=>G2,processSlots:()=>q2,parseSlots:()=>Q2,parseSlotElement:()=>dW,extractSlotContent:()=>lW,applySlots:()=>cW});function fW($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function hW($,Z){let Y=null;for(let X=Z;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"){Y=J;continue}if(J===">")return X+1}return-1}function mW($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);J=j===-1?$.length:j+3;continue}let G=hW($,Q+1);if(G===-1)break;let K=$.slice(Q,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=G;continue}let W=q[1]==="/",z=q[2].toLowerCase();if(W){let j=Y.lastIndexOf(z);if(j!==-1)Y.splice(j);J=G;continue}if(z==="template"&&Y.length===0){let j=K.match(X);if(j){let H=fW($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),J=H;continue}}}if(!/\/\s*>$/.test(K)&&!gW.has(z)){if(Y.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){J=j;continue}}}J=G}return Z}function Q2($){let Z={default:"",named:new Map},Y=$,X=mW($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let J=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[q,W,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${W}${O?" "+O:""}>${H}</${W}>`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${W}${_?" "+_:""} />`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:O})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function dW($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function G2($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,z]=q.split(":").map((j)=>j.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[Q]=Z;J=uW(J,G)}return J}function uW($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=K2(J,Z);return s0(String(Q??""))}catch{return`{{ ${X} }}`}})}function K2($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function q2($,Z,Y){let X=$;X=await pW(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",j=q||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=K2(F,Y)}return await G2(z,H,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function pW($,Z,Y){let X=[],J=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return J.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:q,index:W}=J[K];G=G.slice(0,W)+Q[K]+G.slice(W+q.length)}return G}function lW($){let Z=Q2($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function cW($,Z,Y,X){return await q2($,{default:Z,named:Y},X)}var gW;var w3=b(()=>{Y1();F0();gW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function I1($,Z){let Y=iW($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function iW($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=M0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function nW($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function i1($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)J++,Q=z+q[0].length;else if(U<1/0){if(J--,J===0)return U;Q=U+W[0].length}else break}return-1}function W2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z="if",U=J.expression,j=0,H=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let _=K.substring(B);if(nW(K,B)){W++;continue}if(/^@if\s*\(/.test(_)){H++,W++;continue}if(/^@endif(?![a-z])/.test(_)){H--,W+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W});let F=W+O[0].length,L=I1(K,F);if(!L){W++;continue}z="elseif",U=L.expression,W=L.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W}),z="else",U=void 0,W+=5,j=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function U$($){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 Q=W2($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function J4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=J.exec($);continue}let K=Q.index,q=K+Q[0].length-1,W=M0($,"(",")",q);if(W===-1){Q=J.exec($);continue}let z=$.slice(q+1,W),U=W+1,j=i1($,Z,Y,U);if(j===-1){Q=J.exec($);continue}let H=$.slice(U,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),J.lastIndex=B,Q=J.exec($)}return X}function R3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z=null,U=0;while(W<K.length){let j=K.slice(W),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];W+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];W+=B[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)q.push(z);let L=W+_[0].length,V=I1(K,L);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(O&&j.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=O[0].length}else if(F&&j.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:q,start:Z,end:G+10}}var z2=()=>{};var U2=()=>{};var Q4=b(()=>{z2();U2()});import{matchRoute as KV,Router as aW}from"stx-router";import{findErrorPage as zV,formatRoutes as UV,generateRouteManifest as jV,generateRouteTypes as BV,matchRoute as HV}from"stx-router";function j2($,Z={}){return new aW($,Z).routes}var B2=()=>{};async function _2($){let Z=$;if(!Z)try{Z=(await D1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,X=H2.get(Y);if(X)return X;let J=[];try{J=j2(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{J=[]}return H2.set(Y,J),J}var H2;var O2=b(()=>{B2();w1();H2=new Map});function tW($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function F2($){return tW(JSON.stringify($))}function G4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),X=/<body\b([^>]*)>/i.exec(Y);if(!X)return null;let J=Z+X.index,Q=-1,G="";for(let q of eW){let W=q.open.exec(Y);if(!W)continue;let z=Z+W.index;if(z<J&&(Q===-1||z<Q))Q=z,G=q.close}if(Q===-1)return{index:J,tag:X[0],attrs:X[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function N3($,Z){let Y=G4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var eW;var A3=b(()=>{eW=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function E1($){let Z=$,Y=new Set,X=new Set,J=()=>{if(f0)X.add(f0);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),j$)X.forEach((K)=>q4.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(Q)=>J.set(Q),configurable:!0}),J}function z4($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,j$)X.forEach((G)=>q4.add(G));else X.forEach((G)=>G())},Q=()=>{if(f0)X.add(f0);if(Y){let G=f0;f0=J,K4.push(J);try{Z=$()}finally{K4.pop(),f0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function U4($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=f0;f0=J,K4.push(J);try{let G=$();Y=typeof G==="function"?G:void 0}finally{K4.pop(),f0=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function T3($){if(j$){$();return}j$=!0;try{$()}finally{j$=!1,q4.forEach((Z)=>Z()),q4.clear()}}function I3($){M3.push($)}function D3($){W4.push($)}function $z(){L2(M3,"onMount",W4)}function Zz(){L2(W4,"onDestroy")}function L2($,Z,Y){let X=$.splice(0,$.length);for(let J of X)try{let Q=J();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function Yz(){return{mount:M3.length,destroy:W4.length}}function j4($){return typeof $==="function"&&$._isSignal===!0}function B4($){return typeof $==="function"&&$._isDerived===!0}function E3($){if(j4($)||B4($))return $();return $}function H4($){let Z=f0;f0=null;try{return $()}finally{f0=Z}}function Xz($,Z){let Y=typeof $==="function"?$:()=>$,X=E1([]),J=z4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return U4(()=>{if(Y(),!Q){Q=!0;return}if(H4(()=>X().length))X.set([])}),[J,(K,q)=>{let W={action:K};X.set([...X(),W]);let z=()=>{let U=X().filter((j)=>j!==W);if(U.length!==X().length)X.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var f0=null,K4,j$=!1,q4,M3,W4;var _4=b(()=>{K4=[],q4=new Set,M3=[],W4=[]});var w2={};o(w2,{useOptimistic:()=>Xz,untrack:()=>E3,state:()=>E1,runMountCallbacks:()=>$z,runDestroyCallbacks:()=>Zz,pendingLifecycleCounts:()=>Yz,peek:()=>H4,onMount:()=>I3,onDestroy:()=>D3,isSignal:()=>j4,isDerived:()=>B4,generateSignalsRuntimeDev:()=>k3,generateSignalsRuntime:()=>V2,effect:()=>U4,derived:()=>z4,default:()=>Qz,batch:()=>T3});function V2(){let $=Jz(k3());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function Jz($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let J=$.indexOf(X,Y);if(J===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,J));let Q=1,G=J+X.length;while(G<$.length&&Q>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==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function k3(){return`
2109
2109
  // STX Signals Runtime (Development Build)
2110
2110
  console.log('[stx] signals runtime loading');
2111
2111
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -9866,7 +9866,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9866
9866
  }
9867
9867
  }
9868
9868
  })();
9869
- `}var Qz;var R2=b(()=>{_4();e0();_4();Qz={state:E1,derived:z4,effect:U4,batch:T3,onMount:I3,onDestroy:D3,isSignal:j4,isDerived:B4,untrack:E3,peek:H4,generateSignalsRuntime:V2,generateSignalsRuntimeDev:k3}});var b3={};o(b3,{templateCache:()=>N2,readFileCached:()=>Gz,invalidateFileCacheByDir:()=>qz,invalidateFileCache:()=>Kz,hashFilePath:()=>B$,getCachedSignalsRuntime:()=>Uz,getCachedRouterScript:()=>jz,clearDevCaches:()=>Bz,checkCache:()=>Hz,cacheTemplate:()=>_z,__setSignalsGeneratorsForTest:()=>zz});import k1 from"fs";import N5 from"path";async function Gz($){let Y;for(let X=0;X<3;X++)try{let Q=(await k1.promises.stat($)).mtime.getTime(),G=n1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),W=(await k1.promises.stat($)).mtime.getTime();if(W!==Q)continue;return n1.set($,{content:K,mtime:W}),K}catch(J){Y=J;break}throw n1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Kz($){n1.delete($)}function qz($){for(let Z of n1.keys())if(Z.startsWith($))n1.delete(Z)}function zz($){A2=$}async function Uz($=!1){let Z=A2??await Promise.resolve().then(() => (R2(),w2));if($)return Z.generateSignalsRuntimeDev();if(O4===null)O4=Z.generateSignalsRuntime();return O4}async function jz(){if(F4===null){let{getRouterScript:$}=await import("stx-router");F4=$()}return F4}function Bz(){n1.clear(),T2(),O4=null,Wz=null,F4=null}function M2($){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 Hz($,Z){try{if(!Z.cachePath)return null;let Y=N5.resolve(Z.cachePath),X=N5.join(Y,`${B$($)}.html`),J=N5.join(Y,`${B$($)}.meta.json`);if(!await c(X)||!await c(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==M2(Z))return null;if((await k1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await k1.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 _z($,Z,Y,X){try{if(!X.cachePath)return;let J=N5.resolve(X.cachePath);await k1.promises.mkdir(J,{recursive:!0});let Q=N5.join(J,`${B$($)}.html`),G=N5.join(J,`${B$($)}.meta.json`),K=await k1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:M2(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),N2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function B$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Oz)}var N2,n1,O4=null,Wz=null,A2=null,F4=null,Oz=16;var S3=b(()=>{R0();N2=new Map,n1=new Map});function I2($){return $.includes("data-stx-runtime")}function D2($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let X=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}async function L4($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9869
+ `}var Qz;var R2=b(()=>{_4();$1();_4();Qz={state:E1,derived:z4,effect:U4,batch:T3,onMount:I3,onDestroy:D3,isSignal:j4,isDerived:B4,untrack:E3,peek:H4,generateSignalsRuntime:V2,generateSignalsRuntimeDev:k3}});var b3={};o(b3,{templateCache:()=>N2,readFileCached:()=>Gz,invalidateFileCacheByDir:()=>qz,invalidateFileCache:()=>Kz,hashFilePath:()=>B$,getCachedSignalsRuntime:()=>Uz,getCachedRouterScript:()=>jz,clearDevCaches:()=>Bz,checkCache:()=>Hz,cacheTemplate:()=>_z,__setSignalsGeneratorsForTest:()=>zz});import k1 from"fs";import N5 from"path";async function Gz($){let Y;for(let X=0;X<3;X++)try{let Q=(await k1.promises.stat($)).mtime.getTime(),G=n1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),W=(await k1.promises.stat($)).mtime.getTime();if(W!==Q)continue;return n1.set($,{content:K,mtime:W}),K}catch(J){Y=J;break}throw n1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Kz($){n1.delete($)}function qz($){for(let Z of n1.keys())if(Z.startsWith($))n1.delete(Z)}function zz($){A2=$}async function Uz($=!1){let Z=A2??await Promise.resolve().then(() => (R2(),w2));if($)return Z.generateSignalsRuntimeDev();if(O4===null)O4=Z.generateSignalsRuntime();return O4}async function jz(){if(F4===null){let{getRouterScript:$}=await import("stx-router");F4=$()}return F4}function Bz(){n1.clear(),T2(),O4=null,Wz=null,F4=null}function M2($){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 Hz($,Z){try{if(!Z.cachePath)return null;let Y=N5.resolve(Z.cachePath),X=N5.join(Y,`${B$($)}.html`),J=N5.join(Y,`${B$($)}.meta.json`);if(!await c(X)||!await c(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==M2(Z))return null;if((await k1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await k1.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 _z($,Z,Y,X){try{if(!X.cachePath)return;let J=N5.resolve(X.cachePath);await k1.promises.mkdir(J,{recursive:!0});let Q=N5.join(J,`${B$($)}.html`),G=N5.join(J,`${B$($)}.meta.json`),K=await k1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:M2(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),N2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function B$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Oz)}var N2,n1,O4=null,Wz=null,A2=null,F4=null,Oz=16;var S3=b(()=>{R0();N2=new Map,n1=new Map});function I2($){return $.includes("data-stx-runtime")}function D2($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let X=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}async function L4($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9870
9870
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9871
9871
  `+$.slice(q)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
9872
9872
  `+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
@@ -9881,7 +9881,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9881
9881
  </body>`+$.slice(G+7)}var V4=b(()=>{O2();A3()});var A4={};o(A4,{scanScriptTags:()=>v2,rewriteStxImportSpecifiers:()=>h2,processSignals:()=>x3,processScriptSetup:()=>f2,preEvalLiteralReactiveIfs:()=>C3,parseLoopExpression:()=>x2,hasSignalsSyntax:()=>N4,findMarkupIndexOutsideScripts:()=>R4,extractExports:()=>g2,convertSignalLoopsToAttributes:()=>v3,convertSignalDirectivesToAttributes:()=>P3});function v2($,Z={}){let Y=[];for(let X of q3($,R1)){let J=X.token.match(/^<script\b([^>]*)>/i),Q=X.token.match(/<\/script\s*>$/i);if(!J||!Q)continue;let G=J[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=J[0].length,q=X.token.length-Q[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function x2($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let J=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=b2(Q);if(G)return{style:"as",iterable:J,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let J=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:K}=b2(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function b2($){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 J=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function N4($){return g8($)}function Lz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let J=X[1];if(J.startsWith("if"))Y++;else if(J==="endif")Y--;else if(Y===0)return!0}return!1}function Vz($){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,J;while((J=Y.exec($))!==null){let Q=J[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function wz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function y2($,Z,Y){if(!$)return!1;let X=wz($),J=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let j=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(S2.has(j))continue;if(Z.has(j))J=!0;else if(Y&&j in Y)Q=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(X))!==null){let j=z[1];if(X.slice(0,z.index).trimEnd().endsWith("."))continue;if(S2.has(j)||Y&&j in Y)continue;G=!0}return(J||G)&&!Q}function w4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,J=$.trim(),Q=J.match(C2);if(Q&&Rz(Q[3],Q[1])){let[,G,K,q]=Q;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${J}</template>`}function Rz($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,J;while((J=Y.exec($))!==null)if(J[1]){if(X--,X<0)return!1}else X++;return!0}function P3($,Z){let Y=Vz($);function X(J){let Q=J,G=/@if\s*\(/g,K,q=[];while((K=G.exec(Q))!==null){let W=K.index,z=W+K[0].length,U=1,j=z;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let H=Q.substring(z,j-1).trim(),B=j,_=1,O=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let L;while((L=F.exec(Q))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){O=L.index+L[0].length;break}}if(_!==0)continue;let V=Q.substring(B,O-6).trim(),w;if(Lz(V)){let R=U$(Q.substring(W,O));if(R.length===0)continue;let N=R[0].branches.filter((I)=>I.type!=="else");if(!(N.length>0&&N.every((I)=>y2(I.condition,Y,Z))))continue;w=R[0].branches.map((I)=>{let T=X(I.content);if(I.type==="elseif")return w4(T,"@else-if",I.condition??"");if(I.type==="else")return w4(T,"@else");return w4(T,"@if",I.condition??"")}).join(`
9882
9882
  `)}else{if(!y2(H,Y,Z))continue;w=w4(X(V),"@if",H)}q.push({start:W,end:O,replacement:w}),G.lastIndex=O}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:j}=q[W];Q=Q.substring(0,z)+j+Q.substring(U)}return Q}return X($)}function Nz($){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 J=Number(Z);return J!==0&&!Number.isNaN(J)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Az($,Z,Y,X){if(y3.has(Y.toLowerCase()))return X;let J=Y.toLowerCase(),Q=$.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 H=$.indexOf("-->",q+4);if(H===-1)return-1;q=H+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let H=$.indexOf(">",q);if(H===-1)return-1;if($[H-1]==="/"){q=H+1;continue}let B=Q.indexOf(`</${z[1].toLowerCase()}`,q);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;q=_+1;continue}if($[q+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!H){q++;continue}if(H[1].toLowerCase()===J){if(K--,q+=H[0].length,K===0)return q;continue}q+=H[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(U[1].toLowerCase()===J){let H=$.slice(q,j+1);if(!(/\/\s*>$/.test(H)||y3.has(J)))K++}q=j+1}return-1}function Tz($,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 J=$.indexOf(">",Y);if(J===-1)return!1;let Q=$.slice(Y,J+1);return Mz.test(Q)}function C3($){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 J=(U)=>Z.some(([j,H])=>U>=j&&U<H),Q=/<([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=Q.exec($))!==null){if(J(K.index))continue;let[U,j,H,B,_,O,F]=K,L=Nz(_);if(L===void 0)continue;let V=K.index,w=V+U.length,A=!!F||/\/\s*>$/.test(U)||y3.has(j.toLowerCase())?w:Az($,V,j,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Tz($,A)){Q.lastIndex=w;continue}if(L===!0){let I=`<${j}${H}${O}${F}>`;G.push({start:V,end:w,replacement:I});continue}G.push({start:V,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let q=[],W=-1;for(let U of G){if(U.start<W)continue;q.push(U),W=U.end}let z=$;for(let U=q.length-1;U>=0;U--){let{start:j,end:H,replacement:B}=q[U];z=z.substring(0,j)+B+z.substring(H)}return z}function v3($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,J,Q=[],G=[];while((J=X.exec(Y))!==null){let K=J[1],q=J.index,W=q+J[0].length,z=1,U=W;while(U<Y.length&&z>0){if(Y[U]==="(")z++;else if(Y[U]===")")z--;U++}if(z!==0)continue;let j=Y.substring(W,U-1).trim(),H=U,B=x2(j),_=K==="for"?"@endfor":"@endforeach",O=1,F=H,L=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");L.lastIndex=H;let V;while((V=L.exec(Y))!==null)if(V[1].startsWith(K))O++;else if(O--,O===0){F=V.index+V[0].length;break}if(O!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:F,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let I=M.split(/[.[(]/)[0].trim(),T=Z?I in Z:!1,k=G.some((D)=>q>D.start&&q<D.end&&D.vars.includes(I));if(I&&(T||k)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=Y.substring(H,F-_.length).trim(),N=R.match(C2),A;if(N){let[,M,I,T]=N;A=`<${M}${I} @for="${j}">${T}</${M}>`}else A=`<template @for="${j}">${R}</template>`;Q.push({start:q,end:F,replacement:A})}for(let K=Q.length-1;K>=0;K--){let{start:q,end:W,replacement:z}=Q[K];Y=Y.substring(0,q)+z+Y.substring(W)}return Y}function Iz($){let Z=new Set,Y=[],X=0,J=0,Q=$.length,G=(z)=>{let U=X+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===z)return U+1;U++}return Q},K=()=>{let z=X+2;while(z<Q&&$[z]!==`
9883
9883
  `)z++;return z},q=()=>{let z=X+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},W=(z)=>{let U=z,j=0;while(U<Q){let H=$[U];if(H==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
9884
- `)B++;U=B;continue}if(H==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}U=B;continue}if(H==="("||H==="["||H==="{"){j++,U++;continue}if(H===")"||H==="]"||H==="}"){j--,U++;continue}if(H===";"&&j===0)return U+1;U++}return Q};while(X<Q){let z=$[X];if(z==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(z==="/"&&$[X+1]==="*"){let U=q();Y.push($.slice(X,U)),X=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(X,U)),X=U;continue}if(z==="{"){J++,Y.push(z),X++;continue}if(z==="}"){J--,Y.push(z),X++;continue}if(J===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=W(X+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=_;continue}Z.add(B),Y.push($.slice(X,_)),X=_;continue}}}Y.push(z),X++}return Y.join("")}async function f2($,Z,Y){let X=v2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of X){let F=O.body;if(m1(O.attrs))F=d1(F);if(J.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Fz++}`,{hasUserImports:K,bundleClientScript:q}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5))),W=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=_5(F).code,K(F))F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>h2(w));let L=x0(F);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9884
+ `)B++;U=B;continue}if(H==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}U=B;continue}if(H==="("||H==="["||H==="{"){j++,U++;continue}if(H===")"||H==="]"||H==="}"){j--,U++;continue}if(H===";"&&j===0)return U+1;U++}return Q};while(X<Q){let z=$[X];if(z==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(z==="/"&&$[X+1]==="*"){let U=q();Y.push($.slice(X,U)),X=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(X,U)),X=U;continue}if(z==="{"){J++,Y.push(z),X++;continue}if(z==="}"){J--,Y.push(z),X++;continue}if(J===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=W(X+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=_;continue}Z.add(B),Y.push($.slice(X,_)),X=_;continue}}}Y.push(z),X++}return Y.join("")}async function f2($,Z,Y){let X=v2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[];for(let O of X){let F=O.body;if(m1(O.attrs))F=d1(F);if(J.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Fz++}`,{hasUserImports:K,bundleClientScript:q}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5))),W=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=_5(F).code,K(F))F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>h2(w));let L=x0(F);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9885
9885
  ${L}`)}let z=W.join(`
9886
9886
 
9887
9887
  `);z=Iz(z);let U=g2(z),j=U.split(",").map((O)=>O.trim()).filter(Boolean),H=n$(z,Y),B=`
@@ -9898,13 +9898,13 @@ if(window.stx)window.stx._latestSetup=${G};
9898
9898
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(J!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!X.has(V))Y.push(V),X.add(V);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[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(Q).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 L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){q(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function x3($,Z,Y,X){if(!N4($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await f2(J,Y,X);if(J=Q,J=await L4(J,Z),G){let z=R4(J,/<\/head>/i),U=z===-1?R4(J,/<body[^>]*>/i):-1;if(z!==-1)J=`${J.slice(0,z)}${G}
9899
9899
  ${J.slice(z)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(J.slice(U))[0],H=U+j.length;J=`${J.slice(0,H)}
9900
9900
  ${G}${J.slice(H)}`}else J=`${J}
9901
- ${G}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=R4(J,z);if(U!==-1){let j=J.slice(0,U),H=J.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=j+H}}return J}function R4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],J;while((J=Y.exec($))!==null)X.push([J.index,J.index+J[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function h2($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let J=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])Z.push(`${J[2]} = ${J[1]}`)}if(Z.length===0)return P2;return`var ${Z.join(", ")}; ${P2}`}var Fz=0,k2=`(?:"[^"]*"|'[^']*'|[^>"'])*`,C2,S2,y3,Mz,P2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var H$=b(()=>{X$();Q4();e0();$3();R0();V4();u1();r5();C2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;S2=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"]);y3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Mz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Dz from"fs";import f from"path";function kz($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let J={};for(let Q of Object.keys(X).sort())J[Q]=Y(X[Q]);return J};return JSON.stringify(Y($))}catch{return null}}function m2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function m1($){return!bz($)}function d1($){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,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Sz($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(z)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===z){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let z=1;while(J<Q&&z>0)if($[J]==="{")z++,J++;else if($[J]==="}")z--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},q=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
9902
- `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(X!==0)return;let z=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let B=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let U=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(J<Q){if(q())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return Z}function yz($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Pz($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Cz($,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 J=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let q of yz(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=Pz(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=W.slice(z+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[U]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function I4($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(O))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof J.root==="string"?f.resolve(J.root):void 0,U=z??f.dirname(X),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(J._rootComponentsDir),H(f.join(f.dirname(X),"components")),H(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(z)H(f.resolve(z,"resources/views/components")),H(f.resolve(z,"resources/components")),H(f.resolve(z,"src/components")),H(f.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(f.resolve(f.dirname(X),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(U,O);for(let L of W)if(await c(f.join(F,L)))return!0}return!1}function vz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function xz($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function fz($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let J;while((J=Y.exec(X))!==null)Z.add(J[1]);Y.lastIndex=0}return[...Z]}async function o1($,Z,Y,X,J,Q,G,K=new Set,q){let{extractVariables:W}=await a("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4))),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&vz(j)?j:"";try{let B=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=J.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],h=J.__originalFilePath,g=[];if(h){let U0=f.join(f.dirname(h),"components");g.push(U0)}if(X)g.push(X);let t=G._rootComponentsDir;if(typeof t==="string"&&!g.includes(t))g.push(t);let z0=f.join(f.dirname(Q),"components");if(!g.includes(z0))g.push(z0);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let Q1=G._pluginComponentDirs;if(Array.isArray(Q1)){for(let U0 of Q1)if(typeof U0==="string"&&!g.includes(U0))g.push(U0)}let S0=typeof G.root==="string"?f.resolve(G.root):void 0,v0=S0??f.dirname(Q),n0=[];if(S0)n0.push(f.resolve(S0,"resources/views/components")),n0.push(f.resolve(S0,"resources/components")),n0.push(f.resolve(S0,"src/components")),n0.push(f.resolve(S0,"components"));n0.push(f.resolve(import.meta.dir,"components"));for(let U0 of n0)if(!g.includes(U0))g.push(U0);let z5=[...new Set(g.map((U0)=>{if(!U0)return U0;return f.isAbsolute(U0)?U0:f.resolve(v0,U0)}))];g.length=0,g.push(...z5);let O1=`${O}\x00${Q}\x00${z5.join("\x00")}`,F1=T4.get(O1);if(F1)if(await c(F1))F=F1;else T4.delete(O1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let U0 of g){if(!U0)continue;for(let a0 of v){let i=f.join(U0,a0);if(V.push(i),await c(i)){F=i;break}}if(F)break;if(!F)try{let a0=await import("fs");if(!a0.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let t0=8,x1=[{path:U0,depth:0}];while(x1.length>0&&!F){let G1=x1.pop();if(G1.depth>=t0)continue;let C$;try{C$=a0.readdirSync(G1.path,{withFileTypes:!0})}catch{continue}for(let v$ of C$){if(!v$.isDirectory())continue;if(v$.name==="node_modules"||v$.name.startsWith("."))continue;let r9=f.join(G1.path,v$.name);for(let qK of v){let h7=f.join(r9,qK);if(V.push(h7),await c(h7)){F=h7;break}}if(F)break;x1.push({path:r9,depth:G1.depth+1})}}}catch{}if(F)break}if(F)T4.set(O1,F)}if(!F||!await c(F)){let E=V.length>0?`
9901
+ ${G}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=R4(J,z);if(U!==-1){let j=J.slice(0,U),H=J.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=j+H}}return J}function R4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],J;while((J=Y.exec($))!==null)X.push([J.index,J.index+J[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function h2($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let J=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])Z.push(`${J[2]} = ${J[1]}`)}if(Z.length===0)return P2;return`var ${Z.join(", ")}; ${P2}`}var Fz=0,k2=`(?:"[^"]*"|'[^']*'|[^>"'])*`,C2,S2,y3,Mz,P2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var H$=b(()=>{X$();Q4();$1();$3();R0();V4();u1();r5();C2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;S2=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"]);y3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Mz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Dz from"fs";import f from"path";function kz($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let J={};for(let Q of Object.keys(X).sort())J[Q]=Y(X[Q]);return J};return JSON.stringify(Y($))}catch{return null}}function m2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function m1($){return!bz($)}function d1($){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,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Sz($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(z)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===z){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let z=1;while(J<Q&&z>0)if($[J]==="{")z++,J++;else if($[J]==="}")z--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},q=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
9902
+ `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(X!==0)return;let z=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let B=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let U=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(J<Q){if(q())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return Z}function yz($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Pz($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Cz($,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 J=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let q of yz(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=Pz(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=W.slice(z+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[U]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function I4($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(O))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof J.root==="string"?f.resolve(J.root):void 0,U=z??f.dirname(X),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(J._rootComponentsDir),H(f.join(f.dirname(X),"components")),H(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(z)H(f.resolve(z,"resources/views/components")),H(f.resolve(z,"resources/components")),H(f.resolve(z,"src/components")),H(f.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(f.resolve(f.dirname(X),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(U,O);for(let L of W)if(await c(f.join(F,L)))return!0}return!1}function vz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function xz($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function fz($){let Z=new Set,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let X of $){let J;while((J=Y.exec(X))!==null)Z.add(J[1]);Y.lastIndex=0}return[...Z]}async function o1($,Z,Y,X,J,Q,G,K=new Set,q){let{extractVariables:W}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4))),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&vz(j)?j:"";try{let B=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=J.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],h=J.__originalFilePath,g=[];if(h){let U0=f.join(f.dirname(h),"components");g.push(U0)}if(X)g.push(X);let a=G._rootComponentsDir;if(typeof a==="string"&&!g.includes(a))g.push(a);let Y0=f.join(f.dirname(Q),"components");if(!g.includes(Y0))g.push(Y0);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let n0=G._pluginComponentDirs;if(Array.isArray(n0)){for(let U0 of n0)if(typeof U0==="string"&&!g.includes(U0))g.push(U0)}let S0=typeof G.root==="string"?f.resolve(G.root):void 0,v0=S0??f.dirname(Q),o0=[];if(S0)o0.push(f.resolve(S0,"resources/views/components")),o0.push(f.resolve(S0,"resources/components")),o0.push(f.resolve(S0,"src/components")),o0.push(f.resolve(S0,"components"));o0.push(f.resolve(import.meta.dir,"components"));for(let U0 of o0)if(!g.includes(U0))g.push(U0);let z5=[...new Set(g.map((U0)=>{if(!U0)return U0;return f.isAbsolute(U0)?U0:f.resolve(v0,U0)}))];g.length=0,g.push(...z5);let O1=`${O}\x00${Q}\x00${z5.join("\x00")}`,F1=T4.get(O1);if(F1)if(await c(F1))F=F1;else T4.delete(O1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let U0 of g){if(!U0)continue;for(let t0 of v){let i=f.join(U0,t0);if(V.push(i),await c(i)){F=i;break}}if(F)break;if(!F)try{let t0=await import("fs");if(!t0.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let e0=8,x1=[{path:U0,depth:0}];while(x1.length>0&&!F){let G1=x1.pop();if(G1.depth>=e0)continue;let C$;try{C$=t0.readdirSync(G1.path,{withFileTypes:!0})}catch{continue}for(let v$ of C$){if(!v$.isDirectory())continue;if(v$.name==="node_modules"||v$.name.startsWith("."))continue;let r9=f.join(G1.path,v$.name);for(let qK of v){let h7=f.join(r9,qK);if(V.push(h7),await c(h7)){F=h7;break}}if(F)break;x1.push({path:r9,depth:G1.depth+1})}}}catch{}if(F)break}if(F)T4.set(O1,F)}if(!F||!await c(F)){let E=V.length>0?`
9903
9903
  Searched paths:
9904
9904
  ${V.map((v)=>` - ${v}`).join(`
9905
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(F);let w;if(M4.has(F))w=M4.get(F);else try{w=await Bun.file(F).text(),M4.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",o$]),N={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||R.has(E))N[E]=v;let{extractSlotContent:A}=await a("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),M=A(Y),I={};if(M.defaultSlot?.trim())I.default=M.defaultSlot;for(let[E,v]of M.namedSlots)I[E]=v.content;let T={...N,...Z,props:Z,slot:Y,$slots:I,__processedComponents:U,__sections:{},__stx_signals_gate:z1(w)||xz(Y)};Cz(w,T);let k=w,D=$4(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,d=null;if(C){let E=kz({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=f3.get(x);if(v){for(let h of v.dependencies)q.add(h);return v.output}d=new Set(q)}}for(let E of y){let v=E[1]||"",h=E[2]||"",g=v.includes("server");if(m1(v)&&h.trim())h=d1(h);if(g&&h)try{await W(h,T,F)}catch(z0){}if(!g){let z0=h.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Q1=z0.includes("{{")&&z0.includes("}}"),S0=z0.includes("{!!")&&z0.includes("!!}");if(Q1||S0)z0=t$(z0,T);let v0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${v0}>${z0}</script>`)}}let u=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Y0=u?u[1]:"",d0=u?u[2]:"",V0="",i0=Y0&&/\bscoped\b/i.test(Y0);if(u)V0=`<style${Y0}>${d0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(h,g)=>{let t=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(t)v.push(`<style${t[1]}>${t[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)V0=`${V0}${v.join(`
9906
- `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:B0}=await a("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),{defaultSlot:u0,namedSlots:_1}=M;p=await B0(p,u0,_1,T);let q5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),W5=fz(S);if(W5.length>0)T.__stx_client_signal_names=W5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:q5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let r=await N0(p,T,F,n,q),K0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))K0.add(E[1].trim());if(K0.size>0)J.__stx_preserved_client_expressions=[...K0];let A0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++Ez}_${Math.random().toString(36).slice(2,8)}`,X0=r;if(q5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${m2(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${m2(H)}"`:"";X0=`<div data-stx-scope="${A0}"${E}${v}>${r}</div>`;let h=await Promise.all(S.map(async(g)=>{let t=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!t)return g;let[,z0,Q1]=t,S0=l$(Q1,{filePath:F,projectRoot:process.cwd()}),v0=S0.code,n0=c$(S0.styles);v0=_5(v0).code;let{hasUserImports:z5,bundleClientScript:O1}=await a("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(z5(v0))v0=await O1(v0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:F1}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));v0=v0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(G1,C$)=>F1(C$));let U0=x0(v0),a0=Sz(U0),i=`function(__scopeId) {
9907
- ${B5("const",[...f8,...a0],U0)}
9905
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(F);let w;if(M4.has(F))w=M4.get(F);else try{w=await Bun.file(F).text(),M4.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",o$]),N={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||R.has(E))N[E]=v;let{extractSlotContent:A}=await t("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),M=A(Y),I={};if(M.defaultSlot?.trim())I.default=M.defaultSlot;for(let[E,v]of M.namedSlots)I[E]=v.content;let T={...N,...Z,props:Z,slot:Y,$slots:I,__processedComponents:U,__sections:{},__stx_signals_gate:z1(w)||xz(Y)};Cz(w,T);let k=w,D=$4(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,d=null;if(C){let E=kz({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=f3.get(x);if(v){for(let h of v.dependencies)q.add(h);return v.output}d=new Set(q)}}for(let E of y){let v=E[1]||"",h=E[2]||"",g=v.includes("server");if(m1(v)&&h.trim())h=d1(h);if(g&&h)try{await W(h,T,F)}catch(Y0){}if(!g){let Y0=h.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),n0=Y0.includes("{{")&&Y0.includes("}}"),S0=Y0.includes("{!!")&&Y0.includes("!!}");if(n0||S0)Y0=t$(Y0,T);let v0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${v0}>${Y0}</script>`)}}let u=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),X0=u?u[1]:"",d0=u?u[2]:"",V0="",i0=X0&&/\bscoped\b/i.test(X0);if(u)V0=`<style${X0}>${d0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(h,g)=>{let a=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(a)v.push(`<style${a[1]}>${a[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)V0=`${V0}${v.join(`
9906
+ `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:B0}=await t("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),{defaultSlot:u0,namedSlots:_1}=M;p=await B0(p,u0,_1,T);let q5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),W5=fz(S);if(W5.length>0)T.__stx_client_signal_names=W5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:q5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let r=await N0(p,T,F,n,q),q0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))q0.add(E[1].trim());if(q0.size>0)J.__stx_preserved_client_expressions=[...q0];let A0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++Ez}_${Math.random().toString(36).slice(2,8)}`,J0=r;if(q5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${m2(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${m2(H)}"`:"";J0=`<div data-stx-scope="${A0}"${E}${v}>${r}</div>`;let h=await Promise.all(S.map(async(g)=>{let a=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!a)return g;let[,Y0,n0]=a,S0=l$(n0,{filePath:F,projectRoot:process.cwd()}),v0=S0.code,o0=c$(S0.styles);v0=_5(v0).code;let{hasUserImports:z5,bundleClientScript:O1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(z5(v0))v0=await O1(v0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:F1}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));v0=v0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(G1,C$)=>F1(C$));let U0=x0(v0),t0=Sz(U0),i=`function(__scopeId) {
9907
+ ${B5("const",[...f8,...t0],U0)}
9908
9908
  const __scope = window.stx._scopes = window.stx._scopes || {};
9909
9909
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
9910
9910
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -9922,7 +9922,7 @@ ${U0}
9922
9922
  // Register all defined signals and functions in this scope
9923
9923
  const __localVars = {};
9924
9924
  try {
9925
- ${a0.map((G1)=>`if (typeof ${G1} !== 'undefined') __localVars['${G1}'] = ${G1};`).join(`
9925
+ ${t0.map((G1)=>`if (typeof ${G1} !== 'undefined') __localVars['${G1}'] = ${G1};`).join(`
9926
9926
  `)}
9927
9927
  }
9928
9928
  catch (e) {}
@@ -9931,15 +9931,15 @@ catch (e) {}
9931
9931
  finally {
9932
9932
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
9933
9933
  }
9934
- }`,t0=H?null:_Z(J,i),x1=t0?`window.__stxComponentFactories[${JSON.stringify(t0)}](${JSON.stringify(A0)});`:`(${i})(${JSON.stringify(A0)});`;if(H)return`${n0}<script type="stx/island" data-stx-island="${A0}" data-stx-scoped${z0}>${x1}</script>`;return`${n0}<script data-stx-scoped data-stx-run="always"${z0}>${x1}</script>`}));if(X0=X0+`
9934
+ }`,e0=H?null:_Z(J,i),x1=e0?`window.__stxComponentFactories[${JSON.stringify(e0)}](${JSON.stringify(A0)});`:`(${i})(${JSON.stringify(A0)});`;if(H)return`${o0}<script type="stx/island" data-stx-island="${A0}" data-stx-scoped${Y0}>${x1}</script>`;return`${o0}<script data-stx-scoped data-stx-run="always"${Y0}>${x1}</script>`}));if(J0=J0+`
9935
9935
  `+h.join(`
9936
- `),V0)X0+=`
9937
- `+V0}else{if(V0)X0+=`
9938
- `+V0;if(S.length>0){let E=T.__stx_event_bindings||[],v=Z$(T),h=await Promise.all(S.map(async(g)=>{let t=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!t)return g;return await Y$(t[1],{eventBindings:E,templateContent:X0,filePath:F,projectRoot:process.cwd(),serverData:v})}));X0+=`
9936
+ `),V0)J0+=`
9937
+ `+V0}else{if(V0)J0+=`
9938
+ `+V0;if(S.length>0){let E=T.__stx_event_bindings||[],v=Z$(T),h=await Promise.all(S.map(async(g)=>{let a=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!a)return g;return await Y$(a[1],{eventBindings:E,templateContent:J0,filePath:F,projectRoot:process.cwd(),serverData:v})}));J0+=`
9939
9939
  `+h.join(`
9940
- `),T.__stx_event_bindings=[]}}if(i0){let E=e$(X0,F);if(E.hasScoped)X0=E.html}if(x&&d)f3.set(x,{output:X0,dependencies:[...q].filter((E)=>!d.has(E))});return X0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function g3($,Z){let Y=f.resolve(Z),X=f.resolve($),J=Y.endsWith(f.sep)?Y:Y+f.sep;if(X===Y||X.startsWith(J))return X;return null}async function h3($,Z,Y,X){let J=await gz($,Z,Y,X);if(J===null)return null;let Q=g3(J,process.cwd());if(Q)return Q;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=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(g3(J,q))return f.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function gz($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=g3(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await c(H)&&X)X.add(H);return H}let G=f.join(J,$);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 j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await c(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(X)X.add(H);return H}}let K="",q=f.resolve(J),W=process.cwd();for(let j=0;j<10;j++){let H=f.join(q,"layouts"),B=!1;try{B=Dz.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(q);if(_===q||_.length<W.length)break;q=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await c(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(X)X.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(X)X.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||J,"layouts",j[1]);if(await c(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(X)X.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await c(K)){let j=f.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${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 partials layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}}let z=Y.partialsDir||f.join(process.cwd(),"views"),U=f.join(z,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(J.includes("temp")){let j=f.join(f.dirname(J),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${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 temp layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}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 d2($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
9940
+ `),T.__stx_event_bindings=[]}}if(i0){let E=e$(J0,F);if(E.hasScoped)J0=E.html}if(x&&d)f3.set(x,{output:J0,dependencies:[...q].filter((E)=>!d.has(E))});return J0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function g3($,Z){let Y=f.resolve(Z),X=f.resolve($),J=Y.endsWith(f.sep)?Y:Y+f.sep;if(X===Y||X.startsWith(J))return X;return null}async function h3($,Z,Y,X){let J=await gz($,Z,Y,X);if(J===null)return null;let Q=g3(J,process.cwd());if(Q)return Q;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=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(g3(J,q))return f.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function gz($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=g3(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await c(H)&&X)X.add(H);return H}let G=f.join(J,$);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 j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await c(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(X)X.add(H);return H}}let K="",q=f.resolve(J),W=process.cwd();for(let j=0;j<10;j++){let H=f.join(q,"layouts"),B=!1;try{B=Dz.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(q);if(_===q||_.length<W.length)break;q=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await c(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(X)X.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(X)X.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||J,"layouts",j[1]);if(await c(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(X)X.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await c(K)){let j=f.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${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 partials layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}}let z=Y.partialsDir||f.join(process.cwd(),"views"),U=f.join(z,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(J.includes("temp")){let j=f.join(f.dirname(J),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${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 temp layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}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 d2($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
9941
9941
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,J=G[q].trim();let W=Math.max(0,q-2),z=Math.min(G.length,q+3);Q=G.slice(W,z).map((U,j)=>{let H=W+j+1;return`${H===X?"> ":" "}${H}: ${U}`}).join(`
9942
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return d2($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function W0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=d2(X,J,Q),q=Y.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&X){let U=X.lastIndexOf(`
9942
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return d2($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function z0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=d2(X,J,Q),q=Y.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&X){let U=X.lastIndexOf(`
9943
9943
  `,Math.max(0,J-1));W=J-(U+1)+1}let z="";if(G>0)z+=`
9944
9944
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
9945
9945
  `;if(z+=`
@@ -9952,8 +9952,8 @@ ${e.yellow}${e.bold}Message:${e.reset} ${Z}
9952
9952
  `,K)z+=`
9953
9953
  ${e.blue}${e.bold}Context:${e.reset}
9954
9954
  ${e.dim}${K}${e.reset}
9955
- `;return z}function T2(){M4.clear(),T4.clear(),f3.clear()}var M4,T4,f3,Ez=0,e;var R0=b(()=>{X$();G3();Z1();e0();V5();D4();V1();j3();B3();r5();uZ();z$();M4=new p1(500),T4=new p1(1000),f3=new p1(2000);e={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 u2($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,j=z,H=-1;while(U>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
9956
- `||L==="\r"||L===" "||L===void 0)U++;j=O+9}else{if(U--,U===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);J.push({fullMatch:_,options:W,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:q,content:W,index:z}of J)try{let U={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=s5(W.trim(),j);X=X.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=W0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,z,K);X=X.split(K).join(H)}return X}async function p2($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),s5($.trim(),J)}var m3=b(()=>{R0()});function dz($){if(hz.set($.name,$),$.client)mz.set($.name,$.client)}function E4($){return dz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=uz(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,J,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function uz($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;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 hz,mz;var d3=b(()=>{hz=new Map,mz=new Map});function u3($,Z=A5,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${O$($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function l2($,Z,Y=pz,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${O$($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function p3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function O$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function l3($){return lz[$]||"application/octet-stream"}var A5,pz,_$,lz;var c3=b(()=>{A5=[320,480,640,768,1024,1280,1536,1920,2560],pz=[1,1.5,2,3],_$=["avif","webp","jpeg"],lz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function iz(){try{return await import("ts-images")}catch{return null}}async function nz($,Z={}){let Y={...cz,...Z},X=await iz();if(X)try{return await oz($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return sz($,Y)}async function oz($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=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 J($)).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 sz($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<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(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function c2($,Z,Y={}){let X=Y.transitionDuration||300,J=Y.easing||"ease-out";return`
9955
+ `;return z}function T2(){M4.clear(),T4.clear(),f3.clear()}var M4,T4,f3,Ez=0,e;var R0=b(()=>{X$();G3();Y1();$1();V5();D4();V1();j3();B3();r5();uZ();z$();M4=new p1(500),T4=new p1(1000),f3=new p1(2000);e={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 u2($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,j=z,H=-1;while(U>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
9956
+ `||L==="\r"||L===" "||L===void 0)U++;j=O+9}else{if(U--,U===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);J.push({fullMatch:_,options:W,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:q,content:W,index:z}of J)try{let U={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=s5(W.trim(),j);X=X.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=z0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,z,K);X=X.split(K).join(H)}return X}async function p2($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),s5($.trim(),J)}var m3=b(()=>{R0()});function dz($){if(hz.set($.name,$),$.client)mz.set($.name,$.client)}function E4($){return dz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=uz(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,J,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function uz($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;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 hz,mz;var d3=b(()=>{hz=new Map,mz=new Map});function u3($,Z=A5,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${O$($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function l2($,Z,Y=pz,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${O$($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function p3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function O$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function l3($){return lz[$]||"application/octet-stream"}var A5,pz,_$,lz;var c3=b(()=>{A5=[320,480,640,768,1024,1280,1536,1920,2560],pz=[1,1.5,2,3],_$=["avif","webp","jpeg"],lz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function iz(){try{return await import("ts-images")}catch{return null}}async function nz($,Z={}){let Y={...cz,...Z},X=await iz();if(X)try{return await oz($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return sz($,Y)}async function oz($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=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 J($)).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 sz($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<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(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function c2($,Z,Y={}){let X=Y.transitionDuration||300,J=Y.easing||"ease-out";return`
9957
9957
  #${$} {
9958
9958
  --stx-img-transition-duration: ${X}ms;
9959
9959
  --stx-img-transition-easing: ${J};
@@ -9999,7 +9999,7 @@ ${e.dim}${K}${e.reset}
9999
9999
  filter: blur(0);
10000
10000
  transform: scale(1);
10001
10001
  }
10002
- `.trim();i3=new Map});import{createHash as s2}from"crypto";import{readFile as rz,stat as r2}from"fs/promises";async function k0($){try{let Z=await rz($);return s2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function o2($){return s2("sha256").update($).digest("hex").slice(0,16)}function k4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${o2($)}-${o2(Y)}`}async function o3($){try{return(await r2($)).mtimeMs}catch{return 0}}async function T0($){try{return await r2($),!0}catch{return!1}}var s1=()=>{};import{mkdir as az,readFile as tz,writeFile as ez,readdir as Vw,rm as $U,stat as ww}from"fs/promises";import{join as t2,dirname as ZU}from"path";async function YU($){try{await az($,{recursive:!0})}catch{}}function e2($,Z,Y){return t2($,Y,`${Z}.json`)}async function a2($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await o3(Z)!==$.srcMtime)return!1;return!0}async function b4($,Z,Y,X=s3){if(!X.enabled)return null;let J=k4($,Z),Q=M5.get(J);if(Q){if(await a2(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;M5.delete(J)}let G=e2(X.directory,J,Y);if(await T0(G))try{let K=await tz(G,"utf-8"),q=JSON.parse(K);if(await a2(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),M5.set(J,q),q.data}catch{}return null}async function S4($,Z,Y,X,J=s3){if(!J.enabled)return;let Q=k4($,Z),G=await k0($),K=await o3($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:k4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};M5.set(Q,q);let W=e2(J.directory,Q,X);try{await YU(ZU(W)),await ez(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function y4($,Z=s3){if($==="all")M5.clear();else M5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=t2(Z.directory,X);try{await $U(J,{recursive:!0,force:!0})}catch{}}}var M5,s3;var r3=b(()=>{s1();M5=new Map,s3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class C4{config;constructor($={}){this.config={...XU,...$}}async get($,Z){return b4($,Z,"image",this.config)}async set($,Z,Y){return S4($,Z,Y,"image",this.config)}async clear(){return y4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function a3($){if(!P4)P4=new C4($);else if($)P4.updateConfig($);return P4}async function v4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return a3(X).get($,Z)}async function x4($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return a3(J).set($,Z,Y)}async function $Y(){return a3().clear()}var XU,P4=null;var t3=b(()=>{r3();XU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as JU,basename as QU,extname as GU,join as KU}from"path";import{mkdir as qU}from"fs/promises";async function e3(){try{return await import("ts-images")}catch{return null}}function ZY($){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 WU($,Z){let Y=Z?ZY(Z):ZY("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 YY($,Z,Y){let X=await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await v4($,Z,Y);if(J)return J;try{let Q=JU($);if(!await T0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=WU(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await qU(K,{recursive:!0});let W=await k0(Q),z=QU($,GU($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},H=null;if(Z.transformations&&Z.transformations.length>0)H=await $6(Q,Z.transformations,X);for(let B of U){let _=G[B]||{},O=`${z}-${W}.${B}`,F=KU(K,O);try{let L=await X.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${q}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await x4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function XY($,Z,Y,X){let J=await e3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function $6($,Z,Y){let X=Y||await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var JY=b(()=>{s1();t3()});import{resolve as zU,basename as UU,extname as jU,join as BU}from"path";import{mkdir as HU}from"fs/promises";async function _U(){try{return await import("ts-images")}catch{return null}}async function QY($,Z,Y){let X=await _U();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=zU($);if(!await T0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||OU,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await HU(K,{recursive:!0});let W=await k0(J),z=UU($,jU($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${z}-${O}w-${W}.${B}`,L=BU(K,F),V=`${q}/${F}`;try{let w=U[B]?.quality||80;if(await T0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await X.processImage({input:J,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await X.generateThumbHash(J);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(J,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||FU(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function FU($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function GY($,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 OU;var KY=b(()=>{s1();OU=[320,480,640,768,1024,1280,1536,1920]});var qY={};o(qY,{setCachedImageResult:()=>x4,processImage:()=>YY,optimizeImage:()=>XY,getCachedImageResult:()=>v4,generateSrcset:()=>GY,generateResponsiveVariants:()=>QY,clearImageCache:()=>$Y,applyTransformations:()=>$6,ImageProcessorCache:()=>C4});var WY=b(()=>{JY();KY();t3()});async function LU(){try{return await Promise.resolve().then(() => (WY(),qY))}catch($){if(!zY)console.warn("[stx-media] Image processor not available, some features disabled:",$),zY=!0;return null}}async function f4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return NU(X,Y)}if(Y.processedResult?.processed)return J6($,Y.processedResult,Z);if(Y.responsiveVariants)return HY($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:q,widths:W=A5,dpr:z,formats:U=_$,quality:j=Z6,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":h4,decoding:V=g4,fetchpriority:w,objectFit:R,objectPosition:N,crossorigin:A,referrerpolicy:M}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return RU($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await i2(J,{strategy:B,..._}),C=c2(x,S,_)}catch{}let d=z!==void 0&&G!==void 0,u;if(d)u=wU($,x,S,Z);else u=await VU($,x,S,Z);let Y0;if(F){let i0=U.includes("webp")?"webp":U[0],p=u3(J,W,{...H,q:j},i0),B0=typeof q==="object"?p3(q):q||"100vw";Y0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${B0}" />`}let d0=[];if(!UY&&B!=="none")d0.push(n3),UY=!0;if(C)d0.push(C);let V0=O?BY(x):void 0;return{html:u,preloadLink:Y0,css:d0.length>0?d0.join(`
10002
+ `.trim();i3=new Map});import{createHash as s2}from"crypto";import{readFile as rz,stat as r2}from"fs/promises";async function k0($){try{let Z=await rz($);return s2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function o2($){return s2("sha256").update($).digest("hex").slice(0,16)}function k4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${o2($)}-${o2(Y)}`}async function o3($){try{return(await r2($)).mtimeMs}catch{return 0}}async function T0($){try{return await r2($),!0}catch{return!1}}var s1=()=>{};import{mkdir as az,readFile as tz,writeFile as ez,readdir as Vw,rm as $U,stat as ww}from"fs/promises";import{join as t2,dirname as ZU}from"path";async function YU($){try{await az($,{recursive:!0})}catch{}}function e2($,Z,Y){return t2($,Y,`${Z}.json`)}async function a2($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await o3(Z)!==$.srcMtime)return!1;return!0}async function b4($,Z,Y,X=s3){if(!X.enabled)return null;let J=k4($,Z),Q=M5.get(J);if(Q){if(await a2(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;M5.delete(J)}let G=e2(X.directory,J,Y);if(await T0(G))try{let K=await tz(G,"utf-8"),q=JSON.parse(K);if(await a2(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),M5.set(J,q),q.data}catch{}return null}async function S4($,Z,Y,X,J=s3){if(!J.enabled)return;let Q=k4($,Z),G=await k0($),K=await o3($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:k4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};M5.set(Q,q);let W=e2(J.directory,Q,X);try{await YU(ZU(W)),await ez(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function y4($,Z=s3){if($==="all")M5.clear();else M5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=t2(Z.directory,X);try{await $U(J,{recursive:!0,force:!0})}catch{}}}var M5,s3;var r3=b(()=>{s1();M5=new Map,s3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class C4{config;constructor($={}){this.config={...XU,...$}}async get($,Z){return b4($,Z,"image",this.config)}async set($,Z,Y){return S4($,Z,Y,"image",this.config)}async clear(){return y4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function a3($){if(!P4)P4=new C4($);else if($)P4.updateConfig($);return P4}async function v4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return a3(X).get($,Z)}async function x4($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return a3(J).set($,Z,Y)}async function $Y(){return a3().clear()}var XU,P4=null;var t3=b(()=>{r3();XU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as JU,basename as QU,extname as GU,join as KU}from"path";import{mkdir as qU}from"fs/promises";async function e3(){try{return await import("ts-images")}catch{return null}}function ZY($){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 WU($,Z){let Y=Z?ZY(Z):ZY("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 YY($,Z,Y){let X=await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await v4($,Z,Y);if(J)return J;try{let Q=JU($);if(!await T0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=WU(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await qU(K,{recursive:!0});let W=await k0(Q),z=QU($,GU($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},H=null;if(Z.transformations&&Z.transformations.length>0)H=await $6(Q,Z.transformations,X);for(let B of U){let _=G[B]||{},O=`${z}-${W}.${B}`,F=KU(K,O);try{let L=await X.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${q}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await x4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function XY($,Z,Y,X){let J=await e3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function $6($,Z,Y){let X=Y||await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var JY=b(()=>{s1();t3()});import{resolve as zU,basename as UU,extname as jU,join as BU}from"path";import{mkdir as HU}from"fs/promises";async function _U(){try{return await import("ts-images")}catch{return null}}async function QY($,Z,Y){let X=await _U();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=zU($);if(!await T0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||OU,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await HU(K,{recursive:!0});let W=await k0(J),z=UU($,jU($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${z}-${O}w-${W}.${B}`,L=BU(K,F),V=`${q}/${F}`;try{let w=U[B]?.quality||80;if(await T0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await X.processImage({input:J,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await X.generateThumbHash(J);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(J,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||FU(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function FU($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function GY($,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 OU;var KY=b(()=>{s1();OU=[320,480,640,768,1024,1280,1536,1920]});var qY={};o(qY,{setCachedImageResult:()=>x4,processImage:()=>YY,optimizeImage:()=>XY,getCachedImageResult:()=>v4,generateSrcset:()=>GY,generateResponsiveVariants:()=>QY,clearImageCache:()=>$Y,applyTransformations:()=>$6,ImageProcessorCache:()=>C4});var WY=b(()=>{JY();KY();t3()});async function LU(){try{return await Promise.resolve().then(() => (WY(),qY))}catch($){if(!zY)console.warn("[stx-media] Image processor not available, some features disabled:",$),zY=!0;return null}}async function f4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return NU(X,Y)}if(Y.processedResult?.processed)return J6($,Y.processedResult,Z);if(Y.responsiveVariants)return HY($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:q,widths:W=A5,dpr:z,formats:U=_$,quality:j=Z6,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":h4,decoding:V=g4,fetchpriority:w,objectFit:R,objectPosition:N,crossorigin:A,referrerpolicy:M}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return RU($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await i2(J,{strategy:B,..._}),C=c2(x,S,_)}catch{}let d=z!==void 0&&G!==void 0,u;if(d)u=wU($,x,S,Z);else u=await VU($,x,S,Z);let X0;if(F){let i0=U.includes("webp")?"webp":U[0],p=u3(J,W,{...H,q:j},i0),B0=typeof q==="object"?p3(q):q||"100vw";X0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${B0}" />`}let d0=[];if(!UY&&B!=="none")d0.push(n3),UY=!0;if(C)d0.push(C);let V0=O?BY(x):void 0;return{html:u,preloadLink:X0,css:d0.length>0?d0.join(`
10003
10003
  `):void 0,script:V0}}async function VU($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:q,widths:W=A5,formats:z=_$,quality:U=Z6,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":h4,decoding:O=g4,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,N=$.class,A=$.style,M=$.data||{},I=typeof q==="object"?p3(q):q||"100vw",T=[];for(let P of z){let y=u3(J,W,{...j,q:U},P),S=l3(P);if(H&&!B)T.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else T.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let k=Y6({src:O$(J,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R,className:jY(N,Y),style:X6(A,L,V,Y),lazy:H&&!B,data:M}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
10004
10004
  <picture>
10005
10005
  ${T.join(`
@@ -10012,7 +10012,7 @@ ${T.join(`
10012
10012
  <img ${k} />
10013
10013
  </picture>`;return D}function wU($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,dpr:q=[1,2,3],quality:W=Z6,params:z={},lazy:U=!0,priority:j=!1,loading:H=j?"eager":h4,decoding:B=g4,fetchpriority:_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,w=$.class,R=$.style,N=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),M=l2(J,A,q,{...z,q:W}),I=Y6({src:O$(J,{...z,w:A,q:W}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:jY(w,Y),style:X6(R,O,F,Y),lazy:U&&!j,data:N}),T=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
10014
10014
  <img ${I} ${T} />
10015
- </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function RU($){let{src:Z,alt:Y,width:X,height:J,loading:Q=h4,decoding:G=g4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${Y6({src:Z,alt:Y,width:X,height:J,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:H,style:X6(B,q,W),id:_,data:O})} />`}}function Y6($){let Z=[];if($.lazy)Z.push(`data-src="${s0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${s0($.src)}"`);if(Z.push(`alt="${s0($.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="${s0($.className)}"`);if($.style)Z.push(`style="${s0($.style)}"`);if($.id)Z.push(`id="${s0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${s0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function jY($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function X6($,Z,Y,X){let J=[];if(Z)J.push(`object-fit: ${Z}`);if(Y)J.push(`object-position: ${Y}`);if(X)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function s0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BY($){return`
10015
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function RU($){let{src:Z,alt:Y,width:X,height:J,loading:Q=h4,decoding:G=g4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${Y6({src:Z,alt:Y,width:X,height:J,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:H,style:X6(B,q,W),id:_,data:O})} />`}}function Y6($){let Z=[];if($.lazy)Z.push(`data-src="${r0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${r0($.src)}"`);if(Z.push(`alt="${r0($.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="${r0($.className)}"`);if($.style)Z.push(`style="${r0($.style)}"`);if($.id)Z.push(`id="${r0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${r0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function jY($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function X6($,Z,Y,X){let J=[];if(Z)J.push(`object-fit: ${Z}`);if(Y)J.push(`object-position: ${Y}`);if(X)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function r0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BY($){return`
10016
10016
  (function() {
10017
10017
  const container = document.getElementById('${$}');
10018
10018
  if (!container) return;
@@ -10049,7 +10049,7 @@ ${T.join(`
10049
10049
 
10050
10050
  observer.observe(container);
10051
10051
  })();
10052
- `.trim()}async function NU($,Z){let Y=await LU();if(!Y)return f4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return HY($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return J6($,Q,Z)}return f4({...$,process:!1},Z)}async function J6($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],N=["avif","webp","jpeg","png"];for(let C of N){let x=w.get(C);if(x&&x.length>0){let d=x.map((Y0)=>`${Y0.url} ${Y0.width}w`).join(", "),u=l3(C);if(G&&!K)R.push(` <source type="${u}" data-srcset="${d}" />`);else R.push(` <source type="${u}" srcset="${d}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${s0(L)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)A.push(`data-srcset="${V}"`)}else if(A.push(`src="${s0(L)}"`),V)A.push(`srcset="${V}"`);A.push(`alt="${s0(X)}"`);let M=J||Z.originalWidth,I=Q||Z.originalHeight;if(M)A.push(`width="${M}"`);if(I)A.push(`height="${I}"`);if(!K)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),K)A.push('fetchpriority="high"');if(z)A.push(`crossorigin="${z}"`);if(U)A.push(`referrerpolicy="${U}"`);let T=[];if(q)T.push(`object-fit: ${q}`);if(W)T.push(`object-position: ${W}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)A.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)A.push(`class="${k.join(" ")}"`);if(G&&!K)A.push("data-stx-lazy");for(let[C,x]of Object.entries(_))A.push(`data-${C}="${s0(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
10052
+ `.trim()}async function NU($,Z){let Y=await LU();if(!Y)return f4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return HY($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return J6($,Q,Z)}return f4({...$,process:!1},Z)}async function J6($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],N=["avif","webp","jpeg","png"];for(let C of N){let x=w.get(C);if(x&&x.length>0){let d=x.map((X0)=>`${X0.url} ${X0.width}w`).join(", "),u=l3(C);if(G&&!K)R.push(` <source type="${u}" data-srcset="${d}" />`);else R.push(` <source type="${u}" srcset="${d}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${r0(L)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)A.push(`data-srcset="${V}"`)}else if(A.push(`src="${r0(L)}"`),V)A.push(`srcset="${V}"`);A.push(`alt="${r0(X)}"`);let M=J||Z.originalWidth,I=Q||Z.originalHeight;if(M)A.push(`width="${M}"`);if(I)A.push(`height="${I}"`);if(!K)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),K)A.push('fetchpriority="high"');if(z)A.push(`crossorigin="${z}"`);if(U)A.push(`referrerpolicy="${U}"`);let T=[];if(q)T.push(`object-fit: ${q}`);if(W)T.push(`object-position: ${W}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)A.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)A.push(`class="${k.join(" ")}"`);if(G&&!K)A.push("data-stx-lazy");for(let[C,x]of Object.entries(_))A.push(`data-${C}="${r0(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
10053
10053
  <picture>
10054
10054
  ${R.join(`
10055
10055
  `)}
@@ -10672,8 +10672,8 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
10672
10672
  `)}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 J=`${this.formatEntry($)}
10673
10673
  `;Z.appendFileSync(this.logFilePath,J,"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}`,J=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,J)}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 J=Y.level||"error";Z[J]=(Z[J]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),J=(await import("path")).dirname($);if(!Y.existsSync(J))Y.mkdirSync(J,{recursive:!0});if(Z==="json"){let Q=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(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
10674
10674
 
10675
- `),"utf-8")}}async flush(){await this.writeQueue}}var N6,r0,M6;var cY=b(()=>{X7();N6={isEnabled(){return e4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=e4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],J=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(J>Q){let K=J-Q;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 z=q-W;for(let U=0;U<z;U++)Y+=`
10676
- @end${K}`;X.push(`Added ${z} 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(L$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};r0=new A6,M6={isDevelopment(){return L$()},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(`
10675
+ `),"utf-8")}}async flush(){await this.writeQueue}}var N6,a0,M6;var cY=b(()=>{X7();N6={isEnabled(){return e4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=e4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],J=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(J>Q){let K=J-Q;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 z=q-W;for(let U=0;U<z;U++)Y+=`
10676
+ @end${K}`;X.push(`Added ${z} 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(L$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};a0=new A6,M6={isDevelopment(){return L$()},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(`
10677
10677
  `)}}});var iY=()=>{};var nY=b(()=>{a4();lY();cY();iY();X7()});var U1=b(()=>{nY()});function oY($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,j=z.length>1?z[1]:"";if(j&&Z[j])W=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${l(U)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=J.substring(q+1,z).trim(),j=z+1,H=(()=>{try{let B=O0(U,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${l(String(B.name))}"`;if(B.property)_+=` property="${l(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)_+=` content="${l(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return $0("MetaTag",_,s.EVALUATION_ERROR)}})();J=J.substring(0,K)+H+J.substring(j),Q.lastIndex=0}return J}function sY($,Z,Y){let X=$,J=/@structuredData\s*\(/g,Q;while((Q=J.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)break;let z=X.substring(K+1,W).trim(),U=W+1,j=(()=>{try{let H=O0(z,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return $0("StructuredData",B,s.EVALUATION_ERROR)}})();X=X.substring(0,G)+j+X.substring(U),J.lastIndex=0}return X}function rY($,Z,Y,X){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let K=J.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<J.length&&q>0){let F=J[W];if(U){U=!1,W++;continue}if(F==="\\"&&z){U=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let j=J.substring(W).match(/^\s*\)/);if(!j)break;let H=W+j[0].length,B=J.substring(K,W),_=J.substring(G.index,H),O=((F)=>{try{let L=O0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${l(L.title)}</title>
10678
10678
  `,V+=`<meta name="title" content="${l(L.title)}">
10679
10679
  `;if(L.description)V+=`<meta name="description" content="${l(L.description)}">
@@ -10765,7 +10765,7 @@ ${z}
10765
10765
  customElements.define('${Z}', ${G});
10766
10766
  `}async function $X($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[V$.join(V$.dirname(X),G,`${J}.stx`),V$.join(process.cwd(),G,`${J}.stx`),V$.join(V$.dirname(X),`${J}.stx`)],q=null;for(let U of K)if(await c(U)){q=await Bun.file(U).text();break}if(!q)return $0("WebComponent",`Component file not found: ${J}.stx`,s.FILE_NOT_FOUND);let W=Kj(q,J);return`<script type="module">
10767
10767
  ${qj(W)}
10768
- </script>`}var ZX=b(()=>{U1();R0()});var YX={};o(YX,{timingPlugin:()=>Bj,pluginManager:()=>Wj,definePlugin:()=>J7,debugPlugin:()=>jj,createVariablesPlugin:()=>Hj,createFilterPlugin:()=>Uj,createDirectivePlugin:()=>zj,PluginManager:()=>I6});function J7($){return $}class I6{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 J=X[$];if(J)try{let Q=await J(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(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 "${J.name}" ${$} hook:`,G)}}return X}}function zj($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function Uj($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Hj($){return J7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Wj,jj,Bj;var XX=b(()=>{Wj=new I6;jj=J7({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)}}),Bj=J7({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 KX={};o(KX,{validateConfig:()=>Rj,resolveStxDirectories:()=>GX,loadStxConfig:()=>D1,defineStxConfig:()=>wj,defaultConfig:()=>t1,config:()=>e5});import Q7 from"fs";import g0 from"path";import{loadConfigWithResult as _j}from"bunfig";function Oj($,Z,Y){let X=Z||"pages";if($)return{root:$,pagesDir:X};let J=Y||process.cwd(),Q=g0.join(J,"resources","views"),G=g0.join(J,"resources","layouts");if(Q7.existsSync(Q)&&Q7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=g0.join(J,"resources","views","pages");if(Q7.existsSync(K))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}function Fj($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let X=$.replace(/\\/g,"/"),J=Y.replace(/\\/g,"/");return X===J||X.startsWith(`${J}/`)}function GX($,Z){let Y=!$.root,X=Oj($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,Y&&X.root!=="."){let J=`${Z}::${X.root}`;if(!JX.has(J))JX.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let J=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(g0.isAbsolute(G)||Fj(G,J))continue;$[Q]=g0.join(J,G)}}return $}function Lj($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let X of Y){let J=$[X];if(typeof J!=="string"||!J)continue;let Q=g0.isAbsolute(J)?J:g0.join(Z,J);if(Q7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${J}"`+(K?`, resolved under root "${G}".`:"."))}}function Vj($){if(V8($.stateDir),$.stateDir=i5(),$.cachePath=o5($.cachePath),$.build)$.build.cacheDir=o5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=o5($.media.cache.directory);if($.story)$.story.outDir=o5($.story.outDir)}async function D1($){if(!$){if(I5)return I5;if(G7)return G7}let Z=$?g0.resolve($):process.cwd(),Y=QX.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await _j({name:"stx",alias:"ui",cwd:Z,defaultConfig:t1,verbose:!1})).config;if(Vj(Q),GX(Q,Z),Lj(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (XX(),YX)),K=[],q=[];for(let W of Q.plugins){let z=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,H;try{j=await import(z),H=g0.dirname(q0.resolve(z))}catch{let _=g0.resolve(process.cwd(),z);j=await import(_),H=g0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(g0.resolve(H,O))}if(B.pages){let _=g0.resolve(H,B.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(U,_)}console.log(`[stx] Plugin loaded: ${B.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=q}return Q})();if(QX.set(Z,X),!$)G7=X,X.then((J)=>{I5=J}).catch(()=>{});return X}function wj($){return $}function Rj($){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,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].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,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].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((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))Z.push({path:`pwa.routes[${Q}].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((J)=>typeof J!=="number"||J<16||J>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((Q)=>!X.includes(Q)).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 t1,JX,I5=null,QX,G7=null,e5;var w1=b(()=>{c7();i7();n7();o7();m3();FY();F6();V6();T6();u$();ZX();t1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:j5,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:p2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:$X,hasEndTag:!1,description:"Include a web component in the template"},N8,A8,tY,eY,M8,I8,D8,T8,S8,C8,OY,O6,...L6],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:"main",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}};JX=new Set;QX=new Map;e5=new Proxy(t1,{get($,Z){if(I5&&Z in I5)return I5[Z];if(!G7)D1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import G0 from"path";import{hasLocalConfig as Nj}from"bunfig";function q7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function E6($,Z){if(e1.has($))e1.delete($);else if(e1.size>=zX)e1.delete(e1.keys().next().value);e1.set($,Z)}function Aj($){let Z=q7($);if(D5.has(Z))D5.delete(Z);else if(D5.size>=zX)D5.delete(D5.keys().next().value);return D5.set(Z,$),Z}async function Mj($){if(!b1)return null;try{let Z=Bun.file(G0.join(b1,`cw-${q7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Tj($,Z){if(!b1)return;try{if(!fs.existsSync(b1))fs.mkdirSync(b1,{recursive:!0});await Bun.write(G0.join(b1,`cw-${q7($)}.css`),Z)}catch{}}async function WX($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function Ij(){let $=[],Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);return $}function Dj(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function Ej(){if(qX)return j1;qX=!0;try{let $=async(J)=>{for(let Q of J){if(!await Bun.file(Q).exists())continue;let G=await WX(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let J=G0.resolve(process.env.CROSSWIND_SRC),Q=await $([J]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return j1=Q,j1}let Z=await $(Ij());if(Z)return j1=Z,j1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Y){let Q=await WX(J);if(Q){if(j1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded`);return j1}}let X=await $(Dj());if(X)return j1=X,j1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${w0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${w0.reset}`),console.warn(`${w0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${w0.reset}`),null}}async function kj($){try{if(!Nj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=G0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${w0.yellow}[Crosswind]${w0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function bj($){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 J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[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())}Q=J.exec($)}return Z}async function Sj($,Z){try{let Y=await Ej();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):bj($);if(X.size===0)return"";let J=Z?G0.resolve(Z):process.cwd();if(!b1)b1=n5(J,"cache");let Q=[...X].sort().join(" "),G=`${D6||"default"}::${Q}`,K=e1.get(G);if(K!==void 0)return E6(G,K),K;let q=await Mj(G);if(q!==null)return E6(G,q),q;if(!K7){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (w1(),KX)),N=await R(J);if(N.css)if(typeof N.css==="string"){let A=G0.isAbsolute(N.css)?N.css:G0.resolve(J,N.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(w={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let A=G0.isAbsolute(N.css.config)?N.css.config:G0.resolve(J,N.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${w0.green}[Crosswind]${w0.reset} Using inline CSS config from stx.config.ts`)}}catch{}K7=w||await kj(J);try{D6=q7(JSON.stringify(K7??{}))}catch{D6="unhashable"}}let W=Y.defaultConfig||Y.config,z=K7||{},U=F8(W,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of X)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||z.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!X.has(w)&&!j.includes(w))continue;let N=R.split(/\s+/).filter(Boolean);for(let A of N)O.generate(A)}F=O.toCSS(H,B);let V=F.split(`
10768
+ </script>`}var ZX=b(()=>{U1();R0()});var YX={};o(YX,{timingPlugin:()=>Bj,pluginManager:()=>Wj,definePlugin:()=>J7,debugPlugin:()=>jj,createVariablesPlugin:()=>Hj,createFilterPlugin:()=>Uj,createDirectivePlugin:()=>zj,PluginManager:()=>I6});function J7($){return $}class I6{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 J=X[$];if(J)try{let Q=await J(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(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 "${J.name}" ${$} hook:`,G)}}return X}}function zj($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function Uj($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Hj($){return J7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Wj,jj,Bj;var XX=b(()=>{Wj=new I6;jj=J7({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)}}),Bj=J7({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 KX={};o(KX,{validateConfig:()=>Rj,resolveStxDirectories:()=>GX,loadStxConfig:()=>D1,defineStxConfig:()=>wj,defaultConfig:()=>t1,config:()=>e5});import Q7 from"fs";import g0 from"path";import{loadConfigWithResult as _j}from"bunfig";function Oj($,Z,Y){let X=Z||"pages";if($)return{root:$,pagesDir:X};let J=Y||process.cwd(),Q=g0.join(J,"resources","views"),G=g0.join(J,"resources","layouts");if(Q7.existsSync(Q)&&Q7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=g0.join(J,"resources","views","pages");if(Q7.existsSync(K))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}function Fj($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let X=$.replace(/\\/g,"/"),J=Y.replace(/\\/g,"/");return X===J||X.startsWith(`${J}/`)}function GX($,Z){let Y=!$.root,X=Oj($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,Y&&X.root!=="."){let J=`${Z}::${X.root}`;if(!JX.has(J))JX.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let J=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(g0.isAbsolute(G)||Fj(G,J))continue;$[Q]=g0.join(J,G)}}return $}function Lj($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let X of Y){let J=$[X];if(typeof J!=="string"||!J)continue;let Q=g0.isAbsolute(J)?J:g0.join(Z,J);if(Q7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${J}"`+(K?`, resolved under root "${G}".`:"."))}}function Vj($){if(V8($.stateDir),$.stateDir=i5(),$.cachePath=o5($.cachePath),$.build)$.build.cacheDir=o5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=o5($.media.cache.directory);if($.story)$.story.outDir=o5($.story.outDir)}async function D1($){if(!$){if(I5)return I5;if(G7)return G7}let Z=$?g0.resolve($):process.cwd(),Y=QX.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await _j({name:"stx",alias:"ui",cwd:Z,defaultConfig:t1,verbose:!1})).config;if(Vj(Q),GX(Q,Z),Lj(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (XX(),YX)),K=[],q=[];for(let W of Q.plugins){let z=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,H;try{j=await import(z),H=g0.dirname(W0.resolve(z))}catch{let _=g0.resolve(process.cwd(),z);j=await import(_),H=g0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(g0.resolve(H,O))}if(B.pages){let _=g0.resolve(H,B.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(U,_)}console.log(`[stx] Plugin loaded: ${B.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=q}return Q})();if(QX.set(Z,X),!$)G7=X,X.then((J)=>{I5=J}).catch(()=>{});return X}function wj($){return $}function Rj($){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,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].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,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].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((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))Z.push({path:`pwa.routes[${Q}].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((J)=>typeof J!=="number"||J<16||J>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((Q)=>!X.includes(Q)).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 t1,JX,I5=null,QX,G7=null,e5;var w1=b(()=>{c7();i7();n7();o7();m3();FY();F6();V6();T6();u$();ZX();t1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:j5,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:p2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:$X,hasEndTag:!1,description:"Include a web component in the template"},N8,A8,tY,eY,M8,I8,D8,T8,S8,C8,OY,O6,...L6],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:"main",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}};JX=new Set;QX=new Map;e5=new Proxy(t1,{get($,Z){if(I5&&Z in I5)return I5[Z];if(!G7)D1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import K0 from"path";import{hasLocalConfig as Nj}from"bunfig";function q7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function E6($,Z){if(e1.has($))e1.delete($);else if(e1.size>=zX)e1.delete(e1.keys().next().value);e1.set($,Z)}function Aj($){let Z=q7($);if(D5.has(Z))D5.delete(Z);else if(D5.size>=zX)D5.delete(D5.keys().next().value);return D5.set(Z,$),Z}async function Mj($){if(!b1)return null;try{let Z=Bun.file(K0.join(b1,`cw-${q7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Tj($,Z){if(!b1)return;try{if(!fs.existsSync(b1))fs.mkdirSync(b1,{recursive:!0});await Bun.write(K0.join(b1,`cw-${q7($)}.css`),Z)}catch{}}async function WX($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function Ij(){let $=[],Z=process.cwd();while(Z!==K0.dirname(Z))$.push(K0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(K0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=K0.dirname(Z);return $}function Dj(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[K0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function Ej(){if(qX)return j1;qX=!0;try{let $=async(J)=>{for(let Q of J){if(!await Bun.file(Q).exists())continue;let G=await WX(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded from ${K0.dirname(K0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let J=K0.resolve(process.env.CROSSWIND_SRC),Q=await $([J]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return j1=Q,j1}let Z=await $(Ij());if(Z)return j1=Z,j1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Y){let Q=await WX(J);if(Q){if(j1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded`);return j1}}let X=await $(Dj());if(X)return j1=X,j1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${w0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${w0.reset}`),console.warn(`${w0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${w0.reset}`),null}}async function kj($){try{if(!Nj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=K0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${w0.yellow}[Crosswind]${w0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function bj($){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 J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[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())}Q=J.exec($)}return Z}async function Sj($,Z){try{let Y=await Ej();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):bj($);if(X.size===0)return"";let J=Z?K0.resolve(Z):process.cwd();if(!b1)b1=n5(J,"cache");let Q=[...X].sort().join(" "),G=`${D6||"default"}::${Q}`,K=e1.get(G);if(K!==void 0)return E6(G,K),K;let q=await Mj(G);if(q!==null)return E6(G,q),q;if(!K7){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (w1(),KX)),N=await R(J);if(N.css)if(typeof N.css==="string"){let A=K0.isAbsolute(N.css)?N.css:K0.resolve(J,N.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(w={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let A=K0.isAbsolute(N.css.config)?N.css.config:K0.resolve(J,N.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${w0.green}[Crosswind]${w0.reset} Using inline CSS config from stx.config.ts`)}}catch{}K7=w||await kj(J);try{D6=q7(JSON.stringify(K7??{}))}catch{D6="unhashable"}}let W=Y.defaultConfig||Y.config,z=K7||{},U=F8(W,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of X)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||z.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!X.has(w)&&!j.includes(w))continue;let N=R.split(/\s+/).filter(Boolean);for(let A of N)O.generate(A)}F=O.toCSS(H,B);let V=F.split(`
10769
10769
  `);for(let[w,R]of Object.entries(L)){if(!X.has(w)&&!j.includes(w))continue;let N=R.split(/\s+/).filter(Boolean),A=[],M=[];for(let I of N){let T=I.startsWith("dark:"),P=`.${(T?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let S=V[y].trim();if(S===`${P} {`||S.startsWith(`${P} {`)){let C=y,x="";while(C<V.length){if(x+=V[C],V[C].includes("}"))break;C++}let d=x.match(/\{([^}]+)\}/);if(d)if(T)M.push(d[1].trim());else A.push(d[1].trim());break}}}if(A.length)F+=`
10770
10770
  .${w} { ${A.join(" ")} }`;if(M.length)F+=`
10771
10771
  @media (prefers-color-scheme: dark) { .dark .${w} { ${M.join(" ")} } }`}return E6(G,F),Tj(G,F),F}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function UX($,Z,Y=!1){let X=await Sj($,Z);if(!X)return $;let J=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Aj(X)}.css">`:`<style data-crosswind="generated">
@@ -11551,10 +11551,10 @@ window.__stx_reactive = (function() {
11551
11551
  ${nj()}
11552
11552
  ${Y}
11553
11553
  </script>`}function IX($,Z,Y){if(TX=0,!rj($))return $;let X=pj($);if(X.length===0)return $;let J=sj($,X),Q=oj(X,Z),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
11554
- `+J.slice(G);else J+=Q;return J}function sj($,Z){let Y=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,Q,G)=>{let K=Z[Y++];if(!K)return J;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return K.id=q[1],K.selector=`[data-stx-scope="${K.id}"]`,J;return`<${Q} data-stx-scope="${K.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),X=X.replace(/\s*x-init\s*=\s*'[^']*'/g,""),X}function rj($){return/x-data\s*=\s*["']/.test($)}var TX=0,uj=0;var DX=b(()=>{Z1()});import aj from"fs";import b6 from"path";import{createHighlighter as tj}from"ts-syntax-highlighter";async function ej($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await aj.promises.stat($)).mtime.getTime();if(Z.cache&&S6.has($)){let U=S6.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let J=await Bun.file($).text(),{data:Q,content:G}=x8(J),K=Z.markdown||e5.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=s5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await $B(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:Q||{}};if(Z.cache)S6.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function $B($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W7)try{W7=await tj({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!W7.getSupportedLanguages().includes(j))return K;return(await W7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${W}:`,H)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[q,W,z,U]=K,j=await J(q,W,z,U);Q=Q.replace(q,j)}return Q}async function EX($,Z,Y="",X={}){return await ZB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!b6.isAbsolute(K))z=b6.resolve(b6.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),N=V.substring(w+1).trim(),A=N.startsWith('"')&&N.endsWith('"'),M=N.startsWith("'")&&N.endsWith("'");if(A||M)N=N.substring(1,N.length-1);U[R]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await ej(z,X),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(z){let U=z instanceof Error?z.message:String(z);return W0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function ZB($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],q=J.index,W=J;X.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let Q=await Promise.all(X);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var S6,W7=null;var kX=b(()=>{w1();R0();S6=new Map});function S1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var bX=b(()=>{F0()});function YB($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=R3(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let j;if(U.value&&J0(U.value))j=Q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Z0(U.value,Z);if(q===j){W=U.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function XB($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function JB($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,X)=>Z[Number(X)]??Y)}function $5($,Z,Y){let{masked:X,scripts:J}=XB($);return JB(QB(X,Z,Y),J)}function QB($,Z,Y){let X=$;X=YB(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=I1(X,K+7);if(!q)break;let W=q.endPos,z=i1(X,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(W,z),j=q.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((R,N)=>R.pos-N.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=U.slice(0,H),O=U.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${U}@endif`;X=X.substring(0,K)+B+X.substring(z+10),Q=!0}}X=P6(X,Z,Y),X=C6(X,Z,Y),X=y6(X,Z);let J=()=>{let Q=U$(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&J0(z.condition))U=Q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function SX($){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 J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function y6($,Z){let Y=$;function X(K,q,W,z){let U=1,j=z,H=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)U++,j=F+_[0].length;else if(L<1/0){if(U--,U===0)return L;j=L+O[0].length}else break}return-1}function J(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=U.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+5),H=SX(j);if(H)z=H.value,U=W+5+H.consumed;else U=W+5;let B=X(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?S1(`auth?.check && auth?.user?.[${z}]`,Z):S1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+6),H=SX(j);if(H)z=H.value,U=W+6+H.consumed;else U=W+6;let B=X(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?S1(`!auth?.check || !auth?.user?.[${z}]`,Z):S1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+9),K=!0}}function Q(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=S1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=X(Y,K,q,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],I;while((I=w.exec(F))!==null)M.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)M.push({pos:I.index,type:"close"});while((I=N.exec(F))!==null)M.push({pos:I.index,type:"elseDirective"});while((I=A.exec(F))!==null)M.push({pos:I.index,type:"else"});M.sort((S,C)=>S.pos-C.pos);for(let S of M){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${W}`.length),d=G(x);if(d){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${W}`.length+d.paramsEnd,T.push({content:"",ability:d.ability,type:d.type,id:d.id}),T.pop();let u=L[S+1],Y0=u?u.pos:F.length;T.push({content:F.slice(k,Y0),ability:d.ability,type:d.type,id:d.id}),k=Y0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let d=Q(x.ability,x.type,x.id);if(K==="can"?d:!d){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${q}`.length),z=!0}}return Y}function P6($,Z,Y){let X=$;function J(Q,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let H=j.index,B=I1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=i1(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let N=F.indexOf("@",R);if(N===-1)break;let A=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){V=N;break}R=N+1}try{let N=q(L.trim()),A;if(V!==-1){let M=F.slice(0,V),I=F.slice(V+5);A=N?M:I}else A=N?F:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(N){let A=N instanceof Error?N.message:String(N),M=$0(W,`Error processing @${G} directive: ${A}`,s.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=S1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=S1(Q,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 C6($,Z,Y){let X=$,J="development";function Q(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,W=J===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),P=U.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(L,R),A=-1,M=0,I=0;while(I<N.length){let D=N.indexOf("@",I);if(D===-1)break;let P=N.substring(D);if(j.test(P)){M++,I=D+1;continue}if(H.test(P)){M--,I=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(P)){A=D;break}I=D+1}let T;if(A!==-1){let D=N.slice(0,A),P=N.slice(A+5);T=W?D:P}else T=W?N:"";let k=`@${q}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var z7=b(()=>{bX();U1();Q4();F0()});function PX($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function U7($,Z){if(!$)return Z?.nonceGenerator?.()??PX();let Y=yX.get($);if(!Y)Y=Z?.nonceGenerator?.()??PX(),yX.set($,Y);return Y}function GB($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function CX($,Z){return`<meta http-equiv="Content-Security-Policy" content="${GB($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function vX($,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?U7(Y,Z):void 0,J=CX(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
11554
+ `+J.slice(G);else J+=Q;return J}function sj($,Z){let Y=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,Q,G)=>{let K=Z[Y++];if(!K)return J;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return K.id=q[1],K.selector=`[data-stx-scope="${K.id}"]`,J;return`<${Q} data-stx-scope="${K.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),X=X.replace(/\s*x-init\s*=\s*'[^']*'/g,""),X}function rj($){return/x-data\s*=\s*["']/.test($)}var TX=0,uj=0;var DX=b(()=>{Y1()});import aj from"fs";import b6 from"path";import{createHighlighter as tj}from"ts-syntax-highlighter";async function ej($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await aj.promises.stat($)).mtime.getTime();if(Z.cache&&S6.has($)){let U=S6.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let J=await Bun.file($).text(),{data:Q,content:G}=x8(J),K=Z.markdown||e5.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=s5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await $B(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:Q||{}};if(Z.cache)S6.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function $B($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W7)try{W7=await tj({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!W7.getSupportedLanguages().includes(j))return K;return(await W7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${W}:`,H)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[q,W,z,U]=K,j=await J(q,W,z,U);Q=Q.replace(q,j)}return Q}async function EX($,Z,Y="",X={}){return await ZB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!b6.isAbsolute(K))z=b6.resolve(b6.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),N=V.substring(w+1).trim(),A=N.startsWith('"')&&N.endsWith('"'),M=N.startsWith("'")&&N.endsWith("'");if(A||M)N=N.substring(1,N.length-1);U[R]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await ej(z,X),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(z){let U=z instanceof Error?z.message:String(z);return z0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function ZB($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],q=J.index,W=J;X.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let Q=await Promise.all(X);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var S6,W7=null;var kX=b(()=>{w1();R0();S6=new Map});function S1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var bX=b(()=>{F0()});function YB($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=R3(X,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let j;if(U.value&&Q0(U.value))j=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Z0(U.value,Z);if(q===j){W=U.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function XB($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function JB($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,X)=>Z[Number(X)]??Y)}function $5($,Z,Y){let{masked:X,scripts:J}=XB($);return JB(QB(X,Z,Y),J)}function QB($,Z,Y){let X=$;X=YB(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=I1(X,K+7);if(!q)break;let W=q.endPos,z=i1(X,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(W,z),j=q.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((R,N)=>R.pos-N.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=U.slice(0,H),O=U.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${U}@endif`;X=X.substring(0,K)+B+X.substring(z+10),Q=!0}}X=P6(X,Z,Y),X=C6(X,Z,Y),X=y6(X,Z);let J=()=>{let Q=U$(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&Q0(z.condition))U=G0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function SX($){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 J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function y6($,Z){let Y=$;function X(K,q,W,z){let U=1,j=z,H=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)U++,j=F+_[0].length;else if(L<1/0){if(U--,U===0)return L;j=L+O[0].length}else break}return-1}function J(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=U.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+5),H=SX(j);if(H)z=H.value,U=W+5+H.consumed;else U=W+5;let B=X(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?S1(`auth?.check && auth?.user?.[${z}]`,Z):S1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+6),H=SX(j);if(H)z=H.value,U=W+6+H.consumed;else U=W+6;let B=X(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?S1(`!auth?.check || !auth?.user?.[${z}]`,Z):S1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+9),K=!0}}function Q(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=S1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=X(Y,K,q,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],I;while((I=w.exec(F))!==null)M.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)M.push({pos:I.index,type:"close"});while((I=N.exec(F))!==null)M.push({pos:I.index,type:"elseDirective"});while((I=A.exec(F))!==null)M.push({pos:I.index,type:"else"});M.sort((S,C)=>S.pos-C.pos);for(let S of M){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${W}`.length),d=G(x);if(d){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${W}`.length+d.paramsEnd,T.push({content:"",ability:d.ability,type:d.type,id:d.id}),T.pop();let u=L[S+1],X0=u?u.pos:F.length;T.push({content:F.slice(k,X0),ability:d.ability,type:d.type,id:d.id}),k=X0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let d=Q(x.ability,x.type,x.id);if(K==="can"?d:!d){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${q}`.length),z=!0}}return Y}function P6($,Z,Y){let X=$;function J(Q,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let H=j.index,B=I1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=i1(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let N=F.indexOf("@",R);if(N===-1)break;let A=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){V=N;break}R=N+1}try{let N=q(L.trim()),A;if(V!==-1){let M=F.slice(0,V),I=F.slice(V+5);A=N?M:I}else A=N?F:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(N){let A=N instanceof Error?N.message:String(N),M=$0(W,`Error processing @${G} directive: ${A}`,s.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=S1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=S1(Q,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 C6($,Z,Y){let X=$,J="development";function Q(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,W=J===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),P=U.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(L,R),A=-1,M=0,I=0;while(I<N.length){let D=N.indexOf("@",I);if(D===-1)break;let P=N.substring(D);if(j.test(P)){M++,I=D+1;continue}if(H.test(P)){M--,I=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(P)){A=D;break}I=D+1}let T;if(A!==-1){let D=N.slice(0,A),P=N.slice(A+5);T=W?D:P}else T=W?N:"";let k=`@${q}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var z7=b(()=>{bX();U1();Q4();F0()});function PX($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function U7($,Z){if(!$)return Z?.nonceGenerator?.()??PX();let Y=yX.get($);if(!Y)Y=Z?.nonceGenerator?.()??PX(),yX.set($,Y);return Y}function GB($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function CX($,Z){return`<meta http-equiv="Content-Security-Policy" content="${GB($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function vX($,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?U7(Y,Z):void 0,J=CX(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
11555
11555
  ${J}`)}function xX($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function fX($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?U7(Z,Q):void 0;return CX(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return U7(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=U7(Z,Q);return J}var yX;var gX=b(()=>{yX=new WeakMap});import KB from"crypto";function WB($=qB){let Z=KB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return v6=Z,Z}function zB(){if(!v6)WB();return v6}function UB($=hX){let Z=zB();return`<input type="hidden" name="${$}" value="${Z}">`}function mX($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return UB(X||hX)})}var qB=40,hX="_token",v6=null;var dX=()=>{};async function uX($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await jB(J,Q,Z,Y,X);else J=await BB(J,Q,Z,Y,X)}return J}async function jB($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,W=$,z=L5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],j=z.exec(W);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let F=B?pX(B):[],L=_.trim(),V=await G(L,F,Y,X);U.push({original:H,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:H,processed:$0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,s.EVALUATION_ERROR),startIndex:O})}j=z.exec(W)}for(let H=U.length-1;H>=0;H--){let{original:B,processed:_}=U[H];W=W.replace(B,_)}return W}async function BB($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,q=L5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[H,B=""]=z,_=z.index||0;try{let O=pX(B),F=await G("",O,Y,X);W.push({original:H,processed:F,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);W.push({original:H,processed:$0("CustomDirective",`Error in @${Q}(${B}): ${F}`,s.EVALUATION_ERROR),startIndex:_})}z=q.exec(K)}let U=L5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],Y,X);W.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:H,processed:$0("CustomDirective",`Error in @${Q}: ${O}`,s.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let H=W.length-1;H>=0;H--){let{original:B,processed:_}=W[H];K=K.replace(B,_)}return K}function pX($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)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((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var lX=b(()=>{U1();V5()});function Z5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function _B($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(Z5(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(Z5(Y.key,"appearance.key"),Z5(Y.attribute,"appearance.attribute"),Z5(Y.default,"appearance.default"),Z5(X.key,"colorMode.key"),Z5(X.attribute,"colorMode.attribute"),Z5(X.default,"colorMode.default"),!iX.test(Y.key)||!iX.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!cX.test(Y.attribute)||!cX.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!HB.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function OB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function FB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${OB($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function LB($,Z){let Y=1,X=null,J=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(J){J=!1;continue}if(X){if(G==="\\")J=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function nX($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index+J[0].length-1,G=LB(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),q=Z0(`(${K})`,Z),W=FB(_B(q));Y=Y.slice(0,J.index)+W+Y.slice(G+1),X.lastIndex=J.index+W.length}return Y}var cX,iX,HB;var oX=b(()=>{F0();cX=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,iX=/^[A-Za-z_$][\w$]*$/,HB=new Set(["light","dark","system"])});import VB from"crypto";function H0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function j7($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function l0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function E5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${H0(Z)}"`}function x6($,Z,Y){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(Y))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Y))X+=` aria-describedby="${H0(`${l0($)}-error`)}"`;return X}function wB(){return VB.randomUUID()}function B7($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=wB();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${H0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${H0(Q)}">`;return X}),Y}function aX($,Z,Y=rX){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,q,W="")=>{let z=Q||G||"POST",U=K||q||"",j=y1(W),H=z.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${H0(B)}" action="${H0(U)}"${j?` ${j}`:""}>`;if(_+=`
11556
11556
  ${B7("@csrf",Z)}`,!["GET","POST"].includes(H))_+=`
11557
- ${B7(`@method('${H}')`,Z)}`;return _}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,q,W="")=>{let z=Q||G||"",U=K||q||"",j=y1(W),H=w$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=R$(z,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=j7(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(O)}" name="${H0(z)}"${E5(j,l0(z))} value="${H0(B)}" class="${V}"${x6(z,F,j)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let q=y1(G),W=w$(Q,Z)||K.trim(),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${H0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let q=y1(G),W=w$(Q,Z),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=G===void 0?"1":G,W=G===void 0?l0(Q):`${l0(Q)}-${l0(q)}`,z=y1(K),U=w$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===q):U===!0||String(U)===q),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(Q)}"${E5(z,W)} value="${H0(q)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=y1(K),W=w$(Q,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,H=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(Q)}"${E5(q,`${l0(Q)}-${l0(G)}`)} value="${H0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=y1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=R$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=j7(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${H0(Q)}"${E5(K,l0(Q))}`,`class="${H}"`];if(W)_.push(`accept="${H0(W)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let q=y1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(l0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),X}function tX($,Z,Y=rX){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(R$(J,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return sX(J,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return sX(J,Z)}let W=q.trim();if(J0(W)){let z=Z0(W,Z);return z!==void 0?String(z):W}return W}catch{return q}});return`<div id="${H0(`${l0(J)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function R$($,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 sX($,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 w$($,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 y1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var rX;var eX=b(()=>{F0();rX={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import h6 from"path";async function RB(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function NB($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function AB($,Z){if({...u6,...Z.i18n}.cache&&m6[$]){let J=m6[$],Q=Z.i18n?.cacheMaxAge??0;if(!NB(J,Q))return J.translations}if(A$[$]?.state==="loading")return A$[$].promise;f6[$]="loading";let X=d6($,Z).then((J)=>{return f6[$]="loaded",delete A$[$],J}).catch((J)=>{throw f6[$]="error",A$[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return A$[$]={promise:X,state:"loading"},X}async function d6($,Z){let Y={...u6,...Z.i18n},X=h6.isAbsolute(Y.translationsDir)?Y.translationsDir:h6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let J=await RB(),Q=J?await J($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:EB(Y.format)}):await MB($,Y,X);if(Q===void 0){if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)m6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}}async function MB($,Z,Y){let X=h6.join(Y,`${$}${TB(Z.format)}`);try{let J=await import(X);return J.default||J}catch(J){try{let Q=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return IB(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function TB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function IB($){let Z={},Y=$.split(`
11557
+ ${B7(`@method('${H}')`,Z)}`;return _}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,q,W="")=>{let z=Q||G||"",U=K||q||"",j=y1(W),H=w$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=R$(z,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=j7(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(O)}" name="${H0(z)}"${E5(j,l0(z))} value="${H0(B)}" class="${V}"${x6(z,F,j)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let q=y1(G),W=w$(Q,Z)||K.trim(),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${H0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let q=y1(G),W=w$(Q,Z),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=G===void 0?"1":G,W=G===void 0?l0(Q):`${l0(Q)}-${l0(q)}`,z=y1(K),U=w$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===q):U===!0||String(U)===q),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(Q)}"${E5(z,W)} value="${H0(q)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=y1(K),W=w$(Q,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,H=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(Q)}"${E5(q,`${l0(Q)}-${l0(G)}`)} value="${H0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=y1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=R$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=j7(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${H0(Q)}"${E5(K,l0(Q))}`,`class="${H}"`];if(W)_.push(`accept="${H0(W)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let q=y1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(l0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),X}function tX($,Z,Y=rX){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(R$(J,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return sX(J,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return sX(J,Z)}let W=q.trim();if(Q0(W)){let z=Z0(W,Z);return z!==void 0?String(z):W}return W}catch{return q}});return`<div id="${H0(`${l0(J)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function R$($,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 sX($,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 w$($,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 y1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var rX;var eX=b(()=>{F0();rX={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import h6 from"path";async function RB(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function NB($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function AB($,Z){if({...u6,...Z.i18n}.cache&&m6[$]){let J=m6[$],Q=Z.i18n?.cacheMaxAge??0;if(!NB(J,Q))return J.translations}if(A$[$]?.state==="loading")return A$[$].promise;f6[$]="loading";let X=d6($,Z).then((J)=>{return f6[$]="loaded",delete A$[$],J}).catch((J)=>{throw f6[$]="error",A$[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return A$[$]={promise:X,state:"loading"},X}async function d6($,Z){let Y={...u6,...Z.i18n},X=h6.isAbsolute(Y.translationsDir)?Y.translationsDir:h6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let J=await RB(),Q=J?await J($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:EB(Y.format)}):await MB($,Y,X);if(Q===void 0){if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)m6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}}async function MB($,Z,Y){let X=h6.join(Y,`${$}${TB(Z.format)}`);try{let J=await import(X);return J.default||J}catch(J){try{let Q=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return IB(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function TB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function IB($){let Z={},Y=$.split(`
11558
11558
  `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.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=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),j=z.trim();if(j==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=DB(j)}}return Z}function DB($){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 EB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function kB($,Z){return AB($,Z)}function bB($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function SB($,Z={}){return YJ($,Z)}function YJ($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=yB($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=PB(Q,Z),X=J+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 yB($,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 PB($,Z){let Y=CB($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return vB(J,Y.slice(2).join(","),Z);case"select":return fB(J,Y.slice(2).join(","));case"selectordinal":return gB(J,Y.slice(2).join(","));case"number":return mB(J,Y[2]?.trim());case"date":return dB(J,Y[2]?.trim());case"time":return uB(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function CB($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function vB($,Z,Y){let X=Number($)||0,J=p6(Z),Q=`=${X}`;if(J[Q])return g6(J[Q],X,Y);let G=xB(X);if(J[G])return g6(J[G],X,Y);if(J.other)return g6(J.other,X,Y);return String(X)}function g6($,Z,Y){let X=$.replace(/#/g,String(Z));return YJ(X,Y)}function xB($){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 fB($,Z){let Y=String($||""),X=p6(Z);if(X[Y])return X[Y];return X.other||String($)}function gB($,Z){let Y=Number($)||0,X=p6(Z),J=hB(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function hB($){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 p6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function mB($,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 dB($,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 uB($,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 pB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function $J($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(pB(G))return SB(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=bB(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 XJ($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...u6,...X.i18n},K=await kB(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await ZJ(J,Q,async(z,U,j,H,B)=>{try{let _={};if(j)try{let F=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return O0(j,Z)}];for(let L of F)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return $J(U,K,G.fallbackToKey,_)||H.trim()}catch(_){if(X.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...J.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return J=await ZJ(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return O0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(X.debug)console.error("Error parsing parameters for @translate directive:",_)}return $J(U,K,G.fallbackToKey,B)}catch(B){if(X.debug)console.error("Error processing @translate directive:",B);return $0("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),J}async function ZJ($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var N$,u6,m6,A$,f6;var JJ=b(()=>{U1();F0();u6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},m6={},A$={},f6={}});var i6={};o(i6,{streamingSuspenseDirective:()=>KJ,streamToResponse:()=>ZH,streamTemplateSimple:()=>aB,streamTemplate:()=>cB,renderStreamingPage:()=>nB,registerStreamingDirectives:()=>eB,processStreamDirectives:()=>sB,processSectionDirectives:()=>$H,islandDirective:()=>qJ,generateHydrationRuntime:()=>YH,extractStreamBoundaries:()=>rB,createStreamRenderer:()=>tB,buildSuspenseResolveScript:()=>c6,SUSPENSE_RESOLVER_RUNTIME:()=>GJ});import H7 from"path";function lB($){let Z=[],Y=0,X;QJ.lastIndex=0;while((X=QJ.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 J=X[1],Q=X[2];Z.push({type:"suspense",name:J,content:Q}),Y=X.index+X[0].length}if(Y<$.length){let J=$.slice(Y);if(J.trim())Z.push({type:Z.length===0?"shell":"content",content:J})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function cB($,Z={},Y={}){let X={...t1,...Y,streaming:{...l6,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:H7.dirname($)};if(q.trim())await c1(q,z,$);let U=lB(W),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=X.streaming?.strategy||"auto",_=new RegExp(Y5.source,"g");if(!(B!=="manual"&&_.test(W))){let F=await N0(W,z,$,X,j);for(let L=0;L<F.length;L+=J)Q.enqueue(F.slice(L,L+J)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(Y5.source,"g"),V;while((V=L.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 A=W.slice(w,R.start);if(A.trim()){let M=await N0(A,z,$,X,j);Q.enqueue(M),await new Promise((I)=>setTimeout(I,0))}}let N=await N0(R.content,z,$,X,j);Q.enqueue(N),await new Promise((A)=>setTimeout(A,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let N=await N0(R,z,$,X,j);Q.enqueue(N)}}}}else{let B=new Map;for(let O of U)if(O.type==="shell"||O.type==="content"){let F=await N0(O.content,z,$,X,j);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
11559
11559
  <template data-suspense-fallback>Loading...</template>
11560
11560
  </div>`),B.set(O.name,N0(O.content,z,$,X,j))}Q.enqueue(`
@@ -11578,8 +11578,8 @@ ${J}`)}function xX($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*
11578
11578
  window.__stxSuspense.resolve('${$}', \`${X}\`);
11579
11579
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
11580
11580
  <script>
11581
- window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${o0(X)}</div>');
11582
- </script>`}}function iB($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function nB($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(GJ),await Promise.all(Z.map(async(Q)=>{let G=iB(Q.render(),X,Q.id);J.enqueue(await c6(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function sB($,Z){return $.replace(oB,(Y,X,J)=>{let Q=X.trim(),G=J.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[Q]=K,`<div data-suspense="${Q}">${q}</div>`})}function rB($){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,J])=>({id:X,render:J})):void 0}async function aB($,Z={},Y={}){let X={...t1,...Y,streaming:{...l6,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:H7.dirname($)};if(q.trim())await c1(q,z,$);let U=new Set,j=X.streaming?.strategy||"auto",H=new RegExp(Y5.source,"g");if(!(j!=="manual"&&H.test(W))){let _=await N0(W,z,$,X,U);for(let O=0;O<_.length;O+=J)Q.enqueue(_.slice(O,O+J))}else{let _=[],O=new RegExp(Y5.source,"g"),F;while((F=O.exec(W))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=W.slice(L,V.start);if(R.trim()){let N=await N0(R,z,$,X,U);Q.enqueue(N)}}let w=await N0(V.content,z,$,X,U);Q.enqueue(w),L=V.end}if(L<W.length){let V=W.slice(L);if(V.trim()){let w=await N0(V,z,$,X,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function tB($,Z={}){let Y={...t1,...Z,streaming:{...l6,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;Y5.lastIndex=0;while((W=Y5.exec(G))!==null){let j=W[1],H=W[2];q[j]=H}let z=G.replace(Y5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:H7.dirname($)};return await c1(Q,H,$),N0(z,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!q[j])return`<div class="error-message">Section "${o0(j)}" not found in template "${o0($)}"</div>`;let B={...H,__filename:$,__dirname:H7.dirname($)};await c1(Q,B,$);let _=new Set;return await N0(q[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return W0("Expression",_,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function eB($={}){let Z=[];if($.streaming?.enabled)Z.push(KJ);if($.hydration?.enabled)Z.push(qJ);return Z}async function $H($,Z,Y,X={}){return $}function ZH($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:J})}function YH($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
11581
+ window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${s0(X)}</div>');
11582
+ </script>`}}function iB($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function nB($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(GJ),await Promise.all(Z.map(async(Q)=>{let G=iB(Q.render(),X,Q.id);J.enqueue(await c6(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function sB($,Z){return $.replace(oB,(Y,X,J)=>{let Q=X.trim(),G=J.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[Q]=K,`<div data-suspense="${Q}">${q}</div>`})}function rB($){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,J])=>({id:X,render:J})):void 0}async function aB($,Z={},Y={}){let X={...t1,...Y,streaming:{...l6,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:H7.dirname($)};if(q.trim())await c1(q,z,$);let U=new Set,j=X.streaming?.strategy||"auto",H=new RegExp(Y5.source,"g");if(!(j!=="manual"&&H.test(W))){let _=await N0(W,z,$,X,U);for(let O=0;O<_.length;O+=J)Q.enqueue(_.slice(O,O+J))}else{let _=[],O=new RegExp(Y5.source,"g"),F;while((F=O.exec(W))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=W.slice(L,V.start);if(R.trim()){let N=await N0(R,z,$,X,U);Q.enqueue(N)}}let w=await N0(V.content,z,$,X,U);Q.enqueue(w),L=V.end}if(L<W.length){let V=W.slice(L);if(V.trim()){let w=await N0(V,z,$,X,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function tB($,Z={}){let Y={...t1,...Z,streaming:{...l6,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;Y5.lastIndex=0;while((W=Y5.exec(G))!==null){let j=W[1],H=W[2];q[j]=H}let z=G.replace(Y5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:H7.dirname($)};return await c1(Q,H,$),N0(z,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!q[j])return`<div class="error-message">Section "${s0(j)}" not found in template "${s0($)}"</div>`;let B={...H,__filename:$,__dirname:H7.dirname($)};await c1(Q,B,$);let _=new Set;return await N0(q[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",_,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function eB($={}){let Z=[];if($.streaming?.enabled)Z.push(KJ);if($.hydration?.enabled)Z.push(qJ);return Z}async function $H($,Z,Y,X={}){return $}function ZH($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:J})}function YH($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
11583
11583
  `);if(Z==="loader")return`
11584
11584
  (function() {
11585
11585
  window.__stx = window.__stx || {};
@@ -11741,7 +11741,7 @@ else {
11741
11741
  }
11742
11742
  };
11743
11743
  })();
11744
- </script>`,oB,KJ,qJ;var n6=b(()=>{w1();Z1();D4();R0();l6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},Y5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,QJ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;oB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;KJ={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},qJ={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${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="${J}" data-island-id="${G}" data-priority="${Q}">
11744
+ </script>`,oB,KJ,qJ;var n6=b(()=>{w1();Y1();D4();R0();l6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},Y5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,QJ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;oB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;KJ={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},qJ={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${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="${J}" data-island-id="${G}" data-priority="${Q}">
11745
11745
  ${W}
11746
11746
  <script type="application/json" data-island-props="${G}">
11747
11747
  ${q?`{${q}}`:"{}"}
@@ -11785,8 +11785,8 @@ ${D}
11785
11785
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
11786
11786
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
11787
11787
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
11788
- </style>`}}});import{existsSync as UH,readFileSync as jH}from"fs";function BH($){if(NJ.has($))return;NJ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function HH($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(UH(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return q0.resolve(Y)}catch{}return null}function _H($){if(L7.has($))return L7.get($);let Z=HH($);if(!Z)return BH($),null;try{let Y=JSON.parse(jH(Z,"utf8"));return L7.set($,Y.icons),Y.icons}catch{return null}}function P5($,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 L7,NJ,O9;var F9=b(()=>{L7=new Map,NJ=new Set;O9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=P5($,"name")??P5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let L=X.split(":");J=L[0],Q=L[1]}let G=I0(P5($,"size")||"24"),K=I0(P5($,"color")||"currentColor"),q=I0(P5($,"class")||""),W=I0(P5($,"style")||""),z=L7.get(J)??_H(J);if(!z)return`<!-- Icon: collection "${J}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${J} -->`;let j=U.width||24,H=U.height||24,B=`0 0 ${j} ${H}`,_=U.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function AJ($,...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 MJ($,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 L9;var V9=b(()=>{L9={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=MJ(Z,"fallback"),J=X.rest,Q=MJ(J,"error"),G=Q.rest,K=X.region??AJ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??AJ($,"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 V7($,...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 w9;var R9=b(()=>{w9={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(V7($,"name")||"v").replace(/["'<>]/g,""),J=(V7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=V7($,"class"),G=V7($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function TJ(){C0.registerBuiltin(t6),C0.registerBuiltin(X9),C0.registerBuiltin(Q9),C0.registerBuiltin(q9),C0.registerBuiltin(z9),C0.registerBuiltin(j9),C0.registerBuiltin(H9),C0.registerBuiltin(O9),C0.registerBuiltin(L9),C0.registerBuiltin(w9)}var IJ=b(()=>{e6();J9();G9();W9();U9();B9();_9();F9();V9();R9();a6();e6();J9();G9();W9();U9();B9();_9();F9();V9();R9()});function w7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function DJ($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){J=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let _=Q+1+q.length;while(_<$.length&&$[_]!==">")_++;J=_+1;continue}let W=Q+1+q.length,z=null,U=W,j=-1,H=!1;while(W<$.length){let _=$[W];if(z){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===z)z=null;W++;continue}if(_==='"'||_==="'"){z=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,H=!0;break}if(_===">"){j=W+1;break}W++}if(j===-1){J=Q+1;continue}let B=$.slice(U,H?j-2:j-1).trim();if(H)X.push({fullMatch:$.slice(Q,j),tagName:q,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),J=j;else{let _=`<${q}`,O=`</${q}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let N=$.indexOf(_,L),A=$.indexOf(O,L);if(A===-1)break;if(N!==-1&&N<A){let M=$[N+_.length];if(M===" "||M===">"||M==="/"||M===`
11789
- `||M==="\t")F++;L=N+_.length}else{if(F--,F===0){V=A;break}L=A+O.length}}if(V===-1){J=j;continue}let w=$.slice(j,V),R=V+O.length;X.push({fullMatch:$.slice(Q,R),tagName:q,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),J=R}}return X}function EJ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function kJ($,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 bJ=b(()=>{F0();R0();u1()});var fJ={};o(fJ,{processESImports:()=>vJ,processComponents:()=>N7});import R7 from"fs";import m0 from"path";function FH($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(m8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=Q(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!J.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let z=Q(W.slice(6));X.serverDynamic[z]=kJ(q,Y);continue}if(W.startsWith(":")){let z=Q(W.slice(1)),U=q===X5?z:q;if(z==="if"||z==="for"||z==="show"){X.clientReactive[z]=U;continue}try{if(!J0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);X.clientReactive[z]=U;continue}let j=Object.keys(Z),B=Q0(U,j)(...Object.values(Z));if(B===void 0){let _=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){X.clientReactive[z]=U;continue}}X.serverDynamic[z]=B}catch{X.clientReactive[z]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let z=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(J0(U)){let H=Q0(U,Object.keys(Z))(...Object.values(Z));G(W,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${U}`);G(W,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,U);G(W,q)}else{let U=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(q))!==null)try{let B=H[1];if(!J0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let O=Q0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,U)}continue}G(W,q===X5?"true":EJ(q))}return X}function LH($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]=X5}return Z}function yJ($){return Object.entries($).map(([Z,Y])=>Y===X5?Z:`${Z}="${VH(Y)}"`).join(" ")}function VH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wH($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(C0.isBuiltin(J))Z.add(J)}return[...Z].sort()}function RH($){let Z=PJ.get($);if(Z)return Z;let Y=new Map,X=[m0.join($,"src"),m0.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=R7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let W=m0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return PJ.set($,Y),Y}function NH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=m0.join(Y,"node_modules",$);try{if(R7.statSync(X).isDirectory())return X}catch{}let J=m0.dirname(Y);if(J===Y)return null;Y=J}}async function vJ($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=m0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=U,B,_=[];while((B=j.exec(U))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let M=m0.resolve(G,V);if(M.endsWith(".stx"))R=M;else{let I=`${M}.stx`;try{if(R7.statSync(I).isFile())R=I}catch{try{if(R7.statSync(M).isDirectory())w=M}catch{}}}}else w=NH(V,G);if(!w&&!R)continue;let N=!1,A=(M,I)=>{Q.set(M,I),Q.set(M.toLowerCase(),I);let T=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),J.add(I)};if(L&&R)A(L,R),N=!0;else if(F){let M=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?RH(w):null;for(let{source:T,local:k}of M){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(k,D),N=!0}}if(N)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return W;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${z}>${H}</script>`}),K}async function AH($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[W,z]=q,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[m0.resolve(m0.dirname(Y),`${j}.stx`),m0.resolve(m0.dirname(Y),j),m0.resolve(X.componentsDir||"components",`${j}.stx`),m0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(W,""),K.lastIndex=0}return Q}async function MH($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(Q))!==null){let z=W.index,U=z+W[0].length-1,j=1,H=U+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(U+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){q.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=O0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let N="",A=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)N=I[1].trim(),A=_+I[0].length;let T=await o1(F,R,N,G,Z,Y,X,K,J);Q=Q.substring(0,z)+T+Q.substring(A),q.lastIndex=0}return Q}async function TH($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=N1(Q);return Q=q.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,OH),Q=Q$(Q,q.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=DJ(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?w7(w.tagName):w.tagName,N=LH(w.attributes),A=FH(N,Z,X),M=C0.getBuiltin(w.tagName),I=M?await I4(R,G,Z,Y,X):!1;if(M&&!I){let P={context:Z,filePath:Y,options:X,dependencies:J},y=M.render(A,w.content,P);if(Object.keys(A.clientReactive).length>0)y=CJ(y,A.clientReactive);if(Object.keys(A.events).length>0){let S=yJ(A.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await I4(R,G,Z,Y,X))continue;let T={};for(let[P,y]of Object.entries(A.static))T[P]=y;for(let[P,y]of Object.entries(A.serverDynamic))T[P]=y;let D=await o1(R,T,w.content,G,Z,Y,X,K,J);if(Object.keys(A.clientReactive).length>0)D=CJ(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=xJ(D);if(P){let y=yJ(A.events),S=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function CJ($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),J=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=J.filter(([z])=>!X.has(z)).map(([z])=>w7(z)).join(" "),G=$,K=J.length>0?xJ(G):null;if(K){let z=J.map(([j,H])=>`:${w7(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function xJ($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),J=X.match(/^\s+/);if(J){Y+=J[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+Q[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function N7($,Z,Y,X,J){if(!SJ)TJ(),SJ=!0;let Q=await vJ($,Z,Y,X,J);Q=await AH(Q,Z,Y,X,J),Q=await MH(Q,Z,Y,X,J);let G=[];for(let K=0;K<3;K++){let q=$1(Q,J$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let W=Q;if(Q=await TH(q.output,Z,Y,X,J),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=wH(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var SJ=!1,OH,PJ;var N9=b(()=>{a6();IJ();bJ();u1();R0();F0();e0();OH=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","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"]);PJ=new Map});var lJ={};o(lJ,{processLoops:()=>M9,parseLoopBinding:()=>A9});function EH($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),q=M0($,"(",")",K);if(q===-1)continue;let W=$.slice(G,q).trim();if(!W)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let U;try{let j=O0(W,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}X+=$.slice(J,G)+U,J=q,Y.lastIndex=q}return J===0?$:X+$.slice(J)}function kH($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.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)continue;let z=X.substring(K+1,W),U=W+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=z.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=O0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];X=X.substring(0,K)+W+X.substring(q)}return X}function A7($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let B=X[W];if(U){U=!1,W++;continue}if(B==="\\"&&z){U=!0,W++;continue}if(z){if(B===z)z=null;W++;continue}if(B==='"'||B==="'"||B==="`"){z=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),H=Y(j);X=X.substring(0,G)+H+X.substring(W+1)}return X}function bH($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);s$(Q);let W=Q0(Q,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${J}="${U}"`}catch(G){return X}}),Y}function SH($,Z){let Y=$;return Y=A7(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(J0(Q)){let K=Q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?M7:""}catch{return""}}),Y=A7(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(J0(Q)){let K=Q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?T7:""}catch{return""}}),Y}function yH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,M7),Z=Z.replace(/@continue(?!\()/g,T7),Z}function gJ($){let Z=$.includes(M7),Y=Z?$.substring(0,$.indexOf(M7)):$;return{hasBreak:Z,content:Y}}function hJ($){let Z=$.includes(T7),Y=Z?$.substring(0,$.indexOf(T7)):$;return{hasContinue:Z,content:Y}}function dJ($){let Z=$;return Z=A7(Z,"@break",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=A7(Z,"@continue",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function PH($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of X)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,j=K.length-1,H=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=z)H=K[B].depth,U=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,j=1,H=U+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(U+1,B),O=A9(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,N=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&R<$.length){N.lastIndex=R,A.lastIndex=R;let y=N.exec($),S=A.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){M=S.index;break}R=S.index+11}}if(M===-1)continue;let I=$.substring(V,M),T=M+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:z,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function mJ($,Z){let Y=$;while(!0){let X=PH(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let z;if(J0(G))z=Q0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,J)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,J)+j+Y.substring(Q)}}return Y}function A9($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let X=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Y[2].trim();return X&&J?{arrayExpr:J,itemVar:X}:null}function M9($,Z,Y,X){let J=$;J=mJ(J,Z);function Q(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<q.length&&H>0){if(q[B]==="(")H++;else if(q[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=q.substring(j+1,_),F=A9(O);if(!F)continue;let L=U,{arrayExpr:V,itemVar:w}=F,R=_+1,N=1,A=R,M=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&A<q.length){M.lastIndex=A,I.lastIndex=A;let T=M.exec(q),k=I.exec(q);if(!k)break;if(T&&T.index<k.index)N++,A=T.index+T[0].length;else{if(N--,N===0){let D=q.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}A=k.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let F=B.trim(),L;if(J0(F))L=Q0(F,Object.keys(W))(...Object.values(W));else L=Z0(F,W);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=$0("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,j)+k+z.substring(H);continue}let w=X?.loops?.useAltLoopVariable??DH,R=_.trim(),N=null,A,M=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])N=k[0],A=k[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],N=k[1],M=!0;else A=R}else A=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...W,loop:P,$loop:P};if(A.startsWith("[")&&A.endsWith("]")){let d=A.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))d.forEach((u,Y0)=>{if(u)y[u]=D[Y0]});else y[A]=D}else y[A]=D;if(N)if(!M&&V&&Array.isArray(D)&&D.length===2)y[N]=D[0],y[A]=D[1];else y[N]=k;let S=SH(O,y),C=hJ(S);if(C.hasContinue){I+=C.content;continue}let x=gJ(S);if(x.hasBreak){I+=x.content;break}if(S=mJ(S,y),S=G(S,y),S=$5(S,y,Y),S=yH(S),x=gJ(S),x.hasBreak){I+=x.content;break}if(C=hJ(S),C.hasContinue){I+=C.content;continue}S=A1(S,y,Y),S=bH(S,y),S=kH(S,y),S=EH(S,y),I+=S}z=z.substring(0,j)+I+z.substring(H)}catch(F){let L=$0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,j)+L+z.substring(H)}}return z}J=G(J,Z),J=pJ(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??IH;return J=xH(J,Z,K),J}function uJ($){return r$($)}function pJ($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=M0(J,"(",")",q);if(W===-1)break;let z=J.slice(q+1,W),U=W+1,j=J4(J.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!uJ(z)){let _=$0("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,K)+_+J.substring(B),Q=!0;continue}try{let _=CH(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let N=vH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:Y,options:X});J=J.substring(0,K)+N+J.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,A)=>{return`\${${A}}`});V=dJ(V);let R=Function(...F,`
11788
+ </style>`}}});import{existsSync as UH,readFileSync as jH}from"fs";function BH($){if(NJ.has($))return;NJ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function HH($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(UH(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return W0.resolve(Y)}catch{}return null}function _H($){if(L7.has($))return L7.get($);let Z=HH($);if(!Z)return BH($),null;try{let Y=JSON.parse(jH(Z,"utf8"));return L7.set($,Y.icons),Y.icons}catch{return null}}function P5($,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 L7,NJ,O9;var F9=b(()=>{L7=new Map,NJ=new Set;O9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=P5($,"name")??P5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let L=X.split(":");J=L[0],Q=L[1]}let G=I0(P5($,"size")||"24"),K=I0(P5($,"color")||"currentColor"),q=I0(P5($,"class")||""),W=I0(P5($,"style")||""),z=L7.get(J)??_H(J);if(!z)return`<!-- Icon: collection "${J}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${J} -->`;let j=U.width||24,H=U.height||24,B=`0 0 ${j} ${H}`,_=U.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function AJ($,...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 MJ($,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 L9;var V9=b(()=>{L9={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=MJ(Z,"fallback"),J=X.rest,Q=MJ(J,"error"),G=Q.rest,K=X.region??AJ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??AJ($,"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 V7($,...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 w9;var R9=b(()=>{w9={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(V7($,"name")||"v").replace(/["'<>]/g,""),J=(V7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=V7($,"class"),G=V7($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function TJ(){C0.registerBuiltin(t6),C0.registerBuiltin(X9),C0.registerBuiltin(Q9),C0.registerBuiltin(q9),C0.registerBuiltin(z9),C0.registerBuiltin(j9),C0.registerBuiltin(H9),C0.registerBuiltin(O9),C0.registerBuiltin(L9),C0.registerBuiltin(w9)}var IJ=b(()=>{e6();J9();G9();W9();U9();B9();_9();F9();V9();R9();a6();e6();J9();G9();W9();U9();B9();_9();F9();V9();R9()});function w7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function DJ($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){J=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let _=Q+1+q.length;while(_<$.length&&$[_]!==">")_++;J=_+1;continue}let W=Q+1+q.length,z=null,U=W,j=-1,H=!1;while(W<$.length){let _=$[W];if(z){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===z)z=null;W++;continue}if(_==='"'||_==="'"){z=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,H=!0;break}if(_===">"){j=W+1;break}W++}if(j===-1){J=Q+1;continue}let B=$.slice(U,H?j-2:j-1).trim();if(H)X.push({fullMatch:$.slice(Q,j),tagName:q,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),J=j;else{let _=`<${q}`,O=`</${q}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let N=$.indexOf(_,L),A=$.indexOf(O,L);if(A===-1)break;if(N!==-1&&N<A){let M=$[N+_.length];if(M===" "||M===">"||M==="/"||M===`
11789
+ `||M==="\t")F++;L=N+_.length}else{if(F--,F===0){V=A;break}L=A+O.length}}if(V===-1){J=j;continue}let w=$.slice(j,V),R=V+O.length;X.push({fullMatch:$.slice(Q,R),tagName:q,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),J=R}}return X}function EJ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function kJ($,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 bJ=b(()=>{F0();R0();u1()});var fJ={};o(fJ,{processESImports:()=>vJ,processComponents:()=>N7});import R7 from"fs";import m0 from"path";function FH($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(m8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=Q(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!J.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let z=Q(W.slice(6));X.serverDynamic[z]=kJ(q,Y);continue}if(W.startsWith(":")){let z=Q(W.slice(1)),U=q===X5?z:q;if(z==="if"||z==="for"||z==="show"){X.clientReactive[z]=U;continue}try{if(!Q0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);X.clientReactive[z]=U;continue}let j=Object.keys(Z),B=G0(U,j)(...Object.values(Z));if(B===void 0){let _=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){X.clientReactive[z]=U;continue}}X.serverDynamic[z]=B}catch{X.clientReactive[z]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let z=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(Q0(U)){let H=G0(U,Object.keys(Z))(...Object.values(Z));G(W,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${U}`);G(W,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,U);G(W,q)}else{let U=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(q))!==null)try{let B=H[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let O=G0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,U)}continue}G(W,q===X5?"true":EJ(q))}return X}function LH($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]=X5}return Z}function yJ($){return Object.entries($).map(([Z,Y])=>Y===X5?Z:`${Z}="${VH(Y)}"`).join(" ")}function VH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wH($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(C0.isBuiltin(J))Z.add(J)}return[...Z].sort()}function RH($){let Z=PJ.get($);if(Z)return Z;let Y=new Map,X=[m0.join($,"src"),m0.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=R7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let W=m0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return PJ.set($,Y),Y}function NH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=m0.join(Y,"node_modules",$);try{if(R7.statSync(X).isDirectory())return X}catch{}let J=m0.dirname(Y);if(J===Y)return null;Y=J}}async function vJ($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=m0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=U,B,_=[];while((B=j.exec(U))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let M=m0.resolve(G,V);if(M.endsWith(".stx"))R=M;else{let I=`${M}.stx`;try{if(R7.statSync(I).isFile())R=I}catch{try{if(R7.statSync(M).isDirectory())w=M}catch{}}}}else w=NH(V,G);if(!w&&!R)continue;let N=!1,A=(M,I)=>{Q.set(M,I),Q.set(M.toLowerCase(),I);let T=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),J.add(I)};if(L&&R)A(L,R),N=!0;else if(F){let M=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?RH(w):null;for(let{source:T,local:k}of M){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(k,D),N=!0}}if(N)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return W;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${z}>${H}</script>`}),K}async function AH($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[W,z]=q,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[m0.resolve(m0.dirname(Y),`${j}.stx`),m0.resolve(m0.dirname(Y),j),m0.resolve(X.componentsDir||"components",`${j}.stx`),m0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(W,""),K.lastIndex=0}return Q}async function MH($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(Q))!==null){let z=W.index,U=z+W[0].length-1,j=1,H=U+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(U+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){q.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=O0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let N="",A=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)N=I[1].trim(),A=_+I[0].length;let T=await o1(F,R,N,G,Z,Y,X,K,J);Q=Q.substring(0,z)+T+Q.substring(A),q.lastIndex=0}return Q}async function TH($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=N1(Q);return Q=q.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,OH),Q=Q$(Q,q.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=DJ(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?w7(w.tagName):w.tagName,N=LH(w.attributes),A=FH(N,Z,X),M=C0.getBuiltin(w.tagName),I=M?await I4(R,G,Z,Y,X):!1;if(M&&!I){let P={context:Z,filePath:Y,options:X,dependencies:J},y=M.render(A,w.content,P);if(Object.keys(A.clientReactive).length>0)y=CJ(y,A.clientReactive);if(Object.keys(A.events).length>0){let S=yJ(A.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await I4(R,G,Z,Y,X))continue;let T={};for(let[P,y]of Object.entries(A.static))T[P]=y;for(let[P,y]of Object.entries(A.serverDynamic))T[P]=y;let D=await o1(R,T,w.content,G,Z,Y,X,K,J);if(Object.keys(A.clientReactive).length>0)D=CJ(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=xJ(D);if(P){let y=yJ(A.events),S=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function CJ($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),J=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=J.filter(([z])=>!X.has(z)).map(([z])=>w7(z)).join(" "),G=$,K=J.length>0?xJ(G):null;if(K){let z=J.map(([j,H])=>`:${w7(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function xJ($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),J=X.match(/^\s+/);if(J){Y+=J[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+Q[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function N7($,Z,Y,X,J){if(!SJ)TJ(),SJ=!0;let Q=await vJ($,Z,Y,X,J);Q=await AH(Q,Z,Y,X,J),Q=await MH(Q,Z,Y,X,J);let G=[];for(let K=0;K<3;K++){let q=Z1(Q,J$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let W=Q;if(Q=await TH(q.output,Z,Y,X,J),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=wH(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var SJ=!1,OH,PJ;var N9=b(()=>{a6();IJ();bJ();u1();R0();F0();$1();OH=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","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"]);PJ=new Map});var lJ={};o(lJ,{processLoops:()=>M9,parseLoopBinding:()=>A9});function EH($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),q=M0($,"(",")",K);if(q===-1)continue;let W=$.slice(G,q).trim();if(!W)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let U;try{let j=O0(W,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}X+=$.slice(J,G)+U,J=q,Y.lastIndex=q}return J===0?$:X+$.slice(J)}function kH($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.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)continue;let z=X.substring(K+1,W),U=W+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=z.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=O0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];X=X.substring(0,K)+W+X.substring(q)}return X}function A7($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let B=X[W];if(U){U=!1,W++;continue}if(B==="\\"&&z){U=!0,W++;continue}if(z){if(B===z)z=null;W++;continue}if(B==='"'||B==="'"||B==="`"){z=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),H=Y(j);X=X.substring(0,G)+H+X.substring(W+1)}return X}function bH($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);s$(Q);let W=G0(Q,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${J}="${U}"`}catch(G){return X}}),Y}function SH($,Z){let Y=$;return Y=A7(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?M7:""}catch{return""}}),Y=A7(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?T7:""}catch{return""}}),Y}function yH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,M7),Z=Z.replace(/@continue(?!\()/g,T7),Z}function gJ($){let Z=$.includes(M7),Y=Z?$.substring(0,$.indexOf(M7)):$;return{hasBreak:Z,content:Y}}function hJ($){let Z=$.includes(T7),Y=Z?$.substring(0,$.indexOf(T7)):$;return{hasContinue:Z,content:Y}}function dJ($){let Z=$;return Z=A7(Z,"@break",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=A7(Z,"@continue",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function PH($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of X)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,j=K.length-1,H=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=z)H=K[B].depth,U=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,j=1,H=U+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(U+1,B),O=A9(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,N=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&R<$.length){N.lastIndex=R,A.lastIndex=R;let y=N.exec($),S=A.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){M=S.index;break}R=S.index+11}}if(M===-1)continue;let I=$.substring(V,M),T=M+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:z,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function mJ($,Z){let Y=$;while(!0){let X=PH(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let z;if(Q0(G))z=G0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,J)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,J)+j+Y.substring(Q)}}return Y}function A9($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let X=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Y[2].trim();return X&&J?{arrayExpr:J,itemVar:X}:null}function M9($,Z,Y,X){let J=$;J=mJ(J,Z);function Q(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<q.length&&H>0){if(q[B]==="(")H++;else if(q[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=q.substring(j+1,_),F=A9(O);if(!F)continue;let L=U,{arrayExpr:V,itemVar:w}=F,R=_+1,N=1,A=R,M=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&A<q.length){M.lastIndex=A,I.lastIndex=A;let T=M.exec(q),k=I.exec(q);if(!k)break;if(T&&T.index<k.index)N++,A=T.index+T[0].length;else{if(N--,N===0){let D=q.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}A=k.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let F=B.trim(),L;if(Q0(F))L=G0(F,Object.keys(W))(...Object.values(W));else L=Z0(F,W);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let k=$0("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,j)+k+z.substring(H);continue}let w=X?.loops?.useAltLoopVariable??DH,R=_.trim(),N=null,A,M=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])N=k[0],A=k[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],N=k[1],M=!0;else A=R}else A=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...W,loop:P,$loop:P};if(A.startsWith("[")&&A.endsWith("]")){let d=A.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))d.forEach((u,X0)=>{if(u)y[u]=D[X0]});else y[A]=D}else y[A]=D;if(N)if(!M&&V&&Array.isArray(D)&&D.length===2)y[N]=D[0],y[A]=D[1];else y[N]=k;let S=SH(O,y),C=hJ(S);if(C.hasContinue){I+=C.content;continue}let x=gJ(S);if(x.hasBreak){I+=x.content;break}if(S=mJ(S,y),S=G(S,y),S=$5(S,y,Y),S=yH(S),x=gJ(S),x.hasBreak){I+=x.content;break}if(C=hJ(S),C.hasContinue){I+=C.content;continue}S=A1(S,y,Y),S=bH(S,y),S=kH(S,y),S=EH(S,y),I+=S}z=z.substring(0,j)+I+z.substring(H)}catch(F){let L=$0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,j)+L+z.substring(H)}}return z}J=G(J,Z),J=pJ(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??IH;return J=xH(J,Z,K),J}function uJ($){return r$($)}function pJ($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=M0(J,"(",")",q);if(W===-1)break;let z=J.slice(q+1,W),U=W+1,j=J4(J.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!uJ(z)){let _=$0("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,K)+_+J.substring(B),Q=!0;continue}try{let _=CH(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let N=vH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:Y,options:X});J=J.substring(0,K)+N+J.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,A)=>{return`\${${A}}`});V=dJ(V);let R=Function(...F,`
11790
11790
  let result = '';
11791
11791
  for (${z}) {
11792
11792
  result += \`${V}\`;
@@ -11808,7 +11808,7 @@ ${D}
11808
11808
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
11809
11809
  }
11810
11810
  return result;
11811
- `)(...B);X=X.substring(0,G)+F+X.substring(j),J=!0}catch(H){let B=$0("While",`Error in @while(${W}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),J=!0}}return X}var IH=1000,DH=!1,M7="<!--__STX_BREAK__-->",T7="<!--__STX_CONTINUE__-->";var T9=b(()=>{z7();U1();Z1();Q4();F0()});import j0 from"path";function I9($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function fH($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){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]===")")q--;W++}if(q!==0)break;let z=X.substring(K+1,W-1),U=`${Y}(${z})`;X=X.substring(0,G)+U+X.substring(W),J.lastIndex=G+U.length,Q=J.exec(X)}return X}function gH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function iJ($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
11811
+ `)(...B);X=X.substring(0,G)+F+X.substring(j),J=!0}catch(H){let B=$0("While",`Error in @while(${W}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),J=!0}}return X}var IH=1000,DH=!1,M7="<!--__STX_BREAK__-->",T7="<!--__STX_CONTINUE__-->";var T9=b(()=>{z7();U1();Y1();Q4();F0()});import j0 from"path";function I9($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function fH($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){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]===")")q--;W++}if(q!==0)break;let z=X.substring(K+1,W-1),U=`${Y}(${z})`;X=X.substring(0,G)+U+X.substring(W),J.lastIndex=G+U.length,Q=J.exec(X)}return X}function gH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function iJ($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
11812
11812
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(J!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!X.has(B))Y.push(B),X.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Y.push(B),X.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Y.push(B),X.add(B)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return Y.join(", ")}function nJ($,Z=""){let Y=iJ($).split(",").map((X)=>X.trim()).filter(Boolean);return`
11813
11813
  (function() {
11814
11814
  ${B5("var",Y)}
@@ -11843,23 +11843,23 @@ ${iJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
11843
11843
  } finally {
11844
11844
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
11845
11845
  }
11846
- })();`}function mH($,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 J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function uH($){if($.__onceStore instanceof Set)return $.__onceStore;return dH}async function D9($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||j0.join(j0.dirname(Y),"partials");if(G&&!j0.isAbsolute(G))G=j0.resolve(process.cwd(),G);let K=fH($,"@partial","@include"),q=uH(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(q.has(L))return"";return q.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let N=R[1],A=W(N,G,Y),M="";if(A&&await Bun.file(A).exists())J.add(A),M=`@include(${w})`;K=K.substring(0,O)+M+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+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 N=K.substring(V+1,R-1),A=I9(N,0);if(A===-1){O.lastIndex=R;continue}let M=N.substring(0,A).trim(),I=N.substring(A+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=I9(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${M})`,C;if(J0(S)){let u=Q0(S,Object.keys(Z));C=Boolean(u(...Object.values(Z)))}else C=Boolean(Z0(S,Z));let x=_?!C:C,d="";if(x){let u=W(k,G,Y);if(u&&await Bun.file(u).exists())J.add(u);d=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+d+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=W0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let[,A,M,I,T]=N;try{let k,D=M.trim();if(J0(D))k=Q0(D,Object.keys(Z))(...Object.values(Z));else k=Z0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await U(A,S,$,O);P+=C}else if(T)P=await U(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+W0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let A=N[1],M=w.slice(N[0].length),I,T=M.match(/^\s*,\s*\{/);if(T){M=M.slice(T[0].length-1);let P=1,y=1;while(y<M.length&&P>0){if(M[y]==="{")P++;else if(M[y]==="}"){if(P--,P===0)break}y++}I=M.substring(0,y+1),M=M.slice(y+1)}let k,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(A.replace(/'/g,'"')),y={};if(I)try{y=O0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(X.debug){let d=W0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>d)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=W(C,G,Y);if(!x)continue;if(await c(x)){let d=await U(C,y,$,O);K=K.replace(R,()=>d),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(X.debug){let C=W0("Include",`None of the includeFirst paths exist: ${A}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=W0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function W(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=j0.resolve(_),V=j0.resolve(j0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=j0.resolve(_,F);else w=j0.resolve(V,F);let R=j0.normalize(w),N=R.startsWith(L+j0.sep)||R===L,A=R.startsWith(V+j0.sep)||R===V,M=!1,I=j0.dirname(V);if(R.startsWith(I+j0.sep)){if(!j0.relative(I,R).split(j0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))M=!0}if(!N&&!A&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let z=j0.resolve(Y);Q.add(z);async function U(B,_={},O,F){let L=W(B,G,Y);if(!L)return W0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=j0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>j0.basename(R)).join(" -> ");return W0("Include",`Circular include detected: ${w}`,Y,O,F)}try{J.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let d=x instanceof Error?x.message:String(x);return W0("Include",`Error loading include file ${B}: ${d}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (n6(),i6));w=x(w,Z)}if(w&&(X.debug||!F$()&&!t4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (s6(),UJ));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N9(),fJ));await x(w,Z,L,X,J)}catch(x){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let N=$4(R);if(N)R=N.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(M)I=`<style${M[1]}>${M[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=z1(w);for(let[x,d]of Object.entries(_))T[x]=d;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let d=x[1]||"",u=x[2]||"",Y0=d.includes("server"),d0=m1(d),V0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:B0}=await Promise.resolve().then(() => (X$(),jZ)),u0=p(u,{filePath:L,projectRoot:process.cwd()});u=u0.code,V0=B0(u0.styles)}catch(p){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(d0&&u.trim())u=d1(u);if(!Y0)try{let{hasUserImports:p,bundleClientScript:B0}=await Promise.resolve().then(() => (t5(),a5));if(p(u))u=await B0(u,L,{projectRoot:process.cwd()})}catch(p){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let i0=gH(u);if(i0&&!Y0){y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cJ}`;let p=x0(u),B0=hH(p,y);P+=`${V0}<script data-stx-scoped data-stx-run="always">${B0}</script>
11847
- `;continue}if(Y0)try{let{extractVariables:p}=await Promise.resolve().then(() => (z$(),X4));await p(u,T,L)}catch(p){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!Y0&&!i0){let p=d.replace(/\bclient\b/i,"").trim();y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cJ}`;let B0=x0(u),u0=oJ(B0,y),_1=nJ(B0,u0);P+=`${V0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${_1}</script>
11846
+ })();`}function mH($,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 J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function uH($){if($.__onceStore instanceof Set)return $.__onceStore;return dH}async function D9($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||j0.join(j0.dirname(Y),"partials");if(G&&!j0.isAbsolute(G))G=j0.resolve(process.cwd(),G);let K=fH($,"@partial","@include"),q=uH(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(q.has(L))return"";return q.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let N=R[1],A=W(N,G,Y),M="";if(A&&await Bun.file(A).exists())J.add(A),M=`@include(${w})`;K=K.substring(0,O)+M+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+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 N=K.substring(V+1,R-1),A=I9(N,0);if(A===-1){O.lastIndex=R;continue}let M=N.substring(0,A).trim(),I=N.substring(A+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=I9(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${M})`,C;if(Q0(S)){let u=G0(S,Object.keys(Z));C=Boolean(u(...Object.values(Z)))}else C=Boolean(Z0(S,Z));let x=_?!C:C,d="";if(x){let u=W(k,G,Y);if(u&&await Bun.file(u).exists())J.add(u);d=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+d+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=z0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let[,A,M,I,T]=N;try{let k,D=M.trim();if(Q0(D))k=G0(D,Object.keys(Z))(...Object.values(Z));else k=Z0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await U(A,S,$,O);P+=C}else if(T)P=await U(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+z0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let A=N[1],M=w.slice(N[0].length),I,T=M.match(/^\s*,\s*\{/);if(T){M=M.slice(T[0].length-1);let P=1,y=1;while(y<M.length&&P>0){if(M[y]==="{")P++;else if(M[y]==="}"){if(P--,P===0)break}y++}I=M.substring(0,y+1),M=M.slice(y+1)}let k,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(A.replace(/'/g,'"')),y={};if(I)try{y=O0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(X.debug){let d=z0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>d)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=W(C,G,Y);if(!x)continue;if(await c(x)){let d=await U(C,y,$,O);K=K.replace(R,()=>d),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(X.debug){let C=z0("Include",`None of the includeFirst paths exist: ${A}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=z0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function W(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=j0.resolve(_),V=j0.resolve(j0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=j0.resolve(_,F);else w=j0.resolve(V,F);let R=j0.normalize(w),N=R.startsWith(L+j0.sep)||R===L,A=R.startsWith(V+j0.sep)||R===V,M=!1,I=j0.dirname(V);if(R.startsWith(I+j0.sep)){if(!j0.relative(I,R).split(j0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))M=!0}if(!N&&!A&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let z=j0.resolve(Y);Q.add(z);async function U(B,_={},O,F){let L=W(B,G,Y);if(!L)return z0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=j0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>j0.basename(R)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,O,F)}try{J.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let d=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${B}: ${d}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (n6(),i6));w=x(w,Z)}if(w&&(X.debug||!F$()&&!t4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (s6(),UJ));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N9(),fJ));await x(w,Z,L,X,J)}catch(x){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let N=$4(R);if(N)R=N.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(M)I=`<style${M[1]}>${M[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=z1(w);for(let[x,d]of Object.entries(_))T[x]=d;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let d=x[1]||"",u=x[2]||"",X0=d.includes("server"),d0=m1(d),V0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:B0}=await Promise.resolve().then(() => (X$(),jZ)),u0=p(u,{filePath:L,projectRoot:process.cwd()});u=u0.code,V0=B0(u0.styles)}catch(p){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(d0&&u.trim())u=d1(u);if(!X0)try{let{hasUserImports:p,bundleClientScript:B0}=await Promise.resolve().then(() => (t5(),a5));if(p(u))u=await B0(u,L,{projectRoot:process.cwd()})}catch(p){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let i0=gH(u);if(i0&&!X0){y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cJ}`;let p=x0(u),B0=hH(p,y);P+=`${V0}<script data-stx-scoped data-stx-run="always">${B0}</script>
11847
+ `;continue}if(X0)try{let{extractVariables:p}=await Promise.resolve().then(() => (z$(),X4));await p(u,T,L)}catch(p){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!X0&&!i0){let p=d.replace(/\bclient\b/i,"").trim();y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cJ}`;let B0=x0(u),u0=oJ(B0,y),_1=nJ(B0,u0);P+=`${V0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${_1}</script>
11848
11848
  `}}if(y){let x=mH(R,y);if(R=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),y=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await D9(R,T,L,X,J,Q);let{processLoops:S}=await Promise.resolve().then(() => (T9(),lJ)),C=S(R,T,L);if(C=$5(C,T,L),C=A1(C,T,L),I)C+=`
11849
11849
  `+I;if(P)C+=`
11850
- `+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return W0("Include",`Error processing include ${B}: ${R}`,Y,O,F)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,F=_+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(B,F),V=K.substring(_+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let R=w[1],N,A=V.substring(w[0].length),M=I9(A,0);if(M!==-1)N=A.substring(M+1).trim();let I={};if(N)try{I=O0(N,Z)}catch(k){let D=k instanceof Error?k.message:String(k);K=K.replace(L,W0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let T=await U(R,I,$,B);K=K.substring(0,B)+T+K.substring(F),j.lastIndex=0}return K}function E9($,Z){let Y=$;function X(J,Q,G,K){let q=J,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let j=U.index,H=U[1],B=j+U[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=B,V=-1;while(F>0&&L<q.length){let R=q.slice(L),N=R.match(_),A=R.match(O),M=N?L+N.index:1/0,I=A?L+A.index:1/0;if(M<I)F++,L=M+(N[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);q=q.substring(0,j)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function k9($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
11851
- `)})}var cJ=0,ZT,dH;var sJ=b(()=>{B3();z7();Z1();e0();V5();F0();R0();ZT=new p1(500),dH=new Set});import*as b9 from"path";async function rJ($,Z,Y=""){if(b9.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 tJ($,Z,Y,"@js","@endjs")}async function aJ($,Z,Y=""){if(b9.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return tJ($,Z,Y,"@ts","@endts")}async function tJ($,Z,Y,X,J){let Q=$,G=L5(`${X}([\\s\\S]*?)${J}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=z.trim();if(X==="@ts")_=_.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 F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
11850
+ `+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return z0("Include",`Error processing include ${B}: ${R}`,Y,O,F)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,F=_+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(B,F),V=K.substring(_+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let R=w[1],N,A=V.substring(w[0].length),M=I9(A,0);if(M!==-1)N=A.substring(M+1).trim();let I={};if(N)try{I=O0(N,Z)}catch(k){let D=k instanceof Error?k.message:String(k);K=K.replace(L,z0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let T=await U(R,I,$,B);K=K.substring(0,B)+T+K.substring(F),j.lastIndex=0}return K}function E9($,Z){let Y=$;function X(J,Q,G,K){let q=J,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let j=U.index,H=U[1],B=j+U[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=B,V=-1;while(F>0&&L<q.length){let R=q.slice(L),N=R.match(_),A=R.match(O),M=N?L+N.index:1/0,I=A?L+A.index:1/0;if(M<I)F++,L=M+(N[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);q=q.substring(0,j)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function k9($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
11851
+ `)})}var cJ=0,ZT,dH;var sJ=b(()=>{B3();z7();Y1();$1();V5();F0();R0();ZT=new p1(500),dH=new Set});import*as b9 from"path";async function rJ($,Z,Y=""){if(b9.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 tJ($,Z,Y,"@js","@endjs")}async function aJ($,Z,Y=""){if(b9.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return tJ($,Z,Y,"@ts","@endts")}async function tJ($,Z,Y,X,J){let Q=$,G=L5(`${X}([\\s\\S]*?)${J}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=z.trim();if(X==="@ts")_=_.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 F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
11852
11852
  ${_}
11853
11853
  ${L}
11854
- `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=W0(`${X} Directive`,`Error executing code: ${H}`,Y,$,U,W);console.error(B),Q=Q.replace(W,"")}return Q}var eJ=b(()=>{V5();R0()});function pH($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function $Q($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return pH(X,Q||"_method")})}async function ZQ($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;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(Q,Z,Y,X);if(typeof q==="string")Q=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=W0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
11855
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${o0(W)}</div>
11856
- `)}}}return Q}async function YQ($,Z,Y,X){return ZQ($,Z,Y,X,"before")}async function XQ($,Z,Y,X){return ZQ($,Z,Y,X,"after")}var JQ=b(()=>{Z1();R0()});import{defineRoute as HT,defineRoutes as _T,resetRoutes as OT,route as FT,setAppUrl as LT}from"stx-router";import{route as lH}from"stx-router";function QQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?O0(J,{}):{};return lH(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var GQ=b(()=>{F0()});async function KQ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(E$.exact[$])for(let X of E$.exact[$])await Promise.resolve(X(Z,$));if(E$.exact[Y])for(let X of E$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of E$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var E$;var qQ=b(()=>{E$={patterns:[],exact:{}}});function WQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>WQ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function zQ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(W){return J.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let W=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=z,B=!1;while((j=U.exec(z))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.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 (${O})`)(...L);if(_==="class"){let N=WQ(R);if(N){let A=H.match(/\sclass="([^"]*)"/);if(A)H=H.replace(A[0],` class="${A[1]} ${N}"`);else H=H.replace(j[0],` class="${N}"`)}else H=H.replace(j[0],"");B=!0;continue}if(cH.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let N=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${N}"`)}B=!0}catch{continue}}if(B){let _=W.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;q.push({start:Q.index,end:Q.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:j}=q[W];Y=Y.slice(0,z)+j+Y.slice(U)}return Y}var cH;var UQ=b(()=>{cH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function J5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let J=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&iH.has(X[1]),Q=J?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:J,start:X.index,end:X.index+X[0].length}}function oH($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function Y1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=oH($,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 jQ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function C5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function P1($,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 C1($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function sH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function rH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),q;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];q=`${K} as ${L} => ${F}`}else q=`${K} as ${G}`;let W=P1(X.attrs,"v-for"),z=P1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=Y1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z),B=`@foreach(${q})
11854
+ `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=z0(`${X} Directive`,`Error executing code: ${H}`,Y,$,U,W);console.error(B),Q=Q.replace(W,"")}return Q}var eJ=b(()=>{V5();R0()});function pH($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function $Q($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return pH(X,Q||"_method")})}async function ZQ($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;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(Q,Z,Y,X);if(typeof q==="string")Q=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=z0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
11855
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${s0(W)}</div>
11856
+ `)}}}return Q}async function YQ($,Z,Y,X){return ZQ($,Z,Y,X,"before")}async function XQ($,Z,Y,X){return ZQ($,Z,Y,X,"after")}var JQ=b(()=>{Y1();R0()});import{defineRoute as HT,defineRoutes as _T,resetRoutes as OT,route as FT,setAppUrl as LT}from"stx-router";import{route as lH}from"stx-router";function QQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?O0(J,{}):{};return lH(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var GQ=b(()=>{F0()});async function KQ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(E$.exact[$])for(let X of E$.exact[$])await Promise.resolve(X(Z,$));if(E$.exact[Y])for(let X of E$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of E$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var E$;var qQ=b(()=>{E$={patterns:[],exact:{}}});function WQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>WQ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function zQ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(W){return J.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let W=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=z,B=!1;while((j=U.exec(z))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.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 (${O})`)(...L);if(_==="class"){let N=WQ(R);if(N){let A=H.match(/\sclass="([^"]*)"/);if(A)H=H.replace(A[0],` class="${A[1]} ${N}"`);else H=H.replace(j[0],` class="${N}"`)}else H=H.replace(j[0],"");B=!0;continue}if(cH.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let N=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${N}"`)}B=!0}catch{continue}}if(B){let _=W.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;q.push({start:Q.index,end:Q.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:j}=q[W];Y=Y.slice(0,z)+j+Y.slice(U)}return Y}var cH;var UQ=b(()=>{cH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function J5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let J=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&iH.has(X[1]),Q=J?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:J,start:X.index,end:X.index+X[0].length}}function oH($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function X1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=oH($,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 jQ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function C5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function P1($,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 C1($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function sH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function rH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),q;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];q=`${K} as ${L} => ${F}`}else q=`${K} as ${G}`;let W=P1(X.attrs,"v-for"),z=P1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z),B=`@foreach(${q})
11857
11857
  `,_=`${B}${H}
11858
- @endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function aH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=Y1(Z,X),K=P1(X.attrs,"v-if"),q=C1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,z=!0;while(z){let _=Z.slice(W).match(/^\s*/),O=_?_[0].length:0,F=J5(Z,W+O);if(!F){z=!1;break}let L=C5(F.attrs,"v-else-if"),V=jQ(F.attrs,"v-else");if(L!==null){let w=Y1(Z,F),R=P1(F.attrs,"v-else-if"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=Y1(Z,F),R=P1(F.attrs,"v-else"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=!1}else z=!1}let U=[];for(let _ of Q)if(_.type==="if")U.push(`@if(${_.expr})
11858
+ @endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function aH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=X1(Z,X),K=P1(X.attrs,"v-if"),q=C1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,z=!0;while(z){let _=Z.slice(W).match(/^\s*/),O=_?_[0].length:0,F=J5(Z,W+O);if(!F){z=!1;break}let L=C5(F.attrs,"v-else-if"),V=jQ(F.attrs,"v-else");if(L!==null){let w=X1(Z,F),R=P1(F.attrs,"v-else-if"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=X1(Z,F),R=P1(F.attrs,"v-else"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=!1}else z=!1}let U=[];for(let _ of Q)if(_.type==="if")U.push(`@if(${_.expr})
11859
11859
  ${_.element}`);else if(_.type==="else-if")U.push(`@elseif(${_.expr})
11860
11860
  ${_.element}`);else U.push(`@else
11861
11861
  ${_.element}`);U.push("@endif");let j=U.join(`
11862
- `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function tH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function eH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];J=J.replace(K[0],""),J+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=J.match(G)}if(Q){let z=Y1(Z,X),U=Z.slice(z.outerStart,z.outerEnd),j=C1(U,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length;continue}let q=C5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(nH.has(X.tag)){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=Y1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=Y1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}}return Z}function $_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Z_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Y_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=Y1(Z,X),G=P1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function X_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=Y1(Z,X),G=P1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function J_($){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 Q_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;if(!jQ(X.attrs,"v-once")){Y=X.end;continue}let J=P1(X.attrs,"v-once"),Q=Y1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
11862
+ `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function tH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function eH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];J=J.replace(K[0],""),J+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=J.match(G)}if(Q){let z=X1(Z,X),U=Z.slice(z.outerStart,z.outerEnd),j=C1(U,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length;continue}let q=C5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(nH.has(X.tag)){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}}return Z}function $_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Z_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Y_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=X1(Z,X),G=P1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function X_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=X1(Z,X),G=P1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function J_($){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 Q_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;if(!jQ(X.attrs,"v-once")){Y=X.end;continue}let J=P1(X.attrs,"v-once"),Q=X1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
11863
11863
  ${C1(G,{...X,start:0,end:X.end-X.start},J)}
11864
11864
  @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function G_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function K_($){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 BQ($){if(!sH($))return $;let Z=$;return Z=rH(Z),Z=aH(Z),Z=Q_(Z),Z=$_(Z),Z=Z_(Z),Z=eH(Z),Z=tH(Z),Z=K_(Z),Z=Y_(Z),Z=X_(Z),Z=J_(Z),Z=G_(Z),Z}var iH,nH;var HQ=b(()=>{iH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),nH=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 I7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _Q($,Z){let Y=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=Y?Y[1]:$,J=Z0(X,Z);if(J&&typeof J==="string")return J;let Q=X.trim();return S9.has(Q)?Q:null}function OQ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function FQ($,Z,Y){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=X?`<${$} ${X}>`:`<${$}>`;if(q_.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${J}${Y}</${$}>`}async function LQ($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=_Q(z.expr,Z);if(!U||typeof U!=="string"){let L=`<!-- dynamic component: could not resolve "${I7(OQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+L+Q.slice(z.index+z.full.length);continue}if(S9.has(U)){let L=FQ(U,z.attrs,z.slotContent);Q=Q.slice(0,z.index)+L+Q.slice(z.index+z.full.length);continue}let j=z.attrs.trim(),H={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(j))!==null){let L=_[1]||_[2],V=_[3];if(_[1])try{H[L]=Z0(V,Z)}catch{H[L]=V}else H[L]=V}let O=X.componentsDir||"components",F=await o1(U,H,z.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${I7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q=await W_(Q,Z,Y,X,J),Q}async function W_($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=_Q(z.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${I7(OQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}if(S9.has(U)){let B=FQ(U,z.attrs,"");Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}let j=X.componentsDir||"components",H=await o1(U,{},"",j,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${I7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q}var S9,q_;var VQ=b(()=>{R0();F0();S9=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),q_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function H_($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,J=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!z_.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(X!==null&&(typeof X!=="string"||!B_.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!j_.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(Q!==null&&!U_.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:Y==="system"?"auto":Y,darkClass:X,attribute:J,autoValue:Q}}function __($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function P9($={}){let Z=H_($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${__(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function wQ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=y9($);if(Y===null)return $;let X=P9(Z);return`${$.slice(0,Y)}
11865
11865
  ${X}${$.slice(Y)}`}function y9($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let Y=Z.index+Z[0].length,X=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Y));if(X)Y+=X[0].length;return Y}function L_($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let Y=Z.index+Z[0].length,X=$.toLowerCase().indexOf("</head>",Y),J=$.slice(Y,X===-1?$.length:X),Q=F_.exec(J);if(!Q||J.slice(0,Q.index).trim()==="")return $;let G=J.slice(0,Q.index)+J.slice(Q.index+Q[0].length);return $.slice(0,Y)+`
@@ -11887,7 +11887,7 @@ ${B}
11887
11887
  </script>`;X=X.replace(W,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,z,U,j]=q,H=z+j;if(SQ(U))continue;if(/rel=["']stylesheet["']/.test(H)||U.endsWith(".css")){let _=await yQ(U,J,Z);if(_)try{let O=await Bun.file(_).text();Y.add(_);let F=`<style>
11888
11888
  /* Source: ${U} */
11889
11889
  ${O}
11890
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(O){}}}return X}var CQ=b(()=>{V1()});function k7($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),j=Y.substring(Q,q+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?U.substring(0,H).trim():U,L=H>=0?U.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(J0(V))w=Q0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let N=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+N+Y.substring(q+1),X.lastIndex=Q+N.length}catch(V){r0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+j.length}}return Y}function b7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function vQ($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),j=U.indexOf("@endmemo");if(j===-1)continue;let H=U.slice(0,j),B=z+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(R){let[A,M,I="",T]=R,k=`<${M}${I} data-stx-memo="${W}"${T}>`;N=H.slice(0,O)+k+w.slice(A.length)+H.slice(O+w.length)}else N=`${H.slice(0,O)}<div data-stx-memo="${W}">${w}</div>${H.slice(O+w.length)}`;J.push({start:Q,end:B,replacement:N}),Y.lastIndex=B}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function h9($){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 xQ($){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="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,q=!1,W=!1,z=-1;while(K<$.length){let _=$[K];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let j=$.slice(z+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(J,z)+" x-cloak>",J=z+1}return X+=$.slice(J),X}function fQ($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+J[0].length,q=!1,W=!1,z=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+J[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!T_.test(U))continue;let j=$[z-1]==="/",H=j?z-1:z;Y+=`${$.slice(X,H)} x-cloak${j?" ":""}`,X=H}return Y+=$.slice(X),Y}var T_;var m9=b(()=>{U1();F0();T_=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function S7($,Z,Y,X){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=J.allowPatterns??[],G=[];for(let{pattern:K,message:q,suggestion:W}of I_){if(Q.some((U)=>/\w/.test(U)&&q.includes(U)))continue;K.lastIndex=0;let z=$.match(K);if(z&&z.length>0){let U=$.split(`
11890
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(O){}}}return X}var CQ=b(()=>{V1()});function k7($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),j=Y.substring(Q,q+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?U.substring(0,H).trim():U,L=H>=0?U.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let N=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+N+Y.substring(q+1),X.lastIndex=Q+N.length}catch(V){a0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+j.length}}return Y}function b7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function vQ($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),j=U.indexOf("@endmemo");if(j===-1)continue;let H=U.slice(0,j),B=z+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(R){let[A,M,I="",T]=R,k=`<${M}${I} data-stx-memo="${W}"${T}>`;N=H.slice(0,O)+k+w.slice(A.length)+H.slice(O+w.length)}else N=`${H.slice(0,O)}<div data-stx-memo="${W}">${w}</div>${H.slice(O+w.length)}`;J.push({start:Q,end:B,replacement:N}),Y.lastIndex=B}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function h9($){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 xQ($){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="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,q=!1,W=!1,z=-1;while(K<$.length){let _=$[K];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let j=$.slice(z+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(J,z)+" x-cloak>",J=z+1}return X+=$.slice(J),X}function fQ($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+J[0].length,q=!1,W=!1,z=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+J[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!T_.test(U))continue;let j=$[z-1]==="/",H=j?z-1:z;Y+=`${$.slice(X,H)} x-cloak${j?" ":""}`,X=H}return Y+=$.slice(X),Y}var T_;var m9=b(()=>{U1();F0();T_=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function S7($,Z,Y,X){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=J.allowPatterns??[],G=[];for(let{pattern:K,message:q,suggestion:W}of I_){if(Q.some((U)=>/\w/.test(U)&&q.includes(U)))continue;K.lastIndex=0;let z=$.match(K);if(z&&z.length>0){let U=$.split(`
11891
11891
  `),j=[];U.forEach((O,F)=>{if(K.lastIndex=0,K.test(O))j.push(F+1)});let H=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",B=j.slice(0,3).map((O)=>` ${O} | ${(U[O-1]??"").trim().slice(0,100)}`).join(`
11892
11892
  `),_=B?`
11893
11893
  ${B}`:"";G.push(` \u2717 ${q}${H}
@@ -11895,15 +11895,15 @@ ${B}`:"";G.push(` \u2717 ${q}${H}
11895
11895
  ${G.join(`
11896
11896
  `)}
11897
11897
  Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var I_;var d9=b(()=>{I_=[{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:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{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"}]});import D_ from"fs";function y7($){return[...$].sort().map((Z)=>{try{let Y=D_.statSync(Z);return`${Z}:${Y.size}:${Y.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
11898
- `)}function P7($,Z,Y){let X=$.get(Z);return X!==void 0&&X.signature===Y?X.value:void 0}function X1($,Z,Y,X){return $.set(Z,{signature:Y,value:X}),X}var u9=()=>{};var gQ={};o(gQ,{getStoreScript:()=>k_,clearStoreCache:()=>b_});import C7 from"path";function E_($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let X of(Y[1]??"").split(",")){let Q=((X.includes(":")?X.split(":").pop():X)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let X of(Y[1]??"").split(",")){let J=X.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))Z.add(J)}}async function k_($){let Z;if($)Z=C7.resolve($);else{let B=await D1();Z=C7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),X=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=C7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;X.push(B)}}catch{return X1(f5,Z,"",""),null}let J=y7(X),Q=P7(f5,Z,J);if(Q!==void 0)return Q||null;if(X.length===0)return X1(f5,Z,J,""),null;let G=[];for(let B of X){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),q=[],W=new Set,z=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()});for(let B of K)try{let _=await Bun.file(B).text(),O=C7.basename(B,".ts");E_(_,W),_=x0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=z.transformSync(_),q.push(`// Store: ${O}
11899
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(q.length===0)return X1(f5,Z,J,""),null;let U=q.join(`
11898
+ `)}function P7($,Z,Y){let X=$.get(Z);return X!==void 0&&X.signature===Y?X.value:void 0}function J1($,Z,Y,X){return $.set(Z,{signature:Y,value:X}),X}var u9=()=>{};var gQ={};o(gQ,{getStoreScript:()=>k_,clearStoreCache:()=>b_});import C7 from"path";function E_($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let X of(Y[1]??"").split(",")){let Q=((X.includes(":")?X.split(":").pop():X)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let X of(Y[1]??"").split(",")){let J=X.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))Z.add(J)}}async function k_($){let Z;if($)Z=C7.resolve($);else{let B=await D1();Z=C7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),X=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=C7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;X.push(B)}}catch{return J1(f5,Z,"",""),null}let J=y7(X),Q=P7(f5,Z,J);if(Q!==void 0)return Q||null;if(X.length===0)return J1(f5,Z,J,""),null;let G=[];for(let B of X){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),q=[],W=new Set,z=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()});for(let B of K)try{let _=await Bun.file(B).text(),O=C7.basename(B,".ts");E_(_,W),_=x0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=z.transformSync(_),q.push(`// Store: ${O}
11899
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(q.length===0)return J1(f5,Z,J,""),null;let U=q.join(`
11900
11900
 
11901
11901
  `),H=`;(function(){
11902
11902
  var __stx = window.stx || {};
11903
11903
  ${W1.filter((B)=>!W.has(B)&&new RegExp(`\\b${B}\\b`).test(U)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
11904
11904
  `)}
11905
11905
  ${U}
11906
- })();`;return X1(f5,Z,J,H),H}function b_(){f5.clear()}var f5;var hQ=b(()=>{w1();V1();e0();u9();f5=new Map});var p9,cT;var mQ=b(()=>{p9=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],cT=new Set(p9)});var pQ={};o(pQ,{selectComposableFiles:()=>dQ,referencedFrameworkComposables:()=>uQ,getFrameworkComposableScript:()=>C_,clearFrameworkComposableCache:()=>y_,__setRuntimeOwnedForTest:()=>v_});import v7 from"path";function y_(){k$.clear()}function dQ($){let Z=new Map;for(let Y of $){let X=v7.basename(Y);if(X.endsWith(".d.ts"))continue;let J=X.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===X)continue;let Q=Z.get(J);if(Q&&!Q.endsWith(".js"))continue;Z.set(J,Y)}return[...Z.values()].sort()}function P_($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function uQ($){if(!$)return[];let Z=$.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=[];for(let X of S_){if(l9.has(X))continue;let J=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test(Z))Y.push(X)}return Y.sort()}async function C_($,Z){let Y=uQ($);if(Y.length===0)return null;let X=Z??v7.join(import.meta.dir,"composables"),J=`${X}\x00${Y.join(",")}`,Q=k$.get(J);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),K=new Set(Y),q=[],W=new Set,z=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:X,absolute:!0}))z.push(_)}catch{return k$.set(J,""),null}z=dQ(z);for(let B of z){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${v7.basename(B).replace(/\.[jt]s$/,"")}
11906
+ })();`;return J1(f5,Z,J,H),H}function b_(){f5.clear()}var f5;var hQ=b(()=>{w1();V1();$1();u9();f5=new Map});var p9,cT;var mQ=b(()=>{p9=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],cT=new Set(p9)});var pQ={};o(pQ,{selectComposableFiles:()=>dQ,referencedFrameworkComposables:()=>uQ,getFrameworkComposableScript:()=>C_,clearFrameworkComposableCache:()=>y_,__setRuntimeOwnedForTest:()=>v_});import v7 from"path";function y_(){k$.clear()}function dQ($){let Z=new Map;for(let Y of $){let X=v7.basename(Y);if(X.endsWith(".d.ts"))continue;let J=X.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===X)continue;let Q=Z.get(J);if(Q&&!Q.endsWith(".js"))continue;Z.set(J,Y)}return[...Z.values()].sort()}function P_($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function uQ($){if(!$)return[];let Z=$.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=[];for(let X of S_){if(l9.has(X))continue;let J=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test(Z))Y.push(X)}return Y.sort()}async function C_($,Z){let Y=uQ($);if(Y.length===0)return null;let X=Z??v7.join(import.meta.dir,"composables"),J=`${X}\x00${Y.join(",")}`,Q=k$.get(J);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),K=new Set(Y),q=[],W=new Set,z=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:X,absolute:!0}))z.push(_)}catch{return k$.set(J,""),null}z=dQ(z);for(let B of z){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${v7.basename(B).replace(/\.[jt]s$/,"")}
11907
11907
  ${G.transformSync(_).trim()}`);for(let F of O)W.add(F)}catch(F){console.warn(`[stx] framework composable ${v7.basename(B)} could not be bundled:`,F)}}let U=Y.filter((B)=>!W.has(B)&&!P_($,B));if(U.length>0)console.warn(`[stx] could not bundle ${U.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return k$.set(J,""),null;let j=[...W].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
11908
11908
  `),H=`<script data-stx-framework-composables>
11909
11909
  ;(function(){
@@ -11913,8 +11913,8 @@ ${q.join(`
11913
11913
  `)}
11914
11914
  ${j}
11915
11915
  })();
11916
- </script>`;return k$.set(J,H),H}function v_($){l9.clear();for(let Z of $)l9.add(Z)}var k$,l9,S_;var lQ=b(()=>{V1();mQ();k$=new Map,l9=new Set,S_=new Set(p9)});var iQ={};o(iQ,{getComposableScript:()=>h_,clearComposableCache:()=>m_});import b$ from"path";function cQ($){let Z=b$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function f_($){if($)return b$.resolve($);let Z=`<default>:${process.cwd()}`,Y=c9.get(Z);if(Y!==void 0)return Y;let X=await g_();if(X!==null)c9.set(Z,X);return X}async function g_(){let $=await D1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return b$.resolve(Z,Y);for(let X of x_){let J=b$.resolve(Z,X);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:J,absolute:!0}))if(!cQ(G))return J}catch{}}return null}async function h_($){let Z=await f_($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(cQ(_))continue;Y.push(_)}}catch{return X1(g5,Z,"",""),null}let X=y7(Y),J=P7(g5,Z,X);if(J!==void 0)return J||null;if(Y.length===0)return X1(g5,Z,X,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),G=[],K=new Set,q=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=b$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])q.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=x0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
11917
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return X1(g5,Z,X,""),null;let W=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
11916
+ </script>`;return k$.set(J,H),H}function v_($){l9.clear();for(let Z of $)l9.add(Z)}var k$,l9,S_;var lQ=b(()=>{V1();mQ();k$=new Map,l9=new Set,S_=new Set(p9)});var iQ={};o(iQ,{getComposableScript:()=>h_,clearComposableCache:()=>m_});import b$ from"path";function cQ($){let Z=b$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function f_($){if($)return b$.resolve($);let Z=`<default>:${process.cwd()}`,Y=c9.get(Z);if(Y!==void 0)return Y;let X=await g_();if(X!==null)c9.set(Z,X);return X}async function g_(){let $=await D1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return b$.resolve(Z,Y);for(let X of x_){let J=b$.resolve(Z,X);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:J,absolute:!0}))if(!cQ(G))return J}catch{}}return null}async function h_($){let Z=await f_($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(cQ(_))continue;Y.push(_)}}catch{return J1(g5,Z,"",""),null}let X=y7(Y),J=P7(g5,Z,X);if(J!==void 0)return J||null;if(Y.length===0)return J1(g5,Z,X,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),G=[],K=new Set,q=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=b$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])q.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=x0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
11917
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return J1(g5,Z,X,""),null;let W=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
11918
11918
  `),z=JSON.stringify([...K]),U=G.join(`
11919
11919
 
11920
11920
  `),H=`;(function(){
@@ -11938,7 +11938,7 @@ ${W}
11938
11938
  }
11939
11939
  window[__n] = __c[__n];
11940
11940
  }
11941
- })();`;return X1(g5,Z,X,H),H}function m_(){g5.clear(),c9.clear()}var g5,c9,x_;var nQ=b(()=>{w1();V1();u9();e0();g5=new Map,c9=new Map,x_=["composables","functions"]});var sQ={};o(sQ,{processDeferDirectives:()=>c_});function d_(){return`stx-defer-${++oQ}`}function u_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function p_($,Z,Y){let{trigger:X,value:J}=u_(Z),Q=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:X,triggerValue:J,content:Q,placeholder:G,loading:K,error:q}}function l_($,Z){let{trigger:Y,triggerValue:X}=Z,J;switch(Y){case"visible":J=`
11941
+ })();`;return J1(g5,Z,X,H),H}function m_(){g5.clear(),c9.clear()}var g5,c9,x_;var nQ=b(()=>{w1();V1();u9();$1();g5=new Map,c9=new Map,x_=["composables","functions"]});var sQ={};o(sQ,{processDeferDirectives:()=>c_});function d_(){return`stx-defer-${++oQ}`}function u_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function p_($,Z,Y){let{trigger:X,value:J}=u_(Z),Q=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:X,triggerValue:J,content:Q,placeholder:G,loading:K,error:q}}function l_($,Z){let{trigger:Y,triggerValue:X}=Z,J;switch(Y){case"visible":J=`
11942
11942
  const observer = new IntersectionObserver((entries) => {
11943
11943
  if (entries[0].isIntersecting) {
11944
11944
  observer.disconnect();
@@ -14276,7 +14276,7 @@ else {
14276
14276
  <script type="application/json" id="stx-island-manifest">
14277
14277
  ${JSON.stringify(Z)}
14278
14278
  </script>
14279
- `}var iO;var SG=b(()=>{iO={processPartialHydrationDirectives:RG,processStaticDirectives:EG,generatePartialHydrationCSS:NG,generateIslandManifest:kG,createIslandRegistry:wG,hydrateIsland:AG,hydrateByStrategy:MG,hydrateAll:TG,isHydrated:IG,onHydrated:DG}});var uG={};o(uG,{watchMultiple:()=>xG,watchEffect:()=>fG,watch:()=>vG,unref:()=>yG,toRefs:()=>PG,throttledComputed:()=>dG,stxWatchMultiple:()=>xG,stxWatchEffect:()=>fG,stxWatch:()=>vG,stxUnref:()=>yG,stxToRefs:()=>PG,stxThrottledComputed:()=>dG,stxShallowRef:()=>CG,stxRef:()=>m5,stxIsRef:()=>v1,stxDebouncedComputed:()=>mG,stxComputed:()=>y$,shallowRef:()=>CG,ref:()=>m5,processWatchDirectives:()=>hG,processComputedDirectives:()=>gG,isRef:()=>v1,default:()=>nO,debouncedComputed:()=>mG,computed:()=>y$});function m5($){let Z=$,Y=new Set,X={get value(){if(J1){let J=S$.get(X);if(!J)J=new Set,S$.set(X,J);J.add(J1)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=S$.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function v1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function yG($){return v1($)?$.value:$}function PG($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=m5($[Y]);return Z}function CG($){return m5($)}function y$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let j=U.value;q.forEach((H)=>H(j))}};function z(){K.clear();let j=J1;J1=W,x7.push(W);try{return Y()}finally{x7.pop(),J1=j}}let U={get value(){if(J1){let j=S$.get(U);if(!j)j=new Set,S$.set(U,j);j.add(J1)}if(G){let j=z();if(!J(Q,j))Q=j;G=!1}return Q},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function vG($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(v1($))return J?Q5($.value):$.value;return $()},U=()=>{if(!q||W)return;let B=z();if(K!==void 0&&Object.is(K,B)&&!J)return;let _=()=>{if(Z(B,K),K=J?Q5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(v1($))j=$.subscribe(()=>U());else j=y$($).subscribe(()=>U());if(X)K=void 0,U();else K=z();let H=()=>{if(q=!1,j)j(),j=null};return H.pause=()=>{W=!0},H.resume=()=>{W=!1},H}function xG($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((U)=>v1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((j)=>v1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],J)z()},W=$.map((U)=>{if(v1(U))return U.subscribe(()=>q());return()=>{}});if(X)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function fG($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let q=J1;J1=G,x7.push(G);try{X=$()}finally{x7.pop(),J1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function gG($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function hG($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
14279
+ `}var iO;var SG=b(()=>{iO={processPartialHydrationDirectives:RG,processStaticDirectives:EG,generatePartialHydrationCSS:NG,generateIslandManifest:kG,createIslandRegistry:wG,hydrateIsland:AG,hydrateByStrategy:MG,hydrateAll:TG,isHydrated:IG,onHydrated:DG}});var uG={};o(uG,{watchMultiple:()=>xG,watchEffect:()=>fG,watch:()=>vG,unref:()=>yG,toRefs:()=>PG,throttledComputed:()=>dG,stxWatchMultiple:()=>xG,stxWatchEffect:()=>fG,stxWatch:()=>vG,stxUnref:()=>yG,stxToRefs:()=>PG,stxThrottledComputed:()=>dG,stxShallowRef:()=>CG,stxRef:()=>m5,stxIsRef:()=>v1,stxDebouncedComputed:()=>mG,stxComputed:()=>y$,shallowRef:()=>CG,ref:()=>m5,processWatchDirectives:()=>hG,processComputedDirectives:()=>gG,isRef:()=>v1,default:()=>nO,debouncedComputed:()=>mG,computed:()=>y$});function m5($){let Z=$,Y=new Set,X={get value(){if(Q1){let J=S$.get(X);if(!J)J=new Set,S$.set(X,J);J.add(Q1)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=S$.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function v1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function yG($){return v1($)?$.value:$}function PG($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=m5($[Y]);return Z}function CG($){return m5($)}function y$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let j=U.value;q.forEach((H)=>H(j))}};function z(){K.clear();let j=Q1;Q1=W,x7.push(W);try{return Y()}finally{x7.pop(),Q1=j}}let U={get value(){if(Q1){let j=S$.get(U);if(!j)j=new Set,S$.set(U,j);j.add(Q1)}if(G){let j=z();if(!J(Q,j))Q=j;G=!1}return Q},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function vG($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(v1($))return J?Q5($.value):$.value;return $()},U=()=>{if(!q||W)return;let B=z();if(K!==void 0&&Object.is(K,B)&&!J)return;let _=()=>{if(Z(B,K),K=J?Q5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(v1($))j=$.subscribe(()=>U());else j=y$($).subscribe(()=>U());if(X)K=void 0,U();else K=z();let H=()=>{if(q=!1,j)j(),j=null};return H.pause=()=>{W=!0},H.resume=()=>{W=!1},H}function xG($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((U)=>v1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((j)=>v1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],J)z()},W=$.map((U)=>{if(v1(U))return U.subscribe(()=>q());return()=>{}});if(X)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function fG($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let q=Q1;Q1=G,x7.push(G);try{X=$()}finally{x7.pop(),Q1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function gG($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function hG($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
14280
14280
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
14281
14281
  (function() {
14282
14282
  // Watch implementation for ${Q}
@@ -14288,7 +14288,7 @@ else {
14288
14288
  }
14289
14289
  })();
14290
14290
  </script>
14291
- `})}function Q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>Q5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(Q5(J),Q5(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(Q5(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=Q5($[Y]);return Z}function mG($,Z=100){let Y=m5($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function dG($,Z=100){let Y=m5($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var J1=null,x7,S$,nO;var pG=b(()=>{x7=[],S$=new WeakMap;nO={ref:m5,computed:y$,watch:vG,watchMultiple:xG,watchEffect:fG,isRef:v1,unref:yG,toRefs:PG,shallowRef:CG,debouncedComputed:mG,throttledComputed:dG,processComputedDirectives:gG,processWatchDirectives:hG}});function P$($,Z){let Y={};for(let X of $)Y[X]=E1(Z(X));return new Proxy({},{get:(X,J)=>Y[J]?.(),set:(X,J,Q)=>{if(Y[J])Y[J].set(Q);else Y[J]=E1(Q);return!0},has:(X,J)=>(J in Y),deleteProperty:(X,J)=>{return delete Y[J],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(X,J)=>(J in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[J]()}:void 0})}function oO($,Z){let Y={};for(let X of Z)Y[X]=$[X];return Y}function o9($,Z){let Y=Object.keys($),X=P$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),J=P$(Y,()=>[]),Q=P$(Y,()=>!1),G=P$(Y,()=>!1),K=P$(Y,()=>!1),q=E1(!1);async function W(L){K[L]=!0;let V=await $[L].validate(X[L],X);return J[L]=V,K[L]=!1,V.length===0}async function z(){q.set(!0);let L=await Promise.all(Y.map(W));return q.set(!1),L.every(Boolean)}function U(){for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)X[V]=L[V],G[V]=!0}function H(L,V){X[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)W(L)}function _(L){return{value:X[L],errors:J[L],touched:Q[L],dirty:G[L],valid:J[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await z())await L(oO(X,Y))}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((L)=>J[L].length===0)},get isValidating(){return q()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:z,validateField:W,reset:U,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var lG;var cG=b(()=>{_4();lG=o9});var sG={};o(sG,{v:()=>sO,useForm:()=>o9,processHasErrorsDirective:()=>oG,processFormValidationDirectives:()=>rO,processErrorsDirective:()=>nG,processErrorDirective:()=>iG,defineForm:()=>lG,Validator:()=>d5});class d5{rules=[];defaultValue="";addRule($){let Z=new d5;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:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=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:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||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:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>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 d5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new d5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function iG($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
14291
+ `})}function Q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>Q5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(Q5(J),Q5(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(Q5(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=Q5($[Y]);return Z}function mG($,Z=100){let Y=m5($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function dG($,Z=100){let Y=m5($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var Q1=null,x7,S$,nO;var pG=b(()=>{x7=[],S$=new WeakMap;nO={ref:m5,computed:y$,watch:vG,watchMultiple:xG,watchEffect:fG,isRef:v1,unref:yG,toRefs:PG,shallowRef:CG,debouncedComputed:mG,throttledComputed:dG,processComputedDirectives:gG,processWatchDirectives:hG}});function P$($,Z){let Y={};for(let X of $)Y[X]=E1(Z(X));return new Proxy({},{get:(X,J)=>Y[J]?.(),set:(X,J,Q)=>{if(Y[J])Y[J].set(Q);else Y[J]=E1(Q);return!0},has:(X,J)=>(J in Y),deleteProperty:(X,J)=>{return delete Y[J],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(X,J)=>(J in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[J]()}:void 0})}function oO($,Z){let Y={};for(let X of Z)Y[X]=$[X];return Y}function o9($,Z){let Y=Object.keys($),X=P$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),J=P$(Y,()=>[]),Q=P$(Y,()=>!1),G=P$(Y,()=>!1),K=P$(Y,()=>!1),q=E1(!1);async function W(L){K[L]=!0;let V=await $[L].validate(X[L],X);return J[L]=V,K[L]=!1,V.length===0}async function z(){q.set(!0);let L=await Promise.all(Y.map(W));return q.set(!1),L.every(Boolean)}function U(){for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)X[V]=L[V],G[V]=!0}function H(L,V){X[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)W(L)}function _(L){return{value:X[L],errors:J[L],touched:Q[L],dirty:G[L],valid:J[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await z())await L(oO(X,Y))}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((L)=>J[L].length===0)},get isValidating(){return q()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:z,validateField:W,reset:U,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var lG;var cG=b(()=>{_4();lG=o9});var sG={};o(sG,{v:()=>sO,useForm:()=>o9,processHasErrorsDirective:()=>oG,processFormValidationDirectives:()=>rO,processErrorsDirective:()=>nG,processErrorDirective:()=>iG,defineForm:()=>lG,Validator:()=>d5});class d5{rules=[];defaultValue="";addRule($){let Z=new d5;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:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=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:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||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:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>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 d5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new d5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function iG($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
14292
14292
  `)}catch{return""}})}function nG($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
14293
14293
  `)}catch{return""}})}function oG($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function rO($,Z,Y){let X=$;return X=iG(X,Z,Y),X=nG(X,Z,Y),X=oG(X,Z,Y),X}var sO;var rG=b(()=>{cG();sO=new d5});var eG={};o(eG,{processXElementDirectives:()=>aO,hasXElementDirectives:()=>tG,generateXElementRuntime:()=>aG});function aG(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14294
14294
  (function() {
@@ -14584,32 +14584,32 @@ else {
14584
14584
  `+J.slice(Q)}async function N0($,Z,Y,X,J){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=z1($);let Q=!Z.__stxProcessingDepth;if(Q)HZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!F$()&&!t4())&&Y&&Y.endsWith(".stx"))o6($,Y);try{return await xZ.timeAsync("template-processing",async()=>{let G=await zF($,Z,Y,X,J);if(Q)G=h9(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??H3(),z=(Z.__stx_head_raw||"").trim(),U,j=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),z=z.replace(j[0],"").trim();let H=Z.__sections?.title,B=W.title||U||H,_=!W.title&&(!!U||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
14585
14585
  `),...W.htmlAttrs&&{htmlAttrs:TQ(K.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},F=g9(G);if(G=kQ(G,O,{..._&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}}),F)G=EQ(G,K),G=IQ(G,O.htmlAttrs);let L=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&G.includes("<head")){let R=L[1],N=KF(R);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
14586
14586
  <meta name="stx-layout" content="${YK(R)}">
14587
- <meta name="stx-layout-group" content="${YK(N)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?G4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=N3(G,(N,A)=>`<body${A} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=DQ(G);let K=X.app?.colorMode;if(K)G=wQ(G,K);G=NQ(G),G=WF(G)}if(Q)try{let{getStoreScript:K}=await a("stx/store-loader",()=>Promise.resolve().then(() => (hQ(),gQ))),q=X.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14588
- `+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await a("stx/framework-composables",()=>Promise.resolve().then(() => (lQ(),pQ))),q=await K(G);if(q){let W=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
14589
- `+q+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:K}=await a("stx/composable-loader",()=>Promise.resolve().then(() => (nQ(),iQ))),q=X.composablesDir,W=await K(q);if(W){let z=`<script data-stx-composables>${W}</script>`,U=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14590
- `+z+G.slice(U.end)}}catch{}if(Q)G=RQ(G);if(Q&&Z.__stx_inject_css!==!1)G=await UX(G,void 0,X.buildMode==="serve");if(Q)G=dZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y7)throw G;let K=G instanceof Error?G.message:String(G),q=new a1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(r0.log(q,{filePath:Y,context:Z}),M6.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return N6.createFallbackContent("Template Processing",q)}}async function zF($,Z,Y,X,J){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!E0.isAbsolute(X.partialsDir)?E0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!E0.isAbsolute(X.componentsDir)?E0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!E0.isAbsolute(X.layoutsDir)?E0.resolve(Q,X.layoutsDir):X.layoutsDir},K=G,q=$;await BF(Y,Z),jF(Z,K),q=await T5(()=>YQ(q,Z,Y,K),q,(V)=>{r0.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=$1(q,J$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=W.output;let z=W.tokens,U=(V)=>z.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),q=BQ(q),q=await PQ(q,Y,J);let H={};q=E9(q,H);let B={...Z.__sections||{}},_="",O=NX(RX($)),F=/@nolayout\b/.test(q)||O===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(q))q=`@section('content')
14587
+ <meta name="stx-layout-group" content="${YK(N)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?G4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=N3(G,(N,A)=>`<body${A} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=DQ(G);let K=X.app?.colorMode;if(K)G=wQ(G,K);G=NQ(G),G=WF(G)}if(Q)try{let{getStoreScript:K}=await t("stx/store-loader",()=>Promise.resolve().then(() => (hQ(),gQ))),q=X.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14588
+ `+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await t("stx/framework-composables",()=>Promise.resolve().then(() => (lQ(),pQ))),q=await K(G);if(q){let W=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
14589
+ `+q+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:K}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (nQ(),iQ))),q=X.composablesDir,W=await K(q);if(W){let z=`<script data-stx-composables>${W}</script>`,U=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14590
+ `+z+G.slice(U.end)}}catch{}if(Q)G=RQ(G);if(Q&&Z.__stx_inject_css!==!1)G=await UX(G,void 0,X.buildMode==="serve");if(Q)G=dZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y7)throw G;let K=G instanceof Error?G.message:String(G),q=new a1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(a0.log(q,{filePath:Y,context:Z}),M6.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return N6.createFallbackContent("Template Processing",q)}}async function zF($,Z,Y,X,J){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!E0.isAbsolute(X.partialsDir)?E0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!E0.isAbsolute(X.componentsDir)?E0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!E0.isAbsolute(X.layoutsDir)?E0.resolve(Q,X.layoutsDir):X.layoutsDir},K=G,q=$;await BF(Y,Z),jF(Z,K),q=await T5(()=>YQ(q,Z,Y,K),q,(V)=>{a0.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=Z1(q,J$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=W.output;let z=W.tokens,U=(V)=>z.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),q=BQ(q),q=await PQ(q,Y,J);let H={};q=E9(q,H);let B={...Z.__sections||{}},_="",O=NX(RX($)),F=/@nolayout\b/.test(q)||O===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(q))q=`@section('content')
14591
14591
  ${q.trim()}
14592
14592
  @endsection`}if(!_&&!F&&K.defaultLayout){let V=f9(q),w=/@section\s*\(/.test(q);if(!V||w){let R="",N=E0.dirname(Y),A=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let M=0;M<20;M++){let I=E0.join(N,"_layout.stx");if(await c(I)){R=I;break}let T=E0.dirname(N);if(T===N||T.length<A.length)break;N=T}if(R)_=R;else if(K.layoutsDir){let M=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),I=E0.join(M,`${K.defaultLayout}.stx`);if(await c(I))_=I}if(_&&!w)q=`@section('content')
14593
14593
  ${q.trim()}
14594
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let N=Z0(R.trim(),Z);if(N===void 0)return V;return B[w]=String(N??""),""}catch{return V}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",G5);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=k9(q,H),_){let V=[],w=N1(q),R=$1(w.output,O5,(N,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(N,A,M)=>{let I=A==="SCRIPT"?w.scripts[Number(M)]:R.tokens[Number(M)];if(I)V.push(I);return""}),V.length>0){let N=V.join(`
14594
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let N=Z0(R.trim(),Z);if(N===void 0)return V;return B[w]=String(N??""),""}catch{return V}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",G5);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=k9(q,H),_){let V=[],w=N1(q),R=Z1(w.output,O5,(N,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(N,A,M)=>{let I=A==="SCRIPT"?w.scripts[Number(M)]:R.tokens[Number(M)];if(I)V.push(I);return""}),V.length>0){let N=V.join(`
14595
14595
  `);B.content=B.content?`${B.content}
14596
- ${N}`:N,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,J.add(_);else V=await T5(()=>h3(_,Y,G,J),null,()=>{throw new a1(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=GF.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(r0.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new a1(T,Y);return q}let w=await T5(()=>Bun.file(V).text(),"",()=>{throw new a1(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(G5)){let S=B[P].indexOf(G5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+G5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await N0(D,k,V,G,J)}let N=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=E9(N,H),M={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return M[T]=k.trim(),`@slot('${T}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(G5)){let P=M[T]||"",y=D.indexOf(G5);D=D.slice(0,y)+P+D.slice(y+G5.length)}return D}return k||""}),A=UF(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=k9(A,H),Z.__originalFilePath=Y,q=await JK(A,Z,V,G,J),q=`<!-- stx-layout: ${_} -->
14597
- ${q}`,U(q)}catch(V){return r0.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return U(await JK(q,Z,Y,G,J))}function UF($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,J)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function jF($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(Y)&&Q!==void 0)X[J]=Q;$.$env=X}async function BF($,Z){await T5(()=>KQ($,Z),void 0,(Y)=>{r0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function HF($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await a("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));r0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function _F($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await a("stx/expressions",()=>Promise.resolve().then(() => (Z1(),PZ)));return X($,Z,{skipServer:!0})}catch(X){let J=X instanceof Error?X:Error(String(X));return r0.log(J,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${J.message}`),$}}async function JK($,Z,Y,X,J){let Q=$,G=X;if(await HF(Q,Z,Y),Q=await _F(Q,Z,Y),Q=await rJ(Q,Z,Y),Q=await aJ(Q,Z,Y),Q=await uX(Q,Z,Y,G),z1(Q))Q=P3(Q,Z),Q=v3(Q,Z);Q=C3(Q);let{processStreamDirectives:K}=await a("stx/streaming",()=>Promise.resolve().then(() => (n6(),i6)));Q=K(Q,Z),Q=M9(Q,Z,Y,G),Q=await LQ(Q,Z,Y,G,J),Q=await N7(Q,Z,Y,G,J),Q=E8(Q,Z,Y,G);let{processDeferDirectives:q}=await a("stx/defer",()=>Promise.resolve().then(() => sQ));Q=q(Q,Z,Y);let{processTeleportDirectives:W}=await a("stx/teleport",()=>Promise.resolve().then(() => aQ));Q=W(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await a("stx/transitions",()=>Promise.resolve().then(() => ZG));Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await a("stx/error-boundaries",()=>Promise.resolve().then(() => XG));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await a("stx/suspense",()=>Promise.resolve().then(() => JG));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await a("stx/async-components",()=>Promise.resolve().then(() => qG));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await a("stx/keep-alive",()=>Promise.resolve().then(() => zG));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await a("stx/virtual-scrolling",()=>Promise.resolve().then(() => (OG(),_G)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await a("stx/partial-hydration",()=>Promise.resolve().then(() => (SG(),bG)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:N}=await a("stx/computed",()=>Promise.resolve().then(() => (pG(),uG)));Q=R(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:A}=await a("stx/forms-validation",()=>Promise.resolve().then(() => (rG(),sG)));Q=A(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await a("stx/head",()=>Promise.resolve().then(() => (W$(),O3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
14596
+ ${N}`:N,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,J.add(_);else V=await T5(()=>h3(_,Y,G,J),null,()=>{throw new a1(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=GF.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(a0.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new a1(T,Y);return q}let w=await T5(()=>Bun.file(V).text(),"",()=>{throw new a1(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(G5)){let S=B[P].indexOf(G5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+G5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await N0(D,k,V,G,J)}let N=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=E9(N,H),M={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return M[T]=k.trim(),`@slot('${T}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(G5)){let P=M[T]||"",y=D.indexOf(G5);D=D.slice(0,y)+P+D.slice(y+G5.length)}return D}return k||""}),A=UF(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=k9(A,H),Z.__originalFilePath=Y,q=await JK(A,Z,V,G,J),q=`<!-- stx-layout: ${_} -->
14597
+ ${q}`,U(q)}catch(V){return a0.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return U(await JK(q,Z,Y,G,J))}function UF($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,J)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function jF($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(Y)&&Q!==void 0)X[J]=Q;$.$env=X}async function BF($,Z){await T5(()=>KQ($,Z),void 0,(Y)=>{a0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function HF($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));a0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function _F($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await t("stx/expressions",()=>Promise.resolve().then(() => (Y1(),PZ)));return X($,Z,{skipServer:!0})}catch(X){let J=X instanceof Error?X:Error(String(X));return a0.log(J,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${J.message}`),$}}async function JK($,Z,Y,X,J){let Q=$,G=X;if(await HF(Q,Z,Y),Q=await _F(Q,Z,Y),Q=await rJ(Q,Z,Y),Q=await aJ(Q,Z,Y),Q=await uX(Q,Z,Y,G),z1(Q))Q=P3(Q,Z),Q=v3(Q,Z);Q=C3(Q);let{processStreamDirectives:K}=await t("stx/streaming",()=>Promise.resolve().then(() => (n6(),i6)));Q=K(Q,Z),Q=M9(Q,Z,Y,G),Q=await LQ(Q,Z,Y,G,J),Q=await N7(Q,Z,Y,G,J),Q=E8(Q,Z,Y,G);let{processDeferDirectives:q}=await t("stx/defer",()=>Promise.resolve().then(() => sQ));Q=q(Q,Z,Y);let{processTeleportDirectives:W}=await t("stx/teleport",()=>Promise.resolve().then(() => aQ));Q=W(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await t("stx/transitions",()=>Promise.resolve().then(() => ZG));Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => XG));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await t("stx/suspense",()=>Promise.resolve().then(() => JG));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await t("stx/async-components",()=>Promise.resolve().then(() => qG));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await t("stx/keep-alive",()=>Promise.resolve().then(() => zG));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (OG(),_G)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (SG(),bG)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:N}=await t("stx/computed",()=>Promise.resolve().then(() => (pG(),uG)));Q=R(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:A}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (rG(),sG)));Q=A(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await t("stx/head",()=>Promise.resolve().then(() => (W$(),O3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
14598
14598
  `;if(Q=I(Q,Z),Q=T(Q,Z),Q=QQ(Q),Q=y6(Q,Z),Q=mX(Q),Q=$Q(Q),Q=await D9(Q,Z,Y,G,J),Q=await N7(Q,Z,Y,G,J),Z.__stxProcessingDepth===1)Q=OZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=h9(Q),Q=$5(Q,Z,Y),Q=P6(Q,Z),Q=C6(Q,Z),Q=B7(Q,Z),Q=aX(Q,Z),Q=tX(Q,Z),Q=await EX(Q,Z,Y,G),Q=await u2(Q,Z,Y),Q=await XJ(Q,Z,Y,G),Q=R8(Q,Z,Y,G),Q=oY(Q,Z,Y,G),Q=sY(Q,Z,Y),Q=rY(Q,Z,Y,G),Q=fX(Q,Z,Y,G),Q=k7(Q,Z),Q=b7(Q),Q=vQ(Q),!G.skipEventDirectives)Q=o8(Q,Z,Y);if(Q=IX(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),r=N4($);if(n&&r)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14599
14599
  Both work on the same page, but they manage separate scopes.
14600
- Prefer signals (state/derived/effect) for new components.`)}Q=zQ(Q,Z),Q=await A1(Q,Z,Y),Q=xQ(Q),Q=fQ(Q),Q=FX(Q);let{processXElementDirectives:P}=await a("stx/x-element",()=>Promise.resolve().then(() => eG));Q=P(Q);let y=Z.__originalFilePath||Y,S=Z$(Z);if(Q=await x3(Q,G,y,S),Q=nX(Q,Z),Q=await XQ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await a("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (ZK(),$K)));Q=await r(Q,{publicDir:n})}if(G.seo?.enabled)Q=aY(Q,Z,G);let C=(n,r,K0=!0)=>{if(!r)return n;let A0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),X0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&X0){if(K0)n=n.replace(X0[0],A0[0]);if(r=r.replace(A0[0],"").trim(),!r)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${r}
14600
+ Prefer signals (state/derived/effect) for new components.`)}Q=zQ(Q,Z),Q=await A1(Q,Z,Y),Q=xQ(Q),Q=fQ(Q),Q=FX(Q);let{processXElementDirectives:P}=await t("stx/x-element",()=>Promise.resolve().then(() => eG));Q=P(Q);let y=Z.__originalFilePath||Y,S=Z$(Z);if(Q=await x3(Q,G,y,S),Q=nX(Q,Z),Q=await XQ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (ZK(),$K)));Q=await r(Q,{publicDir:n})}if(G.seo?.enabled)Q=aY(Q,Z,G);let C=(n,r,q0=!0)=>{if(!r)return n;let A0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),J0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&J0){if(q0)n=n.replace(J0[0],A0[0]);if(r=r.replace(A0[0],"").trim(),!r)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${r}
14601
14601
  </head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
14602
14602
  ${r}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
14603
14603
  <head>
14604
14604
  ${r}
14605
- </head>`);return n},{renderHead:x,getHead:d}=await a("stx/head",()=>Promise.resolve().then(() => (W$(),O3))),Y0=Z.__stx_runtime_head??d();if(Y0.title||Y0.meta?.length||Y0.link?.length){let n=x(Y0);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!Y0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=vX(Q,G.csp,Z);if(G.analytics?.enabled)Q=VX(Q,G);if(G.heatmap?.enabled)Q=P8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await a("stx/pwa/inject",()=>Promise.resolve().then(() => (d$(),H8)));Q=n(Q,G)}let d0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),V0=/\bSTX\.\w+/.test(Q),i0=/window\.STX\s*=/.test(Q);if(d0&&V0&&!i0){let r=`<script data-stx-scoped data-stx-run="once">
14605
+ </head>`);return n},{renderHead:x,getHead:d}=await t("stx/head",()=>Promise.resolve().then(() => (W$(),O3))),X0=Z.__stx_runtime_head??d();if(X0.title||X0.meta?.length||X0.link?.length){let n=x(X0);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!X0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=vX(Q,G.csp,Z);if(G.analytics?.enabled)Q=VX(Q,G);if(G.heatmap?.enabled)Q=P8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (d$(),H8)));Q=n(Q,G)}let d0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),V0=/\bSTX\.\w+/.test(Q),i0=/window\.STX\s*=/.test(Q);if(d0&&V0&&!i0){let r=`<script data-stx-scoped data-stx-run="once">
14606
14606
  ${BX()}
14607
- </script>`;if(Q.includes("</head>")){let K0=Q.indexOf("</head>"),X0=Q.slice(0,K0).indexOf("<script");if(X0!==-1){let E=Q.slice(0,X0),v=Q.slice(X0);Q=E+r+`
14607
+ </script>`;if(Q.includes("</head>")){let q0=Q.indexOf("</head>"),J0=Q.slice(0,q0).indexOf("<script");if(J0!==-1){let E=Q.slice(0,J0),v=Q.slice(J0);Q=E+r+`
14608
14608
  `+v}else Q=Q.replace("</head>",`${r}
14609
14609
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
14610
14610
  ${r}`);else Q=r+`
14611
- `+Q}{let{scanScriptTags:n}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4))),r=[];for(let K0 of n(Q)){if(!/\bserver\b/i.test(K0.attrs))continue;let A0=K0.start+K0.fullMatch.indexOf(">")+1,X0=qF(Q,A0);if(X0===-1)continue;let E=X0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:K0.start,end:E})}for(let K0=r.length-1;K0>=0;K0--){let{start:A0,end:X0}=r[K0];Q=Q.substring(0,A0)+Q.substring(X0)}}let p=e$(Q,Y);if(p.hasScoped)Q=p.html;let B0=Z.__stx_event_bindings||[],u0=!1,_1=[],q5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:W5}=await a("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));for(let n of W5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))_1.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:r,content:K0}of _1){u0=!0;let A0=K0;S7(K0,Y,X.strict,Z.__originalFilePath);let X0=await Y$(K0,{eventBindings:B0,attrs:r,hasColonDirectives:q5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:S});Q=Q.replace(n,()=>X0)}if(u0)Z.__stx_event_bindings=[];if(!u0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let r=t7(n);if(r){let K0=Q.lastIndexOf("</body>");Q=K0===-1?Q+r:Q.slice(0,K0)+r+`
14612
- `+Q.slice(K0)}Z.__stx_event_bindings=[]}}if(!I2(Q)&&D2(Q))Q=await L4(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=xX(Q,Z.cspNonce);return Q}var G5="<!--PARENT_CONTENT_PLACEHOLDER-->";var D4=b(()=>{jX();A3();u1();c7();HX();LX();wX();o7();i7();e7();X$();DX();kX();z7();gX();dX();lX();oX();U1();W$();Z1();eX();JJ();sJ();eJ();T9();m3();JQ();V5();GQ();T6();R0();qQ();UQ();HQ();VQ();j3();C9();bQ();H$();N9();CQ();m9();d9();F0();s6();G3();r5();V4();V4();m9();d9()});import wF from"fs";import s9 from"path";import _K from"fs";import K1 from"path";var e9=[72,96,128,144,152,192,384,512],$8=[120,152,167,180],Z8=[16,32];async function Y8($,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 J=K1.isAbsolute(X.src)?X.src:K1.resolve(process.cwd(),X.src);if(!await Bun.file(J).exists())return Y.errors.push(`Source icon not found: ${J}`),Y.success=!1,Y;let Q=K1.resolve(Z,X.outputDir||"pwa-icons");try{_K.mkdirSync(Q,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Q}`),Y.success=!1,Y}let G=X.sizes||e9,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
14611
+ `+Q}{let{scanScriptTags:n}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4))),r=[];for(let q0 of n(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let A0=q0.start+q0.fullMatch.indexOf(">")+1,J0=qF(Q,A0);if(J0===-1)continue;let E=J0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:q0.start,end:E})}for(let q0=r.length-1;q0>=0;q0--){let{start:A0,end:J0}=r[q0];Q=Q.substring(0,A0)+Q.substring(J0)}}let p=e$(Q,Y);if(p.hasScoped)Q=p.html;let B0=Z.__stx_event_bindings||[],u0=!1,_1=[],q5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:W5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));for(let n of W5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))_1.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:r,content:q0}of _1){u0=!0;let A0=q0;S7(q0,Y,X.strict,Z.__originalFilePath);let J0=await Y$(q0,{eventBindings:B0,attrs:r,hasColonDirectives:q5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:S});Q=Q.replace(n,()=>J0)}if(u0)Z.__stx_event_bindings=[];if(!u0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let r=t7(n);if(r){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+r:Q.slice(0,q0)+r+`
14612
+ `+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!I2(Q)&&D2(Q))Q=await L4(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=xX(Q,Z.cspNonce);return Q}var G5="<!--PARENT_CONTENT_PLACEHOLDER-->";var D4=b(()=>{jX();A3();u1();c7();HX();LX();wX();o7();i7();e7();X$();DX();kX();z7();gX();dX();lX();oX();U1();W$();Y1();eX();JJ();sJ();eJ();T9();m3();JQ();V5();GQ();T6();R0();qQ();UQ();HQ();VQ();j3();C9();bQ();H$();N9();CQ();m9();d9();F0();s6();G3();r5();V4();V4();m9();d9()});import wF from"fs";import s9 from"path";import _K from"fs";import K1 from"path";var e9=[72,96,128,144,152,192,384,512],$8=[120,152,167,180],Z8=[16,32];async function Y8($,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 J=K1.isAbsolute(X.src)?X.src:K1.resolve(process.cwd(),X.src);if(!await Bun.file(J).exists())return Y.errors.push(`Source icon not found: ${J}`),Y.success=!1,Y;let Q=K1.resolve(Z,X.outputDir||"pwa-icons");try{_K.mkdirSync(Q,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Q}`),Y.success=!1,Y}let G=X.sizes||e9,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
14613
14613
  Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let U=await W.default(J).metadata();if(U.width&&U.width<512)Y.warnings.push(`Source icon is ${U.width}x${U.height}. Recommend using at least 512x512 for best quality.`);for(let O of G){let F=K1.join(Q,`icon-${O}x${O}.png`);if(await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let L=K1.join(Q,`icon-${O}x${O}.webp`);await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(L),Y.generatedFiles.push(L)}}if(q){for(let F of $8){let L=K1.join(Q,`apple-touch-icon-${F}x${F}.png`);await W.default(J).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}let O=K1.join(Q,"apple-touch-icon.png");await W.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}for(let O of Z8){let F=K1.join(Q,`favicon-${O}x${O}.png`);await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let j=512,H=K1.join(Q,`icon-maskable-${j}x${j}.png`),B=Math.floor(j*0.1),_=j-B*2;await W.default(J).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:B,bottom:B,left:B,right:B,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Y.generatedFiles.push(H)}catch(W){let z=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${z}`),Y.success=!1}return Y}function MF($){let Z=$.sizes||e9,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,J=$.generateAppleIcons??!0,Q=[];for(let G of Z)if(Q.push(`${Y}/icon-${G}x${G}.png`),X)Q.push(`${Y}/icon-${G}x${G}.webp`);if(J){Q.push(`${Y}/apple-touch-icon.png`);for(let G of $8)Q.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of Z8)Q.push(`${Y}/favicon-${G}x${G}.png`);return Q.push(`${Y}/icon-maskable-512x512.png`),Q}async function X8(){try{return await import("sharp"),!0}catch{return!1}}d$();function xK($,Z,Y,X){let J=[],Q=X.join(" ");for(let G of $)if(J.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:Q}),Y)J.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:Q});return J}function fK($){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 gK($){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 hK($){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 mK($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function dK($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,J=X?.sizes||[72,96,128,144,152,192,384,512],Q=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:xK(J,Q,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=fK(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((j)=>({src:j.src,sizes:j.sizes,type:j.type,label:j.label,form_factor:j.platform}));let W=gK($);if(W)q.share_target=W;let z=hK($);if(z)q.file_handlers=z;let U=mK($);if(U)q.protocol_handlers=U;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function _8($){let Z=dK($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function CF($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function vF($){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 J=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!J.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${J.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!Q.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 GK from"path";async function KK($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=GK.isAbsolute(Z.page)?Z.page:GK.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (D4(),QK)),J=await Bun.file(Y).text();return await X(J,{},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 OF($)}function OF($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",J=Z?.fallbackMessage||"Please check your internet connection and try again.",Q=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
14614
14614
  <html lang="en">
14615
14615
  <head>