@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/cli.js +230 -230
- package/dist/craft.js +110 -110
- package/dist/pwa.js +74 -74
- package/dist/ssg.js +108 -108
- package/dist/variable-extractor.js +3 -3
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var _K=Object.defineProperty;var OK=($)=>$;function FK($,Z){this[$]=OK.bind(null,Z)}var
|
|
2
|
+
var _K=Object.defineProperty;var OK=($)=>$;function FK($,Z){this[$]=OK.bind(null,Z)}var t=($,Z)=>{for(var J in Z)_K($,J,{get:Z[J],enumerable:!0,configurable:!0,set:FK.bind(Z,J)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var U0=import.meta.require;import{matchRoute as CF,Router as wK}from"stx-router";import{findErrorPage as fF,formatRoutes as gF,generateRouteManifest as hF,generateRouteTypes as uF,matchRoute as mF}from"stx-router";function i5($,Z={}){return new wK($,Z).routes}var d7=()=>{};function G8($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function p7($,Z){let J={...$};for(let[Y,X]of Object.entries(Z))J[Y]=G8(X)&&G8(J[Y])?p7(J[Y],X):X;return J}function K8($={},Z={}){let J=$.theme||{},Y=Z.theme||{},{extend:X,...Q}=Y,{extend:G,...K}=J,W=p7(K,Q),q=p7(G||{},X||{});if(Object.keys(q).length>0)W.extend=q;let z=[...$.safelist||[],...Z.safelist||[]],U={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:W,safelist:z,shortcuts:U,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}import n5 from"path";function q8($){W8=$?.trim()||null}function o5(){return process.env[NK]?.trim()||W8||_5}function _1($=process.cwd(),...Z){let J=o5();return n5.isAbsolute(J)?n5.join(J,...Z):n5.join($,J,...Z)}function s5($){if(!$||n5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==_5&&!Z.startsWith(`${_5}/`))return $;let J=Z.slice(_5.length+1);return J?n5.join(o5(),J):o5()}var _5=".stx",NK="STX_DIR",W8=null;var r5=()=>{};var O0;var z8=b(()=>{O0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function U8($,Z,J,Y){let X=$;X=X.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,W)=>{let z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${W||z} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return X=X.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),X=X.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,W)=>{return`<span id="${`desc-${K}`}" class="sr-only">${W}</span>`}),X}var j8,B8;var l7=b(()=>{j8={name:"a11y",handler:($,Z,J,Y)=>{if(!Z.length)return $;let X=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[X]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},B8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function RK($,Z={}){let{duration:J,delay:Y,ease:X,direction:Q,custom:G}={...O1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
3
3
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
4
4
|
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
|
|
5
5
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -637,7 +637,7 @@ ${_}
|
|
|
637
637
|
`:`
|
|
638
638
|
`)}</p>`);if(X=K.join(`
|
|
639
639
|
`),Y)X=X.replace(/\n/g,`<br />
|
|
640
|
-
`);for(let z=0;z<Q.length;z++)X=X.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function O5($="const",Z=[],J){let Y=Z.length?F1.filter((X)=>!Z.includes(X)):F1;if(J!==void 0)Y=Y.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(J)});return`${$} { ${Y.join(", ")} } = window.stx;`}function o7($){if(!$)return!1;return yK.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function s7($){if(!$)return!1;let Z=y8($);if(PK.some((J)=>J.test(Z)))return!0;return o7(Z)}function k8($){if(!$)return!1;return CK.test(y8($))||s7($)}function S8(){return`{${E8.map(($)=>`'${$}':1`).join(",")}}`}function y8($){if(!$)return $;let Z=(J)=>J.replace(/(<[^>]*>)|([^<]+)/g,(Y,X,Q)=>X??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(J,Y,X,Q)=>Y+Z(X)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(J,Y,X,Q)=>Y+Z(X)+Q).replace(/<!--[\s\S]*?-->/g,(J)=>" ".repeat(J.length))}var F1,D8,SK,yK,PK,CK,E8,vK,b8;var
|
|
640
|
+
`);for(let z=0;z<Q.length;z++)X=X.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return X=X.replace(/<p>\s*<\/p>/g,""),X.trim()}function O5($="const",Z=[],J){let Y=Z.length?F1.filter((X)=>!Z.includes(X)):F1;if(J!==void 0)Y=Y.filter((X)=>{let Q=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(J)});return`${$} { ${Y.join(", ")} } = window.stx;`}function o7($){if(!$)return!1;return yK.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function s7($){if(!$)return!1;let Z=y8($);if(PK.some((J)=>J.test(Z)))return!0;return o7(Z)}function k8($){if(!$)return!1;return CK.test(y8($))||s7($)}function S8(){return`{${E8.map(($)=>`'${$}':1`).join(",")}}`}function y8($){if(!$)return $;let Z=(J)=>J.replace(/(<[^>]*>)|([^<]+)/g,(Y,X,Q)=>X??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(J,Y,X,Q)=>Y+Z(X)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(J,Y,X,Q)=>Y+Z(X)+Q).replace(/<!--[\s\S]*?-->/g,(J)=>" ".repeat(J.length))}var F1,D8,SK,yK,PK,CK,E8,vK,b8;var K1=b(()=>{F1=["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"],D8=["onMount","onDestroy"];SK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],yK=F1.filter(($)=>!SK.includes($));PK=[/@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/],CK=/\s@[a-z][\w.:-]*\s*=/i;E8=["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"],vK=["x-init","x-transition","x-effect","x-on"],b8=[...E8,...vK]});function v8($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let J of $){let Y=J.toLowerCase();if(Y==="prevent")Z.prevent=!0;else if(Y==="stop")Z.stop=!0;else if(Y==="once")Z.once=!0;else if(Y==="capture")Z.capture=!0;else if(Y==="self")Z.self=!0;else if(Y==="passive")Z.passive=!0;else if(xK.has(Y))Z.systemKeys.push(Y);else if(Y in x8)Z.mouse=Y;else if(Y in C8||/^[a-z]$/.test(Y))Z.keys.push(C8[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let X=Y.match(/debounce(?:\.(\d+))?/);Z.debounce=X?.[1]?Number.parseInt(X[1],10):300}else if(Y.startsWith("throttle")){let X=Y.match(/throttle(?:\.(\d+))?/);Z.throttle=X?.[1]?Number.parseInt(X[1],10):300}}return Z}function f8($){let Z=[],J=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,G,K]=X,W=X.index,q=W+Q.length,z=`__stx_evt_${J++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,V=_.split("."),F=V[0];if(!P8.has(F))continue;U.push({attribute:`@${_}`,event:F,handler:O,modifiers:v8(V.slice(1)),elementId:z})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,V=_.split("."),F=V[0];if(!P8.has(F))continue;U.push({attribute:`@${_}`,event:F,handler:O,modifiers:v8(V.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:W,endIndex:q})}return Z}function fK($){let Z=[],{modifiers:J}=$;if(J.self)Z.push("if ($event.target !== $el) return");for(let Y of J.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if(J.keys.length>0){let Y=J.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if(J.mouse!==null){let Y=x8[J.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if(J.prevent)Z.push("$event.preventDefault()");if(J.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function gK($,Z){let J=$;if(Z.debounce!==null)J=`__stx_debounce(() => { ${J} }, ${Z.debounce})`;else if(Z.throttle!==null)J=`__stx_throttle(() => { ${J} }, ${Z.throttle})`;return J}function r7($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function hK($){let{modifiers:Z}=$,J=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=fK($),X=gK(r7($.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=X.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
641
641
|
(function() {
|
|
642
642
|
var $el = document.getElementById('${J}');
|
|
643
643
|
if (!$el) return;
|
|
@@ -750,11 +750,11 @@ else {
|
|
|
750
750
|
`)}
|
|
751
751
|
})();
|
|
752
752
|
</script>`}function uK($){let Z=f8($);if(Z.length===0)return{template:$,bindings:[]};let J=$,Y=[];for(let X=Z.length-1;X>=0;X--){let Q=Z[X],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 W of Q.events)W.elementId=K[1]}for(let K of Q.events){let W=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");G=G.replace(q,""),G=G.replace(z,"")}J=J.slice(0,Q.startIndex)+G+J.slice(Q.endIndex),Y.push(...Q.events)}return{template:J,bindings:Y}}function g8($,Z,J){if(s7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:W}=uK($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...W],K}let Y=f8($);if(Y.length===0)return $;let X=$;for(let K=Y.length-1;K>=0;K--){let W=Y[K],q=W.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=q.match(/id=["']([^"']+)["']/);if(z)for(let U of W.events)U.elementId=z[1]}for(let z of W.events){let U=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");q=q.replace(j,""),q=q.replace(H,"")}X=X.slice(0,W.startIndex)+q+X.slice(W.endIndex)}let Q=a7(Y.flatMap((K)=>K.events)),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
|
|
753
|
-
`+X.slice(G);else X+=Q;return X}var P8,C8,xK,x8;var t7=b(()=>{
|
|
753
|
+
`+X.slice(G);else X+=Q;return X}var P8,C8,xK,x8;var t7=b(()=>{K1();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"]),C8={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"},xK=new Set(["ctrl","alt","shift","meta"]),x8={left:0,middle:1,right:2}});function d0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(Y,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
754
754
|
`});let J=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(J,(Y,X)=>{return`const { ${X.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
755
|
-
`}),$}function d$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function mK(){let $=globalThis;return $[h8]??=new Map,$[h8]}function
|
|
755
|
+
`}),$}function d$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function mK(){let $=globalThis;return $[h8]??=new Map,$[h8]}function e($,Z){let J=mK(),Y=`${import.meta.url}\x00${$}`,X=J.get(Y);if(X)return X;let Q=Z();return J.set(Y,Q),Q.catch(()=>{if(J.get(Y)===Q)J.delete(Y)}),Q}var h8;var t5=b(()=>{h8=Symbol.for("stx.lazy-module-promises")});function F5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(dK,"<\\/$1")}var dK;var e7=b(()=>{dK=/<\/(script)/gi});import pK from"process";function g0($="STX_PUBLIC_"){let Z={},J={};for(let[Y,X]of Object.entries(pK.env)){if(!Y.startsWith($)||X===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(X),J[Y]=X}return Z["import.meta.env"]=JSON.stringify(J),Z}var D1=()=>{};function lK($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function cK($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function $3($,Z){let J=[];for(let Y of cK($)){if(lK(Y)){let X=Y.position||void 0;J.push({file:Z||X?.file,line:X?.line,column:X?.column,message:Y.message??"",lineText:X?.lineText});continue}J.push({file:Z,message:Y instanceof Error?Y.message:String(Y)})}return J}function u8($,Z){return $3($,Z).map((J)=>{let Y=J.file?`${J.file}${J.line?`:${J.line}${J.column?`:${J.column}`:""}`:""}`:"",X=J.lineText?`
|
|
756
756
|
${J.lineText.trim()}`:"";return Y?`${Y}: ${J.message}${X}`:`${J.message}${X}`}).join(`
|
|
757
|
-
`)}var e5={};
|
|
757
|
+
`)}var e5={};t(e5,{shouldLogBundlerDiagnostics:()=>l8,setBundlerFallbackMode:()=>sK,resolveBundlerFallback:()=>i8,recordBundleFailure:()=>c8,queueClientBundleBuild:()=>n8,hasUserImports:()=>rK,getBundleFailures:()=>nK,clearBundleFailures:()=>oK,bundleClientScript:()=>tK});import L0 from"path";import h0 from"fs";function l8($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function p1(...$){if(l8())console.log("[stx:bundler]",...$)}function c8($,Z,J){Y3.push({filePath:$||"<inline>",message:Z,details:J})}function nK(){return Y3.slice()}function oK(){Y3.length=0}function sK($){J3=$}function i8(){if(J3)return J3;try{return Z$.strict?.bundlerFallback??"warn"}catch{return"warn"}}function rK($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,J;while((J=Z.exec($))!==null){let X=J[1];if(!m8.some((G)=>G.test(X)))return p1("detected user import:",X),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((J=Y.exec($))!==null){let X=J[1];if(/\.css(?:\?.*)?$/.test(X))continue;if(!m8.some((G)=>G.test(X)))return p1("detected side-effect import:",X),!0}return!1}function aK($,Z,J,Y){let X=(Q,G)=>{let K=Q===J?Z:L0.dirname(Q),W=L0.resolve(K,G),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,L0.join(W,"index.ts"),L0.join(W,"index.tsx"),L0.join(W,"index.js"),L0.join(W,"index.mjs")];for(let z of q)try{if(h0.existsSync(z)&&h0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return W};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(h0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=X(G.importer,G.path);return Y.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=L0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,L0.join(K,"index.ts"),L0.join(K,"index.tsx"),L0.join(K,"index.js"),L0.join(K,"index.mjs")];for(let q of W)if(h0.existsSync(q)&&h0.statSync(q,{throwIfNoEntry:!1})?.isFile())return p1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",q),Y.add(q),{path:q};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=L0.extname(G.path).toLowerCase(),W=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==J)Y.add(G.path);return{contents:h0.readFileSync(G.path,"utf8"),loader:W}})}}}function n8($){let Z=globalThis,Y=(Z[d8]??Promise.resolve()).then($,$);return Z[d8]=Y.then(()=>{return},()=>{return}),Y}async function tK($,Z,J={}){let Y=J.projectRoot||process.cwd(),X=J.minify??!1,Q=J.cacheDir||_1(Y,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${iK}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),W=L0.join(Q,`${K}.js`),q=L0.join(Q,`${K}.deps.json`),z=Bun.file(W);if(await z.exists()){let H=Bun.file(q),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==p8||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(h0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return p1("cache hit:",K),await z.text();p1("cache invalidated by dep change:",K)}let U=Z3.get(K);if(U)return await U;let j=n8(()=>eK($,Z,{projectRoot:Y,minify:X,cacheDir:Q,hash:K,cachePath:W,depsPath:q}));Z3.set(K,j);try{return await j}finally{Z3.delete(K)}}async function eK($,Z,J){let{projectRoot:Y,minify:X,cacheDir:Q,hash:G,cachePath:K,depsPath:W}=J,q=_1(Y,"bundle-tmp"),z=L0.join(q,`${G}.ts`),U=L0.join(q,"out",G);h0.mkdirSync(q,{recursive:!0}),h0.mkdirSync(U,{recursive:!0});let j=L0.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((L)=>{let w=L.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 V=H.length>0?`
|
|
758
758
|
export { ${H.join(", ")} }`:"";await Bun.write(z,$+V),p1("bundling:",G,"from:",L0.basename(Z));let F=new Set;try{let L=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:X,plugins:[aK(Y,j,z,F)],define:{"process.env.NODE_ENV":X?'"production"':'"development"',...g0()},root:Y});if(!L.success){let D=L.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of L.outputs){w=await D.text();break}let N=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let y of D[1].split(",")){let S=y.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){N.push([S[2],S[1]]);continue}let P=y.trim();if(/^[A-Za-z_$][\w$]*$/.test(P))N.push([P,P])}let R=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=N.map(([D,y])=>`${JSON.stringify(D)}: ${y}`).join(", "),T=N.map(([D])=>`var ${D} = undefined;`).join(`
|
|
759
759
|
`),I=N.map(([D])=>`${D} = ${A}[${JSON.stringify(D)}];`).join(`
|
|
760
760
|
`);if(w=`${R.join(`
|
|
@@ -764,7 +764,7 @@ var ${A} = (function() {
|
|
|
764
764
|
${w}
|
|
765
765
|
return { ${M} };
|
|
766
766
|
})();
|
|
767
|
-
${I}`.trim(),p1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&N.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(F).map((D)=>{try{return{path:D,mtimeMs:h0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:p8,files:E})),w}catch(L){let w=$3(L,Z||void 0),N=u8(L,Z||void 0);if(console.warn(`[stx:bundler] error: ${N}`),c8(Z||"",N,w),i8()==="error")throw L;return $}finally{try{h0.rmSync(z,{force:!0}),h0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var iK=5,p8=1,Y3,J3,m8,Z3,d8;var $$=b(()=>{D1();r5();V1();Y3=[];m8=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Z3=new Map,d8=Symbol.for("stx.client-bundle-build-queue")});var JZ={};
|
|
767
|
+
${I}`.trim(),p1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&N.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let E=Array.from(F).map((D)=>{try{return{path:D,mtimeMs:h0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(W,JSON.stringify({metadataVersion:p8,files:E})),w}catch(L){let w=$3(L,Z||void 0),N=u8(L,Z||void 0);if(console.warn(`[stx:bundler] error: ${N}`),c8(Z||"",N,w),i8()==="error")throw L;return $}finally{try{h0.rmSync(z,{force:!0}),h0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var iK=5,p8=1,Y3,J3,m8,Z3,d8;var $$=b(()=>{D1();r5();V1();Y3=[];m8=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Z3=new Map,d8=Symbol.for("stx.client-bundle-build-queue")});var JZ={};t(JZ,{stripCommentsAndLiterals:()=>c$,renderVendorStyleTags:()=>l$,processClientScript:()=>X$,injectBrowserCoreAutoImports:()=>V5,generateServerDataBridge:()=>i$,generateBrowserAutoImportDestructuring:()=>zW,generateAutoImportDestructuring:()=>X3,extractBridgeData:()=>Y$,extractAndStripCssImports:()=>p$,STX_AUTO_IMPORTS:()=>a8});import l1 from"path";import J$ from"fs";function ZW($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let J=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!J)return null;return{pkg:J[1],subpath:J[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function JW($,Z){let J=Z;while(!0){let Y=l1.join(J,"node_modules",$,"package.json");if(J$.existsSync(Y))return l1.dirname(Y);let X=l1.dirname(J);if(X===J)return null;J=X}}function YW($,Z){if(!$||typeof $!=="object")return null;let J=(X)=>{if(typeof X==="string")return X;if(X&&typeof X==="object"){if(typeof X.import==="string")return X.import;if(typeof X.default==="string")return X.default;if(typeof X.import==="object")return J(X.import);if(typeof X.default==="object")return J(X.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return J($[Z]);let Y=null;for(let X of Object.keys($)){let Q=X.indexOf("*");if(Q===-1)continue;let G=X.slice(0,Q),K=X.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!Y||G.length>Y.prefix.length)Y={pattern:X,prefix:G,suffix:K}}if(Y){let X=Z.slice(Y.prefix.length,Z.length-Y.suffix.length),Q=J($[Y.pattern]);if(Q)return Q.replace("*",X)}return null}function XW($,Z){let J=ZW($);if(!J||!J.subpath)return null;let Y=JW(J.pkg,Z);if(!Y)return null;let X;try{X=JSON.parse(J$.readFileSync(l1.join(Y,"package.json"),"utf8"))}catch{return null}let Q=`.${J.subpath}`,G=YW(X.exports,Q);if(!G)return null;let K=l1.resolve(Y,G);return J$.existsSync(K)?K:null}function p$($,Z){let J=Z.filePath?l1.dirname(Z.filePath):Z.projectRoot||process.cwd(),Y=Z.projectRoot||process.cwd(),X=new Set,Q=[];return{code:$.replace($W,(K,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:l1.resolve(J,W),!J$.existsSync(q))throw Error(`file not found: ${q}`)}else{let z=null;try{z=Bun.resolveSync(W,Y)}catch{z=XW(W,Y)}if(!z)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);q=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(X.has(q))return"";X.add(q);try{let z=J$.readFileSync(q,"utf8");Q.push({source:W,resolvedPath:q,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${q}: ${z?.message||z}`)}return""}),styles:Q}}function QW($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function l$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${QW(Z.source)}" data-stx-layer="vendor">
|
|
768
768
|
@layer vendor {
|
|
769
769
|
${Z.contents}
|
|
770
770
|
}
|
|
@@ -842,7 +842,7 @@ else {
|
|
|
842
842
|
// STX: auto-generated event bindings
|
|
843
843
|
${$.map((J,Y)=>VW(J,Y)).join(`
|
|
844
844
|
`)}`}function r8($){let Z=[],J=new Set,Y=$.replace(/^\s*import\s+.*$/gm,""),X=0,Q=Y.length,G=0;while(G<Q){let K=Y[G];if(K==="'"||K==='"'||K==="`"){let W=K;if(G++,W==="`"){let q=0;while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]==="`"&&q===0){G++;break}if(Y[G]==="$"&&Y[G+1]==="{"){q++,G+=2;continue}if(Y[G]==="}"&&q>0){q--,G++;continue}G++}}else while(G<Q){if(Y[G]==="\\"){G+=2;continue}if(Y[G]===W){G++;break}G++}continue}if(K==="/"&&Y[G+1]==="/"){while(G<Q&&Y[G]!==`
|
|
845
|
-
`)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<Q-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=Y.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=q[0].length;continue}let z=W.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("_")&&!J.has(_))Z.push(_),J.add(_)}),G+=z[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=U[0].length;continue}}G++}return Z}function NW($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(j){let H;while((H=J.exec(j))!==null){let B=H[0];if(!wW.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)Y(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)Y(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)Y(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)Y(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)Y(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)Y(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)Y(Q[1]);return Z}async function X$($,Z={}){let J=$,Y="",X=!1,Q=[],G=p$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let K=l$(G.styles),W=V5(J);J=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:z}=await
|
|
845
|
+
`)G++;continue}if(K==="/"&&Y[G+1]==="*"){G+=2;while(G<Q-1&&!(Y[G]==="*"&&Y[G+1]==="/"))G++;G+=2;continue}if(K==="{"){X++,G++;continue}if(K==="}"){X--,G++;continue}if(X===0){let W=Y.slice(G),q=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let j=q[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=q[0].length;continue}let z=W.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("_")&&!J.has(_))Z.push(_),J.add(_)}),G+=z[0].length;continue}let U=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!J.has(j))Z.push(j),J.add(j);G+=U[0].length;continue}}G++}return Z}function NW($){let Z=new Set,J=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(j){let H;while((H=J.exec(j))!==null){let B=H[0];if(!wW.has(B))Z.add(B)}}let X=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=X.exec($))!==null)Y(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)Y(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)Y(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=W.exec($))!==null)Y(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=q.exec($))!==null)Y(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)Y(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)Y(Q[1]);return Z}async function X$($,Z={}){let J=$,Y="",X=!1,Q=[],G=p$(J,{filePath:Z.filePath,projectRoot:Z.projectRoot});J=G.code;let K=l$(G.styles),W=V5(J);J=W.code,Q=[...W.imports,...W.models];let{hasUserImports:q,bundleClientScript:z}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => ($$(),e5)));if(q(J))J=await z(J,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),X=!0;if(Z.autoImports!==!1){let F=ZZ(J);J=F.code,Y=X3(F.stxImports,F.browserImports.filter((L)=>!Q.includes(L)))}if(Y=`${i$(J,Z.serverData)}${Y}`,J=d0(J),!X&&c1(Z.attrs||""))J=i1(J);let U=LW(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let F=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),L=`type="module" data-stx-scoped${F?` ${F}`:""}`;return`${K}<script ${L}>
|
|
846
846
|
${F5(`${Y}${J}
|
|
847
847
|
${U}`)}
|
|
848
848
|
</script>`}let B=o7($),_=/function __stx_setup_/.test(J),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(F){let L=F.length>0?`
|
|
@@ -856,7 +856,7 @@ ${U}${L}`)}
|
|
|
856
856
|
'use strict';
|
|
857
857
|
${F5(`${Y}${J}
|
|
858
858
|
${U}`)}
|
|
859
|
-
})()</script>`}var $W,a8,t8,GW,HW,s8,OW,wW;var Q$=b(()=>{t7();I0();t5();
|
|
859
|
+
})()</script>`}var $W,a8,t8,GW,HW,s8,OW,wW;var Q$=b(()=>{t7();I0();t5();K1();e7();$W=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;a8=F1,t8=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];GW=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"]);HW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,s8=new Set;OW={left:0,middle:1,right:2};wW=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 RW}from"crypto";function YZ($){let Z=$[n$];return Z instanceof Map?Z:null}function XZ($){$[n$]=new Map}function QZ($,Z){let J=YZ($);if(!J)return null;let Y=RW("sha256").update(Z).digest("hex").slice(0,16),X=J.get(Y);if(X)X.instances++;else J.set(Y,{body:Z,instances:1});return Y}function GZ($,Z){let J=YZ(Z);if(!J?.size)return $;let Y=$;for(let[W,q]of J){if(q.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(z,(U,j)=>`(${q.body})(${j});`)}let X=[...J].filter(([,W])=>W.instances>1);if(X.length===0)return Y;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
860
860
|
(function() {
|
|
861
861
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
862
862
|
${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${q.body}; }
|
|
@@ -865,7 +865,7 @@ ${X.map(([W,q])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.str
|
|
|
865
865
|
})();
|
|
866
866
|
</script>`,K=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
|
|
867
867
|
${Y}`;return`${Y.slice(0,K)}${G}
|
|
868
|
-
${Y.slice(K)}`}var n$="__stx_component_client_factories";var Q3=()=>{};function IW($){let Z="",J=null,Y=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){Y=!1;continue}if(Q==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}Z+=Q}return Z}function DW($,Z){let J=/[$A-Z_a-z][$\w]*/g,Y;while((Y=J.exec($))!==null){let X=Y[0],Q=$[Y.index-1];if(MW.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&zZ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function kW($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,J;while((J=Z.exec($))!==null){let Y=J[2];if(!zZ.has(Y))continue;let X=$.slice(0,J.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(J.index+J[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${J[2]}): ${$}`)}}function o$($){let Z=$.trim(),J=IW(Z);DW(J,Z),kW(Z);for(let Y of qZ)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!WZ.allowBracketNotation&&TW.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function EW($){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[J,Y]of Object.entries($)){if(J.startsWith("__")||qZ.some((X)=>X.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=G3(Y);else Z[J]=Y}return Z}function G3($,Z=0){if(Z>=WZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>G3(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let J={};for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(X&&typeof X==="object")J[Y]=G3(X,Z+1);else J[Y]=X}return J}function Y0($,Z){try{let J=EW(Z),Y=Object.keys(J),X=Object.values(J);return
|
|
868
|
+
${Y.slice(K)}`}var n$="__stx_component_client_factories";var Q3=()=>{};function IW($){let Z="",J=null,Y=!1;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){Y=!1;continue}if(Q==="\\"&&J){Y=!0;continue}if(J){if(J==="`"&&Q==="$"&&X+1<$.length&&$[X+1]==="{"){let G=1;X+=2;while(X<$.length&&G>0){if($[X]==="{")G++;else if($[X]==="}")G--;if(G>0)Z+=$[X],X++}continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}Z+=Q}return Z}function DW($,Z){let J=/[$A-Z_a-z][$\w]*/g,Y;while((Y=J.exec($))!==null){let X=Y[0],Q=$[Y.index-1];if(MW.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(Q==="."&&zZ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function kW($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,J;while((J=Z.exec($))!==null){let Y=J[2];if(!zZ.has(Y))continue;let X=$.slice(0,J.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(J.index+J[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${J[2]}): ${$}`)}}function o$($){let Z=$.trim(),J=IW(Z);DW(J,Z),kW(Z);for(let Y of qZ)if(Y.test(J))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!WZ.allowBracketNotation&&TW.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function EW($){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[J,Y]of Object.entries($)){if(J.startsWith("__")||qZ.some((X)=>X.test(J)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[J]=G3(Y);else Z[J]=Y}return Z}function G3($,Z=0){if(Z>=WZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>G3(Y,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let J={};for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(X&&typeof X==="object")J[Y]=G3(X,Z+1);else J[Y]=X}return J}function Y0($,Z){try{let J=EW(Z),Y=Object.keys(J),X=Object.values(J);return q0($,Y)(...X)}catch{return}}function W0($){try{return o$($),!0}catch{return!1}}function A0($,Z){try{let J=Y0($,Z);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}function q0($,Z){let J=o$($),Y=/^[A-Za-z_$][\w$]*$/,X=[],Q=[];for(let q=0;q<Z.length;q++){let z=Z[q];if(!Y.test(z))continue;if(UZ.has(z))continue;X.push(q),Q.push(z)}let G=(q)=>Function(...Q,...q,`
|
|
869
869
|
'use strict';
|
|
870
870
|
try {
|
|
871
871
|
return ${J};
|
|
@@ -876,7 +876,7 @@ catch (e) {
|
|
|
876
876
|
}
|
|
877
877
|
throw e;
|
|
878
878
|
}
|
|
879
|
-
`),K=G([]);if(Q.length===Z.length)return KZ(K,Q,G);return KZ((...q)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=q[X[U]];return K(...z)},Q,G,(q)=>{K=G(q)})}function KZ($,Z,J,Y){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let z=0;z<=8;z++)try{return G(...q)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||UZ.has(B))return;W.add(B),K.push(B),G=J(K),Y?.(K)}return}}function s$($){let Z=$.trim(),J=[/\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 Y of J)if(Y.test(Z))return!1;return!0}var AW,WZ,qZ,MW,zZ,TW,UZ;var M0=b(()=>{AW={maxSanitizeDepth:10,allowBracketNotation:!1},WZ={...AW},qZ=[/\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/],MW=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"]),zZ=new Set(["__proto__","constructor","prototype"]),TW=/[\w)\]]\s*\[\s*['"]/;UZ=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 r$($,Z){let J=bW++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return SW.set(Y,{type:$,expression:Z}),Y}var bW=0,SW;var jZ=b(()=>{SW=new Map});function FZ($,Z,J,Y){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)return-1;Y.lastIndex=J.lastIndex;let Q=Y.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return FZ($,Z,BZ,HZ)}function L5($,Z){return FZ($,Z,_Z,OZ)}function G$($,Z){if(!$.startsWith("<!--",Z))return-1;let J=$.indexOf("-->",Z+4);if(J===-1)return-1;return J+3}function yW($,Z){if($.startsWith("<!--",Z)){let J=G$($,Z);return J===-1?$.length:J}for(let[J,Y]of[[BZ,HZ],[_Z,OZ]]){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)continue;Y.lastIndex=J.lastIndex;let Q=Y.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function K3($,Z){let J=[],Y=0,X=$.length,Q=!1,G=null;while(Y<X){let K=$[Y];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;Y++;continue}if(K!=="<"){Y++;continue}let W=Z($,Y);if(W>Y){J.push({start:Y,end:W,token:$.slice(Y,W)}),Y=W;continue}let q=yW($,Y);if(q>Y){Y=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Y,Y+2)))Q=!0;Y++}return J}function K1($,Z,J){let Y=K3($,Z);if(Y.length===0)return{output:$,tokens:[]};let X=Y.map((K)=>K.token),Q="",G=0;for(let K=0;K<Y.length;K++){let W=Y[K];Q+=$.slice(G,W.start),Q+=J(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function E1($){let{output:Z,tokens:J}=K1($,k1,(Y,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:J}}function K$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(J,Y)=>Z[+Y]??"")}var BZ,HZ,_Z,OZ;var n1=b(()=>{BZ=/<script\b[^>]*>/iy,HZ=/<\/script\s*>/ig,_Z=/<style\b[^>]*>/iy,OZ=/<\/style\s*>/ig});var AZ={};a(AZ,{usesSignalsInScript:()=>L1,unescapeHtml:()=>uW,registerFilters:()=>CW,registerFilter:()=>wZ,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>xW,interpolateScriptExpressions:()=>a$,getAllFilters:()=>NZ,evaluateExpression:()=>n0,escapeHtml:()=>a0,defaultFilters:()=>q$,clearCustomFilters:()=>vW,applyFilters:()=>RZ});function PW($){let Z=VZ.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),VZ.set($,Z)}return Z.lastIndex=0,Z}function wZ($,Z){if($ in q$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);W$[$]=Z}function CW($){for(let[Z,J]of Object.entries($))wZ(Z,J)}function NZ(){return{...q$,...W$}}function vW(){for(let $ of Object.keys(W$))delete W$[$]}function a0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function L1($){let{scripts:Z}=E1($);for(let J of Z){let Y=J.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let X=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function LZ($,Z){let J=["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"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<Y.length;q++){let z=Y[q];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&Y[q+1]==="{"){G++,q++,X+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){X+=z;continue}continue}X+=z}Y=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(Y))!==null){let q=W[1];if(!Y.substring(0,W.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function a$($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,X)=>{try{let Q=n0(X,Z);if(Q===void 0)return Y;return Q===null?"":String(Q)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return Y;try{let G=n0(X,Z);if(G===void 0)return Y;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return Y}}),J}function xW($,Z,J={}){let{output:Y,scripts:X}=E1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-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(J.skipServer&&/\bserver\b/.test(z))return G;let j=a$(U,Z);return W[0]+j+G.slice(q)});return K$(Y,Q)}function b1($,Z,J){let Y=$,X=(U,j)=>{let H=L5(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:V}=K1(U,j,(F,L)=>B(_+L));return H.push(...V),O},G=[];Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=Z?.__stx_signals_gate===!0||L1($),q=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:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=n0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,J,$,H,U)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=n0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return r$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return r$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return U0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,J,$,H,U)}}),Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`),Y=Y.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_$]*)/,F=B.match(O)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&q.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(N),A=R&&!_.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=n0(j,Z);if(w)return U;if(W&&!LZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return r$("expr",B);return M!==void 0&&M!==null?a0(String(M)):""}catch(M){if(w)return U;if(W&&!LZ(B,Z))return U;if(A)return U;let T=M instanceof Error?M.message:String(M);return U0("Expression",`Error evaluating: {{ ${B} }}: ${T}`,J,$,H,U)}});for(let U=0;U<K.length;U++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)Y=Y.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return Y}function RZ($,Z,J){if(!Z.trim())return $;let Y=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=W$[G]||q$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(NZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let z=q[1].trim();try{let U=Number(z);W=[Number.isNaN(U)?z:U]}catch{W=[z]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,z=1;while(q>0&&z<X.length){if(X[z]==="(")q++;if(X[z]===")")q--;z++}if(q===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[n0(`(${U})`,J,!0)];else{let j=[],H="",B=null,_=0,O=0,V=0,F=!1;for(let L=0;L<U.length;L++){let w=U[L];if(F){H+=w,F=!1;continue}if(w==="\\"){H+=w,F=!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==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((L)=>{let w=L.trim();return n0(w,J,!0)})}}catch{W=[U]}X=X.substring(z).trim()}}try{Y=K(Y,J,...W)}catch(q){let z=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return Y}function fW($){let Z=!1,J="",Y=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,J=W;else if(W===J)Z=!1,J="";continue}if(Z&&J==="`"&&W==="$"&&q==="{"){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(W==="(")Y++;else if(W===")")Y--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&Y===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function n0($,Z,J=!1){try{let Y=$.trim(),X=fW(Y);if(X>0){let Q=Y.substring(0,X).trim(),G=Y.substring(X+1).trim(),K=n0(Q,Z,!0);return RZ(K,G,Z)}if(!K0(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return W0(Y,Q)(...G)}catch{return Y0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(Y.message);if(X){let Q=X[1],G=gW(Q,Object.keys(Z));if(G&&G!==Q)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function gW($,Z){let J=null;for(let X of Z){if(X===$)continue;let Q=hW($,X);if(J===null||Q<J.dist)J={key:X,dist:Q}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function hW($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],X=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)X[G]=G;for(let G=1;G<=Y.length;G++){Q[0]=G;for(let K=1;K<=J.length;K++){let W=J[K-1]===Y[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=J.length;K++)X[K]=Q[K]}return X[J.length]}function uW($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var W$,VZ,q$;var W1=b(()=>{M0();I0();jZ();n1();W$={},VZ=new Map;q$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return a0(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=Y;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(J).forEach(([W,q])=>{K=K.replace(PW(W),String(q))}),K},t:($,Z,J={})=>{return q$.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=J)return X;if(J<=Y.length)return Y.substring(0,J);return X.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.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(J==="iso")return X.toISOString();return new Intl.DateTimeFormat(Y,Q[J]||Q.short).format(X)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(X)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let X=Number($);if(Number.isNaN(X))return J;let Q=Y||`${J}s`;return X===1?J: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 J=String($);return J.charAt(J.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,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let X=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let X=10**J;return Math.round(Y*X)/X}}});class o1{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 J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}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 N5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!w5.has(J)){if(w5.size>=mW){let Y=w5.keys().next().value;if(Y)w5.delete(Y)}w5.set(J,new RegExp($,Z))}return w5.get(J)}class MZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${J}:${W}`,z=X.get(q);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
|
|
879
|
+
`),K=G([]);if(Q.length===Z.length)return KZ(K,Q,G);return KZ((...q)=>{let z=Array(X.length);for(let U=0;U<X.length;U++)z[U]=q[X[U]];return K(...z)},Q,G,(q)=>{K=G(q)})}function KZ($,Z,J,Y){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...q)=>{for(let z=0;z<=8;z++)try{return G(...q)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(W.has(B)||UZ.has(B))return;W.add(B),K.push(B),G=J(K),Y?.(K)}return}}function s$($){let Z=$.trim(),J=[/\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 Y of J)if(Y.test(Z))return!1;return!0}var AW,WZ,qZ,MW,zZ,TW,UZ;var M0=b(()=>{AW={maxSanitizeDepth:10,allowBracketNotation:!1},WZ={...AW},qZ=[/\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/],MW=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"]),zZ=new Set(["__proto__","constructor","prototype"]),TW=/[\w)\]]\s*\[\s*['"]/;UZ=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 r$($,Z){let J=bW++,Y=`<!--__STX_${$.toUpperCase()}_${J}__-->`;return SW.set(Y,{type:$,expression:Z}),Y}var bW=0,SW;var jZ=b(()=>{SW=new Map});function FZ($,Z,J,Y){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)return-1;Y.lastIndex=J.lastIndex;let Q=Y.exec($);if(!Q)return-1;return Q.index+Q[0].length}function k1($,Z){return FZ($,Z,BZ,HZ)}function L5($,Z){return FZ($,Z,_Z,OZ)}function G$($,Z){if(!$.startsWith("<!--",Z))return-1;let J=$.indexOf("-->",Z+4);if(J===-1)return-1;return J+3}function yW($,Z){if($.startsWith("<!--",Z)){let J=G$($,Z);return J===-1?$.length:J}for(let[J,Y]of[[BZ,HZ],[_Z,OZ]]){J.lastIndex=Z;let X=J.exec($);if(!X||X.index!==Z)continue;Y.lastIndex=J.lastIndex;let Q=Y.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function K3($,Z){let J=[],Y=0,X=$.length,Q=!1,G=null;while(Y<X){let K=$[Y];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;Y++;continue}if(K!=="<"){Y++;continue}let W=Z($,Y);if(W>Y){J.push({start:Y,end:W,token:$.slice(Y,W)}),Y=W;continue}let q=yW($,Y);if(q>Y){Y=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Y,Y+2)))Q=!0;Y++}return J}function W1($,Z,J){let Y=K3($,Z);if(Y.length===0)return{output:$,tokens:[]};let X=Y.map((K)=>K.token),Q="",G=0;for(let K=0;K<Y.length;K++){let W=Y[K];Q+=$.slice(G,W.start),Q+=J(W.token,K),G=W.end}return Q+=$.slice(G),{output:Q,tokens:X}}function E1($){let{output:Z,tokens:J}=W1($,k1,(Y,X)=>`\x00STX_SCRIPT_${X}\x00`);return{output:Z,scripts:J}}function K$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(J,Y)=>Z[+Y]??"")}var BZ,HZ,_Z,OZ;var n1=b(()=>{BZ=/<script\b[^>]*>/iy,HZ=/<\/script\s*>/ig,_Z=/<style\b[^>]*>/iy,OZ=/<\/style\s*>/ig});var AZ={};t(AZ,{usesSignalsInScript:()=>L1,unescapeHtml:()=>uW,registerFilters:()=>CW,registerFilter:()=>wZ,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>xW,interpolateScriptExpressions:()=>a$,getAllFilters:()=>NZ,evaluateExpression:()=>n0,escapeHtml:()=>t0,defaultFilters:()=>q$,clearCustomFilters:()=>vW,applyFilters:()=>RZ});function PW($){let Z=VZ.get($);if(!Z){let J=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${J}(?!\\w)`,"g"),VZ.set($,Z)}return Z.lastIndex=0,Z}function wZ($,Z){if($ in q$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);W$[$]=Z}function CW($){for(let[Z,J]of Object.entries($))wZ(Z,J)}function NZ(){return{...q$,...W$}}function vW(){for(let $ of Object.keys(W$))delete W$[$]}function t0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function L1($){let{scripts:Z}=E1($);for(let J of Z){let Y=J.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let X=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function LZ($,Z){let J=["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"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),X="",Q=!1,G=0;for(let q=0;q<Y.length;q++){let z=Y[q];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&Y[q+1]==="{"){G++,q++,X+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){X+=z;continue}continue}X+=z}Y=X;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=K.exec(Y))!==null){let q=W[1];if(!Y.substring(0,W.index).trimEnd().endsWith(".")){if(!J.includes(q)&&!(q in Z))return!1}}return!0}function a$($,Z){let J=$;return J=J.replace(/\{!!([\s\S]*?)!!\}/g,(Y,X)=>{try{let Q=n0(X,Z);if(Q===void 0)return Y;return Q===null?"":String(Q)}catch{return Y}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(Y,X)=>{let Q=X.trim();if(/^__[A-Z_]+__$/.test(Q))return Y;try{let G=n0(X,Z);if(G===void 0)return Y;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return Y}}),J}function xW($,Z,J={}){let{output:Y,scripts:X}=E1($),Q=X.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=G.match(/^<script\b[^>]*>/i),q=G.search(/<\/script\s*>$/i);if(!K||!W||q===-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(J.skipServer&&/\bserver\b/.test(z))return G;let j=a$(U,Z);return W[0]+j+G.slice(q)});return K$(Y,Q)}function b1($,Z,J){let Y=$,X=(U,j)=>{let H=L5(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:V}=W1(U,j,(F,L)=>B(_+L));return H.push(...V),O},G=[];Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=Z?.__stx_signals_gate===!0||L1($),q=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:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=n0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,J,$,H,U)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=n0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return r$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return r$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,J,$,H,U)}}),Y=Q(Y,k1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Y=Q(Y,X,G,(U)=>`<!--__STX_STYLE_${U}__-->`),Y=Y.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_$]*)/,F=B.match(O)?.[1],L=F&&((F in Z)||_.includes(F)),w=Boolean(F&&q.has(F)),N=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(N),A=R&&!_.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=n0(j,Z);if(w)return U;if(W&&!LZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return r$("expr",B);return M!==void 0&&M!==null?t0(String(M)):""}catch(M){if(w)return U;if(W&&!LZ(B,Z))return U;if(A)return U;let T=M instanceof Error?M.message:String(M);return j0("Expression",`Error evaluating: {{ ${B} }}: ${T}`,J,$,H,U)}});for(let U=0;U<K.length;U++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)Y=Y.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return Y}function RZ($,Z,J){if(!Z.trim())return $;let Y=$,X=Z.trim();while(X.length>0){let Q=X.match(/^(\w+)/);if(!Q)break;let G=Q[1];X=X.substring(G.length).trim();let K=W$[G]||q$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(NZ()).join(", ")}`);let W=[];if(X.startsWith(":")){let q=X.match(/^:([^|\s]+)/);if(q){let z=q[1].trim();try{let U=Number(z);W=[Number.isNaN(U)?z:U]}catch{W=[z]}X=X.substring(q[0].length).trim()}}else if(X.startsWith("(")){let q=1,z=1;while(q>0&&z<X.length){if(X[z]==="(")q++;if(X[z]===")")q--;z++}if(q===0){let U=X.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))W=[n0(`(${U})`,J,!0)];else{let j=[],H="",B=null,_=0,O=0,V=0,F=!1;for(let L=0;L<U.length;L++){let w=U[L];if(F){H+=w,F=!1;continue}if(w==="\\"){H+=w,F=!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==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);W=j.map((L)=>{let w=L.trim();return n0(w,J,!0)})}}catch{W=[U]}X=X.substring(z).trim()}}try{Y=K(Y,J,...W)}catch(q){let z=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${G}': ${z}`)}if(X.startsWith("|"))X=X.substring(1).trim();else break}return Y}function fW($){let Z=!1,J="",Y=0,X=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],q=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,J=W;else if(W===J)Z=!1,J="";continue}if(Z&&J==="`"&&W==="$"&&q==="{"){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(W==="(")Y++;else if(W===")")Y--;else if(W==="[")X++;else if(W==="]")X--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&Y===0&&X===0&&Q===0){if(q==="|"){K++;continue}if(q==="="){K++;continue}return K}}return-1}function n0($,Z,J=!1){try{let Y=$.trim(),X=fW(Y);if(X>0){let Q=Y.substring(0,X).trim(),G=Y.substring(X+1).trim(),K=n0(Q,Z,!0);return RZ(K,G,Z)}if(!W0(Y)){if(!J)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return q0(Y,Q)(...G)}catch{return Y0(Y,Z)}}catch(Y){if(Y instanceof ReferenceError){let X=/(\b\w+)\s+is not defined/.exec(Y.message);if(X){let Q=X[1],G=gW(Q,Object.keys(Z));if(G&&G!==Q)Y.message=`${Y.message} \u2014 did you mean '${G}'?`}}if(!J)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function gW($,Z){let J=null;for(let X of Z){if(X===$)continue;let Q=hW($,X);if(J===null||Q<J.dist)J={key:X,dist:Q}}if(!J)return null;let Y=Math.max($.length,J.key.length);if(J.dist<=2||J.dist/Y<=0.35)return J.key;return null}function hW($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[J,Y]=$.length<Z.length?[$,Z]:[Z,$],X=Array(J.length+1),Q=Array(J.length+1);for(let G=0;G<=J.length;G++)X[G]=G;for(let G=1;G<=Y.length;G++){Q[0]=G;for(let K=1;K<=J.length;K++){let W=J[K-1]===Y[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,X[K]+1,X[K-1]+W)}for(let K=0;K<=J.length;K++)X[K]=Q[K]}return X[J.length]}function uW($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var W$,VZ,q$;var q1=b(()=>{M0();I0();jZ();n1();W$={},VZ=new Map;q$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let J=String($);return J.charAt(0).toUpperCase()+J.slice(1)},number:($,Z,J=0)=>{if($===void 0||$===null)return"";try{let Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(J),10))}catch{return""}},fmt:($,Z,J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(J)}catch{return String($)}},join:($,Z,J=",")=>{if(!Array.isArray($))return"";return $.join(String(J))},escape:($,Z)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,Z,J={})=>{if(!Z||!Z.__translations)return $;let Y=Z.__translations,X=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=Y;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return X?$:"";let K=String(G);return Object.entries(J).forEach(([W,q])=>{K=K.replace(PW(W),String(q))}),K},t:($,Z,J={})=>{return q$.translate($,Z,J)},truncate:($,Z,J=50,Y="...")=>{if($===void 0||$===null)return"";let X=String($);if(X.length<=J)return X;if(J<=Y.length)return Y.substring(0,J);return X.substring(0,J-Y.length)+Y},date:($,Z,J="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=$ instanceof Date?$:new Date($);if(Number.isNaN(X.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(J==="iso")return X.toISOString();return new Intl.DateTimeFormat(Y,Q[J]||Q.short).format(X)}catch{return String($)}},currency:($,Z,J="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:J}).format(X)}catch{return String($)}},pluralize:($,Z,J,Y)=>{let X=Number($);if(Number.isNaN(X))return J;let Q=Y||`${J}s`;return X===1?J: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 J=String($);return J.charAt(J.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,J=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return J?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,J="")=>{return $===void 0||$===null||$===""?J:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,J=0,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(J,Y);return $},replace:($,Z,J,Y="")=>{if($===void 0||$===null)return"";let X=J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(X,"g"),()=>Y)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let J=Number($);return Number.isNaN(J)?0:Math.abs(J)},round:($,Z,J=0)=>{let Y=Number($);if(Number.isNaN(Y))return 0;let X=10**J;return Math.round(Y*X)/X}}});class o1{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 J=this.cache.keys().next().value;if(J!==void 0)this.cache.delete(J)}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 N5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let J=`${$}:${Z||""}`;if(!w5.has(J)){if(w5.size>=mW){let Y=w5.keys().next().value;if(Y)w5.delete(Y)}w5.set(J,new RegExp($,Z))}return w5.get(J)}class MZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),J=Z.sort().join(","),Y=this.pool.find((K)=>K.context.join(",")===J);if(Y)return Y.func;let X=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let q=`${J}:${W}`,z=X.get(q);if(!z){if(X.size>=Q){let U=X.keys().next().value;if(U)X.delete(U)}z=Function(...Z,`
|
|
880
880
|
'use strict';
|
|
881
881
|
try {
|
|
882
882
|
return ${W};
|
|
@@ -893,17 +893,17 @@ catch (e) {
|
|
|
893
893
|
`)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(X.trim()){X+=W;let q=X.match(/([^{]+)\{([^}]*)\}/);if(q)Z.push({selector:q[1].trim(),declarations:q[2].trim()});X=""}continue}}if(Q)G+=W;else X+=W}return Z}function EZ($,Z,J,Y,X,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${X.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=q3(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>EZ(j,Z,J,Y,X,Q)).join(`
|
|
894
894
|
`);return`${G} {
|
|
895
895
|
${U}
|
|
896
|
-
}`}return`${G} { ${K} }`}let W=pW(G,Z,J,Y),q=K;for(let[z,U]of X)q=q.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function pW($,Z,J,Y){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(Y)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=J?`${J} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=lW(G,Z);if(W)Q.push(J?`${J} ${W}`:W)}return Q.join(", ")}function lW($,Z){let J=0,Y=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")J++;else if(q==="]"||q===")")J--;else if(J===0&&(q===" "||q===">"||q==="+"||q==="~")){Y=W;break}}let X=$.slice(0,Y),Q=$.slice(Y);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(J===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function SZ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(J)=>{let Y=J.trim();if(Z.has(Y))return"";return Z.add(Y),J})}function t$($,Z){if(!cW.test($))return{html:$,hasScoped:!1};let J=DZ(Z),Y=`data-v-${J}`,X=$,Q=new RegExp(`<style\\s+([^>]*${z3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let z=iW(q,Y),U=W.replace(new RegExp(z3,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${J}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return X=oW(X,Y),{html:X,hasScoped:!0}}function iW($,Z){return kZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function oW($,Z){let J=
|
|
896
|
+
}`}return`${G} { ${K} }`}let W=pW(G,Z,J,Y),q=K;for(let[z,U]of X)q=q.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)q=q.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${W} { ${q} }`}function pW($,Z,J,Y){let X=$.split(",").map((G)=>G.trim()),Q=[];for(let G of X){if(G.startsWith(":host")){if(Y)Q.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(q)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=J?`${J} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let W=lW(G,Z);if(W)Q.push(J?`${J} ${W}`:W)}return Q.join(", ")}function lW($,Z){let J=0,Y=$.length;for(let W=0;W<$.length;W++){let q=$[W];if(q==="["||q==="(")J++;else if(q==="]"||q===")")J--;else if(J===0&&(q===" "||q===">"||q==="+"||q==="~")){Y=W;break}}let X=$.slice(0,Y),Q=$.slice(Y);if(!X)return"";let G=X.length,K=0;for(let W=0;W<X.length;W++){let q=X[W];if(q==="["||q==="(")K++;else if(q==="]"||q===")")K--;else if(J===0&&K===0&&q===":"){G=W;break}}return`${X.slice(0,G)}.${Z}${X.slice(G)}${Q}`}function SZ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(J)=>{let Y=J.trim();if(Z.has(Y))return"";return Z.add(Y),J})}function t$($,Z){if(!cW.test($))return{html:$,hasScoped:!1};let J=DZ(Z),Y=`data-v-${J}`,X=$,Q=new RegExp(`<style\\s+([^>]*${z3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(X=X.replace(Q,(K,W,q)=>{G=!0;let z=iW(q,Y),U=W.replace(new RegExp(z3,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${J}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return X=oW(X,Y),{html:X,hasScoped:!0}}function iW($,Z){return kZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function oW($,Z){let J=W1($,(X,Q)=>{let G=k1(X,Q);return G>Q?G:L5(X,Q)},(X,Q)=>nW(Q)),Y=sW(J.output,Z);return bZ.lastIndex=0,Y.replace(bZ,(X,Q)=>J.tokens[Number(Q)])}function sW($,Z){let J=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,(Y,X,Q)=>{if(J.has(X.toLowerCase()))return Y;if(Y.includes(Z))return Y;if(X.toLowerCase()==="style"||X.toLowerCase()==="script")return Y;if(Q)return Y.replace(`<${X}${Q}`,`<${X} ${Z}${Q}`);if(Y.endsWith("/>"))return`<${X} ${Z} />`;return`<${X} ${Z}>`})}var z3,cW,nW=($)=>`\x00stx-scope-mask-${$}\x00`,bZ;var U3=b(()=>{n1();z3=String.raw`(?<![\w-])scoped(?![\w-])`,cW=new RegExp(`<style\\s+[^>]*${z3}`,"i");bZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function aW($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return rW.test(Z)}function e$($){z$.lastIndex=0;let Z;while((Z=z$.exec($))!==null){if(Z[0].startsWith("</")||aW(Z[0]))continue;let J=Z.index,Y=z$.lastIndex,X=1,Q;while((Q=z$.exec($))!==null)if(Q[0].startsWith("</")){if(X--,X===0){let G=Q.index;return{start:J,openEnd:Y,closeStart:G,end:z$.lastIndex,content:$.slice(Y,G)}}}else X++;return null}return null}var z$,rW;var j3=b(()=>{z$=/<\/?template\b[^>]*>/gi,rW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var yZ=()=>{};function k0($,Z,J,Y=0){let X=0,Q=Y,G=null,K=0,W=!1;while(Q<$.length){let q=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&q==="\\"){W=!0,Q++;continue}if(W=!1,(q==='"'||q==="'"||q==="`")&&!G){G=q,Q++;continue}if(q===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&q==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&q==="}"){K--,Q++;continue}if(q==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(q===Z)X++;else if(q===J){if(X--,X===0)return Q}Q++}return-1}var _3={};t(_3,{useTitle:()=>Jq,useSeoMeta:()=>PZ,usePageTitle:()=>Jq,useHead:()=>H3,seoMetaToHeadConfig:()=>Z4,resetHead:()=>$q,renderHtmlAttrs:()=>Xq,renderHead:()=>Yq,renderBodyAttrs:()=>Qq,processTitleDirective:()=>Wq,processMetaDirective:()=>qq,processHeadDirective:()=>Kq,mergeHeadConfigs:()=>A5,getPageMeta:()=>eW,getHead:()=>B3,definePageMeta:()=>Zq,applyHead:()=>Gq});function B3(){return S1}function eW(){return $4}function $q(){S1={},tW.length=0,$4={}}function H3($){S1=A5(S1,$)}function A5($,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($){H3(Z4($))}function Z4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let J=$.ogTitle??$.title,Y=$.ogDescription??$.description;if(J)Z.push({property:"og:title",content:J});if(Y)Z.push({property:"og:description",content:Y});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 X=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(X)Z.push({name:"twitter:title",content:X});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 W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function Zq($){if($4={...$4,...$},$.title||$.description)PZ({title:$.title,description:$.description})}function Jq($){let Z=typeof $==="function"?$():$;H3({title:Z})}function Yq($=S1){let Z=[];if($.title){let J=$.title;if($.titleTemplate)J=typeof $.titleTemplate==="function"?$.titleTemplate(J):$.titleTemplate.replace("%s",J);Z.push(`<title>${s1(J)}</title>`)}if($.base){let J=Object.entries($.base).map(([Y,X])=>`${Y}="${s1(X)}"`).join(" ");Z.push(`<base ${J}>`)}for(let J of $.meta||[]){let Y=Object.entries(J).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>{return`${X==="httpEquiv"?"http-equiv":X}="${s1(String(Q))}"`}).join(" ");Z.push(`<meta ${Y}>`)}for(let J of $.link||[]){let Y=Object.entries(J).filter(([X,Q])=>Q!==void 0).map(([X,Q])=>`${X}="${s1(String(Q))}"`).join(" ");Z.push(`<link ${Y}>`)}for(let J of $.script||[]){let{content:Y,...X}=J,Q=Object.entries(X).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${s1(String(K))}"`}).filter(Boolean).join(" ");if(Y)Z.push(`<script ${Q}>${Y}</script>`);else Z.push(`<script ${Q}></script>`)}for(let J of $.style||[]){let Y=J.type?` type="${J.type}"`:"";Z.push(`<style${Y}>${J.content}</style>`)}return Z.join(`
|
|
897
897
|
`)}function Xq($=S1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,J])=>`${Z}="${s1(J)}"`).join(" ")}function Qq($=S1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,J])=>`${Z}="${s1(J)}"`).join(" ")}function s1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Gq($=S1){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 J=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(J){let Y=document.querySelector(J);if(!Y){if(Y=document.createElement("meta"),Z.name)Y.setAttribute("name",Z.name);if(Z.property)Y.setAttribute("property",Z.property);document.head.appendChild(Y)}Y.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let J=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,Y=document.querySelector(J);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[X,Q]of Object.entries(Z))if(Q!==void 0)Y.setAttribute(X,String(Q))}if($.htmlAttrs)for(let[Z,J]of Object.entries($.htmlAttrs))if(Z==="class")for(let Y of String(J).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute(Z,J);if($.bodyAttrs)for(let[Z,J]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,J)}function Kq($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,X)=>{return Z+=X.trim()+`
|
|
898
|
-
`,""}),headContent:Z.trim()}}function Wq($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,X,Q)=>{let G=Y?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=A5(K,{title:G}),""})}function qq($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=A5(j,{meta:[U]}),""})}var S1,tW,$4;var U$=b(()=>{S1={},tW=[],$4={}});var J4={};
|
|
898
|
+
`,""}),headContent:Z.trim()}}function Wq($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(J,Y,X,Q)=>{let G=Y?X:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=A5(K,{title:G}),""})}function qq($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(J,Y,X,Q,G,K)=>{let W=Q?G:K,q=Q?W:Z[(W||"").trim()]??W,U=X.includes(":")?{property:X,content:q}:{name:X,content:q},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=A5(j,{meta:[U]}),""})}var S1,tW,$4;var U$=b(()=>{S1={},tW=[],$4={}});var J4={};t(J4,{stripTypeScript:()=>gZ,splitDeclaration:()=>lZ,isModuleResolutionFailure:()=>hZ,isMissingBindingFailure:()=>uZ,isCompleteImport:()=>mZ,hasVariables:()=>oZ,extractVariables:()=>r1,extractScriptFromTemplate:()=>nZ,convertToCommonJS:()=>F3});import y1 from"path";import M5 from"process";function zq($){let Z=[],J=0,Y=$.split(`
|
|
899
899
|
`);for(let X of Y){let Q=J,G=null,K=!1;for(let W=0;W<X.length;W++){let q=X[W];if(K){K=!1;continue}if(q==="\\"){K=!0;continue}if(G){if(q===G)G=null;continue}if(q==="'"||q==='"'||q==="`"){G=q;continue}if(q==="/"&&W+1<X.length&&X[W+1]==="/")break;if(q==="{")J++;else if(q==="}")J--}if(Q===0){let W=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(X)){let q=X.match(/(?:const|let|var)\s+(\w+)/);if(q)Z.push(q[1])}else{let q=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let U=q[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 gZ($){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 J(Y){if(!Y.includes(":"))return Y;let X=[],Q="",G=0,K=0,W=null;for(let q=0;q<Y.length;q++){let z=Y[q];if(W){if(Q+=z,z===W)W=null;continue}if(z==='"'||z==="'"||z==="`"){W=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){X.push(Q),Q="";continue}Q+=z}if(Q)X.push(Q);return X.map((q)=>{let z=q.trim(),U=z.startsWith("..."),j=U?z.slice(3):z,H=-1,B=0;for(let N=0;N<j.length;N++)if(j[N]==="<")B++;else if(j[N]===">")B--;else if(j[N]===":"&&B===0){H=N;break}if(H===-1)return q;let O=j.substring(0,H).trim().replace(/\?$/,""),V=j.substring(H+1),F=-1,L=0;for(let N=0;N<V.length;N++)if(V[N]==="<")L++;else if(V[N]===">")L--;else if(V[N]==="="&&L===0){F=N;break}let w=U?"...":"";if(F!==-1)return`${w}${O} = ${V.substring(F+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,X,Q)=>{if(!Q.includes(":"))return Y;return`${X}(${J(Q)})`});{let Y=/\b(function\s+\w*\s*)\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let G=X.index+X[0].length-1,K=1,W=G+1,q=0,z=null;while(W<Z.length&&K>0){let H=Z[W];if(z){if(H===z)z=null;W++;continue}if(H==='"'||H==="'"||H==="`"){z=H,W++;continue}if(H==="<")q++;else if(H===">"&&q>0)q--;else if(q===0){if(H==="(")K++;else if(H===")")K--}if(K>0)W++}if(K!==0)continue;let U=Z.substring(G+1,W);if(!U.includes(":"))continue;let j=J(U);Q.push({start:G+1,end:W,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Z=Z.substring(0,K)+q+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,X)=>{if(!X.includes(":"))return Y;if(X.includes("{")||X.includes("}"))return Y;return`(${X.split(",").map((G)=>{let[K,...W]=G.split("="),q=K.split(":")[0].trim();if(W.length>0)return`${q} = ${W.join("=").trim()}`;return q}).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,`
|
|
900
900
|
|
|
901
|
-
`),Z}function hZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function uZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function r1($,Z,J,Y={}){if(!$.trim())return;let X;try{let k=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=k.transformSync(v)}catch{X=gZ($)}let Q={exports:{}},G=Q.exports,K=M5.cwd(),W={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((k)=>k[1]).filter((k)=>!k.startsWith("node:")&&!k.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(k));for(let k of q)try{let v=y1.resolve(K,"node_modules",k),m=y1.join(v,"package.json"),
|
|
902
|
-
`),B5=Z.params??{},M1=[],T1=[];for(let i=0;i<
|
|
901
|
+
`),Z}function hZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function uZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function r1($,Z,J,Y={}){if(!$.trim())return;let X;try{let k=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=k.transformSync(v)}catch{X=gZ($)}let Q={exports:{}},G=Q.exports,K=M5.cwd(),W={},q=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((k)=>k[1]).filter((k)=>!k.startsWith("node:")&&!k.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(k));for(let k of q)try{let v=y1.resolve(K,"node_modules",k),m=y1.join(v,"package.json"),h=JSON.parse(U0("fs").readFileSync(m,"utf8")),r=h.main||"index.js";if(h.exports){let G0=typeof h.exports==="string"?h.exports:h.exports["."];if(typeof G0==="string")r=G0;else if(G0?.bun)r=G0.bun;else if(G0?.import)r=G0.import;else if(G0?.default)r=G0.default}W[k]=await import(y1.resolve(v,r))}catch{}let z=(k)=>{if(W[k])return W[k];return U0(k)},U=Z.props||{},j=(k)=>{if(!k)return U;let v={};for(let[m,h]of Object.entries(k)){let r=U[m];if(r!==void 0)v[m]=r;else if(typeof h==="function")v[m]=h();else v[m]=h}return v};for(let[k,v]of Object.entries(U))Object.defineProperty(j,k,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let k of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,k))continue;try{Object.defineProperty(j,k,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(k)=>{if(!k)return U;let v={...U};for(let[m,h]of Object.entries(k)){let r=h&&typeof h==="object"&&!Array.isArray(h)?h:{type:h};if(v[m]===void 0&&r.default!==void 0)v[m]=typeof r.default==="function"?r.default():r.default}return v},B=()=>Z.slots||{},_=(k,v)=>{let m={...k};for(let[h,r]of Object.entries(v))if(m[h]===void 0)if(typeof r==="function")m[h]=r();else m[h]=r;return m},O=(k)=>{let v=()=>k;return v.set=(m)=>{},v.update=(m)=>{},v},V=(k)=>{let v,m=!1;return()=>{if(!m)try{v=k(),m=!0}catch{v=void 0}return v}},F=(k)=>{},L=(k)=>k(),w=(k)=>{},N=(k)=>{};function R(k){let v=k||{};if(v.title!==void 0||v.description!==void 0)E({title:v.title,description:v.description})}function A(k){if(!k||typeof k!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,k),Z.__stxClientPayload=v}let M=()=>{let k=Z.__stxServeContext,v=Z.__stxServeSearch??k?.search??"",m=k?.path??"",h=Object.fromEntries(new URLSearchParams(v)),r=Z.query,G0=Object.keys(h).length>0?h:r??{},r0=v||(Object.keys(G0).length>0?`?${new URLSearchParams(G0).toString()}`:"");return{params:Z.params??{},query:G0,path:m,name:"",fullPath:m+r0,hash:"",matched:[]}},T=()=>({push:(k)=>{},replace:(k)=>{},back:()=>{},forward:()=>{},go:(k)=>{}}),I=(k)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=A5(v,k||{})},E=(k)=>{I(Z4(k||{}))},D=(k)=>({value:k}),y=(k)=>k,S=(k)=>({value:typeof k==="function"?k():k}),P=(k,v)=>{},C=(k)=>{},x=(k)=>{},f=(k)=>k?k():Promise.resolve(),d=(k)=>(v,...m)=>{},$0=(k)=>{},P0=(k,v)=>{},B0=(k,v)=>v,N0=()=>({value:"light"}),u=()=>O(!1),a=(k)=>O(!1),R0=()=>O(!1),C0=()=>a("(prefers-color-scheme: dark)"),U5=()=>a("(prefers-color-scheme: light)"),j5=()=>a("(prefers-reduced-motion: reduce)"),n=()=>a("(prefers-contrast: more)"),s={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:{}},z0=new Proxy(s,{get(k,v){if(v in k)return k[v];return},set(k,v,m){return k[v]=m,!0}}),D0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},K0=console;try{let k=F3(X,J),v=new Set(Object.keys(U)),m=(i)=>/^[a-z_$][\w$]*$/i.test(i),h=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&m(i)),r=h.map((i)=>Z[i]),G0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),r0=[],f0=[];for(let[i,G1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(G0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(k))continue;r0.push(i),f0.push(G1)}let a0=zq(k).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
|
|
902
|
+
`),B5=Z.params??{},M1=[],T1=[];for(let i=0;i<h.length;i++){if(h[i]==="params")continue;M1.push(h[i]),T1.push(r[i])}let Q1=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",...r0,...M1,`return (async () => {
|
|
903
903
|
${k}
|
|
904
|
-
${
|
|
904
|
+
${a0}
|
|
905
905
|
return module.exports
|
|
906
|
-
})()`)(Q,G,z,U,j,H,_,A,O,V,F,L,w,N,R,M,T,I,E,D,y,S,P,C,x,f,d,$0,B,P0,
|
|
906
|
+
})()`)(Q,G,z,U,j,H,_,A,O,V,F,L,w,N,R,M,T,I,E,D,y,S,P,C,x,f,d,$0,B,P0,B0,N0,u,a,R0,C0,U5,j5,n,z0,D0,K0,s.confirm,s.alert,s.fetch,B5,...f0,...T1);if(Y.preserveExisting){for(let[i,G1]of Object.entries(Q1))if(!(i in Z)||Z[i]===void 0)Z[i]=G1}else Object.assign(Z,Q1);for(let[i,G1]of Object.entries(U))if(!(i in Z))Z[i]=G1}catch(k){let v=k instanceof Error?k.message:String(k);if(hZ(v))console.warn(`[stx] server <script> in ${J??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(uZ(v))console.warn(`[stx] server <script> in ${J??"<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(M5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${J??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await _q(X,Z,J)}catch(m){if(M5.env.STX_DEBUG){let h=m instanceof Error?m.message:String(m);console.warn(`[stx] fallback extraction also failed in ${J??"<unknown>"}: ${h}`)}}}}function mZ($){let Z=0,J=null,Y=!1,X=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G===J){if(J=null,Y||Z===0)X=!0}continue}if(G==="'"||G==='"'||G==="`"){J=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)Y=!0}return J===null&&Z===0&&X}function F3($,Z){let J=Z?y1.dirname(Z):M5.cwd(),Y=M5.cwd(),X=$.split(`
|
|
907
907
|
`),Q=[],G=0;while(G<X.length){let K=X[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let W=0;for(;G<X.length;G++){for(let q of X[G])if(q==="{")W++;else if(q==="}")W--;if(W<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let W=0,q=!1,z=G;for(let H=G;H<X.length&&!q;H++){let B=null,_=!1,O=X[H];for(let V=0;V<O.length;V++){let F=O[V];if(_){_=!1;continue}if(F==="\\"){_=!0;continue}if(B){if(F===B)B=null;continue}if(F==='"'||F==="'"||F==="`"){B=F;continue}if(F==="(")W++;else if(F===")"){if(W--,W===0){G=H+1,q=!0;break}}}}if(!q)G=X.length;let U=X.slice(z,G).join(`
|
|
908
908
|
`),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 W=K,q=0;while(!mZ(W)&&G+q+1<X.length)q++,W=`${W} ${X[G+q].trim()}`;G+=q;let z=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=W.match(/^import\s+['"](.+?)['"]/),H=W,B=(_)=>{if(_.startsWith("."))return y1.resolve(J,_);if(_.startsWith("~/")||_.startsWith("@/"))return y1.resolve(Y,_.slice(2));return _};if(z){let[,_,O]=z,V=B(O);Q.push(`const ${_} = await import('${V}')`),Q.push(`module.exports.${_} = ${_};`)}else if(U){let[,_,O]=U,V=B(O),F=[],L=[];for(let w of _.split(",")){let N=w.trim();if(!N)continue;let R=N.split(/\s+as\s+/);if(R.length===2){let[A,M]=[R[0].trim(),R[1].trim()];F.push(`${A}: ${M}`),L.push(M)}else F.push(N),L.push(N)}Q.push(`const { ${F.join(", ")} } = await import('${V}')`);for(let w of L)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(X[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let W=CZ(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let W=O3(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let W=CZ(X,G),{type:q,name:z,value:U}=W;Q.push(`${q} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=W.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let W=O3(X,G);Q.push(W.functionCode),Q.push(`module.exports.${W.name} = ${W.name};`),G=W.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let W=X[G].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[G]=W;let z=O3(q,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 W=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${W};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let W=K.match(/(?:export\s+)?class\s+(\w+)/);if(W){let q=W[1],z=X[G].replace(/^export\s+/,""),U=0,j=G;for(;j<X.length;j++){let H=X[j];for(let B of H)if(B==="{")U++;else if(B==="}")U--;if(j>G)z+=`
|
|
909
909
|
`+H;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${q} = ${q};`),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 Uq(Q.join(`
|
|
@@ -914,7 +914,7 @@ ${R}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${J}`)}l
|
|
|
914
914
|
${$[q]}`,q++;else break}return W=W.trim().replace(/;$/,""),{type:Q,name:G,value:W,nextIndex:q}}function O3($,Z){let J=$[Z].trim(),Y=J.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${J}`);let[,X]=Y,Q=J.replace(/^export\s+/,""),G=Z;if(Bq(J)){let K=Hq($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:X,functionCode:Q,nextIndex:G}}function vZ($){let Z=$.trim();if(Z.startsWith("{"))return k0(Z,"{","}",0)===-1;if(Z.startsWith("["))return k0(Z,"[","]",0)===-1;return!cZ(Z)}function cZ($){let Z={paren:0,bracket:0,brace:0},J=null,Y=0;for(let X=0;X<$.length;X++){let Q=$[X];if((X>0?$[X-1]:"")==="\\"&&J)continue;if((Q==='"'||Q==="'")&&!J){J=Q;continue}if(Q===J&&J!=="`"){J=null;continue}if(Q==="`"&&!J){J="`";continue}if(Q==="`"&&J==="`"&&Y===0){J=null;continue}if(J==="`"&&Q==="$"&&$[X+1]==="{"){Y++,X++;continue}if(Y>0&&Q==="{"){Y++;continue}if(Y>0&&Q==="}"){Y--;continue}if(J)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&&J===null}function iZ($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let J=k0($,"(",")",Z);if(J===-1)return-1;return $.indexOf("{",J)}function Bq($){let Z=iZ($);if(Z===-1)return!0;return k0($,"{","}",Z)===-1}function xZ($,Z,J){let Y=J,X=Z+1;while(X<$.length&&!cZ(Y)){let Q=$[X];Y+=`
|
|
915
915
|
${Q}`,X++}while(X<$.length){let Q=$[X].trim();if(Q.startsWith(".")||Q.startsWith("?."))Y+=`
|
|
916
916
|
${$[X]}`,X++;else break}return{value:Y,nextIndex:X}}function Hq($,Z,J){let Y=J,X=Z+1;while(X<$.length){let Q=iZ(Y);if(Q!==-1){if(k0(Y,"{","}",Q)!==-1)break}let G=$[X];Y+=`
|
|
917
|
-
${G}`,X++}return{functionCode:Y,nextIndex:X}}function fZ($,Z){let J=Y0($,Z)??Y0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let Y={...Z,process:Object.freeze({env:{...M5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function _q($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of Y){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=fZ(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=fZ(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function nZ($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function oZ($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var j$=b(()=>{U$();D1();M0()});var V3={};a(V3,{renderSlot:()=>rZ,processSlots:()=>tZ,parseSlots:()=>sZ,parseSlotElement:()=>wq,extractSlotContent:()=>Aq,applySlots:()=>Mq});function Oq($,Z){let J=1,Y=Z,X="<template",Q="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(X,Y)&&(Y+X.length>=$.length||/[\s>\/]/.test($[Y+X.length]))){J++,Y+=X.length;continue}if($.startsWith(Q,Y)){let K=$.indexOf(">",Y+Q.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function Vq($,Z){let J=null;for(let Y=Z;Y<$.length;Y++){let X=$[Y];if(J){if(X==="\\"){Y++;continue}if(X===J)J=null;continue}if(X==='"'||X==="'"){J=X;continue}if(X===">")return Y+1}return-1}function Lq($){let Z=[],J=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=Vq($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",z=W[2].toLowerCase();if(q){let j=J.lastIndexOf(z);if(j!==-1)J.splice(j);X=G;continue}if(z==="template"&&J.length===0){let j=K.match(Y);if(j){let H=Oq($,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}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!Fq.has(z)){if(J.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function sZ($){let Z={default:"",named:new Map},J=$,Y=Lq($);for(let W of Y)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});Y.sort((W,q)=>q.start-W.start);for(let W of Y)J=J.slice(0,W.start)+J.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(J))!==null){let[W,q,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),V=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(J))!==null){let[W,q,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function wq($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)Y[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function rZ($,Z,J,Y){if(!$)return J;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...Y};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,z]=W.split(":").map((j)=>j.trim()),U=z||q;if(Z[q]!==void 0)G[U]=Z[q]}}else G[Q]=Z;X=Nq(X,G)}return X}function Nq($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let X=Y.trim(),Q=aZ(X,Z);return a0(String(Q??""))}catch{return`{{ ${Y} }}`}})}function aZ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),X=Z;for(let Q of Y)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,X,Q]=J,G=Z[Y],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!K0($))return;return W0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function tZ($,Z,J){let Y=$;Y=await Rq(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let z=Z.named.get(K),U=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],V=_[2];H[O]=aZ(V,J)}return await rZ(z,H,U,J)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),Y}async function Rq($,Z,J){let Y=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),Y.push(J(K,...W.slice(0,-2))),K});let Q=await Promise.all(Y),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function Aq($){let Z=sZ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Mq($,Z,J,Y){return await tZ($,{default:Z,named:J},Y)}var Fq;var L3=b(()=>{W1();M0();Fq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,Z){let J=Tq($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function Tq($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=k0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function Iq($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function a1($,Z,J,Y){let X=1,Q=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),z=W?W.index:1/0,U=q?q.index:1/0;if(z<U)X++,Q=z+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+q[0].length}else break}return-1}function eZ($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z="if",U=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(Iq(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q});let V=q+O[0].length,F=P1(K,V);if(!F){q++;continue}z="elseif",U=F.expression,q=F.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q}),z="else",U=void 0,q+=5,j=q;continue}}q++}return W.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function B$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let Q=eZ($,Y.index);if(Q)Z.push(Q),J.lastIndex=Q.end;Y=J.exec($)}return Z}function Y4($,Z,J){let Y=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(Y.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=k0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let z=$.slice(W+1,q),U=q+1,j=a1($,Z,J,U);if(j===-1){Q=X.exec($);continue}let H=$.slice(U,j),B=j+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return Y}function w3($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z=null,U=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];q+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];q+=B[0].length;continue}if(U>0){if(z)z.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)W.push(z);let F=q+_[0].length,L=P1(K,F);if(!L){q++;continue}z={type:"case",value:L.expression,content:""},q=L.endPos}else if(O&&j.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},q+=O[0].length}else if(V&&j.startsWith("@break"))q+=V[0].length;else{if(z)z.content+=K[q];q++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var $2=()=>{};var Z2=()=>{};var X4=b(()=>{$2();Z2()});async function Y2($){let Z=$;if(!Z)try{Z=(await t0())?.pagesDir||"pages"}catch{Z="pages"}let J=Z,Y=J2.get(J);if(Y)return Y;let X=[];try{X=i5(".",{pagesDir:J}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return J2.set(J,X),X}var J2;var X2=b(()=>{d7();V1();J2=new Map});function bq($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Q2($){return bq(JSON.stringify($))}function Q4($){let Z=0;while(Z<$.length){let J=$.slice(Z),Y=/<body\b([^>]*)>/i.exec(J);if(!Y)return null;let X=Z+Y.index,Q=-1,G="";for(let W of Sq){let q=W.open.exec(J);if(!q)continue;let z=Z+q.index;if(z<X&&(Q===-1||z<Q))Q=z,G=W.close}if(Q===-1)return{index:X,tag:Y[0],attrs:Y[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function N3($,Z){let J=Q4($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var Sq;var R3=b(()=>{Sq=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function C1($){let Z=$,J=new Set,Y=new Set,X=()=>{if(p0)Y.add(p0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,J.forEach((K)=>K(Z,G)),H$)Y.forEach((K)=>K4.add(K));else Y.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return J.add(Q),()=>J.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function q4($){let Z,J=!0,Y=new Set,X=()=>{if(!J)if(J=!0,H$)Y.forEach((G)=>K4.add(G));else Y.forEach((G)=>G())},Q=()=>{if(p0)Y.add(p0);if(J){let G=p0;p0=X,G4.push(X);try{Z=$()}finally{G4.pop(),p0=G}J=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function z4($,Z={}){let J,Y=!1,X=()=>{if(Y)return;if(J)J(),J=void 0;let Q=p0;p0=X,G4.push(X);try{let G=$();J=typeof G==="function"?G:void 0}finally{G4.pop(),p0=Q}};if(Z.immediate!==!1)X();return()=>{if(Y=!0,J)J()}}function M3($){if(H$){$();return}H$=!0;try{$()}finally{H$=!1,K4.forEach((Z)=>Z()),K4.clear()}}function T3($){A3.push($)}function I3($){W4.push($)}function yq(){G2(A3,"onMount",W4)}function Pq(){G2(W4,"onDestroy")}function G2($,Z,J){let Y=$.splice(0,$.length);for(let X of Y)try{let Q=X();if(J&&typeof Q==="function")J.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function Cq(){return{mount:A3.length,destroy:W4.length}}function U4($){return typeof $==="function"&&$._isSignal===!0}function j4($){return typeof $==="function"&&$._isDerived===!0}function D3($){if(U4($)||j4($))return $();return $}function B4($){let Z=p0;p0=null;try{return $()}finally{p0=Z}}function vq($,Z){let J=typeof $==="function"?$:()=>$,Y=C1([]),X=q4(()=>Y().reduce((K,W)=>Z(K,W.action),J())),Q=!1;return z4(()=>{if(J(),!Q){Q=!0;return}if(B4(()=>Y().length))Y.set([])}),[X,(K,W)=>{let q={action:K};Y.set([...Y(),q]);let z=()=>{let U=Y().filter((j)=>j!==q);if(U.length!==Y().length)Y.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var p0=null,G4,H$=!1,K4,A3,W4;var H4=b(()=>{G4=[],K4=new Set,A3=[],W4=[]});var W2={};a(W2,{useOptimistic:()=>vq,untrack:()=>D3,state:()=>C1,runMountCallbacks:()=>yq,runDestroyCallbacks:()=>Pq,pendingLifecycleCounts:()=>Cq,peek:()=>B4,onMount:()=>T3,onDestroy:()=>I3,isSignal:()=>U4,isDerived:()=>j4,generateSignalsRuntimeDev:()=>k3,generateSignalsRuntime:()=>K2,effect:()=>z4,derived:()=>q4,default:()=>fq,batch:()=>M3});function K2(){let $=xq(k3());try{let J=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return J=J.replace(/\}(var |let |const |function )/g,"};$1"),J}catch{return $}}function xq($){let Z=[],J=0,Y="console.log(";while(J<$.length){let X=$.indexOf(Y,J);if(X===-1){Z.push($.slice(J));break}Z.push($.slice(J,X));let Q=1,G=X+Y.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),J=G}return Z.join("")}function k3(){return`
|
|
917
|
+
${G}`,X++}return{functionCode:Y,nextIndex:X}}function fZ($,Z){let J=Y0($,Z)??Y0(`(${$})`,Z);if(J!==void 0)return J;if(!/\bprocess\b/.test($))return;let Y={...Z,process:Object.freeze({env:{...M5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function _q($,Z,J){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of Y){let[,,G,K]=Q;try{let W=K.trim().replace(/;$/,""),q=fZ(W,Z);if(q!==void 0)Z[G]=q}catch(W){console.warn(`Failed to parse export ${G} in fallback:`,W)}}let X=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of X){let[,,G,K]=Q;if(!(G in Z))try{let W=K.trim().replace(/;$/,""),q=fZ(W,Z);if(q!==void 0)Z[G]=q}catch{}}}function nZ($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1]:"",Y=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:J,templateWithoutScript:Y}}function oZ($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var j$=b(()=>{U$();D1();M0()});var V3={};t(V3,{renderSlot:()=>rZ,processSlots:()=>tZ,parseSlots:()=>sZ,parseSlotElement:()=>wq,extractSlotContent:()=>Aq,applySlots:()=>Mq});function Oq($,Z){let J=1,Y=Z,X="<template",Q="</template";while(Y<$.length&&J>0){let G=$.indexOf("<",Y);if(G===-1)break;if(Y=G,$.startsWith(X,Y)&&(Y+X.length>=$.length||/[\s>\/]/.test($[Y+X.length]))){J++,Y+=X.length;continue}if($.startsWith(Q,Y)){let K=$.indexOf(">",Y+Q.length);if(K!==-1){if(J--,J===0)return K+1;Y=K+1;continue}}Y++}return J===0?Y:-1}function Vq($,Z){let J=null;for(let Y=Z;Y<$.length;Y++){let X=$[Y];if(J){if(X==="\\"){Y++;continue}if(X===J)J=null;continue}if(X==='"'||X==="'"){J=X;continue}if(X===">")return Y+1}return-1}function Lq($){let Z=[],J=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);X=j===-1?$.length:j+3;continue}let G=Vq($,Q+1);if(G===-1)break;let K=$.slice(Q,G),W=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){X=G;continue}let q=W[1]==="/",z=W[2].toLowerCase();if(q){let j=J.lastIndexOf(z);if(j!==-1)J.splice(j);X=G;continue}if(z==="template"&&J.length===0){let j=K.match(Y);if(j){let H=Oq($,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}),X=H;continue}}}if(!/\/\s*>$/.test(K)&&!Fq.has(z)){if(J.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){X=j;continue}}}X=G}return Z}function sZ($){let Z={default:"",named:new Map},J=$,Y=Lq($);for(let W of Y)Z.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});Y.sort((W,q)=>q.start-W.start);for(let W of Y)J=J.slice(0,W.start)+J.slice(W.end);let X=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(J))!==null){let[W,q,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),V=`<${q}${O?" "+O:""}>${H}</${q}>`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:V})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(J))!==null){let[W,q,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${q}${_?" "+_:""} />`;X.push({start:G.index,end:G.index+W.length,slotName:U,element:O})}X.sort((W,q)=>q.start-W.start);for(let W of X){let q=Z.named.get(W.slotName);if(q)q.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});J=J.slice(0,W.start)+J.slice(W.end)}return Z.default=J.trim(),Z}function wq($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),J=Z?Z[1]:"",Y={},X=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=X.exec($))!==null)Y[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:J,props:Y,defaultContent:K}}async function rZ($,Z,J,Y){if(!$)return J;let X=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...Y};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[q,z]=W.split(":").map((j)=>j.trim()),U=z||q;if(Z[q]!==void 0)G[U]=Z[q]}}else G[Q]=Z;X=Nq(X,G)}return X}function Nq($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(J,Y)=>{try{let X=Y.trim(),Q=aZ(X,Z);return t0(String(Q??""))}catch{return`{{ ${Y} }}`}})}function aZ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),X=Z;for(let Q of Y)if(X&&typeof X==="object"&&Q in X)X=X[Q];else return;return X}let J=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(J){let[,Y,X,Q]=J,G=Z[Y],K=parseInt(Q,10);if(typeof G==="number")switch(X){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!W0($))return;return q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function tZ($,Z,J){let Y=$;Y=await Rq(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,q)=>{let z=Z.named.get(K),U=q?.trim()||"",j=W||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],V=_[2];H[O]=aZ(V,J)}return await rZ(z,H,U,J)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),Y}async function Rq($,Z,J){let Y=[],X=[];$.replace(Z,(K,...W)=>{let q=W[W.length-2];return X.push({match:K,index:q}),Y.push(J(K,...W.slice(0,-2))),K});let Q=await Promise.all(Y),G=$;for(let K=X.length-1;K>=0;K--){let{match:W,index:q}=X[K];G=G.slice(0,q)+Q[K]+G.slice(q+W.length)}return G}function Aq($){let Z=sZ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Mq($,Z,J,Y){return await tZ($,{default:Z,named:J},Y)}var Fq;var L3=b(()=>{q1();M0();Fq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,Z){let J=Tq($,Z);return J.ok?{expression:J.expression,endPos:J.endPos}:null}function Tq($,Z){let J=Z;while(J<$.length&&/\s/.test($[J]))J++;if($[J]!=="(")return{ok:!1,reason:"missing-open-paren",pos:J};let Y=k0($,"(",")",J);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:J};return{ok:!0,expression:$.slice(J+1,Y),endPos:Y+1}}function Iq($,Z){let J=$.lastIndexOf("<",Z);if(J===-1)return!1;return J>$.lastIndexOf(">",Z)}function a1($,Z,J,Y){let X=1,Q=Y,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${J}(?![a-z])`,"g");while(Q<$.length&&X>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),q=K.exec($),z=W?W.index:1/0,U=q?q.index:1/0;if(z<U)X++,Q=z+W[0].length;else if(U<1/0){if(X--,X===0)return U;Q=U+q[0].length}else break}return-1}function eZ($,Z){let J=$.slice(Z).match(/^@if\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z="if",U=X.expression,j=0,H=0;while(q<K.length){let B=K.indexOf("@",q);if(B===-1)break;q=B;let _=K.substring(B);if(Iq(K,B)){q++;continue}if(/^@if\s*\(/.test(_)){H++,q++;continue}if(/^@endif(?![a-z])/.test(_)){H--,q+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q});let V=q+O[0].length,F=P1(K,V);if(!F){q++;continue}z="elseif",U=F.expression,q=F.endPos,j=q;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:z,condition:U,content:K.substring(j,q),start:Q+j,end:Q+q}),z="else",U=void 0,q+=5,j=q;continue}}q++}return W.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function B$($){let Z=[],J=/@if\s*\(/g,Y=J.exec($);while(Y!==null){if(Z.some((G)=>Y.index>G.start&&Y.index<G.end)){Y=J.exec($);continue}let Q=eZ($,Y.index);if(Q)Z.push(Q),J.lastIndex=Q.end;Y=J.exec($)}return Z}function Y4($,Z,J){let Y=[],X=new RegExp(`@${Z}\\s*\\(`,"g"),Q=X.exec($);while(Q!==null){if(Y.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=X.exec($);continue}let K=Q.index,W=K+Q[0].length-1,q=k0($,"(",")",W);if(q===-1){Q=X.exec($);continue}let z=$.slice(W+1,q),U=q+1,j=a1($,Z,J,U);if(j===-1){Q=X.exec($);continue}let H=$.slice(U,j),B=j+`@${J}`.length;Y.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),X.lastIndex=B,Q=X.exec($)}return Y}function w3($,Z){let J=$.slice(Z).match(/^@switch\s*/);if(!J)return null;let Y=Z+J[0].length,X=P1($,Y);if(!X)return null;let Q=X.endPos,G=a1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],q=0,z=null,U=0;while(q<K.length){let j=K.slice(q),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];q+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];q+=B[0].length;continue}if(U>0){if(z)z.content+=K[q];q++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),V=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)W.push(z);let F=q+_[0].length,L=P1(K,F);if(!L){q++;continue}z={type:"case",value:L.expression,content:""},q=L.endPos}else if(O&&j.startsWith("@default")){if(z)W.push(z);z={type:"default",content:""},q+=O[0].length}else if(V&&j.startsWith("@break"))q+=V[0].length;else{if(z)z.content+=K[q];q++}}if(z)W.push(z);return{fullMatch:$.slice(Z,G+10),expression:X.expression,cases:W,start:Z,end:G+10}}var $2=()=>{};var Z2=()=>{};var X4=b(()=>{$2();Z2()});async function Y2($){let Z=$;if(!Z)try{Z=(await e0())?.pagesDir||"pages"}catch{Z="pages"}let J=Z,Y=J2.get(J);if(Y)return Y;let X=[];try{X=i5(".",{pagesDir:J}).map((Q)=>Q.regex.source).filter(Boolean)}catch{X=[]}return J2.set(J,X),X}var J2;var X2=b(()=>{d7();V1();J2=new Map});function bq($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Q2($){return bq(JSON.stringify($))}function Q4($){let Z=0;while(Z<$.length){let J=$.slice(Z),Y=/<body\b([^>]*)>/i.exec(J);if(!Y)return null;let X=Z+Y.index,Q=-1,G="";for(let W of Sq){let q=W.open.exec(J);if(!q)continue;let z=Z+q.index;if(z<X&&(Q===-1||z<Q))Q=z,G=W.close}if(Q===-1)return{index:X,tag:Y[0],attrs:Y[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function N3($,Z){let J=Q4($);if(!J)return $;return $.slice(0,J.index)+Z(J.tag,J.attrs)+$.slice(J.index+J.tag.length)}var Sq;var R3=b(()=>{Sq=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function C1($){let Z=$,J=new Set,Y=new Set,X=()=>{if(p0)Y.add(p0);return Z};return X.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,J.forEach((K)=>K(Z,G)),H$)Y.forEach((K)=>K4.add(K));else Y.forEach((K)=>K())}},X.update=(Q)=>{X.set(Q(Z))},X.subscribe=(Q)=>{return J.add(Q),()=>J.delete(Q)},Object.defineProperty(X,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(X,"value",{get:()=>X(),set:(Q)=>X.set(Q),configurable:!0}),X}function q4($){let Z,J=!0,Y=new Set,X=()=>{if(!J)if(J=!0,H$)Y.forEach((G)=>K4.add(G));else Y.forEach((G)=>G())},Q=()=>{if(p0)Y.add(p0);if(J){let G=p0;p0=X,G4.push(X);try{Z=$()}finally{G4.pop(),p0=G}J=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function z4($,Z={}){let J,Y=!1,X=()=>{if(Y)return;if(J)J(),J=void 0;let Q=p0;p0=X,G4.push(X);try{let G=$();J=typeof G==="function"?G:void 0}finally{G4.pop(),p0=Q}};if(Z.immediate!==!1)X();return()=>{if(Y=!0,J)J()}}function M3($){if(H$){$();return}H$=!0;try{$()}finally{H$=!1,K4.forEach((Z)=>Z()),K4.clear()}}function T3($){A3.push($)}function I3($){W4.push($)}function yq(){G2(A3,"onMount",W4)}function Pq(){G2(W4,"onDestroy")}function G2($,Z,J){let Y=$.splice(0,$.length);for(let X of Y)try{let Q=X();if(J&&typeof Q==="function")J.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function Cq(){return{mount:A3.length,destroy:W4.length}}function U4($){return typeof $==="function"&&$._isSignal===!0}function j4($){return typeof $==="function"&&$._isDerived===!0}function D3($){if(U4($)||j4($))return $();return $}function B4($){let Z=p0;p0=null;try{return $()}finally{p0=Z}}function vq($,Z){let J=typeof $==="function"?$:()=>$,Y=C1([]),X=q4(()=>Y().reduce((K,W)=>Z(K,W.action),J())),Q=!1;return z4(()=>{if(J(),!Q){Q=!0;return}if(B4(()=>Y().length))Y.set([])}),[X,(K,W)=>{let q={action:K};Y.set([...Y(),q]);let z=()=>{let U=Y().filter((j)=>j!==q);if(U.length!==Y().length)Y.set(U)};if(W&&typeof W.then==="function")Promise.resolve(W).then(z,z);return z}]}var p0=null,G4,H$=!1,K4,A3,W4;var H4=b(()=>{G4=[],K4=new Set,A3=[],W4=[]});var W2={};t(W2,{useOptimistic:()=>vq,untrack:()=>D3,state:()=>C1,runMountCallbacks:()=>yq,runDestroyCallbacks:()=>Pq,pendingLifecycleCounts:()=>Cq,peek:()=>B4,onMount:()=>T3,onDestroy:()=>I3,isSignal:()=>U4,isDerived:()=>j4,generateSignalsRuntimeDev:()=>k3,generateSignalsRuntime:()=>K2,effect:()=>z4,derived:()=>q4,default:()=>fq,batch:()=>M3});function K2(){let $=xq(k3());try{let J=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return J=J.replace(/\}(var |let |const |function )/g,"};$1"),J}catch{return $}}function xq($){let Z=[],J=0,Y="console.log(";while(J<$.length){let X=$.indexOf(Y,J);if(X===-1){Z.push($.slice(J));break}Z.push($.slice(J,X));let Q=1,G=X+Y.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let W=K;G++;while(G<$.length&&$[G]!==W){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),J=G}return Z.join("")}function k3(){return`
|
|
918
918
|
// STX Signals Runtime (Development Build)
|
|
919
919
|
console.log('[stx] signals runtime loading');
|
|
920
920
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -8675,7 +8675,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
8675
8675
|
}
|
|
8676
8676
|
}
|
|
8677
8677
|
})();
|
|
8678
|
-
`}var fq;var q2=b(()=>{H4();
|
|
8678
|
+
`}var fq;var q2=b(()=>{H4();K1();H4();fq={state:C1,derived:q4,effect:z4,batch:M3,onMount:T3,onDestroy:I3,isSignal:U4,isDerived:j4,untrack:D3,peek:B4,generateSignalsRuntime:K2,generateSignalsRuntimeDev:k3}});var E3={};t(E3,{templateCache:()=>z2,readFileCached:()=>gq,invalidateFileCacheByDir:()=>uq,invalidateFileCache:()=>hq,hashFilePath:()=>_$,getCachedSignalsRuntime:()=>pq,getCachedRouterScript:()=>lq,clearDevCaches:()=>cq,checkCache:()=>iq,cacheTemplate:()=>nq,__setSignalsGeneratorsForTest:()=>dq});import v1 from"fs";import T5 from"path";async function gq($){let J;for(let Y=0;Y<3;Y++)try{let Q=(await v1.promises.stat($)).mtime.getTime(),G=t1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),q=(await v1.promises.stat($)).mtime.getTime();if(q!==Q)continue;return t1.set($,{content:K,mtime:q}),K}catch(X){J=X;break}throw t1.delete($),Error(`File not found: ${$}${J?` (${J.message})`:""}`)}function hq($){t1.delete($)}function uq($){for(let Z of t1.keys())if(Z.startsWith($))t1.delete(Z)}function dq($){U2=$}async function pq($=!1){let Z=U2??await Promise.resolve().then(() => (q2(),W2));if($)return Z.generateSignalsRuntimeDev();if(_4===null)_4=Z.generateSignalsRuntime();return _4}async function lq(){if(O4===null){let{getRouterScript:$}=await import("stx-router");O4=$()}return O4}function cq(){t1.clear(),B2(),_4=null,mq=null,O4=null}function j2($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((J)=>({name:J.name,timing:J.timing,handler:String(J.handler)})),customDirectives:($.customDirectives??[]).map((J)=>({name:J.name,hasEndTag:J.hasEndTag===!0,handler:String(J.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function iq($,Z){try{if(!Z.cachePath)return null;let J=T5.resolve(Z.cachePath),Y=T5.join(J,`${_$($)}.html`),X=T5.join(J,`${_$($)}.meta.json`);if(!await c(Y)||!await c(X))return null;let Q=await Bun.file(X).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==j2(Z))return null;if((await v1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await c(W)){if((await v1.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(Y).text()}catch(J){return console.warn(`Cache error for ${$}:`,J),null}}async function nq($,Z,J,Y){try{if(!Y.cachePath)return;let X=T5.resolve(Y.cachePath);await v1.promises.mkdir(X,{recursive:!0});let Q=T5.join(X,`${_$($)}.html`),G=T5.join(X,`${_$($)}.meta.json`),K=await v1.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(J),cacheVersion:Y.cacheVersion,optionsSignature:j2(Y),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),z2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:J})}catch(X){console.warn(`Failed to cache template ${$}:`,X)}}function _$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,oq)}var z2,t1,_4=null,mq=null,U2=null,O4=null,oq=16;var b3=b(()=>{I0();z2=new Map,t1=new Map});function H2($){return $.includes("data-stx-runtime")}function _2($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let J=Z.exec($);J!==null;J=Z.exec($)){let Y=$.slice(Math.max(0,J.index-80),J.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}async function F4($,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>
|
|
8679
8679
|
`+$.slice(K);if($.includes("</head>")){let W=$.indexOf("</head>");return $.slice(0,W)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
8680
8680
|
`+$.slice(W)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
8681
8681
|
`+$}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>
|
|
@@ -8687,10 +8687,10 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
8687
8687
|
`+X+$.slice(K+1)}return X+`
|
|
8688
8688
|
`+$}async function S3($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let J=Z?.router,Y="";{let K={};if(J){if(J.container)K.container=J.container;if(J.interceptAllLinks!==void 0)K.interceptAllLinks=J.interceptAllLinks;if(J.progress!==void 0)K.progress=J.progress;if(J.viewTransitions!==void 0)K.viewTransitions=J.viewTransitions;if(J.viewTransitionDuration!==void 0)K.viewTransitionDuration=J.viewTransitionDuration;if(J.viewTransitionEasing!==void 0)K.viewTransitionEasing=J.viewTransitionEasing;if(J.scrollToTop!==void 0)K.scrollToTop=J.scrollToTop;if(J.prefetch!==void 0)K.prefetch=J.prefetch;if(J.cache!==void 0)K.cache=J.cache;if(J.progressColor!==void 0)K.progressColor=J.progressColor;if(J.progressHeight!==void 0)K.progressHeight=J.progressHeight}try{let W=await Y2(Z?.pagesDir);if(W.length>0)K.ownedRoutes=W}catch{}if(Object.keys(K).length>0)Y=`<script>window.__stxRouterConfig=${Q2(K)};</script>
|
|
8689
8689
|
`}let{getCachedRouterScript:X}=await Promise.resolve().then(() => (b3(),E3)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await X()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+Y+Q+`
|
|
8690
|
-
</body>`+$.slice(G+7)}var V4=b(()=>{X2();R3()});var R4={};
|
|
8690
|
+
</body>`+$.slice(G+7)}var V4=b(()=>{X2();R3()});var R4={};t(R4,{scanScriptTags:()=>R2,rewriteStxImportSpecifiers:()=>I2,processSignals:()=>x3,processScriptSetup:()=>M2,preEvalLiteralReactiveIfs:()=>C3,parseLoopExpression:()=>A2,hasSignalsSyntax:()=>N4,findMarkupIndexOutsideScripts:()=>w4,extractExports:()=>T2,convertSignalLoopsToAttributes:()=>v3,convertSignalDirectivesToAttributes:()=>P3});function R2($,Z={}){let J=[];for(let Y of K3($,k1)){let X=Y.token.match(/^<script\b([^>]*)>/i),Q=Y.token.match(/<\/script\s*>$/i);if(!X||!Q)continue;let G=X[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=X[0].length,W=Y.token.length-Q[0].length;J.push({fullMatch:Y.token,attrs:G,body:Y.token.slice(K,W),start:Y.start,end:Y.end})}return J}function A2($){let Z=$.trim(),J=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(J){let X=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:K}=F2(Q);if(G)return{style:"as",iterable:X,itemVar:G,indexVar:K}}let Y=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let X=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=F2(X);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function F2($){let Z=$.trim(),J=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(J)return{itemVar:J[2],indexVar:J[1]};let Y=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let X=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(X)return{itemVar:X[1],indexVar:X[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function N4($){return k8($)}function rq($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,J=0,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(X.startsWith("if"))J++;else if(X==="endif")J--;else if(J===0)return!0}return!1}function aq($){let Z=new Set,J=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,X;while((X=J.exec($))!==null){let Q=X[1],G;while((G=Y.exec(Q))!==null)Z.add(G[1])}return Z}function tq($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function L2($,Z,J){if(!$)return!1;let Y=tq($),X=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,W;while((W=K.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(V2.has(j))continue;if(Z.has(j))X=!0;else if(J&&j in J)Q=!0}let q=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=q.exec(Y))!==null){let j=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(V2.has(j)||J&&j in J)continue;G=!0}return(X||G)&&!Q}function L4($,Z,J){let Y=J===void 0?` ${Z}`:` ${Z}="${J.replace(/"/g,""")}"`,X=$.trim(),Q=X.match(N2);if(Q&&eq(Q[3],Q[1])){let[,G,K,W]=Q;return`<${G}${K}${Y}>${W}</${G}>`}return`<template${Y}>${X}</template>`}function eq($,Z){let J=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),Y=0,X;while((X=J.exec($))!==null)if(X[1]){if(Y--,Y<0)return!1}else Y++;return!0}function P3($,Z){let J=aq($);function Y(X){let Q=X,G=/@if\s*\(/g,K,W=[];while((K=G.exec(Q))!==null){let q=K.index,z=q+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,V=/@(if\s*\(|endif)/g;V.lastIndex=B;let F;while((F=V.exec(Q))!==null)if(F[1].startsWith("if"))_++;else if(F[1]==="endif"){if(_--,_===0){O=F.index+F[0].length;break}}if(_!==0)continue;let L=Q.substring(B,O-6).trim(),w;if(rq(L)){let N=B$(Q.substring(q,O));if(N.length===0)continue;let R=N[0].branches.filter((T)=>T.type!=="else");if(!(R.length>0&&R.every((T)=>L2(T.condition,J,Z))))continue;w=N[0].branches.map((T)=>{let I=Y(T.content);if(T.type==="elseif")return L4(I,"@else-if",T.condition??"");if(T.type==="else")return L4(I,"@else");return L4(I,"@if",T.condition??"")}).join(`
|
|
8691
8691
|
`)}else{if(!L2(H,J,Z))continue;w=L4(Y(L),"@if",H)}W.push({start:q,end:O,replacement:w}),G.lastIndex=O}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];Q=Q.substring(0,z)+j+Q.substring(U)}return Q}return Y($)}function $z($){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 X=Number(Z);return X!==0&&!Number.isNaN(X)}let J=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(J)return J[1].length>0;let Y=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function Zz($,Z,J,Y){if(y3.has(J.toLowerCase()))return Y;let X=J.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,W=Y;while(W<G){let q=$.indexOf("<",W);if(q===-1)return-1;if(W=q,$.startsWith("<!--",W)){let H=$.indexOf("-->",W+4);if(H===-1)return-1;W=H+3;continue}let z=/^<(script|style)\b/i.exec($.slice(W,W+8));if(z){let H=$.indexOf(">",W);if(H===-1)return-1;if($[H-1]==="/"){W=H+1;continue}let B=Q.indexOf(`</${z[1].toLowerCase()}`,W);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;W=_+1;continue}if($[W+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!H){W++;continue}if(H[1].toLowerCase()===X){if(K--,W+=H[0].length,K===0)return W;continue}W+=H[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(W,W+64));if(!U){W++;continue}let j=$.indexOf(">",W);if(j===-1)return-1;if(U[1].toLowerCase()===X){let H=$.slice(W,j+1);if(!(/\/\s*>$/.test(H)||y3.has(X)))K++}W=j+1}return-1}function Yz($,Z){let J=Z,Y=$.length;for(;;){while(J<Y&&$[J]!=="<")J++;if(J>=Y)return!1;if($.startsWith("<!--",J)){let G=$.indexOf("-->",J+4);if(G===-1)return!1;J=G+3;continue}break}if($[J+1]==="/")return!1;let X=$.indexOf(">",J);if(X===-1)return!1;let Q=$.slice(J,X+1);return Jz.test(Q)}function C3($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=J.exec($))!==null)Z.push([Y.index,Y.index+Y[0].length]);let X=(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(X(K.index))continue;let[U,j,H,B,_,O,V]=K,F=$z(_);if(F===void 0)continue;let L=K.index,w=L+U.length,A=!!V||/\/\s*>$/.test(U)||y3.has(j.toLowerCase())?w:Zz($,L,j,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Yz($,A)){Q.lastIndex=w;continue}if(F===!0){let T=`<${j}${H}${O}${V}>`;G.push({start:L,end:w,replacement:T});continue}G.push({start:L,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let W=[],q=-1;for(let U of G){if(U.start<q)continue;W.push(U),q=U.end}let z=$;for(let U=W.length-1;U>=0;U--){let{start:j,end:H,replacement:B}=W[U];z=z.substring(0,j)+B+z.substring(H)}return z}function v3($,Z){let J=$,Y=/@(for|foreach)\s*\(/g,X,Q=[],G=[];while((X=Y.exec(J))!==null){let K=X[1],W=X.index,q=W+X[0].length,z=1,U=q;while(U<J.length&&z>0){if(J[U]==="(")z++;else if(J[U]===")")z--;U++}if(z!==0)continue;let j=J.substring(q,U-1).trim(),H=U,B=A2(j),_=K==="for"?"@endfor":"@endforeach",O=1,V=H,F=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");F.lastIndex=H;let L;while((L=F.exec(J))!==null)if(L[1].startsWith(K))O++;else if(O--,O===0){V=L.index+L[0].length;break}if(O!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:W,end:V,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 T=M.split(/[.[(]/)[0].trim(),I=Z?T in Z:!1,E=G.some((D)=>W>D.start&&W<D.end&&D.vars.includes(T));if(T&&(I||E)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let N=J.substring(H,V-_.length).trim(),R=N.match(N2),A;if(R){let[,M,T,I]=R;A=`<${M}${T} @for="${j}">${I}</${M}>`}else A=`<template @for="${j}">${N}</template>`;Q.push({start:W,end:V,replacement:A})}for(let K=Q.length-1;K>=0;K--){let{start:W,end:q,replacement:z}=Q[K];J=J.substring(0,W)+z+J.substring(q)}return J}function Xz($){let Z=new Set,J=[],Y=0,X=0,Q=$.length,G=(z)=>{let U=Y+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===z)return U+1;U++}return Q},K=()=>{let z=Y+2;while(z<Q&&$[z]!==`
|
|
8692
8692
|
`)z++;return z},W=()=>{let z=Y+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},q=(z)=>{let U=z,j=0;while(U<Q){let H=$[U];if(H==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
|
|
8693
|
-
`)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(Y<Q){let z=$[Y];if(z==="/"&&$[Y+1]==="/"){let U=K();J.push($.slice(Y,U)),Y=U;continue}if(z==="/"&&$[Y+1]==="*"){let U=W();J.push($.slice(Y,U)),Y=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);J.push($.slice(Y,U)),Y=U;continue}if(z==="{"){X++,J.push(z),Y++;continue}if(z==="}"){X--,J.push(z),Y++;continue}if(X===0){let U=Y>0?$[Y-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(Y+H[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=_;continue}Z.add(B),J.push($.slice(Y,_)),Y=_;continue}}}J.push(z),Y++}return J.join("")}async function M2($,Z,J){let Y=R2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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 Y){let V=O.body;if(c1(O.attrs))V=i1(V);if(X.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${sq++}`,{hasUserImports:K,bundleClientScript:W}=await
|
|
8693
|
+
`)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(Y<Q){let z=$[Y];if(z==="/"&&$[Y+1]==="/"){let U=K();J.push($.slice(Y,U)),Y=U;continue}if(z==="/"&&$[Y+1]==="*"){let U=W();J.push($.slice(Y,U)),Y=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);J.push($.slice(Y,U)),Y=U;continue}if(z==="{"){X++,J.push(z),Y++;continue}if(z==="}"){X--,J.push(z),Y++;continue}if(X===0){let U=Y>0?$[Y-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=q(Y+H[0].length);if(Z.has(B)){J.push(`/* stx: deduped const ${B} */`),Y=_;continue}Z.add(B),J.push($.slice(Y,_)),Y=_;continue}}}J.push(z),Y++}return J.join("")}async function M2($,Z,J){let Y=R2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),X=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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 Y){let V=O.body;if(c1(O.attrs))V=i1(V);if(X.test(V))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:V})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${sq++}`,{hasUserImports:K,bundleClientScript:W}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => ($$(),e5))),q=[];for(let O=0;O<Q.length;O++){let V=Q[O].content;if(V=V5(V).code,K(V))V=await W(V,Z||"",{projectRoot:process.cwd()});V=V.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L,w)=>I2(w));let F=d0(V);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
|
|
8694
8694
|
${F}`)}let z=q.join(`
|
|
8695
8695
|
|
|
8696
8696
|
`);z=Xz(z);let U=T2(z),j=U.split(",").map((O)=>O.trim()).filter(Boolean),H=i$(z,J),B=`
|
|
@@ -8707,13 +8707,13 @@ if(window.stx)window.stx._latestSetup=${G};
|
|
|
8707
8707
|
`)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(X!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let L=B[2];if(!Y.has(L))J.push(L),Y.add(L);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((L)=>{let w=L.trim();if(!w)return;let N=w.indexOf(":"),A=(N>=0?w.slice(N+1).trim():w).split(/[\s=]/)[0];if(A&&!Y.has(A))J.push(A),Y.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((L)=>{let w=L.trim().replace(/^\.\.\./,"");if(!w)return;let N=w.split(/[\s=]/)[0];if(N&&!Y.has(N))J.push(N),Y.add(N)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let L=V[1];if(!Y.has(L))J.push(L),Y.add(L);return}let F=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let L=F[1];if(!Y.has(L))J.push(L),Y.add(L)}};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]!=="*"&&q()){W(),K="/";continue}if(Z[Q]==="{"){X++,K="{",Q++;continue}if(Z[Q]==="}"){X--,K="}",Q++;continue}if(X===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 J.join(", ")}async function x3($,Z,J,Y){if(!N4($))return $;let X=$;if(Z.skipSignalsRuntime)return X;let{output:Q,setupCode:G}=await M2(X,J,Y);if(X=Q,X=await F4(X,Z),G){let z=w4(X,/<\/head>/i),U=z===-1?w4(X,/<body[^>]*>/i):-1;if(z!==-1)X=`${X.slice(0,z)}${G}
|
|
8708
8708
|
${X.slice(z)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(X.slice(U))[0],H=U+j.length;X=`${X.slice(0,H)}
|
|
8709
8709
|
${G}${X.slice(H)}`}else X=`${X}
|
|
8710
|
-
${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,U=w4(X,z);if(U!==-1){let j=X.slice(0,U),H=X.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function w4($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],X;while((X=J.exec($))!==null)Y.push([X.index,X.index+X[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 W=G+K.index;if(!Y.some(([z,U])=>W>=z&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function I2($){let Z=[];for(let J of $.split(",")){let Y=J.trim();if(!Y||Y.startsWith("type "))continue;let X=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return w2;return`var ${Z.join(", ")}; ${w2}`}var sq=0,O2=`(?:"[^"]*"|'[^']*'|[^>"'])*`,N2,V2,y3,Jz,w2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var O$=b(()=>{Q$();X4();
|
|
8711
|
-
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(Y!==0)return;let z=$.slice(X).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(_)&&!J.has(_))Z.push(_),J.add(_);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){Y++,X++;continue}if($[X]==="}"){Y--,X++;continue}if(Y===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function zz($){let Z=[],J=0,Y=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(Y,Q)),Y=Q+1}if(Y<$.length)Z.push($.slice(Y));return Z}function Uz($){let Z=0,J=null;for(let Y=0;Y<$.length;Y++){let X=$[Y];if(J){if(X==="\\"){Y++;continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[Y-1],G=$[Y+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return Y}}return-1}function jz($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let Y=J.index-1;while(Y>=0&&/\s/.test($[Y]))Y--;if($[Y]!=="}")return;let X=Y,Q=0,G=-1;for(;Y>=0;Y--){let W=$[Y];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=Y;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of zz(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let z=Uz(q);if(z===-1)continue;let U=q.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=q.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 T4($,Z,J,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=J.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof X.root==="string"?g.resolve(X.root):void 0,U=z??g.dirname(Y),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=J.__originalFilePath;if(B)H(g.join(g.dirname(B),"components"));H(Z),H(X._rootComponentsDir),H(g.join(g.dirname(Y),"components")),H(X.componentsDir);let _=X._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(z)H(g.resolve(z,"resources/views/components")),H(g.resolve(z,"resources/components")),H(g.resolve(z,"src/components")),H(g.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(g.resolve(g.dirname(Y),`${Q}.stx`));for(let O of j){let V=g.isAbsolute(O)?O:g.resolve(U,O);for(let F of q)if(await c(g.join(V,F)))return!0}return!1}function Bz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Hz($){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 _z($){let Z=new Set,J=/\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 Y of $){let X;while((X=J.exec(Y))!==null)Z.add(X[1]);J.lastIndex=0}return[...Z]}async function e1($,Z,J,Y,X,Q,G,K=new Set,W){let{extractVariables:q}=await
|
|
8710
|
+
${G}`}let W=X.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=W&&/data-stx/.test(W[1]);if(!G&&!q&&W&&!/data-stx-auto/.test(W[1])){let z=/<body[^>]*>/i,U=w4(X,z);if(U!==-1){let j=X.slice(0,U),H=X.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));X=j+H}}return X}function w4($,Z){let J=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],X;while((X=J.exec($))!==null)Y.push([X.index,X.index+X[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 W=G+K.index;if(!Y.some(([z,U])=>W>=z&&W<U))return W;G=W+Math.max(K[0].length,1)}return-1}function I2($){let Z=[];for(let J of $.split(",")){let Y=J.trim();if(!Y||Y.startsWith("type "))continue;let X=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(X&&X[1]!==X[2])Z.push(`${X[2]} = ${X[1]}`)}if(Z.length===0)return w2;return`var ${Z.join(", ")}; ${w2}`}var sq=0,O2=`(?:"[^"]*"|'[^']*'|[^>"'])*`,N2,V2,y3,Jz,w2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var O$=b(()=>{Q$();X4();K1();e7();I0();V4();n1();t5();N2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;V2=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"]);Jz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Qz from"fs";import g from"path";function Kz($){let Z=new WeakSet;try{let J=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if(Z.has(Y))throw TypeError("Circular component input");if(Z.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(J);let X={};for(let Q of Object.keys(Y).sort())X[Q]=J(Y[Q]);return X};return JSON.stringify(J($))}catch{return null}}function D2($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Wz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function c1($){return!Wz($)}function i1($){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 J=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=J.length;return J.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=J.length;return J.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=J.length;return J.push(Q),`"__STX_EXPR_${G}__"`});let X=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}).transformSync(Z);for(let Q=0;Q<J.length;Q++)X=X.replace(`"__STX_EXPR_${Q}__"`,J[Q]),X=X.replace(`'__STX_EXPR_${Q}__'`,J[Q]);return X}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function qz($){let Z=[],J=new Set,Y=0,X=0,Q=$.length,G=(z)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===z){X++;return}X++}},K=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let z=1;while(X<Q&&z>0)if($[X]==="{")z++,X++;else if($[X]==="}")z--,X++;else if($[X]==="'"||$[X]==='"')G($[X]);else if($[X]==="`")K();else X++;continue}X++}},W=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
|
|
8711
|
+
`)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(Y!==0)return;let z=$.slice(X).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(_)&&!J.has(_))Z.push(_),J.add(_);return}let U=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!J.has(B))Z.push(B),J.add(B);return}let j=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B);return}let H=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))Z.push(B),J.add(B)}};while(X<Q){if(W())continue;if($[X]==="'"||$[X]==='"'){G($[X]);continue}if($[X]==="`"){K();continue}if($[X]==="{"){Y++,X++;continue}if($[X]==="}"){Y--,X++;continue}if(Y===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))q();X++}return Z}function zz($){let Z=[],J=0,Y=0,X=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G==="\\"){Q++;continue}if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="("||G==="["||G==="{")J++;else if(G===")"||G==="]"||G==="}")J--;else if(G===","&&J===0)Z.push($.slice(Y,Q)),Y=Q+1}if(Y<$.length)Z.push($.slice(Y));return Z}function Uz($){let Z=0,J=null;for(let Y=0;Y<$.length;Y++){let X=$[Y];if(J){if(X==="\\"){Y++;continue}if(X===J)J=null;continue}if(X==='"'||X==="'"||X==="`"){J=X;continue}if(X==="("||X==="["||X==="{")Z++;else if(X===")"||X==="]"||X==="}")Z--;else if(X==="="&&Z===0){let Q=$[Y-1],G=$[Y+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return Y}}return-1}function jz($,Z){try{let J=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!J)return;let Y=J.index-1;while(Y>=0&&/\s/.test($[Y]))Y--;if($[Y]!=="}")return;let X=Y,Q=0,G=-1;for(;Y>=0;Y--){let W=$[Y];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=Y;break}}}if(G===-1)return;let K=$.slice(G+1,X);for(let W of zz(K)){let q=W.trim();if(!q||q.startsWith("..."))continue;let z=Uz(q);if(z===-1)continue;let U=q.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=q.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 T4($,Z,J,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=J.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let q=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof X.root==="string"?g.resolve(X.root):void 0,U=z??g.dirname(Y),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=J.__originalFilePath;if(B)H(g.join(g.dirname(B),"components"));H(Z),H(X._rootComponentsDir),H(g.join(g.dirname(Y),"components")),H(X.componentsDir);let _=X._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(z)H(g.resolve(z,"resources/views/components")),H(g.resolve(z,"resources/components")),H(g.resolve(z,"src/components")),H(g.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(g.resolve(g.dirname(Y),`${Q}.stx`));for(let O of j){let V=g.isAbsolute(O)?O:g.resolve(U,O);for(let F of q)if(await c(g.join(V,F)))return!0}return!1}function Bz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Hz($){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 _z($){let Z=new Set,J=/\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 Y of $){let X;while((X=J.exec(Y))!==null)Z.add(X[1]);J.lastIndex=0}return[...Z]}async function e1($,Z,J,Y,X,Q,G,K=new Set,W){let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (j$(),J4))),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"&&Bz(j)?j:"";try{let B=(k)=>k.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(k)=>k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,F=X.__importedComponents;if(F){let k=[O,O.toLowerCase(),B(O),_(O)];for(let v of k)if(F.has(v)){V=F.get(v);break}}let L=[];if(!V){let k=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(k)],m=X.__originalFilePath,h=[];if(m){let H0=g.join(g.dirname(m),"components");h.push(H0)}if(Y)h.push(Y);let r=G._rootComponentsDir;if(typeof r==="string"&&!h.includes(r))h.push(r);let G0=g.join(g.dirname(Q),"components");if(!h.includes(G0))h.push(G0);if(G.componentsDir&&G.componentsDir!==Y&&!h.includes(G.componentsDir))h.push(G.componentsDir);let r0=G._pluginComponentDirs;if(Array.isArray(r0)){for(let H0 of r0)if(typeof H0==="string"&&!h.includes(H0))h.push(H0)}let f0=typeof G.root==="string"?g.resolve(G.root):void 0,m0=f0??g.dirname(Q),a0=[];if(f0)a0.push(g.resolve(f0,"resources/views/components")),a0.push(g.resolve(f0,"resources/components")),a0.push(g.resolve(f0,"src/components")),a0.push(g.resolve(f0,"components"));a0.push(g.resolve(import.meta.dir,"components"));for(let H0 of a0)if(!h.includes(H0))h.push(H0);let B5=[...new Set(h.map((H0)=>{if(!H0)return H0;return g.isAbsolute(H0)?H0:g.resolve(m0,H0)}))];h.length=0,h.push(...B5);let M1=`${O}\x00${Q}\x00${B5.join("\x00")}`,T1=M4.get(M1);if(T1)if(await c(T1))V=T1;else M4.delete(M1);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=g.resolve(g.dirname(Q),`${O}.stx`),L.push(V);else if(!V)for(let H0 of h){if(!H0)continue;for(let Q1 of v){let i=g.join(H0,Q1);if(L.push(i),await c(i)){V=i;break}}if(V)break;if(!V)try{let Q1=await import("fs");if(!Q1.statSync(H0,{throwIfNoEntry:!1})?.isDirectory())continue;let G1=8,d1=[{path:H0,depth:0}];while(d1.length>0&&!V){let H1=d1.pop();if(H1.depth>=G1)continue;let h$;try{h$=Q1.readdirSync(H1.path,{withFileTypes:!0})}catch{continue}for(let u$ of h$){if(!u$.isDirectory())continue;if(u$.name==="node_modules"||u$.name.startsWith("."))continue;let Z8=g.join(H1.path,u$.name);for(let HK of v){let g7=g.join(Z8,HK);if(L.push(g7),await c(g7)){V=g7;break}}if(V)break;d1.push({path:Z8,depth:H1.depth+1})}}}catch{}if(V)break}if(V)M4.set(M1,V)}if(!V||!await c(V)){let k=L.length>0?`
|
|
8712
8712
|
Searched paths:
|
|
8713
8713
|
${L.map((v)=>` - ${v}`).join(`
|
|
8714
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${k}`}W.add(V);let w;if(A4.has(V))w=A4.get(V);else try{w=await Bun.file(V).text(),A4.set(V,w)}catch(k){return`[Error loading component: ${k instanceof Error?k.message:String(k)}]`}let N=new Set(["__originalFilePath","__importedComponents",n$]),R={};for(let[k,v]of Object.entries(X))if(!k.startsWith("__")||N.has(k))R[k]=v;let{extractSlotContent:A}=await
|
|
8715
|
-
`)}`}if(J&&
|
|
8716
|
-
${O5("const",[...D8,...
|
|
8714
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${k}`}W.add(V);let w;if(A4.has(V))w=A4.get(V);else try{w=await Bun.file(V).text(),A4.set(V,w)}catch(k){return`[Error loading component: ${k instanceof Error?k.message:String(k)}]`}let N=new Set(["__originalFilePath","__importedComponents",n$]),R={};for(let[k,v]of Object.entries(X))if(!k.startsWith("__")||N.has(k))R[k]=v;let{extractSlotContent:A}=await e("stx/slots",()=>Promise.resolve().then(() => (L3(),V3))),M=A(J),T={};if(M.defaultSlot?.trim())T.default=M.defaultSlot;for(let[k,v]of M.namedSlots)T[k]=v.content;let I={...R,...Z,props:Z,slot:J,$slots:T,__processedComponents:U,__sections:{},__stx_signals_gate:L1(w)||Hz(J)};jz(w,I);let E=w,D=e$(E);if(D)E=D.content.trim();let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(y)],P=[],C=S.some((k)=>/\bserver\b/.test(k[1]||"")&&/\bcache\b/.test(k[1]||""))&&S.every((k)=>/\bserver\b/.test(k[1]||"")),x=null,f=null;if(C){let k=Kz({props:Z,slot:J,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(k!==null){x=`${V}\x00${k}`;let v=f3.get(x);if(v){for(let m of v.dependencies)W.add(m);return v.output}f=new Set(W)}}for(let k of S){let v=k[1]||"",m=k[2]||"",h=v.includes("server");if(c1(v)&&m.trim())m=i1(m);if(h&&m)try{await q(m,I,V)}catch(G0){}if(!h){let G0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),r0=G0.includes("{{")&&G0.includes("}}"),f0=G0.includes("{!!")&&G0.includes("!!}");if(r0||f0)G0=a$(G0,I);let m0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");P.push(`<script${m0}>${G0}</script>`)}}let d=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),$0=d?d[1]:"",P0=d?d[2]:"",B0="",N0=$0&&/\bscoped\b/i.test($0);if(d)B0=`<style${$0}>${P0}</style>`;let u=E;if(u=u.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),d)u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let k=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(u=u.replace(k,(m,h)=>{let r=h.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(r)v.push(`<style${r[1]}>${r[2]}</style>`);return""}),u=u.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)B0=`${B0}${v.join(`
|
|
8715
|
+
`)}`}if(J&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>J);let{applySlots:a}=await e("stx/slots",()=>Promise.resolve().then(() => (L3(),V3))),{defaultSlot:R0,namedSlots:C0}=M;u=await a(u,R0,C0,I);let U5=P.some((k)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(k)),j5=_z(P);if(j5.length>0)I.__stx_client_signal_names=j5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:g.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:U5||P.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(X.__stxProcessingDepth||0)+1;let s=await F0(u,I,V,n,W),z0=new Set(Array.isArray(X.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);for(let k of s.matchAll(/\{\{([\s\S]*?)\}\}/g))z0.add(k[1].trim());if(z0.size>0)X.__stx_preserved_client_expressions=[...z0];let D0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++Gz}_${Math.random().toString(36).slice(2,8)}`,K0=s;if(U5){let k="";if(Object.keys(Z).length>0)try{k=` data-stx-props="${D2(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${D2(H)}"`:"";K0=`<div data-stx-scope="${D0}"${k}${v}>${s}</div>`;let m=await Promise.all(P.map(async(h)=>{let r=h.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!r)return h;let[,G0,r0]=r,f0=p$(r0,{filePath:V,projectRoot:process.cwd()}),m0=f0.code,a0=l$(f0.styles);m0=V5(m0).code;let{hasUserImports:B5,bundleClientScript:M1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => ($$(),e5)));if(B5(m0))m0=await M1(m0,V,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:T1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (O$(),R4)));m0=m0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(H1,h$)=>T1(h$));let H0=d0(m0),Q1=qz(H0),i=`function(__scopeId) {
|
|
8716
|
+
${O5("const",[...D8,...Q1],H0)}
|
|
8717
8717
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
8718
8718
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
8719
8719
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
@@ -8731,7 +8731,7 @@ ${H0}
|
|
|
8731
8731
|
// Register all defined signals and functions in this scope
|
|
8732
8732
|
const __localVars = {};
|
|
8733
8733
|
try {
|
|
8734
|
-
${
|
|
8734
|
+
${Q1.map((H1)=>`if (typeof ${H1} !== 'undefined') __localVars['${H1}'] = ${H1};`).join(`
|
|
8735
8735
|
`)}
|
|
8736
8736
|
}
|
|
8737
8737
|
catch (e) {}
|
|
@@ -8740,15 +8740,15 @@ catch (e) {}
|
|
|
8740
8740
|
finally {
|
|
8741
8741
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
8742
8742
|
}
|
|
8743
|
-
}`,
|
|
8743
|
+
}`,G1=H?null:QZ(X,i),d1=G1?`window.__stxComponentFactories[${JSON.stringify(G1)}](${JSON.stringify(D0)});`:`(${i})(${JSON.stringify(D0)});`;if(H)return`${a0}<script type="stx/island" data-stx-island="${D0}" data-stx-scoped${G0}>${d1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always"${G0}>${d1}</script>`}));if(K0=K0+`
|
|
8744
8744
|
`+m.join(`
|
|
8745
|
-
`),
|
|
8746
|
-
`+
|
|
8747
|
-
`+
|
|
8745
|
+
`),B0)K0+=`
|
|
8746
|
+
`+B0}else{if(B0)K0+=`
|
|
8747
|
+
`+B0;if(P.length>0){let k=I.__stx_event_bindings||[],v=Y$(I),m=await Promise.all(P.map(async(h)=>{let r=h.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!r)return h;return await X$(r[1],{eventBindings:k,templateContent:K0,filePath:V,projectRoot:process.cwd(),serverData:v})}));K0+=`
|
|
8748
8748
|
`+m.join(`
|
|
8749
|
-
`),I.__stx_event_bindings=[]}}if(N0){let k=t$(
|
|
8749
|
+
`),I.__stx_event_bindings=[]}}if(N0){let k=t$(K0,V);if(k.hasScoped)K0=k.html}if(x&&f)f3.set(x,{output:K0,dependencies:[...W].filter((k)=>!f.has(k))});return K0}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 J=g.resolve(Z),Y=g.resolve($),X=J.endsWith(g.sep)?J:J+g.sep;if(Y===J||Y.startsWith(X))return Y;return null}async function h3($,Z,J,Y){let X=await Oz($,Z,J,Y);if(X===null)return null;let Q=g3(X,process.cwd());if(Q)return Q;let G=[J.root,J.layoutsDir,J.componentsDir,J.partialsDir,J.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=g.isAbsolute(K)?K:g.resolve(process.cwd(),K);if(g3(X,W))return g.resolve(X)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${X} (template: ${$}, from: ${Z})`),null}async function Oz($,Z,J,Y){if(J.debug)console.log(`Resolving template path: ${$} from ${Z}`);let X=g.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=g.join(Q,$),H=g3(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(J.debug)console.log(`Checking absolute path: ${H}`);if(await c(H)&&Y)Y.add(H);return H}let G=g.join(X,$);if(await c(G)){if(J.debug)console.log(`Found direct path: ${G}`);if(Y)Y.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(J.debug)console.log(`Found direct path with extension: ${H}`);if(Y)Y.add(H);return H}}let K="",W=g.resolve(X),q=process.cwd();for(let j=0;j<10;j++){let H=g.join(W,"layouts"),B=!1;try{B=Qz.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=g.dirname(W);if(_===W||_.length<q.length)break;W=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=g.join(K,j);if(await c(H)){if(J.debug)console.log(`Found in current layouts dir: ${H}`);if(Y)Y.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(J.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.layoutsDir){let j=g.isAbsolute(J.layoutsDir)?J.layoutsDir:g.resolve(process.cwd(),J.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=g.join(j,H);if(await c(B)){if(J.debug)console.log(`Found in options.layoutsDir: ${B}`);if(Y)Y.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(J.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(Y)Y.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=g.join(J.partialsDir||X,"layouts",j[1]);if(await c(H)){if(J.debug)console.log(`Found in layouts path: ${H}`);if(Y)Y.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(J.debug)console.log(`Found in layouts path with extension: ${B}`);if(Y)Y.add(B);return B}}}if(J.partialsDir){if(K=g.join(J.partialsDir,"layouts"),await c(K)){let j=g.join(K,$);if(await c(j)){if(J.debug)console.log(`Found in partials layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(J.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(Y)Y.add(H);return H}}}}let z=J.partialsDir||g.join(process.cwd(),"views"),U=g.join(z,$);if(await c(U)){if(J.debug)console.log(`Found in views path: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(J.debug)console.log(`Found in views path with extension: ${j}`);if(Y)Y.add(j);return j}}if(X.includes("temp")){let j=g.join(g.dirname(X),"layouts",$);if(await c(j)){if(J.debug)console.log(`Found in temp layouts dir: ${j}`);if(Y)Y.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(J.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(Y)Y.add(H);return H}}}if(J.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 k2($,Z,J){let Y=0,X="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
|
|
8750
8750
|
`),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){Y=W+1,X=G[W].trim();let q=Math.max(0,W-2),z=Math.min(G.length,W+3);Q=G.slice(q,z).map((U,j)=>{let H=q+j+1;return`${H===Y?"> ":" "}${H}: ${U}`}).join(`
|
|
8751
|
-
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return k2($,G)}}catch{}return{lineNumber:Y,lineContent:X,context:Q}}function
|
|
8751
|
+
`);break}}else if(J){let G=$.indexOf(J);if(G>=0)return k2($,G)}}catch{}return{lineNumber:Y,lineContent:X,context:Q}}function j0($,Z,J,Y,X,Q){let{lineNumber:G,context:K}=k2(Y,X,Q),W=J.split("/").pop(),q=0;if(typeof X==="number"&&X>=0&&Y){let U=Y.lastIndexOf(`
|
|
8752
8752
|
`,Math.max(0,X-1));q=X-(U+1)+1}let z="";if(G>0)z+=`
|
|
8753
8753
|
${J}:${G}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${Z}
|
|
8754
8754
|
`;if(z+=`
|
|
@@ -8761,8 +8761,8 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${Z}
|
|
|
8761
8761
|
`,K)z+=`
|
|
8762
8762
|
${Z0.blue}${Z0.bold}Context:${Z0.reset}
|
|
8763
8763
|
${Z0.dim}${K}${Z0.reset}
|
|
8764
|
-
`;return z}function B2(){A4.clear(),M4.clear(),f3.clear()}var A4,M4,f3,Gz=0,Z0;var I0=b(()=>{Q$();Q3();
|
|
8765
|
-
`||F==="\r"||F===" "||F===void 0)U++;j=O+9}else{if(U--,U===0){H=V;break}j=V+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:z}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=a5(q.trim(),j);Y=Y.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=
|
|
8764
|
+
`;return z}function B2(){A4.clear(),M4.clear(),f3.clear()}var A4,M4,f3,Gz=0,Z0;var I0=b(()=>{Q$();Q3();q1();K1();R5();I4();D1();U3();j3();t5();yZ();j$();A4=new o1(500),M4=new o1(1000),f3=new o1(2000);Z0={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 E2($,Z,J=""){let Y=$,X=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),q=W?W[1]:"",z=K+G[0].length,U=1,j=z,H=-1;while(U>0&&j<$.length){let O=$.indexOf("@markdown",j),V=$.indexOf("@endmarkdown",j);if(V===-1)break;if(O!==-1&&O<V&&O!==K){let F=$[O+9];if(F==="("||F===`
|
|
8765
|
+
`||F==="\r"||F===" "||F===void 0)U++;j=O+9}else{if(U--,U===0){H=V;break}j=V+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);X.push({fullMatch:_,options:q,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:W,content:q,index:z}of X)try{let U={};if(W)W.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=a5(q.trim(),j);Y=Y.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=j0("Markdown Directive",`Error processing markdown: ${j}`,J,$,z,K);Y=Y.split(K).join(H)}return Y}async function b2($,Z,J,Y){let X={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")X.breaks=!0;if(G==="no-gfm")X.gfm=!1}),a5($.trim(),X)}var u3=b(()=>{I0()});function Lz($){if(Fz.set($.name,$),$.client)Vz.set($.name,$.client)}function D4($){return Lz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(J,Y,X,Q)=>{let G=wz(Y,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let q=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(q)}}let K=J;if($.transform)K=await $.transform(J,G,X,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function wz($,Z){let J={...Z};for(let Y of $){let X=Y.indexOf(":"),Q=Y.indexOf("="),G=X>=0&&(Q<0||X<Q)?X:Q;if(G>=0){let K=Y.slice(0,G).trim(),W=Y.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}J[K]=W}else{let K=Object.keys(J).filter((W)=>!Z||!(W in Z)).length;J[K===0?"value":`arg${K}`]=Y}}return J}var Fz,Vz;var m3=b(()=>{Fz=new Map,Vz=new Map});function d3($,Z=I5,J={},Y){return Z.sort((X,Q)=>X-Q).map((X)=>{return`${V$($,{...J,w:X,fm:Y})} ${X}w`}).join(", ")}function S2($,Z,J=Nz,Y={},X){return J.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${V$($,{...Y,w:G,dpr:Q,fm:X})} ${Q}x`}).join(", ")}function p3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let Y=Object.entries($).map(([X,Q])=>{let G=/^\d+$/.test(X)?`${X}px`:X;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((X,Q)=>X.numericBp-Q.numericBp).map(({bp:X,size:Q})=>`(max-width: ${X}) ${Q}`);return Y.push(Z),Y.join(", ")}function V$($,Z={}){let J=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(J.length===0)return $;let Y=J.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),X=$.includes("?")?"&":"?";return`${$}${X}${Y}`}function l3($){return Rz[$]||"application/octet-stream"}var I5,Nz,F$,Rz;var c3=b(()=>{I5=[320,480,640,768,1024,1280,1536,1920,2560],Nz=[1,1.5,2,3],F$=["avif","webp","jpeg"],Rz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Mz(){try{return await import("ts-images")}catch{return null}}async function Tz($,Z={}){let J={...Az,...Z},Y=await Mz();if(Y)try{return await Iz($,J,Y)}catch(X){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${X}`)}return Dz($,J)}async function Iz($,Z,J){let{generatePlaceholder:Y,generateThumbHash:X}=J,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 X($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await Y($,{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 Dz($,Z){let J=Z.width||20,Y=Z.height||J,X="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${J}" height="${Y}" viewBox="0 0 ${J} ${Y}"><rect fill="#e5e7eb" width="${J}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:J,height:Y,aspectRatio:J/Y,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function y2($,Z,J={}){let Y=J.transitionDuration||300,X=J.easing||"ease-out";return`
|
|
8766
8766
|
#${$} {
|
|
8767
8767
|
--stx-img-transition-duration: ${Y}ms;
|
|
8768
8768
|
--stx-img-transition-easing: ${X};
|
|
@@ -8808,8 +8808,8 @@ ${Z0.dim}${K}${Z0.reset}
|
|
|
8808
8808
|
filter: blur(0);
|
|
8809
8809
|
transform: scale(1);
|
|
8810
8810
|
}
|
|
8811
|
-
`.trim();i3=new Map});import{createHash as x2}from"crypto";import{readFile as kz,stat as f2}from"fs/promises";async function v0($){try{let Z=await kz($);return x2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function v2($){return x2("sha256").update($).digest("hex").slice(0,16)}function k4($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${v2($)}-${v2(J)}`}async function o3($){try{return(await f2($)).mtimeMs}catch{return 0}}async function E0($){try{return await f2($),!0}catch{return!1}}var $5=()=>{};import{mkdir as Ez,readFile as bz,writeFile as Sz,readdir as _w,rm as yz,stat as Ow}from"fs/promises";import{join as h2,dirname as Pz}from"path";async function Cz($){try{await Ez($,{recursive:!0})}catch{}}function u2($,Z,J){return h2($,J,`${Z}.json`)}async function g2($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await o3(Z)!==$.srcMtime)return!1;return!0}async function E4($,Z,J,Y=s3){if(!Y.enabled)return null;let X=k4($,Z),Q=D5.get(X);if(Q){if(await g2(Q,$,Y.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;D5.delete(X)}let G=u2(Y.directory,X,J);if(await E0(G))try{let K=await bz(G,"utf-8"),W=JSON.parse(K);if(await g2(W,$,Y.maxAge))return W.lastAccessedAt=Date.now(),D5.set(X,W),W.data}catch{}return null}async function b4($,Z,J,Y,X=s3){if(!X.enabled)return;let Q=k4($,Z),G=await v0($),K=await o3($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:k4("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};D5.set(Q,W);let q=u2(X.directory,Q,Y);try{await Cz(Pz(q)),await Sz(q,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function S4($,Z=s3){if($==="all")D5.clear();else D5.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let X=h2(Z.directory,Y);try{await yz(X,{recursive:!0,force:!0})}catch{}}}var D5,s3;var r3=b(()=>{$5();D5=new Map,s3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class P4{config;constructor($={}){this.config={...vz,...$}}async get($,Z){return E4($,Z,"image",this.config)}async set($,Z,J){return b4($,Z,J,"image",this.config)}async clear(){return S4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function a3($){if(!y4)y4=new P4($);else if($)y4.updateConfig($);return y4}async function C4($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return a3(Y).get($,Z)}async function v4($,Z,J,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return a3(X).set($,Z,J)}async function m2(){return a3().clear()}var vz,y4=null;var t3=b(()=>{r3();vz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as xz,basename as fz,extname as gz,join as hz}from"path";import{mkdir as uz}from"fs/promises";async function e3(){try{return await import("ts-images")}catch{return null}}function d2($){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 mz($,Z){let J=Z?d2(Z):d2("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function p2($,Z,J){let Y=await e3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await C4($,Z,J);if(X)return X;try{let Q=xz($);if(!await E0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=mz(J,Z.preset),K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await uz(K,{recursive:!0});let q=await v0(Q),z=fz($,gz($)),U=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await $6(Q,Z.transformations,Y);for(let B of U){let _=G[B]||{},O=`${z}-${q}.${B}`,V=hz(K,O);try{let F=await Y.optimizeImage({input:H||Q,output:V,format:B,quality:_.quality,progressive:_.progressive});if(F){if(j.variants.push({path:V,url:`${W}/${O}`,width:F.width||0,height:F.height||0,format:B,size:F.outputSize||0}),!j.originalWidth&&F.width)j.originalWidth=F.width,j.originalHeight=F.height}}catch(F){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${F}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.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 Y.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 v4($,Z,j,J),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function l2($,Z,J,Y){let X=await e3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function $6($,Z,J){let Y=J||await e3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await Y.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await Y.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await Y.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await Y.sharpen(X,G.amount);break;case"grayscale":X=await Y.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await Y.rotate(X,G.angle);break;case"flip":X=await Y.flip(X);break;case"flop":X=await Y.flop(X);break;case"brightness":if(G.value!==void 0)X=await Y.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await Y.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await Y.saturation(X,G.value);break}}return await Y.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var c2=b(()=>{$5();t3()});import{resolve as dz,basename as pz,extname as lz,join as cz}from"path";import{mkdir as iz}from"fs/promises";async function nz(){try{return await import("ts-images")}catch{return null}}async function i2($,Z,J){let Y=await nz();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=dz($);if(!await E0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||J.breakpoints||oz,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await iz(K,{recursive:!0});let q=await v0(X),z=pz($,lz($)),U=J.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 V=`${z}-${O}w-${q}.${B}`,F=cz(K,V),L=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await E0(F)){j.byFormat[B].push({path:F,url:L,width:O,height:0,format:B,size:0}),_.push(`${L} ${O}w`);continue}let N=await Y.processImage({input:X,output:F,format:B,quality:w,resize:{width:O}});if(N)j.byFormat[B].push({path:F,url:L,width:O,height:N.height||Math.round(O*(N.height||1)/(N.width||1)),format:B,size:N.outputSize||0}),_.push(`${L} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||J.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await Y.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(X,{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||sz(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function sz($){let Z=[...$].sort((Y,X)=>Y-X),J=[];for(let Y=0;Y<Z.length-1;Y++){let X=Z[Y];J.push(`(max-width: ${X}px) ${X}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function n2($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var oz;var o2=b(()=>{$5();oz=[320,480,640,768,1024,1280,1536,1920]});var s2={};a(s2,{setCachedImageResult:()=>v4,processImage:()=>p2,optimizeImage:()=>l2,getCachedImageResult:()=>C4,generateSrcset:()=>n2,generateResponsiveVariants:()=>i2,clearImageCache:()=>m2,applyTransformations:()=>$6,ImageProcessorCache:()=>P4});var r2=b(()=>{c2();o2();t3()});async function rz(){try{return await Promise.resolve().then(() => (r2(),s2))}catch($){if(!a2)console.warn("[stx-media] Image processor not available, some features disabled:",$),a2=!0;return null}}async function x4($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return $U(Y,J)}if(J.processedResult?.processed)return X6($,J.processedResult,Z);if(J.responsiveVariants)return ZJ($,J.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=I5,dpr:z,formats:U=F$,quality:j=Z6,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:V=!1,loading:F=V?"eager":g4,decoding:L=f4,fetchpriority:w,objectFit:N,objectPosition:R,crossorigin:A,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return ez($);let P,C,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{P=await P2(X,{strategy:B,..._}),C=y2(x,P,_)}catch{}let f=z!==void 0&&G!==void 0,d;if(f)d=tz($,x,P,Z);else d=await az($,x,P,Z);let $0;if(V){let N0=U.includes("webp")?"webp":U[0],h=d3(X,q,{...H,q:j},N0),r=typeof W==="object"?p3(W):W||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${h}" imagesizes="${r}" />`}let P0=[];if(!t2&&B!=="none")P0.push(n3),t2=!0;if(C)P0.push(C);let j0=O?$J(x):void 0;return{html:d,preloadLink:$0,css:P0.length>0?P0.join(`
|
|
8812
|
-
`):void 0,script:
|
|
8811
|
+
`.trim();i3=new Map});import{createHash as x2}from"crypto";import{readFile as kz,stat as f2}from"fs/promises";async function v0($){try{let Z=await kz($);return x2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function v2($){return x2("sha256").update($).digest("hex").slice(0,16)}function k4($,Z){let J=JSON.stringify(Z,Object.keys(Z).sort());return`${v2($)}-${v2(J)}`}async function o3($){try{return(await f2($)).mtimeMs}catch{return 0}}async function E0($){try{return await f2($),!0}catch{return!1}}var $5=()=>{};import{mkdir as Ez,readFile as bz,writeFile as Sz,readdir as _w,rm as yz,stat as Ow}from"fs/promises";import{join as h2,dirname as Pz}from"path";async function Cz($){try{await Ez($,{recursive:!0})}catch{}}function u2($,Z,J){return h2($,J,`${Z}.json`)}async function g2($,Z,J){if((Date.now()-$.createdAt)/86400000>J)return!1;if(await o3(Z)!==$.srcMtime)return!1;return!0}async function E4($,Z,J,Y=s3){if(!Y.enabled)return null;let X=k4($,Z),Q=D5.get(X);if(Q){if(await g2(Q,$,Y.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;D5.delete(X)}let G=u2(Y.directory,X,J);if(await E0(G))try{let K=await bz(G,"utf-8"),W=JSON.parse(K);if(await g2(W,$,Y.maxAge))return W.lastAccessedAt=Date.now(),D5.set(X,W),W.data}catch{}return null}async function b4($,Z,J,Y,X=s3){if(!X.enabled)return;let Q=k4($,Z),G=await v0($),K=await o3($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:k4("",Z),data:J,createdAt:Date.now(),lastAccessedAt:Date.now()};D5.set(Q,W);let q=u2(X.directory,Q,Y);try{await Cz(Pz(q)),await Sz(q,JSON.stringify(W,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function S4($,Z=s3){if($==="all")D5.clear();else D5.clear();let J=$==="all"?["image","video"]:[$];for(let Y of J){let X=h2(Z.directory,Y);try{await yz(X,{recursive:!0,force:!0})}catch{}}}var D5,s3;var r3=b(()=>{$5();D5=new Map,s3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class P4{config;constructor($={}){this.config={...vz,...$}}async get($,Z){return E4($,Z,"image",this.config)}async set($,Z,J){return b4($,Z,J,"image",this.config)}async clear(){return S4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function a3($){if(!y4)y4=new P4($);else if($)y4.updateConfig($);return y4}async function C4($,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return a3(Y).get($,Z)}async function v4($,Z,J,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return a3(X).set($,Z,J)}async function m2(){return a3().clear()}var vz,y4=null;var t3=b(()=>{r3();vz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as xz,basename as fz,extname as gz,join as hz}from"path";import{mkdir as uz}from"fs/promises";async function e3(){try{return await import("ts-images")}catch{return null}}function d2($){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 mz($,Z){let J=Z?d2(Z):d2("web"),Y=$.formatQuality||{};return{jpeg:{...J.jpeg,...Y.jpeg},png:{...J.png,...Y.png},webp:{...J.webp,...Y.webp},avif:{...J.avif,...Y.avif}}}async function p2($,Z,J){let Y=await e3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let X=await C4($,Z,J);if(X)return X;try{let Q=xz($);if(!await E0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=mz(J,Z.preset),K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await uz(K,{recursive:!0});let q=await v0(Q),z=fz($,gz($)),U=Z.outputFormat?[Z.outputFormat]:J.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:q},H=null;if(Z.transformations&&Z.transformations.length>0)H=await $6(Q,Z.transformations,Y);for(let B of U){let _=G[B]||{},O=`${z}-${q}.${B}`,V=hz(K,O);try{let F=await Y.optimizeImage({input:H||Q,output:V,format:B,quality:_.quality,progressive:_.progressive});if(F){if(j.variants.push({path:V,url:`${W}/${O}`,width:F.width||0,height:F.height||0,format:B,size:F.outputSize||0}),!j.originalWidth&&F.width)j.originalWidth=F.width,j.originalHeight=F.height}}catch(F){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${F}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await Y.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 Y.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 v4($,Z,j,J),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function l2($,Z,J,Y){let X=await e3();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:$,output:Y,format:Z,quality:J}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function $6($,Z,J){let Y=J||await e3();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await Y.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)X=await Y.resize(X,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)X=await Y.blur(X,G.sigma);break;case"sharpen":if(G.amount!==void 0)X=await Y.sharpen(X,G.amount);break;case"grayscale":X=await Y.grayscale(X);break;case"rotate":if(G.angle!==void 0)X=await Y.rotate(X,G.angle);break;case"flip":X=await Y.flip(X);break;case"flop":X=await Y.flop(X);break;case"brightness":if(G.value!==void 0)X=await Y.brightness(X,G.value);break;case"contrast":if(G.value!==void 0)X=await Y.contrast(X,G.value);break;case"saturation":if(G.value!==void 0)X=await Y.saturation(X,G.value);break}}return await Y.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}var c2=b(()=>{$5();t3()});import{resolve as dz,basename as pz,extname as lz,join as cz}from"path";import{mkdir as iz}from"fs/promises";async function nz(){try{return await import("ts-images")}catch{return null}}async function i2($,Z,J){let Y=await nz();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=dz($);if(!await E0(X))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||J.breakpoints||oz,G=Z.formats||J.defaultFormats||["avif","webp","jpeg"],K=J.outputDir||"dist/images",W=J.baseUrl||"/images";await iz(K,{recursive:!0});let q=await v0(X),z=pz($,lz($)),U=J.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 V=`${z}-${O}w-${q}.${B}`,F=cz(K,V),L=`${W}/${V}`;try{let w=U[B]?.quality||80;if(await E0(F)){j.byFormat[B].push({path:F,url:L,width:O,height:0,format:B,size:0}),_.push(`${L} ${O}w`);continue}let N=await Y.processImage({input:X,output:F,format:B,quality:w,resize:{width:O}});if(N)j.byFormat[B].push({path:F,url:L,width:O,height:N.height||Math.round(O*(N.height||1)/(N.width||1)),format:B,size:N.outputSize||0}),_.push(`${L} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||J.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await Y.generateThumbHash(X);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await Y.generatePlaceholder(X,{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||sz(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function sz($){let Z=[...$].sort((Y,X)=>Y-X),J=[];for(let Y=0;Y<Z.length-1;Y++){let X=Z[Y];J.push(`(max-width: ${X}px) ${X}px`)}return J.push(`${Z[Z.length-1]}px`),J.join(", ")}function n2($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((J)=>J.dpr).map((J)=>`${J.url} ${J.dpr}x`).join(", ");return $.map((J)=>`${J.url} ${J.width}w`).join(", ")}var oz;var o2=b(()=>{$5();oz=[320,480,640,768,1024,1280,1536,1920]});var s2={};t(s2,{setCachedImageResult:()=>v4,processImage:()=>p2,optimizeImage:()=>l2,getCachedImageResult:()=>C4,generateSrcset:()=>n2,generateResponsiveVariants:()=>i2,clearImageCache:()=>m2,applyTransformations:()=>$6,ImageProcessorCache:()=>P4});var r2=b(()=>{c2();o2();t3()});async function rz(){try{return await Promise.resolve().then(() => (r2(),s2))}catch($){if(!a2)console.warn("[stx-media] Image processor not available, some features disabled:",$),a2=!0;return null}}async function x4($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipOptimization){if(J.tsImagesConfig?.enabled&&!J.isDev)return $U(Y,J)}if(J.processedResult?.processed)return X6($,J.processedResult,Z);if(J.responsiveVariants)return ZJ($,J.responsiveVariants,Z);let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=I5,dpr:z,formats:U=F$,quality:j=Z6,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:V=!1,loading:F=V?"eager":g4,decoding:L=f4,fetchpriority:w,objectFit:N,objectPosition:R,crossorigin:A,referrerpolicy:M}=$,T=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:y=!1,baseUrl:S=""}=Z;if(y&&!Z.optimize)return ez($);let P,C,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{P=await P2(X,{strategy:B,..._}),C=y2(x,P,_)}catch{}let f=z!==void 0&&G!==void 0,d;if(f)d=tz($,x,P,Z);else d=await az($,x,P,Z);let $0;if(V){let N0=U.includes("webp")?"webp":U[0],u=d3(X,q,{...H,q:j},N0),a=typeof W==="object"?p3(W):W||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${u}" imagesizes="${a}" />`}let P0=[];if(!t2&&B!=="none")P0.push(n3),t2=!0;if(C)P0.push(C);let B0=O?$J(x):void 0;return{html:d,preloadLink:$0,css:P0.length>0?P0.join(`
|
|
8812
|
+
`):void 0,script:B0}}async function az($,Z,J,Y){let{src:X,alt:Q,width:G,height:K,sizes:W,widths:q=I5,formats:z=F$,quality:U=Z6,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":g4,decoding:O=f4,fetchpriority:V,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N}=$,R=$.class,A=$.style,M=$.data||{},T=typeof W==="object"?p3(W):W||"100vw",I=[];for(let y of z){let S=d3(X,q,{...j,q:U},y),P=l3(y);if(H&&!B)I.push(` <source type="${P}" data-srcset="${S}" data-sizes="${T}" />`);else I.push(` <source type="${P}" srcset="${S}" sizes="${T}" />`)}let E=J6({src:V$(X,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":V,objectFit:F,objectPosition:L,crossorigin:w,referrerpolicy:N,className:e2(R,J),style:Y6(A,F,L,J),lazy:H&&!B,data:M}),D;if(J){let y=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
|
|
8813
8813
|
<picture>
|
|
8814
8814
|
${I.join(`
|
|
8815
8815
|
`)}
|
|
@@ -8821,7 +8821,7 @@ ${I.join(`
|
|
|
8821
8821
|
<img ${E} />
|
|
8822
8822
|
</picture>`;return D}function tz($,Z,J,Y){let{src:X,alt:Q,width:G,height:K,dpr:W=[1,2,3],quality:q=Z6,params:z={},lazy:U=!0,priority:j=!1,loading:H=j?"eager":g4,decoding:B=f4,fetchpriority:_,objectFit:O,objectPosition:V,crossorigin:F,referrerpolicy:L}=$,w=$.class,N=$.style,R=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),M=S2(X,A,W,{...z,q}),T=J6({src:V$(X,{...z,w:A,q}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:V,crossorigin:F,referrerpolicy:L,className:e2(w,J),style:Y6(N,O,V,J),lazy:U&&!j,data:R}),I=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(J){let E=`background-image: url('${J.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
|
|
8823
8823
|
<img ${T} ${I} />
|
|
8824
|
-
</div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function ez($){let{src:Z,alt:J,width:Y,height:X,loading:Q=g4,decoding:G=f4,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${J6({src:Z,alt:J,width:Y,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,className:H,style:Y6(B,W,q),id:_,data:O})} />`}}function J6($){let Z=[];if($.lazy)Z.push(`data-src="${
|
|
8824
|
+
</div>`}return`<img ${Z?`id="${Z}" `:""}${T} ${I} />`}function ez($){let{src:Z,alt:J,width:Y,height:X,loading:Q=g4,decoding:G=f4,fetchpriority:K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${J6({src:Z,alt:J,width:Y,height:X,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U,className:H,style:Y6(B,W,q),id:_,data:O})} />`}}function J6($){let Z=[];if($.lazy)Z.push(`data-src="${$1($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${$1($.src)}"`);if(Z.push(`alt="${$1($.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="${$1($.className)}"`);if($.style)Z.push(`style="${$1($.style)}"`);if($.id)Z.push(`id="${$1($.id)}"`);if($.data)for(let[J,Y]of Object.entries($.data))Z.push(`data-${J}="${$1(Y)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function e2($,Z){let J=[];if($)J.push($);if(Z)J.push("stx-img-blur");return J.join(" ")||""}function Y6($,Z,J,Y){let X=[];if(Z)X.push(`object-fit: ${Z}`);if(J)X.push(`object-position: ${J}`);if(Y)X.push("opacity: 0; transition: opacity 300ms ease-out");if($)X.push($);return X.join("; ")}function $1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function $J($){return`
|
|
8825
8825
|
(function() {
|
|
8826
8826
|
const container = document.getElementById('${$}');
|
|
8827
8827
|
if (!container) return;
|
|
@@ -8858,7 +8858,7 @@ ${I.join(`
|
|
|
8858
8858
|
|
|
8859
8859
|
observer.observe(container);
|
|
8860
8860
|
})();
|
|
8861
|
-
`.trim()}async function $U($,Z){let J=await rz();if(!J)return x4({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,Y);if(Q)return ZJ($,Q,Z)}else{let Q=await J.processImage($.src,$,Y);if(Q.processed)return X6($,Q,Z)}return x4({...$,process:!1},Z)}async function X6($,Z,J){let{alt:Y,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],V=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],F=V?.url||$.src,L=O.filter((C)=>C.format===(V?.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 N=[],R=["avif","webp","jpeg","png"];for(let C of R){let x=w.get(C);if(x&&x.length>0){let f=x.map(($0)=>`${$0.url} ${$0.width}w`).join(", "),d=l3(C);if(G&&!K)N.push(` <source type="${d}" data-srcset="${f}" />`);else N.push(` <source type="${d}" srcset="${f}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${
|
|
8861
|
+
`.trim()}async function $U($,Z){let J=await rz();if(!J)return x4({...$,process:!1},Z);let Y=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await J.generateResponsiveVariants($.src,$,Y);if(Q)return ZJ($,Q,Z)}else{let Q=await J.processImage($.src,$,Y);if(Q.processed)return X6($,Q,Z)}return x4({...$,process:!1},Z)}async function X6($,Z,J){let{alt:Y,width:X,height:Q,lazy:G=!0,priority:K=!1,objectFit:W,objectPosition:q,crossorigin:z,referrerpolicy:U}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],V=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],F=V?.url||$.src,L=O.filter((C)=>C.format===(V?.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 N=[],R=["avif","webp","jpeg","png"];for(let C of R){let x=w.get(C);if(x&&x.length>0){let f=x.map(($0)=>`${$0.url} ${$0.width}w`).join(", "),d=l3(C);if(G&&!K)N.push(` <source type="${d}" data-srcset="${f}" />`);else N.push(` <source type="${d}" srcset="${f}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${$1(F)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),L)A.push(`data-srcset="${L}"`)}else if(A.push(`src="${$1(F)}"`),L)A.push(`srcset="${L}"`);A.push(`alt="${$1(Y)}"`);let M=X||Z.originalWidth,T=Q||Z.originalHeight;if(M)A.push(`width="${M}"`);if(T)A.push(`height="${T}"`);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 I=[];if(W)I.push(`object-fit: ${W}`);if(q)I.push(`object-position: ${q}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(H)I.push(H);if(I.length>0)A.push(`style="${I.join("; ")}"`);let E=[];if(j)E.push(j);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)A.push(`class="${E.join(" ")}"`);if(G&&!K)A.push("data-stx-lazy");for(let[C,x]of Object.entries(_))A.push(`data-${C}="${$1(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}">
|
|
8862
8862
|
<picture>
|
|
8863
8863
|
${N.join(`
|
|
8864
8864
|
`)}
|
|
@@ -8899,7 +8899,7 @@ ${N.join(`
|
|
|
8899
8899
|
</Representation>
|
|
8900
8900
|
`}K+=` </AdaptationSet>
|
|
8901
8901
|
`}return K+=` </Period>
|
|
8902
|
-
</MPD>`,K}function KJ($){let Z=Math.floor($/3600),J=Math.floor($%3600/60),Y=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(J>0)X+=`${J}M`;return X+=`${Y}S`,X}var BJ;var H6=b(()=>{$5();BJ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as HJ,basename as KU,extname as WU,join as qU}from"path";import{mkdir as zU}from"fs/promises";async function _J(){try{return await import("ts-videos")}catch{return null}}function UU($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function jU($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function _6($){let Z=await _J();if(!Z)return null;try{let J=HJ($),X=await new Z.Input(J).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(J){return console.warn(`[stx-media] Failed to analyze video: ${J}`),null}}async function OJ($,Z,J,Y){let X=await _J();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await m4($,Z,J);if(Q)return Q;try{let G=HJ($);if(!await E0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",W=J.baseUrl||"/videos";await zU(K,{recursive:!0});let q=await v0(G),z=KU($,WU($)),U={src:$,processed:!0,hash:q};Y?.({percentage:5,stage:"analyzing"}),U.metadata=await _6(G)||void 0;let j={};if(Z.quality)j.bitrate=UU(Z.quality);if(Z.platform)Object.assign(j,jU(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let H=`${z}-${q}.mp4`,B=qU(K,H);try{let _=await BU(G,B,j,X,(O)=>Y?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)U.transcoded={path:B,url:`${W}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await l4(G,H,K,W);if(B)U.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let H=await c4(G,J.thumbnails,K,W);if(H.length>0)U.thumbnails=H}if(Z.streaming){Y?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:J.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await n4(G,H.qualities||J.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,hls:B}}if(H.format==="dash"){let B=await o4(G,H.qualities||J.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await d4($,Z,U,J),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function BU($,Z,J,Y,X){try{let G=await new Y.Conversion($,Z,{videoCodec:J.codec,videoBitrate:J.bitrate,width:J.maxWidth,height:J.maxHeight,frameRate:J.frameRate,audioCodec:J.audioCodec,audioBitrate:J.audioBitrate,sampleRate:J.sampleRate,channels:J.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||J.maxWidth||0,height:G.height||J.maxHeight||0,bitrate:G.bitrate||J.bitrate||0,frameRate:G.frameRate||J.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var FJ=b(()=>{$5();K6();B6();H6()});var VJ={};
|
|
8902
|
+
</MPD>`,K}function KJ($){let Z=Math.floor($/3600),J=Math.floor($%3600/60),Y=Math.floor($%60),X="PT";if(Z>0)X+=`${Z}H`;if(J>0)X+=`${J}M`;return X+=`${Y}S`,X}var BJ;var H6=b(()=>{$5();BJ=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as HJ,basename as KU,extname as WU,join as qU}from"path";import{mkdir as zU}from"fs/promises";async function _J(){try{return await import("ts-videos")}catch{return null}}function UU($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function jU($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function _6($){let Z=await _J();if(!Z)return null;try{let J=HJ($),X=await new Z.Input(J).getInfo();return{duration:X.duration||0,width:X.width||0,height:X.height||0,frameRate:X.frameRate||0,bitrate:X.bitrate||0,codec:X.videoCodec||"",audioCodec:X.audioCodec}}catch(J){return console.warn(`[stx-media] Failed to analyze video: ${J}`),null}}async function OJ($,Z,J,Y){let X=await _J();if(!X)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await m4($,Z,J);if(Q)return Q;try{let G=HJ($);if(!await E0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=J.outputDir||"dist/videos",W=J.baseUrl||"/videos";await zU(K,{recursive:!0});let q=await v0(G),z=KU($,WU($)),U={src:$,processed:!0,hash:q};Y?.({percentage:5,stage:"analyzing"}),U.metadata=await _6(G)||void 0;let j={};if(Z.quality)j.bitrate=UU(Z.quality);if(Z.platform)Object.assign(j,jU(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){Y?.({percentage:10,stage:"transcoding"});let H=`${z}-${q}.mp4`,B=qU(K,H);try{let _=await BU(G,B,j,X,(O)=>Y?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)U.transcoded={path:B,url:`${W}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await l4(G,H,K,W);if(B)U.poster=B}if(J.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let H=await c4(G,J.thumbnails,K,W);if(H.length>0)U.thumbnails=H}if(Z.streaming){Y?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:J.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await n4(G,H.qualities||J.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,hls:B}}if(H.format==="dash"){let B=await o4(G,H.qualities||J.streaming?.defaultQualities||[],K,W);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await d4($,Z,U,J),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function BU($,Z,J,Y,X){try{let G=await new Y.Conversion($,Z,{videoCodec:J.codec,videoBitrate:J.bitrate,width:J.maxWidth,height:J.maxHeight,frameRate:J.frameRate,audioCodec:J.audioCodec,audioBitrate:J.audioBitrate,sampleRate:J.sampleRate,channels:J.channels}).run((K)=>{X?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||J.maxWidth||0,height:G.height||J.maxHeight||0,bitrate:G.bitrate||J.bitrate||0,frameRate:G.frameRate||J.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var FJ=b(()=>{$5();K6();B6();H6()});var VJ={};t(VJ,{setCachedVideoResult:()=>d4,processVideo:()=>OJ,getCachedVideoResult:()=>m4,generateThumbnails:()=>c4,generateSpriteSheet:()=>GJ,generatePoster:()=>l4,generateHLSManifest:()=>n4,generateDASHManifest:()=>o4,clearVideoCache:()=>QJ,analyzeVideo:()=>_6,VideoProcessorCache:()=>u4});var LJ=b(()=>{FJ();B6();H6();K6()});async function NJ(){try{return await Promise.resolve().then(() => (LJ(),VJ))}catch($){if(!wJ)console.warn("[stx-media] Video processor not available, some features disabled:",$),wJ=!0;return null}}async function s4($,Z={}){let J=Z,Y=$;if(Y.process&&!Y.skipProcessing){if(J.tsVideosConfig?.enabled&&!J.isDev)return LU(Y,J)}if(J.processedResult?.processed)return TJ($,J.processedResult,Z);let X;if(Y.generatePoster&&Y.src&&!$.poster)X=await wU(Y,J);let{src:Q,sources:G=[],poster:K,posterPlaceholder:W,controls:q=RJ,autoplay:z=!1,muted:U=!1,loop:j=!1,preload:H=AJ,playsinline:B=!0,lazy:_=!0,player:O="native",type:V,width:F,height:L,crossorigin:w,disablePictureInPicture:N=!1,disableRemotePlayback:R=!1}=$,A=X||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return OU($,Z);if(V&&V!=="video")return _U(Q||"",V,$);let E=G.length>0?G:Q?[{src:Q,type:MJ(Q)}]:[],D=[`id="${I}"`];if(q)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(N)D.push("disablepictureinpicture");if(R)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),A)D.push(`data-poster="${T0(A)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),A)D.push(`poster="${T0(A)}"`);if(F)D.push(`width="${F}"`);if(L)D.push(`height="${L}"`);if(M)D.push(`class="${T0(M)}"`);if(T)D.push(`style="${T0(T)}"`);let y=E.map((C)=>{return` <source ${_?`data-src="${T0(C.src)}"`:`src="${T0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
|
|
8903
8903
|
`),S=`<video ${D.join(" ")}>
|
|
8904
8904
|
${y}
|
|
8905
8905
|
Your browser does not support the video tag.
|
|
@@ -9481,8 +9481,8 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
9481
9481
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(Y))Z.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded(Z);let X=`${this.formatEntry($)}
|
|
9482
9482
|
`;Z.appendFileSync(this.logFilePath,X,"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 J=this.maxLogFiles-1;J>=1;J--){let Y=`${this.logFilePath}.${J}`,X=`${this.logFilePath}.${J+1}`;if($.existsSync(Y))if(J>=this.maxLogFiles-1)$.unlinkSync(Y);else $.renameSync(Y,X)}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 J of this.errors){let Y=J.error.constructor.name;$[Y]=($[Y]||0)+1;let X=J.level||"error";Z[X]=(Z[X]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let J=await import("fs"),X=(await import("path")).dirname($);if(!J.existsSync(X))J.mkdirSync(X,{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}));J.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));J.writeFileSync($,Q.join(`
|
|
9483
9483
|
|
|
9484
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var w6
|
|
9485
|
-
@end${K}`;Y.push(`Added ${z} missing @end${K}`)}}if(Y.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Y}},createFallbackContent($,Z){if(w$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}}
|
|
9484
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var w6,Z1,R6;var CJ=b(()=>{J7();w6={isEnabled(){return t4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=t4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let J=$,Y=[],X=(J.match(/\{\{/g)||[]).length,Q=(J.match(/\}\}/g)||[]).length;if(X>Q){let K=X-Q;J+="}}".repeat(K),Y.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let W=(J.match(new RegExp(`@${K}\\b`,"g"))||[]).length,q=(J.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(W>q){let z=W-q;for(let U=0;U<z;U++)J+=`
|
|
9485
|
+
@end${K}`;Y.push(`Added ${z} missing @end${K}`)}}if(Y.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Y}},createFallbackContent($,Z){if(w$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};Z1=new N6,R6={isDevelopment(){return w$()},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 J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)J.push(`Context: ${JSON.stringify(Z,null,2)}`);return J.push("========================"),J.join(`
|
|
9486
9486
|
`)}}});var vJ=()=>{};var xJ=b(()=>{r4();PJ();CJ();vJ();J7()});var w1=b(()=>{xJ()});function fJ($,Z,J,Y){let X=$;X=X.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,W,q)=>{if(!q&&W.includes(":")){let z=W.split(":"),U=W,j=z.length>1?z[1]:"";if(j&&Z[j])q=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])q=Z.openGraph[z[1]];else q="";return q?`<meta property="${l(U)}" content="${l(q)}">`:""}return q?`<meta name="${l(W)}" content="${l(q)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(X))!==null){let K=G.index,W=K+G[0].length-1,q=1,z=W+1;while(z<X.length&&q>0){if(X[z]==="(")q++;else if(X[z]===")"){if(q--,q===0)break}z++}if(q!==0)break;let U=X.substring(W+1,z).trim(),j=z+1,H=(()=>{try{let B=A0(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 J0("MetaTag",_,o.EVALUATION_ERROR)}})();X=X.substring(0,K)+H+X.substring(j),Q.lastIndex=0}return X}function gJ($,Z,J){let Y=$,X=/@structuredData\s*\(/g,Q;while((Q=X.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let z=Y.substring(K+1,q).trim(),U=q+1,j=(()=>{try{let H=A0(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 J0("StructuredData",B,o.EVALUATION_ERROR)}})();Y=Y.substring(0,G)+j+Y.substring(U),X.lastIndex=0}return Y}function hJ($,Z,J,Y){let X=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(X))!==null){let K=X.indexOf("{",G.index+4),W=1,q=K+1,z=null,U=!1;while(q<X.length&&W>0){let V=X[q];if(U){U=!1,q++;continue}if(V==="\\"&&z){U=!0,q++;continue}if(z){if(V===z)z=null;q++;continue}if(V==='"'||V==="'"||V==="`"){z=V,q++;continue}if(V==="{")W++;else if(V==="}")W--;q++}if(W!==0)break;let j=X.substring(q).match(/^\s*\)/);if(!j)break;let H=q+j[0].length,B=X.substring(K,q),_=X.substring(G.index,H),O=((V)=>{try{let F=A0(V,Z);if(!F)return"";let L="";if(F.title)L+=`<title>${l(F.title)}</title>
|
|
9487
9487
|
`,L+=`<meta name="title" content="${l(F.title)}">
|
|
9488
9488
|
`;if(F.description)L+=`<meta name="description" content="${l(F.description)}">
|
|
@@ -9575,14 +9575,14 @@ ${z}
|
|
|
9575
9575
|
customElements.define('${Z}', ${G});
|
|
9576
9576
|
`}async function lJ($,Z,J,Y){if(Z.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let X=Z[0].replace(/['"]/g,""),G=(J.__stx_options||{}).componentsDir||"components",K=[N$.join(N$.dirname(Y),G,`${X}.stx`),N$.join(process.cwd(),G,`${X}.stx`),N$.join(N$.dirname(Y),`${X}.stx`)],W=null;for(let U of K)if(await c(U)){W=await Bun.file(U).text();break}if(!W)return J0("WebComponent",`Component file not found: ${X}.stx`,o.FILE_NOT_FOUND);let q=hU(W,X);return`<script type="module">
|
|
9577
9577
|
${uU(q)}
|
|
9578
|
-
</script>`}var cJ=b(()=>{w1();I0()});var iJ={};a(iJ,{timingPlugin:()=>cU,pluginManager:()=>mU,definePlugin:()=>X7,debugPlugin:()=>lU,createVariablesPlugin:()=>iU,createFilterPlugin:()=>pU,createDirectivePlugin:()=>dU,PluginManager:()=>A6});function X7($){return $}class A6{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 J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" 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[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" 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 J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let X=Y[$];if(X)try{let Q=await X(J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return Y}}function dU($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function pU($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function iU($){return X7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var mU,lU,cU;var nJ=b(()=>{mU=new A6;lU=X7({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)}}),cU=X7({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 J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var aJ={};a(aJ,{validateConfig:()=>eU,resolveStxDirectories:()=>rJ,loadStxConfig:()=>t0,defineStxConfig:()=>tU,defaultConfig:()=>Y5,config:()=>Z$});import Q7 from"fs";import l0 from"path";import{loadConfigWithResult as nU}from"bunfig";function oU($,Z,J){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=J||process.cwd(),Q=l0.join(X,"resources","views"),G=l0.join(X,"resources","layouts");if(Q7.existsSync(Q)&&Q7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=l0.join(X,"resources","views","pages");if(Q7.existsSync(K))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function sU($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let Y=$.replace(/\\/g,"/"),X=J.replace(/\\/g,"/");return Y===X||Y.startsWith(`${X}/`)}function rJ($,Z){let J=!$.root,Y=oU($.root,$.pagesDir,Z);if($.root=Y.root,$.pagesDir=Y.pagesDir,J&&Y.root!=="."){let X=`${Z}::${Y.root}`;if(!oJ.has(X))oJ.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(l0.isAbsolute(G)||sU(G,X))continue;$[Q]=l0.join(X,G)}}return $}function rU($,Z){let J=["componentsDir","layoutsDir","partialsDir"];for(let Y of J){let X=$[Y];if(typeof X!=="string"||!X)continue;let Q=l0.isAbsolute(X)?X:l0.join(Z,X);if(Q7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(Y)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function aU($){if(q8($.stateDir),$.stateDir=o5(),$.cachePath=s5($.cachePath),$.build)$.build.cacheDir=s5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=s5($.media.cache.directory);if($.story)$.story.outDir=s5($.story.outDir)}async function t0($){if(!$){if(E5)return E5;if(G7)return G7}let Z=$?l0.resolve($):process.cwd(),J=sJ.get(Z);if(J)return J;let Y=(async()=>{let Q=(await nU({name:"stx",alias:"ui",cwd:Z,defaultConfig:Y5,verbose:!1})).config;if(aU(Q),rJ(Q,Z),rU(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (nJ(),iJ)),K=[],W=[];for(let q of Q.plugins){let z=typeof q==="string"?q:q[0],U=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(z),H=l0.dirname(z0.resolve(z))}catch{let _=l0.resolve(process.cwd(),z);j=await import(_),H=l0.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(l0.resolve(H,O))}if(B.pages){let _=l0.resolve(H,B.pages),O=U.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},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=W}return Q})();if(sJ.set(Z,Y),!$)G7=Y,Y.then((X)=>{E5=X}).catch(()=>{});return Y}function tU($){return $}function eU($){let Z=[],J=[];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 Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.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 Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${X}].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((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.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 Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.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((X)=>typeof X!=="number"||X<16||X>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 Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!Y.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var Y5,oJ,E5=null,sJ,G7=null,Z$;var V1=b(()=>{l7();c7();i7();n7();u3();XJ();F6();bJ();Y7();r5();cJ();Y5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_5,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:b2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:lJ,hasEndTag:!1,description:"Include a web component in the template"},j8,B8,mJ,dJ,H8,O8,F8,_8,N8,M8,YJ,O6,...EJ],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}};oJ=new Set;sJ=new Map;Z$=new Proxy(Y5,{get($,Z){if(E5&&Z in E5)return E5[Z];if(!G7)t0().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var YY={};a(YY,{resetCssCache:()=>Kj,resetCrosswindCache:()=>Wj,rebuildCrosswindCSS:()=>qj,loadCrosswindConfig:()=>D6,loadCrosswind:()=>I6,injectCrosswindCSS:()=>A$,getCrosswindServeAsset:()=>Jj,getCachedCSS:()=>zj,generateCrosswindCSS:()=>JY,extractClassNames:()=>ZY,buildCrosswindCSS:()=>$Y});import X0 from"path";import{hasLocalConfig as $j}from"bunfig";function W7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function M6($,Z){if(N1.has($))N1.delete($);else if(N1.size>=eJ)N1.delete(N1.keys().next().value);N1.set($,Z)}function Zj($){let Z=W7($);if(Z1.has(Z))Z1.delete(Z);else if(Z1.size>=eJ)Z1.delete(Z1.keys().next().value);return Z1.set(Z,$),Z}function Jj($){let Z=Z1.get($);if(Z===void 0)return;return Z1.delete($),Z1.set($,Z),Z}async function Yj($){if(!x1)return null;try{let Z=Bun.file(X0.join(x1,`cw-${W7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Xj($,Z){if(!x1)return;try{if(!fs.existsSync(x1))fs.mkdirSync(x1,{recursive:!0});await Bun.write(X0.join(x1,`cw-${W7($)}.css`),Z)}catch{}}async function tJ($){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 Qj(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function Gj(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let J=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function I6(){if(T6)return q1;T6=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await tJ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return q1=Q,q1}let Z=await $(Qj());if(Z)return q1=Z,q1;let J=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of J){let Q=await tJ(X);if(Q){if(q1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return q1}}let Y=await $(Gj());if(Y)return q1=Y,q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function Kj(){N1.clear(),Z1.clear()}function Wj(){q1=null,T6=!1,J1=null,R$="",N1.clear(),Z1.clear(),K7=null}async function D6($){try{if(!$j({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=X0.relative($,J.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${Y||J.path}`);return J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function $Y($){if(b5)return R$;b5=!0;try{let Z=await I6();if(!Z||!Z.build)return b5=!1,"";if(!J1)J1=await D6($);if(!J1)return b5=!1,"";let J=Z.defaultConfig?.theme||{},Y=J1.theme||{},X={...Z.defaultConfig,...J1,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(R$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return b5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),b5=!1,R$}}async function qj($){J1=null,await $Y($)}function zj(){return R$}function ZY($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function JY($,Z){try{let J=await I6();if(!J)return"";let Y=typeof J.extractClasses==="function"?J.extractClasses($):ZY($);if(Y.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!x1)x1=_1(X,"cache");let Q=[...Y].sort().join(" "),G=`${K7||"default"}::${Q}`,K=N1.get(G);if(K!==void 0)return M6(G,K),K;let W=await Yj(G);if(W!==null)return M6(G,W),W;if(!J1){let w=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (V1(),aJ)),R=await N(X);if(R.css)if(typeof R.css==="string"){let A=X0.isAbsolute(R.css)?R.css:X0.resolve(X,R.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(w={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(X,R.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}J1=w||await D6(X);try{K7=W7(JSON.stringify(J1??{}))}catch{K7="unhashable"}}let q=J.defaultConfig||J.config,z=J1||{},U=K8(q,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new J.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of Y)O.generate(w);let V=O.toCSS(H,B),F=_.shortcuts||z.shortcuts||{};for(let[w,N]of Object.entries(F)){if(!Y.has(w)&&!j.includes(w))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}V=O.toCSS(H,B);let L=V.split(`
|
|
9578
|
+
</script>`}var cJ=b(()=>{w1();I0()});var iJ={};t(iJ,{timingPlugin:()=>cU,pluginManager:()=>mU,definePlugin:()=>X7,debugPlugin:()=>lU,createVariablesPlugin:()=>iU,createFilterPlugin:()=>pU,createDirectivePlugin:()=>dU,PluginManager:()=>A6});function X7($){return $}class A6{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 J of $.dependencies)if(!this.plugins.has(J))throw Error(`Plugin "${$.name}" depends on "${J}" 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[J,Y]of this.plugins)if(Y.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${J}" 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 J=await Z.onError($);if(J){if(J.template!==void 0)$.template=J.template;if(J.context)$.context={...$.context,...J.context};if(J.metadata)$.metadata={...$.metadata,...J.metadata};if(J.skip)return $}}catch(J){console.error(`Error in plugin "${Z.name}" onError hook:`,J)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let J={...Z};for(let Y of this.sortedPlugins){let X=Y[$];if(X)try{let Q=await X(J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}async runDirectiveHooks($,Z,J){let Y={...J};for(let X of this.sortedPlugins){let Q=X[$];if(Q)try{let G=await Q(Z,Y);if(G){if(G.template!==void 0)Y.template=G.template;if(G.context)Y.context={...Y.context,...G.context};if(G.metadata)Y.metadata={...Y.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${X.name}" ${$} hook:`,G)}}return Y}}function dU($,Z,J={}){return{name:$,...J,registerDirectives:()=>Z}}function pU($,Z,J={}){return{name:$,...J,registerFilters:()=>Z}}function iU($){return X7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var mU,lU,cU;var nJ=b(()=>{mU=new A6;lU=X7({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)}}),cU=X7({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 J=performance.now()-Z;console.log(`[stx-timing] Processing took ${J.toFixed(2)}ms`)}}})});var aJ={};t(aJ,{validateConfig:()=>eU,resolveStxDirectories:()=>rJ,loadStxConfig:()=>e0,defineStxConfig:()=>tU,defaultConfig:()=>Y5,config:()=>Z$});import Q7 from"fs";import l0 from"path";import{loadConfigWithResult as nU}from"bunfig";function oU($,Z,J){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=J||process.cwd(),Q=l0.join(X,"resources","views"),G=l0.join(X,"resources","layouts");if(Q7.existsSync(Q)&&Q7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=l0.join(X,"resources","views","pages");if(Q7.existsSync(K))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function sU($,Z){let J=Z.replace(/[\\/]+$/,"");if(!J||J===".")return!0;let Y=$.replace(/\\/g,"/"),X=J.replace(/\\/g,"/");return Y===X||Y.startsWith(`${X}/`)}function rJ($,Z){let J=!$.root,Y=oU($.root,$.pagesDir,Z);if($.root=Y.root,$.pagesDir=Y.pagesDir,J&&Y.root!=="."){let X=`${Z}::${Y.root}`;if(!oJ.has(X))oJ.add(X),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let X=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(l0.isAbsolute(G)||sU(G,X))continue;$[Q]=l0.join(X,G)}}return $}function rU($,Z){let J=["componentsDir","layoutsDir","partialsDir"];for(let Y of J){let X=$[Y];if(typeof X!=="string"||!X)continue;let Q=l0.isAbsolute(X)?X:l0.join(Z,X);if(Q7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(Y)} resolves to "${Q}", which does not exist. Configured as "${X}"`+(K?`, resolved under root "${G}".`:"."))}}function aU($){if(q8($.stateDir),$.stateDir=o5(),$.cachePath=s5($.cachePath),$.build)$.build.cacheDir=s5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=s5($.media.cache.directory);if($.story)$.story.outDir=s5($.story.outDir)}async function e0($){if(!$){if(E5)return E5;if(G7)return G7}let Z=$?l0.resolve($):process.cwd(),J=sJ.get(Z);if(J)return J;let Y=(async()=>{let Q=(await nU({name:"stx",alias:"ui",cwd:Z,defaultConfig:Y5,verbose:!1})).config;if(aU(Q),rJ(Q,Z),rU(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (nJ(),iJ)),K=[],W=[];for(let q of Q.plugins){let z=typeof q==="string"?q:q[0],U=typeof q==="string"?{}:q[1]||{};try{let j,H;try{j=await import(z),H=l0.dirname(U0.resolve(z))}catch{let _=l0.resolve(process.cwd(),z);j=await import(_),H=l0.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(l0.resolve(H,O))}if(B.pages){let _=l0.resolve(H,B.pages),O=U.path||"/";W.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},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=W}return Q})();if(sJ.set(Z,Y),!$)G7=Y,Y.then((X)=>{E5=X}).catch(()=>{});return Y}function tU($){return $}function eU($){let Z=[],J=[];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 Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.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 Y=["AA","AAA"];if(!Y.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`customDirectives[${X}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`customDirectives[${X}].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((Y,X)=>{if(!Y.name||typeof Y.name!=="string")Z.push({path:`middleware[${X}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")Z.push({path:`middleware[${X}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))Z.push({path:`middleware[${X}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)J.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)J.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 Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((X,Q)=>{if(!X.pattern||typeof X.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(X.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(X.maxAgeSeconds!==void 0&&(typeof X.maxAgeSeconds!=="number"||X.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(X.maxEntries!==void 0&&(typeof X.maxEntries!=="number"||X.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((X)=>typeof X!=="number"||X<16||X>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 Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!Y.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)J.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)J.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:J}}var Y5,oJ,E5=null,sJ,G7=null,Z$;var V1=b(()=>{l7();c7();i7();n7();u3();XJ();F6();bJ();Y7();r5();cJ();Y5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:_5,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:b2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:lJ,hasEndTag:!1,description:"Include a web component in the template"},j8,B8,mJ,dJ,H8,O8,F8,_8,N8,M8,YJ,O6,...EJ],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}};oJ=new Set;sJ=new Map;Z$=new Proxy(Y5,{get($,Z){if(E5&&Z in E5)return E5[Z];if(!G7)e0().catch((J)=>{console.warn("[stx] Failed to load config file:",J?.message||J)});return $[Z]}})});var YY={};t(YY,{resetCssCache:()=>Kj,resetCrosswindCache:()=>Wj,rebuildCrosswindCSS:()=>qj,loadCrosswindConfig:()=>D6,loadCrosswind:()=>I6,injectCrosswindCSS:()=>A$,getCrosswindServeAsset:()=>Jj,getCachedCSS:()=>zj,generateCrosswindCSS:()=>JY,extractClassNames:()=>ZY,buildCrosswindCSS:()=>$Y});import X0 from"path";import{hasLocalConfig as $j}from"bunfig";function W7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function M6($,Z){if(N1.has($))N1.delete($);else if(N1.size>=eJ)N1.delete(N1.keys().next().value);N1.set($,Z)}function Zj($){let Z=W7($);if(J1.has(Z))J1.delete(Z);else if(J1.size>=eJ)J1.delete(J1.keys().next().value);return J1.set(Z,$),Z}function Jj($){let Z=J1.get($);if(Z===void 0)return;return J1.delete($),J1.set($,Z),Z}async function Yj($){if(!x1)return null;try{let Z=Bun.file(X0.join(x1,`cw-${W7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Xj($,Z){if(!x1)return;try{if(!fs.existsSync(x1))fs.mkdirSync(x1,{recursive:!0});await Bun.write(X0.join(x1,`cw-${W7($)}.css`),Z)}catch{}}async function tJ($){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 Qj(){let $=[],Z=process.cwd();while(Z!==X0.dirname(Z))$.push(X0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(X0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(X0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=X0.dirname(Z);return $}function Gj(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let J=[X0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),X0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),X0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(X0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function I6(){if(T6)return z1;T6=!0;try{let $=async(X)=>{for(let Q of X){if(!await Bun.file(Q).exists())continue;let G=await tJ(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${X0.dirname(X0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let X=X0.resolve(process.env.CROSSWIND_SRC),Q=await $([X]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${X}`);return z1=Q,z1}let Z=await $(Qj());if(Z)return z1=Z,z1;let J=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let X of J){let Q=await tJ(X);if(Q){if(z1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return z1}}let Y=await $(Gj());if(Y)return z1=Y,z1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function Kj(){N1.clear(),J1.clear()}function Wj(){z1=null,T6=!1,Y1=null,R$="",N1.clear(),J1.clear(),K7=null}async function D6($){try{if(!$j({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),J=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!J?.path||!J.config||Object.keys(J.config).length===0)return null;let Y=X0.relative($,J.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${Y||J.path}`);return J.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function $Y($){if(b5)return R$;b5=!0;try{let Z=await I6();if(!Z||!Z.build)return b5=!1,"";if(!Y1)Y1=await D6($);if(!Y1)return b5=!1,"";let J=Z.defaultConfig?.theme||{},Y=Y1.theme||{},X={...Z.defaultConfig,...Y1,theme:{...J,...Y,extend:{...J.extend||{},...Y.extend||{}}}},Q=performance.now(),G=await Z.build(X),K=performance.now()-Q;if(R$=G.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),X.output){let W=X0.isAbsolute(X.output)?X.output:X0.join($,X.output),q=X0.dirname(W);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(W,G.css)}return b5=!1,G.css}catch(Z){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,Z),b5=!1,R$}}async function qj($){Y1=null,await $Y($)}function zj(){return R$}function ZY($){let Z=new Set,J=/class\s*=\s*["']([^"']+)["']/gi,Y=J.exec($);while(Y!==null){for(let G of Y[1].split(/\s+/))if(G.trim())Z.add(G.trim());Y=J.exec($)}let X=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=X.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=X.exec($)}return Z}async function JY($,Z){try{let J=await I6();if(!J)return"";let Y=typeof J.extractClasses==="function"?J.extractClasses($):ZY($);if(Y.size===0)return"";let X=Z?X0.resolve(Z):process.cwd();if(!x1)x1=_1(X,"cache");let Q=[...Y].sort().join(" "),G=`${K7||"default"}::${Q}`,K=N1.get(G);if(K!==void 0)return M6(G,K),K;let W=await Yj(G);if(W!==null)return M6(G,W),W;if(!Y1){let w=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (V1(),aJ)),R=await N(X);if(R.css)if(typeof R.css==="string"){let A=X0.isAbsolute(R.css)?R.css:X0.resolve(X,R.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(w={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let A=X0.isAbsolute(R.css.config)?R.css.config:X0.resolve(X,R.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Y1=w||await D6(X);try{K7=W7(JSON.stringify(Y1??{}))}catch{K7="unhashable"}}let q=J.defaultConfig||J.config,z=Y1||{},U=K8(q,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new J.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of Y)O.generate(w);let V=O.toCSS(H,B),F=_.shortcuts||z.shortcuts||{};for(let[w,N]of Object.entries(F)){if(!Y.has(w)&&!j.includes(w))continue;let R=N.split(/\s+/).filter(Boolean);for(let A of R)O.generate(A)}V=O.toCSS(H,B);let L=V.split(`
|
|
9579
9579
|
`);for(let[w,N]of Object.entries(F)){if(!Y.has(w)&&!j.includes(w))continue;let R=N.split(/\s+/).filter(Boolean),A=[],M=[];for(let T of R){let I=T.startsWith("dark:"),y=`.${(I?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<L.length;S++){let P=L[S].trim();if(P===`${y} {`||P.startsWith(`${y} {`)){let C=S,x="";while(C<L.length){if(x+=L[C],L[C].includes("}"))break;C++}let f=x.match(/\{([^}]+)\}/);if(f)if(I)M.push(f[1].trim());else A.push(f[1].trim());break}}}if(A.length)V+=`
|
|
9580
9580
|
.${w} { ${A.join(" ")} }`;if(M.length)V+=`
|
|
9581
9581
|
@media (prefers-color-scheme: dark) { .dark .${w} { ${M.join(" ")} } }`}return M6(G,V),Xj(G,V),V}catch(J){return console.warn("Failed to generate Crosswind CSS:",J),""}}async function A$($,Z,J=!1){let Y=await JY($,Z);if(!Y)return $;let X=J?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Zj(Y)}.css">`:`<style data-crosswind="generated">
|
|
9582
9582
|
${Y}
|
|
9583
9583
|
</style>`,Q=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(Q.test($)){let G=!1;return $.replace(Q,()=>{if(G)return"";return G=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
|
|
9584
9584
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
9585
|
-
${X}`);return X+$}var
|
|
9585
|
+
${X}`);return X+$}var z1=null,T6=!1,Y1=null,R$="",b5=!1,eJ=256,N1,J1,x1=null,K7=null;var q7=b(()=>{r5();z8();N1=new Map,J1=new Map});function XY(){return`
|
|
9586
9586
|
// STX Lifecycle Runtime
|
|
9587
9587
|
(function() {
|
|
9588
9588
|
if (typeof window === 'undefined') return;
|
|
@@ -10361,11 +10361,11 @@ window.__stx_reactive = (function() {
|
|
|
10361
10361
|
${Ij()}
|
|
10362
10362
|
${J}
|
|
10363
10363
|
</script>`}function OY($,Z,J){if(_Y=0,!Ej($))return $;let Y=Rj($);if(Y.length===0)return $;let X=kj($,Y),Q=Dj(Y,Z),G=X.lastIndexOf("</body>");if(G!==-1)X=X.slice(0,G)+Q+`
|
|
10364
|
-
`+X.slice(G);else X+=Q;return X}function kj($,Z){let J=0,Y=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[J++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Ej($){return/x-data\s*=\s*["']/.test($)}var _Y=0,Nj=0;var FY=b(()=>{W1()});import bj from"fs";import E6 from"path";import{createHighlighter as Sj}from"ts-syntax-highlighter";async function yj($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let Y=(await bj.promises.stat($)).mtime.getTime();if(Z.cache&&b6.has($)){let U=b6.get($);if(U.updatedAt>=Y)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=I8(X),K=Z.markdown||Z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=a5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await Pj(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:q,data:Q||{}};if(Z.cache)b6.set($,{...z,updatedAt:Y});return z}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function Pj($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!U7)try{U7=await Sj({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,z)=>{let U=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),j=q||(J?"text":"");if(!j)return K;try{if(!U7.getSupportedLanguages().includes(j))return K;return(await U7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(Y);for(let K of G){let[W,q,z,U]=K,j=await X(W,q,z,U);Q=Q.replace(W,j)}return Q}async function VY($,Z,J="",Y={}){return await Cj($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let z=K;if(!E6.isAbsolute(K))z=E6.resolve(E6.dirname(J),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let F=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=L.substring(0,w).trim(),R=L.substring(w+1).trim(),A=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(A||M)R=R.substring(1,R.length-1);U[N]=R}}}}catch(V){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:H}=await yj(z,Y),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):V}),_}catch(z){let U=z instanceof Error?z.message:String(z);return U0("Markdown File",`Error including markdown file: ${U}`,J,$,q,G)}})}async function Cj($,Z,J){let Y=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;Y.push(J(...q).then((z)=>({match:K,replacement:z,index:W})))}let Q=await Promise.all(Y);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var b6,U7=null;var LY=b(()=>{V1();I0();b6=new Map});function f1($,Z){try{let J=$.trim();if(K0(J))return W0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}var wY=b(()=>{M0()});function vj($,Z,J){let Y=$,X=!0;while(X){X=!1;let Q=Y.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=w3(Y,G);if(!K)break;try{let W;if(K0(K.expression))W=W0(K.expression,Object.keys(Z))(...Object.values(Z));else W=Y0(K.expression,Z);let q="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)q=U.content.trim()}else try{let j;if(U.value&&K0(U.value))j=W0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Y0(U.value,Z);if(W===j){q=U.content.trim(),z=!0;break}}catch{continue}Y=Y.substring(0,G)+q+Y.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+z+Y.substring(K.end);break}}return Y}function xj($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return Z.push(Y),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function fj($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,Y)=>Z[Number(Y)]??J)}function X5($,Z,J){let{masked:Y,scripts:X}=xj($);return fj(gj(Y,Z,J),X)}function gj($,Z,J){let Y=$;Y=vj(Y,Z,J);{let Q=!0;while(Q){Q=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=P1(Y,K+7);if(!W)break;let q=W.endPos,z=a1(Y,"unless","endunless",q);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=Y.slice(q,z),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=O.exec(U))!==null)L.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(U))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")_++;else if(N.type==="close")_--;else if(N.type==="else"&&_===0){H=N.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`;Y=Y.substring(0,K)+B+Y.substring(z+10),Q=!0}}Y=y6(Y,Z,J),Y=P6(Y,Z,J),Y=S6(Y,Z);let X=()=>{let Q=B$(Y);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let z of K.branches){if(q)break;if(z.type==="else")W=z.content,q=!0;else try{let U;if(z.condition&&K0(z.condition))U=W0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Y0(z.condition,Z);if(U)W=z.content,q=!0}catch(U){W=J0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),q=!0}}Y=Y.substring(0,K.start)+W+Y.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,K.start)+z+Y.substring(K.end)}}return!0};while(!0){let Q=Y;if(!X())break;if(Y===Q)break}return Y}function NY($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(X===J){Z++;break}Y.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function S6($,Z){let J=$;function Y(K,W,q,z){let U=1,j=z,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),V=_?_.index:1/0,F=O?O.index:1/0;if(V<F)U++,j=V+_[0].length;else if(F<1/0){if(U--,U===0)return F;j=F+O[0].length}else break}return-1}function X(K,W,q){let z=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![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,V)=>O.pos-V.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 W=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+5),H=NY(j);if(H)z=H.value,U=q+5+H.consumed;else U=q+5;let B=Y(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?f1(`auth?.check && auth?.user?.[${z}]`,Z):f1("auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+6),H=NY(j);if(H)z=H.value,U=q+6+H.consumed;else U=q+6;let B=Y(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?f1(`!auth?.check || !auth?.user?.[${z}]`,Z):f1("!auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+9),K=!0}}function Q(K,W,q){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(W)z.push(W);if(q){let U=f1(q,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=J.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=J.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=Y(J,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=J.slice(_,O),F=[],L=0,w=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],T;while((T=w.exec(V))!==null)M.push({pos:T.index,type:"open"});while((T=N.exec(V))!==null)M.push({pos:T.index,type:"close"});while((T=R.exec(V))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=A.exec(V))!==null)M.push({pos:T.index,type:"else"});M.sort((P,C)=>P.pos-C.pos);for(let P of M){if(P.type==="open"){L++;continue}if(P.type==="close"){L--;continue}if(L===0)F.push(P)}let I=[],E=0;for(let P=0;P<F.length;P++){let C=F[P];if(I.push({content:V.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let x=V.slice(C.pos+`@${q}`.length),f=G(x);if(f){I[I.length-1]={content:V.slice(E,C.pos)},E=C.pos+`@${q}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=F[P+1],$0=d?d.pos:V.length;I.push({content:V.slice(E,$0),ability:f.ability,type:f.type,id:f.id}),E=$0}}else E=C.pos+5}if(E<V.length){let P=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:V.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(E)})}let D=Q(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let P=!1;for(let C=1;C<I.length;C++){let x=I[C];if(x.isFinalElse){S=x.content,P=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(K==="can"?f:!f){S=x.content,P=!0;break}}}if(!P&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}J=J.substring(0,j)+S+J.substring(O+`@${W}`.length),z=!0}}return J}function y6($,Z,J){let Y=$;function X(Q,G,K,W,q){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=P1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=a1(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 V=Q.slice(_,O),F=B.expression,L=-1,w=0,N=0;while(N<V.length){let R=V.indexOf("@",N);if(R===-1)break;let A=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){L=R;break}N=R+1}try{let R=W(F.trim()),A;if(L!==-1){let M=V.slice(0,L),T=V.slice(L+5);A=R?M:T}else A=R?V:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(R){let A=R instanceof Error?R.message:String(R),M=J0(q,`Error processing @${G} directive: ${A}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return Y=X(Y,"isset","endisset",(Q)=>{let G=f1(Q,Z);return G!==void 0&&G!==null},"Isset"),Y=X(Y,"empty","endempty",(Q)=>{let G=f1(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"),Y}function P6($,Z,J){let Y=$,X="development";function Q(G,K,W,q){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let V=O.index,F=V+O[0].length;if(K==="env"){let D=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;F+=D[0].length,q=X===D[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),y=U.exec(B),S=D?D.index:1/0,P=y?y.index:1/0;if(S<P)L++,w=S+D[0].length;else if(P<1/0){if(L--,L===0){N=P;break}w=P+y[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(F,N),A=-1,M=0,T=0;while(T<R.length){let D=R.indexOf("@",T);if(D===-1)break;let y=R.substring(D);if(j.test(y)){M++,T=D+1;continue}if(H.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){A=D;break}T=D+1}let I;if(A!==-1){let D=R.slice(0,A),y=R.slice(A+5);I=q?D:y}else I=q?R:"";let E=`@${W}`.length;B=B.substring(0,V)+I+B.substring(N+E),_=!0}return B}return Y=Q(Y,"env","endenv",!1),Y=Q(Y,"production","endproduction",X==="production"),Y=Q(Y,"development","enddevelopment",X==="development"),Y=Q(Y,"staging","endstaging",X==="staging"),Y=Q(Y,"testing","endtesting",X==="testing"),Y}var j7=b(()=>{wY();w1();X4();M0()});function AY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function B7($,Z){if(!$)return Z?.nonceGenerator?.()??AY();let J=RY.get($);if(!J)J=Z?.nonceGenerator?.()??AY(),RY.set($,J);return J}function hj($,Z){let J=[];for(let[Y,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)J.push(Y);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(Y==="script-src"||Y==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${Y} ${Q.join(" ")}`)}}return J.join("; ")}function MY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${hj($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function TY($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?B7(J,Z):void 0,X=MY(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
10364
|
+
`+X.slice(G);else X+=Q;return X}function kj($,Z){let J=0,Y=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(X,Q,G)=>{let K=Z[J++];if(!K)return X;let W=/data-stx-scope="([^"]*)"/.exec(G);if(W)return K.id=W[1],K.selector=`[data-stx-scope="${K.id}"]`,X;return`<${Q} data-stx-scope="${K.id}"${G}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Ej($){return/x-data\s*=\s*["']/.test($)}var _Y=0,Nj=0;var FY=b(()=>{q1()});import bj from"fs";import E6 from"path";import{createHighlighter as Sj}from"ts-syntax-highlighter";async function yj($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let Y=(await bj.promises.stat($)).mtime.getTime();if(Z.cache&&b6.has($)){let U=b6.get($);if(U.updatedAt>=Y)return{content:U.content,data:U.data}}let X=await Bun.file($).text(),{data:Q,content:G}=I8(X),K=Z.markdown||Z$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=a5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)q=await Pj(q,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:q,data:Q||{}};if(Z.cache)b6.set($,{...z,updatedAt:Y});return z}catch(J){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,J);let Y=J instanceof Error?J.message:String(J);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function Pj($,Z,J){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!U7)try{U7=await Sj({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let X=async(K,W,q,z)=>{let U=z.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),j=q||(J?"text":"");if(!j)return K;try{if(!U7.getSupportedLanguages().includes(j))return K;return(await U7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${q}:`,H)}return K},Q=$,G=$.matchAll(Y);for(let K of G){let[W,q,z,U]=K,j=await X(W,q,z,U);Q=Q.replace(W,j)}return Q}async function VY($,Z,J="",Y={}){return await Cj($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,q)=>{try{let z=K;if(!E6.isAbsolute(K))z=E6.resolve(E6.dirname(J),K);let U={};if(W)try{try{U=JSON.parse(W)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let F=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let L of F){let w=L.indexOf(":");if(w>0){let N=L.substring(0,w).trim(),R=L.substring(w+1).trim(),A=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(A||M)R=R.substring(1,R.length-1);U[N]=R}}}}catch(V){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:j,data:H}=await yj(z,Y),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,F)=>{let L=F.trim();return B[L]!==void 0?String(B[L]):V}),_}catch(z){let U=z instanceof Error?z.message:String(z);return j0("Markdown File",`Error including markdown file: ${U}`,J,$,q,G)}})}async function Cj($,Z,J){let Y=[],X;while((X=Z.exec($))!==null){let K=X[0],W=X.index,q=X;Y.push(J(...q).then((z)=>({match:K,replacement:z,index:W})))}let Q=await Promise.all(Y);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var b6,U7=null;var LY=b(()=>{V1();I0();b6=new Map});function f1($,Z){try{let J=$.trim();if(W0(J))return q0(J,Object.keys(Z))(...Object.values(Z));else return Y0(J,Z)}catch{return!1}}var wY=b(()=>{M0()});function vj($,Z,J){let Y=$,X=!0;while(X){X=!1;let Q=Y.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=w3(Y,G);if(!K)break;try{let W;if(W0(K.expression))W=q0(K.expression,Object.keys(Z))(...Object.values(Z));else W=Y0(K.expression,Z);let q="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)q=U.content.trim()}else try{let j;if(U.value&&W0(U.value))j=q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Y0(U.value,Z);if(W===j){q=U.content.trim(),z=!0;break}}catch{continue}Y=Y.substring(0,G)+q+Y.substring(K.end),X=!0}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+z+Y.substring(K.end);break}}return Y}function xj($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return Z.push(Y),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function fj($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(J,Y)=>Z[Number(Y)]??J)}function X5($,Z,J){let{masked:Y,scripts:X}=xj($);return fj(gj(Y,Z,J),X)}function gj($,Z,J){let Y=$;Y=vj(Y,Z,J);{let Q=!0;while(Q){Q=!1;let G=Y.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=P1(Y,K+7);if(!W)break;let q=W.endPos,z=a1(Y,"unless","endunless",q);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=Y.slice(q,z),j=W.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,F=/@else(?![a-z])/g,L=[],w;while((w=O.exec(U))!==null)L.push({pos:w.index,type:"open"});while((w=V.exec(U))!==null)L.push({pos:w.index,type:"close"});while((w=F.exec(U))!==null)L.push({pos:w.index,type:"else"});L.sort((N,R)=>N.pos-R.pos);for(let N of L)if(N.type==="open")_++;else if(N.type==="close")_--;else if(N.type==="else"&&_===0){H=N.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`;Y=Y.substring(0,K)+B+Y.substring(z+10),Q=!0}}Y=y6(Y,Z,J),Y=P6(Y,Z,J),Y=S6(Y,Z);let X=()=>{let Q=B$(Y);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",q=!1;for(let z of K.branches){if(q)break;if(z.type==="else")W=z.content,q=!0;else try{let U;if(z.condition&&W0(z.condition))U=q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Y0(z.condition,Z);if(U)W=z.content,q=!0}catch(U){W=J0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),q=!0}}Y=Y.substring(0,K.start)+W+Y.substring(K.end)}catch(W){let q=W instanceof Error?W.message:String(W),z=J0("If",`Error processing @if block: ${q}`,o.EVALUATION_ERROR);Y=Y.substring(0,K.start)+z+Y.substring(K.end)}}return!0};while(!0){let Q=Y;if(!X())break;if(Y===Q)break}return Y}function NY($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=[];while(Z<$.length){let X=$[Z];if(X==="\\"&&Z+1<$.length){Y.push($[Z+1]),Z+=2;continue}if(X===J){Z++;break}Y.push(X),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:Y.join(""),consumed:Z}}function S6($,Z){let J=$;function Y(K,W,q,z){let U=1,j=z,H=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),V=_?_.index:1/0,F=O?O.index:1/0;if(V<F)U++,j=V+_[0].length;else if(F<1/0){if(U--,U===0)return F;j=F+O[0].length}else break}return-1}function X(K,W,q){let z=0,U=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![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,V)=>O.pos-V.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 W=J.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+5),H=NY(j);if(H)z=H.value,U=q+5+H.consumed;else U=q+5;let B=Y(J,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=z?f1(`auth?.check && auth?.user?.[${z}]`,Z):f1("auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let W=J.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let q=W.index,z,U,j=J.slice(q+6),H=NY(j);if(H)z=H.value,U=q+6+H.consumed;else U=q+6;let B=Y(J,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let _=J.slice(U,B),O=X(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=z?f1(`!auth?.check || !auth?.user?.[${z}]`,Z):f1("!auth?.check",Z);let F;if(O!==-1){let L=_.slice(0,O),w=_.slice(O+5);F=V?L:w}else F=V?_:"";J=J.substring(0,q)+F+J.substring(B+9),K=!0}}function Q(K,W,q){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(W)z.push(W);if(q){let U=f1(q,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,q=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=J.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=J.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=Y(J,K,W,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let V=J.slice(_,O),F=[],L=0,w=new RegExp(`@${K}\\s*\\(`,"g"),N=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],T;while((T=w.exec(V))!==null)M.push({pos:T.index,type:"open"});while((T=N.exec(V))!==null)M.push({pos:T.index,type:"close"});while((T=R.exec(V))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=A.exec(V))!==null)M.push({pos:T.index,type:"else"});M.sort((P,C)=>P.pos-C.pos);for(let P of M){if(P.type==="open"){L++;continue}if(P.type==="close"){L--;continue}if(L===0)F.push(P)}let I=[],E=0;for(let P=0;P<F.length;P++){let C=F[P];if(I.push({content:V.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let x=V.slice(C.pos+`@${q}`.length),f=G(x);if(f){I[I.length-1]={content:V.slice(E,C.pos)},E=C.pos+`@${q}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let d=F[P+1],$0=d?d.pos:V.length;I.push({content:V.slice(E,$0),ability:f.ability,type:f.type,id:f.id}),E=$0}}else E=C.pos+5}if(E<V.length){let P=I[I.length-1];if(F.length>0&&F[F.length-1].type==="else")I.push({content:V.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:V.slice(E)})}let D=Q(B.ability,B.type,B.id),y=K==="can"?D:!D,S="";if(y)S=I[0]?.content||"";else{let P=!1;for(let C=1;C<I.length;C++){let x=I[C];if(x.isFinalElse){S=x.content,P=!0;break}if(x.ability){let f=Q(x.ability,x.type,x.id);if(K==="can"?f:!f){S=x.content,P=!0;break}}}if(!P&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}J=J.substring(0,j)+S+J.substring(O+`@${W}`.length),z=!0}}return J}function y6($,Z,J){let Y=$;function X(Q,G,K,W,q){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=P1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=a1(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 V=Q.slice(_,O),F=B.expression,L=-1,w=0,N=0;while(N<V.length){let R=V.indexOf("@",N);if(R===-1)break;let A=V.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,N=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,N=R+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){L=R;break}N=R+1}try{let R=W(F.trim()),A;if(L!==-1){let M=V.slice(0,L),T=V.slice(L+5);A=R?M:T}else A=R?V:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(R){let A=R instanceof Error?R.message:String(R),M=J0(q,`Error processing @${G} directive: ${A}`,o.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return Y=X(Y,"isset","endisset",(Q)=>{let G=f1(Q,Z);return G!==void 0&&G!==null},"Isset"),Y=X(Y,"empty","endempty",(Q)=>{let G=f1(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"),Y}function P6($,Z,J){let Y=$,X="development";function Q(G,K,W,q){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${W}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let V=O.index,F=V+O[0].length;if(K==="env"){let D=B.substring(F).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;F+=D[0].length,q=X===D[2]}let L=1,w=F,N=-1;while(L>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),y=U.exec(B),S=D?D.index:1/0,P=y?y.index:1/0;if(S<P)L++,w=S+D[0].length;else if(P<1/0){if(L--,L===0){N=P;break}w=P+y[0].length}else break}if(N===-1){console.warn(`[stx] @${K} directive at position ${V} has no matching @${W} \u2014 the block was skipped.`);break}let R=B.substring(F,N),A=-1,M=0,T=0;while(T<R.length){let D=R.indexOf("@",T);if(D===-1)break;let y=R.substring(D);if(j.test(y)){M++,T=D+1;continue}if(H.test(y)){M--,T=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(y)){A=D;break}T=D+1}let I;if(A!==-1){let D=R.slice(0,A),y=R.slice(A+5);I=q?D:y}else I=q?R:"";let E=`@${W}`.length;B=B.substring(0,V)+I+B.substring(N+E),_=!0}return B}return Y=Q(Y,"env","endenv",!1),Y=Q(Y,"production","endproduction",X==="production"),Y=Q(Y,"development","enddevelopment",X==="development"),Y=Q(Y,"staging","endstaging",X==="staging"),Y=Q(Y,"testing","endtesting",X==="testing"),Y}var j7=b(()=>{wY();w1();X4();M0()});function AY($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function B7($,Z){if(!$)return Z?.nonceGenerator?.()??AY();let J=RY.get($);if(!J)J=Z?.nonceGenerator?.()??AY(),RY.set($,J);return J}function hj($,Z){let J=[];for(let[Y,X]of Object.entries($)){if(X===void 0||X===null)continue;if(typeof X==="boolean"){if(X)J.push(Y);continue}if(Array.isArray(X)){let Q=[...X];if(Z&&(Y==="script-src"||Y==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)J.push(`${Y} ${Q.join(" ")}`)}}return J.join("; ")}function MY($,Z){return`<meta http-equiv="Content-Security-Policy" content="${hj($,Z).replace(/&/g,"&").replace(/"/g,""")}">`}function TY($,Z,J){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=Z.useNonce?B7(J,Z):void 0,X=MY(Z.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
10365
10365
|
${X}`)}function IY($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,X)=>{if(X.includes("nonce="))return Y;return`<script nonce="${Z}"${X}>`}),J=J.replace(/<style([^>]*)>/gi,(Y,X)=>{if(X.includes("nonce="))return Y;return`<style nonce="${Z}"${X}>`}),J}function DY($,Z,J,Y){let X=$,Q=Y.csp;if(X=X.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?B7(Z,Q):void 0;return MY(Q.directives,G)}),X=X.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return B7(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=B7(Z,Q);return X}var RY;var kY=b(()=>{RY=new WeakMap});import uj from"crypto";function dj($=mj){let Z=uj.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return C6=Z,Z}function pj(){if(!C6)dj();return C6}function lj($=EY){let Z=pj();return`<input type="hidden" name="${$}" value="${Z}">`}function bY($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,J,Y)=>{return lj(Y||EY)})}var mj=40,EY="_token",C6=null;var SY=()=>{};async function yY($,Z,J,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let X=$;for(let Q of Y.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)X=await cj(X,Q,Z,J,Y);else X=await ij(X,Q,Z,J,Y)}return X}async function cj($,Z,J,Y,X){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,q=$,z=N5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),U=[],j=z.exec(q);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let V=B?PY(B):[],F=_.trim(),L=await G(F,V,J,Y);U.push({original:H,processed:L,startIndex:O})}catch(V){let F=V instanceof Error?V.message:String(V);if(X.debug)console.error(`Error processing custom directive @${Q}:`,V);U.push({original:H,processed:J0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${F}`,o.EVALUATION_ERROR),startIndex:O})}j=z.exec(q)}for(let H=U.length-1;H>=0;H--){let{original:B,processed:_}=U[H];q=q.replace(B,_)}return q}async function ij($,Z,J,Y,X){let{name:Q,handler:G}=Z,K=$,W=N5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],z=W.exec(K);while(z!==null){let[H,B=""]=z,_=z.index||0;try{let O=PY(B),V=await G("",O,J,Y);q.push({original:H,processed:V,startIndex:_})}catch(O){let V=O instanceof Error?O.message:String(O);if(X.debug)console.error(`Error processing custom directive @${Q}:`,O);q.push({original:H,processed:J0("CustomDirective",`Error in @${Q}(${B}): ${V}`,o.EVALUATION_ERROR),startIndex:_})}z=W.exec(K)}let U=N5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],J,Y);q.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(X.debug)console.error(`Error processing custom directive @${Q}:`,_);q.push({original:H,processed:J0("CustomDirective",`Error in @${Q}: ${O}`,o.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let H=q.length-1;H>=0;H--){let{original:B,processed:_}=q[H];K=K.replace(B,_)}return K}function PY($){if(!$.trim())return[];let Z=[],J="",Y=!1,X="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!Y)Y=!0,X=G;else if(G===X)Y=!1;else J+=G;else if(G===","&&!Y)Z.push(J.trim()),J="";else J+=G}if(J.trim())Z.push(J.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 CY=b(()=>{w1();R5()});function Q5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function oj($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,J=Z.appearance,Y=Z.colorMode;if(Q5(Z.storageKey,"storageKey"),!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(J.key,"appearance.key"),Q5(J.attribute,"appearance.attribute"),Q5(J.default,"appearance.default"),Q5(Y.key,"colorMode.key"),Q5(Y.attribute,"colorMode.attribute"),Q5(Y.default,"colorMode.default"),!xY.test(J.key)||!xY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!vY.test(J.attribute)||!vY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(J.allowed)||J.allowed.length===0||J.allowed.some((X)=>typeof X!=="string"||X.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!J.allowed.includes(J.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!nj.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:J.key,attribute:J.attribute,allowed:[...new Set(J.allowed)],default:J.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function sj($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function rj($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${sj($)};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 aj($,Z){let J=1,Y=null,X=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(X){X=!1;continue}if(Y){if(G==="\\")X=!0;else if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="(")J++;else if(G===")"&&--J===0)return Q}return-1}function fY($,Z){let J=$,Y=/@appearanceBootstrap\s*\(/g,X;while((X=Y.exec(J))!==null){let Q=X.index+X[0].length-1,G=aj(J,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=J.slice(Q+1,G).trim(),W=Y0(`(${K})`,Z),q=rj(oj(W));J=J.slice(0,X.index)+q+J.slice(G+1),Y.lastIndex=X.index+q.length}return J}var vY,xY,nj;var gY=b(()=>{M0();vY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,xY=/^[A-Za-z_$][\w$]*$/,nj=new Set(["light","dark","system"])});import tj from"crypto";function V0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function H7($,Z,J,Y){let X=$||Z;return J?`${X} ${Y}`:X}function o0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function S5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${V0(Z)}"`}function v6($,Z,J){if(!Z)return"";let Y="";if(!/\baria-invalid\s*=/i.test(J))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(J))Y+=` aria-describedby="${V0(`${o0($)}-error`)}"`;return Y}function ej(){return tj.randomUUID()}function _7($,Z){let J=$;return J=J.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let Y=ej();Z.csrf={token:Y}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),J=J.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,X)=>{let Q=X.toUpperCase();if(X&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${V0(Q)}">`;return Y}),J}function mY($,Z,J=uY){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"POST",U=K||W||"",j=g1(q),H=z.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${V0(B)}" action="${V0(U)}"${j?` ${j}`:""}>`;if(_+=`
|
|
10366
10366
|
${_7("@csrf",Z)}`,!["GET","POST"].includes(H))_+=`
|
|
10367
|
-
${_7(`@method('${H}')`,Z)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"",U=K||W||"",j=g1(q),H=M$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=T$(z,Z),F=j.match(/class=['"]([^'"]+)['"]/i),L=H7(F?F[1]:"",J.input,V,J.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(O)}" name="${V0(z)}"${S5(j,o0(z))} value="${V0(B)}" class="${L}"${v6(z,V,j)}${w?` ${w}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=g1(G),q=M$(Q,Z)||K.trim(),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=H7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${v6(Q,z,W)}${H?` ${H}`:""}>${V0(q)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=g1(G),q=M$(Q,Z),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=H7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(q)?q.some((L)=>String(L)===V):String(q)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${v6(Q,z,W)}${H?` ${H}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?o0(Q):`${o0(Q)}-${o0(W)}`,z=g1(K),U=M$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===W):U===!0||String(U)===W),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:J.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(Q)}"${S5(z,q)} value="${V0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=g1(K),q=M$(Q,Z),z=q!==void 0&&q===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:J.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(Q)}"${S5(W,`${o0(Q)}-${o0(G)}`)} value="${V0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=g1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",z=K.includes("multiple"),U=T$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=H7(j?j[1]:"",J.input,U,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${V0(Q)}"${S5(K,o0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${V0(q)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=g1(G),q=W.match(/class=['"]([^'"]+)['"]/i),z=q?q[1]:J.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(o0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),Y}function dY($,Z,J=uY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,X,Q)=>{try{if(T$(X,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return hY(X,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return hY(X,Z)}let q=W.trim();if(
|
|
10368
|
-
`),Y=[{obj:Z,indent:-1}];for(let X of J){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,z]=W,U=q.trim(),j=z.trim();if(j==="")K[U]={},Y.push({obj:K[U],indent:G});else K[U]=GB(j)}}return Z}function GB($){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 J=Number($);if(!Number.isNaN(J)&&$!=="")return J;return $}function KB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function WB($,Z){return JB($,Z)}function qB($,Z){for(let J of $){let Y=J.trim(),X=Y.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=Y.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 zB($,Z={}){return iY($,Z)}function iY($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let X=UB($,Y);if(X===-1){J+=$[Y],Y++;continue}let Q=$.slice(Y+1,X);J+=jB(Q,Z),Y=X+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")J+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")J+=$[Y+1],Y+=2;else J+=$[Y],Y++;else J+=$[Y],Y++;return J}function UB($,Z){let J=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")J++;else if($[Y]==="}"){if(J--,J===0)return Y}return-1}function jB($,Z){let J=BB($);if(J.length===0)return`{${$}}`;let Y=J[0].trim(),X=Z[Y];if(J.length===1)return X!==void 0?String(X):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return HB(X,J.slice(2).join(","),Z);case"select":return OB(X,J.slice(2).join(","));case"selectordinal":return FB(X,J.slice(2).join(","));case"number":return LB(X,J[2]?.trim());case"date":return wB(X,J[2]?.trim());case"time":return NB(X,J[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function BB($){let Z=[],J="",Y=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")Y++,J+=Q;else if(Q==="}")Y--,J+=Q;else if(Q===","&&Y===0)Z.push(J),J="";else J+=Q}if(J)Z.push(J);return Z}function HB($,Z,J){let Y=Number($)||0,X=d6(Z),Q=`=${Y}`;if(X[Q])return f6(X[Q],Y,J);let G=_B(Y);if(X[G])return f6(X[G],Y,J);if(X.other)return f6(X.other,Y,J);return String(Y)}function f6($,Z,J){let Y=$.replace(/#/g,String(Z));return iY(Y,J)}function _B($){let Z=Math.abs($),J=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function OB($,Z){let J=String($||""),Y=d6(Z);if(Y[J])return Y[J];return Y.other||String($)}function FB($,Z){let J=Number($)||0,Y=d6(Z),X=VB(J);if(Y[X])return Y[X].replace(/#/g,String(J));if(Y.other)return Y.other.replace(/#/g,String(J));return String(J)}function VB($){let Z=Math.abs($),J=Z%10,Y=Z%100;if(J===1&&Y!==11)return"one";if(J===2&&Y!==12)return"two";if(J===3&&Y!==13)return"few";return"other"}function d6($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function LB($,Z){let J=Number($);if(Number.isNaN(J))return String($);switch(Z){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function wB($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return J.toLocaleDateString(void 0,Y)}function NB($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return J.toLocaleTimeString(void 0,Y)}function RB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function lY($,Z,J=!0,Y={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return J?$:"";let G=String(Q);if(RB(G))return zB(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),W=G.split("|");G=qB(W,K)}for(let[K,W]of Object.entries(Y)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function nY($,Z,J,Y){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...m6,...Y.i18n},K=await WB(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await cY(X,Q,async(z,U,j,H,B)=>{try{let _={};if(j)try{let V=[()=>JSON.parse(j),()=>{let F=`{"data":${j}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return A0(j,Z)}];for(let F of V)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(V){if(Y.debug)console.error("Error parsing parameters for @translate directive:",V)}return lY(U,K,G.fallbackToKey,_)||H.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return J0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...X.matchAll(W)];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 X=await cY(X,/@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}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return A0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return lY(U,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return J0("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function cY($,Z,J){let Y=[];return $.replace(Z,(Q,...G)=>{let K=J(Q,...G).then((W)=>({match:Q,replacement:W}));return Y.push(K),Q}),(await Promise.all(Y)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var I$,m6,h6,D$,x6;var oY=b(()=>{w1();M0();m6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},h6={},D$={},x6={}});var c6={};
|
|
10367
|
+
${_7(`@method('${H}')`,Z)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(X,Q,G,K,W,q="")=>{let z=Q||G||"",U=K||W||"",j=g1(q),H=M$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=T$(z,Z),F=j.match(/class=['"]([^'"]+)['"]/i),L=H7(F?F[1]:"",J.input,V,J.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(O)}" name="${V0(z)}"${S5(j,o0(z))} value="${V0(B)}" class="${L}"${v6(z,V,j)}${w?` ${w}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(X,Q,G="",K="")=>{let W=g1(G),q=M$(Q,Z)||K.trim(),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=H7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${v6(Q,z,W)}${H?` ${H}`:""}>${V0(q)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(X,Q,G="",K)=>{let W=g1(G),q=M$(Q,Z),z=T$(Q,Z),U=W.match(/class=['"]([^'"]+)['"]/i),j=H7(U?U[1]:"",J.input,z,J.inputError),H=W.replace(/class=['"][^'"]+['"]/i,""),B=K;if(q!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(q)?q.some((L)=>String(L)===V):String(q)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${V0(Q)}"${S5(W,o0(Q))} class="${j}"${v6(Q,z,W)}${H?` ${H}`:""}>${B}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=G===void 0?"1":G,q=G===void 0?o0(Q):`${o0(Q)}-${o0(W)}`,z=g1(K),U=M$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===W):U===!0||String(U)===W),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:J.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(Q)}"${S5(z,q)} value="${V0(W)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G,K="")=>{let W=g1(K),q=M$(Q,Z),z=q!==void 0&&q===G,U=W.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:J.checkInput,H=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(Q)}"${S5(W,`${o0(Q)}-${o0(G)}`)} value="${V0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(X,Q,G="")=>{let K=g1(G),W=K.match(/accept=['"]([^'"]+)['"]/i),q=W?W[1]:"",z=K.includes("multiple"),U=T$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=H7(j?j[1]:"",J.input,U,J.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${V0(Q)}"${S5(K,o0(Q))}`,`class="${H}"`];if(q)_.push(`accept="${V0(q)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(X,Q,G="",K)=>{let W=g1(G),q=W.match(/class=['"]([^'"]+)['"]/i),z=q?q[1]:J.label,U=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(o0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),Y}function dY($,Z,J=uY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,X,Q)=>{try{if(T$(X,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return hY(X,Z);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(X);return hY(X,Z)}let q=W.trim();if(W0(q)){let z=Y0(q,Z);return z!==void 0?String(z):q}return q}catch{return W}});return`<div id="${V0(`${o0(X)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),Y}})}function T$($,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 hY($,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 J=Z.errors[$];return Array.isArray(J)?J[0]:String(J)}return""}function M$($,Z){let J;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let Y=$.slice(0,-2);if(J=Z[Y],J!==void 0)return J}return Z[$]}function g1($){if(!$.trim())return"";let Z=[],J=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,X;while((X=Y.exec(J))!==null){let[,Q,,G]=X;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var uY;var pY=b(()=>{M0();uY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import g6 from"path";async function $B(){if(I$!==void 0)return I$;try{I$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{I$=null}return I$}function ZB($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function JB($,Z){if({...m6,...Z.i18n}.cache&&h6[$]){let X=h6[$],Q=Z.i18n?.cacheMaxAge??0;if(!ZB(X,Q))return X.translations}if(D$[$]?.state==="loading")return D$[$].promise;x6[$]="loading";let Y=u6($,Z).then((X)=>{return x6[$]="loaded",delete D$[$],X}).catch((X)=>{throw x6[$]="error",D$[$]={promise:Y,state:"error",error:X instanceof Error?X:Error(String(X))},X});return D$[$]={promise:Y,state:"loading"},Y}async function u6($,Z){let J={...m6,...Z.i18n},Y=g6.isAbsolute(J.translationsDir)?J.translationsDir:g6.resolve(Z.root||process.cwd(),J.translationsDir);try{let X=await $B(),Q=X?await X($,{translationsDir:Y,defaultLocale:J.defaultLocale,sources:KB(J.format)}):await YB($,J,Y);if(Q===void 0){if($!==J.defaultLocale)return u6(J.defaultLocale,Z);return{}}let G=Q;if(J.cache)h6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(X){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,X);if($!==J.defaultLocale)return u6(J.defaultLocale,Z);return{}}}async function YB($,Z,J){let Y=g6.join(J,`${$}${XB(Z.format)}`);try{let X=await import(Y);return X.default||X}catch(X){try{let Q=await Bun.file(Y).text();if(Z.format==="yaml"||Z.format==="yml")return QB(Q);if(Z.format==="json")return JSON.parse(Q);throw X}catch{return}}}function XB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function QB($){let Z={},J=$.split(`
|
|
10368
|
+
`),Y=[{obj:Z,indent:-1}];for(let X of J){let Q=X.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=G)Y.pop();let K=Y[Y.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,q,z]=W,U=q.trim(),j=z.trim();if(j==="")K[U]={},Y.push({obj:K[U],indent:G});else K[U]=GB(j)}}return Z}function GB($){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 J=Number($);if(!Number.isNaN(J)&&$!=="")return J;return $}function KB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function WB($,Z){return JB($,Z)}function qB($,Z){for(let J of $){let Y=J.trim(),X=Y.match(/^\{(\d+)\}\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10);if(Z===G)return X[2];continue}let Q=Y.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 zB($,Z={}){return iY($,Z)}function iY($,Z){let J="",Y=0;while(Y<$.length)if($[Y]==="{"){let X=UB($,Y);if(X===-1){J+=$[Y],Y++;continue}let Q=$.slice(Y+1,X);J+=jB(Q,Z),Y=X+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")J+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")J+=$[Y+1],Y+=2;else J+=$[Y],Y++;else J+=$[Y],Y++;return J}function UB($,Z){let J=0;for(let Y=Z;Y<$.length;Y++)if($[Y]==="{")J++;else if($[Y]==="}"){if(J--,J===0)return Y}return-1}function jB($,Z){let J=BB($);if(J.length===0)return`{${$}}`;let Y=J[0].trim(),X=Z[Y];if(J.length===1)return X!==void 0?String(X):`{${Y}}`;switch(J[1].trim().toLowerCase()){case"plural":return HB(X,J.slice(2).join(","),Z);case"select":return OB(X,J.slice(2).join(","));case"selectordinal":return FB(X,J.slice(2).join(","));case"number":return LB(X,J[2]?.trim());case"date":return wB(X,J[2]?.trim());case"time":return NB(X,J[2]?.trim());default:return X!==void 0?String(X):`{${$}}`}}function BB($){let Z=[],J="",Y=0;for(let X=0;X<$.length;X++){let Q=$[X];if(Q==="{")Y++,J+=Q;else if(Q==="}")Y--,J+=Q;else if(Q===","&&Y===0)Z.push(J),J="";else J+=Q}if(J)Z.push(J);return Z}function HB($,Z,J){let Y=Number($)||0,X=d6(Z),Q=`=${Y}`;if(X[Q])return f6(X[Q],Y,J);let G=_B(Y);if(X[G])return f6(X[G],Y,J);if(X.other)return f6(X.other,Y,J);return String(Y)}function f6($,Z,J){let Y=$.replace(/#/g,String(Z));return iY(Y,J)}function _B($){let Z=Math.abs($),J=Math.floor(Z),Y=String($).includes(".")?String($).split(".")[1].length:0;if(J===1&&Y===0)return"one";return"other"}function OB($,Z){let J=String($||""),Y=d6(Z);if(Y[J])return Y[J];return Y.other||String($)}function FB($,Z){let J=Number($)||0,Y=d6(Z),X=VB(J);if(Y[X])return Y[X].replace(/#/g,String(J));if(Y.other)return Y.other.replace(/#/g,String(J));return String(J)}function VB($){let Z=Math.abs($),J=Z%10,Y=Z%100;if(J===1&&Y!==11)return"one";if(J===2&&Y!==12)return"two";if(J===3&&Y!==13)return"few";return"other"}function d6($){let Z={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=J.exec($);while(Y!==null)Z[Y[1]]=Y[2],Y=J.exec($);return Z}function LB($,Z){let J=Number($);if(Number.isNaN(J))return String($);switch(Z){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function wB($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return J.toLocaleDateString(void 0,Y)}function NB($,Z){let J=$ instanceof Date?$:new Date(String($));if(Number.isNaN(J.getTime()))return String($);let Y={};switch(Z){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return J.toLocaleTimeString(void 0,Y)}function RB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function lY($,Z,J=!0,Y={}){let X=$.split("."),Q=Z;for(let K of X){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return J?$:"";let G=String(Q);if(RB(G))return zB(G,Y);if(G.includes("|")&&"count"in Y){let K=Number(Y.count),W=G.split("|");G=qB(W,K)}for(let[K,W]of Object.entries(Y)){let q=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${q}`,"g"),String(W))}return G}async function nY($,Z,J,Y){let X=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...m6,...Y.i18n},K=await WB(G.locale,Y);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,X=await cY(X,Q,async(z,U,j,H,B)=>{try{let _={};if(j)try{let V=[()=>JSON.parse(j),()=>{let F=`{"data":${j}}`,L=JSON.parse(F);return typeof L.data==="object"?L.data:{}},()=>{return A0(j,Z)}];for(let F of V)try{if(_=F(),Object.keys(_).length>0)break}catch{}}catch(V){if(Y.debug)console.error("Error parsing parameters for @translate directive:",V)}return lY(U,K,G.fallbackToKey,_)||H.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return J0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${X.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...X.matchAll(W)];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 X=await cY(X,/@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}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return A0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return lY(U,K,G.fallbackToKey,B)}catch(B){if(Y.debug)console.error("Error processing @translate directive:",B);return J0("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),X}async function cY($,Z,J){let Y=[];return $.replace(Z,(Q,...G)=>{let K=J(Q,...G).then((W)=>({match:Q,replacement:W}));return Y.push(K),Q}),(await Promise.all(Y)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var I$,m6,h6,D$,x6;var oY=b(()=>{w1();M0();m6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},h6={},D$={},x6={}});var c6={};t(c6,{streamingSuspenseDirective:()=>aY,streamToResponse:()=>CB,streamTemplateSimple:()=>bB,streamTemplate:()=>MB,renderStreamingPage:()=>IB,registerStreamingDirectives:()=>yB,processStreamDirectives:()=>kB,processSectionDirectives:()=>PB,islandDirective:()=>tY,generateHydrationRuntime:()=>vB,extractStreamBoundaries:()=>EB,createStreamRenderer:()=>SB,buildSuspenseResolveScript:()=>l6,SUSPENSE_RESOLVER_RUNTIME:()=>rY});import O7 from"path";function AB($){let Z=[],J=0,Y;sY.lastIndex=0;while((Y=sY.exec($))!==null){if(Y.index>J){let G=$.slice(J,Y.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let X=Y[1],Q=Y[2];Z.push({type:"suspense",name:X,content:Q}),J=Y.index+Y[0].length}if(J<$.length){let X=$.slice(J);if(X.trim())Z.push({type:Z.length===0?"shell":"content",content:X})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function MB($,Z={},J={}){let Y={...Y5,...J,streaming:{...p6,...J.streaming}},X=Y.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),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:O7.dirname($)};if(W.trim())await r1(W,z,$);let U=AB(q),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=Y.streaming?.strategy||"auto",_=new RegExp(G5.source,"g");if(!(B!=="manual"&&_.test(q))){let V=await F0(q,z,$,Y,j);for(let F=0;F<V.length;F+=X)Q.enqueue(V.slice(F,F+X)),await new Promise((L)=>setTimeout(L,0))}else{let V=[],F=new RegExp(G5.source,"g"),L;while((L=F.exec(q))!==null)V.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let w=0;for(let N of V){if(N.start>w){let A=q.slice(w,N.start);if(A.trim()){let M=await F0(A,z,$,Y,j);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let R=await F0(N.content,z,$,Y,j);Q.enqueue(R),await new Promise((A)=>setTimeout(A,0)),w=N.end}if(w<q.length){let N=q.slice(w);if(N.trim()){let R=await F0(N,z,$,Y,j);Q.enqueue(R)}}}}else{let B=new Map;for(let O of U)if(O.type==="shell"||O.type==="content"){let V=await F0(O.content,z,$,Y,j);Q.enqueue(V)}else if(O.type==="suspense"&&O.name){let V=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${V}" data-suspense="${O.name}" style="display:contents;">
|
|
10369
10369
|
<template data-suspense-fallback>Loading...</template>
|
|
10370
10370
|
</div>`),B.set(O.name,F0(O.content,z,$,Y,j))}Q.enqueue(`
|
|
10371
10371
|
<script>
|
|
@@ -10388,8 +10388,8 @@ ${X}`)}function IY($,Z){let J=$;return J=J.replace(/<script(?![^>]*\ssrc=)([^>]*
|
|
|
10388
10388
|
window.__stxSuspense.resolve('${$}', \`${Y}\`);
|
|
10389
10389
|
</script>`}catch(J){let Y=J instanceof Error?J.message:String(J);return`
|
|
10390
10390
|
<script>
|
|
10391
|
-
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${
|
|
10392
|
-
</script>`}}function TB($,Z,J){if(!Z||Z<=0)return $;let Y,X=new Promise((Q,G)=>{Y=setTimeout(()=>G(Error(`streaming boundary "${J}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(Y))}function IB($,Z=[],J={}){let Y=J.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(rY),await Promise.all(Z.map(async(Q)=>{let G=TB(Q.render(),Y,Q.id);X.enqueue(await l6(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function kB($,Z){return $.replace(DB,(J,Y,X)=>{let Q=Y.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function EB($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).filter(([,Y])=>typeof Y==="function");return J.length>0?J.map(([Y,X])=>({id:Y,render:X})):void 0}async function bB($,Z={},J={}){let Y={...Y5,...J,streaming:{...p6,...J.streaming}},X=Y.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),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:O7.dirname($)};if(W.trim())await r1(W,z,$);let U=new Set,j=Y.streaming?.strategy||"auto",H=new RegExp(G5.source,"g");if(!(j!=="manual"&&H.test(q))){let _=await F0(q,z,$,Y,U);for(let O=0;O<_.length;O+=X)Q.enqueue(_.slice(O,O+X))}else{let _=[],O=new RegExp(G5.source,"g"),V;while((V=O.exec(q))!==null)_.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let F=0;for(let L of _){if(L.start>F){let N=q.slice(F,L.start);if(N.trim()){let R=await F0(N,z,$,Y,U);Q.enqueue(R)}}let w=await F0(L.content,z,$,Y,U);Q.enqueue(w),F=L.end}if(F<q.length){let L=q.slice(F);if(L.trim()){let w=await F0(L,z,$,Y,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function SB($,Z={}){let J={...Y5,...Z,streaming:{...p6,...Z.streaming}},Y=await Bun.file($).text(),X=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;G5.lastIndex=0;while((q=G5.exec(G))!==null){let j=q[1],H=q[2];W[j]=H}let z=G.replace(G5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:O7.dirname($)};return await r1(Q,H,$),F0(z,H,$,J,new Set)},renderSection:async(j,H={})=>{try{if(!W[j])return`<div class="error-message">Section "${
|
|
10391
|
+
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${t0(Y)}</div>');
|
|
10392
|
+
</script>`}}function TB($,Z,J){if(!Z||Z<=0)return $;let Y,X=new Promise((Q,G)=>{Y=setTimeout(()=>G(Error(`streaming boundary "${J}" timed out after ${Z}ms`)),Z)});return Promise.race([$,X]).finally(()=>clearTimeout(Y))}function IB($,Z=[],J={}){let Y=J.timeoutMs??0;return new ReadableStream({async start(X){try{if(X.enqueue($),Z.length>0)X.enqueue(rY),await Promise.all(Z.map(async(Q)=>{let G=TB(Q.render(),Y,Q.id);X.enqueue(await l6(Q.id,G))}));X.close()}catch(Q){X.error(Q)}}})}function kB($,Z){return $.replace(DB,(J,Y,X)=>{let Q=Y.trim(),G=X.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function EB($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let J=Object.entries(Z).filter(([,Y])=>typeof Y==="function");return J.length>0?J.map(([Y,X])=>({id:Y,render:X})):void 0}async function bB($,Z={},J={}){let Y={...Y5,...J,streaming:{...p6,...J.streaming}},X=Y.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),W=K?K[1]:"",q=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:O7.dirname($)};if(W.trim())await r1(W,z,$);let U=new Set,j=Y.streaming?.strategy||"auto",H=new RegExp(G5.source,"g");if(!(j!=="manual"&&H.test(q))){let _=await F0(q,z,$,Y,U);for(let O=0;O<_.length;O+=X)Q.enqueue(_.slice(O,O+X))}else{let _=[],O=new RegExp(G5.source,"g"),V;while((V=O.exec(q))!==null)_.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let F=0;for(let L of _){if(L.start>F){let N=q.slice(F,L.start);if(N.trim()){let R=await F0(N,z,$,Y,U);Q.enqueue(R)}}let w=await F0(L.content,z,$,Y,U);Q.enqueue(w),F=L.end}if(F<q.length){let L=q.slice(F);if(L.trim()){let w=await F0(L,z,$,Y,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function SB($,Z={}){let J={...Y5,...Z,streaming:{...p6,...Z.streaming}},Y=await Bun.file($).text(),X=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=X?X[1]:"",G=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},q;G5.lastIndex=0;while((q=G5.exec(G))!==null){let j=q[1],H=q[2];W[j]=H}let z=G.replace(G5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:O7.dirname($)};return await r1(Q,H,$),F0(z,H,$,J,new Set)},renderSection:async(j,H={})=>{try{if(!W[j])return`<div class="error-message">Section "${t0(j)}" not found in template "${t0($)}"</div>`;let B={...H,__filename:$,__dirname:O7.dirname($)};await r1(Q,B,$);let _=new Set;return await F0(W[j],B,$,J,_)}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",_,$,W[j]||"",0,W[j]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function yB($={}){let Z=[];if($.streaming?.enabled)Z.push(aY);if($.hydration?.enabled)Z.push(tY);return Z}async function PB($,Z,J,Y={}){return $}function CB($,Z={}){let J=new TextEncoder,Y=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(J.encode(Q))}})),X=new Headers(Z.headers);if(!X.has("Content-Type"))X.set("Content-Type","text/html; charset=utf-8");if(!X.has("Transfer-Encoding"))X.set("Transfer-Encoding","chunked");if(!X.has("X-Content-Type-Options"))X.set("X-Content-Type-Options","nosniff");if(!X.has("X-Accel-Buffering"))X.set("X-Accel-Buffering","no");return new Response(Y,{...Z,headers:X})}function vB($={mode:"full"}){let{mode:Z,components:J={},dynamicImports:Y=!0}=$,X=Object.entries(J).map(([Q,G])=>`'${Q}': ${Y?`() => import('${G}')`:`require('${G}')`}`).join(`,
|
|
10393
10393
|
`);if(Z==="loader")return`
|
|
10394
10394
|
(function() {
|
|
10395
10395
|
window.__stx = window.__stx || {};
|
|
@@ -10551,12 +10551,12 @@ else {
|
|
|
10551
10551
|
}
|
|
10552
10552
|
};
|
|
10553
10553
|
})();
|
|
10554
|
-
</script>`,DB,aY,tY;var i6=b(()=>{V1();
|
|
10554
|
+
</script>`,DB,aY,tY;var i6=b(()=>{V1();q1();I4();I0();p6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},G5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,sY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;DB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;aY={name:"suspense",hasEndTag:!0,handler:($,Z,J,Y)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let X=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${X} -->${$}<!-- @endsuspense:${X} -->`}},tY={name:"island",hasEndTag:!0,handler:($,Z,J,Y)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let X=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${X}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",q=K?$.replace(K[0],""):$;return`<div data-island="${X}" data-island-id="${G}" data-priority="${Q}">
|
|
10555
10555
|
${q}
|
|
10556
10556
|
<script type="application/json" data-island-props="${G}">
|
|
10557
10557
|
${W?`{${W}}`:"{}"}
|
|
10558
10558
|
</script>
|
|
10559
|
-
</div>`}}});var ZX={};
|
|
10559
|
+
</div>`}}});var ZX={};t(ZX,{warnUnbalancedTags:()=>n6,findUnbalancedTags:()=>$X});function y5($){return $.replace(/[^\n]/g," ")}function $X($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,y5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,y5).replace(/<!--[\s\S]*?-->/g,y5).replace(/\{\{\{[\s\S]*?\}\}\}/g,y5).replace(/\{\{[\s\S]*?\}\}/g,y5).replace(/\{!![\s\S]*?!!\}/g,y5),J=new Map,Y=new Map,X=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=X.exec(Z))!==null){let K=Q[1]==="/",W=Q[2],q=Q[3]==="/";if(xB.has(W.toLowerCase()))continue;if(q)continue;if(K)Y.set(W,(Y.get(W)??0)+1);else{let z=J.get(W);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
|
|
10560
10560
|
`).length;J.set(W,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...J.keys(),...Y.keys()])){if(fB.has(K.toLowerCase()))continue;let W=J.get(K)?.count??0,q=Y.get(K)??0;if(W!==q)G.push({tag:K,opened:W,closed:q,firstOpenLine:J.get(K)?.firstLine??0})}return G}function n6($,Z){let J;try{J=$X($)}catch{return}if(J.length===0)return;let Y=`${Z}:${$.length}`;if(eY.has(Y))return;eY.add(Y);let X=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:W}of J)if(G>K){let q=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${X}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var xB,fB,eY;var o6=b(()=>{xB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),fB=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);eY=new Set});import s0 from"path";import s6 from"fs";function JX($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function YX($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class XX{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,J,Y){let X=$.endsWith(".stx")?$.slice(0,-4):$,Q=Y?.__importedComponents;if(Q){let H=[X,X.toLowerCase(),JX(X),YX(X)];for(let B of H)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${X}.stx`,`${JX(X)}.stx`,`${YX(X)}.stx`])];if(X.startsWith("./")||X.startsWith("../")){let H=s0.resolve(s0.dirname(Z),`${X}.stx`);if(await c(H))return H;return null}let K=[],W=J.componentsDir||"",q=Y?.__originalFilePath;if(q)K.push(s0.join(s0.dirname(q),"components"));if(W)K.push(W);let z=s0.join(s0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),j=[s0.resolve(U,"src/components"),s0.resolve(U,"components"),s0.resolve(import.meta.dir,"components")];for(let H of j)if(!K.includes(H))K.push(H);for(let H of K){if(!H)continue;for(let B of G){let _=s0.join(H,B);if(await c(_))return _}try{if(!s6.statSync(H,{throwIfNoEntry:!1})?.isDirectory())continue;let _=s6.readdirSync(H,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let V=s0.join(H,O.name);for(let F of G){let L=s0.join(V,F);if(await c(L))return L}}}catch{}}return null}}var u0;var r6=b(()=>{I0();u0=new XX});function b0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function QX($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var K5="\x00stx-boolean-attribute";function P5($,Z){let J=[];for(let[Y,X]of Object.entries($.static)){if(Z.has(Y))continue;let Q=$.staticNames?.[Y]??Y;if(typeof X==="boolean"){if(X)J.push(b0(Q));continue}if(X===K5){J.push(b0(Q));continue}J.push(`${b0(Q)}="${b0(QX(String(X)))}"`)}return J}var F7=()=>{};function k$($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function gB($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var a6;var t6=b(()=>{F7();a6={name:"StxLink",aliases:["stx-link"],render($,Z,J){let Y=gB($),X=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(Y.reactive)W.push(`:href="${k$(Y.value)}"`);else W.push(`href="${k$(Y.value)}"`);if(X)W.push(`class="${k$(X)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${k$(Q)}"`),W.push(`data-stx-exact-active-class="${k$(G)}"`),K)W.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...P5($,q)),`<a ${W.join(" ")}>${Z}</a>`}}});function S0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function x0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J;return}function $9($,Z,J=!1){let Y=$.serverDynamic[Z];if(Y!==void 0)return Y!==!1&&Y!=="false";let X=$.static[Z];if(X!==void 0)return X!=="false"&&X!==!1;return J}function GX($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),J=[];for(let Y of Z)if(Y.includes(":")){let[X,Q]=Y.split(":"),G=hB[X];if(G)J.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(X);if(!Number.isNaN(K))J.push(`(max-width: ${K}px) ${Q}`)}}else J.push(Y);return J.join(", ")}function Z9($,Z,J,Y){return Z.map((X)=>`${E$($,X,void 0,J,Y)} ${X}w`).join(", ")}function uB($,Z,J,Y,X){return Z.map((Q)=>{let G=J?J*Q:void 0;return`${E$($,G,void 0,Y,X)} ${Q}x`}).join(", ")}function E$($,Z,J,Y,X){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(J)Q.push(`h_${J}`);if(X)Q.push(`f_${X}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(Y==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(J)Q.set("h",String(J));if(X)Q.set("fm",X);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(Y==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(J)Q.set("height",String(J));if(X)Q.set("format",X);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function mB($,Z,J="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${J}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var hB,e6,J9;var Y9=b(()=>{F7();hB={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},e6=[320,640,768,1024,1280,1536,1920];J9={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,J){let Y=x0($,"src")||"",X=x0($,"alt")||"",Q=x0($,"width"),G=x0($,"height"),K=x0($,"sizes"),W=x0($,"srcset"),q=x0($,"densities"),z=x0($,"format"),U=x0($,"placeholder"),j=x0($,"placeholderColor")||"#e5e7eb",H=x0($,"provider"),B=x0($,"class")||x0($,"className")||"",_=x0($,"style")||"",O=x0($,"quality"),V=$9($,"lazy",!0),F=$9($,"preload",!1),L=$9($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,N=G?Number.parseInt(G):void 0,R=W||"",A="";if(!R&&K)R=Z9(Y,e6,H,z),A=GX(K);else if(!R&&q){let S=q.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));R=uB(Y,S,w,H,z)}else if(K)A=GX(K);let M=[];if(_)M.push(_);if(w&&N)M.push(`aspect-ratio:${w}/${N}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=mB(w||16,N||9,j);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${S0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=E$(Y,w,N,H,z),I=[];if(I.push(`src="${S0(T)}"`),I.push(`alt="${S0(X)}"`),Q)I.push(`width="${S0(Q)}"`);if(G)I.push(`height="${S0(G)}"`);if(V)I.push('loading="lazy"');if(I.push('decoding="async"'),B)I.push(`class="${S0(B)}"`);if(M.length>0)I.push(`style="${S0(M.join(";"))}"`);if(R)I.push(`srcset="${S0(R)}"`);if(A)I.push(`sizes="${S0(A)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...P5($,E));let D=`<img ${I.join(" ")} />`,y="";if(F){let P=z==="webp"?"image/webp":z==="avif"?"image/avif":"";y=`<link rel="preload" as="image" href="${S0(T)}"${P?` type="${P}"`:""}${R?` imagesrcset="${S0(R)}"`:""}${A?` imagesizes="${S0(A)}"`:""} />
|
|
10561
10561
|
`}if(L){let S=[];if(z==="avif"||z==="auto"){let P=E$(Y,w,N,H,"avif"),C=R?Z9(Y,e6,H,"avif"):`${P}`;S.push(`<source type="image/avif" srcset="${S0(C)}"${A?` sizes="${S0(A)}"`:""} />`)}if(z==="webp"||z==="auto"){let P=E$(Y,w,N,H,"webp"),C=R?Z9(Y,e6,H,"webp"):`${P}`;S.push(`<source type="image/webp" srcset="${S0(C)}"${A?` sizes="${S0(A)}"`:""} />`)}return`${y}<picture>
|
|
10562
10562
|
${S.join(`
|
|
@@ -10595,8 +10595,8 @@ ${D}
|
|
|
10595
10595
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
10596
10596
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
10597
10597
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
10598
|
-
</style>`}}});import{existsSync as lB,readFileSync as cB}from"fs";function iB($){if(jX.has($))return;jX.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function nB($){let Z=process.cwd();for(let J 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(lB(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return
|
|
10599
|
-
`||M==="\t")V++;F=R+_.length}else{if(V--,V===0){L=A;break}F=A+O.length}}if(L===-1){X=j;continue}let w=$.slice(j,L),N=L+O.length;Y.push({fullMatch:$.slice(Q,N),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:N,isSelfClosing:!1}),X=N}}return Y}function VX($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function LX($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}var wX=b(()=>{M0();I0();n1()});var DX={};a(DX,{processESImports:()=>TX,processComponents:()=>M7});import A7 from"fs";import i0 from"path";function rB($,Z,J){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(b8),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,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(Y.static[q]=W,q!==K)Y.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){Y.events[q]=W;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));Y.serverDynamic[z]=LX(W,J);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),U=W===K5?z:W;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=U;continue}try{if(!K0(U)){if(J.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);Y.clientReactive[z]=U;continue}let j=Object.keys(Z),B=W0(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((F)=>!O.has(F)&&!j.includes(F))){Y.clientReactive[z]=U;continue}}Y.serverDynamic[z]=B}catch{Y.clientReactive[z]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(K0(U)){let H=W0(U,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${U}`);G(q,W)}}catch(U){if(J.debug)console.error(`Error evaluating expression for ${q}:`,U);G(q,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!K0(B)){if(J.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=W0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(J.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,U)}continue}G(q,W===K5?"true":VX(W))}return Y}function aB($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let X="";while(J<Y&&!/[\s=]/.test($[J]))X+=$[J],J++;if(!X)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let Q="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,Q+=$[J],J++;continue}if(K===G){J++;break}Q+=K,J++}}else while(J<Y&&!/\s/.test($[J]))Q+=$[J],J++;Z[X]=Q}else Z[X]=K5}return Z}function RX($){return Object.entries($).map(([Z,J])=>J===K5?Z:`${Z}="${tB(J)}"`).join(" ")}function tB($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function eB($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=J.exec($))!==null){let X=Y[1];if(u0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function $H($){let Z=AX.get($);if(Z)return Z;let J=new Map,Y=[i0.join($,"src"),i0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=A7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=i0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!J.has(z))J.set(z,q);let U=z.toLowerCase();if(!J.has(U))J.set(U,q);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!J.has(j))J.set(j,q)}}}for(let Q of Y)if(X(Q,0),J.size>0)break;return AX.set($,J),J}function ZH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let Y=i0.join(J,"node_modules",$);try{if(A7.statSync(Y).isDirectory())return Y}catch{}let X=i0.dirname(J);if(X===J)return null;J=X}}async function TX($,Z,J,Y,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=i0.dirname(J),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,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,V,F,L]=B,w=null,N=null;if(L.startsWith(".")||L.startsWith("/")){let M=i0.resolve(G,L);if(M.endsWith(".stx"))N=M;else{let T=`${M}.stx`;try{if(A7.statSync(T).isFile())N=T}catch{try{if(A7.statSync(M).isDirectory())w=M}catch{}}}}else w=ZH(L,G);if(!w&&!N)continue;let R=!1,A=(M,T)=>{Q.set(M,T),Q.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,T),X.add(T)};if(F&&N)A(F,N),R=!0;else if(V){let M=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?$H(w):null;for(let{source:I,local:E}of M){let D=null;if(N)D=N;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(E,D),R=!0}}if(R)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;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 JH($,Z,J,Y,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,z]=W,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((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,F=[i0.resolve(i0.dirname(J),`${j}.stx`),i0.resolve(i0.dirname(J),j),i0.resolve(Y.componentsDir||"components",`${j}.stx`),i0.resolve(Y.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){V=L;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let L=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,V),X.add(V),Y.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function YH($,Z,J,Y,X){let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let z=q.index,U=z+q[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){W.lastIndex=0;continue}let V=O[1],F,L=B.slice(O[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let N={};if(F)try{N=A0(F,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let R="",A=_,T=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),A=_+T[0].length;let I=await e1(V,N,R,G,Z,J,Y,K,X);Q=Q.substring(0,z)+I+Q.substring(A),W.lastIndex=0}return Q}async function XH($,Z,J,Y,X){if(!$)return $;let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=E1(Q);return Q=W.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,sB),Q=K$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let V=H,F=FX(V,B,O);for(let L=F.length-1;L>=0;L--){let w=F[L],N=_?R7(w.tagName):w.tagName,R=aB(w.attributes),A=rB(R,Z,Y),M=u0.getBuiltin(w.tagName),T=M?await T4(N,G,Z,J,Y):!1;if(M&&!T){let y={context:Z,filePath:J,options:Y,dependencies:X},S=M.render(A,w.content,y);if(Object.keys(A.clientReactive).length>0)S=MX(S,A.clientReactive);if(Object.keys(A.events).length>0){let P=RX(A.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}V=V.substring(0,w.startIndex)+S+V.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await T4(N,G,Z,J,Y))continue;let I={};for(let[y,S]of Object.entries(A.static))I[y]=S;for(let[y,S]of Object.entries(A.serverDynamic))I[y]=S;let D=await e1(N,I,w.content,G,Z,J,Y,K,X);if(Object.keys(A.clientReactive).length>0)D=MX(D,A.clientReactive);if(Object.keys(A.events).length>0){let y=IX(D);if(y){let S=RX(A.events),P=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${P}" ${S}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function MX($,Z){let J=new Set(["if","for"]),Y=new Set(["show"]),X=Object.entries(Z).filter(([z])=>!J.has(z)),Q=X.filter(([z])=>!Y.has(z)).map(([z])=>R7(z)).join(" "),G=$,K=X.length>0?IX(G):null;if(K){let z=X.map(([j,H])=>`:${R7(j)}="${H.replace(/"/g,""")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function IX($){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 J=0;while(J<$.length){let Y=$.slice(J),X=Y.match(/^\s+/);if(X){J+=X[0].length;continue}if(Y.startsWith("<!--")){let K=$.indexOf("-->",J+4);if(K===-1)return null;J=K+3;continue}let Q=Y.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,J+Q[0].length);if(W===-1)return null;J=W+K.length;continue}let G=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function M7($,Z,J,Y,X){if(!NX)_X(),NX=!0;let Q=await TX($,Z,J,Y,X);Q=await JH(Q,Z,J,Y,X),Q=await YH(Q,Z,J,Y,X);let G=[];for(let K=0;K<3;K++){let W=K1(Q,G$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let q=Q;if(Q=await XH(W.output,Z,J,Y,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(Y.debug){let K=eB(Q);if(K.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var NX=!1,sB,AX;var N9=b(()=>{r6();OX();wX();n1();I0();M0();G1();sB=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"]);AX=new Map});var CX={};a(CX,{processLoops:()=>A9,parseLoopBinding:()=>R9});function KH($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",X=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=k0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let U;try{let j=A0(q,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}Y+=$.slice(X,G)+U,X=W,J.lastIndex=W}return X===0?$:Y+$.slice(X)}function WH($,Z){let J=/@component\s*\(/g,Y=$,X,Q=[];while((X=J.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let z=Y.substring(K+1,q),U=q+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 V=A0(O,Z),F=JSON.stringify(V),L=`@component('${H}', ${F})`;Q.push({start:G,end:U,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Y=Y.substring(0,K)+q+Y.substring(W)}return Y}function T7($,Z,J){let Y=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,z=null,U=!1;while(q<Y.length&&W>0){let B=Y[q];if(U){U=!1,q++;continue}if(B==="\\"&&z){U=!0,q++;continue}if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=Y.substring(K+1,q),H=J(j);Y=Y.substring(0,G)+H+Y.substring(q+1)}return Y}function qH($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,X)=>{if(X in Z)return`:${X}="${X}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);o$(Q);let q=W0(Q,G)(...K),z=JSON.stringify(q),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return Y}}),J}function zH($,Z){let J=$;return J=T7(J,"@break",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?I7:""}catch{return""}}),J=T7(J,"@continue",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(K0(Q)){let K=W0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?D7:""}catch{return""}}),J}function UH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,I7),Z=Z.replace(/@continue(?!\()/g,D7),Z}function kX($){let Z=$.includes(I7),J=Z?$.substring(0,$.indexOf(I7)):$;return{hasBreak:Z,content:J}}function EX($){let Z=$.includes(D7),J=Z?$.substring(0,$.indexOf(D7)):$;return{hasContinue:Z,content:J}}function SX($){let Z=$;return Z=T7(Z,"@break",(J)=>{let Y=J.trim();if(!s$(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=T7(Z,"@continue",(J)=>{let Y=J.trim();if(!s$(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function jH($){let Z=/@forelse\s*\(/g,J,Y=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((z,U)=>z.pos-U.pos);let K=[],W=0;for(let z of Y)W+=z.delta,K.push({pos:z.pos,depth:W});function q(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((J=Z.exec($))!==null){if(q(J.index)>0)continue;let z=J.index,U=J.index+J[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=R9(_);if(!O)continue;let{arrayExpr:V,itemVar:F}=O,L=B+1,w=1,N=L,R=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&N<$.length){R.lastIndex=N,A.lastIndex=N;let S=R.exec($),P=A.exec($);if(!P)break;if(S&&S.index<P.index)w++,N=S.index+S[0].length;else{if(w--,w===0){M=P.index;break}N=P.index+11}}if(M===-1)continue;let T=$.substring(L,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let P=T.substring(S);if(/^@forelse\s*\(/.test(P))D++,y=S+1;else if(P.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&P.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:V,itemVar:F,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function bX($,Z){let J=$;while(!0){let Y=jH(J);if(!Y)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=Y;try{let z;if(K0(G))z=W0(G,Object.keys(Z))(...Object.values(Z));else z=Y0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=q;else U=`@foreach (${G} as ${K})${W}@endforeach`;J=J.substring(0,X)+U+J.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=J0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);J=J.substring(0,X)+j+J.substring(Q)}}return J}function R9($){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 J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let Y=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=J[2].trim();return Y&&X?{arrayExpr:X,itemVar:Y}:null}function A9($,Z,J,Y){let X=$;X=bX(X,Z);function Q(W){let q=/@foreach\s*\(/g,z;while((z=q.exec(W))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),V=R9(O);if(!V)continue;let F=U,{arrayExpr:L,itemVar:w}=V,N=_+1,R=1,A=N,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&A<W.length){M.lastIndex=A,T.lastIndex=A;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,A=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(N,E.index),y=E.index+11;return{start:F,end:y,arrayExpr:L,itemVar:w,content:D}}A=E.index+11}}}return null}function G(W,q){let z=W;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let V=B.trim(),F;if(K0(V))F=W0(V,Object.keys(q))(...Object.values(q));else F=Y0(V,q);let L=!1;if(!Array.isArray(F))if(F instanceof Map)F=Array.from(F),L=!0;else if(F instanceof Set)F=Array.from(F);else if(typeof F==="string")F=Array.from(F);else if(F&&typeof F==="object"&&!(F instanceof Date)&&!(F instanceof RegExp))F=Object.entries(F),L=!0;else{console.warn(`[stx] @foreach(${V}) in ${J}: ${V} 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 E=J0("Foreach",`Error in @foreach: ${V} is not iterable`,o.TYPE_ERROR);z=z.substring(0,j)+E+z.substring(H);continue}let w=Y?.loops?.useAltLoopVariable??GH,N=_.trim(),R=null,A,M=!1;if(N.includes("=>")){let E=N.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],A=E[1];else A=N}else if(!N.startsWith("[")&&!N.startsWith("{")&&N.includes(",")){let E=N.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])A=E[0],R=E[1],M=!0;else A=N}else A=N;let T="",I=F;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...q,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let f=A.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,$0)=>{if(d)S[d]=D[$0]});else S[A]=D}else S[A]=D;if(R)if(!M&&L&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[A]=D[1];else S[R]=E;let P=zH(O,S),C=EX(P);if(C.hasContinue){T+=C.content;continue}let x=kX(P);if(x.hasBreak){T+=x.content;break}if(P=bX(P,S),P=G(P,S),P=X5(P,S,J),P=UH(P),x=kX(P),x.hasBreak){T+=x.content;break}if(C=EX(P),C.hasContinue){T+=C.content;continue}P=b1(P,S,J),P=qH(P,S),P=WH(P,S),P=KH(P,S),T+=P}z=z.substring(0,j)+T+z.substring(H)}catch(V){let F=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,o.EVALUATION_ERROR);z=z.substring(0,j)+F+z.substring(H)}}return z}X=G(X,Z),X=PX(X,Z,J,Y);let K=Y?.loops?.maxWhileIterations??QH;return X=_H(X,Z,K),X}function yX($){return s$($)}function PX($,Z,J,Y){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=k0(X,"(",")",W);if(q===-1)break;let z=X.slice(W+1,q),U=q+1,j=Y4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!yX(z)){let _=J0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=BH(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let R=HH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:J,options:Y});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),F=Object.values(Z),L=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,A)=>{return`\${${A}}`});L=SX(L);let N=Function(...V,`
|
|
10598
|
+
</style>`}}});import{existsSync as lB,readFileSync as cB}from"fs";function iB($){if(jX.has($))return;jX.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function nB($){let Z=process.cwd();for(let J 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(lB(J))return J;for(let J of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return U0.resolve(J)}catch{}return null}function oB($){if(w7.has($))return w7.get($);let Z=nB($);if(!Z)return iB($),null;try{let J=JSON.parse(cB(Z,"utf8"));return w7.set($,J.icons),J.icons}catch{return null}}function x5($,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 w7,jX,_9;var O9=b(()=>{w7=new Map,jX=new Set;_9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,J){let Y=x5($,"name")??x5($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let X="lucide",Q=Y;if(Y.includes(":")){let F=Y.split(":");X=F[0],Q=F[1]}let G=b0(x5($,"size")||"24"),K=b0(x5($,"color")||"currentColor"),W=b0(x5($,"class")||""),q=b0(x5($,"style")||""),z=w7.get(X)??oB(X);if(!z)return`<!-- Icon: collection "${X}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${X} -->`;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=W?` class="${W}"`:"",V=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${V}>${_}</svg>`}}});function BX($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let Y=$.static[J];if(typeof Y==="string")return Y}return}function HX($,Z){let J=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=$.match(J);if(!Y)return{region:null,rest:$};return{region:Y[2],rest:$.replace(Y[0],"")}}var F9;var V9=b(()=>{F9={name:"Suspense",aliases:["suspense"],render($,Z,J){let Y=HX(Z,"fallback"),X=Y.rest,Q=HX(X,"error"),G=Q.rest,K=Y.region??BX($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??BX($,"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>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function N7($,...Z){for(let J of Z){if($.serverDynamic[J]!==void 0)return String($.serverDynamic[J]);let Y=$.static[J];if(typeof Y==="string")return Y}return}var L9;var w9=b(()=>{L9={name:"TransitionGroup",aliases:["transition-group"],render($,Z,J){let Y=(N7($,"name")||"v").replace(/["'<>]/g,""),X=(N7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=N7($,"class"),G=N7($,"id"),K=[`data-stx-transition-group="${Y}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${X} ${K}>${Z}</${X}>`}}});function _X(){u0.registerBuiltin(a6),u0.registerBuiltin(J9),u0.registerBuiltin(X9),u0.registerBuiltin(K9),u0.registerBuiltin(q9),u0.registerBuiltin(U9),u0.registerBuiltin(B9),u0.registerBuiltin(_9),u0.registerBuiltin(F9),u0.registerBuiltin(L9)}var OX=b(()=>{t6();Y9();Q9();W9();z9();j9();H9();O9();V9();w9();r6();t6();Y9();Q9();W9();z9();j9();H9();O9();V9();w9()});function R7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function FX($,Z,J){let Y=[],X=0;while(X<$.length){let Q=$.indexOf("<",X);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){X=Q+1;continue}let W=K[1];if(J&&J.has(W.toLowerCase())){let _=Q+1+W.length;while(_<$.length&&$[_]!==">")_++;X=_+1;continue}let q=Q+1+W.length,z=null,U=q,j=-1,H=!1;while(q<$.length){let _=$[q];if(z){if(_==="\\"&&q+1<$.length){q+=2;continue}if(_===z)z=null;q++;continue}if(_==='"'||_==="'"){z=_,q++;continue}if(_==="/"&&q+1<$.length&&$[q+1]===">"){j=q+2,H=!0;break}if(_===">"){j=q+1;break}q++}if(j===-1){X=Q+1;continue}let B=$.slice(U,H?j-2:j-1).trim();if(H)Y.push({fullMatch:$.slice(Q,j),tagName:W,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),X=j;else{let _=`<${W}`,O=`</${W}>`,V=1,F=j,L=-1;while(V>0&&F<$.length){let R=$.indexOf(_,F),A=$.indexOf(O,F);if(A===-1)break;if(R!==-1&&R<A){let M=$[R+_.length];if(M===" "||M===">"||M==="/"||M===`
|
|
10599
|
+
`||M==="\t")V++;F=R+_.length}else{if(V--,V===0){L=A;break}F=A+O.length}}if(L===-1){X=j;continue}let w=$.slice(j,L),N=L+O.length;Y.push({fullMatch:$.slice(Q,N),tagName:W,attributes:B,content:w,startIndex:Q,endIndex:N,isSelfClosing:!1}),X=N}}return Y}function VX($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function LX($,Z){try{let J=Buffer.from($,"base64").toString("utf8");return JSON.parse(J)}catch{}try{let J=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(J)}catch(J){if(Z?.debug)console.error("Error decoding __stx_ prop:",J);return $}}var wX=b(()=>{M0();I0();n1()});var DX={};t(DX,{processESImports:()=>TX,processComponents:()=>M7});import A7 from"fs";import i0 from"path";function rB($,Z,J){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},X=new Set(b8),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,(W,q)=>q.toUpperCase())},G=(K,W)=>{let q=Q(K);if(Y.static[q]=W,q!==K)Y.staticNames[q]=K};for(let[K,W]of Object.entries($)){let q=K.startsWith("x-")&&!X.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(q.startsWith("@")){Y.events[q]=W;continue}if(q.startsWith("__stx_")){let z=Q(q.slice(6));Y.serverDynamic[z]=LX(W,J);continue}if(q.startsWith(":")){let z=Q(q.slice(1)),U=W===K5?z:W;if(z==="if"||z==="for"||z==="show"){Y.clientReactive[z]=U;continue}try{if(!W0(U)){if(J.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);Y.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((F)=>!O.has(F)&&!j.includes(F))){Y.clientReactive[z]=U;continue}}Y.serverDynamic[z]=B}catch{Y.clientReactive[z]=U}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let z=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(W0(U)){let H=q0(U,Object.keys(Z))(...Object.values(Z));G(q,H!=null?String(H):"")}else{if(J.debug)console.error(`Unsafe expression in ${q}: ${U}`);G(q,W)}}catch(U){if(J.debug)console.error(`Error evaluating expression for ${q}:`,U);G(q,W)}else{let U=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(W))!==null)try{let B=H[1];if(!W0(B)){if(J.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let O=q0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(J.debug)console.error(`Error evaluating expression in ${q}:`,B)}G(q,U)}continue}G(q,W===K5?"true":VX(W))}return Y}function aB($){let Z={},J=0,Y=$.length;while(J<Y){while(J<Y&&/\s/.test($[J]))J++;if(J>=Y)break;let X="";while(J<Y&&!/[\s=]/.test($[J]))X+=$[J],J++;if(!X)break;while(J<Y&&/\s/.test($[J]))J++;if(J<Y&&$[J]==="="){J++;while(J<Y&&/\s/.test($[J]))J++;let Q="";if(J<Y&&($[J]==='"'||$[J]==="'")){let G=$[J];J++;while(J<Y){let K=$[J];if(K==="\\"&&J+1<Y){J++,Q+=$[J],J++;continue}if(K===G){J++;break}Q+=K,J++}}else while(J<Y&&!/\s/.test($[J]))Q+=$[J],J++;Z[X]=Q}else Z[X]=K5}return Z}function RX($){return Object.entries($).map(([Z,J])=>J===K5?Z:`${Z}="${tB(J)}"`).join(" ")}function tB($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function eB($){let Z=new Set,J=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=J.exec($))!==null){let X=Y[1];if(u0.isBuiltin(X))Z.add(X)}return[...Z].sort()}function $H($){let Z=AX.get($);if(Z)return Z;let J=new Map,Y=[i0.join($,"src"),i0.join($,"dist"),$];function X(Q,G){if(G>6)return;let K;try{K=A7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let q=i0.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;X(q,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let z=W.name.slice(0,-4);if(!J.has(z))J.set(z,q);let U=z.toLowerCase();if(!J.has(U))J.set(U,q);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!J.has(j))J.set(j,q)}}}for(let Q of Y)if(X(Q,0),J.size>0)break;return AX.set($,J),J}function ZH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let J=Z;while(!0){let Y=i0.join(J,"node_modules",$);try{if(A7.statSync(Y).isDirectory())return Y}catch{}let X=i0.dirname(J);if(X===J)return null;J=X}}async function TX($,Z,J,Y,X){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=i0.dirname(J),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(q,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,V,F,L]=B,w=null,N=null;if(L.startsWith(".")||L.startsWith("/")){let M=i0.resolve(G,L);if(M.endsWith(".stx"))N=M;else{let T=`${M}.stx`;try{if(A7.statSync(T).isFile())N=T}catch{try{if(A7.statSync(M).isDirectory())w=M}catch{}}}}else w=ZH(L,G);if(!w&&!N)continue;let R=!1,A=(M,T)=>{Q.set(M,T),Q.set(M.toLowerCase(),T);let I=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(I,T),X.add(T)};if(F&&N)A(F,N),R=!0;else if(V){let M=V.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),T=w?$H(w):null;for(let{source:I,local:E}of M){let D=null;if(N)D=N;else if(T)D=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(E,D),R=!0}}if(R)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return q;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 JH($,Z,J,Y,X){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[q,z]=W,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((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,F=[i0.resolve(i0.dirname(J),`${j}.stx`),i0.resolve(i0.dirname(J),j),i0.resolve(Y.componentsDir||"components",`${j}.stx`),i0.resolve(Y.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let L of F)try{if(await Bun.file(L).exists()){V=L;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let L=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(L,V),X.add(V),Y.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(q,""),K.lastIndex=0}return Q}async function YH($,Z,J,Y,X){let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,q;while((q=W.exec(Q))!==null){let z=q.index,U=z+q[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){W.lastIndex=0;continue}let V=O[1],F,L=B.slice(O[0].length),w=L.match(/^\s*,\s*/);if(w)F=L.slice(w[0].length).trim();let N={};if(F)try{N=A0(F,Z)}catch(E){let D=E instanceof Error?E.message:String(E);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let R="",A=_,T=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),A=_+T[0].length;let I=await e1(V,N,R,G,Z,J,Y,K,X);Q=Q.substring(0,z)+I+Q.substring(A),W.lastIndex=0}return Q}async function XH($,Z,J,Y,X){if(!$)return $;let Q=$,G=Y.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=E1(Q);return Q=W.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,sB),Q=K$(Q,W.scripts),Q;async function j(H,B,_,O){if(!H)return H;let V=H,F=FX(V,B,O);for(let L=F.length-1;L>=0;L--){let w=F[L],N=_?R7(w.tagName):w.tagName,R=aB(w.attributes),A=rB(R,Z,Y),M=u0.getBuiltin(w.tagName),T=M?await T4(N,G,Z,J,Y):!1;if(M&&!T){let y={context:Z,filePath:J,options:Y,dependencies:X},S=M.render(A,w.content,y);if(Object.keys(A.clientReactive).length>0)S=MX(S,A.clientReactive);if(Object.keys(A.events).length>0){let P=RX(A.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${P}`)}V=V.substring(0,w.startIndex)+S+V.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await T4(N,G,Z,J,Y))continue;let I={};for(let[y,S]of Object.entries(A.static))I[y]=S;for(let[y,S]of Object.entries(A.serverDynamic))I[y]=S;let D=await e1(N,I,w.content,G,Z,J,Y,K,X);if(Object.keys(A.clientReactive).length>0)D=MX(D,A.clientReactive);if(Object.keys(A.events).length>0){let y=IX(D);if(y){let S=RX(A.events),P=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,y.insertPos)+` data-stx-parent-events="${P}" ${S}`+D.substring(y.insertPos)}}V=V.substring(0,w.startIndex)+D+V.substring(w.endIndex)}return V}}function MX($,Z){let J=new Set(["if","for"]),Y=new Set(["show"]),X=Object.entries(Z).filter(([z])=>!J.has(z)),Q=X.filter(([z])=>!Y.has(z)).map(([z])=>R7(z)).join(" "),G=$,K=X.length>0?IX(G):null;if(K){let z=X.map(([j,H])=>`:${R7(j)}="${H.replace(/"/g,""")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let W=Z.if;if(W)G=`<template :if="${W.replace(/"/g,""")}">${G}</template>`;let q=Z.for;if(q)G=`<template :for="${q.replace(/"/g,""")}">${G}</template>`;return G}function IX($){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 J=0;while(J<$.length){let Y=$.slice(J),X=Y.match(/^\s+/);if(X){J+=X[0].length;continue}if(Y.startsWith("<!--")){let K=$.indexOf("-->",J+4);if(K===-1)return null;J=K+3;continue}let Q=Y.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,W=$.toLowerCase().indexOf(K,J+Q[0].length);if(W===-1)return null;J=W+K.length;continue}let G=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:J+1+G[1].length}}return null}async function M7($,Z,J,Y,X){if(!NX)_X(),NX=!0;let Q=await TX($,Z,J,Y,X);Q=await JH(Q,Z,J,Y,X),Q=await YH(Q,Z,J,Y,X);let G=[];for(let K=0;K<3;K++){let W=W1(Q,G$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...W.tokens);let q=Q;if(Q=await XH(W.output,Z,J,Y,X),Q===q)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,W)=>G[Number(W)]??"");if(Y.debug){let K=eB(Q);if(K.length>0)console.warn(`[stx] ${J}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var NX=!1,sB,AX;var N9=b(()=>{r6();OX();wX();n1();I0();M0();K1();sB=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"]);AX=new Map});var CX={};t(CX,{processLoops:()=>A9,parseLoopBinding:()=>R9});function KH($,Z){let J=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",X=0,Q;while((Q=J.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),W=k0($,"(",")",K);if(W===-1)continue;let q=$.slice(G,W).trim();if(!q)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let U;try{let j=A0(q,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}Y+=$.slice(X,G)+U,X=W,J.lastIndex=W}return X===0?$:Y+$.slice(X)}function WH($,Z){let J=/@component\s*\(/g,Y=$,X,Q=[];while((X=J.exec(Y))!==null){let G=X.index,K=G+X[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")"){if(W--,W===0)break}q++}if(W!==0)continue;let z=Y.substring(K+1,q),U=q+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 V=A0(O,Z),F=JSON.stringify(V),L=`@component('${H}', ${F})`;Q.push({start:G,end:U,replacement:L})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:q}=Q[G];Y=Y.substring(0,K)+q+Y.substring(W)}return Y}function T7($,Z,J){let Y=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=X.exec(Y))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1,z=null,U=!1;while(q<Y.length&&W>0){let B=Y[q];if(U){U=!1,q++;continue}if(B==="\\"&&z){U=!0,q++;continue}if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="(")W++;else if(B===")"){if(W--,W===0)break}q++}if(W!==0)break;let j=Y.substring(K+1,q),H=J(j);Y=Y.substring(0,G)+H+Y.substring(q+1)}return Y}function qH($,Z){let J=$;return J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,X)=>{if(X in Z)return`:${X}="${X}"`;return Y}),J=J.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,X,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);o$(Q);let q=q0(Q,G)(...K),z=JSON.stringify(q),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${X}="${U}"`}catch(G){return Y}}),J}function zH($,Z){let J=$;return J=T7(J,"@break",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?I7:""}catch{return""}}),J=T7(J,"@continue",(Y)=>{try{let Q=`!!(${Y.trim()})`,G;if(W0(Q)){let K=q0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(Q,Z));return G?D7:""}catch{return""}}),J}function UH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,I7),Z=Z.replace(/@continue(?!\()/g,D7),Z}function kX($){let Z=$.includes(I7),J=Z?$.substring(0,$.indexOf(I7)):$;return{hasBreak:Z,content:J}}function EX($){let Z=$.includes(D7),J=Z?$.substring(0,$.indexOf(D7)):$;return{hasContinue:Z,content:J}}function SX($){let Z=$;return Z=T7(Z,"@break",(J)=>{let Y=J.trim();if(!s$(Y))return"";return`\`; if (${Y}) { break; } result += \``}),Z=T7(Z,"@continue",(J)=>{let Y=J.trim();if(!s$(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function jH($){let Z=/@forelse\s*\(/g,J,Y=[],X=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=X.exec($))!==null)Y.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)Y.push({pos:G.index,delta:-1});Y.sort((z,U)=>z.pos-U.pos);let K=[],W=0;for(let z of Y)W+=z.delta,K.push({pos:z.pos,depth:W});function q(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((J=Z.exec($))!==null){if(q(J.index)>0)continue;let z=J.index,U=J.index+J[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=R9(_);if(!O)continue;let{arrayExpr:V,itemVar:F}=O,L=B+1,w=1,N=L,R=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&N<$.length){R.lastIndex=N,A.lastIndex=N;let S=R.exec($),P=A.exec($);if(!P)break;if(S&&S.index<P.index)w++,N=S.index+S[0].length;else{if(w--,w===0){M=P.index;break}N=P.index+11}}if(M===-1)continue;let T=$.substring(L,M),I=M+11,E=-1,D=0,y=0;while(y<T.length){let S=T.indexOf("@",y);if(S===-1)break;let P=T.substring(S);if(/^@forelse\s*\(/.test(P))D++,y=S+1;else if(P.startsWith("@endforelse"))D--,y=S+11;else if(D===0&&P.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){E=S;break}y=S+1}else y=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:V,itemVar:F,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function bX($,Z){let J=$;while(!0){let Y=jH(J);if(!Y)break;let{start:X,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:q}=Y;try{let z;if(W0(G))z=q0(G,Object.keys(Z))(...Object.values(Z));else z=Y0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=q;else U=`@foreach (${G} as ${K})${W}@endforeach`;J=J.substring(0,X)+U+J.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=J0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);J=J.substring(0,X)+j+J.substring(Q)}}return J}function R9($){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 J=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!J)return null;let Y=J[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),X=J[2].trim();return Y&&X?{arrayExpr:X,itemVar:Y}:null}function A9($,Z,J,Y){let X=$;X=bX(X,Z);function Q(W){let q=/@foreach\s*\(/g,z;while((z=q.exec(W))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<W.length&&H>0){if(W[B]==="(")H++;else if(W[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=W.substring(j+1,_),V=R9(O);if(!V)continue;let F=U,{arrayExpr:L,itemVar:w}=V,N=_+1,R=1,A=N,M=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&A<W.length){M.lastIndex=A,T.lastIndex=A;let I=M.exec(W),E=T.exec(W);if(!E)break;if(I&&I.index<E.index)R++,A=I.index+I[0].length;else{if(R--,R===0){let D=W.substring(N,E.index),y=E.index+11;return{start:F,end:y,arrayExpr:L,itemVar:w,content:D}}A=E.index+11}}}return null}function G(W,q){let z=W;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let V=B.trim(),F;if(W0(V))F=q0(V,Object.keys(q))(...Object.values(q));else F=Y0(V,q);let L=!1;if(!Array.isArray(F))if(F instanceof Map)F=Array.from(F),L=!0;else if(F instanceof Set)F=Array.from(F);else if(typeof F==="string")F=Array.from(F);else if(F&&typeof F==="object"&&!(F instanceof Date)&&!(F instanceof RegExp))F=Object.entries(F),L=!0;else{console.warn(`[stx] @foreach(${V}) in ${J}: ${V} 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 E=J0("Foreach",`Error in @foreach: ${V} is not iterable`,o.TYPE_ERROR);z=z.substring(0,j)+E+z.substring(H);continue}let w=Y?.loops?.useAltLoopVariable??GH,N=_.trim(),R=null,A,M=!1;if(N.includes("=>")){let E=N.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])R=E[0],A=E[1];else A=N}else if(!N.startsWith("[")&&!N.startsWith("{")&&N.includes(",")){let E=N.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])A=E[0],R=E[1],M=!0;else A=N}else A=N;let T="",I=F;for(let E=0;E<I.length;E++){let D=I[E],y={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...q,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let f=A.slice(1,-1).split(",").map((d)=>d.trim());if(Array.isArray(D))f.forEach((d,$0)=>{if(d)S[d]=D[$0]});else S[A]=D}else S[A]=D;if(R)if(!M&&L&&Array.isArray(D)&&D.length===2)S[R]=D[0],S[A]=D[1];else S[R]=E;let P=zH(O,S),C=EX(P);if(C.hasContinue){T+=C.content;continue}let x=kX(P);if(x.hasBreak){T+=x.content;break}if(P=bX(P,S),P=G(P,S),P=X5(P,S,J),P=UH(P),x=kX(P),x.hasBreak){T+=x.content;break}if(C=EX(P),C.hasContinue){T+=C.content;continue}P=b1(P,S,J),P=qH(P,S),P=WH(P,S),P=KH(P,S),T+=P}z=z.substring(0,j)+T+z.substring(H)}catch(V){let F=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,o.EVALUATION_ERROR);z=z.substring(0,j)+F+z.substring(H)}}return z}X=G(X,Z),X=PX(X,Z,J,Y);let K=Y?.loops?.maxWhileIterations??QH;return X=_H(X,Z,K),X}function yX($){return s$($)}function PX($,Z,J,Y){let X=$,Q=!0;while(Q){Q=!1;let G=X.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,q=k0(X,"(",")",W);if(q===-1)break;let z=X.slice(W+1,q),U=q+1,j=Y4(X.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!yX(z)){let _=J0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);X=X.substring(0,K)+_+X.substring(B),Q=!0;continue}try{let _=BH(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let R=HH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:J,options:Y});X=X.substring(0,K)+R+X.substring(B),Q=!0;continue}let V=Object.keys(Z),F=Object.values(Z),L=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,A)=>{return`\${${A}}`});L=SX(L);let N=Function(...V,`
|
|
10600
10600
|
let result = '';
|
|
10601
10601
|
for (${z}) {
|
|
10602
10602
|
result += \`${L}\`;
|
|
@@ -10618,7 +10618,7 @@ ${D}
|
|
|
10618
10618
|
result += '<!-- [While Error [1104]]: Maximum iterations (${J}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
10619
10619
|
}
|
|
10620
10620
|
return result;
|
|
10621
|
-
`)(...B);Y=Y.substring(0,G)+V+Y.substring(j),X=!0}catch(H){let B=J0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(j),X=!0}}return Y}var QH=1000,GH=!1,I7="<!--__STX_BREAK__-->",D7="<!--__STX_CONTINUE__-->";var M9=b(()=>{j7();w1();
|
|
10621
|
+
`)(...B);Y=Y.substring(0,G)+V+Y.substring(j),X=!0}catch(H){let B=J0("While",`Error in @while(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Y=Y.substring(0,G)+B+Y.substring(j),X=!0}}return Y}var QH=1000,GH=!1,I7="<!--__STX_BREAK__-->",D7="<!--__STX_CONTINUE__-->";var M9=b(()=>{j7();w1();q1();X4();M0()});import _0 from"path";function T9($,Z){let J=0;for(let Y=Z;Y<$.length;Y++){let X=$[Y];if(X==="("||X==="["||X==="{")J++;else if(X===")"||X==="]"||X==="}")J--;else if(X===","&&J===0)return Y}return-1}function OH($,Z,J){let Y=$,X=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=X.exec(Y);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,q=K+1;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")")W--;q++}if(W!==0)break;let z=Y.substring(K+1,q-1),U=`${J}(${z})`;Y=Y.substring(0,G)+U+Y.substring(q),X.lastIndex=G+U.length,Q=X.exec(Y)}return Y}function FH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function xX($){let Z=$,J=[],Y=new Set,X=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++}},W=()=>{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]==="`")W();else Q++;continue}Q++}},q=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
|
|
10622
10622
|
`)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(X!==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(!Y.has(B))J.push(B),Y.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(!Y.has(B))J.push(B),Y.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(!Y.has(B))J.push(B),Y.add(B)}};while(Q<G){if(q())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){X++,Q++;continue}if(Z[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return J.join(", ")}function fX($,Z=""){let J=xX($).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
|
|
10623
10623
|
(function() {
|
|
10624
10624
|
${O5("var",J)}
|
|
@@ -10653,23 +10653,23 @@ ${xX($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
|
|
|
10653
10653
|
} finally {
|
|
10654
10654
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
10655
10655
|
}
|
|
10656
|
-
})();`}function LH($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=(J[2]+J[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=J[1],G=J[2],K=J[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function NH($){if($.__onceStore instanceof Set)return $.__onceStore;return wH}async function I9($,Z,J,Y,X,Q=new Set){let G=Y.partialsDir||_0.join(_0.dirname(J),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=OH($,"@partial","@include"),W=NH(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let V=_.trim(),F=`${J}:${V}`;if(W.has(F))return"";return W.add(F),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,V=O+_[0].length-1,F=1,L=V+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let w=K.substring(V+1,L-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=L;continue}let R=N[1],A=q(R,G,J),M="";if(A&&await Bun.file(A).exists())X.add(A),M=`@include(${w})`;K=K.substring(0,O)+M+K.substring(L),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=O.exec(K))!==null){let F=V.index,L=F+V[0].length-1,w=1,N=L+1;while(N<K.length&&w>0){if(K[N]==="(")w++;else if(K[N]===")")w--;N++}if(w!==0)break;let R=K.substring(L+1,N-1),A=T9(R,0);if(A===-1){O.lastIndex=N;continue}let M=R.substring(0,A).trim(),T=R.substring(A+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){O.lastIndex=N;continue}let E=I[1],D=T.substring(I[0].length),y,S=T9(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let P=`Boolean(${M})`,C;if(
|
|
10657
|
-
`;continue}if($0)try{let{extractVariables:
|
|
10656
|
+
})();`}function LH($,Z){let J=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(J){let X=(J[2]+J[3]).match(/data-stx-scope="([^"]*)"/);if(X)return{html:$,mergedIntoExisting:X[1]};let Q=J[1],G=J[2],K=J[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(J[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function NH($){if($.__onceStore instanceof Set)return $.__onceStore;return wH}async function I9($,Z,J,Y,X,Q=new Set){let G=Y.partialsDir||_0.join(_0.dirname(J),"partials");if(G&&!_0.isAbsolute(G))G=_0.resolve(process.cwd(),G);let K=OH($,"@partial","@include"),W=NH(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let V=_.trim(),F=`${J}:${V}`;if(W.has(F))return"";return W.add(F),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,V=O+_[0].length-1,F=1,L=V+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")")F--;L++}if(F!==0)break;let w=K.substring(V+1,L-1),N=w.match(/^\s*['"]([^'"]+)['"]/);if(!N){B.lastIndex=L;continue}let R=N[1],A=q(R,G,J),M="";if(A&&await Bun.file(A).exists())X.add(A),M=`@include(${w})`;K=K.substring(0,O)+M+K.substring(L),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),V;while((V=O.exec(K))!==null){let F=V.index,L=F+V[0].length-1,w=1,N=L+1;while(N<K.length&&w>0){if(K[N]==="(")w++;else if(K[N]===")")w--;N++}if(w!==0)break;let R=K.substring(L+1,N-1),A=T9(R,0);if(A===-1){O.lastIndex=N;continue}let M=R.substring(0,A).trim(),T=R.substring(A+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){O.lastIndex=N;continue}let E=I[1],D=T.substring(I[0].length),y,S=T9(D,0);if(S!==-1)y=D.substring(S+1).trim();try{let P=`Boolean(${M})`,C;if(W0(P)){let d=q0(P,Object.keys(Z));C=Boolean(d(...Object.values(Z)))}else C=Boolean(Y0(P,Z));let x=_?!C:C,f="";if(x){let d=q(E,G,J);if(d&&await Bun.file(d).exists())X.add(d);f=`@include('${E}'${y?`, ${y}`:""})`}K=K.substring(0,F)+f+K.substring(N),O.lastIndex=0}catch(P){let C=P instanceof Error?P.message:String(P),x=j0("Include",`Error evaluating ${B} condition: ${C}`,J,$,F);K=K.substring(0,F)+x+K.substring(N),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,V=O+_[0].length-1,F=1,L=V+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")"){if(F--,F===0)break}L++}if(F!==0)break;let w=K.substring(V+1,L),N=K.substring(O,L+1),R=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){B.lastIndex=0,K=K.replace(N,"");continue}let[,A,M,T,I]=R;try{let E,D=M.trim();if(W0(D))E=q0(D,Object.keys(Z))(...Object.values(Z));else E=Y0(D,Z);let y="";if(Array.isArray(E)&&E.length>0)for(let S of E){let P={...Z,[T]:S},C=await U(A,P,$,O);y+=C}else if(I)y=await U(I,{},$,O);K=K.substring(0,O)+y+K.substring(L+1),B.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,O)+j0("Each",`Error in @each: ${D}`,J,$,O)+K.substring(L+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,V=O+_[0].length-1,F=1,L=V+1;while(L<K.length&&F>0){if(K[L]==="(")F++;else if(K[L]===")"){if(F--,F===0)break}L++}if(F!==0)break;let w=K.substring(V+1,L),N=K.substring(O,L+1),R=w.match(/^\s*(\[[^\]]+\])/);if(!R){B.lastIndex=0,K=K.replace(N,"");continue}let A=R[1],M=w.slice(R[0].length),T,I=M.match(/^\s*,\s*\{/);if(I){M=M.slice(I[0].length-1);let y=1,S=1;while(S<M.length&&y>0){if(M[S]==="{")y++;else if(M[S]==="}"){if(y--,y===0)break}S++}T=M.substring(0,S+1),M=M.slice(S+1)}let E,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let y=JSON.parse(A.replace(/'/g,'"')),S={};if(T)try{S=A0(T,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(Y.debug){let f=j0("Include",`Error parsing includeFirst variables: ${x}`,J,$,O,N);K=K.replace(N,()=>f)}else K=K.replace(N,()=>E||"");continue}let P=!1;for(let C of y){let x=q(C,G,J);if(!x)continue;if(await c(x)){let f=await U(C,S,$,O);K=K.replace(N,()=>f),P=!0;break}}if(!P)if(E!==void 0)K=K.replace(N,()=>E);else if(Y.debug){let C=j0("Include",`None of the includeFirst paths exist: ${A}`,J,$,O,N);K=K.replace(N,()=>C)}else K=K.replace(N,"")}catch(y){let S=y instanceof Error?y.message:String(y),P=j0("Include",`Error processing @includeFirst: ${S}`,J,$,O,N);K=K.replace(N,()=>P)}B.lastIndex=0}}function q(B,_,O){try{let V=B;if(!B.endsWith(".stx"))V=`${B}.stx`;let F=_0.resolve(_),L=_0.resolve(_0.dirname(O)),w;if(!V.startsWith("./")&&!V.startsWith("../"))w=_0.resolve(_,V);else w=_0.resolve(L,V);let N=_0.normalize(w),R=N.startsWith(F+_0.sep)||N===F,A=N.startsWith(L+_0.sep)||N===L,M=!1,T=_0.dirname(L);if(N.startsWith(T+_0.sep)){if(!_0.relative(T,N).split(_0.sep).some((y)=>y.startsWith(".")&&y!=="."&&y!==".."))M=!0}if(!R&&!A&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${F}, ${L}`),null;return N}catch(V){return console.error(`Error resolving path ${B}: ${V}`),null}}let z=_0.resolve(J);Q.add(z);async function U(B,_={},O,V){let F=q(B,G,J);if(!F)return j0("Include",`Could not resolve path for include: ${B}`,J,O,V);let L=_0.resolve(F);if(Q.has(L)){let w=[...Q,L].map((N)=>_0.basename(N)).join(" -> ");return j0("Include",`Circular include detected: ${w}`,J,O,V)}try{X.add(F);let w;if(!w)try{w=await Bun.file(F).text()}catch(x){let f=x instanceof Error?x.message:String(x);return j0("Include",`Error loading include file ${B}: ${f}`,J,O,V)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (i6(),c6));w=x(w,Z)}if(w&&(Y.debug||!L$()&&!a4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (o6(),ZX));x(w,F)}catch{}let N=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N9(),DX));await x(w,Z,F,Y,X)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,x instanceof Error?x.message:x)}let R=e$(N);if(R)N=R.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};I.__stx_signals_gate=L1(w);for(let[x,f]of Object.entries(_))I[x]=f;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(E)],y="",S=null;for(let x of D){let f=x[1]||"",d=x[2]||"",$0=f.includes("server"),P0=c1(f),B0="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:a}=await Promise.resolve().then(() => (Q$(),JZ)),R0=u(d,{filePath:F,projectRoot:process.cwd()});d=R0.code,B0=a(R0.styles)}catch(u){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,u instanceof Error?u.message:u)}if(P0&&d.trim())d=i1(d);if(!$0)try{let{hasUserImports:u,bundleClientScript:a}=await Promise.resolve().then(() => ($$(),e5));if(u(d))d=await a(d,F,{projectRoot:process.cwd()})}catch(u){if(Y.debug)console.warn(`[stx] bundler skipped for ${F}:`,u instanceof Error?u.message:u)}let N0=FH(d);if(N0&&!$0){S=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vX}`;let u=d0(d),a=VH(u,S);y+=`${B0}<script data-stx-scoped data-stx-run="always">${a}</script>
|
|
10657
|
+
`;continue}if($0)try{let{extractVariables:u}=await Promise.resolve().then(() => (j$(),J4));await u(d,I,F)}catch(u){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,u)}if(!$0&&!N0){let u=f.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++vX}`;let a=d0(d),R0=gX(a,S),C0=fX(a,R0);y+=`${B0}<script data-stx-scoped data-stx-run="always"${u?` ${u}`:""}>${C0}</script>
|
|
10658
10658
|
`}}if(S){let x=LH(N,S);if(N=x.html,x.mergedIntoExisting)y=y.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(N.includes("@include")||N.includes("@partial"))N=await I9(N,I,F,Y,X,Q);let{processLoops:P}=await Promise.resolve().then(() => (M9(),CX)),C=P(N,I,F);if(C=X5(C,I,F),C=b1(C,I,F),T)C+=`
|
|
10659
10659
|
`+T;if(y)C+=`
|
|
10660
|
-
`+y;return C}catch(w){let N=w instanceof Error?w.message:String(w);return
|
|
10661
|
-
`)})}var vX=0,sM,wH;var hX=b(()=>{j3();j7();
|
|
10660
|
+
`+y;return C}catch(w){let N=w instanceof Error?w.message:String(w);return j0("Include",`Error processing include ${B}: ${N}`,J,O,V)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,V=_+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let F=K.substring(B,V),L=K.substring(_+1,V-1),w=L.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let N=w[1],R,A=L.substring(w[0].length),M=T9(A,0);if(M!==-1)R=A.substring(M+1).trim();let T={};if(R)try{T=A0(R,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(F,j0("Include",`Error parsing include variables for ${N}: ${D}`,J,$,B)),j.lastIndex=0;continue}let I=await U(N,T,$,B);K=K.substring(0,B)+I+K.substring(V),j.lastIndex=0}return K}function D9($,Z){let J=$;function Y(X,Q,G,K){let W=X,q=!0;while(q){q=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=W.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])`),V=1,F=B,L=-1;while(V>0&&F<W.length){let N=W.slice(F),R=N.match(_),A=N.match(O),M=R?F+R.index:1/0,T=A?F+A.index:1/0;if(M<T)V++,F=M+(R[0].length||1);else if(T<1/0){if(V--,V===0){L=T;break}F=T+G.length+1}else break}if(L===-1)break;let w=W.slice(B,L);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);W=W.substring(0,j)+W.substring(L+`@${G}`.length),q=!0}return W}return J=Y(J,"push","endpush",!1),J=Y(J,"prepend","endprepend",!0),J}function k9($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(J,Y)=>{if(!Z[Y]||Z[Y].length===0)return"";return Z[Y].join(`
|
|
10661
|
+
`)})}var vX=0,sM,wH;var hX=b(()=>{j3();j7();q1();K1();R5();M0();I0();sM=new o1(500),wH=new Set});import*as E9 from"path";async function uX($,Z,J=""){if(E9.basename(J)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return dX($,Z,J,"@js","@endjs")}async function mX($,Z,J=""){if(E9.basename(J)==="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 dX($,Z,J,"@ts","@endts")}async function dX($,Z,J,Y,X){let Q=$,G=N5(`${Y}([\\s\\S]*?)${X}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:q,content:z,index:U}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=z.trim();if(Y==="@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 V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=V.length>0?`return { ${V.join(", ")} };`:"return {};",L=`
|
|
10662
10662
|
${_}
|
|
10663
10663
|
${F}
|
|
10664
|
-
`,N=Function(...H,L)(...B);if(N&&typeof N==="object")Object.assign(Z,N);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${Y} code block in ${J}:`,j);let H=j instanceof Error?j.message:String(j),B=
|
|
10665
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${
|
|
10666
|
-
`)}}}return Q}async function iX($,Z,J,Y){return cX($,Z,J,Y,"before")}async function nX($,Z,J,Y){return cX($,Z,J,Y,"after")}var oX=b(()=>{
|
|
10664
|
+
`,N=Function(...H,L)(...B);if(N&&typeof N==="object")Object.assign(Z,N);Q=Q.replace(q,"")}catch(j){console.error(`Error executing ${Y} code block in ${J}:`,j);let H=j instanceof Error?j.message:String(j),B=j0(`${Y} Directive`,`Error executing code: ${H}`,J,$,U,q);console.error(B),Q=Q.replace(q,"")}return Q}var pX=b(()=>{R5();I0()});function RH($,Z="_method"){let J=$.toUpperCase();if(J==="GET"||J==="POST")return"";return`<input type="hidden" name="${Z}" value="${J}">`}function lX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,J,Y,X,Q)=>{return RH(Y,Q||"_method")})}async function cX($,Z,J,Y,X){if(!Y.middleware||Y.middleware.length===0)return $;let Q=$,G=Y.middleware.filter((K)=>K.timing===X);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,J,Y);if(typeof W==="string")Q=W;else if(Y.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(Y.debug)console.error(`Error in middleware ${K.name}:`,W);if(Y.debug){let q=j0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,J,$);Q=Q.replace(/<body[^>]*>/,`$&
|
|
10665
|
+
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(q)}</div>
|
|
10666
|
+
`)}}}return Q}async function iX($,Z,J,Y){return cX($,Z,J,Y,"before")}async function nX($,Z,J,Y){return cX($,Z,J,Y,"after")}var oX=b(()=>{q1();I0()});import{defineRoute as WT,defineRoutes as qT,resetRoutes as zT,route as UT,setAppUrl as jT}from"stx-router";import{route as AH}from"stx-router";function sX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,J,Y,X,Q)=>{try{let G=X?A0(X,{}):{};return AH(Y,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var rX=b(()=>{M0()});async function aX($,Z){let J=$.split("/").pop()?.split(".")[0]||"";if(y$.exact[$])for(let Y of y$.exact[$])await Promise.resolve(Y(Z,$));if(y$.exact[J])for(let Y of y$.exact[J])await Promise.resolve(Y(Z,$));for(let{pattern:Y,callback:X}of y$.patterns)if(Y.test($)||Y.test(J))await Promise.resolve(X(Z,$))}var y$;var tX=b(()=>{y$={patterns:[],exact:{}}});function eX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>eX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function $Q($,Z){if(!/:[\w-]+=/.test($))return $;let J=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);function G(q){return X.some(([z,U])=>q>=z&&q<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(J))!==null){if(G(Q.index))continue;let q=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 V=Object.keys(Z),F=Object.values(Z),L=O.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!V.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let N=Function(...V,`return (${O})`)(...F);if(_==="class"){let R=eX(N);if(R){let A=H.match(/\sclass="([^"]*)"/);if(A)H=H.replace(A[0],` class="${A[1]} ${R}"`);else H=H.replace(j[0],` class="${R}"`)}else H=H.replace(j[0],"");B=!0;continue}if(MH.has(_)){if(N)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(N===null||N===void 0||N===!1)H=H.replace(j[0],"");else{let R=String(N).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");H=H.replace(j[0],` ${_}="${R}"`)}B=!0}catch{continue}}if(B){let _=q.endsWith("/>")?" /":"",V=`<${Q[1]}${H}${_}>`;W.push({start:Q.index,end:Q.index+q.length,replacement:V})}}for(let q=W.length-1;q>=0;q--){let{start:z,end:U,replacement:j}=W[q];J=J.slice(0,z)+j+J.slice(U)}return J}var MH;var ZQ=b(()=>{MH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function W5($,Z){let J=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;J.lastIndex=Z;let Y=J.exec($);if(!Y)return null;let X=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&TH.has(Y[1]),Q=X?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:Q,selfClosing:X,start:Y.index,end:Y.index+Y[0].length}}function DH($,Z,J){let Y=1,X=J,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(Y>0&&X<$.length){Q.lastIndex=X,G.lastIndex=X;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)Y++,X=K.index+K[0].length;else{if(Y--,Y===0)return W.index+W[0].length;X=W.index+W[0].length}}return-1}function U1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let J=DH($,Z.tag,Z.end);if(J===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:J,innerHTML:$.slice(Z.end,J-`</${Z.tag}>`.length)}}function JQ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function f5($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${J}="([^"]*)"`,"s"))||$.match(new RegExp(`${J}='([^']*)'`,"s"));return Y?Y[1]:null}function h1($,Z){let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${J}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${J}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${J}(?=\\s|$|>|/)`,"g"),"")}function u1($,Z,J){let Y=Z.selfClosing?" /":"",X=`<${Z.tag}${J}${Y}>`;return $.slice(0,Z.start)+X+$.slice(Z.end)}function kH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function EH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-for");if(X===null){J=Y.end;continue}let Q=X.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){J=Y.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((L)=>L.trim()),V=O[0],F=O[1];W=`${K} as ${F} => ${V}`}else W=`${K} as ${G}`;let q=h1(Y.attrs,"v-for"),z=h1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=U1(Z,Y),j=Z.slice(U.outerStart,U.outerEnd),H=u1(j,{...Y,start:0,end:Y.end-Y.start},z),B=`@foreach(${W})
|
|
10667
10667
|
`,_=`${B}${H}
|
|
10668
|
-
@endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function bH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-if");if(X===null){J=Y.end;continue}let Q=[],G=
|
|
10668
|
+
@endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),J=U.outerStart+B.length}return Z}function bH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-if");if(X===null){J=Y.end;continue}let Q=[],G=U1(Z,Y),K=h1(Y.attrs,"v-if"),W=u1(Z.slice(G.outerStart,G.outerEnd),{...Y,start:0,end:Y.end-Y.start},K);Q.push({type:"if",expr:X,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:Y});let q=G.outerEnd,z=!0;while(z){let _=Z.slice(q).match(/^\s*/),O=_?_[0].length:0,V=W5(Z,q+O);if(!V){z=!1;break}let F=f5(V.attrs,"v-else-if"),L=JQ(V.attrs,"v-else");if(F!==null){let w=U1(Z,V),N=h1(V.attrs,"v-else-if"),R=u1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},N);Q.push({type:"else-if",expr:F,outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:V}),q=w.outerEnd}else if(L){let w=U1(Z,V),N=h1(V.attrs,"v-else"),R=u1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},N);Q.push({type:"else",outerStart:q,outerEnd:w.outerEnd,element:R,parsedTag:V}),z=!1}else z=!1}let U=[];for(let _ of Q)if(_.type==="if")U.push(`@if(${_.expr})
|
|
10669
10669
|
${_.element}`);else if(_.type==="else-if")U.push(`@elseif(${_.expr})
|
|
10670
10670
|
${_.element}`);else U.push(`@else
|
|
10671
10671
|
${_.element}`);U.push("@endif");let j=U.join(`
|
|
10672
|
-
`),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),J=H+j.length}return Z}function SH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function yH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=Y.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=X.match(G)}if(Q){let z=
|
|
10672
|
+
`),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),J=H+j.length}return Z}function SH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function yH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=Y.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=X.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];X=X.replace(K[0],""),X+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=X.match(G)}if(Q){let z=U1(Z,Y),U=Z.slice(z.outerStart,z.outerEnd),j=u1(U,{...Y,start:0,end:Y.end-Y.start},X);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),J=z.outerStart+j.length;continue}let W=f5(Y.attrs,"v-model");if(W===null){J=Y.end;continue}if(IH.has(Y.tag)){let z=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,U=U1(Z,Y),j=Z.slice(U.outerStart,U.outerEnd),H=u1(j,{...Y,start:0,end:Y.end-Y.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),J=U.outerStart+H.length}else{let z=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let U=U1(Z,Y),j=Z.slice(U.outerStart,U.outerEnd),H=u1(j,{...Y,start:0,end:Y.end-Y.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),J=U.outerStart+H.length}}return Z}function PH($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function CH($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function vH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-html");if(X===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let Q=U1(Z,Y),G=h1(Y.attrs,"v-html"),K=Y.selfClosing?" /":"",W=`<${Y.tag}${G}${K}>{!! ${X} !!}</${Y.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),J=Q.outerStart+W.length}return Z}function xH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;let X=f5(Y.attrs,"v-text");if(X===null){J=Y.end;continue}if(Y.selfClosing){J=Y.end;continue}let Q=U1(Z,Y),G=h1(Y.attrs,"v-text"),K=Y.selfClosing?" /":"",W=`<${Y.tag}${G}${K}>{{ ${X} }}</${Y.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),J=Q.outerStart+W.length}return Z}function fH($){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 gH($){let Z=$,J=0;while(J<Z.length){let Y=W5(Z,J);if(!Y)break;if(!JQ(Y.attrs,"v-once")){J=Y.end;continue}let X=h1(Y.attrs,"v-once"),Q=U1(Z,Y),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
|
|
10673
10673
|
${u1(G,{...Y,start:0,end:Y.end-Y.start},X)}
|
|
10674
10674
|
@endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),J=Q.outerStart+W.length}return Z}function hH($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function uH($){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 YQ($){if(!kH($))return $;let Z=$;return Z=EH(Z),Z=bH(Z),Z=gH(Z),Z=PH(Z),Z=CH(Z),Z=yH(Z),Z=SH(Z),Z=uH(Z),Z=vH(Z),Z=xH(Z),Z=fH(Z),Z=hH(Z),Z}var TH,IH;var XQ=b(()=>{TH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),IH=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 k7($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}function QQ($,Z){let J=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),Y=J?J[1]:$,X=Y0(Y,Z);if(X&&typeof X==="string")return X;let Q=Y.trim();return b9.has(Q)?Q:null}function GQ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function KQ($,Z,J){let Y=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),X=Y?`<${$} ${Y}>`:`<${$}>`;if(mH.has($))return Y?`<${$} ${Y}>`:`<${$}>`;return`${X}${J}</${$}>`}async function WQ($,Z,J,Y,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=QQ(z.expr,Z);if(!U||typeof U!=="string"){let F=`<!-- dynamic component: could not resolve "${k7(GQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length);continue}if(b9.has(U)){let F=KQ(U,z.attrs,z.slotContent);Q=Q.slice(0,z.index)+F+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 F=_[1]||_[2],L=_[3];if(_[1])try{H[F]=Y0(L,Z)}catch{H[F]=L}else H[F]=L}let O=Y.componentsDir||"components",V=await e1(U,H,z.slotContent,O,Z,J,Y,new Set,X??new Set);Q=Q.slice(0,z.index)+V+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${k7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q=await dH(Q,Z,J,Y,X),Q}async function dH($,Z,J,Y,X){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let q=K.length-1;q>=0;q--){let z=K[q];try{let U=QQ(z.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${k7(GQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}if(b9.has(U)){let B=KQ(U,z.attrs,"");Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}let j=Y.componentsDir||"components",H=await e1(U,{},"",j,Z,J,Y,new Set,X??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: ${k7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q}var b9,mH;var qQ=b(()=>{I0();M0();b9=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"]),mH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function nH($){let Z=$.storageKey??"stx-color-mode",J=$.initialMode??"auto",Y=$.darkClass===void 0?"dark":$.darkClass,X=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!pH.has(J))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!iH.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(X!==null&&(typeof X!=="string"||!cH.test(X)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(X)}`);if(Q!==null&&!lH.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(Y===null&&X===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:J==="system"?"auto":J,darkClass:Y,attribute:X,autoValue:Q}}function oH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function y9($={}){let Z=nH($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${oH(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 zQ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let J=S9($);if(J===null)return $;let Y=y9(Z);return`${$.slice(0,J)}
|
|
10675
10675
|
${Y}${$.slice(J)}`}function S9($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let J=Z.index+Z[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(J));if(Y)J+=Y[0].length;return J}function aH($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length,Y=$.toLowerCase().indexOf("</head>",J),X=$.slice(J,Y===-1?$.length:Y),Q=rH.exec(X);if(!Q||X.slice(0,Q.index).trim()==="")return $;let G=X.slice(0,Q.index)+X.slice(Q.index+Q[0].length);return $.slice(0,J)+`
|
|
@@ -10697,7 +10697,7 @@ ${B}
|
|
|
10697
10697
|
</script>`;Y=Y.replace(q,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(Y))!==null){let[q,z,U,j]=W,H=z+j;if(NQ(U))continue;if(/rel=["']stylesheet["']/.test(H)||U.endsWith(".css")){let _=await RQ(U,X,Z);if(_)try{let O=await Bun.file(_).text();J.add(_);let V=`<style>
|
|
10698
10698
|
/* Source: ${U} */
|
|
10699
10699
|
${O}
|
|
10700
|
-
</style>`;Y=Y.replace(q,V),K.lastIndex=0}catch(O){}}}return Y}var MQ=b(()=>{D1()});function g9($,Z){let J=$,Y=/@json\s*\(/g,X;while((X=Y.exec(J))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,z=!1;while(W<J.length&&K>0){let L=J[W];if(z){z=!1,W++;continue}if(L==="\\"&&q){z=!0,W++;continue}if(q){if(L===q)q=null;W++;continue}if(L==='"'||L==="'"||L==="`"){q=L,W++;continue}if(L==="(")K++;else if(L===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=J.substring(G+1,W).trim(),j=J.substring(Q,W+1),H=-1,B=0,_=null,O=!1;for(let L=0;L<U.length;L++){let w=U[L];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=L;break}}let V=H>=0?U.substring(0,H).trim():U,F=H>=0?U.substring(H+1).trim():void 0;try{let L=V.trim(),w;if(
|
|
10700
|
+
</style>`;Y=Y.replace(q,V),K.lastIndex=0}catch(O){}}}return Y}var MQ=b(()=>{D1()});function g9($,Z){let J=$,Y=/@json\s*\(/g,X;while((X=Y.exec(J))!==null){let Q=X.index,G=Q+X[0].length-1,K=1,W=G+1,q=null,z=!1;while(W<J.length&&K>0){let L=J[W];if(z){z=!1,W++;continue}if(L==="\\"&&q){z=!0,W++;continue}if(q){if(L===q)q=null;W++;continue}if(L==='"'||L==="'"||L==="`"){q=L,W++;continue}if(L==="(")K++;else if(L===")"){if(K--,K===0)break}W++}if(K!==0)break;let U=J.substring(G+1,W).trim(),j=J.substring(Q,W+1),H=-1,B=0,_=null,O=!1;for(let L=0;L<U.length;L++){let w=U[L];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=L;break}}let V=H>=0?U.substring(0,H).trim():U,F=H>=0?U.substring(H+1).trim():void 0;try{let L=V.trim(),w;if(W0(L))w=q0(L,Object.keys(Z))(...Object.values(Z));else w=void 0;let N;if(F==="true")N=JSON.stringify(w,null,2);else N=JSON.stringify(w);let R=N.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");J=J.substring(0,Q)+R+J.substring(W+1),Y.lastIndex=Q+R.length}catch(L){Z1.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),Y.lastIndex=Q+j.length}}return J}function h9($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function TQ($){let Z=$,J=/@memo\s*\(/g,Y,X=[];while((Y=J.exec(Z))!==null){let Q=Y.index,G=Q+Y[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let q=Z.slice(G,W-1).trim(),z=W,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,V=H.slice(O),F=H.match(/(\s*)$/),L=F?F[0].length:0,w=V.slice(0,V.length-L),N=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(N){let[A,M,T="",I]=N,E=`<${M}${T} data-stx-memo="${q}"${I}>`;R=H.slice(0,O)+E+w.slice(A.length)+H.slice(O+w.length)}else R=`${H.slice(0,O)}<div data-stx-memo="${q}">${w}</div>${H.slice(O+w.length)}`;X.push({start:Q,end:B,replacement:R}),J.lastIndex=B}for(let Q=X.length-1;Q>=0;Q--){let G=X[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function u9($){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 IQ($){let J=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"),Y="",X=0,Q;while((Q=J.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,q=!1,z=-1;while(K<$.length){let _=$[K];if(W){if(_==="'")W=!1}else if(q){if(_==='"')q=!1}else if(_==="'")W=!0;else if(_==='"')q=!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))Y+=$.slice(X,z)+" x-cloak>",X=z+1}return Y+=$.slice(X),Y}function DQ($){let Z=/<[a-z][\w-]*/gi,J="",Y=0,X;while((X=Z.exec($))!==null){let Q=X.index,G=X[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+X[0].length,W=!1,q=!1,z=-1;while(K<$.length){let B=$[K];if(W){if(B==="'")W=!1}else if(q){if(B==='"')q=!1}else if(B==="'")W=!0;else if(B==='"')q=!0;else if(B===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+X[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!X_.test(U))continue;let j=$[z-1]==="/",H=j?z-1:z;J+=`${$.slice(Y,H)} x-cloak${j?" ":""}`,Y=H}return J+=$.slice(Y),J}var X_;var m9=b(()=>{w1();M0();X_=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function d9($,Z,J,Y){let X=typeof J==="boolean"?{enabled:J,failOnViolation:J}:J??{enabled:!1},Q=X.allowPatterns??[],G=[];for(let{pattern:K,message:W,suggestion:q}of Q_){if(Q.some((U)=>/\w/.test(U)&&W.includes(U)))continue;K.lastIndex=0;let z=$.match(K);if(z&&z.length>0){let U=$.split(`
|
|
10701
10701
|
`),j=[];U.forEach((O,V)=>{if(K.lastIndex=0,K.test(O))j.push(V+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(`
|
|
10702
10702
|
`),_=B?`
|
|
10703
10703
|
${B}`:"";G.push(` \u2717 ${W}${H}
|
|
@@ -10705,15 +10705,15 @@ ${B}`:"";G.push(` \u2717 ${W}${H}
|
|
|
10705
10705
|
${G.join(`
|
|
10706
10706
|
`)}
|
|
10707
10707
|
Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(q);else console.warn(q)}}var Q_;var p9=b(()=>{Q_=[{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 G_ from"fs";function S7($){return[...$].sort().map((Z)=>{try{let J=G_.statSync(Z);return`${Z}:${J.size}:${J.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
|
|
10708
|
-
`)}function y7($,Z,J){let Y=$.get(Z);return Y!==void 0&&Y.signature===J?Y.value:void 0}function
|
|
10709
|
-
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return
|
|
10708
|
+
`)}function y7($,Z,J){let Y=$.get(Z);return Y!==void 0&&Y.signature===J?Y.value:void 0}function j1($,Z,J,Y){return $.set(Z,{signature:J,value:Y}),Y}var l9=()=>{};var kQ={};t(kQ,{getStoreScript:()=>W_,clearStoreCache:()=>q_});import P7 from"path";function K_($,Z){for(let J of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(J[1])Z.add(J[1]);for(let J of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(J[1]??"").split(",")){let Q=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let J of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(J[1]??"").split(",")){let X=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(X))Z.add(X)}}async function W_($){let Z;if($)Z=P7.resolve($);else{let B=await e0();Z=P7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let J=new Bun.Glob("*.ts"),Y=[];try{for await(let B of J.scan({cwd:Z,absolute:!0})){let _=P7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;Y.push(B)}}catch{return j1(u5,Z,"",""),null}let X=S7(Y),Q=y7(u5,Z,X);if(Q!==void 0)return Q||null;if(Y.length===0)return j1(u5,Z,X,""),null;let G=[];for(let B of Y){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),W=[],q=new Set,z=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()});for(let B of K)try{let _=await Bun.file(B).text(),O=P7.basename(B,".ts");K_(_,q),_=d0(_),_=d$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=z.transformSync(_),W.push(`// Store: ${O}
|
|
10709
|
+
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(W.length===0)return j1(u5,Z,X,""),null;let U=W.join(`
|
|
10710
10710
|
|
|
10711
10711
|
`),H=`;(function(){
|
|
10712
10712
|
var __stx = window.stx || {};
|
|
10713
10713
|
${F1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(U)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
|
|
10714
10714
|
`)}
|
|
10715
10715
|
${U}
|
|
10716
|
-
})();`;return
|
|
10716
|
+
})();`;return j1(u5,Z,X,H),H}function q_(){u5.clear()}var u5;var EQ=b(()=>{V1();D1();K1();l9();u5=new Map});var c9,hT;var bQ=b(()=>{c9=["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"],hT=new Set(c9)});var PQ={};t(PQ,{selectComposableFiles:()=>SQ,referencedFrameworkComposables:()=>yQ,getFrameworkComposableScript:()=>B_,clearFrameworkComposableCache:()=>U_,__setRuntimeOwnedForTest:()=>H_});import C7 from"path";function U_(){P$.clear()}function SQ($){let Z=new Map;for(let J of $){let Y=C7.basename(J);if(Y.endsWith(".d.ts"))continue;let X=Y.replace(/\.[jt]s$/,"");if(X==="index")continue;if(X===Y)continue;let Q=Z.get(X);if(Q&&!Q.endsWith(".js"))continue;Z.set(X,J)}return[...Z.values()].sort()}function j_($,Z){let J=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${J}\\b`).test($)}function yQ($){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,""),J=[];for(let Y of z_){if(i9.has(Y))continue;let X=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${X}\\s*\\(`).test(Z))J.push(Y)}return J.sort()}async function B_($,Z){let J=yQ($);if(J.length===0)return null;let Y=Z??C7.join(import.meta.dir,"composables"),X=`${Y}\x00${J.join(",")}`,Q=P$.get(X);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),K=new Set(J),W=[],q=new Set,z=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:Y,absolute:!0}))z.push(_)}catch{return P$.set(X,""),null}z=SQ(z);for(let B of z){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((V)=>V!=="default")}catch{continue}if(!O.some((V)=>K.has(V)))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,""),W.push(`// ${C7.basename(B).replace(/\.[jt]s$/,"")}
|
|
10717
10717
|
${G.transformSync(_).trim()}`);for(let V of O)q.add(V)}catch(V){console.warn(`[stx] framework composable ${C7.basename(B)} could not be bundled:`,V)}}let U=J.filter((B)=>!q.has(B)&&!j_($,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(W.length===0)return P$.set(X,""),null;let j=[...q].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(`
|
|
10718
10718
|
`),H=`<script data-stx-framework-composables>
|
|
10719
10719
|
;(function(){
|
|
@@ -10723,8 +10723,8 @@ ${W.join(`
|
|
|
10723
10723
|
`)}
|
|
10724
10724
|
${j}
|
|
10725
10725
|
})();
|
|
10726
|
-
</script>`;return P$.set(X,H),H}function H_($){i9.clear();for(let Z of $)i9.add(Z)}var P$,i9,z_;var CQ=b(()=>{D1();bQ();P$=new Map,i9=new Set,z_=new Set(c9)});var xQ={};
|
|
10727
|
-
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return
|
|
10726
|
+
</script>`;return P$.set(X,H),H}function H_($){i9.clear();for(let Z of $)i9.add(Z)}var P$,i9,z_;var CQ=b(()=>{D1();bQ();P$=new Map,i9=new Set,z_=new Set(c9)});var xQ={};t(xQ,{getComposableScript:()=>V_,clearComposableCache:()=>L_});import C$ from"path";function vQ($){let Z=C$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function O_($){if($)return C$.resolve($);let Z=`<default>:${process.cwd()}`,J=n9.get(Z);if(J!==void 0)return J;let Y=await F_();if(Y!==null)n9.set(Z,Y);return Y}async function F_(){let $=await e0(),Z=$.root||process.cwd(),J=$.composablesDir;if(J)return C$.resolve(Z,J);for(let Y of __){let X=C$.resolve(Z,Y);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:X,absolute:!0}))if(!vQ(G))return X}catch{}}return null}async function V_($){let Z=await O_($);if(!Z)return null;let J=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(vQ(_))continue;J.push(_)}}catch{return j1(m5,Z,"",""),null}let Y=S7(J),X=y7(m5,Z,Y);if(X!==void 0)return X||null;if(J.length===0)return j1(m5,Z,Y,""),null;J.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),G=[],K=new Set,W=new Set;for(let B of J)try{let _=await Bun.file(B).text(),O=C$.basename(B,".ts");for(let V of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(V[1])W.add(V[1]);try{for(let V of Q.scan(_).exports)if(V!=="default")K.add(V)}catch{}_=d0(_),_=d$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
|
|
10727
|
+
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return j1(m5,Z,Y,""),null;let q=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
|
|
10728
10728
|
`),z=JSON.stringify([...K]),U=G.join(`
|
|
10729
10729
|
|
|
10730
10730
|
`),H=`;(function(){
|
|
@@ -10748,7 +10748,7 @@ ${q}
|
|
|
10748
10748
|
}
|
|
10749
10749
|
window[__n] = __c[__n];
|
|
10750
10750
|
}
|
|
10751
|
-
})();`;return
|
|
10751
|
+
})();`;return j1(m5,Z,Y,H),H}function L_(){m5.clear(),n9.clear()}var m5,n9,__;var fQ=b(()=>{V1();D1();l9();K1();m5=new Map,n9=new Map,__=["composables","functions"]});var hQ={};t(hQ,{processDeferDirectives:()=>M_});function w_(){return`stx-defer-${++gQ}`}function N_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function R_($,Z,J){let{trigger:Y,value:X}=N_(Z),Q=J,G,K,W,q=J.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)G=q[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=J.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=J.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)W=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:Y,triggerValue:X,content:Q,placeholder:G,loading:K,error:W}}function A_($,Z){let{trigger:J,triggerValue:Y}=Z,X;switch(J){case"visible":X=`
|
|
10752
10752
|
const observer = new IntersectionObserver((entries) => {
|
|
10753
10753
|
if (entries[0].isIntersecting) {
|
|
10754
10754
|
observer.disconnect();
|
|
@@ -10829,7 +10829,7 @@ else {
|
|
|
10829
10829
|
${U}
|
|
10830
10830
|
</div>
|
|
10831
10831
|
${H}
|
|
10832
|
-
`})}var gQ=0;var mQ={};
|
|
10832
|
+
`})}var gQ=0;var mQ={};t(mQ,{processTeleportDirectives:()=>k_,ensureTeleportTargets:()=>E_});function T_(){return`stx-teleport-${++uQ}`}function I_($){let Z=$.split(",").map((X)=>X.trim()),J=Z[0].replace(/['"]/g,""),Y;for(let X=1;X<Z.length;X++){let Q=Z[X].match(/disabled:\s*(.+)/);if(Q)Y=Q[1].trim()}return{target:J,disabled:Y}}function D_($,Z){return`
|
|
10833
10833
|
<script>
|
|
10834
10834
|
(function() {
|
|
10835
10835
|
const source = document.getElementById('${$}');
|
|
@@ -10897,7 +10897,7 @@ else {
|
|
|
10897
10897
|
});
|
|
10898
10898
|
})();
|
|
10899
10899
|
</script>
|
|
10900
|
-
`}var uQ=0;var cQ={};
|
|
10900
|
+
`}var uQ=0;var cQ={};t(cQ,{processTransitionDirectives:()=>P_,processTransitionAttributes:()=>f_,performLeave:()=>y_,performEnter:()=>S_,generateTransitionRuntime:()=>x_,generateTransitionCSS:()=>v_});function dQ($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function b_($){let Z=getComputedStyle($),J=Z.transitionDuration||"0s",Y=Z.animationDuration||"0s",X=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(X(J),X(Y))}function pQ($,Z){return new Promise((J)=>{let Y=Z??b_($);if(Y===0){J();return}let X=!1,Q=()=>{if(X)return;X=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),J()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,Y+50)})}function lQ($){$.offsetHeight}async function S_($,Z={}){let J=Z.name||"stx",Y=dQ(J,Z),X=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(Y.enterFrom),$.classList.add(Y.enterActive),lQ($),$.classList.remove(Y.enterFrom),$.classList.add(Y.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await pQ($,X);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),Z.onAfterEnter?.($)}async function y_($,Z={}){let J=Z.name||"stx",Y=dQ(J,Z),X=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(Y.leaveFrom),$.classList.add(Y.leaveActive),lQ($),$.classList.remove(Y.leaveFrom),$.classList.add(Y.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await pQ($,X);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),Z.onAfterLeave?.($)}function P_($,Z={},J){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(X,Q,G)=>{let K=C_(Q),W=K.name||"stx",q=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
10901
10901
|
<div
|
|
10902
10902
|
class="stx-transition-wrapper"
|
|
10903
10903
|
data-transition="${W}"
|
|
@@ -11215,7 +11215,7 @@ else {
|
|
|
11215
11215
|
|
|
11216
11216
|
console.log('[stx] Transition runtime initialized');
|
|
11217
11217
|
})();
|
|
11218
|
-
`}function f_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(J,Y,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var nQ={};
|
|
11218
|
+
`}function f_($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(J,Y,X,Q)=>{let G=X||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var nQ={};t(nQ,{withErrorBoundary:()=>iQ,processErrorBoundaryDirectives:()=>u_,generateErrorBoundaryRuntime:()=>c_,generateErrorBoundaryCSS:()=>l_,createErrorBoundary:()=>p_});function h_(){return`eb-${++g_}-${Date.now().toString(36)}`}function u_($,Z={},J){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(X,Q,G,K)=>{let W=h_(),q=m_(Q||"");return d_(W,G.trim(),K.trim(),q)})}function m_($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3]||Y[4];switch(X){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function d_($,Z,J,Y){let X=Y.logErrors!==!1;return`
|
|
11219
11219
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
11220
11220
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
11221
11221
|
${Z}
|
|
@@ -11444,7 +11444,7 @@ else {
|
|
|
11444
11444
|
|
|
11445
11445
|
console.log('[stx] Error boundary runtime initialized');
|
|
11446
11446
|
})();
|
|
11447
|
-
`}var g_=0;var oQ={};
|
|
11447
|
+
`}var g_=0;var oQ={};t(oQ,{renderSSRSuspense:()=>t_,processSuspenseDirectives:()=>o_,generateSuspenseRuntime:()=>$O,generateSuspenseCSS:()=>e_,createSSRSuspense:()=>a_});function n_(){return`suspense-${++i_}-${Date.now().toString(36)}`}function o_($,Z={},J){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(X,Q,G,K)=>{let W=n_(),q=s_(Q||"");return r_(W,G.trim(),K.trim(),q)})}function s_($){let Z={},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3],G=Y[4];switch(X){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function r_($,Z,J,Y){let X=Y.timeout||30000,Q=Y.id||$;return`
|
|
11448
11448
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
|
|
11449
11449
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
11450
11450
|
${J}
|
|
@@ -11782,7 +11782,7 @@ else {
|
|
|
11782
11782
|
|
|
11783
11783
|
console.log('[stx] Suspense runtime initialized');
|
|
11784
11784
|
})();
|
|
11785
|
-
`}var i_=0;var tQ={};
|
|
11785
|
+
`}var i_=0;var tQ={};t(tQ,{processAsyncDirectives:()=>JO,isAsyncComponent:()=>XO,generateAsyncComponentRuntime:()=>GO,generateAsyncComponentCSS:()=>QO,defineAsyncComponent:()=>YO});function sQ(){return`async-${++ZO}-${Date.now().toString(36)}`}function JO($,Z={},J){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(Y,(G,K,W,q)=>{let z=sQ(),U=rQ(K);return aQ(z,U,W.trim(),q.trim())}),Q=Q.replace(X,(G,K,W)=>{let q=sQ(),z=rQ(K);return aQ(q,z,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function rQ($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3],G=Y[4],K=Y[5];switch(X){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function aQ($,Z,J,Y){let{component:X,timeout:Q,delay:G,suspensible:K,retries:W}=Z;return`
|
|
11786
11786
|
<div class="stx-async-component" data-async-id="${$}" data-component="${X}" data-status="pending">
|
|
11787
11787
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
11788
11788
|
${J}
|
|
@@ -12137,7 +12137,7 @@ catch (error) {
|
|
|
12137
12137
|
|
|
12138
12138
|
console.log('[stx] Async component runtime initialized');
|
|
12139
12139
|
})();
|
|
12140
|
-
`}var ZO=0;var $G={};
|
|
12140
|
+
`}var ZO=0;var $G={};t($G,{shouldCacheComponent:()=>jO,processKeepAliveDirectives:()=>WO,onDeactivated:()=>OO,onActivated:()=>_O,generateKeepAliveRuntime:()=>HO,generateKeepAliveCSS:()=>BO,createKeepAliveCache:()=>UO});function eQ(){return`keep-alive-${++KO}-${Date.now().toString(36)}`}function WO($,Z={},J){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(X,Q,G)=>{let K=eQ(),W=qO(Q||"");return zO(K,G.trim(),W)})}function qO($){let Z={max:10},J=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=J.exec($))!==null){let X=Y[1],Q=Y[2]||Y[3],G=Y[4];switch(X){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function zO($,Z,J){let{max:Y,include:X,exclude:Q}=J,G=J.id||$;return`
|
|
12141
12141
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
|
|
12142
12142
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
12143
12143
|
${Z}
|
|
@@ -12485,7 +12485,7 @@ else {
|
|
|
12485
12485
|
|
|
12486
12486
|
console.log('[stx] Keep-alive runtime initialized');
|
|
12487
12487
|
})();
|
|
12488
|
-
`}function _O($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function OO($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var KO=0;var QG={};
|
|
12488
|
+
`}function _O($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function OO($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var KO=0;var QG={};t(QG,{useVirtualList:()=>JG,processVirtualListDirectives:()=>s9,processVirtualGridDirectives:()=>XG,processInfiniteListDirectives:()=>YG,generateVirtualListCSS:()=>ZG,default:()=>FO,createVirtualList:()=>o9});function o9($,Z){let{itemHeight:J,containerHeight:Y,overscan:X=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=J,direction:W="vertical"}=Z,q=[...$],z=0,U=new Map;function j(){if(G)return H();let R=Math.max(0,Math.floor(z/J)-X),A=Math.ceil(Y/J),M=Math.min(q.length-1,R+A+X*2);return{startIndex:R,endIndex:M}}function H(){let R=0,A=0,M=q.length-1;for(let T=0;T<q.length;T++){let I=U.get(T)||K;if(R+I>z){A=Math.max(0,T-X);break}R+=I}R=0;for(let T=0;T<q.length;T++){let I=U.get(T)||K;if(R+=I,R>z+Y){M=Math.min(q.length-1,T+X);break}}return{startIndex:A,endIndex:M}}function B(){if(G){let R=0;for(let A=0;A<q.length;A++)R+=U.get(A)||K;return R}return q.length*J}function _(R){if(G){let A=0;for(let M=0;M<R;M++)A+=U.get(M)||K;return A}return R*J}function O(){let{startIndex:R,endIndex:A}=j();return{startIndex:R,endIndex:A,scrollTop:z,totalHeight:B(),visibleItems:q.slice(R,A+1),itemHeights:new Map(U)}}function V(R,A="auto"){let M=_(R);F(M,A)}function F(R,A="auto"){z=Math.max(0,Math.min(R,B()-Y))}function L(){j()}function w(R){q=[...R],U.clear(),L()}function N(){q=[],U.clear()}return{scrollToIndex:V,scrollToOffset:F,getState:O,refresh:L,setItems:w,destroy:N}}function s9($,Z={},J){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(Y,(X,Q,G,K)=>{let W=Q.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let F=G.trim(),L=Function(`return ${F}`)();z={...z,...L}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.containerHeight/z.itemHeight),H=z.overscan||3,B=0,_=Math.min(q.length-1,j+H),O="";for(let F=B;F<=_&&F<q.length;F++){let L=q[F],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof L==="object"?JSON.stringify(L):String(L)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,R)=>{if(typeof L==="object"&&L!==null)return String(L[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(F));O+=`
|
|
12489
12489
|
<div class="virtual-item ${z.itemClass||""}"
|
|
12490
12490
|
style="position: absolute; top: ${F*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
|
|
12491
12491
|
data-index="${F}">
|
|
@@ -12858,7 +12858,7 @@ else {
|
|
|
12858
12858
|
stxIslands.initIslands();
|
|
12859
12859
|
}
|
|
12860
12860
|
})();
|
|
12861
|
-
</script>`}function WG($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let J=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function qG($,Z){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=Y.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)J[Q]=Z[G];else J[Q]=G}return J}var wG={};
|
|
12861
|
+
</script>`}function WG($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let J=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(J)return J[1];return null}function qG($,Z){let J={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,X;while((X=Y.exec($))!==null){let Q=X[1],G=X[2];if(G in Z)J[Q]=Z[G];else J[Q]=G}return J}var wG={};t(wG,{processStaticDirectives:()=>VG,processPartialHydrationDirectives:()=>UG,onHydrated:()=>FG,isHydrated:()=>OG,hydrateIsland:()=>BG,hydrateByStrategy:()=>HG,hydrateAll:()=>_G,generatePartialHydrationCSS:()=>jG,generateIslandManifest:()=>LG,default:()=>TO,createIslandRegistry:()=>zG});function zG(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let J=$.get(Z);if(!J||J.hydrated)return;if(J.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:J.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((J)=>!J.hydrated).map((J)=>this.hydrate(J.id));await Promise.all(Z)}}}function VO($){return`
|
|
12862
12862
|
<script data-hydrate="${$}">
|
|
12863
12863
|
(function() {
|
|
12864
12864
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -13086,7 +13086,7 @@ else {
|
|
|
13086
13086
|
<script type="application/json" id="stx-island-manifest">
|
|
13087
13087
|
${JSON.stringify(Z)}
|
|
13088
13088
|
</script>
|
|
13089
|
-
`}var TO;var NG=b(()=>{TO={processPartialHydrationDirectives:UG,processStaticDirectives:VG,generatePartialHydrationCSS:jG,generateIslandManifest:LG,createIslandRegistry:zG,hydrateIsland:BG,hydrateByStrategy:HG,hydrateAll:_G,isHydrated:OG,onHydrated:FG}});var yG={};
|
|
13089
|
+
`}var TO;var NG=b(()=>{TO={processPartialHydrationDirectives:UG,processStaticDirectives:VG,generatePartialHydrationCSS:jG,generateIslandManifest:LG,createIslandRegistry:zG,hydrateIsland:BG,hydrateByStrategy:HG,hydrateAll:_G,isHydrated:OG,onHydrated:FG}});var yG={};t(yG,{watchMultiple:()=>IG,watchEffect:()=>DG,watch:()=>TG,unref:()=>RG,toRefs:()=>AG,throttledComputed:()=>SG,stxWatchMultiple:()=>IG,stxWatchEffect:()=>DG,stxWatch:()=>TG,stxUnref:()=>RG,stxToRefs:()=>AG,stxThrottledComputed:()=>SG,stxShallowRef:()=>MG,stxRef:()=>p5,stxIsRef:()=>m1,stxDebouncedComputed:()=>bG,stxComputed:()=>x$,shallowRef:()=>MG,ref:()=>p5,processWatchDirectives:()=>EG,processComputedDirectives:()=>kG,isRef:()=>m1,default:()=>IO,debouncedComputed:()=>bG,computed:()=>x$});function p5($){let Z=$,J=new Set,Y={get value(){if(B1){let X=v$.get(Y);if(!X)X=new Set,v$.set(Y,X);X.add(B1)}return Z},set value(X){if(!Object.is(Z,X)){Z=X,J.forEach((G)=>G(X));let Q=v$.get(Y);if(Q)Q.forEach((G)=>G())}},subscribe(X){return J.add(X),()=>J.delete(X)},peek(){return Z}};return Y}function m1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function RG($){return m1($)?$.value:$}function AG($){let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=p5($[J]);return Z}function MG($){return p5($)}function x$($){let Z=typeof $==="function",J=Z?$:$.get,Y=Z?void 0:$.set,X=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,W=new Set,q=()=>{if(G=!0,W.size>0){let j=U.value;W.forEach((H)=>H(j))}};function z(){K.clear();let j=B1;B1=q,v7.push(q);try{return J()}finally{v7.pop(),B1=j}}let U={get value(){if(B1){let j=v$.get(U);if(!j)j=new Set,v$.set(U,j);j.add(B1)}if(G){let j=z();if(!X(Q,j))Q=j;G=!1}return Q},set value(j){if(Y)Y(j);else console.warn("Computed property is readonly")},subscribe(j){return W.add(j),()=>W.delete(j)},peek(){if(G)Q=J(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function TG($,Z,J={}){let{immediate:Y=!1,deep:X=!1,flush:Q="pre",once:G=!1}=J,K,W=!0,q=!1,z=()=>{if(m1($))return X?q5($.value):$.value;return $()},U=()=>{if(!W||q)return;let B=z();if(K!==void 0&&Object.is(K,B)&&!X)return;let _=()=>{if(Z(B,K),K=X?q5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(m1($))j=$.subscribe(()=>U());else j=x$($).subscribe(()=>U());if(Y)K=void 0,U();else K=z();let H=()=>{if(W=!1,j)j(),j=null};return H.pause=()=>{q=!0},H.resume=()=>{q=!1},H}function IG($,Z,J={}){let{immediate:Y=!1,once:X=!1}=J,Q=$.map((U)=>m1(U)?U.value:void 0),G=!0,K=!1,W=()=>{if(!G||K)return;let U=$.map((j)=>m1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],X)z()},q=$.map((U)=>{if(m1(U))return U.subscribe(()=>W());return()=>{}});if(Y)W();let z=()=>{G=!1,q.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function DG($,Z={}){let{flush:J="pre"}=Z,Y,X=!0,Q=!1,G=()=>{if(!X||Q)return;if(Y)Y();let W=B1;B1=G,v7.push(G);try{Y=$()}finally{v7.pop(),B1=W}};if(J==="sync")G();else if(J==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(X=!1,Y)Y()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function kG($,Z={},J){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(Y,(X,Q,G)=>{try{let W=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=W,`<!-- computed: ${Q} = ${W} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function EG($,Z={},J){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(X,Q,G)=>{return`
|
|
13090
13090
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
13091
13091
|
(function() {
|
|
13092
13092
|
// Watch implementation for ${Q}
|
|
@@ -13098,9 +13098,9 @@ else {
|
|
|
13098
13098
|
}
|
|
13099
13099
|
})();
|
|
13100
13100
|
</script>
|
|
13101
|
-
`})}function q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>q5(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,X)=>J.set(q5(X),q5(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(q5(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=q5($[J]);return Z}function bG($,Z=100){let J=p5($()),Y=null,X=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return x$($).subscribe(()=>X()),{get value(){return J.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function SG($,Z=100){let J=p5($()),Y=0,X=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return x$($).subscribe(()=>X()),{get value(){return J.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var
|
|
13101
|
+
`})}function q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>q5(J));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let J=new Map;return $.forEach((Y,X)=>J.set(q5(X),q5(Y))),J}if($ instanceof Set){let J=new Set;return $.forEach((Y)=>J.add(q5(Y))),J}let Z={};for(let J in $)if(Object.prototype.hasOwnProperty.call($,J))Z[J]=q5($[J]);return Z}function bG($,Z=100){let J=p5($()),Y=null,X=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{J.value=$()},Z)};return x$($).subscribe(()=>X()),{get value(){return J.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}function SG($,Z=100){let J=p5($()),Y=0,X=()=>{let G=Date.now();if(G-Y>=Z)Y=G,J.value=$()};return x$($).subscribe(()=>X()),{get value(){return J.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:J.subscribe,peek:J.peek,invalidate(){X()},get dirty(){return!1},get deps(){return new Set}}}var B1=null,v7,v$,IO;var PG=b(()=>{v7=[],v$=new WeakMap;IO={ref:p5,computed:x$,watch:TG,watchMultiple:IG,watchEffect:DG,isRef:m1,unref:RG,toRefs:AG,shallowRef:MG,debouncedComputed:bG,throttledComputed:SG,processComputedDirectives:kG,processWatchDirectives:EG}});function f$($,Z){let J={};for(let Y of $)J[Y]=C1(Z(Y));return new Proxy({},{get:(Y,X)=>J[X]?.(),set:(Y,X,Q)=>{if(J[X])J[X].set(Q);else J[X]=C1(Q);return!0},has:(Y,X)=>(X in J),deleteProperty:(Y,X)=>{return delete J[X],!0},ownKeys:()=>Reflect.ownKeys(J),getOwnPropertyDescriptor:(Y,X)=>(X in J)?{enumerable:!0,configurable:!0,writable:!0,value:J[X]()}:void 0})}function DO($,Z){let J={};for(let Y of Z)J[Y]=$[Y];return J}function r9($,Z){let J=Object.keys($),Y=f$(J,(F)=>Z?.[F]??$[F].getDefaultValue()),X=f$(J,()=>[]),Q=f$(J,()=>!1),G=f$(J,()=>!1),K=f$(J,()=>!1),W=C1(!1);async function q(F){K[F]=!0;let L=await $[F].validate(Y[F],Y);return X[F]=L,K[F]=!1,L.length===0}async function z(){W.set(!0);let F=await Promise.all(J.map(q));return W.set(!1),F.every(Boolean)}function U(){for(let F of J)Y[F]=Z?.[F]??$[F].getDefaultValue(),X[F]=[],Q[F]=!1,G[F]=!1}function j(F){for(let L of J)if(L in F)Y[L]=F[L],G[L]=!0}function H(F,L){Y[F]=L,G[F]=!0}function B(F,L=!0){if(Q[F]=L,L)q(F)}function _(F){return{value:Y[F],errors:X[F],touched:Q[F],dirty:G[F],valid:X[F].length===0,validating:K[F]}}function O(F){return async(L)=>{L?.preventDefault?.();for(let N of J)Q[N]=!0;if(await z())await F(DO(Y,J))}}return{values:Y,errors:X,touched:Q,dirty:G,get isValid(){return J.every((F)=>X[F].length===0)},get isValidating(){return W()||J.some((F)=>K[F])},get isDirty(){return J.some((F)=>G[F])},validate:z,validateField:q,reset:U,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var CG;var vG=b(()=>{H4();CG=r9});var hG={};t(hG,{v:()=>kO,useForm:()=>r9,processHasErrorsDirective:()=>gG,processFormValidationDirectives:()=>EO,processErrorsDirective:()=>fG,processErrorDirective:()=>xG,defineForm:()=>CG,Validator:()=>l5});class l5{rules=[];defaultValue="";addRule($){let Z=new l5;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 J=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=$||J}})}max($,Z){let J=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:J,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=$||J}})}length($,Z,J){let Y=J||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:Y,validate:(X)=>{if(!X)return!0;let Q=String(X).length;return Q>=$&&Q<=Z||Y}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(J)=>{if(!J)return!0;return $.test(String(J))||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:(J)=>{if(!J&&J!==0)return!0;return!Number.isNaN(Number(J))||$}});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 J=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=$||J}})}maxValue($,Z){let J=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=$||J}})}between($,Z,J){let Y=J||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;let Q=Number(X);return Q>=$&&Q<=Z||Y}})}matches($,Z){let J=Z||`Must match ${$}`;return this.addRule({name:"matches",message:J,validate:(Y,X)=>{if(!X)return!0;return Y===X[$]||J}})}oneOf($,Z){let J=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:J,validate:(Y)=>{if(!Y)return!0;return $.includes(Y)||J}})}notOneOf($,Z){let J=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:J,validate:(Y)=>{if(!Y)return!0;return!$.includes(Y)||J}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let J=new Date(String(Z));return!Number.isNaN(J.getTime())||$}})}before($,Z){let J=new Date($),Y=Z||`Must be before ${J.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(X)=>{if(!X)return!0;return new Date(String(X))<J||Y}})}after($,Z){let J=new Date($),Y=Z||`Must be after ${J.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(X)=>{if(!X)return!0;return new Date(String(X))>J||Y}})}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 J=new l5;J.rules=[...this.rules],J.defaultValue=this.defaultValue;for(let Y of Z.getRules())J.rules.push({...Y,validate:(X,Q)=>{if(!$(X,Q||{}))return!0;return Y.validate(X,Q)}});return J}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new l5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let J=[];for(let Y of this.rules){let X=await Y.validate($,Z);if(X!==!0)J.push(X)}return J}validateSync($,Z){let J=[];for(let Y of this.rules){if(Y.async)continue;let X=Y.validate($,Z);if(X!==!0)J.push(X)}return J}}function xG($,Z,J){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(Y,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
|
|
13102
13102
|
`)}catch{return""}})}function fG($,Z,J){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(Y,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
|
|
13103
|
-
`)}catch{return""}})}function gG($,Z,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function EO($,Z,J){let Y=$;return Y=xG(Y,Z,J),Y=fG(Y,Z,J),Y=gG(Y,Z,J),Y}var kO;var uG=b(()=>{vG();kO=new l5});var pG={};
|
|
13103
|
+
`)}catch{return""}})}function gG($,Z,J){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(X,Q,G)=>{try{let K=Q.trim().split("."),W=Z;for(let z of K)if(W&&typeof W==="object"&&z in W)W=W[z];else return"";let q=W;if(!q||!Array.isArray(q)||q.length===0)return"";return G}catch{return""}})}function EO($,Z,J){let Y=$;return Y=xG(Y,Z,J),Y=fG(Y,Z,J),Y=gG(Y,Z,J),Y}var kO;var uG=b(()=>{vG();kO=new l5});var pG={};t(pG,{processXElementDirectives:()=>bO,hasXElementDirectives:()=>dG,generateXElementRuntime:()=>mG});function mG(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
13104
13104
|
(function() {
|
|
13105
13105
|
'use strict';
|
|
13106
13106
|
|
|
@@ -13386,7 +13386,7 @@ else {
|
|
|
13386
13386
|
})();
|
|
13387
13387
|
</script>`}function dG($){return/\bx-data(?:\s|=)/.test($)}function bO($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,J=$.match(Z)||[],Y=J.length>0?$.replace(Z,""):$;if(!dG(Y))return Y;let X=J[0]?.trim()||mG(),Q=Y.lastIndexOf("</body>");if(Q!==-1)return Y.slice(0,Q)+X+`
|
|
13388
13388
|
`+Y.slice(Q);return Y+`
|
|
13389
|
-
`+X}var lG={};
|
|
13389
|
+
`+X}var lG={};t(lG,{rewriteImagesWithSiblings:()=>PO});import A1 from"path";async function PO($,Z){let J=Z.formats??yO;if(!Z.publicDir)return $;let Y=xO($),X=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],j=U.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(fO(K.index,Y))continue;G.push({idx:K.index,length:U.length,src:j[1],raw:U})}if(G.length===0)return $;let W=await Promise.all(G.map(async(U)=>{let j=await CO(U.src,Z.publicDir,J);return{match:U,sources:j}}));for(let{match:U,sources:j}of W){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${gO(_.url)}">`).join("")}${U.raw}</picture>`;X.push({start:U.idx,end:U.idx+U.length,replacement:B})}if(X.length===0)return $;let q="",z=0;for(let U of X)q+=$.slice(z,U.start),q+=U.replacement,z=U.end;return q+=$.slice(z),q}async function CO($,Z,J){if(!vO($))return[];let Y=A1.extname($).toLowerCase();if(!SO.has(Y))return[];if(!$.startsWith("/"))return[];let X=A1.join(Z,$.slice(1)),Q=A1.dirname(X),G=A1.basename(X,Y),K=A1.resolve(Q),W=A1.resolve(Z);if(!K.startsWith(W))return[];let q=A1.posix.dirname($),z=J.map(async(j)=>{let H=A1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:A1.posix.join(q,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(z)).filter((j)=>j!==null)}function vO($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function xO($){let Z=[],J=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=J.exec($))!==null)Z.push([Y.index,Y.index+Y[0].length]);return Z}function fO($,Z){for(let[J,Y]of Z)if($>=J&&$<Y)return!0;return!1}function gO($){return $.replace(/&/g,"&").replace(/"/g,""")}var SO,yO;var cG=b(()=>{SO=new Set([".jpg",".jpeg",".png",".gif"]),yO=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var iG=()=>{};function a9($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var nG=b(()=>{iG()});var oG={};t(oG,{injectPwaTags:()=>hO,generateThemeColorMeta:()=>dO,generateSwRegistrationScript:()=>uO,generatePwaTags:()=>x7,generateManifestLink:()=>mO});function x7($){let Z=$.pwa;if(!Z?.enabled)return"";let J=Z.manifest,Y=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",X=a9($),Q=`
|
|
13390
13390
|
<!-- stx PWA Meta Tags -->
|
|
13391
13391
|
<link rel="manifest" href="/manifest.json">
|
|
13392
13392
|
<meta name="theme-color" content="${t9(J?.themeColor||"#000000")}">
|
|
@@ -13452,32 +13452,32 @@ if ('serviceWorker' in navigator) {
|
|
|
13452
13452
|
`+X.slice(Q)}async function F0($,Z,J,Y,X){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=L1($);let Q=!Z.__stxProcessingDepth;if(Q)XZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((Y.debug||!L$()&&!a4())&&J&&J.endsWith(".stx"))n6($,J);try{return await IZ.timeAsync("template-processing",async()=>{let G=await nO($,Z,J,Y,X);if(Q)G=u9(G);if(Q&&Y.autoShell&&Y.buildMode!=="compile"){let K=Y.app?.head||{},q=(Z.__stx_runtime_head||null)??B3(),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=q.title||U||H,_=!q.title&&(!!U||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...q.meta||[]],link:[...K.link||[],...q.link||[]],script:[...K.script||[],...q.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
|
|
13453
13453
|
`),...q.htmlAttrs&&{htmlAttrs:_Q(K.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...q.bodyAttrs}}},V=f9(G);if(G=LQ(G,O,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),V)G=VQ(G,K),G=OQ(G,O.htmlAttrs);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let N=F[1],R=lO(N);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
|
|
13454
13454
|
<meta name="stx-layout" content="${rG(N)}">
|
|
13455
|
-
<meta name="stx-layout-group" content="${rG(R)}">`)}let L=G.match(/function (__stx_setup_\d+_\d+)\(/),w=L?Q4(G):null;if(L&&w&&!/\bdata-stx=/.test(w.tag)){G=N3(G,(R,A)=>`<body${A} data-stx="${L[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=FQ(G);let K=Y.app?.colorMode;if(K)G=zQ(G,K);G=jQ(G),G=iO(G)}if(Q)try{let{getStoreScript:K}=await
|
|
13456
|
-
`+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await
|
|
13457
|
-
`+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await
|
|
13458
|
-
`+z+G.slice(U.end)}}catch{}if(Q)G=UQ(G);if(Q&&Z.__stx_inject_css!==!1)G=await A$(G,void 0,Y.buildMode==="serve");if(Q)G=SZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Z7)throw G;let K=G instanceof Error?G.message:String(G),W=new J5(`Template processing failed: ${K}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(
|
|
13455
|
+
<meta name="stx-layout-group" content="${rG(R)}">`)}let L=G.match(/function (__stx_setup_\d+_\d+)\(/),w=L?Q4(G):null;if(L&&w&&!/\bdata-stx=/.test(w.tag)){G=N3(G,(R,A)=>`<body${A} data-stx="${L[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${L[1]}"`,"i");G=G.replace(N,"$1")}}if(Q){G=FQ(G);let K=Y.app?.colorMode;if(K)G=zQ(G,K);G=jQ(G),G=iO(G)}if(Q)try{let{getStoreScript:K}=await e("stx/store-loader",()=>Promise.resolve().then(() => (EQ(),kQ))),W=Y.storesDir,q=await K(W);if(q){let z=`<script data-stx-stores>${q}</script>`,U=c5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
13456
|
+
`+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (CQ(),PQ))),W=await K(G);if(W){let q=c5(G,"data-stx-stores")||c5(G,"data-stx-runtime");if(q)G=G.slice(0,q.end)+`
|
|
13457
|
+
`+W+G.slice(q.end)}}catch{}if(Q)try{let{getComposableScript:K}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (fQ(),xQ))),W=Y.composablesDir,q=await K(W);if(q){let z=`<script data-stx-composables>${q}</script>`,U=c5(G,"data-stx-stores")||c5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
|
|
13458
|
+
`+z+G.slice(U.end)}}catch{}if(Q)G=UQ(G);if(Q&&Z.__stx_inject_css!==!1)G=await A$(G,void 0,Y.buildMode==="serve");if(Q)G=SZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Z7)throw G;let K=G instanceof Error?G.message:String(G),W=new J5(`Template processing failed: ${K}`,J,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Z1.log(W,{filePath:J,context:Z}),R6.logDetailedError(W,{filePath:J,template:$.substring(0,500)}),Y.debug)throw W;return w6.createFallbackContent("Template Processing",W)}}async function nO($,Z,J,Y,X){let Q=process.cwd(),G={...Y,partialsDir:Y.partialsDir&&!y0.isAbsolute(Y.partialsDir)?y0.resolve(Q,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!y0.isAbsolute(Y.componentsDir)?y0.resolve(Q,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!y0.isAbsolute(Y.layoutsDir)?y0.resolve(Q,Y.layoutsDir):Y.layoutsDir},K=G,W=$;await rO(J,Z),sO(Z,K),W=await k5(()=>iX(W,Z,J,K),W,(L)=>{Z1.log(L,{filePath:J,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${J}: ${L.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=W1(W,G$,(L,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);W=q.output;let z=q.tokens,U=(L)=>z.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,N)=>z[Number(N)]??""),j="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,j),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(L,w)=>{return`{{ ${w} }}`}),W=YQ(W),W=await AQ(W,J,X);let H={};W=D9(W,H);let B={...Z.__sections||{}},_="",O=jY(z7($)),V=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let F=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)_=F[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(W))W=`@section('content')
|
|
13459
13459
|
${W.trim()}
|
|
13460
13460
|
@endsection`}if(!_&&!V&&K.defaultLayout){let L=x9(W),w=/@section\s*\(/.test(W);if(!L||w){let N="",R=y0.dirname(J),A=K.layoutsDir?y0.dirname(K.layoutsDir):process.cwd();for(let M=0;M<20;M++){let T=y0.join(R,"_layout.stx");if(await c(T)){N=T;break}let I=y0.dirname(R);if(I===R||I.length<A.length)break;R=I}if(N)_=N;else if(K.layoutsDir){let M=y0.isAbsolute(K.layoutsDir)?K.layoutsDir:y0.resolve(process.cwd(),K.layoutsDir),T=y0.join(M,`${K.defaultLayout}.stx`);if(await c(T))_=T}if(_&&!w)W=`@section('content')
|
|
13461
13461
|
${W.trim()}
|
|
13462
|
-
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,N)=>{return B[w]=N,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return L;try{let R=Y0(N.trim(),Z);if(R===void 0)return L;return B[w]=String(R??""),""}catch{return L}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",z5);else B[w]=N.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=k9(W,H),_){let L=[],w=E1(W),N=
|
|
13462
|
+
@endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,w,N)=>{return B[w]=N,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,w,N)=>{if(/^(['"]).*\1$/.test(N.trim()))return L;try{let R=Y0(N.trim(),Z);if(R===void 0)return L;return B[w]=String(R??""),""}catch{return L}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,w,N)=>{if(N.includes("@parent"))B[w]=N.replace("@parent",z5);else B[w]=N.trim();return""}),Z.__sections=B,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,w,N)=>{return B[w]||N||""}),!("slot"in Z)||Z.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(W=k9(W,H),_){let L=[],w=E1(W),N=W1(w.output,L5,(R,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(W=N.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,A,M)=>{let T=A==="SCRIPT"?w.scripts[Number(M)]:N.tokens[Number(M)];if(T)L.push(T);return""}),L.length>0){let R=L.join(`
|
|
13463
13463
|
`);B.content=B.content?`${B.content}
|
|
13464
|
-
${R}`:R,Z.__sections=B}}if(_)try{let L;if(y0.isAbsolute(_))L=_,X.add(_);else L=await k5(()=>h3(_,J,G,X),null,()=>{throw new J5(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let T=[];try{let E=G.layoutsDir;if(E){let D=y0.isAbsolute(E)?E:y0.resolve(process.cwd(),E);T=pO.readdirSync(D).filter((y)=>y.endsWith(".stx")).map((y)=>y.replace(/\.stx$/,"")).sort()}}catch{}let I=`Layout not found: ${_} (referenced from ${J})`+(T.length>0?`. Available layouts: ${T.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(
|
|
13465
|
-
${W}`,U(W)}catch(L){return
|
|
13464
|
+
${R}`:R,Z.__sections=B}}if(_)try{let L;if(y0.isAbsolute(_))L=_,X.add(_);else L=await k5(()=>h3(_,J,G,X),null,()=>{throw new J5(`Failed to resolve layout path: ${_}`,J,void 0,void 0,`Layout referenced from ${J}`)});if(!L){let T=[];try{let E=G.layoutsDir;if(E){let D=y0.isAbsolute(E)?E:y0.resolve(process.cwd(),E);T=pO.readdirSync(D).filter((y)=>y.endsWith(".stx")).map((y)=>y.replace(/\.stx$/,"")).sort()}}catch{}let I=`Layout not found: ${_} (referenced from ${J})`+(T.length>0?`. Available layouts: ${T.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(Z1.log(Error(I),{layoutPath:_,filePath:J,available:T},"error"),console.error(`[stx] ${I}`),G.debug)throw new J5(I,J);return W}let w=await k5(()=>Bun.file(L).text(),"",()=>{throw new J5(`Failed to read layout file: ${L}`,J,void 0,void 0,"Layout content could not be loaded")}),N=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(N){if(G.debug)console.log(`Found nested layout: ${N[1]} in ${L}`);let T={},I=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,S,P)=>{return T[S]=P.trim(),""});for(let[y,S]of Object.entries(T))if(B[y]&&B[y].includes(z5)){let P=B[y].indexOf(z5);B[y]=B[y].slice(0,P)+S+B[y].slice(P+z5.length)}else if(!B[y])B[y]=S;let E={...Z,__sections:B},D=`@layout('${N[1]}')${I}`;return await F0(D,E,L,G,X)}let R=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=D9(R,H),M={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,I,E)=>{return M[I]=E.trim(),`@slot('${I}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,I,E)=>{if(B[I]){let D=B[I];if(D.includes(z5)){let y=M[I]||"",S=D.indexOf(z5);D=D.slice(0,S)+y+D.slice(S+z5.length)}return D}return E||""}),A=oO(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=k9(A,H),Z.__originalFilePath=J,W=await tG(A,Z,L,G,X),W=`<!-- stx-layout: ${_} -->
|
|
13465
|
+
${W}`,U(W)}catch(L){return Z1.log(L instanceof Error?L:Error(String(L)),{layoutPath:_,filePath:J},"error"),`[Error processing layout: ${L instanceof Error?L.message:String(L)}]`}return U(await tG(W,Z,J,G,X))}function oO($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(J,Y,X)=>{let Q=Z[Y];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return X||""})}function sO($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let J=Z.envPrefix||"STX_PUBLIC_",Y={};for(let[X,Q]of Object.entries(process.env))if(X.startsWith(J)&&Q!==void 0)Y[X]=Q;$.$env=Y}async function rO($,Z){await k5(()=>aX($,Z),void 0,(J)=>{Z1.log(J,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${J.message}`)})}async function aO($,Z,J){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,X;while((X=Y.exec($))!==null){let Q=X[1],G=X[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (j$(),J4)));await W(G,Z,J,{preserveExisting:!0})}catch(W){let q=W instanceof Error?W:Error(String(W));Z1.log(q,{filePath:J,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${J}: ${q.message}`)}}}async function tO($,Z,J){try{let{interpolateScriptsInTemplate:Y}=await e("stx/expressions",()=>Promise.resolve().then(() => (q1(),AZ)));return Y($,Z,{skipServer:!0})}catch(Y){let X=Y instanceof Error?Y:Error(String(Y));return Z1.log(X,{filePath:J,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${J}: ${X.message}`),$}}async function tG($,Z,J,Y,X){let Q=$,G=Y;if(await aO(Q,Z,J),Q=await tO(Q,Z,J),Q=await uX(Q,Z,J),Q=await mX(Q,Z,J),Q=await yY(Q,Z,J,G),L1(Q))Q=P3(Q,Z),Q=v3(Q,Z);Q=C3(Q);let{processStreamDirectives:K}=await e("stx/streaming",()=>Promise.resolve().then(() => (i6(),c6)));Q=K(Q,Z),Q=A9(Q,Z,J,G),Q=await WQ(Q,Z,J,G,X),Q=await M7(Q,Z,J,G,X),Q=V8(Q,Z,J,G);let{processDeferDirectives:W}=await e("stx/defer",()=>Promise.resolve().then(() => hQ));Q=W(Q,Z,J);let{processTeleportDirectives:q}=await e("stx/teleport",()=>Promise.resolve().then(() => mQ));Q=q(Q,Z,J);let{processTransitionDirectives:z,processTransitionAttributes:U}=await e("stx/transitions",()=>Promise.resolve().then(() => cQ));Q=z(Q,Z,J),Q=U(Q);let{processErrorBoundaryDirectives:j}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => nQ));Q=j(Q,Z,J);let{processSuspenseDirectives:H}=await e("stx/suspense",()=>Promise.resolve().then(() => oQ));Q=H(Q,Z,J);let{processAsyncDirectives:B}=await e("stx/async-components",()=>Promise.resolve().then(() => tQ));Q=B(Q,Z,J);let{processKeepAliveDirectives:_}=await e("stx/keep-alive",()=>Promise.resolve().then(() => $G));Q=_(Q,Z,J);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:F}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (GG(),QG)));Q=O(Q,Z,J),Q=V(Q,Z,J),Q=F(Q,Z,J);let{processPartialHydrationDirectives:L,processStaticDirectives:w}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (NG(),wG)));Q=L(Q,Z,J),Q=w(Q);let{processComputedDirectives:N,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (PG(),yG)));Q=N(Q,Z,J),Q=R(Q,Z,J);let{processFormValidationDirectives:A}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (uG(),hG)));Q=A(Q,Z,J);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:E}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),_3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
|
|
13466
13466
|
`;if(Q=T(Q,Z),Q=I(Q,Z),Q=sX(Q),Q=S6(Q,Z),Q=bY(Q),Q=lX(Q),Q=await I9(Q,Z,J,G,X),Q=await M7(Q,Z,J,G,X),Z.__stxProcessingDepth===1)Q=GZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=u9(Q),Q=X5(Q,Z,J),Q=y6(Q,Z),Q=P6(Q,Z),Q=_7(Q,Z),Q=mY(Q,Z),Q=dY(Q,Z),Q=await VY(Q,Z,J,G),Q=await E2(Q,Z,J),Q=await nY(Q,Z,J,G),Q=U8(Q,Z,J,G),Q=fJ(Q,Z,J,G),Q=gJ(Q,Z,J),Q=hJ(Q,Z,J,G),Q=DY(Q,Z,J,G),Q=g9(Q,Z),Q=h9(Q),Q=TQ(Q),!G.skipEventDirectives)Q=g8(Q,Z,J);if(Q=OY(Q,Z,J),G.debug){let n=/\bx-data\s*=/.test(Q),s=N4($);if(n&&s)console.warn(`[stx] ${J}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
13467
13467
|
Both work on the same page, but they manage separate scopes.
|
|
13468
|
-
Prefer signals (state/derived/effect) for new components.`)}Q=$Q(Q,Z),Q=await b1(Q,Z,J),Q=IQ(Q),Q=DQ(Q),Q=WY(Q);let{processXElementDirectives:y}=await
|
|
13468
|
+
Prefer signals (state/derived/effect) for new components.`)}Q=$Q(Q,Z),Q=await b1(Q,Z,J),Q=IQ(Q),Q=DQ(Q),Q=WY(Q);let{processXElementDirectives:y}=await e("stx/x-element",()=>Promise.resolve().then(() => pG));Q=y(Q);let S=Z.__originalFilePath||J,P=Y$(Z);if(Q=await x3(Q,G,S,P),Q=fY(Q,Z),Q=await nX(Q,Z,J,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:s}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (cG(),lG)));Q=await s(Q,{publicDir:n})}if(G.seo?.enabled)Q=uJ(Q,Z,G);let C=(n,s,z0=!0)=>{if(!s)return n;let D0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),K0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(D0&&K0){if(z0)n=n.replace(K0[0],D0[0]);if(s=s.replace(D0[0],"").trim(),!s)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${s}
|
|
13469
13469
|
</head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
|
|
13470
13470
|
${s}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
|
|
13471
13471
|
<head>
|
|
13472
13472
|
${s}
|
|
13473
|
-
</head>`);return n},{renderHead:x,getHead:f}=await
|
|
13473
|
+
</head>`);return n},{renderHead:x,getHead:f}=await e("stx/head",()=>Promise.resolve().then(() => (U$(),_3))),$0=Z.__stx_runtime_head??f();if($0.title||$0.meta?.length||$0.link?.length){let n=x($0);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!$0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=TY(Q,G.csp,Z);if(G.analytics?.enabled)Q=zY(Q,G);if(G.heatmap?.enabled)Q=A8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (sG(),oG)));Q=n(Q,G)}let P0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),B0=/\bSTX\.\w+/.test(Q),N0=/window\.STX\s*=/.test(Q);if(P0&&B0&&!N0){let s=`<script data-stx-scoped data-stx-run="once">
|
|
13474
13474
|
${XY()}
|
|
13475
|
-
</script>`;if(Q.includes("</head>")){let
|
|
13475
|
+
</script>`;if(Q.includes("</head>")){let z0=Q.indexOf("</head>"),K0=Q.slice(0,z0).indexOf("<script");if(K0!==-1){let k=Q.slice(0,K0),v=Q.slice(K0);Q=k+s+`
|
|
13476
13476
|
`+v}else Q=Q.replace("</head>",`${s}
|
|
13477
13477
|
</head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
|
|
13478
13478
|
${s}`);else Q=s+`
|
|
13479
|
-
`+Q}{let{scanScriptTags:n}=await
|
|
13480
|
-
`+Q.slice(
|
|
13479
|
+
`+Q}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (O$(),R4))),s=[];for(let z0 of n(Q)){if(!/\bserver\b/i.test(z0.attrs))continue;let D0=z0.start+z0.fullMatch.indexOf(">")+1,K0=cO(Q,D0);if(K0===-1)continue;let k=K0+9;while(k<Q.length&&/\s/.test(Q[k]))k++;s.push({start:z0.start,end:k})}for(let z0=s.length-1;z0>=0;z0--){let{start:D0,end:K0}=s[z0];Q=Q.substring(0,D0)+Q.substring(K0)}}let u=t$(Q,J);if(u.hasScoped)Q=u.html;let a=Z.__stx_event_bindings||[],R0=!1,C0=[],U5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:j5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (O$(),R4)));for(let n of j5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))C0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:s,content:z0}of C0){R0=!0;let D0=z0;d9(z0,J,Y.strict,Z.__originalFilePath);let K0=await X$(z0,{eventBindings:a,attrs:s,hasColonDirectives:U5,templateContent:$,filePath:J,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:P});Q=Q.replace(n,()=>K0)}if(R0)Z.__stx_event_bindings=[];if(!R0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let s=a7(n);if(s){let z0=Q.lastIndexOf("</body>");Q=z0===-1?Q+s:Q.slice(0,z0)+s+`
|
|
13480
|
+
`+Q.slice(z0)}Z.__stx_event_bindings=[]}}if(!H2(Q)&&_2(Q))Q=await F4(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=IY(Q,Z.cspNonce);return Q}var z5="<!--PARENT_CONTENT_PLACEHOLDER-->";var I4=b(()=>{q7();R3();n1();l7();QY();qY();UY();n7();c7();t7();Q$();FY();LY();j7();kY();SY();CY();gY();w1();U$();q1();pY();oY();hX();pX();M9();u3();oX();R5();rX();Y7();I0();tX();ZQ();XQ();qQ();U3();P9();wQ();O$();N9();MQ();m9();p9();M0();o6();Q3();t5();V4();V4();m9();p9()});import w0 from"fs";import Q0 from"path";import J8 from"fs";import VK from"path";var h7="resources/assets",Y8="assets";function X8($=process.cwd()){let Z=VK.resolve($,h7);return J8.existsSync(Z)&&J8.statSync(Z).isDirectory()?Z:null}import H5 from"fs";import m7 from"path";var m$="_stx";function u7($){return Bun.hash($).toString(16).slice(0,8)}function LK($){let Z=[],J=(Y)=>{for(let X of H5.readdirSync(Y,{withFileTypes:!0})){let Q=m7.join(Y,X.name);if(X.isDirectory())J(Q);else if(X.isFile()&&Q.endsWith(".html"))Z.push(Q)}};if(H5.existsSync($))J($);return Z}function Q8($){let Z={pages:0,assets:0,bytesInlined:0},J=m7.join($,m$),Y=new Set,X=(Q,G)=>{if(Y.has(Q))return;Y.add(Q),H5.mkdirSync(J,{recursive:!0}),H5.writeFileSync(m7.join(J,Q),G),Z.assets++};for(let Q of LK($)){let G=H5.readFileSync(Q,"utf8"),K=G;if(K=K.replace(/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,(W,q,z)=>{if(/\bsrc\s*=/.test(q)||!z.trim())return W;let U=`runtime.${u7(z)}.js`;return X(U,z),Z.bytesInlined+=z.length,`<script data-stx-runtime src="/${m$}/${U}"></script>`}),K=K.replace(/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,(W,q,z)=>{if(/\bsrc\s*=/.test(q)||!z.trim())return W;let U=`router.${u7(z)}.js`;return X(U,z),Z.bytesInlined+=z.length,`<script data-stx-router src="/${m$}/${U}"></script>`}),K=K.replace(/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,(W,q,z)=>{if(!z.trim())return W;let U=`crosswind.${u7(z)}.css`;return X(U,z),Z.bytesInlined+=z.length,`<link data-crosswind="generated" rel="stylesheet" href="/${m$}/${U}">`}),K!==G)H5.writeFileSync(Q,K),Z.pages++}return Z}d7();I4();import{createHash as eO}from"crypto";function $F($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var ZF=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function JF($){return Bun.hash($).toString(16)}function eG($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let J=new Map,Y=$.replace(ZF,(Q,G,K,W)=>{let q=W.trim();if(!q)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)q=$F(q);let z=JF(q);if(!J.has(z))J.set(z,q);let U=Z.integrity?` data-stx-integrity="sha384-${eO("sha384").update(q).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${U}${K}></script>`}),X=Array.from(J,([Q,G])=>({hash:Q,code:G}));return{html:Y,chunks:X}}var YF=new Set(["visible","idle"]);function $K($){if(!$.includes("data-stx-src="))return $;let Z=new Map,J=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,Y;while((Y=J.exec($))!==null)Z.set(Y[1],Y[2]);let X=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(YF.has(Z.get(G[1])||""))X.add(G[2]);let K=$.lastIndexOf("</head>");if(X.size===0||K===-1)return $;let W=Array.from(X).filter((q)=>!$.includes(`rel="prefetch" href="${q}"`)).map((q)=>`<link rel="prefetch" href="${q}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}V1();import g$ from"fs";import f7 from"path";var XF="layout-types.d.ts";function QF($){let Z=[],J=(Y,X)=>{let Q;try{Q=g$.readdirSync(Y,{withFileTypes:!0})}catch{return}for(let G of Q){if(G.name.startsWith("."))continue;let K=f7.join(Y,G.name);if(G.isDirectory())J(K,X?`${X}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let W=G.name.slice(0,-4);Z.push(X?`${X}/${W}`:W)}}};return J($,""),Z.sort()}function GF($){let Z=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if($.length===0)return Z.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),Z.join(`
|
|
13481
13481
|
`);return Z.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((J)=>` '${J}': true`)," }","}","","export {}",""),Z.join(`
|
|
13482
13482
|
`)}function ZK($,Z){if(!$)return[];let J=f7.isAbsolute($)?$:f7.resolve(process.cwd(),$),Y=QF(J),X=GF(Y),Q=f7.join(Z,XF);try{if(g$.existsSync(Q)&&g$.readFileSync(Q,"utf8")===X)return Y;g$.mkdirSync(Z,{recursive:!0}),g$.writeFileSync(Q,X)}catch{}return Y}var KF=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function e9($){let Z=$.trim();if(!Z)return null;let J=/^https?:\/\//i.test(Z)?Z:`https://${Z}`;try{return new URL(J).origin+new URL(J).pathname.replace(/\/$/,"")}catch{return null}}function WF($){for(let Z of KF){let J=$[Z];if(!J)continue;let Y=e9(J);if(Y)return{url:Y,source:"env",via:Z}}return null}function JK($){if(!$||typeof $!=="object")return null;let Z=$,J=Z.site?.url??Z.url??Z.app?.url;return typeof J==="string"?e9(J):null}async function qF($){let{existsSync:Z}=await import("fs"),J=await import("path");for(let Y of["site.config.ts","site.config.js",".config/site.config.ts"]){let X=J.resolve($,Y);if(!Z(X))continue;try{let Q=await import(X),G=JK(Q.default??Q);if(G)return G}catch{}}return null}async function YK($={}){let Z=$.cwd??process.cwd(),J=$.env??process.env;if($.explicit){let G=e9($.explicit);if(G)return{url:G,source:"option"}}let Y=JK($.stxConfig);if(Y)return{url:Y,source:"stx.config",via:"site.url"};let X=await qF(Z);if(X)return{url:X,source:"site.config",via:"url"};let Q=WF(J);if(Q)return Q;return{url:"http://localhost",source:"fallback"}}function XK(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
|
|
13483
13483
|
`)}Y7();r5();q7();import{abortNavigation as MD,clearMiddleware as QK,createClientCookieManager as TD,createMiddlewareContext as GK,createRouteLocation as KK,createServerCookieManager as ID,createStorageManager as DD,defineMiddleware as kD,getMiddleware as ED,getMiddlewareNames as WK,hasMiddleware as bD,loadMiddlewareFromDirectory as qK,navigateTo as SD,registerMiddleware as yD,runMiddleware as zK}from"stx-router";class UK{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=Q0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[J,Y]of Object.entries(Z))this.cache.set(J,Y)}catch{}this.loaded=!0}async save(){await w0.promises.mkdir(this.cacheDir,{recursive:!0});let $=Q0.join(this.cacheDir,"build-cache.json"),Z={};for(let[J,Y]of this.cache)Z[J]=Y;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let J=w0.statSync($),Y=`${$}:${J.mtimeMs}`;for(let Q of Z)if(w0.existsSync(Q)){let G=w0.statSync(Q);Y+=`:${Q}:${G.mtimeMs}`}let X=0;for(let Q=0;Q<Y.length;Q++){let G=Y.charCodeAt(Q);X=(X<<5)-X+G,X=X&X}return Math.abs(X).toString(36)}get($,Z){let J=this.cache.get($);if(!J)return null;let Y=this.getHash(Z,J.dependencies??[]);if(J.hash!==Y)return this.cache.delete($),null;return J.html}set($,Z,J,Y){let X=this.getHash(Z,J);this.cache.set($,{hash:X,html:Y,generatedAt:Date.now(),dependencies:J})}}class jK{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Q0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let J=this.getFilePath($);await w0.promises.mkdir(Q0.dirname(J),{recursive:!0}),await Bun.write(J,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await w0.promises.unlink(Z)}async invalidatePattern($){let Z=Q0.join(this.cacheDir,"isr");if(!w0.existsSync(Z))return;let J=await w0.promises.readdir(Z);for(let Y of J){let X=Y.replace(/_/g,"/").replace(".json","");if($.test(X))await w0.promises.unlink(Q0.join(Z,Y))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function zF($){try{let J=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticPaths"))return null;let X=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!X)return null;return await Function(`
|
|
@@ -13493,37 +13493,37 @@ ${s}`);else Q=s+`
|
|
|
13493
13493
|
${U}`}if(U=await S3(U,{router:Y.router}),U=await A$(U),Y.minify!==!1)return{html:HF(U),dependencies:Array.from(q)};return{html:U,dependencies:Array.from(q)}}function HF($){let Z=[],J=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,X;while((X=Y.exec($))!==null){let G=$.slice(J,X.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=X[1],W=X[2],q=X[3];W=W.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+W+q),J=X.index+X[0].length}let Q=$.slice(J);return Z.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function _F($){let Z=0;for(let J=0;J<$.length;J++){let Y=$.charCodeAt(J);Z=(Z<<5)-Z+Y,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function OF($,Z,J,Y){if(J?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(Z))return!0;return Y.some((X)=>{if(X instanceof RegExp)return X.test($);return X.endsWith("/")?$===X.slice(0,-1)||$.startsWith(X):$===X})}function FF($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
13494
13494
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
13495
13495
|
${$.map((Y)=>{let X=new URL(Y.loc,Z).href,Q=` <url>
|
|
13496
|
-
<loc>${
|
|
13496
|
+
<loc>${X1(X)}</loc>`;if(Y.lastmod)Q+=`
|
|
13497
13497
|
<lastmod>${Y.lastmod}</lastmod>`;if(Y.changefreq)Q+=`
|
|
13498
13498
|
<changefreq>${Y.changefreq}</changefreq>`;if(Y.priority!==void 0)Q+=`
|
|
13499
13499
|
<priority>${Y.priority}</priority>`;return Q+=`
|
|
13500
13500
|
</url>`,Q}).join(`
|
|
13501
13501
|
`)}
|
|
13502
|
-
</urlset>`}function
|
|
13503
|
-
<title>${
|
|
13504
|
-
<link>${
|
|
13505
|
-
<description>${
|
|
13502
|
+
</urlset>`}function X1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function VF($,Z){let J=Z.map((Y)=>{let X=" <item>";if(X+=`
|
|
13503
|
+
<title>${X1(Y.title)}</title>`,X+=`
|
|
13504
|
+
<link>${X1(Y.link)}</link>`,Y.description)X+=`
|
|
13505
|
+
<description>${X1(Y.description)}</description>`;if(Y.pubDate)X+=`
|
|
13506
13506
|
<pubDate>${Y.pubDate.toUTCString()}</pubDate>`;if(Y.author)X+=`
|
|
13507
|
-
<author>${
|
|
13508
|
-
<category>${
|
|
13509
|
-
<guid>${
|
|
13507
|
+
<author>${X1(Y.author)}</author>`;if(Y.categories)for(let Q of Y.categories)X+=`
|
|
13508
|
+
<category>${X1(Q)}</category>`;if(Y.guid)X+=`
|
|
13509
|
+
<guid>${X1(Y.guid)}</guid>`;return X+=`
|
|
13510
13510
|
</item>`,X});return`<?xml version="1.0" encoding="UTF-8"?>
|
|
13511
13511
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
13512
13512
|
<channel>
|
|
13513
|
-
<title>${
|
|
13514
|
-
<link>${
|
|
13515
|
-
<description>${
|
|
13513
|
+
<title>${X1($.title)}</title>
|
|
13514
|
+
<link>${X1($.link)}</link>
|
|
13515
|
+
<description>${X1($.description)}</description>
|
|
13516
13516
|
${$.language?`<language>${$.language}</language>`:""}
|
|
13517
|
-
${$.copyright?`<copyright>${
|
|
13517
|
+
${$.copyright?`<copyright>${X1($.copyright)}</copyright>`:""}
|
|
13518
13518
|
<lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
|
|
13519
13519
|
<atom:link href="${$.link}/rss.xml" rel="self" type="application/rss+xml"/>
|
|
13520
13520
|
${J.join(`
|
|
13521
13521
|
`)}
|
|
13522
13522
|
</channel>
|
|
13523
|
-
</rss>`}async function LF($={}){let Z=Date.now(),J=await
|
|
13523
|
+
</rss>`}async function LF($={}){let Z=Date.now(),J=await e0(),Y=await YK({explicit:$.domain,stxConfig:J});if(Y.source==="fallback"&&($.sitemap??!0))console.warn(XK());let X={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:Y.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||_1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},G=new Set,K=0,W={},q={};await X.hooks.onBuildStart?.();try{if(X.cleanOutput&&w0.existsSync(X.outputDir))await w0.promises.rm(X.outputDir,{recursive:!0});await w0.promises.mkdir(X.outputDir,{recursive:!0});let U=new UK(X.cacheDir);if(X.cache)await U.load();try{let{generateCrosswindCSS:R}=await Promise.resolve().then(() => (q7(),YY));await R('<div class="bg-black"></div>')}catch{}QK();let j=J?.routeMiddleware?.dir||"middleware";await qK(process.cwd(),j);let H=WK();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let B=J?.routeMiddleware?.global||[];ZK(J?.layoutsDir,_1(process.cwd()));let _=i5(".",{pagesDir:X.pagesDir});console.log(`Found ${_.length} routes`);let O=[];for(let R of _){let A=await UF(R);for(let M of A)O.push({route:R,url:M.url,params:M.params,props:M.props,revalidate:M.revalidate??X.revalidate})}Q.totalPages=O.length,console.log(`Generating ${Q.totalPages} pages...`);let V=[],F=[];for(let R=0;R<O.length;R+=X.concurrency)F.push(O.slice(R,R+X.concurrency));for(let R of F)await Promise.all(R.map(async(A)=>{let{route:M,url:T,params:I,props:E,revalidate:D}=A;try{await X.hooks.onPageStart?.(T);let y=await Bun.file(M.filePath).text(),S=AF(y),P=S?.middleware?Array.isArray(S.middleware)?S.middleware:[S.middleware]:[],C=[...B,...P];if(C.length>0){let B0=KK(T,I,S||{}),N0=GK(B0,null,void 0,{isServer:!0}),u=await zK(C,N0);if(u.redirect){let a=typeof u.redirect==="string"?u.redirect:u.redirect.path||u.redirect,R0=MF(String(a),T),C0=TF(T,X);await w0.promises.mkdir(Q0.dirname(C0),{recursive:!0}),await Bun.write(C0,R0),Q.successCount++,Q.pages.push({route:T,outputPath:C0,size:Buffer.byteLength(R0),cached:!1}),V.push({loc:T,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${T} \u2192 redirect to ${a}`);return}if(u.abort){let a=typeof u.abort==="string"?u.abort:u.abort?.error?.message||"aborted";console.warn(` \u21B3 ${T} \u2014 middleware aborted: ${a}`);return}}let x=y.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(x)try{if(!await Function("route",`
|
|
13524
13524
|
const validate = ${x[1]};
|
|
13525
13525
|
return validate(route);
|
|
13526
|
-
`)({params:I})){console.warn(`Validation failed for ${T}, skipping...`);return}}catch{}let f=null,d=!1;if(X.cache){if(f=U.get(T,M.filePath),f)d=!0,Q.cachedCount++}if(!f){let
|
|
13526
|
+
`)({params:I})){console.warn(`Validation failed for ${T}, skipping...`);return}}catch{}let f=null,d=!1;if(X.cache){if(f=U.get(T,M.filePath),f)d=!0,Q.cachedCount++}if(!f){let B0=await BK(M,I,E,X,J);if(f=B0.html,X.cache)U.set(T,M.filePath,B0.dependencies,f)}let $0;if(X.trailingSlash)$0=Q0.join(X.outputDir,T,"index.html");else $0=T==="/"?Q0.join(X.outputDir,"index.html"):Q0.join(X.outputDir,`${T}.html`);if(X.chunkIslands){let{html:B0,chunks:N0}=eG(f,{integrity:X.integrityIslands,minify:X.minify});if(N0.length>0){let u=Q0.join(X.outputDir,"_stx","islands");await w0.promises.mkdir(u,{recursive:!0});for(let a of N0){let R0=Q0.join(u,`${a.hash}.js`);if(!await Bun.file(R0).exists())await Bun.write(R0,a.code);if(!G.has(a.hash)){G.add(a.hash);let C0=Buffer.byteLength(a.code,"utf8");K+=C0,W[a.hash]={bytes:C0,file:`/_stx/islands/${a.hash}.js`}}}if(q[T]=N0.map((a)=>a.hash),f=B0,X.prefetchIslands)f=$K(f)}}if(await w0.promises.mkdir(Q0.dirname($0),{recursive:!0}),await Bun.write($0,f),!OF(T,f,S,X.sitemapExclude))V.push({loc:T,lastmod:new Date().toISOString().split("T")[0],priority:T==="/"?1:0.8});let P0={route:T,outputPath:$0,size:Buffer.byteLength(f,"utf8"),cached:d};if(D!==!1)P0.revalidateAt=Date.now()+D*1000;Q.pages.push(P0),Q.successCount++,await X.hooks.onPageEnd?.(T,f)}catch(y){Q.failedCount++,Q.errors.push({route:T,error:y}),await X.hooks.onError?.(y,T),console.error(`Error generating ${T}:`,y)}}));if(X.cache)await U.save();if(X.generate404){let R=Q0.join(X.pagesDir,"404.stx");if(await Bun.file(R).exists()){let A=new Set,M={...J,debug:!1,cache:!1},T=await F0(await Bun.file(R).text(),{},R,M,A);await Bun.write(Q0.join(X.outputDir,"404.html"),T)}else await Bun.write(Q0.join(X.outputDir,"404.html"),`<!DOCTYPE html>
|
|
13527
13527
|
<html lang="en">
|
|
13528
13528
|
<head>
|
|
13529
13529
|
<meta charset="UTF-8">
|
|
@@ -13552,7 +13552,7 @@ Build complete!
|
|
|
13552
13552
|
Cached: ${Q.cachedCount}
|
|
13553
13553
|
Failed: ${Q.failedCount}
|
|
13554
13554
|
Time: ${Q.buildTime}ms${z}
|
|
13555
|
-
`),Q}async function $8($,Z){let J=await w0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let X=Q0.join($,Y.name),Q=Q0.join(Z,Y.name);if(Y.isDirectory())await w0.promises.mkdir(Q,{recursive:!0}),await $8(X,Q);else await w0.promises.copyFile(X,Q)}}function wF($={}){let Z=$.cacheDir||_1(process.cwd(),"ssg-cache"),J=new jK(Z),Y=$.revalidate||3600;return{async get(X){let Q=await J.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=i5(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),W={};if(K)G.params.forEach((U,j)=>{W[U]=K[j+1]});let q=await
|
|
13555
|
+
`),Q}async function $8($,Z){let J=await w0.promises.readdir($,{withFileTypes:!0});for(let Y of J){let X=Q0.join($,Y.name),Q=Q0.join(Z,Y.name);if(Y.isDirectory())await w0.promises.mkdir(Q,{recursive:!0}),await $8(X,Q);else await w0.promises.copyFile(X,Q)}}function wF($={}){let Z=$.cacheDir||_1(process.cwd(),"ssg-cache"),J=new jK(Z),Y=$.revalidate||3600;return{async get(X){let Q=await J.get(X);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(X).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(X){let G=i5(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return X.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${X}`);return}let K=X.match(G.regex),W={};if(K)G.params.forEach((U,j)=>{W[U]=K[j+1]});let q=await e0(),{html:z}=await BK(G,W,{},$,q);await J.set(X,{html:z,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:_F(z)}),console.log(`Revalidated: ${X}`)},async invalidate(X){if(typeof X==="string")await J.invalidate(X);else await J.invalidatePattern(X)}}}function NF($){return async()=>{return{paths:await $(),fallback:!1}}}function RF(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),J=Z.match(/^---\n([\s\S]*?)\n---/),Y={},X=Z;if(J){let q=J[1];X=Z.slice(J[0].length).trim();for(let z of q.split(`
|
|
13556
13556
|
`)){let U=z.indexOf(":");if(U>0){let j=z.slice(0,U).trim(),H=z.slice(U+1).trim();if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^\d+$/.test(H))H=parseInt(H,10);else if(/^\d+\.\d+$/.test(H))H=parseFloat(H);else if(H.startsWith("[")&&H.endsWith("]"))H=H.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));Y[j]=H}}}let Q=X.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,W;while((W=K.exec(Q))!==null){let q=parseInt(W[1],10),z=W[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:q})}return{content:Q,data:Y,toc:G}}}}function AF($){return z7($)}function MF($,Z){return`<!DOCTYPE html>
|
|
13557
13557
|
<html>
|
|
13558
13558
|
<head>
|