@stacksjs/stx 0.2.84 → 0.2.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/app-shell.js +50 -50
  2. package/dist/build-mode-detector.js +95 -95
  3. package/dist/build-views.js +149 -149
  4. package/dist/build.js +37 -37
  5. package/dist/cli.js +51 -51
  6. package/dist/component-processing.js +16 -16
  7. package/dist/component-renderer.js +32 -32
  8. package/dist/components.js +95 -95
  9. package/dist/dev-server/index.js +36 -36
  10. package/dist/dev-server/serve-app.js +50 -50
  11. package/dist/dev-server/serve-file.js +50 -50
  12. package/dist/dev-server/serve-markdown.js +36 -36
  13. package/dist/dev-server/serve-multi.js +49 -49
  14. package/dist/dev-server.js +50 -50
  15. package/dist/docs.js +96 -96
  16. package/dist/dynamic-components.js +32 -32
  17. package/dist/includes.js +32 -32
  18. package/dist/index.js +50 -50
  19. package/dist/interactive.js +96 -96
  20. package/dist/lazy-loader.js +95 -95
  21. package/dist/plugin.js +44 -44
  22. package/dist/process.js +31 -31
  23. package/dist/production-builder.js +31 -31
  24. package/dist/production-server.js +31 -31
  25. package/dist/pwa/index.js +95 -95
  26. package/dist/pwa/offline.js +95 -95
  27. package/dist/pwa.js +84 -84
  28. package/dist/render.js +153 -153
  29. package/dist/serve.js +106 -106
  30. package/dist/site-builder/build.js +97 -97
  31. package/dist/site-builder/index.js +38 -38
  32. package/dist/ssg.js +13 -13
  33. package/dist/ssr.js +83 -83
  34. package/dist/story/cli.js +36 -36
  35. package/dist/story/commands/dev.js +36 -36
  36. package/dist/story/commands/index.js +36 -36
  37. package/dist/story/index.js +36 -36
  38. package/dist/story/renderer.js +96 -96
  39. package/dist/story/server.js +36 -36
  40. package/dist/story/visual-testing.js +96 -96
  41. package/dist/streaming.js +32 -32
  42. package/dist/template-compiler.js +24 -24
  43. package/dist/template-hydrator.js +110 -110
  44. package/dist/testing.js +95 -95
  45. package/dist/utils.js +32 -32
  46. package/dist/variable-extractor.js +11 -11
  47. package/dist/web-components.js +95 -95
  48. package/package.json +7 -5
package/dist/pwa/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var{defineProperty:U7,getOwnPropertyNames:MQ,getOwnPropertyDescriptor:IQ}=Object,DQ=Object.prototype.hasOwnProperty;function EQ($){return this[$]}var R9=($)=>{var Z=(w9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=U7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of MQ($))if(!DQ.call(Z,X))U7(Z,X,{get:EQ.bind($,X),enumerable:!(Y=IQ($,X))||Y.enumerable})}return w9.set($,Z),Z},w9;var kQ=($)=>$;function SQ($,Z){this[$]=kQ.bind(null,Z)}var l=($,Z)=>{for(var Y in Z)U7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:SQ.bind(Z,Y)})};var P=($,Z)=>()=>($&&(Z=$($=0)),Z);var J0=import.meta.require;var fQ={};l(fQ,{screenReaderDirective:()=>_$,scanA11yIssues:()=>PQ,registerA11yDirectives:()=>xQ,processA11yDirectives:()=>W7,hasDOMSupport:()=>A9,getScreenReaderOnlyStyle:()=>bQ,checkA11y:()=>N9,autoFixA11yFile:()=>M9,autoFixA11yDirectory:()=>vQ,autoFixA11y:()=>T9,a11yDirective:()=>B$});import z$ from"path";function W7($,Z,Y,X){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||W} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),J}function bQ(){return`
2
+ var{defineProperty:U7,getOwnPropertyNames:MQ,getOwnPropertyDescriptor:IQ}=Object,DQ=Object.prototype.hasOwnProperty;function EQ($){return this[$]}var R9=($)=>{var Z=(w9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=U7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of MQ($))if(!DQ.call(Z,X))U7(Z,X,{get:EQ.bind($,X),enumerable:!(Y=IQ($,X))||Y.enumerable})}return w9.set($,Z),Z},w9;var kQ=($)=>$;function SQ($,Z){this[$]=kQ.bind(null,Z)}var l=($,Z)=>{for(var Y in Z)U7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:SQ.bind(Z,Y)})};var C=($,Z)=>()=>($&&(Z=$($=0)),Z);var J0=import.meta.require;var fQ={};l(fQ,{screenReaderDirective:()=>_$,scanA11yIssues:()=>PQ,registerA11yDirectives:()=>xQ,processA11yDirectives:()=>W7,hasDOMSupport:()=>A9,getScreenReaderOnlyStyle:()=>bQ,checkA11y:()=>N9,autoFixA11yFile:()=>M9,autoFixA11yDirectory:()=>vQ,autoFixA11y:()=>T9,a11yDirective:()=>B$});import z$ from"path";function W7($,Z,Y,X){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||W} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),J}function bQ(){return`
3
3
  .sr-only {
4
4
  position: absolute;
5
5
  width: 1px;
@@ -11,7 +11,7 @@ var{defineProperty:U7,getOwnPropertyNames:MQ,getOwnPropertyDescriptor:IQ}=Object
11
11
  white-space: nowrap;
12
12
  border-width: 0;
13
13
  }
14
- `.trim()}function A9(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function yQ($,Z){let Y=[],X=/<img\s+([^>]*)>/gi,J;J=X.exec($);while(J!==null){let L=J[1];if(!/\balt\s*=/i.test(L))Y.push({type:"missing-alt",element:J[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});J=X.exec($)}let Q=/<button([^>]*)>\s*<\/button>/gi;J=Q.exec($);while(J!==null){let L=J[1];if(!/\baria-label\s*=/i.test(L)&&!/\btitle\s*=/i.test(L))Y.push({type:"missing-accessible-name",element:J[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});J=Q.exec($)}let G=/<a\s+([^>]*)>\s*<\/a>/gi;J=G.exec($);while(J!==null){let L=J[1];if(!/\baria-label\s*=/i.test(L)&&!/\btitle\s*=/i.test(L))Y.push({type:"link-missing-text",element:J[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});J=G.exec($)}let K=/<(input|select|textarea)\s+([^>]*)>/gi;J=K.exec($);while(J!==null){let L=J[2];if(/\btype\s*=\s*["']hidden["']/i.test(L)){J=K.exec($);continue}let F=/\baria-label\s*=/i.test(L)||/\baria-labelledby\s*=/i.test(L),O=L.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!F){let V=O&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${O[1]}["']`,"i").test($),R=J.index,w=$.substring(0,R),A=$.substring(R),N=(w.match(/<label\b/gi)||[]).length,M=(w.match(/<\/label>/gi)||[]).length,T=N>M;if(!V&&!T)Y.push({type:"input-missing-label",element:J[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}J=K.exec($)}let q=/<h([1-6])[^>]*>/gi,U=[];J=q.exec($);while(J!==null)U.push(Number.parseInt(J[1],10)),J=q.exec($);let W=0;for(let L of U){if(W>0&&L>W+1)Y.push({type:"heading-skip",element:`<h${L}>`,message:`Heading level skipped from h${W} to h${L}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});W=L}if(/<html\b/i.test($)&&!/<html[^>]*\slang\s*=/i.test($))Y.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let z=/<table[^>]*>([\s\S]*?)<\/table>/gi;J=z.exec($);while(J!==null){let L=J[1];if(!/<th\b/i.test(L))Y.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});J=z.exec($)}let B=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;J=B.exec($);while(J!==null){if(!/\bmuted\b/i.test(J[0]))Y.push({type:"autoplay-audio",element:`<${J[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});J=B.exec($)}let _=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;J=_.exec($);while(J!==null)Y.push({type:"positive-tabindex",element:`tabindex="${J[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),J=_.exec($);let j=/<iframe\s+([^>]*)>/gi;J=j.exec($);while(J!==null){let L=J[1];if(!/\btitle\s*=/i.test(L)&&!/\baria-label\s*=/i.test(L))Y.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});J=j.exec($)}let H=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;J=H.exec($);while(J!==null){let L=J[1].toLowerCase(),F=J[2];if(L!=="button"&&!/\btabindex\s*=/i.test(F))Y.push({type:"button-not-focusable",element:J[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});J=H.exec($)}return Y}async function N9($,Z){if(!A9())return yQ($,Z);let Y=[];try{let X=globalThis.document.createElement("div");X.innerHTML=$,X.querySelectorAll("img").forEach((K)=>{if(!K.hasAttribute("alt"))Y.push({type:"missing-alt",element:`<${K.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),X.querySelectorAll('button, a, [role="button"]').forEach((K)=>{if(!(K.hasAttribute("aria-label")||K.hasAttribute("aria-labelledby")||K.textContent&&K.textContent.trim().length>0))Y.push({type:"missing-accessible-name",element:`<${K.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),X.querySelectorAll("input, select, textarea").forEach((K)=>{let q=K.getAttribute("id"),U=q&&X.querySelector(`label[for="${q}"]`),W=K.hasAttribute("aria-label")||K.hasAttribute("aria-labelledby"),z=K.closest("label")!==null;if(!U&&!W&&!z)Y.push({type:"input-missing-label",element:`<${K.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let J=Array.from(X.querySelectorAll("h1, h2, h3, h4, h5, h6")),Q=0;for(let K of J){let q=Number.parseInt(K.tagName.charAt(1));if(Q>0&&q>Q+1)Y.push({type:"heading-skip",element:`<${K.outerHTML}>`,message:`Heading level skipped from h${Q} to h${q}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});Q=q}let G=X.querySelector("html");if($.includes("<html")&&G&&!G.hasAttribute("lang"))Y.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(X.querySelectorAll("a").forEach((K)=>{let q=K.textContent&&K.textContent.trim().length>0,U=K.hasAttribute("aria-label")||K.hasAttribute("aria-labelledby"),W=K.hasAttribute("title"),z=K.querySelector("img[alt]");if(!q&&!U&&!W&&!z)Y.push({type:"link-missing-text",element:`<${K.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),$.includes("<nav")||$.includes("<header")){if(!X.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&X.querySelectorAll("a").length>5)Y.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(X.querySelectorAll("table").forEach((K)=>{let q=K.querySelector("caption");if(!K.querySelector("th"))Y.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!q&&!K.hasAttribute("aria-label")&&!K.hasAttribute("aria-labelledby"))Y.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),X.querySelectorAll('[style*="color"]').forEach((K)=>{let q=K.getAttribute("style")||"";if(q.includes("color:")&&!q.includes("background"))Y.push({type:"potential-contrast-issue",element:`<${K.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),X.querySelectorAll("video[autoplay], audio[autoplay]").forEach((K)=>{if(!K.hasAttribute("muted"))Y.push({type:"autoplay-audio",element:`<${K.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),X.querySelectorAll("[tabindex]").forEach((K)=>{if(Number.parseInt(K.getAttribute("tabindex")||"0")>0)Y.push({type:"positive-tabindex",element:`<${K.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),X.querySelectorAll('[role="button"]').forEach((K)=>{if(!K.hasAttribute("tabindex"))Y.push({type:"button-not-focusable",element:`<${K.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),$.includes("<body")&&!X.querySelector('main, [role="main"]'))Y.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});X.querySelectorAll("iframe").forEach((K)=>{if(!K.hasAttribute("title")&&!K.hasAttribute("aria-label"))Y.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(X){console.error(`Error checking accessibility in ${Z}:`,X)}return Y}async function PQ($,Z={}){let Y={},{recursive:X=!0,ignorePaths:J=[]}=Z,Q=z$.join($,X?"**/*.stx":"*.stx"),G=new Bun.Glob(Q),K=[];for await(let q of G.scan())if(!J.some((W)=>q.includes(z$.normalize(W))))K.push(q);for(let q of K)try{let U=await Bun.file(q).text();if(q.endsWith("good-a11y.stx"))continue;let W=await N9(U,q);if(W.length>0)Y[q]=W}catch(U){console.error(`Error scanning ${q}:`,U)}return Y}function T9($,Z={}){let Y={...CQ,...Z},X=[],J=$;if(Y.fixMissingAlt)J=J.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(Q,G,K)=>{if(/\balt\s*=/i.test(G))return Q;let q=Q,U=`<img${G} alt=""${K}`;return X.push({type:"missing-alt",description:"Added empty alt attribute to image",before:q,after:U}),U});if(Y.fixMissingLabels)J=J.replace(/<button([^>]*)>\s*<\/button>/gi,(Q,G)=>{if(/\baria-label\s*=/i.test(G)||/\btitle\s*=/i.test(G))return Q;let K=Q,q=`<button${G} aria-label="Button"></button>`;return X.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:K,after:q}),q}),J=J.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(Q,G,K)=>{if(/\baria-label\s*=/i.test(G)||/\btitle\s*=/i.test(G))return Q;if(!K&&Q.replace(/<a[^>]*>|<\/a>/gi,"").trim())return Q;let q=Q,U=`<a${G} aria-label="Link">${K||""}</a>`;return X.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:q,after:U}),U});if(Y.fixMissingFormLabels)J=J.replace(/<(input|select|textarea)([^>]*)>/gi,(Q,G,K)=>{if(/\baria-label\s*=/i.test(K)||/\baria-labelledby\s*=/i.test(K))return Q;if(/\btype\s*=\s*["']hidden["']/i.test(K))return Q;let q=K.match(/\bname\s*=\s*["']([^"']+)["']/i),U=K.match(/\bid\s*=\s*["']([^"']+)["']/i),W=q?.[1]||U?.[1]||G,z=Q,B=`<${G}${K} aria-label="${W}">`;return X.push({type:"input-missing-label",description:`Added aria-label to ${G} element`,before:z,after:B}),B});if(Y.fixMissingLang)J=J.replace(/<html([^>]*)>/gi,(Q,G)=>{if(/\blang\s*=/i.test(G))return Q;let K=Q,q=`<html${G} lang="${Y.defaultLang}">`;return X.push({type:"missing-lang",description:`Added lang="${Y.defaultLang}" to html element`,before:K,after:q}),q});if(Y.fixPositiveTabindex)J=J.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(Q,G)=>{let K=Q,q='tabindex="0"';return X.push({type:"positive-tabindex",description:`Changed tabindex="${G}" to tabindex="0"`,before:K,after:'tabindex="0"'}),'tabindex="0"'});if(Y.fixButtonFocusable)J=J.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(Q,G,K)=>{if(/\btabindex\s*=/i.test(K))return Q;if(G.toLowerCase()==="button")return Q;let q=Q,U=`<${G}${K} tabindex="0">`;return X.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:q,after:U}),U});if(Y.fixTableHeaders)J=J.replace(/<th([^>]*)>/gi,(Q,G)=>{if(/\bscope\s*=/i.test(G))return Q;let K=Q,q=`<th${G} scope="col">`;return X.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:K,after:q}),q});return{original:$,fixed:J,fixCount:X.length,fixes:X}}async function M9($,Z={},Y=!1){let X=await Bun.file($).text(),J=T9(X,Z);if(Y&&J.fixCount>0)await Bun.write($,J.fixed);return J}async function vQ($,Z={},Y={}){let X={},{recursive:J=!0,ignorePaths:Q=[],writeBack:G=!1,extensions:K=[".stx",".html",".htm"]}=Y,q=K.length===1?`*${K[0]}`:`*{${K.join(",")}}`,U=z$.join($,J?`**/${q}`:q),W=new Bun.Glob(U);for await(let z of W.scan()){if(Q.some((_)=>z.includes(z$.normalize(_))))continue;try{let _=await M9(z,Z,G);if(_.fixCount>0)X[z]=_}catch(_){console.error(`Error fixing ${z}:`,_)}}return X}function xQ(){return[B$,_$]}var CQ,B$,_$;var z7=P(()=>{CQ={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};B$={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let J=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"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},_$={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function I9($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return gQ(Z);case"google-analytics":return hQ(Z);case"plausible":return dQ(Z);case"self-hosted":return mQ(Z);case"custom":return uQ(Z);default:return""}}function gQ($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",J=[`data-site="${C0(Z.siteId)}"`];if(Z.honorDnt)J.push('data-honor-dnt="true"');if(Z.spa)J.push('data-spa="auto"');if(Z.canonical)J.push(`data-canonical="${C0(Z.canonical)}"`);if(Z.auto===!1)J.push('data-auto="false"');return`
14
+ `.trim()}function A9(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function yQ($,Z){let Y=[],X=/<img\s+([^>]*)>/gi,J;J=X.exec($);while(J!==null){let L=J[1];if(!/\balt\s*=/i.test(L))Y.push({type:"missing-alt",element:J[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});J=X.exec($)}let Q=/<button([^>]*)>\s*<\/button>/gi;J=Q.exec($);while(J!==null){let L=J[1];if(!/\baria-label\s*=/i.test(L)&&!/\btitle\s*=/i.test(L))Y.push({type:"missing-accessible-name",element:J[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});J=Q.exec($)}let G=/<a\s+([^>]*)>\s*<\/a>/gi;J=G.exec($);while(J!==null){let L=J[1];if(!/\baria-label\s*=/i.test(L)&&!/\btitle\s*=/i.test(L))Y.push({type:"link-missing-text",element:J[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});J=G.exec($)}let K=/<(input|select|textarea)\s+([^>]*)>/gi;J=K.exec($);while(J!==null){let L=J[2];if(/\btype\s*=\s*["']hidden["']/i.test(L)){J=K.exec($);continue}let F=/\baria-label\s*=/i.test(L)||/\baria-labelledby\s*=/i.test(L),O=L.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!F){let V=O&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${O[1]}["']`,"i").test($),R=J.index,w=$.substring(0,R),A=$.substring(R),N=(w.match(/<label\b/gi)||[]).length,M=(w.match(/<\/label>/gi)||[]).length,T=N>M;if(!V&&!T)Y.push({type:"input-missing-label",element:J[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}J=K.exec($)}let q=/<h([1-6])[^>]*>/gi,U=[];J=q.exec($);while(J!==null)U.push(Number.parseInt(J[1],10)),J=q.exec($);let W=0;for(let L of U){if(W>0&&L>W+1)Y.push({type:"heading-skip",element:`<h${L}>`,message:`Heading level skipped from h${W} to h${L}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});W=L}if(/<html\b/i.test($)&&!/<html[^>]*\slang\s*=/i.test($))Y.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let z=/<table[^>]*>([\s\S]*?)<\/table>/gi;J=z.exec($);while(J!==null){let L=J[1];if(!/<th\b/i.test(L))Y.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});J=z.exec($)}let B=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;J=B.exec($);while(J!==null){if(!/\bmuted\b/i.test(J[0]))Y.push({type:"autoplay-audio",element:`<${J[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});J=B.exec($)}let _=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;J=_.exec($);while(J!==null)Y.push({type:"positive-tabindex",element:`tabindex="${J[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),J=_.exec($);let j=/<iframe\s+([^>]*)>/gi;J=j.exec($);while(J!==null){let L=J[1];if(!/\btitle\s*=/i.test(L)&&!/\baria-label\s*=/i.test(L))Y.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});J=j.exec($)}let H=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;J=H.exec($);while(J!==null){let L=J[1].toLowerCase(),F=J[2];if(L!=="button"&&!/\btabindex\s*=/i.test(F))Y.push({type:"button-not-focusable",element:J[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});J=H.exec($)}return Y}async function N9($,Z){if(!A9())return yQ($,Z);let Y=[];try{let X=globalThis.document.createElement("div");X.innerHTML=$,X.querySelectorAll("img").forEach((K)=>{if(!K.hasAttribute("alt"))Y.push({type:"missing-alt",element:`<${K.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),X.querySelectorAll('button, a, [role="button"]').forEach((K)=>{if(!(K.hasAttribute("aria-label")||K.hasAttribute("aria-labelledby")||K.textContent&&K.textContent.trim().length>0))Y.push({type:"missing-accessible-name",element:`<${K.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),X.querySelectorAll("input, select, textarea").forEach((K)=>{let q=K.getAttribute("id"),U=q&&X.querySelector(`label[for="${q}"]`),W=K.hasAttribute("aria-label")||K.hasAttribute("aria-labelledby"),z=K.closest("label")!==null;if(!U&&!W&&!z)Y.push({type:"input-missing-label",element:`<${K.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let J=Array.from(X.querySelectorAll("h1, h2, h3, h4, h5, h6")),Q=0;for(let K of J){let q=Number.parseInt(K.tagName.charAt(1));if(Q>0&&q>Q+1)Y.push({type:"heading-skip",element:`<${K.outerHTML}>`,message:`Heading level skipped from h${Q} to h${q}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});Q=q}let G=X.querySelector("html");if($.includes("<html")&&G&&!G.hasAttribute("lang"))Y.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(X.querySelectorAll("a").forEach((K)=>{let q=K.textContent&&K.textContent.trim().length>0,U=K.hasAttribute("aria-label")||K.hasAttribute("aria-labelledby"),W=K.hasAttribute("title"),z=K.querySelector("img[alt]");if(!q&&!U&&!W&&!z)Y.push({type:"link-missing-text",element:`<${K.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),$.includes("<nav")||$.includes("<header")){if(!X.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&X.querySelectorAll("a").length>5)Y.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(X.querySelectorAll("table").forEach((K)=>{let q=K.querySelector("caption");if(!K.querySelector("th"))Y.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!q&&!K.hasAttribute("aria-label")&&!K.hasAttribute("aria-labelledby"))Y.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),X.querySelectorAll('[style*="color"]').forEach((K)=>{let q=K.getAttribute("style")||"";if(q.includes("color:")&&!q.includes("background"))Y.push({type:"potential-contrast-issue",element:`<${K.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),X.querySelectorAll("video[autoplay], audio[autoplay]").forEach((K)=>{if(!K.hasAttribute("muted"))Y.push({type:"autoplay-audio",element:`<${K.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),X.querySelectorAll("[tabindex]").forEach((K)=>{if(Number.parseInt(K.getAttribute("tabindex")||"0")>0)Y.push({type:"positive-tabindex",element:`<${K.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),X.querySelectorAll('[role="button"]').forEach((K)=>{if(!K.hasAttribute("tabindex"))Y.push({type:"button-not-focusable",element:`<${K.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),$.includes("<body")&&!X.querySelector('main, [role="main"]'))Y.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});X.querySelectorAll("iframe").forEach((K)=>{if(!K.hasAttribute("title")&&!K.hasAttribute("aria-label"))Y.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(X){console.error(`Error checking accessibility in ${Z}:`,X)}return Y}async function PQ($,Z={}){let Y={},{recursive:X=!0,ignorePaths:J=[]}=Z,Q=z$.join($,X?"**/*.stx":"*.stx"),G=new Bun.Glob(Q),K=[];for await(let q of G.scan())if(!J.some((W)=>q.includes(z$.normalize(W))))K.push(q);for(let q of K)try{let U=await Bun.file(q).text();if(q.endsWith("good-a11y.stx"))continue;let W=await N9(U,q);if(W.length>0)Y[q]=W}catch(U){console.error(`Error scanning ${q}:`,U)}return Y}function T9($,Z={}){let Y={...CQ,...Z},X=[],J=$;if(Y.fixMissingAlt)J=J.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(Q,G,K)=>{if(/\balt\s*=/i.test(G))return Q;let q=Q,U=`<img${G} alt=""${K}`;return X.push({type:"missing-alt",description:"Added empty alt attribute to image",before:q,after:U}),U});if(Y.fixMissingLabels)J=J.replace(/<button([^>]*)>\s*<\/button>/gi,(Q,G)=>{if(/\baria-label\s*=/i.test(G)||/\btitle\s*=/i.test(G))return Q;let K=Q,q=`<button${G} aria-label="Button"></button>`;return X.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:K,after:q}),q}),J=J.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(Q,G,K)=>{if(/\baria-label\s*=/i.test(G)||/\btitle\s*=/i.test(G))return Q;if(!K&&Q.replace(/<a[^>]*>|<\/a>/gi,"").trim())return Q;let q=Q,U=`<a${G} aria-label="Link">${K||""}</a>`;return X.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:q,after:U}),U});if(Y.fixMissingFormLabels)J=J.replace(/<(input|select|textarea)([^>]*)>/gi,(Q,G,K)=>{if(/\baria-label\s*=/i.test(K)||/\baria-labelledby\s*=/i.test(K))return Q;if(/\btype\s*=\s*["']hidden["']/i.test(K))return Q;let q=K.match(/\bname\s*=\s*["']([^"']+)["']/i),U=K.match(/\bid\s*=\s*["']([^"']+)["']/i),W=q?.[1]||U?.[1]||G,z=Q,B=`<${G}${K} aria-label="${W}">`;return X.push({type:"input-missing-label",description:`Added aria-label to ${G} element`,before:z,after:B}),B});if(Y.fixMissingLang)J=J.replace(/<html([^>]*)>/gi,(Q,G)=>{if(/\blang\s*=/i.test(G))return Q;let K=Q,q=`<html${G} lang="${Y.defaultLang}">`;return X.push({type:"missing-lang",description:`Added lang="${Y.defaultLang}" to html element`,before:K,after:q}),q});if(Y.fixPositiveTabindex)J=J.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(Q,G)=>{let K=Q,q='tabindex="0"';return X.push({type:"positive-tabindex",description:`Changed tabindex="${G}" to tabindex="0"`,before:K,after:'tabindex="0"'}),'tabindex="0"'});if(Y.fixButtonFocusable)J=J.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(Q,G,K)=>{if(/\btabindex\s*=/i.test(K))return Q;if(G.toLowerCase()==="button")return Q;let q=Q,U=`<${G}${K} tabindex="0">`;return X.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:q,after:U}),U});if(Y.fixTableHeaders)J=J.replace(/<th([^>]*)>/gi,(Q,G)=>{if(/\bscope\s*=/i.test(G))return Q;let K=Q,q=`<th${G} scope="col">`;return X.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:K,after:q}),q});return{original:$,fixed:J,fixCount:X.length,fixes:X}}async function M9($,Z={},Y=!1){let X=await Bun.file($).text(),J=T9(X,Z);if(Y&&J.fixCount>0)await Bun.write($,J.fixed);return J}async function vQ($,Z={},Y={}){let X={},{recursive:J=!0,ignorePaths:Q=[],writeBack:G=!1,extensions:K=[".stx",".html",".htm"]}=Y,q=K.length===1?`*${K[0]}`:`*{${K.join(",")}}`,U=z$.join($,J?`**/${q}`:q),W=new Bun.Glob(U);for await(let z of W.scan()){if(Q.some((_)=>z.includes(z$.normalize(_))))continue;try{let _=await M9(z,Z,G);if(_.fixCount>0)X[z]=_}catch(_){console.error(`Error fixing ${z}:`,_)}}return X}function xQ(){return[B$,_$]}var CQ,B$,_$;var z7=C(()=>{CQ={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};B$={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let J=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"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},_$={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function I9($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return gQ(Z);case"google-analytics":return hQ(Z);case"plausible":return dQ(Z);case"self-hosted":return mQ(Z);case"custom":return uQ(Z);default:return""}}function gQ($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",J=[`data-site="${C0(Z.siteId)}"`];if(Z.honorDnt)J.push('data-honor-dnt="true"');if(Z.spa)J.push('data-spa="auto"');if(Z.canonical)J.push(`data-canonical="${C0(Z.canonical)}"`);if(Z.auto===!1)J.push('data-auto="false"');return`
15
15
  <!-- Fathom Analytics -->
16
16
  <script src="${C0(Y)}" ${J.join(" ")}${X}></script>
17
17
  `}function hQ($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=C0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
@@ -68,7 +68,7 @@ ${Z.inlineScript}
68
68
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${C0(Z.scriptId)}"`);if(Z.attributes)for(let[J,Q]of Object.entries(Z.attributes))Y.push(`${C0(J)}="${C0(Q)}"`);return`
69
69
  <!-- Custom Analytics -->
70
70
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${C0(Z.scriptUrl)}" defer></script>
71
- `}function D9($,Z){let Y=I9(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function C0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var CH;var E9=P(()=>{CH={name:"analytics",hasEndTag:!1,handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};return I9(J)}}});function iQ($,Z={}){let{duration:Y,delay:X,ease:J,direction:Q,custom:G}={...Z1,...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);"}
71
+ `}function D9($,Z){let Y=I9(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function C0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var CH;var E9=C(()=>{CH={name:"analytics",hasEndTag:!1,handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};return I9(J)}}});function iQ($,Z={}){let{duration:Y,delay:X,ease:J,direction:Q,custom:G}={...Z1,...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);"}
72
72
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
73
73
  @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);"}
74
74
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -439,7 +439,7 @@ else {
439
439
  );
440
440
  }
441
441
  };
442
- </script>`}function dH($){let Z=$.customDirectives||[];return Z.push(B7),Z.push(j7),Z.push(H7),Z.push(_7),Z.push(eQ),Z.push(ZG),Z.push(XG),{...$,customDirectives:Z}}var lQ,pQ,cQ,Z1,B7,_7,j7,H7,k9,eQ,ZG,XG;var O7=P(()=>{((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(lQ||={});((X)=>{X.In="in";X.Out="out";X.Both="both"})(pQ||={});((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(cQ||={});Z1={duration:300,delay:0,ease:"ease",direction:"both"};B7={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||Z1.duration:Z1.duration,G=Z.length>2?Z[2]||Z1.ease:Z1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||Z1.delay:Z1.delay,q=Z.length>4?Z[4]||Z1.direction:Z1.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=iQ(J,{duration:Q,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(J==="fade")B="stx-fade";else if(J==="slide")B="stx-slide";else if(J==="scale")B="stx-scale";else if(J==="flip")B="stx-flip";else if(J==="rotate")B="stx-rotate";return`<div id="${U}" class="${z} ${B} ${q==="out"?"stx-out":""}"
442
+ </script>`}function dH($){let Z=$.customDirectives||[];return Z.push(B7),Z.push(j7),Z.push(H7),Z.push(_7),Z.push(eQ),Z.push(ZG),Z.push(XG),{...$,customDirectives:Z}}var lQ,pQ,cQ,Z1,B7,_7,j7,H7,k9,eQ,ZG,XG;var O7=C(()=>{((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(lQ||={});((X)=>{X.In="in";X.Out="out";X.Both="both"})(pQ||={});((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(cQ||={});Z1={duration:300,delay:0,ease:"ease",direction:"both"};B7={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||Z1.duration:Z1.duration,G=Z.length>2?Z[2]||Z1.ease:Z1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||Z1.delay:Z1.delay,q=Z.length>4?Z[4]||Z1.direction:Z1.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=iQ(J,{duration:Q,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(J==="fade")B="stx-fade";else if(J==="slide")B="stx-slide";else if(J==="scale")B="stx-scale";else if(J==="flip")B="stx-flip";else if(J==="rotate")B="stx-rotate";return`<div id="${U}" class="${z} ${B} ${q==="out"?"stx-out":""}"
443
443
  style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},_7={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(J==="fade")z+=" stx-fade";else if(J==="slide-up"||J==="slide")z+=" stx-from-bottom";else if(J==="slide-down")z+=" stx-from-top";else if(J==="slide-left")z+=" stx-from-right";else if(J==="slide-right")z+=" stx-from-left";else if(J==="scale")z+=" stx-scale";else if(J.includes("-"))z+=` stx-${J}`;else z+=` stx-${J}`;return`<div id="${U}" class="${z}" style="${W}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},j7={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let J=Z[0],Q=Z.slice(1).map((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=aQ(J,Q,{staggerDelay:G,sequence:K});return`${$}
444
444
  ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},H7={name:"motion",handler:($,Z,Y,X)=>{let J=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=nQ();return`<div data-animate="${J?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};k9={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};eQ={name:"keyframe",hasEndTag:!0,handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",K=Z[3]||"1",q=Z[4]?.replace(/['"`]/g,"")||"normal",U=Z[5]?.replace(/['"`]/g,"")||"forwards",W=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,z=`
445
445
  animation-name: ${J};
@@ -463,7 +463,7 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
463
463
  --stx-spring-stiffness: ${Q.stiffness};
464
464
  --stx-spring-damping: ${Q.damping};
465
465
  --stx-spring-mass: ${Q.mass};
466
- `.trim().replace(/\s+/g," ");return`<div id="${K}" class="stx-spring" style="${U}">${$}</div>`},description:"Applies spring physics animations to an element"}});var b9={};l(b9,{rewriteImagesWithSiblings:()=>GG});import Y1 from"path";async function GG($,Z){let Y=Z.formats??QG;if(!Z.publicDir)return $;let X=UG($),J=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(WG(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await KG(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${zG(H.url)}">`).join("")}${z.raw}</picture>`;J.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(J.length===0)return $;let U="",W=0;for(let z of J)U+=$.slice(W,z.start),U+=z.replacement,W=z.end;return U+=$.slice(W),U}async function KG($,Z,Y){if(!qG($))return[];let X=Y1.extname($).toLowerCase();if(!JG.has(X))return[];if(!$.startsWith("/"))return[];let J=Y1.join(Z,$.slice(1)),Q=Y1.dirname(J),G=Y1.basename(J,X),K=Y1.resolve(Q),q=Y1.resolve(Z);if(!K.startsWith(q))return[];let U=Y1.posix.dirname($),W=Y.map(async(B)=>{let _=Y1.join(Q,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:Y1.posix.join(U,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(W)).filter((B)=>B!==null)}function qG($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function UG($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function WG($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function zG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var JG,QG;var y9=P(()=>{JG=new Set([".jpg",".jpeg",".png",".gif"]),QG=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});function BG($){if(j$.set($.name,$),$.client)L7.set($.name,$.client)}function lH($){return j$.get($)}function pH(){return Array.from(j$.values())}function cH($){return L7.delete($),j$.delete($)}function _0($){return BG($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=_G(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let U=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(U)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function iH($,Z){let Y=typeof Z==="function"?{mounted:Z}:Z;return L7.set($,Y),Y}function _G($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}function nH(){return[_0({name:"uppercase",description:"Convert content to uppercase",transform:($)=>$.toUpperCase()}),_0({name:"lowercase",description:"Convert content to lowercase",transform:($)=>$.toLowerCase()}),_0({name:"capitalize",description:"Capitalize first letter of content",transform:($)=>$.charAt(0).toUpperCase()+$.slice(1)}),_0({name:"trim",description:"Remove leading and trailing whitespace",transform:($)=>$.trim()}),_0({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:($,{length:Z,suffix:Y})=>$.length>Z?$.slice(0,Z)+Y:$}),_0({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:($,{color:Z})=>`<mark style="background-color: ${Z}; padding: 0.1em 0.2em; border-radius: 0.2em;">${$}</mark>`}),_0({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:($,{variant:Z,color:Y})=>{let X={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${Y?`background: ${Y}; color: white;`:X[Z]||X.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${$}</span>`}}),_0({name:"code",description:"Style content as inline code",transform:($)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${$}</code>`}),_0({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:($,{text:Z,position:Y})=>`<span class="stx-tooltip" data-tooltip="${Z}" data-tooltip-position="${Y}" style="position: relative; cursor: help;">${$}</span>`,css:()=>`
466
+ `.trim().replace(/\s+/g," ");return`<div id="${K}" class="stx-spring" style="${U}">${$}</div>`},description:"Applies spring physics animations to an element"}});var b9={};l(b9,{rewriteImagesWithSiblings:()=>GG});import Y1 from"path";async function GG($,Z){let Y=Z.formats??QG;if(!Z.publicDir)return $;let X=UG($),J=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(WG(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await KG(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${zG(H.url)}">`).join("")}${z.raw}</picture>`;J.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(J.length===0)return $;let U="",W=0;for(let z of J)U+=$.slice(W,z.start),U+=z.replacement,W=z.end;return U+=$.slice(W),U}async function KG($,Z,Y){if(!qG($))return[];let X=Y1.extname($).toLowerCase();if(!JG.has(X))return[];if(!$.startsWith("/"))return[];let J=Y1.join(Z,$.slice(1)),Q=Y1.dirname(J),G=Y1.basename(J,X),K=Y1.resolve(Q),q=Y1.resolve(Z);if(!K.startsWith(q))return[];let U=Y1.posix.dirname($),W=Y.map(async(B)=>{let _=Y1.join(Q,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:Y1.posix.join(U,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(W)).filter((B)=>B!==null)}function qG($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function UG($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function WG($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function zG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var JG,QG;var y9=C(()=>{JG=new Set([".jpg",".jpeg",".png",".gif"]),QG=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});function BG($){if(j$.set($.name,$),$.client)L7.set($.name,$.client)}function lH($){return j$.get($)}function pH(){return Array.from(j$.values())}function cH($){return L7.delete($),j$.delete($)}function _0($){return BG($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=_G(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let U=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(U)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function iH($,Z){let Y=typeof Z==="function"?{mounted:Z}:Z;return L7.set($,Y),Y}function _G($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}function nH(){return[_0({name:"uppercase",description:"Convert content to uppercase",transform:($)=>$.toUpperCase()}),_0({name:"lowercase",description:"Convert content to lowercase",transform:($)=>$.toLowerCase()}),_0({name:"capitalize",description:"Capitalize first letter of content",transform:($)=>$.charAt(0).toUpperCase()+$.slice(1)}),_0({name:"trim",description:"Remove leading and trailing whitespace",transform:($)=>$.trim()}),_0({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:($,{length:Z,suffix:Y})=>$.length>Z?$.slice(0,Z)+Y:$}),_0({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:($,{color:Z})=>`<mark style="background-color: ${Z}; padding: 0.1em 0.2em; border-radius: 0.2em;">${$}</mark>`}),_0({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:($,{variant:Z,color:Y})=>{let X={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${Y?`background: ${Y}; color: white;`:X[Z]||X.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${$}</span>`}}),_0({name:"code",description:"Style content as inline code",transform:($)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${$}</code>`}),_0({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:($,{text:Z,position:Y})=>`<span class="stx-tooltip" data-tooltip="${Z}" data-tooltip-position="${Y}" style="position: relative; cursor: help;">${$}</span>`,css:()=>`
467
467
  .stx-tooltip::after {
468
468
  content: attr(data-tooltip);
469
469
  position: absolute;
@@ -607,13 +607,13 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
607
607
 
608
608
  console.log('[stx] Directive runtime initialized');
609
609
  })();
610
- `}function sH($){let Z=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return $.replace(Z,(Y,X,J,Q,G)=>{let q=(Q?Q.split("."):[]).reduce((U,W)=>{return U[W]=!0,U},{});return`data-stx-directive="${X}:${G}" data-stx-directive-arg="${J||""}" data-stx-directive-modifiers='${JSON.stringify(q)}'`})}var j$,L7;var F7=P(()=>{j$=new Map,L7=new Map});function X1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
610
+ `}function sH($){let Z=/v-(\w+)(?::(\w+))?(?:\.([\w.]+))?="([^"]*)"/g;return $.replace(Z,(Y,X,J,Q,G)=>{let q=(Q?Q.split("."):[]).reduce((U,W)=>{return U[W]=!0,U},{});return`data-stx-directive="${X}:${G}" data-stx-directive-arg="${J||""}" data-stx-directive-modifiers='${JSON.stringify(q)}'`})}var j$,L7;var F7=C(()=>{j$=new Map,L7=new Map});function X1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
611
611
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
612
612
  `}),$}import P9 from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(P9.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function eH($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(P9.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var a1=()=>{};var H$={};l(H$,{hasUserImports:()=>jG,bundleClientScript:()=>OG});import z0 from"path";import f0 from"fs";function jG($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,J;while((J=X.exec($))!==null){let G=J[1];if(!C9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((J=Q.exec($))!==null){let G=J[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!C9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function HG($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:z0.dirname(Q),q=z0.resolve(K,G),U=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,z0.join(q,"index.ts"),z0.join(q,"index.tsx"),z0.join(q,"index.js"),z0.join(q,"index.mjs")];for(let W of U)try{if(f0.existsSync(W)&&f0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=z0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,z0.join(K,"index.ts"),z0.join(K,"index.tsx"),z0.join(K,"index.js"),z0.join(K,"index.mjs")];for(let U of q)if(f0.existsSync(U)&&f0.statSync(U,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",U),X.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function OG($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||z0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=z0.join(Q,`${K}.js`),U=z0.join(Q,`${K}.deps.json`),W=Bun.file(q);if(await W.exists()){let w=Bun.file(U),A=!0;if(await w.exists())try{let N=JSON.parse(await w.text());for(let M of N.files)try{if(f0.statSync(M.path).mtimeMs!==M.mtimeMs){A=!1;break}}catch{A=!1;break}}catch{A=!1}if(A)return console.log("[stx:bundler] cache hit:",K),await W.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=z0.join(X,".stx","bundle-tmp"),B=z0.join(z,`${K}.ts`),_=z0.join(z,"out",K);f0.mkdirSync(z,{recursive:!0}),f0.mkdirSync(_,{recursive:!0});let j=z0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((w)=>{let A=w.split(":")[0].trim();if(A)H.push(A)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
613
613
  export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",z0.basename(Z));let R=new Set;try{let w=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:J,plugins:[HG(X,j,B,R)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...o0()},root:X});if(!w.success){let T=w.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",T),$}let A="";for(let T of w.outputs){A=await T.text();break}let N=[];for(let T of A.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of T[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])N.push([D[2],D[1]])}if(A=A.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),N.length>0){let T=N.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");A+=`
614
614
  var __stxScopeRenames = { ${T} };`}console.log("[stx:bundler] bundled:",K,"output:",A.length,"bytes"),f0.mkdirSync(Q,{recursive:!0}),await Bun.write(q,A);let M=Array.from(R).map((T)=>{try{return{path:T,mtimeMs:f0.statSync(T).mtimeMs}}catch{return null}}).filter((T)=>T!==null);return await Bun.write(U,JSON.stringify({files:M})),A}catch(w){let A=w instanceof Error?w.message:String(w),N=w?.errors,M=Array.isArray(N)&&N.length>0?`
615
615
  ${N.map((T)=>`- ${T?.message??T}`).join(`
616
- `)}`:"";return console.warn(`[stx:bundler] error: ${A}${M}`),$}finally{try{f0.rmSync(B,{force:!0}),f0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var C9;var O$=P(()=>{a1();C9=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function JO($){t1={...t1,...$}}function QO(){t1={...f9}}function GO(){return{...t1}}function VG($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function wG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(LG.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&g9.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function RG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!g9.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function I5($){let Z=$.trim(),Y=VG(Z);wG(Y,Z),RG(Z);for(let X of w7)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!t1.allowBracketNotation&&FG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function h9($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||w7.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=V7(X);else Z[Y]=X}return Z}function V7($,Z=0){if(Z>=t1.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>V7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=V7(J,Z+1);else Y[X]=J}return Y}function e($,Z){try{let Y=h9(Z),X=Object.keys(Y),J=Object.values(Y);return Z0($,X)(...J)}catch{return}}function $0($){try{return I5($),!0}catch{return!1}}function KO($){try{return I5($),null}catch(Z){return Z instanceof Error?Z.message:String(Z)}}function qO($,Z){try{let Y=e($,Z);return Boolean(Y)}catch{return!1}}function UO($,Z){try{let Y=e($,Z);if(Array.isArray(Y))return Y;if(Y&&typeof Y==="object"&&"length"in Y){let X=Y.length;if(typeof X==="number"&&Number.isFinite(X)&&X>=0&&Number.isInteger(X))return Array.from(Y)}return[]}catch{return[]}}function j0($,Z){try{let Y=e($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Z0($,Z){let Y=I5($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let U=0;U<Z.length;U++){let W=Z[U];if(!X.test(W))continue;if(d9.has(W))continue;J.push(U),Q.push(W)}let G=(U)=>Function(...Q,...U,`
616
+ `)}`:"";return console.warn(`[stx:bundler] error: ${A}${M}`),$}finally{try{f0.rmSync(B,{force:!0}),f0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var C9;var O$=C(()=>{a1();C9=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});function JO($){t1={...t1,...$}}function QO(){t1={...f9}}function GO(){return{...t1}}function VG($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function wG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(LG.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&g9.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function RG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!g9.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function I5($){let Z=$.trim(),Y=VG(Z);wG(Y,Z),RG(Z);for(let X of w7)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!t1.allowBracketNotation&&FG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function h9($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||w7.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=V7(X);else Z[Y]=X}return Z}function V7($,Z=0){if(Z>=t1.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>V7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=V7(J,Z+1);else Y[X]=J}return Y}function e($,Z){try{let Y=h9(Z),X=Object.keys(Y),J=Object.values(Y);return Z0($,X)(...J)}catch{return}}function $0($){try{return I5($),!0}catch{return!1}}function KO($){try{return I5($),null}catch(Z){return Z instanceof Error?Z.message:String(Z)}}function qO($,Z){try{let Y=e($,Z);return Boolean(Y)}catch{return!1}}function UO($,Z){try{let Y=e($,Z);if(Array.isArray(Y))return Y;if(Y&&typeof Y==="object"&&"length"in Y){let X=Y.length;if(typeof X==="number"&&Number.isFinite(X)&&X>=0&&Number.isInteger(X))return Array.from(Y)}return[]}catch{return[]}}function j0($,Z){try{let Y=e($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Z0($,Z){let Y=I5($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let U=0;U<Z.length;U++){let W=Z[U];if(!X.test(W))continue;if(d9.has(W))continue;J.push(U),Q.push(W)}let G=(U)=>Function(...Q,...U,`
617
617
  'use strict';
618
618
  try {
619
619
  return ${Y};
@@ -655,7 +655,7 @@ catch (e) {
655
655
  }
656
656
  return result;
657
657
  // eslint-disable-next-line pickier/no-unused-vars
658
- `)}var f9,t1,w7,LG,g9,FG,d9,x9=65536;var F0=P(()=>{f9={maxSanitizeDepth:10,allowBracketNotation:!1},t1={...f9};w7=[/\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/],LG=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"]),g9=new Set(["__proto__","constructor","prototype"]),FG=/[\w)\]]\s*\[\s*['"]/;d9=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 _O(){m9=0,L$.clear()}function F$($,Z){let Y=m9++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return L$.set(X,{type:$,expression:Z}),X}function jO(){let $={};for(let[Z,Y]of L$)$[Z]={type:Y.type,expression:Y.expression};return $}function HO($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=L$.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function OO($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function LO($){return $.includes("<!--__STX_")}var m9=0,L$;var u9=P(()=>{L$=new Map});function l9($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function V$($,Z){return l9($,Z,AG,NG)}function p9($,Z){return l9($,Z,TG,MG)}function c9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function E5($,Z,Y){let X=[],J="",Q=0,G=$.length,K=!1,q=null;while(Q<G){let U=$[Q];if(K){if(J+=U,q){if(U===q)q=null}else if(U==='"'||U==="'")q=U;else if(U===">")K=!1;Q++;continue}if(U==="<"){let W=Z($,Q);if(W>Q){J+=Y($.slice(Q,W),X.length),X.push($.slice(Q,W)),Q=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Q,Q+2)))K=!0;J+=U,Q++;continue}J+=U,Q++}return{output:J,tokens:X}}function w$($){let{output:Z,tokens:Y}=E5($,V$,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function R$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var AG,NG,TG,MG;var A$=P(()=>{AG=/<script\b[^>]*>/iy,NG=/<\/script\s*>/ig,TG=/<style\b[^>]*>/iy,MG=/<\/style\s*>/ig});var t9={};l(t9,{usesSignalsInScript:()=>e1,unescapeHtml:()=>R7,registerFilters:()=>DG,registerFilter:()=>o9,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>kG,interpolateScriptExpressions:()=>r9,getAllFilters:()=>s9,evaluateExpression:()=>g0,escapeHtml:()=>d0,defaultFilters:()=>S5,clearCustomFilters:()=>EG,applyFilters:()=>a9});function IG($){let Z=i9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),i9.set($,Z)}return Z.lastIndex=0,Z}function o9($,Z){if($ in S5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);k5[$]=Z}function DG($){for(let[Z,Y]of Object.entries($))o9(Z,Y)}function s9(){return{...S5,...k5}}function EG(){for(let $ of Object.keys(k5))delete k5[$]}function d0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function e1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function n9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let U=0;U<X.length;U++){let W=X[U];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[U+1]==="{"){G++,U++;continue}if(W==="}"&&G>0){G--;continue}continue}J+=W}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let U=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(U)&&!(U in Z))return!1}}return!0}function r9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=g0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=g0(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function kG($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,J,Q)=>{if(/\bsrc\s*=/.test(J))return X;if(/\bdata-raw\b/.test(J))return X;if(/\btype\s*=\s*["']application\/json["']/.test(J))return X;if(Y.skipServer&&/\bserver\b/.test(J))return X;let G=r9(Q,Z);return`<script${J}>${G}</script>`})}function s0($,Z,Y,X){let J=$,Q=(W,z)=>{let B=p9(W,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(z,B))?-1:B},G=(W,z,B,_)=>{let j=B.length,{output:H,tokens:L}=E5(W,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];J=G(J,Q,K,(W)=>`<!--__STX_STYLE_${W}__-->`);let q=[];J=G(J,V$,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let U=X?.forceSignals===!0||e1($);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(W,z,B)=>{try{let _=g0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,W)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(W,z,B)=>{try{let _=g0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return F$("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return F$("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,W)}}),J=G(J,V$,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),J=G(J,Q,K,(W)=>`<!--__STX_STYLE_${W}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(W,z,B)=>{let _=z.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(V),w=R&&!j.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let A=g0(z,Z);if(A===void 0&&U&&!n9(_,Z))return W;if(A===void 0&&Z.__stx_buildMode==="compile"&&!U)return F$("expr",_);return A!==void 0&&A!==null?d0(String(A)):""}catch(A){if(U&&!n9(_,Z))return W;if(w)return W;let N=A instanceof Error?A.message:String(A);return Q0("Expression",`Error evaluating: {{ ${_} }}: ${N}`,Y,$,B,W)}});for(let W=0;W<q.length;W++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${W}__-->`,()=>q[W]);for(let W=0;W<K.length;W++)J=J.replace(`<!--__STX_STYLE_${W}__-->`,()=>K[W]);return J}function a9($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=k5[G]||S5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(s9()).join(", ")}`);let q=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let W=U[1].trim();try{let z=Number(W);q=[Number.isNaN(z)?W:z]}catch{q=[W]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,W=1;while(U>0&&W<J.length){if(J[W]==="(")U++;if(J[W]===")")U--;W++}if(U===0){let z=J.substring(1,W-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[g0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let R=z[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return g0(R,Y,!0)})}}catch{q=[z]}J=J.substring(W).trim()}}try{X=K(X,Y,...q)}catch(U){let W=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${W}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function SG($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],U=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&U==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&J===0&&Q===0){if(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function g0($,Z,Y=!1){try{let X=$.trim(),J=SG(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=g0(Q,Z,!0);return a9(K,G,Z)}if(!$0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return e(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return Z0(X,Q)(...G)}catch{return e(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=bG(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function bG($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=yG($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function yG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+q)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function R7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var k5,i9,S5;var r0=P(()=>{F0();V0();u9();A$();k5={},i9=new Map;S5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return d0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([q,U])=>{K=K.replace(IG(q),String(U))}),K},t:($,Z,Y={})=>{return S5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});class b5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function E1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!D1.has(Y)){if(D1.size>=PG){let X=D1.keys().next().value;if(X)D1.delete(X)}D1.set(Y,new RegExp($,Z))}return D1.get(Y)}function TO(){D1.clear()}class CG{cache=new Map;maxSize;ttl;constructor($=1000,Z=300000){this.maxSize=$,this.ttl=Z}get($){let Z=this.cache.get($);if(!Z)return null;if(Date.now()-Z.timestamp>this.ttl)return this.cache.delete($),null;return Z.result}set($,Z,Y=new Set){if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X)this.cache.delete(X)}this.cache.set($,{result:Z,timestamp:Date.now(),dependencies:Y})}invalidateDependency($){let Z=0;for(let[Y,X]of this.cache.entries())if(X.dependencies.has($))this.cache.delete(Y),Z++;return Z}clear(){this.cache.clear()}getStats(){return{size:this.cache.size,maxSize:this.maxSize}}}function MO($,Z){let Y;return(...X)=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{$(...X)},Z)}}function IO($,Z){let Y=0,X;return(...J)=>{let Q=Date.now();if(Q-Y>=Z)Y=Q,X=$(...J);return X}}function DO($,Z=100){let Y=new Map;return(...X)=>{let J;try{J=JSON.stringify(X)}catch{return $(...X)}if(Y.has(J))return Y.get(J);if(Y.size>=Z){let G=Y.keys().next().value;if(G)Y.delete(G)}let Q=$(...X);return Y.set(J,Q),Q}}function EO($,Z,Y,X){if(typeof Z==="string"){let J=E1(Z,X);if(typeof Y==="string"&&X?.includes("i")){let Q=Y;return $.replace(J,(G)=>{if(G===G.toUpperCase()&&G!==G.toLowerCase())return Q.toUpperCase();else if(G[0]===G[0].toUpperCase()&&G[0]!==G[0].toLowerCase())return Q[0].toUpperCase()+Q.slice(1).toLowerCase();else return Q.toLowerCase()})}return $.replace(J,Y)}return $.replace(Z,Y)}class e9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let U=`${Y}:${q}`,W=J.get(U);if(!W){if(J.size>=Q){let z=J.keys().next().value;if(z)J.delete(z)}W=Function(...Z,`
658
+ `)}var f9,t1,w7,LG,g9,FG,d9,x9=65536;var F0=C(()=>{f9={maxSanitizeDepth:10,allowBracketNotation:!1},t1={...f9};w7=[/\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/],LG=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"]),g9=new Set(["__proto__","constructor","prototype"]),FG=/[\w)\]]\s*\[\s*['"]/;d9=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 _O(){m9=0,L$.clear()}function F$($,Z){let Y=m9++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return L$.set(X,{type:$,expression:Z}),X}function jO(){let $={};for(let[Z,Y]of L$)$[Z]={type:Y.type,expression:Y.expression};return $}function HO($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=L$.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function OO($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function LO($){return $.includes("<!--__STX_")}var m9=0,L$;var u9=C(()=>{L$=new Map});function l9($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function V$($,Z){return l9($,Z,AG,NG)}function p9($,Z){return l9($,Z,TG,MG)}function c9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function E5($,Z,Y){let X=[],J="",Q=0,G=$.length,K=!1,q=null;while(Q<G){let U=$[Q];if(K){if(J+=U,q){if(U===q)q=null}else if(U==='"'||U==="'")q=U;else if(U===">")K=!1;Q++;continue}if(U==="<"){let W=Z($,Q);if(W>Q){J+=Y($.slice(Q,W),X.length),X.push($.slice(Q,W)),Q=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Q,Q+2)))K=!0;J+=U,Q++;continue}J+=U,Q++}return{output:J,tokens:X}}function w$($){let{output:Z,tokens:Y}=E5($,V$,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function R$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var AG,NG,TG,MG;var A$=C(()=>{AG=/<script\b[^>]*>/iy,NG=/<\/script\s*>/ig,TG=/<style\b[^>]*>/iy,MG=/<\/style\s*>/ig});var t9={};l(t9,{usesSignalsInScript:()=>e1,unescapeHtml:()=>R7,registerFilters:()=>DG,registerFilter:()=>o9,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>kG,interpolateScriptExpressions:()=>r9,getAllFilters:()=>s9,evaluateExpression:()=>g0,escapeHtml:()=>d0,defaultFilters:()=>S5,clearCustomFilters:()=>EG,applyFilters:()=>a9});function IG($){let Z=i9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),i9.set($,Z)}return Z.lastIndex=0,Z}function o9($,Z){if($ in S5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);k5[$]=Z}function DG($){for(let[Z,Y]of Object.entries($))o9(Z,Y)}function s9(){return{...S5,...k5}}function EG(){for(let $ of Object.keys(k5))delete k5[$]}function d0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function e1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function n9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let U=0;U<X.length;U++){let W=X[U];if(!Q&&W==="`"){Q=!0,G=0;continue}if(Q){if(W==="`"&&G===0){Q=!1;continue}if(W==="$"&&X[U+1]==="{"){G++,U++;continue}if(W==="}"&&G>0){G--;continue}continue}J+=W}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let U=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(U)&&!(U in Z))return!1}}return!0}function r9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=g0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=g0(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function kG($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,J,Q)=>{if(/\bsrc\s*=/.test(J))return X;if(/\bdata-raw\b/.test(J))return X;if(/\btype\s*=\s*["']application\/json["']/.test(J))return X;if(Y.skipServer&&/\bserver\b/.test(J))return X;let G=r9(Q,Z);return`<script${J}>${G}</script>`})}function s0($,Z,Y,X){let J=$,Q=(W,z)=>{let B=p9(W,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(z,B))?-1:B},G=(W,z,B,_)=>{let j=B.length,{output:H,tokens:L}=E5(W,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];J=G(J,Q,K,(W)=>`<!--__STX_STYLE_${W}__-->`);let q=[];J=G(J,V$,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let U=X?.forceSignals===!0||e1($);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(W,z,B)=>{try{let _=g0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,W)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(W,z,B)=>{try{let _=g0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return F$("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return F$("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return Q0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,W)}}),J=G(J,V$,q,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),J=G(J,Q,K,(W)=>`<!--__STX_STYLE_${W}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(W,z,B)=>{let _=z.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(V),w=R&&!j.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let A=g0(z,Z);if(A===void 0&&U&&!n9(_,Z))return W;if(A===void 0&&Z.__stx_buildMode==="compile"&&!U)return F$("expr",_);return A!==void 0&&A!==null?d0(String(A)):""}catch(A){if(U&&!n9(_,Z))return W;if(w)return W;let N=A instanceof Error?A.message:String(A);return Q0("Expression",`Error evaluating: {{ ${_} }}: ${N}`,Y,$,B,W)}});for(let W=0;W<q.length;W++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${W}__-->`,()=>q[W]);for(let W=0;W<K.length;W++)J=J.replace(`<!--__STX_STYLE_${W}__-->`,()=>K[W]);return J}function a9($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=k5[G]||S5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(s9()).join(", ")}`);let q=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let W=U[1].trim();try{let z=Number(W);q=[Number.isNaN(z)?W:z]}catch{q=[W]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,W=1;while(U>0&&W<J.length){if(J[W]==="(")U++;if(J[W]===")")U--;W++}if(U===0){let z=J.substring(1,W-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[g0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let R=z[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return g0(R,Y,!0)})}}catch{q=[z]}J=J.substring(W).trim()}}try{X=K(X,Y,...q)}catch(U){let W=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${W}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function SG($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],U=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&U==="{"){let W=1;K+=2;while(K<$.length&&W>0){if($[K]==="{")W++;else if($[K]==="}")W--;if(W>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&J===0&&Q===0){if(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function g0($,Z,Y=!1){try{let X=$.trim(),J=SG(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=g0(Q,Z,!0);return a9(K,G,Z)}if(!$0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return e(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return Z0(X,Q)(...G)}catch{return e(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=bG(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function bG($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=yG($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function yG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+q)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function R7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var k5,i9,S5;var r0=C(()=>{F0();V0();u9();A$();k5={},i9=new Map;S5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return d0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([q,U])=>{K=K.replace(IG(q),String(U))}),K},t:($,Z,Y={})=>{return S5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});class b5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function E1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!D1.has(Y)){if(D1.size>=PG){let X=D1.keys().next().value;if(X)D1.delete(X)}D1.set(Y,new RegExp($,Z))}return D1.get(Y)}function TO(){D1.clear()}class CG{cache=new Map;maxSize;ttl;constructor($=1000,Z=300000){this.maxSize=$,this.ttl=Z}get($){let Z=this.cache.get($);if(!Z)return null;if(Date.now()-Z.timestamp>this.ttl)return this.cache.delete($),null;return Z.result}set($,Z,Y=new Set){if(this.cache.size>=this.maxSize){let X=this.cache.keys().next().value;if(X)this.cache.delete(X)}this.cache.set($,{result:Z,timestamp:Date.now(),dependencies:Y})}invalidateDependency($){let Z=0;for(let[Y,X]of this.cache.entries())if(X.dependencies.has($))this.cache.delete(Y),Z++;return Z}clear(){this.cache.clear()}getStats(){return{size:this.cache.size,maxSize:this.maxSize}}}function MO($,Z){let Y;return(...X)=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{$(...X)},Z)}}function IO($,Z){let Y=0,X;return(...J)=>{let Q=Date.now();if(Q-Y>=Z)Y=Q,X=$(...J);return X}}function DO($,Z=100){let Y=new Map;return(...X)=>{let J;try{J=JSON.stringify(X)}catch{return $(...X)}if(Y.has(J))return Y.get(J);if(Y.size>=Z){let G=Y.keys().next().value;if(G)Y.delete(G)}let Q=$(...X);return Y.set(J,Q),Q}}function EO($,Z,Y,X){if(typeof Z==="string"){let J=E1(Z,X);if(typeof Y==="string"&&X?.includes("i")){let Q=Y;return $.replace(J,(G)=>{if(G===G.toUpperCase()&&G!==G.toLowerCase())return Q.toUpperCase();else if(G[0]===G[0].toUpperCase()&&G[0]!==G[0].toLowerCase())return Q[0].toUpperCase()+Q.slice(1).toLowerCase();else return Q.toLowerCase()})}return $.replace(J,Y)}return $.replace(Z,Y)}class e9{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let U=`${Y}:${q}`,W=J.get(U);if(!W){if(J.size>=Q){let z=J.keys().next().value;if(z)J.delete(z)}W=Function(...Z,`
659
659
  'use strict';
660
660
  try {
661
661
  return ${q};
@@ -666,7 +666,7 @@ catch (e) {
666
666
  }
667
667
  throw e;
668
668
  }
669
- `),J.set(U,W)}return W(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class $8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,J=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!J&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:J};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=J?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let J=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function Z8(){if(!N$)N$=new $8;return N$}function SO($=Z8()){$.setBudgets(vG)}function bO(){N$=null}var D1,PG=500,kO,vG,N$=null,Y8;var $5=P(()=>{D1=new Map;kO=new e9;vG={processDirectives:{maxTime:500,warnThreshold:0.8,action:"warn"},processTemplate:{maxTime:200,warnThreshold:0.8,action:"warn"},processIncludes:{maxTime:100,warnThreshold:0.8,action:"warn"},processLoops:{maxTime:50,warnThreshold:0.8,action:"warn"},processConditionals:{maxTime:50,warnThreshold:0.8,action:"warn"},processExpressions:{maxTime:100,warnThreshold:0.8,action:"warn"},renderComponent:{maxTime:150,warnThreshold:0.8,action:"warn"},buildWebComponents:{maxTime:1000,warnThreshold:0.8,action:"warn"}};Y8=new Proxy({},{get($,Z){return Z8()[Z]}})});function y5($,Z){return`${K0[Z]}${$}${K0.reset}`}function PO($){return y5($,"green")}function CO($){return y5($,"yellow")}function vO($){return y5($,"red")}function xO($){return y5($,"cyan")}function fO($){return y5($,"gray")}var K0;var X8=P(()=>{K0={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"}});import{getRouterScript as J8}from"stx-router";var Q8=P(()=>{A7()});async function xG($,Z,Y,X){let J=Z[0]?.replace(/['"]/g,"")||"main",Q=J8();if(J!=="main")Q=Q.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${Q}</script>`}var G8;var A7=P(()=>{Q8();G8={name:"stxRouter",handler:xG,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function K8($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...fG,...Z};return`
669
+ `),J.set(U,W)}return W(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class $8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,J=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!J&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:J};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=J?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let J=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function Z8(){if(!N$)N$=new $8;return N$}function SO($=Z8()){$.setBudgets(vG)}function bO(){N$=null}var D1,PG=500,kO,vG,N$=null,Y8;var $5=C(()=>{D1=new Map;kO=new e9;vG={processDirectives:{maxTime:500,warnThreshold:0.8,action:"warn"},processTemplate:{maxTime:200,warnThreshold:0.8,action:"warn"},processIncludes:{maxTime:100,warnThreshold:0.8,action:"warn"},processLoops:{maxTime:50,warnThreshold:0.8,action:"warn"},processConditionals:{maxTime:50,warnThreshold:0.8,action:"warn"},processExpressions:{maxTime:100,warnThreshold:0.8,action:"warn"},renderComponent:{maxTime:150,warnThreshold:0.8,action:"warn"},buildWebComponents:{maxTime:1000,warnThreshold:0.8,action:"warn"}};Y8=new Proxy({},{get($,Z){return Z8()[Z]}})});function y5($,Z){return`${K0[Z]}${$}${K0.reset}`}function PO($){return y5($,"green")}function CO($){return y5($,"yellow")}function vO($){return y5($,"red")}function xO($){return y5($,"cyan")}function fO($){return y5($,"gray")}var K0;var X8=C(()=>{K0={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"}});import{getRouterScript as J8}from"stx-router";var Q8=C(()=>{A7()});async function xG($,Z,Y,X){let J=Z[0]?.replace(/['"]/g,"")||"main",Q=J8();if(J!=="main")Q=Q.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${Q}</script>`}var G8;var A7=C(()=>{Q8();G8={name:"stxRouter",handler:xG,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function K8($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...fG,...Z};return`
670
670
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
671
671
  <script>
672
672
  (function() {
@@ -1049,7 +1049,7 @@ else {
1049
1049
  };
1050
1050
  })();
1051
1051
  </script>
1052
- `}function q8($,Z){let Y=K8(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function gG($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[J,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(J){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class W8{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let Y of this.sessions.values())if(Y.page===$)Z.push(...Y.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),Y=new Map;for(let X of Z)if(X.depth!==void 0)Y.set(X.depth,(Y.get(X.depth)||0)+1);return Array.from(Y.entries()).map(([X,J])=>({depth:X,count:J})).sort((X,J)=>X.depth-J.depth)}getZoneStats($){let Z=new Map,Y=this.getPageData($);for(let X of Y)if(X.zone){let J=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")J.clicks++;else if(X.type==="move")J.hovers++;Z.set(X.zone,J)}return Z}generateGridData($,Z=20){let Y=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of Y){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),K=Math.min(Math.floor(Q.y/100*Z),Z-1);X[K][G]+=Q.type==="click"?3:1}let J=0;for(let Q of X)for(let G of Q)J=Math.max(J,G);return X.map((Q,G)=>Q.map((K,q)=>({x:q,y:G,intensity:J>0?K/J:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function pO(){return new W8}var fG,U8;var N7=P(()=>{fG={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};U8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};if(Z.length>0){let Q=gG(Z.join(" "));J.heatmap={...J.heatmap,...Q,enabled:!0}}return K8(J)}}});function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function z8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function B8($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],J=$.slice(Y[0].length),Q={};for(let G of X.split(`
1052
+ `}function q8($,Z){let Y=K8(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function gG($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[J,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(J){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class W8{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let Y of this.sessions.values())if(Y.page===$)Z.push(...Y.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((X)=>X.type==="scroll"),Y=new Map;for(let X of Z)if(X.depth!==void 0)Y.set(X.depth,(Y.get(X.depth)||0)+1);return Array.from(Y.entries()).map(([X,J])=>({depth:X,count:J})).sort((X,J)=>X.depth-J.depth)}getZoneStats($){let Z=new Map,Y=this.getPageData($);for(let X of Y)if(X.zone){let J=Z.get(X.zone)||{clicks:0,hovers:0};if(X.type==="click")J.clicks++;else if(X.type==="move")J.hovers++;Z.set(X.zone,J)}return Z}generateGridData($,Z=20){let Y=this.getPageData($),X=[];for(let Q=0;Q<Z;Q++){X[Q]=[];for(let G=0;G<Z;G++)X[Q][G]=0}for(let Q of Y){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),K=Math.min(Math.floor(Q.y/100*Z),Z-1);X[K][G]+=Q.type==="click"?3:1}let J=0;for(let Q of X)for(let G of Q)J=Math.max(J,G);return X.map((Q,G)=>Q.map((K,q)=>({x:q,y:G,intensity:J>0?K/J:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function pO(){return new W8}var fG,U8;var N7=C(()=>{fG={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};U8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};if(Z.length>0){let Q=gG(Z.join(" "));J.heatmap={...J.heatmap,...Q,enabled:!0}}return K8(J)}}});function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function z8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function B8($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],J=$.slice(Y[0].length),Q={};for(let G of X.split(`
1053
1053
  `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let U=K.slice(0,q).trim(),W=K.slice(q+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}Q[U]=W}return{data:Q,content:J.trim()}}function P5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,J=$,Q=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(W,z,B)=>{let _=Q.length,j=z?` class="language-${U1(z)}"`:"";return Q.push(`<pre><code${j}>${U1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),J=J.replace(/`([^`]*)`/g,(W,z)=>`<code>${U1(z)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,z,B)=>{return`<img src="${z8(B)?U1(B):""}" alt="${U1(z)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,z,B)=>{return`<a href="${z8(B)?U1(B):""}">${z}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
1054
1054
  `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Y)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,z,B)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${U1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
1055
1055
  `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${U1(O)}</td>`).join("")}</tr>`}).join(`
@@ -1068,8 +1068,8 @@ ${H}
1068
1068
  `)}</p>`);if(J=K.join(`
1069
1069
  `),X)J=J.replace(/\n/g,`<br />
1070
1070
  `);for(let W=0;W<Q.length;W++)J=J.replace(`\x00CODEBLOCK${W}\x00`,Q[W]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}var hG={};l(hG,{processMarkdownDirectives:()=>T7,markdownDirectiveHandler:()=>M7});async function T7($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),U=q?q[1]:"",W=K+G[0].length,z=1,B=W,_=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
1071
- `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(W,_),H=$.slice(K,_+12);J.push({fullMatch:H,options:U,content:j,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:q,content:U,index:W}of J)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},_=P5(U.trim(),B);X=X.split(K).join(_)}catch(z){let B=z instanceof Error?z.message:String(z),_=Q0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,W,K);X=X.split(K).join(_)}return X}async function M7($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),P5($.trim(),J)}var I7=P(()=>{V0()});function C5($,Z=k1,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${W1($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function sO($,Z=320,Y=2560,X=0.08,J={},Q){let G=mG(Z,Y,X);return C5($,G,J,Q)}function mG($,Z,Y=0.08){let X=[],J=$;while(J<Z)X.push(Math.round(J)),J*=1+Y*2;if(X[X.length-1]!==Z)X.push(Z);return X}function D7($,Z,Y=_8,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${W1($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function rO($,Z,Y=_8,X=80,J={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return Y.sort((K,q)=>K-q).map((K)=>{let q=Math.round(Z*K),U=G[K]||Math.round(X*Math.max(0.5,1-K*0.1));return`${W1($,{...J,w:q,q:U,dpr:K,fm:Q})} ${K}x`}).join(", ")}function E7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function aO($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((J,Q)=>(J.maxWidth||0)-(Q.maxWidth||0)).filter((J)=>J.maxWidth).map((J)=>`(max-width: ${J.maxWidth}px) ${J.imageWidth}`);return X.push(Z),X.join(", ")}function W1($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function eO($){let[Z,Y]=$.split("?"),X={};if(Y)new URLSearchParams(Y).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function $L($){let{src:Z,widths:Y,dprValues:X,fixedWidth:J,formats:Q=Z5,baseUrl:G="",params:K={}}=$,q=[];for(let U of Q){let W,z;if(J!==void 0&&X)W=D7(Z,J,X,K,U),z=X.map((B)=>({path:"",url:W1(Z,{...K,w:Math.round(J*B),fm:U}),width:Math.round(J*B),height:0,format:U,size:0,dpr:B}));else{let B=Y||k1;W=C5(Z,B,K,U),z=B.map((_)=>({path:"",url:W1(Z,{...K,w:_,fm:U}),width:_,height:0,format:U,size:0}))}q.push({srcset:W,format:U,mimeType:j8[U],variants:z})}return q}function ZL($,Z="100vw"){return $.map(({srcset:Y,mimeType:X})=>`<source type="${X}" srcset="${Y}" sizes="${Z}" />`).join(`
1072
- `)}function YL($,Z){if($.length===0)return;let Y=[...$].sort((J,Q)=>J.width-Q.width),X=Y.find((J)=>J.width>=Z);if(X)return X;return Y[Y.length-1]}function XL($,Z){let Y=Z?$.filter((J)=>J.format===Z):$;if(Y.length===0){let J=$.filter((G)=>G.format==="jpeg"),Q=J.length>0?J:$;return Q[Math.floor(Q.length/2)]}let X=Y.sort((J,Q)=>J.width-Q.width);return X[Math.floor(X.length/2)]}function JL($){let Z=new Map;for(let Y of $){let X=Z.get(Y.format)||[];X.push(Y),Z.set(Y.format,X)}return Z}function k7($){return j8[$]||"application/octet-stream"}function QL($){return dG[$]||$}function GL($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var k1,_8,Z5,j8,dG,tO;var S7=P(()=>{k1=[320,480,640,768,1024,1280,1536,1920,2560],_8=[1,1.5,2,3],Z5=["avif","webp","jpeg"],j8={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},dG={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};tO={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"}});async function y7(){try{return await import("ts-images")}catch{return null}}async function H8($,Z={}){let Y={...uG,...Z},X=await y7();if(X)try{return await lG($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return O8($,Y)}async function lG($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function O8($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function qL($){let Z=await y7();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await O8($,{strategy:"thumbhash",width:32,height:32})).dataURL}function UL($){let Z=$[0]|$[1]<<8|$[2]<<16,Y=(Z&63)/63,X=(Z>>6&63)/31.5-1,J=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,K=$[3]|$[4]<<8,q=(K>>3&63)/63,U=(K>>9&63)/63,W=K>>15!==0,z=Math.max(3,W?G?5:7:G?5:7),B=Math.max(3,W?G?5:7:G?5:7),_=32,j=32,H=Math.max(0,Math.min(255,Math.round((Y+X)*255))),L=Math.max(0,Math.min(255,Math.round(Y*255))),F=Math.max(0,Math.min(255,Math.round((Y-X)*255))),O=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1071
+ `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(W,_),H=$.slice(K,_+12);J.push({fullMatch:H,options:U,content:j,index:K}),Q.lastIndex=_+12}for(let{fullMatch:K,options:q,content:U,index:W}of J)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},_=P5(U.trim(),B);X=X.split(K).join(_)}catch(z){let B=z instanceof Error?z.message:String(z),_=Q0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,W,K);X=X.split(K).join(_)}return X}async function M7($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),P5($.trim(),J)}var I7=C(()=>{V0()});function C5($,Z=k1,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${W1($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function sO($,Z=320,Y=2560,X=0.08,J={},Q){let G=mG(Z,Y,X);return C5($,G,J,Q)}function mG($,Z,Y=0.08){let X=[],J=$;while(J<Z)X.push(Math.round(J)),J*=1+Y*2;if(X[X.length-1]!==Z)X.push(Z);return X}function D7($,Z,Y=_8,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${W1($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function rO($,Z,Y=_8,X=80,J={},Q){let G={1:X,1.5:Math.round(X*0.9),2:Math.round(X*0.8),3:Math.round(X*0.7),4:Math.round(X*0.6),5:Math.round(X*0.5)};return Y.sort((K,q)=>K-q).map((K)=>{let q=Math.round(Z*K),U=G[K]||Math.round(X*Math.max(0.5,1-K*0.1));return`${W1($,{...J,w:q,q:U,dpr:K,fm:Q})} ${K}x`}).join(", ")}function E7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function aO($,Z="100vw"){if(!$||$.length===0)return Z;let X=[...$].sort((J,Q)=>(J.maxWidth||0)-(Q.maxWidth||0)).filter((J)=>J.maxWidth).map((J)=>`(max-width: ${J.maxWidth}px) ${J.imageWidth}`);return X.push(Z),X.join(", ")}function W1($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function eO($){let[Z,Y]=$.split("?"),X={};if(Y)new URLSearchParams(Y).forEach((Q,G)=>{if(/^\d+$/.test(Q))X[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))X[G]=Number.parseFloat(Q);else if(Q==="true")X[G]=!0;else if(Q==="false")X[G]=!1;else X[G]=Q});return{src:Z,params:X}}function $L($){let{src:Z,widths:Y,dprValues:X,fixedWidth:J,formats:Q=Z5,baseUrl:G="",params:K={}}=$,q=[];for(let U of Q){let W,z;if(J!==void 0&&X)W=D7(Z,J,X,K,U),z=X.map((B)=>({path:"",url:W1(Z,{...K,w:Math.round(J*B),fm:U}),width:Math.round(J*B),height:0,format:U,size:0,dpr:B}));else{let B=Y||k1;W=C5(Z,B,K,U),z=B.map((_)=>({path:"",url:W1(Z,{...K,w:_,fm:U}),width:_,height:0,format:U,size:0}))}q.push({srcset:W,format:U,mimeType:j8[U],variants:z})}return q}function ZL($,Z="100vw"){return $.map(({srcset:Y,mimeType:X})=>`<source type="${X}" srcset="${Y}" sizes="${Z}" />`).join(`
1072
+ `)}function YL($,Z){if($.length===0)return;let Y=[...$].sort((J,Q)=>J.width-Q.width),X=Y.find((J)=>J.width>=Z);if(X)return X;return Y[Y.length-1]}function XL($,Z){let Y=Z?$.filter((J)=>J.format===Z):$;if(Y.length===0){let J=$.filter((G)=>G.format==="jpeg"),Q=J.length>0?J:$;return Q[Math.floor(Q.length/2)]}let X=Y.sort((J,Q)=>J.width-Q.width);return X[Math.floor(X.length/2)]}function JL($){let Z=new Map;for(let Y of $){let X=Z.get(Y.format)||[];X.push(Y),Z.set(Y.format,X)}return Z}function k7($){return j8[$]||"application/octet-stream"}function QL($){return dG[$]||$}function GL($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var k1,_8,Z5,j8,dG,tO;var S7=C(()=>{k1=[320,480,640,768,1024,1280,1536,1920,2560],_8=[1,1.5,2,3],Z5=["avif","webp","jpeg"],j8={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},dG={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};tO={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"}});async function y7(){try{return await import("ts-images")}catch{return null}}async function H8($,Z={}){let Y={...uG,...Z},X=await y7();if(X)try{return await lG($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return O8($,Y)}async function lG($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function O8($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function qL($){let Z=await y7();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await O8($,{strategy:"thumbhash",width:32,height:32})).dataURL}function UL($){let Z=$[0]|$[1]<<8|$[2]<<16,Y=(Z&63)/63,X=(Z>>6&63)/31.5-1,J=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,K=$[3]|$[4]<<8,q=(K>>3&63)/63,U=(K>>9&63)/63,W=K>>15!==0,z=Math.max(3,W?G?5:7:G?5:7),B=Math.max(3,W?G?5:7:G?5:7),_=32,j=32,H=Math.max(0,Math.min(255,Math.round((Y+X)*255))),L=Math.max(0,Math.min(255,Math.round(Y*255))),F=Math.max(0,Math.min(255,Math.round((Y-X)*255))),O=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1073
1073
  <rect fill="rgb(${H},${L},${F})" width="32" height="32"/>
1074
1074
  </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(O)}`}async function WL($,Z=20,Y=50){return H8($,{strategy:"blur",width:Z,quality:Y,blurLevel:40})}async function zL($){let Z=await y7();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function BL($,Z=1,Y=1){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}"><rect fill="${$}" width="${Z}" height="${Y}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`}function L8($,Z,Y={}){let X=Y.transitionDuration||300,J=Y.easing||"ease-out";return`
1075
1075
  #${$} {
@@ -1088,7 +1088,7 @@ ${H}
1088
1088
  #${$}.stx-img-loaded img {
1089
1089
  opacity: 1;
1090
1090
  }
1091
- `.trim()}function _L($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}async function F8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(Y5.has(Y))return Y5.get(Y);let X=await H8($,Z);return Y5.set(Y,X),X}function jL(){Y5.clear()}function HL(){return{size:Y5.size,keys:Array.from(Y5.keys())}}var uG,b7,Y5;var V8=P(()=>{uG={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},b7=`
1091
+ `.trim()}function _L($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}async function F8($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(Y5.has(Y))return Y5.get(Y);let X=await H8($,Z);return Y5.set(Y,X),X}function jL(){Y5.clear()}function HL(){return{size:Y5.size,keys:Array.from(Y5.keys())}}var uG,b7,Y5;var V8=C(()=>{uG={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},b7=`
1092
1092
  .stx-img-placeholder {
1093
1093
  position: relative;
1094
1094
  overflow: hidden;
@@ -1117,7 +1117,7 @@ ${H}
1117
1117
  filter: blur(0);
1118
1118
  transform: scale(1);
1119
1119
  }
1120
- `.trim();Y5=new Map});import{createHash as P7}from"crypto";import{readFile as pG,stat as R8}from"fs/promises";async function T0($){try{let Z=await pG($);return P7("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function VL($){return P7("sha256").update($).digest("hex").slice(0,16)}function w8($){return P7("sha256").update($).digest("hex").slice(0,16)}function T$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${w8($)}-${w8(Y)}`}async function C7($){try{return(await R8($)).mtimeMs}catch{return 0}}async function A0($){try{return await R8($),!0}catch{return!1}}var S1=()=>{};import{mkdir as cG,readFile as N8,writeFile as iG,readdir as T8,rm as v7,stat as nG}from"fs/promises";import{join as X5,dirname as oG}from"path";async function sG($){try{await cG($,{recursive:!0})}catch{}}function M8($,Z,Y){return X5($,Y,`${Z}.json`)}async function A8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await C7(Z)!==$.srcMtime)return!1;return!0}async function M$($,Z,Y,X=J5){if(!X.enabled)return null;let J=T$($,Z),Q=a0.get(J);if(Q){if(await A8(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;a0.delete(J)}let G=M8(X.directory,J,Y);if(await A0(G))try{let K=await N8(G,"utf-8"),q=JSON.parse(K);if(await A8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),a0.set(J,q),q.data}catch{}return null}async function I$($,Z,Y,X,J=J5){if(!J.enabled)return;let Q=T$($,Z),G=await T0($),K=await C7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:T$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};a0.set(Q,q);let U=M8(J.directory,Q,X);try{await sG(oG(U)),await iG(U,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function TL($,Z,Y=J5){for(let[X,J]of a0.entries())if(J.src===$)a0.delete(X)}async function D$($,Z=J5){if($==="all")a0.clear();else a0.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=X5(Z.directory,X);try{await v7(J,{recursive:!0,force:!0})}catch{}}}async function ML($=J5){let Z={memoryEntries:a0.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=X5($.directory,Y);try{let J=await T8(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=X5(X,Q),K=await nG(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function IL($=J5){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=X5($.directory,X);try{let Q=await T8(J);for(let G of Q){let K=X5(J,G);try{let q=await N8(K,"utf-8"),U=JSON.parse(q);if(Date.now()-U.createdAt>Y)await v7(K),a0.delete(U.key),Z++}catch{await v7(K).catch(()=>{}),Z++}}}catch{}}return Z}var a0,J5;var x7=P(()=>{S1();a0=new Map,J5={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class k${config;constructor($={}){this.config={...rG,...$}}async get($,Z){return M$($,Z,"image",this.config)}async set($,Z,Y){return I$($,Z,Y,"image",this.config)}async clear(){return D$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function f7($){if(!E$)E$=new k$($);else if($)E$.updateConfig($);return E$}async function S$($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return f7(X).get($,Z)}async function b$($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return f7(J).set($,Z,Y)}async function I8(){return f7().clear()}var rG,E$=null;var g7=P(()=>{x7();rG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as aG,basename as tG,extname as eG,join as $K}from"path";import{mkdir as ZK}from"fs/promises";async function h7(){try{return await import("ts-images")}catch{return null}}function D8($){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 YK($,Z){let Y=Z?D8(Z):D8("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function E8($,Z,Y){let X=await h7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await S$($,Z,Y);if(J)return J;try{let Q=aG($);if(!await A0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=YK(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await ZK(K,{recursive:!0});let U=await T0(Q),W=tG($,eG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:U},_=null;if(Z.transformations&&Z.transformations.length>0)_=await d7(Q,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${W}-${U}.${j}`,F=$K(K,L);try{let O=await X.optimizeImage({input:_||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await b$($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function k8($,Z,Y,X){let J=await h7();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function d7($,Z,Y){let X=Y||await h7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var S8=P(()=>{S1();g7()});import{resolve as XK,basename as JK,extname as QK,join as GK}from"path";import{mkdir as KK}from"fs/promises";async function qK(){try{return await import("ts-images")}catch{return null}}async function m7($,Z,Y){let X=await qK();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=XK($);if(!await A0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||UK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await KK(K,{recursive:!0});let U=await T0(J),W=JK($,QK($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of Q){let F=`${W}-${L}w-${U}.${j}`,O=GK(K,F),V=`${q}/${F}`;try{let R=z[j]?.quality||80;if(await A0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let w=await X.processImage({input:J,output:O,format:j,quality:R,resize:{width:L}});if(w)B.byFormat[j].push({path:O,url:V,width:L,height:w.height||Math.round(L*(w.height||1)/(w.width||1)),format:j,size:w.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(J);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(J,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||WK(Q),B}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function WK($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function b8($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}async function dL($,Z,Y){let X=[];for(let J of Z){let Q=await m7(J.src,{responsiveWidths:J.widths},Y);if(Q){for(let[G,K]of Object.entries(Q.srcsets))if(K)X.push({media:J.media,srcset:K,type:zK(G)})}}return X}function zK($){switch($){case"avif":return"image/avif";case"webp":return"image/webp";case"jpeg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";default:return"image/jpeg"}}var UK;var y8=P(()=>{S1();UK=[320,480,640,768,1024,1280,1536,1920]});var P8={};l(P8,{setCachedImageResult:()=>b$,processImage:()=>E8,optimizeImage:()=>k8,getCachedImageResult:()=>S$,generateSrcset:()=>b8,generateResponsiveVariants:()=>m7,clearImageCache:()=>I8,applyTransformations:()=>d7,ImageProcessorCache:()=>k$});var C8=P(()=>{S8();y8();g7()});async function BK(){try{return await Promise.resolve().then(() => (C8(),P8))}catch($){if(!v8)console.warn("[stx-media] Image processor not available, some features disabled:",$),v8=!0;return null}}async function v5($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return LK(X,Y)}if(Y.processedResult?.processed)return c7($,Y.processedResult,Z);if(Y.responsiveVariants)return h8($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:q,widths:U=k1,dpr:W,formats:z=Z5,quality:B=u7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":P$,decoding:V=y$,fetchpriority:R,objectFit:w,objectPosition:A,crossorigin:N,referrerpolicy:M}=$,T=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:k=!1,baseUrl:S=""}=Z;if(k&&!Z.optimize)return HK($);let b,y,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await F8(J,{strategy:j,...H}),y=L8(d,b,H)}catch{}let f=W!==void 0&&G!==void 0,m;if(f)m=jK($,d,b,Z);else m=await _K($,d,b,Z);let o;if(F){let y0=z.includes("webp")?"webp":z[0],D0=C5(J,U,{..._,q:B},y0),X0=typeof q==="object"?E7(q):q||"100vw";o=`<link rel="preload" as="image" imagesrcset="${D0}" imagesizes="${X0}" />`}let N0=[];if(!x8&&j!=="none")N0.push(b7),x8=!0;if(y)N0.push(y);let $1=L?g8(d):void 0;return{html:m,preloadLink:o,css:N0.length>0?N0.join(`
1120
+ `.trim();Y5=new Map});import{createHash as P7}from"crypto";import{readFile as pG,stat as R8}from"fs/promises";async function M0($){try{let Z=await pG($);return P7("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function VL($){return P7("sha256").update($).digest("hex").slice(0,16)}function w8($){return P7("sha256").update($).digest("hex").slice(0,16)}function T$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${w8($)}-${w8(Y)}`}async function C7($){try{return(await R8($)).mtimeMs}catch{return 0}}async function A0($){try{return await R8($),!0}catch{return!1}}var S1=()=>{};import{mkdir as cG,readFile as N8,writeFile as iG,readdir as T8,rm as v7,stat as nG}from"fs/promises";import{join as X5,dirname as oG}from"path";async function sG($){try{await cG($,{recursive:!0})}catch{}}function M8($,Z,Y){return X5($,Y,`${Z}.json`)}async function A8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await C7(Z)!==$.srcMtime)return!1;return!0}async function M$($,Z,Y,X=J5){if(!X.enabled)return null;let J=T$($,Z),Q=a0.get(J);if(Q){if(await A8(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;a0.delete(J)}let G=M8(X.directory,J,Y);if(await A0(G))try{let K=await N8(G,"utf-8"),q=JSON.parse(K);if(await A8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),a0.set(J,q),q.data}catch{}return null}async function I$($,Z,Y,X,J=J5){if(!J.enabled)return;let Q=T$($,Z),G=await M0($),K=await C7($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:T$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};a0.set(Q,q);let U=M8(J.directory,Q,X);try{await sG(oG(U)),await iG(U,JSON.stringify(q,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function TL($,Z,Y=J5){for(let[X,J]of a0.entries())if(J.src===$)a0.delete(X)}async function D$($,Z=J5){if($==="all")a0.clear();else a0.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=X5(Z.directory,X);try{await v7(J,{recursive:!0,force:!0})}catch{}}}async function ML($=J5){let Z={memoryEntries:a0.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=X5($.directory,Y);try{let J=await T8(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=X5(X,Q),K=await nG(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function IL($=J5){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=X5($.directory,X);try{let Q=await T8(J);for(let G of Q){let K=X5(J,G);try{let q=await N8(K,"utf-8"),U=JSON.parse(q);if(Date.now()-U.createdAt>Y)await v7(K),a0.delete(U.key),Z++}catch{await v7(K).catch(()=>{}),Z++}}}catch{}}return Z}var a0,J5;var x7=C(()=>{S1();a0=new Map,J5={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class k${config;constructor($={}){this.config={...rG,...$}}async get($,Z){return M$($,Z,"image",this.config)}async set($,Z,Y){return I$($,Z,Y,"image",this.config)}async clear(){return D$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function f7($){if(!E$)E$=new k$($);else if($)E$.updateConfig($);return E$}async function S$($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return f7(X).get($,Z)}async function b$($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return f7(J).set($,Z,Y)}async function I8(){return f7().clear()}var rG,E$=null;var g7=C(()=>{x7();rG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as aG,basename as tG,extname as eG,join as $K}from"path";import{mkdir as ZK}from"fs/promises";async function h7(){try{return await import("ts-images")}catch{return null}}function D8($){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 YK($,Z){let Y=Z?D8(Z):D8("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function E8($,Z,Y){let X=await h7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await S$($,Z,Y);if(J)return J;try{let Q=aG($);if(!await A0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=YK(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await ZK(K,{recursive:!0});let U=await M0(Q),W=tG($,eG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:U},_=null;if(Z.transformations&&Z.transformations.length>0)_=await d7(Q,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${W}-${U}.${j}`,F=$K(K,L);try{let O=await X.optimizeImage({input:_||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await b$($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function k8($,Z,Y,X){let J=await h7();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function d7($,Z,Y){let X=Y||await h7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var S8=C(()=>{S1();g7()});import{resolve as XK,basename as JK,extname as QK,join as GK}from"path";import{mkdir as KK}from"fs/promises";async function qK(){try{return await import("ts-images")}catch{return null}}async function m7($,Z,Y){let X=await qK();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=XK($);if(!await A0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||UK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await KK(K,{recursive:!0});let U=await M0(J),W=JK($,QK($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of Q){let F=`${W}-${L}w-${U}.${j}`,O=GK(K,F),V=`${q}/${F}`;try{let R=z[j]?.quality||80;if(await A0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let w=await X.processImage({input:J,output:O,format:j,quality:R,resize:{width:L}});if(w)B.byFormat[j].push({path:O,url:V,width:L,height:w.height||Math.round(L*(w.height||1)/(w.width||1)),format:j,size:w.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(J);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(J,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||WK(Q),B}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function WK($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function b8($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}async function dL($,Z,Y){let X=[];for(let J of Z){let Q=await m7(J.src,{responsiveWidths:J.widths},Y);if(Q){for(let[G,K]of Object.entries(Q.srcsets))if(K)X.push({media:J.media,srcset:K,type:zK(G)})}}return X}function zK($){switch($){case"avif":return"image/avif";case"webp":return"image/webp";case"jpeg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";default:return"image/jpeg"}}var UK;var y8=C(()=>{S1();UK=[320,480,640,768,1024,1280,1536,1920]});var P8={};l(P8,{setCachedImageResult:()=>b$,processImage:()=>E8,optimizeImage:()=>k8,getCachedImageResult:()=>S$,generateSrcset:()=>b8,generateResponsiveVariants:()=>m7,clearImageCache:()=>I8,applyTransformations:()=>d7,ImageProcessorCache:()=>k$});var C8=C(()=>{S8();y8();g7()});async function BK(){try{return await Promise.resolve().then(() => (C8(),P8))}catch($){if(!v8)console.warn("[stx-media] Image processor not available, some features disabled:",$),v8=!0;return null}}async function v5($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return LK(X,Y)}if(Y.processedResult?.processed)return c7($,Y.processedResult,Z);if(Y.responsiveVariants)return h8($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:q,widths:U=k1,dpr:W,formats:z=Z5,quality:B=u7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":P$,decoding:V=y$,fetchpriority:R,objectFit:w,objectPosition:A,crossorigin:N,referrerpolicy:M}=$,T=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:k=!1,baseUrl:S=""}=Z;if(k&&!Z.optimize)return HK($);let b,P,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await F8(J,{strategy:j,...H}),P=L8(d,b,H)}catch{}let f=W!==void 0&&G!==void 0,m;if(f)m=jK($,d,b,Z);else m=await _K($,d,b,Z);let o;if(F){let y0=z.includes("webp")?"webp":z[0],E0=C5(J,U,{..._,q:B},y0),X0=typeof q==="object"?E7(q):q||"100vw";o=`<link rel="preload" as="image" imagesrcset="${E0}" imagesizes="${X0}" />`}let N0=[];if(!x8&&j!=="none")N0.push(b7),x8=!0;if(P)N0.push(P);let $1=L?g8(d):void 0;return{html:m,preloadLink:o,css:N0.length>0?N0.join(`
1121
1121
  `):void 0,script:$1}}async function _K($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:q,widths:U=k1,formats:W=Z5,quality:z=u7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":P$,decoding:L=y$,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:w}=$,A=$.class,N=$.style,M=$.data||{},T=typeof q==="object"?E7(q):q||"100vw",I=[];for(let k of W){let S=C5(J,U,{...B,q:z},k),b=k7(k);if(_&&!j)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${T}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${T}" />`)}let D=l7({src:W1(J,{...B,q:z}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:w,className:f8(A,Y),style:p7(N,O,V,Y),lazy:_&&!j,data:M}),E;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${k}">
1122
1122
  <picture>
1123
1123
  ${I.join(`
@@ -1167,7 +1167,7 @@ ${I.join(`
1167
1167
 
1168
1168
  observer.observe(container);
1169
1169
  })();
1170
- `.trim()}function OK($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let Y=Z[1],X={},J=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=J.exec(Y))!==null){let[,G,K,q,U,W]=Q,z=q??U??W??!0;if(G===":"&&typeof z==="string")try{X[K]=JSON.parse(z)}catch{X[K]=z}else switch(K){case"src":X.src=String(z);break;case"alt":X.alt=String(z);break;case"width":X.width=Number(z)||z;break;case"height":X.height=Number(z)||z;break;case"sizes":X.sizes=String(z);break;case"quality":X.quality=Number(z);break;case"placeholder":X.placeholder=z;break;case"lazy":X.lazy=z===!0||z==="true";break;case"priority":X.priority=z===!0||z==="true";break;case"class":X.class=String(z);break;case"style":X.style=String(z);break;case"id":X.id=String(z);break;case"loading":X.loading=z;break;case"decoding":X.decoding=z;break;case"fetchpriority":X.fetchpriority=z;break;case"objectFit":X.objectFit=z;break;case"objectPosition":X.objectPosition=String(z);break;case"crossorigin":X.crossorigin=z;break}}if(!X.src||!X.alt)return null;return X}async function nL($,Z={}){let Y=/<Img\s+[^>]*?\/?>/g,X=[],J=[],Q=[],G=$,K=[],q;while((q=Y.exec($))!==null)K.push({match:q[0],index:q.index});for(let U=K.length-1;U>=0;U--){let{match:W}=K[U],z=OK(W);if(z){let B=await v5(z,Z);if(G=G.replace(W,B.html),B.preloadLink)X.push(B.preloadLink);if(B.css)J.push(B.css);if(B.script)Q.push(B.script)}}return{html:G,preloadLinks:X,styles:J,scripts:Q}}async function LK($,Z){let Y=await BK();if(!Y)return v5({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return h8($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return c7($,Q,Z)}return v5({...$,process:!1},Z)}async function c7($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:U,crossorigin:W,referrerpolicy:z}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((y)=>y.format===(F?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),R=new Map;for(let y of L){if(!R.has(y.format))R.set(y.format,[]);R.get(y.format).push(y)}let w=[],A=["avif","webp","jpeg","png"];for(let y of A){let d=R.get(y);if(d&&d.length>0){let f=d.map((o)=>`${o.url} ${o.width}w`).join(", "),m=k7(y);if(G&&!K)w.push(` <source type="${m}" data-srcset="${f}" />`);else w.push(` <source type="${m}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${m0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${m0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${m0(X)}"`);let M=J||Z.originalWidth,T=Q||Z.originalHeight;if(M)N.push(`width="${M}"`);if(T)N.push(`height="${T}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(W)N.push(`crossorigin="${W}"`);if(z)N.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(U)I.push(`object-position: ${U}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let D=[];if(B)D.push(B);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)N.push(`class="${D.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[y,d]of Object.entries(H))N.push(`data-${y}="${m0(d)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${y}">
1170
+ `.trim()}function OK($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let Y=Z[1],X={},J=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=J.exec(Y))!==null){let[,G,K,q,U,W]=Q,z=q??U??W??!0;if(G===":"&&typeof z==="string")try{X[K]=JSON.parse(z)}catch{X[K]=z}else switch(K){case"src":X.src=String(z);break;case"alt":X.alt=String(z);break;case"width":X.width=Number(z)||z;break;case"height":X.height=Number(z)||z;break;case"sizes":X.sizes=String(z);break;case"quality":X.quality=Number(z);break;case"placeholder":X.placeholder=z;break;case"lazy":X.lazy=z===!0||z==="true";break;case"priority":X.priority=z===!0||z==="true";break;case"class":X.class=String(z);break;case"style":X.style=String(z);break;case"id":X.id=String(z);break;case"loading":X.loading=z;break;case"decoding":X.decoding=z;break;case"fetchpriority":X.fetchpriority=z;break;case"objectFit":X.objectFit=z;break;case"objectPosition":X.objectPosition=String(z);break;case"crossorigin":X.crossorigin=z;break}}if(!X.src||!X.alt)return null;return X}async function nL($,Z={}){let Y=/<Img\s+[^>]*?\/?>/g,X=[],J=[],Q=[],G=$,K=[],q;while((q=Y.exec($))!==null)K.push({match:q[0],index:q.index});for(let U=K.length-1;U>=0;U--){let{match:W}=K[U],z=OK(W);if(z){let B=await v5(z,Z);if(G=G.replace(W,B.html),B.preloadLink)X.push(B.preloadLink);if(B.css)J.push(B.css);if(B.script)Q.push(B.script)}}return{html:G,preloadLinks:X,styles:J,scripts:Q}}async function LK($,Z){let Y=await BK();if(!Y)return v5({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return h8($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return c7($,Q,Z)}return v5({...$,process:!1},Z)}async function c7($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:U,crossorigin:W,referrerpolicy:z}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((P)=>P.format==="jpeg")||L.find((P)=>P.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),R=new Map;for(let P of L){if(!R.has(P.format))R.set(P.format,[]);R.get(P.format).push(P)}let w=[],A=["avif","webp","jpeg","png"];for(let P of A){let d=R.get(P);if(d&&d.length>0){let f=d.map((o)=>`${o.url} ${o.width}w`).join(", "),m=k7(P);if(G&&!K)w.push(` <source type="${m}" data-srcset="${f}" />`);else w.push(` <source type="${m}" srcset="${f}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${m0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${m0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${m0(X)}"`);let M=J||Z.originalWidth,T=Q||Z.originalHeight;if(M)N.push(`width="${M}"`);if(T)N.push(`height="${T}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(W)N.push(`crossorigin="${W}"`);if(z)N.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(U)I.push(`object-position: ${U}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let D=[];if(B)D.push(B);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)N.push(`class="${D.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[P,d]of Object.entries(H))N.push(`data-${P}="${m0(d)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let P=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${P}">
1171
1171
  <picture>
1172
1172
  ${w.join(`
1173
1173
  `)}
@@ -1178,11 +1178,11 @@ ${w.join(`
1178
1178
  `)}
1179
1179
  <img ${N.join(" ")} />
1180
1180
  </picture>`;let k=[];if(Z.placeholder)k.push(b7);let S=G?g8(j):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:b,css:k.length>0?k.join(`
1181
- `):void 0,script:S}}async function h8($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[J,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return c7($,X,Y)}var v8=!1,u7=80,y$="async",P$="lazy",x8=!1;var d8=P(()=>{S7();V8()});function FK(){return _0({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:J,alt:Q,options:G}=VK($,Z,Y);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:J,alt:Q||"",widths:G.widths||k1,formats:G.formats||Z5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,U=await v5(K,{isDev:q}),W=U.html;if(U.preloadLink)W=U.preloadLink+`
1181
+ `):void 0,script:S}}async function h8($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[J,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return c7($,X,Y)}var v8=!1,u7=80,y$="async",P$="lazy",x8=!1;var d8=C(()=>{S7();V8()});function FK(){return _0({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:J,alt:Q,options:G}=VK($,Z,Y);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:J,alt:Q||"",widths:G.widths||k1,formats:G.formats||Z5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,U=await v5(K,{isDev:q}),W=U.html;if(U.preloadLink)W=U.preloadLink+`
1182
1182
  `+W;if(U.css)W+=`
1183
1183
  <style>${U.css}</style>`;if(U.script)W+=`
1184
- <script>${U.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function VK($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=wK(X),Q=i7(J[0],Y)||"",G=i7(J[1],Y)||"",K={};if(J[2]){let q=i7(J[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof J[2]==="string")try{K=JSON.parse(J[2])}catch{}}return{src:Q,alt:G,options:K}}function wK($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function i7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var m8;var u8=P(()=>{F7();d8();S7();m8=FK()});class v${config;constructor($={}){this.config={...RK,...$}}async get($,Z){return M$($,Z,"video",this.config)}async set($,Z,Y){return I$($,Z,Y,"video",this.config)}async clear(){return D$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function n7($){if(!C$)C$=new v$($);else if($)C$.updateConfig($);return C$}async function x$($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n7(X).get($,Z)}async function f$($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return n7(J).set($,Z,Y)}async function l8(){return n7().clear()}var RK,C$=null;var o7=P(()=>{x7();RK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as s7,basename as r7,extname as a7,join as g$}from"path";import{mkdir as t7}from"fs/promises";async function e7(){try{return await import("ts-videos")}catch{return null}}async function h$($,Z,Y,X){let J=await e7();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=s7($);if(!await A0(Q))return null;await t7(Y,{recursive:!0});let G=await T0(Q),K=r7($,a7($)),q=Z.format||"webp",U=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,z=g$(Y,W),B=await J.extractThumbnails(Q,{timestamps:[U],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:W.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:z,url:`${X}/${W}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:U,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function d$($,Z,Y,X){let J=await e7();if(!J)return[];try{let Q=s7($);if(!await A0(Q))return[];await t7(Y,{recursive:!0});let G=await T0(Q),K=r7($,a7($)),q=Z.format||"webp",z=(await new J.Input(Q).getInfo()).duration||60,B=Z.count||10,_=Z.interval||z/B,j=[];for(let L=0;L<B&&L*_<z;L++)j.push(L*_);let H=await J.extractThumbnails(Q,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||g$(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function p8($,Z,Y,X){let J=await e7();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=s7($);if(!await A0(Q))return null;await t7(Y,{recursive:!0});let G=await T0(Q),K=r7($,a7($)),W=(await new J.Input(Q).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(W/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=g$(Y,O),R=[];for(let A=0;A<L;A++)R.push(A*B);let w=await J.extractThumbnails(Q,{timestamps:R,width:_,height:j,format:H,quality:Z.quality||70,outputDir:g$(Y,".temp")});if(!w||w.length===0)return null;try{let A=await import("ts-images"),N=z*_,M=F*j,T=await A.createSprite({images:w.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var $3=P(()=>{S1()});import{resolve as i8,basename as n8,extname as o8,join as b1}from"path";import{mkdir as m$,writeFile as s8}from"fs/promises";async function r8(){try{return await import("ts-videos")}catch{return null}}async function u$($,Z,Y,X,J){let Q=await r8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=i8($);if(!await A0(G))return null;let K=await T0(G),q=n8($,o8($)),U=b1(Y,`${q}-${K}-hls`);await m$(U,{recursive:!0});let W=Z.length>0?Z:a8,z=J?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of W){let R=b1(U,V.label);await m$(R,{recursive:!0});let w=`${V.label}.m3u8`,A=b1(R,w);try{let N=await Q.generateHLS(G,{outputDir:R,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${w}`,path:A}),L+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=b1(U,"master.m3u8"),O=AK(H,X,q,K);return await s8(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function AK($,Z,Y,X){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return J.join(`
1185
- `)}async function l$($,Z,Y,X,J){let Q=await r8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=i8($);if(!await A0(G))return null;let K=await T0(G),q=n8($,o8($)),U=b1(Y,`${q}-${K}-dash`);await m$(U,{recursive:!0});let W=Z.length>0?Z:a8,z=J?.segmentDuration||4,B=J?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],F=[];for(let w of W){let A=b1(U,w.label);await m$(A,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:A,segmentDuration:z,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(L.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${X}/${q}-${K}-dash/${w.label}/video`}),w.audioBitrate)F.push({bandwidth:w.audioBitrate,url:`${X}/${q}-${K}-dash/${w.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${N}`)}}if(L.length===0)return null;let O=b1(U,"manifest.mpd"),V=NK(L,F,H,z,B);await s8(O,V);let R=[{type:"video",representations:L}];if(F.length>0)R.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:R,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function NK($,Z,Y,X,J){let Q=c8(Y),G=c8(J),K=`<?xml version="1.0" encoding="UTF-8"?>
1184
+ <script>${U.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function VK($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=wK(X),Q=i7(J[0],Y)||"",G=i7(J[1],Y)||"",K={};if(J[2]){let q=i7(J[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof J[2]==="string")try{K=JSON.parse(J[2])}catch{}}return{src:Q,alt:G,options:K}}function wK($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function i7($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var m8;var u8=C(()=>{F7();d8();S7();m8=FK()});class v${config;constructor($={}){this.config={...RK,...$}}async get($,Z){return M$($,Z,"video",this.config)}async set($,Z,Y){return I$($,Z,Y,"video",this.config)}async clear(){return D$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function n7($){if(!C$)C$=new v$($);else if($)C$.updateConfig($);return C$}async function x$($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n7(X).get($,Z)}async function f$($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return n7(J).set($,Z,Y)}async function l8(){return n7().clear()}var RK,C$=null;var o7=C(()=>{x7();RK={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as s7,basename as r7,extname as a7,join as g$}from"path";import{mkdir as t7}from"fs/promises";async function e7(){try{return await import("ts-videos")}catch{return null}}async function h$($,Z,Y,X){let J=await e7();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=s7($);if(!await A0(Q))return null;await t7(Y,{recursive:!0});let G=await M0(Q),K=r7($,a7($)),q=Z.format||"webp",U=Z.timestamp||0,W=`${K}-poster-${G}.${q}`,z=g$(Y,W),B=await J.extractThumbnails(Q,{timestamps:[U],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:W.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:z,url:`${X}/${W}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:U,size:_.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function d$($,Z,Y,X){let J=await e7();if(!J)return[];try{let Q=s7($);if(!await A0(Q))return[];await t7(Y,{recursive:!0});let G=await M0(Q),K=r7($,a7($)),q=Z.format||"webp",z=(await new J.Input(Q).getInfo()).duration||60,B=Z.count||10,_=Z.interval||z/B,j=[];for(let L=0;L<B&&L*_<z;L++)j.push(L*_);let H=await J.extractThumbnails(Q,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||g$(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function p8($,Z,Y,X){let J=await e7();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=s7($);if(!await A0(Q))return null;await t7(Y,{recursive:!0});let G=await M0(Q),K=r7($,a7($)),W=(await new J.Input(Q).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(W/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=g$(Y,O),R=[];for(let A=0;A<L;A++)R.push(A*B);let w=await J.extractThumbnails(Q,{timestamps:R,width:_,height:j,format:H,quality:Z.quality||70,outputDir:g$(Y,".temp")});if(!w||w.length===0)return null;try{let A=await import("ts-images"),N=z*_,M=F*j,T=await A.createSprite({images:w.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var $3=C(()=>{S1()});import{resolve as i8,basename as n8,extname as o8,join as b1}from"path";import{mkdir as m$,writeFile as s8}from"fs/promises";async function r8(){try{return await import("ts-videos")}catch{return null}}async function u$($,Z,Y,X,J){let Q=await r8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=i8($);if(!await A0(G))return null;let K=await M0(G),q=n8($,o8($)),U=b1(Y,`${q}-${K}-hls`);await m$(U,{recursive:!0});let W=Z.length>0?Z:a8,z=J?.segmentDuration||6,j=(await new Q.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of W){let R=b1(U,V.label);await m$(R,{recursive:!0});let w=`${V.label}.m3u8`,A=b1(R,w);try{let N=await Q.generateHLS(G,{outputDir:R,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${w}`,path:A}),L+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=b1(U,"master.m3u8"),O=AK(H,X,q,K);return await s8(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function AK($,Z,Y,X){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return J.join(`
1185
+ `)}async function l$($,Z,Y,X,J){let Q=await r8();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=i8($);if(!await A0(G))return null;let K=await M0(G),q=n8($,o8($)),U=b1(Y,`${q}-${K}-dash`);await m$(U,{recursive:!0});let W=Z.length>0?Z:a8,z=J?.segmentDuration||4,B=J?.minBufferTime||2,H=(await new Q.Input(G).getInfo()).duration||0,L=[],F=[];for(let w of W){let A=b1(U,w.label);await m$(A,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:A,segmentDuration:z,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(L.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${X}/${q}-${K}-dash/${w.label}/video`}),w.audioBitrate)F.push({bandwidth:w.audioBitrate,url:`${X}/${q}-${K}-dash/${w.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${N}`)}}if(L.length===0)return null;let O=b1(U,"manifest.mpd"),V=NK(L,F,H,z,B);await s8(O,V);let R=[{type:"video",representations:L}];if(F.length>0)R.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:R,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function NK($,Z,Y,X,J){let Q=c8(Y),G=c8(J),K=`<?xml version="1.0" encoding="UTF-8"?>
1186
1186
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
1187
1187
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1188
1188
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -1208,7 +1208,7 @@ ${w.join(`
1208
1208
  </Representation>
1209
1209
  `}K+=` </AdaptationSet>
1210
1210
  `}return K+=` </Period>
1211
- </MPD>`,K}function c8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),J="PT";if(Z>0)J+=`${Z}H`;if(Y>0)J+=`${Y}M`;return J+=`${X}S`,J}var a8;var Z3=P(()=>{S1();a8=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as t8,basename as TK,extname as MK,join as IK}from"path";import{mkdir as DK}from"fs/promises";async function e8(){try{return await import("ts-videos")}catch{return null}}function EK($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function kK($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Y3($){let Z=await e8();if(!Z)return null;try{let Y=t8($),J=await new Z.Input(Y).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function $Z($,Z,Y,X){let J=await e8();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await x$($,Z,Y);if(Q)return Q;try{let G=t8($);if(!await A0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await DK(K,{recursive:!0});let U=await T0(G),W=TK($,MK($)),z={src:$,processed:!0,hash:U};X?.({percentage:5,stage:"analyzing"}),z.metadata=await Y3(G)||void 0;let B={};if(Z.quality)B.bitrate=EK(Z.quality);if(Z.platform)Object.assign(B,kK(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${W}-${U}.mp4`,j=IK(K,_);try{let H=await SK(G,j,B,J,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await h$(G,_,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await d$(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await u$(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(_.format==="dash"){let j=await l$(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await f$($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function SK($,Z,Y,X,J){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{J?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var ZZ=P(()=>{S1();o7();$3();Z3()});var YZ={};l(YZ,{setCachedVideoResult:()=>f$,processVideo:()=>$Z,getCachedVideoResult:()=>x$,generateThumbnails:()=>d$,generateSpriteSheet:()=>p8,generatePoster:()=>h$,generateHLSManifest:()=>u$,generateDASHManifest:()=>l$,clearVideoCache:()=>l8,analyzeVideo:()=>Y3,VideoProcessorCache:()=>v$});var XZ=P(()=>{ZZ();$3();Z3();o7()});async function QZ(){try{return await Promise.resolve().then(() => (XZ(),YZ))}catch($){if(!JZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),JZ=!0;return null}}async function p$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return xK(X,Y)}if(Y.processedResult?.processed)return UZ($,Y.processedResult,Z);let J;if(X.generatePoster&&X.src&&!$.poster)J=await fK(X,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:U=GZ,autoplay:W=!1,muted:z=!1,loop:B=!1,preload:_=KZ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:R,disablePictureInPicture:w=!1,disableRemotePlayback:A=!1}=$,N=J||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return PK($,Z);if(F&&F!=="video")return yK(Q||"",F,$);let D=G.length>0?G:Q?[{src:Q,type:qZ(Q)}]:[],E=[`id="${I}"`];if(U)E.push("controls");if(W)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(j)E.push("playsinline");if(w)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(R)E.push(`crossorigin="${R}"`);if(H){if(E.push(`data-preload="${_}"`),E.push('preload="none"'),N)E.push(`data-poster="${H0(N)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${_}"`),N)E.push(`poster="${H0(N)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(M)E.push(`class="${H0(M)}"`);if(T)E.push(`style="${H0(T)}"`);let k=D.map((y)=>{return` <source ${H?`data-src="${H0(y.src)}"`:`src="${H0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
1211
+ </MPD>`,K}function c8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),J="PT";if(Z>0)J+=`${Z}H`;if(Y>0)J+=`${Y}M`;return J+=`${X}S`,J}var a8;var Z3=C(()=>{S1();a8=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as t8,basename as TK,extname as MK,join as IK}from"path";import{mkdir as DK}from"fs/promises";async function e8(){try{return await import("ts-videos")}catch{return null}}function EK($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function kK($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Y3($){let Z=await e8();if(!Z)return null;try{let Y=t8($),J=await new Z.Input(Y).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function $Z($,Z,Y,X){let J=await e8();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await x$($,Z,Y);if(Q)return Q;try{let G=t8($);if(!await A0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await DK(K,{recursive:!0});let U=await M0(G),W=TK($,MK($)),z={src:$,processed:!0,hash:U};X?.({percentage:5,stage:"analyzing"}),z.metadata=await Y3(G)||void 0;let B={};if(Z.quality)B.bitrate=EK(Z.quality);if(Z.platform)Object.assign(B,kK(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${W}-${U}.mp4`,j=IK(K,_);try{let H=await SK(G,j,B,J,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await h$(G,_,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await d$(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await u$(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(_.format==="dash"){let j=await l$(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await f$($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function SK($,Z,Y,X,J){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{J?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var ZZ=C(()=>{S1();o7();$3();Z3()});var YZ={};l(YZ,{setCachedVideoResult:()=>f$,processVideo:()=>$Z,getCachedVideoResult:()=>x$,generateThumbnails:()=>d$,generateSpriteSheet:()=>p8,generatePoster:()=>h$,generateHLSManifest:()=>u$,generateDASHManifest:()=>l$,clearVideoCache:()=>l8,analyzeVideo:()=>Y3,VideoProcessorCache:()=>v$});var XZ=C(()=>{ZZ();$3();Z3();o7()});async function QZ(){try{return await Promise.resolve().then(() => (XZ(),YZ))}catch($){if(!JZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),JZ=!0;return null}}async function p$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return xK(X,Y)}if(Y.processedResult?.processed)return UZ($,Y.processedResult,Z);let J;if(X.generatePoster&&X.src&&!$.poster)J=await fK(X,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:U=GZ,autoplay:W=!1,muted:z=!1,loop:B=!1,preload:_=KZ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:R,disablePictureInPicture:w=!1,disableRemotePlayback:A=!1}=$,N=J||K,M=$.class,T=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return PK($,Z);if(F&&F!=="video")return yK(Q||"",F,$);let D=G.length>0?G:Q?[{src:Q,type:qZ(Q)}]:[],E=[`id="${I}"`];if(U)E.push("controls");if(W)E.push("autoplay");if(z)E.push("muted");if(B)E.push("loop");if(j)E.push("playsinline");if(w)E.push("disablepictureinpicture");if(A)E.push("disableremoteplayback");if(R)E.push(`crossorigin="${R}"`);if(H){if(E.push(`data-preload="${_}"`),E.push('preload="none"'),N)E.push(`data-poster="${H0(N)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${_}"`),N)E.push(`poster="${H0(N)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(M)E.push(`class="${H0(M)}"`);if(T)E.push(`style="${H0(T)}"`);let k=D.map((P)=>{return` <source ${H?`data-src="${H0(P.src)}"`:`src="${H0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
1212
1212
  `),S=`<video ${E.join(" ")}>
1213
1213
  ${k}
1214
1214
  Your browser does not support the video tag.
@@ -1465,9 +1465,9 @@ ${D}
1465
1465
  width: 100%;
1466
1466
  height: auto;
1467
1467
  }
1468
- `.trim();return{html:D,script:E,css:k}}var JZ=!1,GZ=!0,KZ="metadata",bK="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var WZ=P(()=>{J3()});function zZ(){return _0({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:J,options:Q}=gK($,Z,Y);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:J,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},U=await p$(G,q),W=U.html;if(U.css)W+=`
1468
+ `.trim();return{html:D,script:E,css:k}}var JZ=!1,GZ=!0,KZ="metadata",bK="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var WZ=C(()=>{J3()});function zZ(){return _0({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:J,options:Q}=gK($,Z,Y);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:J,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},U=await p$(G,q),W=U.html;if(U.css)W+=`
1469
1469
  <style>${U.css}</style>`;if(U.script)W+=`
1470
- <script>${U.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function gK($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=hK(X),Q=BZ(J[0],Y)||"",G={};if(J[1]){let K=BZ(J[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof J[1]==="string")try{G=JSON.parse(J[1])}catch{}}return{src:Q,options:G}}function hK($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function BZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var X3;var J3=P(()=>{F7();WZ();X3=zZ()});function dK($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1470
+ <script>${U.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function gK($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=hK(X),Q=BZ(J[0],Y)||"",G={};if(J[1]){let K=BZ(J[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof J[1]==="string")try{G=JSON.parse(J[1])}catch{}}return{src:Q,options:G}}function hK($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],U=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&U!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function BZ($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var X3;var J3=C(()=>{F7();WZ();X3=zZ()});function dK($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1471
1471
  ${$}
1472
1472
  </div>
1473
1473
  <script>
@@ -1766,8 +1766,8 @@ catch (error) {
1766
1766
  init();
1767
1767
  }
1768
1768
  })();
1769
- </script>`}function IF($){return[...$,...c$]}var pK,cK,iK,nK,c$;var Q3=P(()=>{pK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return dK($,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},cK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return mK($,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},iK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return uK($,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},nK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return lK($,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},c$=[pK,cK,iK,nK]});function sK($){_Z=$}function rK(){return _Z}function aK($){i$={...i$,...$}}function tK(){i$={}}function jZ($,Z={}){let Y=i$[$]||oK[$]||{message:`Unknown error (code: ${$})`},X=Y.message,J=Y.help;for(let[Q,G]of Object.entries(Z)){let K=`{{${Q}}}`;if(X=X.replace(new RegExp(K,"g"),G),J)J=J.replace(new RegExp(K,"g"),G)}return{message:X,help:J}}function eK($,Z={}){let{message:Y,help:X}=jZ($,Z);return X?`${Y}
1770
- Help: ${X}`:Y}function G3($){for(let[Z,Y]of Object.entries(p))if(Y===$)return Z;return}var oK,i$,_Z="en",p;var n$=P(()=>{oK={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},i$={};p={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function x5(){return!1}function f5(){return!x5()||process.env.STX_DEBUG==="true"}function o$(){return!1}import $q from"path";function Zq($){Q5={...Q5,...$}}function s$(){return{...Q5}}function Yq(){Q5={...HZ}}function r$($){if(!Q5.showRelativePaths||!$)return $;let Z=Q5.baseDir||process.cwd();try{let Y=$q.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var HZ,Q5,y1,OZ,P1,LZ,FZ,a$;var t$=P(()=>{n$();HZ={showRelativePaths:!1,enableAutoRecovery:f5(),logRecoveryWarnings:!0},Q5={...HZ};y1=class y1 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,J,Q,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||p.EVALUATION_ERROR,this.filePath)this.filePath=r$(this.filePath)}};OZ=class OZ extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_SYNTAX_ERROR",Z,Y,X,J,Q||p.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}};P1=class P1 extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_RUNTIME_ERROR",Z,Y,X,J,Q||p.EVALUATION_ERROR);this.name="StxRuntimeError"}};LZ=class LZ extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_SECURITY_ERROR",Z,Y,X,J,Q||p.UNSAFE_EXPRESSION);this.name="StxSecurityError"}};FZ=class FZ extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_FILE_ERROR",Z,Y,X,J,Q||p.FILE_NOT_FOUND);this.name="StxFileError"}};a$=class a$ extends y1{isFatal=!0;constructor($,Z,Y,X,J,Q){super($,"stx_VALIDATION_ERROR",Z,Y,X,J,Q||p.DOM_API_VIOLATION);this.name="StxValidationError"}}});function K3($){let{type:Z,message:Y,code:X,filePath:J,line:Q,column:G,template:K,offset:q,snippet:U,suggestion:W,format:z="text"}=$,B=Q,_=G;if(!B&&K&&q!==void 0){let O=wZ(K,q);B=O.line,_=O.column}let j=J?r$(J):void 0,H=X?G3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:U,suggestion:W,timestamp:new Date().toISOString()},F;switch(z){case"html":F=Jq(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=Qq(L,K,q);break;case"text":default:F=Xq(L,K,q);break}return{formatted:F,data:L}}function Xq($,Z,Y){let X=[],J=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}X.push(`at ${Q}`)}if(X.push(`
1769
+ </script>`}function IF($){return[...$,...c$]}var pK,cK,iK,nK,c$;var Q3=C(()=>{pK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return dK($,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},cK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return mK($,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},iK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return uK($,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},nK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return lK($,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},c$=[pK,cK,iK,nK]});function sK($){_Z=$}function rK(){return _Z}function aK($){i$={...i$,...$}}function tK(){i$={}}function jZ($,Z={}){let Y=i$[$]||oK[$]||{message:`Unknown error (code: ${$})`},X=Y.message,J=Y.help;for(let[Q,G]of Object.entries(Z)){let K=`{{${Q}}}`;if(X=X.replace(new RegExp(K,"g"),G),J)J=J.replace(new RegExp(K,"g"),G)}return{message:X,help:J}}function eK($,Z={}){let{message:Y,help:X}=jZ($,Z);return X?`${Y}
1770
+ Help: ${X}`:Y}function G3($){for(let[Z,Y]of Object.entries(p))if(Y===$)return Z;return}var oK,i$,_Z="en",p;var n$=C(()=>{oK={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},i$={};p={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function x5(){return!1}function f5(){return!x5()||process.env.STX_DEBUG==="true"}function o$(){return!1}import $q from"path";function Zq($){Q5={...Q5,...$}}function s$(){return{...Q5}}function Yq(){Q5={...HZ}}function r$($){if(!Q5.showRelativePaths||!$)return $;let Z=Q5.baseDir||process.cwd();try{let Y=$q.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var HZ,Q5,y1,OZ,P1,LZ,FZ,a$;var t$=C(()=>{n$();HZ={showRelativePaths:!1,enableAutoRecovery:f5(),logRecoveryWarnings:!0},Q5={...HZ};y1=class y1 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,J,Q,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||p.EVALUATION_ERROR,this.filePath)this.filePath=r$(this.filePath)}};OZ=class OZ extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_SYNTAX_ERROR",Z,Y,X,J,Q||p.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}};P1=class P1 extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_RUNTIME_ERROR",Z,Y,X,J,Q||p.EVALUATION_ERROR);this.name="StxRuntimeError"}};LZ=class LZ extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_SECURITY_ERROR",Z,Y,X,J,Q||p.UNSAFE_EXPRESSION);this.name="StxSecurityError"}};FZ=class FZ extends y1{constructor($,Z,Y,X,J,Q){super($,"stx_FILE_ERROR",Z,Y,X,J,Q||p.FILE_NOT_FOUND);this.name="StxFileError"}};a$=class a$ extends y1{isFatal=!0;constructor($,Z,Y,X,J,Q){super($,"stx_VALIDATION_ERROR",Z,Y,X,J,Q||p.DOM_API_VIOLATION);this.name="StxValidationError"}}});function K3($){let{type:Z,message:Y,code:X,filePath:J,line:Q,column:G,template:K,offset:q,snippet:U,suggestion:W,format:z="text"}=$,B=Q,_=G;if(!B&&K&&q!==void 0){let O=wZ(K,q);B=O.line,_=O.column}let j=J?r$(J):void 0,H=X?G3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:U,suggestion:W,timestamp:new Date().toISOString()},F;switch(z){case"html":F=Jq(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=Qq(L,K,q);break;case"text":default:F=Xq(L,K,q);break}return{formatted:F,data:L}}function Xq($,Z,Y){let X=[],J=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}X.push(`at ${Q}`)}if(X.push(`
1771
1771
  ${$.message}`),Z&&$.line){let Q=Gq(Z,$.line,2);if(Q)X.push(`
1772
1772
  ${Q}`)}if($.snippet)X.push(`
1773
1773
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
@@ -1791,15 +1791,15 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
1791
1791
  `,G=Math.max(0,J.line-3),K=Math.min(X.length-1,J.line+2);Q+=`Context:
1792
1792
  `;for(let q=G;q<=K;q++){let U=q+1,W=X[q]||"",z=q===J.line-1?">":" ";Q+=`${z} ${U.toString().padStart(3)}: ${W}
1793
1793
  `}if(J.line-1<X.length){let q=" ".repeat(J.column+5);Q+=`${q}^
1794
- `}return Q}function Wq($,Z,Y){try{return $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}async function G5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var RZ=P(()=>{n$();t$()});class U3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1794
+ `}return Q}function Wq($,Z,Y){try{return $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}async function G5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var RZ=C(()=>{n$();t$()});class U3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1795
1795
  `).slice(1).join(`
1796
1796
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1797
1797
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(X))Z.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Z);let J=`${this.formatEntry($)}
1798
1798
  `;Z.appendFileSync(this.logFilePath,J,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,J=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,J)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let J=Y.level||"error";Z[J]=(Z[J]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),J=(await import("path")).dirname($);if(!Y.existsSync(J))Y.mkdirSync(J,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
1799
1799
 
1800
- `),"utf-8")}}async flush(){await this.writeQueue}}var q3,u0,W3;var AZ=P(()=>{t$();q3={isEnabled(){return s$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=s$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],J=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(J>Q){let K=J-Q;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,U=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>U){let W=q-U;for(let z=0;z<W;z++)Y+=`
1800
+ `),"utf-8")}}async flush(){await this.writeQueue}}var q3,u0,W3;var AZ=C(()=>{t$();q3={isEnabled(){return s$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=s$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],J=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(J>Q){let K=J-Q;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,U=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>U){let W=q-U;for(let z=0;z<W;z++)Y+=`
1801
1801
  @end${K}`;X.push(`Added ${W} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(f5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};u0=new U3,W3={isDevelopment(){return f5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1802
- `)}}});import z3 from"path";function zq($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(Y)=>Z[Y]||Y)}function e$($,Z={}){let{allowHtml:Y=!1,maxLength:X=1e4,allowSpecialChars:J=!0,customSanitizer:Q}=Z,G=[],K=$,q=!1;if(Q){let W=Q(K);if(W!==K)K=W,q=!0}if(K.includes("\x00"))K=K.replace(/\0/g,""),q=!0,G.push("Null bytes removed from parameter");if(K.length>X)K=K.substring(0,X),q=!0,G.push(`Parameter truncated to ${X} characters`);if(!Y&&/<[^>]+>/.test(K))K=zq(K),q=!0,G.push("HTML content was escaped");let U=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:W,replacement:z,name:B}of U)if(W.test(K))K=K.replace(W,z),q=!0,G.push(`Removed ${B} from parameter`);if(!J){let W=K;if(K=K.split("").filter((z)=>{let B=z.charCodeAt(0);return B>=32&&B!==127}).join(""),K!==W)q=!0,G.push("Control characters removed")}return{value:K,modified:q,warnings:G}}function Bq($,Z){let Y=$.replace(/\0/g,"");Y=Y.replace(/\\/g,"/"),Y=Y.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(Y.includes("../")||Y.includes("./"))Y=Y.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!B3.isValidFilePath(Y,Z))return null;return Y}function _q($){let Z=[],Y=$.trim(),X=Y!==$,J=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of J)if(Q.test(Y))Z.push(`Potentially dangerous pattern detected: ${G}`);if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),X=!0,Z.push("Null bytes removed from expression");return{value:Y,modified:X,warnings:Z}}function jq($,Z={}){return $.map((Y)=>e$(Y,Z))}function NZ($){let Z={};for(let[Y,X]of Object.entries($)){if(!B3.isValidVariableName(Y))continue;if(typeof X==="string"){let J=e$(X);Z[Y]=J.value}else if(Array.isArray(X))Z[Y]=X.map((J)=>typeof J==="string"?e$(J).value:J);else if(typeof X==="object"&&X!==null)Z[Y]=NZ(X);else Z[Y]=X}return Z}var B3;var TZ=P(()=>{B3={isValidFilePath($,Z){let Y=$.replace(/\\/g,"/");if(Y.includes("\x00"))return!1;if(Y.includes("../")||Y.includes("..\\")||Y===".."||Y.startsWith("../")||Y.endsWith("/..")||Y.includes("/..\\")||Y.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(Y))return!1;if(Y.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>Y===Q.slice(0,-1)||Y.startsWith(Q)))return!1}if(/^[a-z]:/i.test(Y)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>Y.includes(Q)))return!1}if(Z){let J=z3.resolve(Z,$),Q=z3.resolve(Z);if(!J.startsWith(Q+z3.sep)&&J!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((Y)=>Y.test($))}}});var MZ=P(()=>{n$();RZ();AZ();TZ();t$()});var J1=P(()=>{MZ()});function IZ($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,U)=>{if(!U&&q.includes(":")){let W=q.split(":"),z=q,B=W.length>1?W[1]:"";if(B&&Z[B])U=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])U=Z.openGraph[W[1]];else U="";return U?`<meta property="${c(z)}" content="${c(U)}">`:""}return U?`<meta name="${c(q)}" content="${c(U)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,q=K+G[0].length-1,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let z=J.substring(q+1,W).trim(),B=W+1,_=(()=>{try{let j=j0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${c(String(j.name))}"`;if(j.property)H+=` property="${c(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)H+=` content="${c(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return r("MetaTag",H,p.EVALUATION_ERROR)}})();J=J.substring(0,K)+_+J.substring(B),Q.lastIndex=0}return J}function DZ($,Z,Y){let X=$,J=/@structuredData\s*\(/g,Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let W=X.substring(K+1,U).trim(),z=U+1,B=(()=>{try{let _=j0(W,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return r("StructuredData",j,p.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),J.lastIndex=0}return X}function EZ($,Z,Y,X){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let K=J.indexOf("{",G.index+4),q=1,U=K+1,W=null,z=!1;while(U<J.length&&q>0){let F=J[U];if(z){z=!1,U++;continue}if(F==="\\"&&W){z=!0,U++;continue}if(W){if(F===W)W=null;U++;continue}if(F==='"'||F==="'"||F==="`"){W=F,U++;continue}if(F==="{")q++;else if(F==="}")q--;U++}if(q!==0)break;let B=J.substring(U).match(/^\s*\)/);if(!B)break;let _=U+B[0].length,j=J.substring(K,U),H=J.substring(G.index,_),L=((F)=>{try{let O=j0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${c(O.title)}</title>
1802
+ `)}}});import z3 from"path";function zq($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(Y)=>Z[Y]||Y)}function e$($,Z={}){let{allowHtml:Y=!1,maxLength:X=1e4,allowSpecialChars:J=!0,customSanitizer:Q}=Z,G=[],K=$,q=!1;if(Q){let W=Q(K);if(W!==K)K=W,q=!0}if(K.includes("\x00"))K=K.replace(/\0/g,""),q=!0,G.push("Null bytes removed from parameter");if(K.length>X)K=K.substring(0,X),q=!0,G.push(`Parameter truncated to ${X} characters`);if(!Y&&/<[^>]+>/.test(K))K=zq(K),q=!0,G.push("HTML content was escaped");let U=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:W,replacement:z,name:B}of U)if(W.test(K))K=K.replace(W,z),q=!0,G.push(`Removed ${B} from parameter`);if(!J){let W=K;if(K=K.split("").filter((z)=>{let B=z.charCodeAt(0);return B>=32&&B!==127}).join(""),K!==W)q=!0,G.push("Control characters removed")}return{value:K,modified:q,warnings:G}}function Bq($,Z){let Y=$.replace(/\0/g,"");Y=Y.replace(/\\/g,"/"),Y=Y.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(Y.includes("../")||Y.includes("./"))Y=Y.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!B3.isValidFilePath(Y,Z))return null;return Y}function _q($){let Z=[],Y=$.trim(),X=Y!==$,J=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of J)if(Q.test(Y))Z.push(`Potentially dangerous pattern detected: ${G}`);if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),X=!0,Z.push("Null bytes removed from expression");return{value:Y,modified:X,warnings:Z}}function jq($,Z={}){return $.map((Y)=>e$(Y,Z))}function NZ($){let Z={};for(let[Y,X]of Object.entries($)){if(!B3.isValidVariableName(Y))continue;if(typeof X==="string"){let J=e$(X);Z[Y]=J.value}else if(Array.isArray(X))Z[Y]=X.map((J)=>typeof J==="string"?e$(J).value:J);else if(typeof X==="object"&&X!==null)Z[Y]=NZ(X);else Z[Y]=X}return Z}var B3;var TZ=C(()=>{B3={isValidFilePath($,Z){let Y=$.replace(/\\/g,"/");if(Y.includes("\x00"))return!1;if(Y.includes("../")||Y.includes("..\\")||Y===".."||Y.startsWith("../")||Y.endsWith("/..")||Y.includes("/..\\")||Y.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(Y))return!1;if(Y.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>Y===Q.slice(0,-1)||Y.startsWith(Q)))return!1}if(/^[a-z]:/i.test(Y)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>Y.includes(Q)))return!1}if(Z){let J=z3.resolve(Z,$),Q=z3.resolve(Z);if(!J.startsWith(Q+z3.sep)&&J!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((Y)=>Y.test($))}}});var MZ=C(()=>{n$();RZ();AZ();TZ();t$()});var J1=C(()=>{MZ()});function IZ($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,U)=>{if(!U&&q.includes(":")){let W=q.split(":"),z=q,B=W.length>1?W[1]:"";if(B&&Z[B])U=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[W[1]])U=Z.openGraph[W[1]];else U="";return U?`<meta property="${c(z)}" content="${c(U)}">`:""}return U?`<meta name="${c(q)}" content="${c(U)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,q=K+G[0].length-1,U=1,W=q+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let z=J.substring(q+1,W).trim(),B=W+1,_=(()=>{try{let j=j0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${c(String(j.name))}"`;if(j.property)H+=` property="${c(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)H+=` content="${c(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return r("MetaTag",H,p.EVALUATION_ERROR)}})();J=J.substring(0,K)+_+J.substring(B),Q.lastIndex=0}return J}function DZ($,Z,Y){let X=$,J=/@structuredData\s*\(/g,Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)break;let W=X.substring(K+1,U).trim(),z=U+1,B=(()=>{try{let _=j0(W,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return r("StructuredData",j,p.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),J.lastIndex=0}return X}function EZ($,Z,Y,X){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let K=J.indexOf("{",G.index+4),q=1,U=K+1,W=null,z=!1;while(U<J.length&&q>0){let F=J[U];if(z){z=!1,U++;continue}if(F==="\\"&&W){z=!0,U++;continue}if(W){if(F===W)W=null;U++;continue}if(F==='"'||F==="'"||F==="`"){W=F,U++;continue}if(F==="{")q++;else if(F==="}")q--;U++}if(q!==0)break;let B=J.substring(U).match(/^\s*\)/);if(!B)break;let _=U+B[0].length,j=J.substring(K,U),H=J.substring(G.index,_),L=((F)=>{try{let O=j0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${c(O.title)}</title>
1803
1803
  `,V+=`<meta name="title" content="${c(O.title)}">
1804
1804
  `;if(O.description)V+=`<meta name="description" content="${c(O.description)}">
1805
1805
  `;if(O.keywords){let R=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${c(R)}">
@@ -1854,7 +1854,7 @@ ${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${Y}${Q.startsWith("/")?"":"/"}${Q}`
1854
1854
  </sitemap>`}).join(`
1855
1855
  `)}
1856
1856
  </sitemapindex>`}async function ZV($,Z){let{extensions:Y=[".stx",".html",".htm"],ignore:X=["_*",".*","node_modules","components","partials","layouts"]}=Z,J=[],Q=Y.length===1?`*${Y[0]}`:`*{${Y.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let K of G.scan($)){if(X.some((B)=>{if(B.startsWith("*"))return K.includes(B.slice(1));return K.startsWith(B)||K.includes(`/${B}`)}))continue;let U=K.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!U.startsWith("/"))U=`/${U}`;if(U!=="/"&&U.endsWith("/"))U=U.slice(0,-1);let W=`${$}/${K}`,z;try{let B=await Bun.file(W).stat();if(B)z=new Date(B.mtime).toISOString().split("T")[0]}catch{}J.push({loc:U||"/",lastmod:z,priority:U==="/"?1:0.5})}return J.sort((K,q)=>K.loc.localeCompare(q.loc)),J}function Hq($){let Z=[];for(let Y of $.rules){if(Z.push(`User-agent: ${Y.userAgent}`),Y.allow)for(let X of Y.allow)Z.push(`Allow: ${X}`);if(Y.disallow)for(let X of Y.disallow)Z.push(`Disallow: ${X}`);if(Y.crawlDelay!==void 0)Z.push(`Crawl-delay: ${Y.crawlDelay}`);Z.push("")}if($.sitemap){let Y=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let X of Y)Z.push(`Sitemap: ${X}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
1857
- `).trim()}function YV($){return Hq({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function SZ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var _3,j3;var H3=P(()=>{J1();F0();_3={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return r("Meta","meta directive requires at least the meta name",p.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(J)}" content="${c(Q)}">`},hasEndTag:!1},j3={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return r("StructuredData","structuredData directive requires JSON-LD content",p.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return r("StructuredData","structuredData requires @type property",p.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let Q=J instanceof Error?J.message:String(J);return r("StructuredData",Q,p.EVALUATION_ERROR)}},hasEndTag:!0}});import Oq from"fs";import z1 from"path";async function qV($,Z){if(!$.webComponents?.enabled)return[];let Y=$.webComponents.components||[],X=[];if(Y.length>0){if($.debug)console.log(`Building ${Y.length} web components...`);for(let J of Y)try{let Q=await Lq(J,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${J.name}:`,Q),$.debug)throw Q}}return X}async function Lq($,Z,Y){let{name:X,file:J,tag:Q,extends:G}=$;if(!X||!J||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let K=null;if(z1.isAbsolute(J)&&await i(J))K=J;else if(Z.componentsDir){let H=z1.join(Z.componentsDir,J);if(await i(H))K=H}if(!K)K=await $4(J,process.cwd(),Z,Y);if(!K)return console.error(`Web component source file not found: ${J}`),null;let q=await Bun.file(K).text();Y.add(K);let W=($.outputFormat||"js")==="ts",z=W?Vq({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):Fq({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),B=Z.webComponents?.outputDir||"dist/web-components";await Oq.promises.mkdir(B,{recursive:!0});let _=W?"ts":"js",j=z1.join(B,`${Q}.${_}`);if(await Bun.write(j,z),Z.debug)console.log(`Built web component ${X} -> ${j}`);return j}function Fq($){let{name:Z,tag:Y,baseElement:X="HTMLElement",source:J,shadowDOM:Q,template:G,styleSource:K,attributes:q=[]}=$,U=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let W="";if(K)W=`<link rel="stylesheet" href="${K}">`;return`/**
1857
+ `).trim()}function YV($){return Hq({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function SZ($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}var _3,j3;var H3=C(()=>{J1();F0();_3={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return r("Meta","meta directive requires at least the meta name",p.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(J)}" content="${c(Q)}">`},hasEndTag:!1},j3={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return r("StructuredData","structuredData directive requires JSON-LD content",p.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return r("StructuredData","structuredData requires @type property",p.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let Q=J instanceof Error?J.message:String(J);return r("StructuredData",Q,p.EVALUATION_ERROR)}},hasEndTag:!0}});import Oq from"fs";import z1 from"path";async function qV($,Z){if(!$.webComponents?.enabled)return[];let Y=$.webComponents.components||[],X=[];if(Y.length>0){if($.debug)console.log(`Building ${Y.length} web components...`);for(let J of Y)try{let Q=await Lq(J,$,Z);if(Q)X.push(Q)}catch(Q){if(console.error(`Error building web component ${J.name}:`,Q),$.debug)throw Q}}return X}async function Lq($,Z,Y){let{name:X,file:J,tag:Q,extends:G}=$;if(!X||!J||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let K=null;if(z1.isAbsolute(J)&&await i(J))K=J;else if(Z.componentsDir){let H=z1.join(Z.componentsDir,J);if(await i(H))K=H}if(!K)K=await $4(J,process.cwd(),Z,Y);if(!K)return console.error(`Web component source file not found: ${J}`),null;let q=await Bun.file(K).text();Y.add(K);let W=($.outputFormat||"js")==="ts",z=W?Vq({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):Fq({name:X,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),B=Z.webComponents?.outputDir||"dist/web-components";await Oq.promises.mkdir(B,{recursive:!0});let _=W?"ts":"js",j=z1.join(B,`${Q}.${_}`);if(await Bun.write(j,z),Z.debug)console.log(`Built web component ${X} -> ${j}`);return j}function Fq($){let{name:Z,tag:Y,baseElement:X="HTMLElement",source:J,shadowDOM:Q,template:G,styleSource:K,attributes:q=[]}=$,U=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let W="";if(K)W=`<link rel="stylesheet" href="${K}">`;return`/**
1858
1858
  * ${Z} Web Component
1859
1859
  * Auto-generated from stx component
1860
1860
  */
@@ -2317,7 +2317,7 @@ else { this.removeAttribute('${E}'); }`:`this.setAttribute('${E}', ${I.type==="o
2317
2317
  }
2318
2318
  else {
2319
2319
  this.removeAttribute('${E}');
2320
- }`:"",b=I.observer?`this.${I.observer}(value, oldValue);`:"",y=I.render!==!1?"this._scheduleRender();":"";return`
2320
+ }`:"",b=I.observer?`this.${I.observer}(value, oldValue);`:"",P=I.render!==!1?"this._scheduleRender();":"";return`
2321
2321
  get ${T}(): ${D} {
2322
2322
  return this._${T};
2323
2323
  }
@@ -2327,7 +2327,7 @@ else {
2327
2327
  if (oldValue === value) return;
2328
2328
  this._${T} = value;${S}
2329
2329
  ${b}
2330
- ${y}
2330
+ ${P}
2331
2331
  this.dispatchEvent(new CustomEvent('${T}-changed', {
2332
2332
  detail: { value, oldValue },
2333
2333
  bubbles: true
@@ -2933,14 +2933,14 @@ ${W}
2933
2933
  customElements.define('${Z}', ${G});
2934
2934
  `}async function bZ($,Z,Y,X){if(Z.length<1)return r("WebComponent","@webcomponent directive requires at least the tag name parameter",p.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[z1.join(z1.dirname(X),G,`${J}.stx`),z1.join(process.cwd(),G,`${J}.stx`),z1.join(z1.dirname(X),`${J}.stx`)],q=null;for(let z of K)if(await i(z)){q=await Bun.file(z).text();break}if(!q)return r("WebComponent",`Component file not found: ${J}.stx`,p.FILE_NOT_FOUND);let U=Mq(q,J);return`<script type="module">
2935
2935
  ${Iq(U)}
2936
- </script>`}var O3;var yZ=P(()=>{J1();V0();O3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var PZ={};l(PZ,{timingPlugin:()=>bq,pluginManager:()=>Dq,definePlugin:()=>Z4,debugPlugin:()=>Sq,createVariablesPlugin:()=>yq,createFilterPlugin:()=>kq,createDirectivePlugin:()=>Eq,PluginManager:()=>F3});function Z4($){return $}class F3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function Eq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function kq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function yq($){return Z4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Dq,Sq,bq;var CZ=P(()=>{Dq=new F3;Sq=Z4({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)}}),bq=Z4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var xZ={};l(xZ,{validateConfig:()=>xq,loadStxConfig:()=>X4,defineStxConfig:()=>vq,defaultConfig:()=>C1,config:()=>w3});import V3 from"fs";import M0 from"path";import{loadConfigWithResult as Pq}from"bunfig";function Cq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=M0.join(process.cwd(),"resources","views"),J=M0.join(process.cwd(),"resources","layouts");if(V3.existsSync(X)&&V3.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=M0.join(process.cwd(),"resources","views","pages");if(V3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function X4($){if(!$){if(q5)return q5;if(Y4)return Y4}let Z=$?M0.resolve($):process.cwd(),Y=vZ.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await Pq({name:"stx",alias:"ui",cwd:Z,defaultConfig:C1,verbose:!1})).config,G=Cq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!M0.isAbsolute(Q.partialsDir))Q.partialsDir=M0.join(K,Q.partialsDir);if(Q.componentsDir&&!M0.isAbsolute(Q.componentsDir))Q.componentsDir=M0.join(K,Q.componentsDir);if(Q.layoutsDir&&!M0.isAbsolute(Q.layoutsDir))Q.layoutsDir=M0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (CZ(),PZ)),q=[],U=[];for(let W of Q.plugins){let z=typeof W==="string"?W:W[0],B=typeof W==="string"?{}:W[1]||{};try{let _,j;try{_=await import(z),j=M0.dirname(J0.resolve(z))}catch{let L=M0.resolve(process.cwd(),z);_=await import(L),j=M0.dirname(L)}let H=_.default||_;if(K.register(H,Q),H.components){let L=M0.resolve(j,H.components);q.push(L)}if(H.pages){let L=M0.resolve(j,H.pages),F=B.path||"/";U.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=O},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(vZ.set(Z,X),!$)Y4=X,X.then((J)=>{q5=J}).catch(()=>{});return X}function vq($){return $}function xq($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var C1,q5=null,vZ,Y4=null,w3;var g5=P(()=>{z7();O7();A7();N7();I7();u8();J3();Q3();H3();yZ();C1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:M7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:bZ,hasEndTag:!1,description:"Include a web component in the template"},B$,_$,_3,j3,B7,j7,H7,_7,G8,U8,m8,X3,...c$],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};vZ=new Map;w3=new Proxy(C1,{get($,Z){if(q5&&Z in q5)return q5[Z];if(!Y4)X4().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var cq={};l(cq,{resetCssCache:()=>mq,resetCrosswindCache:()=>uq,rebuildCrosswindCSS:()=>lq,loadCrosswindConfig:()=>M3,loadCrosswind:()=>T3,injectCrosswindCSS:()=>I3,getCachedCSS:()=>pq,generateCrosswindCSS:()=>dZ,extractClassNames:()=>hZ,buildCrosswindCSS:()=>gZ});import Q4 from"fs";import Y0 from"path";function N3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function R3($,Z){if(Q1.has($))Q1.delete($);else if(Q1.size>=fq)Q1.delete(Q1.keys().next().value);Q1.set($,Z)}async function gq($){if(!B1)return null;try{let Z=Bun.file(Y0.join(B1,`cw-${N3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function hq($,Z){if(!B1)return;try{if(!Q4.existsSync(B1))Q4.mkdirSync(B1,{recursive:!0});await Bun.write(Y0.join(B1,`cw-${N3($)}.css`),Z)}catch{}}async function fZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function dq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y0.dirname(Y))$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=Y0.dirname(Y);if(Z){let X=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function T3(){if(A3)return W5;A3=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await fZ(Y);if(X){if(W5=X,!process.env.STACKS_DEV_QUIET)console.log(`${K0.green}[Crosswind]${K0.reset} CSS engine loaded`);return W5}}let Z=dq();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await fZ(Y);if(X){if(W5=X,!process.env.STACKS_DEV_QUIET)console.log(`${K0.green}[Crosswind]${K0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Y))}`);return W5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${K0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${K0.reset}`),console.warn(`${K0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${K0.reset}`),null}}function mq(){Q1.clear()}function uq(){W5=null,A3=!1,l0=null,h5="",Q1.clear(),J4=null}async function M3($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${K0.green}[Crosswind]${K0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${K0.yellow}[Crosswind]${K0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function gZ($){if(U5)return h5;U5=!0;try{let Z=await T3();if(!Z||!Z.build)return U5=!1,"";if(!l0)l0=await M3($);if(!l0)return U5=!1,"";let Y=Z.defaultConfig?.theme||{},X=l0.theme||{},J={...Z.defaultConfig,...l0,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(h5=G.css,console.log(`${K0.cyan}[Crosswind]${K0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),J.output){let q=Y0.isAbsolute(J.output)?J.output:Y0.join($,J.output),U=Y0.dirname(q);if(!Q4.existsSync(U))Q4.mkdirSync(U,{recursive:!0});await Bun.write(q,G.css)}return U5=!1,G.css}catch(Z){return console.error(`${K0.red}[Crosswind]${K0.reset} Build error:`,Z),U5=!1,h5}}async function lq($){l0=null,await gZ($)}function pq(){return h5}function hZ($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=J.exec($)}return Z}async function dZ($,Z){try{let Y=await T3();if(!Y)return"";let X=hZ($);if(X.size===0)return"";let J=Z?Y0.resolve(Z):process.cwd();if(!B1)B1=Y0.join(J,".stx/cache");let Q=[...X].sort().join(" "),G=`${J4||"default"}::${Q}`,K=Q1.get(G);if(K!==void 0)return R3(G,K),K;let q=await gq(G);if(q!==null)return R3(G,q),q;if(!l0){let w=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (g5(),xZ)),N=await A(J);if(N.css)if(typeof N.css==="string"){let M=Y0.isAbsolute(N.css)?N.css:Y0.resolve(J,N.css);if(await Bun.file(M).exists()){let T=await import(M);w=T.default||T,console.log(`${K0.green}[Crosswind]${K0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(w={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let M=Y0.isAbsolute(N.css.config)?N.css.config:Y0.resolve(J,N.css.config);if(await Bun.file(M).exists()){let T=await import(M);w={...T.default||T,...w}}}console.log(`${K0.green}[Crosswind]${K0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l0=w||await M3(J);try{J4=N3(JSON.stringify(l0??{}))}catch{J4="unhashable"}}let U=Y.defaultConfig||Y.config,W=l0||{},z=U.theme||{},_=(W.theme||{}).extend||{},j={...z};if(Object.keys(_).length>0)j.extend=_;let H=[...U.safelist||[],...W.safelist||[]],L={...U,...W,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let w of H)F.generate(w);for(let w of X)F.generate(w);let O=F.toCSS(!0,!1),V=L.shortcuts||W.shortcuts||{};for(let[w,A]of Object.entries(V)){if(!X.has(w)&&!H.includes(w))continue;let N=A.split(/\s+/).filter(Boolean);for(let M of N)F.generate(M)}O=F.toCSS(!0,!1);let R=O.split(`
2937
- `);for(let[w,A]of Object.entries(V)){if(!X.has(w)&&!H.includes(w))continue;let N=A.split(/\s+/).filter(Boolean),M=[],T=[];for(let I of N){let D=I.startsWith("dark:"),S=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<R.length;b++){let y=R[b].trim();if(y===`${S} {`||y.startsWith(`${S} {`)){let d=b,f="";while(d<R.length){if(f+=R[d],R[d].includes("}"))break;d++}let m=f.match(/\{([^}]+)\}/);if(m)if(D)T.push(m[1].trim());else M.push(m[1].trim());break}}}if(M.length)O+=`
2936
+ </script>`}var O3;var yZ=C(()=>{J1();V0();O3={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var PZ={};l(PZ,{timingPlugin:()=>bq,pluginManager:()=>Dq,definePlugin:()=>Z4,debugPlugin:()=>Sq,createVariablesPlugin:()=>yq,createFilterPlugin:()=>kq,createDirectivePlugin:()=>Eq,PluginManager:()=>F3});function Z4($){return $}class F3{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function Eq($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function kq($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function yq($){return Z4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Dq,Sq,bq;var CZ=C(()=>{Dq=new F3;Sq=Z4({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)}}),bq=Z4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var xZ={};l(xZ,{validateConfig:()=>xq,loadStxConfig:()=>X4,defineStxConfig:()=>vq,defaultConfig:()=>C1,config:()=>w3});import V3 from"fs";import I0 from"path";import{loadConfigWithResult as Pq}from"bunfig";function Cq($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=I0.join(process.cwd(),"resources","views"),J=I0.join(process.cwd(),"resources","layouts");if(V3.existsSync(X)&&V3.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=I0.join(process.cwd(),"resources","views","pages");if(V3.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function X4($){if(!$){if(q5)return q5;if(Y4)return Y4}let Z=$?I0.resolve($):process.cwd(),Y=vZ.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await Pq({name:"stx",alias:"ui",cwd:Z,defaultConfig:C1,verbose:!1})).config,G=Cq(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!I0.isAbsolute(Q.partialsDir))Q.partialsDir=I0.join(K,Q.partialsDir);if(Q.componentsDir&&!I0.isAbsolute(Q.componentsDir))Q.componentsDir=I0.join(K,Q.componentsDir);if(Q.layoutsDir&&!I0.isAbsolute(Q.layoutsDir))Q.layoutsDir=I0.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (CZ(),PZ)),q=[],U=[];for(let W of Q.plugins){let z=typeof W==="string"?W:W[0],B=typeof W==="string"?{}:W[1]||{};try{let _,j;try{_=await import(z),j=I0.dirname(J0.resolve(z))}catch{let L=I0.resolve(process.cwd(),z);_=await import(L),j=I0.dirname(L)}let H=_.default||_;if(K.register(H,Q),H.components){let L=I0.resolve(j,H.components);q.push(L)}if(H.pages){let L=I0.resolve(j,H.pages),F=B.path||"/";U.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,O)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=O},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}Q._pluginComponentDirs=q,Q._pluginPageDirs=U}return Q})();if(vZ.set(Z,X),!$)Y4=X,X.then((J)=>{q5=J}).catch(()=>{});return X}function vq($){return $}function xq($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var C1,q5=null,vZ,Y4=null,w3;var g5=C(()=>{z7();O7();A7();N7();I7();u8();J3();Q3();H3();yZ();C1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:M7,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:bZ,hasEndTag:!1,description:"Include a web component in the template"},B$,_$,_3,j3,B7,j7,H7,_7,G8,U8,m8,X3,...c$],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};vZ=new Map;w3=new Proxy(C1,{get($,Z){if(q5&&Z in q5)return q5[Z];if(!Y4)X4().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var cq={};l(cq,{resetCssCache:()=>mq,resetCrosswindCache:()=>uq,rebuildCrosswindCSS:()=>lq,loadCrosswindConfig:()=>M3,loadCrosswind:()=>T3,injectCrosswindCSS:()=>I3,getCachedCSS:()=>pq,generateCrosswindCSS:()=>dZ,extractClassNames:()=>hZ,buildCrosswindCSS:()=>gZ});import Q4 from"fs";import Y0 from"path";function N3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function R3($,Z){if(Q1.has($))Q1.delete($);else if(Q1.size>=fq)Q1.delete(Q1.keys().next().value);Q1.set($,Z)}async function gq($){if(!B1)return null;try{let Z=Bun.file(Y0.join(B1,`cw-${N3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function hq($,Z){if(!B1)return;try{if(!Q4.existsSync(B1))Q4.mkdirSync(B1,{recursive:!0});await Bun.write(Y0.join(B1,`cw-${N3($)}.css`),Z)}catch{}}async function fZ($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function dq(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==Y0.dirname(Y))$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Y0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Y0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=Y0.dirname(Y);if(Z){let X=[Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Y0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Y0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Y0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function T3(){if(A3)return W5;A3=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await fZ(Y);if(X){if(W5=X,!process.env.STACKS_DEV_QUIET)console.log(`${K0.green}[Crosswind]${K0.reset} CSS engine loaded`);return W5}}let Z=dq();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await fZ(Y);if(X){if(W5=X,!process.env.STACKS_DEV_QUIET)console.log(`${K0.green}[Crosswind]${K0.reset} CSS engine loaded from ${Y0.dirname(Y0.dirname(Y))}`);return W5}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${K0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${K0.reset}`),console.warn(`${K0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${K0.reset}`),null}}function mq(){Q1.clear()}function uq(){W5=null,A3=!1,l0=null,h5="",Q1.clear(),J4=null}async function M3($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=Y0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${K0.green}[Crosswind]${K0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${K0.yellow}[Crosswind]${K0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function gZ($){if(U5)return h5;U5=!0;try{let Z=await T3();if(!Z||!Z.build)return U5=!1,"";if(!l0)l0=await M3($);if(!l0)return U5=!1,"";let Y=Z.defaultConfig?.theme||{},X=l0.theme||{},J={...Z.defaultConfig,...l0,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(h5=G.css,console.log(`${K0.cyan}[Crosswind]${K0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),J.output){let q=Y0.isAbsolute(J.output)?J.output:Y0.join($,J.output),U=Y0.dirname(q);if(!Q4.existsSync(U))Q4.mkdirSync(U,{recursive:!0});await Bun.write(q,G.css)}return U5=!1,G.css}catch(Z){return console.error(`${K0.red}[Crosswind]${K0.reset} Build error:`,Z),U5=!1,h5}}async function lq($){l0=null,await gZ($)}function pq(){return h5}function hZ($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=J.exec($)}return Z}async function dZ($,Z){try{let Y=await T3();if(!Y)return"";let X=hZ($);if(X.size===0)return"";let J=Z?Y0.resolve(Z):process.cwd();if(!B1)B1=Y0.join(J,".stx/cache");let Q=[...X].sort().join(" "),G=`${J4||"default"}::${Q}`,K=Q1.get(G);if(K!==void 0)return R3(G,K),K;let q=await gq(G);if(q!==null)return R3(G,q),q;if(!l0){let w=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (g5(),xZ)),N=await A(J);if(N.css)if(typeof N.css==="string"){let M=Y0.isAbsolute(N.css)?N.css:Y0.resolve(J,N.css);if(await Bun.file(M).exists()){let T=await import(M);w=T.default||T,console.log(`${K0.green}[Crosswind]${K0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(w={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let M=Y0.isAbsolute(N.css.config)?N.css.config:Y0.resolve(J,N.css.config);if(await Bun.file(M).exists()){let T=await import(M);w={...T.default||T,...w}}}console.log(`${K0.green}[Crosswind]${K0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l0=w||await M3(J);try{J4=N3(JSON.stringify(l0??{}))}catch{J4="unhashable"}}let U=Y.defaultConfig||Y.config,W=l0||{},z=U.theme||{},_=(W.theme||{}).extend||{},j={...z};if(Object.keys(_).length>0)j.extend=_;let H=[...U.safelist||[],...W.safelist||[]],L={...U,...W,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let w of H)F.generate(w);for(let w of X)F.generate(w);let O=F.toCSS(!0,!1),V=L.shortcuts||W.shortcuts||{};for(let[w,A]of Object.entries(V)){if(!X.has(w)&&!H.includes(w))continue;let N=A.split(/\s+/).filter(Boolean);for(let M of N)F.generate(M)}O=F.toCSS(!0,!1);let R=O.split(`
2937
+ `);for(let[w,A]of Object.entries(V)){if(!X.has(w)&&!H.includes(w))continue;let N=A.split(/\s+/).filter(Boolean),M=[],T=[];for(let I of N){let D=I.startsWith("dark:"),S=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<R.length;b++){let P=R[b].trim();if(P===`${S} {`||P.startsWith(`${S} {`)){let d=b,f="";while(d<R.length){if(f+=R[d],R[d].includes("}"))break;d++}let m=f.match(/\{([^}]+)\}/);if(m)if(D)T.push(m[1].trim());else M.push(m[1].trim());break}}}if(M.length)O+=`
2938
2938
  .${w} { ${M.join(" ")} }`;if(T.length)O+=`
2939
2939
  @media (prefers-color-scheme: dark) { .dark .${w} { ${T.join(" ")} } }`}return R3(G,O),hq(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function I3($,Z){let Y=await dZ($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
2940
2940
  ${Y}
2941
2941
  </style>`,J=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(J.test($)){let Q=!1;return $.replace(J,()=>{if(Q)return"";return Q=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
2942
2942
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
2943
- ${X}`);return X+$}var W5=null,A3=!1,l0=null,h5="",U5=!1,fq=256,Q1,B1=null,J4=null;var mZ=P(()=>{X8();Q1=new Map});function nq(){return`stx-${++iq}-${Date.now().toString(36)}`}function oq($){let Z={id:nq(),element:$||null,mountHooks:[],destroyHooks:[],updateHooks:[],refs:new Map,watchers:[],isMounted:!1};return lZ.set(Z.id,Z),Z}function uZ($){G4=$}function D3(){return G4}function E3($){if(!G4)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return G4}function sq($){let Z=E3("onMount");if(Z)Z.mountHooks.push($)}function rq($){let Z=E3("onDestroy");if(Z)Z.destroyHooks.push($)}function aq($){let Z=E3("onUpdate");if(Z)Z.updateHooks.push($)}function tq($=null){let Z={value:$,get current(){return this.value}},Y=D3();if(Y){let X=`ref-${Y.refs.size}`;Y.refs.set(X,Z)}return Z}function xV($,Z=null){let Y=tq(Z),X=D3();if(X)X.refs.set($,Y);return Y}function fV($,Z,Y={}){let X,J,Q=!0,G=()=>{if(!Q)return;let W=$();if(X!==W||Y.immediate){if(J)J();J=Z(W,X),X=W}};if(Y.immediate)G();else X=$();let K=setInterval(G,16),q=()=>{if(Q=!1,clearInterval(K),J)J()},U=D3();if(U)U.watchers.push({stop:q}),U.destroyHooks.push(q);return q}function gV($){let Z,Y=!0;return{get value(){if(Y)Z=$(),Y=!1,queueMicrotask(()=>{Y=!0});return Z}}}function hV($,Z){let Y=oq($);uZ(Y);try{Z()}finally{uZ(null)}return Y}function dV($){if($.isMounted)return;$.isMounted=!0;for(let Z of $.mountHooks)try{let Y=Z();if(typeof Y==="function")$.destroyHooks.push(Y)}catch(Y){console.error("[stx] Error in onMount hook:",Y)}}function mV($){if(!$.isMounted)return;for(let Z of $.updateHooks)try{let Y=Z();if(typeof Y==="function")$.destroyHooks.push(Y)}catch(Y){console.error("[stx] Error in onUpdate hook:",Y)}}function uV($){if(!$.isMounted)return;for(let Z of $.watchers)Z.stop();for(let Z of $.destroyHooks)try{Z()}catch(Y){console.error("[stx] Error in onDestroy hook:",Y)}for(let Z of $.refs.values())Z.value=null;$.isMounted=!1,lZ.delete($.id)}function pZ(){return`
2943
+ ${X}`);return X+$}var W5=null,A3=!1,l0=null,h5="",U5=!1,fq=256,Q1,B1=null,J4=null;var mZ=C(()=>{X8();Q1=new Map});function nq(){return`stx-${++iq}-${Date.now().toString(36)}`}function oq($){let Z={id:nq(),element:$||null,mountHooks:[],destroyHooks:[],updateHooks:[],refs:new Map,watchers:[],isMounted:!1};return lZ.set(Z.id,Z),Z}function uZ($){G4=$}function D3(){return G4}function E3($){if(!G4)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return G4}function sq($){let Z=E3("onMount");if(Z)Z.mountHooks.push($)}function rq($){let Z=E3("onDestroy");if(Z)Z.destroyHooks.push($)}function aq($){let Z=E3("onUpdate");if(Z)Z.updateHooks.push($)}function tq($=null){let Z={value:$,get current(){return this.value}},Y=D3();if(Y){let X=`ref-${Y.refs.size}`;Y.refs.set(X,Z)}return Z}function xV($,Z=null){let Y=tq(Z),X=D3();if(X)X.refs.set($,Y);return Y}function fV($,Z,Y={}){let X,J,Q=!0,G=()=>{if(!Q)return;let W=$();if(X!==W||Y.immediate){if(J)J();J=Z(W,X),X=W}};if(Y.immediate)G();else X=$();let K=setInterval(G,16),q=()=>{if(Q=!1,clearInterval(K),J)J()},U=D3();if(U)U.watchers.push({stop:q}),U.destroyHooks.push(q);return q}function gV($){let Z,Y=!0;return{get value(){if(Y)Z=$(),Y=!1,queueMicrotask(()=>{Y=!0});return Z}}}function hV($,Z){let Y=oq($);uZ(Y);try{Z()}finally{uZ(null)}return Y}function dV($){if($.isMounted)return;$.isMounted=!0;for(let Z of $.mountHooks)try{let Y=Z();if(typeof Y==="function")$.destroyHooks.push(Y)}catch(Y){console.error("[stx] Error in onMount hook:",Y)}}function mV($){if(!$.isMounted)return;for(let Z of $.updateHooks)try{let Y=Z();if(typeof Y==="function")$.destroyHooks.push(Y)}catch(Y){console.error("[stx] Error in onUpdate hook:",Y)}}function uV($){if(!$.isMounted)return;for(let Z of $.watchers)Z.stop();for(let Z of $.destroyHooks)try{Z()}catch(Y){console.error("[stx] Error in onDestroy hook:",Y)}for(let Z of $.refs.values())Z.value=null;$.isMounted=!1,lZ.delete($.id)}function pZ(){return`
2944
2944
  // STX Lifecycle Runtime
2945
2945
  (function() {
2946
2946
  if (typeof window === 'undefined') return;
@@ -3285,7 +3285,7 @@ else {
3285
3285
 
3286
3286
  console.log('[stx] Lifecycle runtime initialized');
3287
3287
  })();
3288
- `}function k3($){return Symbol($)}function lV($,Z){(_1.length>0?_1[_1.length-1]:K4).set($,Z)}function pV($,Z){for(let Y=_1.length-1;Y>=0;Y--){let X=_1[Y];if(X.has($))return X.get($)}if(K4.has($))return K4.get($);if(arguments.length>1)return Z;console.warn(`[stx] Injection "${String($)}" not found.`);return}function eq(){_1.push(new Map)}function $U(){_1.pop()}async function cV($){eq();try{return await $()}finally{$U()}}function iV(){K4.clear(),_1.length=0}var G4=null,lZ,iq=0,PV,CV,vV,K4,_1,nV,oV,sV;var cZ=P(()=>{lZ=new Map;PV=sq,CV=rq,vV=aq;K4=new Map,_1=[];nV=k3("theme"),oV=k3("router"),sV=k3("i18n")});import*as nZ from"crypto";function iZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function ZU(){return`stx-${nZ.randomBytes(4).toString("hex")}`}function YU($){return/\$\w+\./.test($)}function XU($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(X,(Q,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let U=[],W=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(YU(V)){W=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let w=R[1];if(U.push({attr:O,expr:w,fullMatch:F,originalAttr:O}),iZ(w).forEach((N)=>Y.add(N)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!W)return Q;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=ZU(),z=` id="${H}"${z}`;for(let L of U)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:iZ(L.expr)});return`<${G}${z}${q}`}),{html:J,bindings:Z,stores:Y}}function JU($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3288
+ `}function k3($){return Symbol($)}function lV($,Z){(_1.length>0?_1[_1.length-1]:K4).set($,Z)}function pV($,Z){for(let Y=_1.length-1;Y>=0;Y--){let X=_1[Y];if(X.has($))return X.get($)}if(K4.has($))return K4.get($);if(arguments.length>1)return Z;console.warn(`[stx] Injection "${String($)}" not found.`);return}function eq(){_1.push(new Map)}function $U(){_1.pop()}async function cV($){eq();try{return await $()}finally{$U()}}function iV(){K4.clear(),_1.length=0}var G4=null,lZ,iq=0,PV,CV,vV,K4,_1,nV,oV,sV;var cZ=C(()=>{lZ=new Map;PV=sq,CV=rq,vV=aq;K4=new Map,_1=[];nV=k3("theme"),oV=k3("router"),sV=k3("i18n")});import*as nZ from"crypto";function iZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function ZU(){return`stx-${nZ.randomBytes(4).toString("hex")}`}function YU($){return/\$\w+\./.test($)}function XU($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(X,(Q,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let U=[],W=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(YU(V)){W=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let w=R[1];if(U.push({attr:O,expr:w,fullMatch:F,originalAttr:O}),iZ(w).forEach((N)=>Y.add(N)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!W)return Q;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=ZU(),z=` id="${H}"${z}`;for(let L of U)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:iZ(L.expr)});return`<${G}${z}${q}`}),{html:J,bindings:Z,stores:Y}}function JU($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3289
3289
  <script>
3290
3290
  (function() {
3291
3291
  'use strict';
@@ -3549,7 +3549,7 @@ else {
3549
3549
  `)}
3550
3550
  })();
3551
3551
  </script>`}function WU($){let Z=$2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let J=Z.length-1;J>=0;J--){let Q=Z[J],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of Q.events)q.elementId=K[1]}for(let K of Q.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(U,""),G=G.replace(W,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),X.push(...Q.events)}return{template:Y,bindings:X}}function Z2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:U}=WU($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...U],q}let J=$2($);if(J.length===0)return $;let Q=$;for(let q=J.length-1;q>=0;q--){let U=J[q],W=U.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${U.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let B of U.events)B.elementId=z[1]}for(let z of U.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");W=W.replace(_,""),W=W.replace(j,"")}Q=Q.slice(0,U.startIndex)+W+Q.slice(U.endIndex)}let G=UU(J),K=Q.lastIndexOf("</body>");if(K!==-1)Q=Q.slice(0,K)+G+`
3552
- `+Q.slice(K);else Q+=G;return Q}function tV($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}var rZ,aZ,QU,eZ;var Y2=P(()=>{rZ=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"]),aZ={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"},QU=new Set(["ctrl","alt","shift","meta"]),eZ={left:0,middle:1,right:2}});function q4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function BU($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[J,Q,G]=X,K=X.index,q=X2(G,"x-data");if(!q)continue;let U=`__stx_scope_${Q2++}`,W=X2(G,"x-init"),z=_U($,Q,K+J.length),B=$.slice(K,z.endIndex),_=jU(B);Z.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:q,initExpr:W,bindings:[],refs:_})}return Z}function _U($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J,K.lastIndex=J;let q=Q.exec($),U=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){J=W.index+W[0].length;continue}if(!U)return{endIndex:$.length};if(q&&q.index<U.index)X++,J=q.index+q[0].length;else{if(X--,X===0)return{endIndex:U.index+U[0].length};J=U.index+U[0].length}}return{endIndex:$.length}}function jU($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=X.exec(Y))!==null){let[,Q,G]=J,K=HU(Q);Z.set(G,K)}return Z}function HU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${zU++}`}function OU(){return`
3552
+ `+Q.slice(K);else Q+=G;return Q}function tV($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}var rZ,aZ,QU,eZ;var Y2=C(()=>{rZ=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"]),aZ={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"},QU=new Set(["ctrl","alt","shift","meta"]),eZ={left:0,middle:1,right:2}});function q4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X2($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function BU($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[J,Q,G]=X,K=X.index,q=X2(G,"x-data");if(!q)continue;let U=`__stx_scope_${Q2++}`,W=X2(G,"x-init"),z=_U($,Q,K+J.length),B=$.slice(K,z.endIndex),_=jU(B);Z.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:q,initExpr:W,bindings:[],refs:_})}return Z}function _U($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J,K.lastIndex=J;let q=Q.exec($),U=G.exec($),W=K.exec($);if(W&&W.index<(q?.index??1/0)){J=W.index+W[0].length;continue}if(!U)return{endIndex:$.length};if(q&&q.index<U.index)X++,J=q.index+q[0].length;else{if(X--,X===0)return{endIndex:U.index+U[0].length};J=U.index+U[0].length}}return{endIndex:$.length}}function jU($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=X.exec(Y))!==null){let[,Q,G]=J,K=HU(Q);Z.set(G,K)}return Z}function HU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${zU++}`}function OU(){return`
3553
3553
  // STX Reactive Runtime - x-cloak and transition CSS
3554
3554
  (function() {
3555
3555
  var style = document.createElement('style');
@@ -3768,12 +3768,12 @@ window.__stx_reactive = (function() {
3768
3768
  ${OU()}
3769
3769
  ${Y}
3770
3770
  </script>`}function G2($,Z,Y){if(Q2=0,!VU($))return $;let X=BU($);if(X.length===0)return $;let J=FU($,X),Q=LU(X,Z),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
3771
- `+J.slice(G);else J+=Q;return J}function FU($,Z){let Y=$;for(let X of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${q4(X.stateExpr)}["']`,"gi").exec(Y);if(Q)X.id=Q[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${q4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${q4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${q4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function VU($){return/x-data\s*=\s*["']/.test($)}var Q2=0,zU=0;var K2=P(()=>{r0()});import wU from"fs";import S3 from"path";import{createHighlighter as RU}from"ts-syntax-highlighter";async function AU($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await wU.promises.stat($)).mtime.getTime();if(Z.cache&&b3.has($)){let z=b3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let J=await Bun.file($).text(),{data:Q,content:G}=B8(J),K=Z.markdown||w3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=P5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await NU(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:U,data:Q||{}};if(Z.cache)b3.set($,{...W,updatedAt:X});return W}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:Q0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function NU($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!U4)try{U4=await RU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,q,U,W)=>{let z=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=U||(Y?"text":"");if(!B)return K;try{if(!U4.getSupportedLanguages().includes(B))return K;return(await U4.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${U}:`,_)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[q,U,W,z]=K,B=await J(q,U,W,z);Q=Q.replace(q,B)}return Q}async function q2($,Z,Y="",X={}){return await TU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,U)=>{try{let W=K;if(!S3.isAbsolute(K))W=S3.resolve(S3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let R=V.indexOf(":");if(R>0){let w=V.substring(0,R).trim(),A=V.substring(R+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),M=A.startsWith("'")&&A.endsWith("'");if(N||M)A=A.substring(1,A.length-1);z[w]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await AU(W,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(W){let z=W instanceof Error?W.message:String(W);return Q0("Markdown File",`Error including markdown file: ${z}`,Y,$,U,G)}})}async function TU($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],q=J.index,U=J;X.push(Y(...U).then((W)=>({match:K,replacement:W,index:q})))}let Q=await Promise.all(X);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var b3,U4=null;var U2=P(()=>{g5();V0();b3=new Map});function j1($,Z){try{let Y=$.trim();if($0(Y))return Z0(Y,Object.keys(Z))(...Object.values(Z));else return e(Y,Z)}catch{return!1}}var W2=P(()=>{F0()});class W4{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,Y=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,Y);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,Y);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,Y);if(X==='"'||X==="'")return this.readString(X,$,Z,Y);if(X==="`")return this.readTemplateString($,Z,Y);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,Y);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,Y);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:Y}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:Y}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:Y};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,Y);let J=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of J)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:Y};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:Y};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y}}readWhitespace($,Z,Y){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readLineComment($,Z,Y){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3771
+ `+J.slice(G);else J+=Q;return J}function FU($,Z){let Y=$;for(let X of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${q4(X.stateExpr)}["']`,"gi").exec(Y);if(Q)X.id=Q[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${q4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${q4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${q4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function VU($){return/x-data\s*=\s*["']/.test($)}var Q2=0,zU=0;var K2=C(()=>{r0()});import wU from"fs";import S3 from"path";import{createHighlighter as RU}from"ts-syntax-highlighter";async function AU($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await wU.promises.stat($)).mtime.getTime();if(Z.cache&&b3.has($)){let z=b3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let J=await Bun.file($).text(),{data:Q,content:G}=B8(J),K=Z.markdown||w3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=P5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await NU(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:U,data:Q||{}};if(Z.cache)b3.set($,{...W,updatedAt:X});return W}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:Q0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function NU($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!U4)try{U4=await RU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,q,U,W)=>{let z=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=U||(Y?"text":"");if(!B)return K;try{if(!U4.getSupportedLanguages().includes(B))return K;return(await U4.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${U}:`,_)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[q,U,W,z]=K,B=await J(q,U,W,z);Q=Q.replace(q,B)}return Q}async function q2($,Z,Y="",X={}){return await TU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,U)=>{try{let W=K;if(!S3.isAbsolute(K))W=S3.resolve(S3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let R=V.indexOf(":");if(R>0){let w=V.substring(0,R).trim(),A=V.substring(R+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),M=A.startsWith("'")&&A.endsWith("'");if(N||M)A=A.substring(1,A.length-1);z[w]=A}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await AU(W,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(W){let z=W instanceof Error?W.message:String(W);return Q0("Markdown File",`Error including markdown file: ${z}`,Y,$,U,G)}})}async function TU($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],q=J.index,U=J;X.push(Y(...U).then((W)=>({match:K,replacement:W,index:q})))}let Q=await Promise.all(X);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var b3,U4=null;var U2=C(()=>{g5();V0();b3=new Map});function j1($,Z){try{let Y=$.trim();if($0(Y))return Z0(Y,Object.keys(Z))(...Object.values(Z));else return e(Y,Z)}catch{return!1}}var W2=C(()=>{F0()});class W4{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,Y=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,Y);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,Y);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,Y);if(X==='"'||X==="'")return this.readString(X,$,Z,Y);if(X==="`")return this.readTemplateString($,Z,Y);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,Y);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,Y);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:Y}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:Y}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:Y};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,Y);let J=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of J)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:Y};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:Y};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y}}readWhitespace($,Z,Y){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readLineComment($,Z,Y){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3772
3772
  `)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readBlockComment($,Z,Y){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readString($,Z,Y,X){this.advance();while(this.pos<this.source.length){let J=this.source[this.pos];if(J==="\\"){this.advance(2);continue}if(J===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:Y,column:X}}readTemplateString($,Z,Y){this.advance();let X=0,J=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(X>=J){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Q==="{"&&X>0){X++,this.advance();continue}if(Q==="}"&&X>0){X--,this.advance();continue}if(Q==="`"&&X===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readNumber($,Z,Y){if(this.source[this.pos]==="0"){let X=this.peek(1)?.toLowerCase();if(X==="x"||X==="o"||X==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readIdentifier($,Z,Y){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readDirective($,Z,Y){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
3773
- `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function O0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,q=!1;while(Q<$.length){let U=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&U==="\\"){q=!0,Q++;continue}if(q=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,Q++;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&U==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&U==="}"){K--,Q++;continue}if(U==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(U===Z)J++;else if(U===Y){if(J--,J===0)return Q}Q++}return-1}function z2($,Z){let Y=Z,X={paren:0,bracket:0,brace:0},J=null,Q=0;while(Y<$.length){let G=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J){Y++;continue}if((G==='"'||G==="'")&&!J){J=G,Y++;continue}if(G===J&&J!=="`"){J=null,Y++;continue}if(G==="`"&&!J){J="`",Y++;continue}if(G==="`"&&J==="`"&&Q===0){J=null,Y++;continue}if(J==="`"&&G==="$"&&$[Y+1]==="{"){Q++,Y+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;Y++;continue}if(J){Y++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(Y,Y+2)==="}}"||$.slice(Y,Y+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}Y++}return{expression:$.slice(Z,Y),endPos:Y}}function y3($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+=K+$[G+1],G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}if(K==="|"&&$[G-1]==="\\"&&!J){Y=Y.slice(0,-1)+K;continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function H1($,Z){let Y=MU($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function MU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=O0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function v1($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),U=K.exec($),W=q?q.index:1/0,z=U?U.index:1/0;if(W<z)J++,Q=W+q[0].length;else if(z<1/0){if(J--,J===0)return z;Q=z+U[0].length}else break}return-1}function B2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=H1($,X);if(!J)return null;let Q=J.endPos,G=v1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],U=0,W="if",z=J.expression,B=0,_=0;while(U<K.length){let j=K.indexOf("@",U);if(j===-1)break;U=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){_++,U++;continue}if(/^@endif(?![a-z])/.test(H)){_--,U+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:W,condition:z,content:K.substring(B,U),start:Q+B,end:Q+U});let F=U+L[0].length,O=H1(K,F);if(!O){U++;continue}W="elseif",z=O.expression,U=O.endPos,B=U;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:W,condition:z,content:K.substring(B,U),start:Q+B,end:Q+U}),W="else",z=void 0,U+=5,B=U;continue}}U++}return q.push({type:W,condition:z,content:K.slice(B),start:Q+B,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function d5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=B2($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function z4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=J.exec($);continue}let K=Q.index,q=K+Q[0].length-1,U=O0($,"(",")",q);if(U===-1){Q=J.exec($);continue}let W=$.slice(q+1,U),z=U+1,B=v1($,Z,Y,z);if(B===-1){Q=J.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:W,content:_,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function P3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=H1($,X);if(!J)return null;let Q=J.endPos,G=v1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],U=0,W=null,z=0;while(U<K.length){let B=K.slice(U),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,W)W.content+=_[0];U+=_[0].length;continue}if(j){if(z--,W)W.content+=j[0];U+=j[0].length;continue}if(z>0){if(W)W.content+=K[U];U++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(W)q.push(W);let O=U+H[0].length,V=H1(K,O);if(!V){U++;continue}W={type:"case",value:V.expression,content:""},U=V.endPos}else if(L&&B.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},U+=L[0].length}else if(F&&B.startsWith("@break"))U+=F[0].length;else{if(W)W.content+=K[U];U++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:q,start:Z,end:G+10}}var _2=()=>{};function IU($){let Z=[],Y=0;while(Y<$.length){let X=$.indexOf("{{",Y),J=$.indexOf("{!!",Y),Q=!1,G;if(X===-1&&J===-1)break;else if(X===-1)G=J,Q=!0;else if(J===-1)G=X,Q=!1;else if(J<X)G=J,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let K=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?K==="{{{"?"}}}":"!!}":"}}",U=G+K.length,W=DU($,U,q);if(W===-1){Y=G+1;continue}let z=$.slice(U,W).trim(),B=W+q.length;Z.push({fullMatch:$.slice(G,B),expression:z,start:G,end:B,isRaw:Q}),Y=B}return Z}function DU($,Z,Y){let X=Z,J=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let K=$[X];if((X>0?$[X-1]:"")==="\\"&&J){X++;continue}if((K==='"'||K==="'")&&!J){J=K,X++;continue}if(K===J&&J!=="`"){J=null,X++;continue}if(K==="`"&&!J){J="`",X++;continue}if(K==="`"&&J==="`"&&G===0){J=null,X++;continue}if(J==="`"&&K==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(K==="{")G++;else if(K==="}")G--;X++;continue}if(J){X++;continue}if(K==="(")Q.paren++;else if(K===")")Q.paren--;else if(K==="[")Q.bracket++;else if(K==="]")Q.bracket--;else if(K==="{")Q.brace++;else if(K==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+Y.length)===Y)return X}X++}return-1}function EU($){let Z=y3($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=kU(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function kU($){let Z=$.trim();if(!Z)return null;let Y=Z.indexOf("(");if(Y===-1)return{name:Z,args:[]};let X=Z.slice(0,Y).trim(),J=Y+1,Q=O0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=O2(G);return{name:X,args:K}}function O2($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+="${",G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function SU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=O0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function bU($){let Z=[],X=new W4($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),J=0;while(J<X.length){let Q=X[J],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,J++,J>=X.length)break}let K=X[J];if(K.type==="IDENTIFIER"&&(K.value==="const"||K.value==="let"||K.value==="var")){let q=K.value;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let W=U.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let z=J<X.length?X[J].start:$.length,B=j2(X,J,$);J=B.nextIndex,Z.push({type:"variable",name:W,value:$.slice(z,B.endPos),exported:G,start:K.start,end:B.endPos})}}else if(U.type==="PUNCTUATION"&&(U.value==="{"||U.value==="[")){let W=U.start,z=U.value==="{"?"}":"]",B=O0($,U.value,z,W);if(B!==-1){let _=$.slice(W,B+1);if(J=H2(X,B+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=j2(X,J,$);J=H.nextIndex;let L=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:L,value:`${$.slice(j,H.endPos)}; ${q} ${_} = ${L}`,exported:G,start:K.start,end:H.endPos})}}}}else if(K.type==="IDENTIFIER"&&K.value==="function"){let q=G?X[J-1].start:K.start;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let W=U.value;J++;let z=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){z=X[J].start;break}J++}if(z!==-1){let B=O0($,"{","}",z);if(B!==-1)Z.push({type:"function",name:W,value:$.slice(q,B+1).replace(/^export\s+/,""),exported:G,start:q,end:B+1}),J=H2(X,B+1)}}}else J++}return Z}function j2($,Z,Y){let X=Z,J={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:Y.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")J.paren++;else if(G.value===")")J.paren--;else if(G.value==="[")J.bracket++;else if(G.value==="]")J.bracket--;else if(G.value==="{")J.brace++;else if(G.value==="}")J.brace--;if(G.value===";"&&J.paren===0&&J.bracket===0&&J.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(J.paren===0&&J.bracket===0&&J.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function H2($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var L2=()=>{};var B4=P(()=>{_2();L2()});function yU($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=P3(X,G);if(!K)break;try{let q;if($0(K.expression))q=Z0(K.expression,Object.keys(Z))(...Object.values(Z));else q=e(K.expression,Z);let U="",W=!1;for(let z of K.cases)if(z.type==="default"){if(!W)U=z.content.trim()}else try{let B;if(z.value&&$0(z.value))B=Z0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=e(z.value,Z);if(q===B){U=z.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+U+X.substring(K.end),J=!0}catch(q){let U=q instanceof Error?q.message:String(q),W=r("Switch",`Error evaluating @switch expression: ${U}`,p.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(K.end);break}}return X}function x1($,Z,Y){let X=$;X=yU(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=H1(X,K+7);if(!q)break;let U=q.endPos,W=v1(X,"unless","endunless",U);if(W===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(U,W),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(z))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(z))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(z))!==null)V.push({pos:R.index,type:"else"});V.sort((w,A)=>w.pos-A.pos);for(let w of V)if(w.type==="open")H++;else if(w.type==="close")H--;else if(w.type==="else"&&H===0){_=w.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(W+10),Q=!0}}X=v3(X,Z,Y),X=x3(X,Z,Y),X=C3(X,Z);let J=()=>{let Q=d5(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",U=!1;for(let W of K.branches){if(U)break;if(W.type==="else")q=W.content,U=!0;else try{let z;if(W.condition&&$0(W.condition))z=Z0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)z=e(W.condition,Z);if(z)q=W.content,U=!0}catch(z){q=r(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${z instanceof Error?z.message:String(z)}`,p.EVALUATION_ERROR),U=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let U=q instanceof Error?q.message:String(q),W=r("If",`Error processing @if block: ${U}`,p.EVALUATION_ERROR);X=X.substring(0,K.start)+W+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function F2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function C3($,Z){let Y=$;function X(K,q,U,W){let z=1,B=W,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function J(K,q,U){let W=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${U}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let U=q.index,W,z,B=Y.slice(U+5),_=F2(B);if(_)W=_.value,z=U+5+_.consumed;else z=U+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=J(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=W?j1(`auth?.check && auth?.user?.[${W}]`,Z):j1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,U)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let U=q.index,W,z,B=Y.slice(U+6),_=F2(B);if(_)W=_.value,z=U+6+_.consumed;else z=U+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=J(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=W?j1(`!auth?.check || !auth?.user?.[${W}]`,Z):j1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,U)+O+Y.substring(j+9),K=!0}}function Q(K,q,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(U){let z=j1(U,Z);W.push(z)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,U=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${U}\\s*\\(`,"g"),N=/@else(?![a-z])/g,M=[],T;while((T=R.exec(F))!==null)M.push({pos:T.index,type:"open"});while((T=w.exec(F))!==null)M.push({pos:T.index,type:"close"});while((T=A.exec(F))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=N.exec(F))!==null)M.push({pos:T.index,type:"else"});M.sort((b,y)=>b.pos-y.pos);for(let b of M){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],D=0;for(let b=0;b<O.length;b++){let y=O[b];if(I.push({content:F.slice(D,y.pos),ability:void 0}),y.type==="elseDirective"){let d=F.slice(y.pos+`@${U}`.length),f=G(d);if(f){I[I.length-1]={content:F.slice(D,y.pos)},D=y.pos+`@${U}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],o=m?m.pos:F.length;I.push({content:F.slice(D,o),ability:f.ability,type:f.type,id:f.id}),D=o}}else D=y.pos+5}if(D<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=Q(j.ability,j.type,j.id),k=K==="can"?E:!E,S="";if(k)S=I[0]?.content||"";else{let b=!1;for(let y=1;y<I.length;y++){let d=I[y];if(d.isFinalElse){S=d.content,b=!0;break}if(d.ability){let f=Q(d.ability,d.type,d.id);if(K==="can"?f:!f){S=d.content,b=!0;break}}}if(!b&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)S=y.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),W=!0}}return Y}function v3($,Z,Y){let X=$;function J(Q,G,K,q,U){let W=!0;while(W){W=!1;let z=new RegExp(`@${G}\\s*\\(`),B=Q.match(z);if(!B||B.index===void 0)break;let _=B.index,j=H1(Q,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=v1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,L),O=j.expression,V=-1,R=0,w=0;while(w<F.length){let A=F.indexOf("@",w);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){R++,w=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){R--,w=A+1;continue}if(R===0&&/^@else(?![a-z])/.test(N)){V=A;break}w=A+1}try{let A=q(O.trim()),N;if(V!==-1){let M=F.slice(0,V),T=F.slice(V+5);N=A?M:T}else N=A?F:"";Q=Q.substring(0,_)+N+Q.substring(L+`@${K}`.length),W=!0}catch(A){let N=A instanceof Error?A.message:String(A),M=r(U,`Error processing @${G} directive: ${N}`,p.EVALUATION_ERROR);Q=Q.substring(0,_)+M+Q.substring(L+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=j1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=j1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function x3($,Z,Y){let X=$,J="development";function Q(G,K,q,U){let W=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,W.lastIndex=0;let L=W.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,U=J===E[2]}let V=1,R=O,w=-1;while(V>0&&R<j.length){W.lastIndex=R,z.lastIndex=R;let E=W.exec(j),k=z.exec(j),S=E?E.index:1/0,b=k?k.index:1/0;if(S<b)V++,R=S+E[0].length;else if(b<1/0){if(V--,V===0){w=b;break}R=b+k[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=j.substring(O,w),N=-1,M=0,T=0;while(T<A.length){let E=A.indexOf("@",T);if(E===-1)break;let k=A.substring(E);if(B.test(k)){M++,T=E+1;continue}if(_.test(k)){M--,T=E+1;continue}if(M===0&&/^@else(?![a-z])/.test(k)){N=E;break}T=E+1}let I;if(N!==-1){let E=A.slice(0,N),k=A.slice(N+5);I=U?E:k}else I=U?A:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(w+D),H=!0}return j}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var _4=P(()=>{W2();J1();B4();F0()});function V2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function f1($,Z){if(!$)return Z?.nonceGenerator?.()??V2();let Y=f3.get($);if(!Y)Y=Z?.nonceGenerator?.()??V2(),f3.set($,Y);return Y}function Iw($){f3.delete($)}function w2($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function h3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${w2($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Dw($){return{enabled:!0,directives:{strict:PU,moderate:g3,relaxed:CU,api:vU}[$]||g3,useNonce:$==="strict",addMetaTag:!0}}function Ew($,Z){let Y={...$};for(let[X,J]of Object.entries(Z)){let Q=X,G=Y[Q];if(J===void 0||J===null)continue;if(typeof J==="boolean")Y[Q]=G||J;else if(Array.isArray(J)){let K=Array.isArray(G)?G:[],q=[...new Set([...K,...J])];Y[Q]=q}}return Y}function R2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?f1(Y,Z):void 0,J=h3(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3774
- ${J}`)}function kw($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function A2($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?f1(Z,Q):void 0;return h3(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return f1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=f1(Z,Q);return J}function Sw(){return[xU,fU]}function bw($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[Y,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${Y} allows insecure resources`);return Z}function gU($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function yw($,Z){if(!$.enabled)return{};let Y=$.useNonce?f1(Z,$):void 0,X=w2($.directives,Y);return{[gU($.reportOnly)]:X}}var f3,PU,g3,CU,vU,xU,fU,Pw;var N2=P(()=>{f3=new WeakMap;PU={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},g3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},CU={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},vU={"default-src":["'none'"],"frame-ancestors":["'none'"]};xU={name:"csp",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?f1(Y,Q):void 0;return h3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},fU={name:"cspNonce",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return f1(Y,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};Pw={enabled:!1,reportOnly:!1,directives:g3,useNonce:!1,addMetaTag:!0}});import{Buffer as T2}from"buffer";import M2 from"crypto";function dU($=hU){let Z=M2.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return z5=Z,Z}function mU(){if(!z5)dU();return z5}function fw(){z5=null}function gw($){z5=$}function uU($=I2){let Z=mU();return`<input type="hidden" name="${$}" value="${Z}">`}function D2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return uU(X||I2)})}function hw($,Z){let Y=Z??z5;if(!Y)return!1;let X=T2.from($),J=T2.from(Y);if(X.length!==J.length)return!1;return M2.timingSafeEqual(X,J)}var hU=40,I2="_token",z5=null;var E2=()=>{};async function k2($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await lU(J,Q,Z,Y,X);else J=await pU(J,Q,Z,Y,X)}return J}async function lU($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,U=$,W=E1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=W.exec(U);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?S2(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);z.push({original:_,processed:r("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${O}`,p.EVALUATION_ERROR),startIndex:L})}B=W.exec(U)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];U=U.replace(j,H)}return U}async function pU($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,q=E1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],W=q.exec(K);while(W!==null){let[_,j=""]=W,H=W.index||0;try{let L=S2(j),F=await G("",L,Y,X);U.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(J.debug)console.error(`Error processing custom directive @${Q}:`,L);U.push({original:_,processed:r("CustomDirective",`Error in @${Q}(${j}): ${F}`,p.EVALUATION_ERROR),startIndex:H})}W=q.exec(K)}let z=E1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);U.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${Q}:`,H);U.push({original:_,processed:r("CustomDirective",`Error in @${Q}: ${L}`,p.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];K=K.replace(j,H)}return K}function S2($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var b2=P(()=>{J1();$5()});var d3={};l(d3,{useTitle:()=>rU,useSeoMeta:()=>H4,usePageTitle:()=>rU,useHead:()=>h1,resetHead:()=>nU,renderHtmlAttrs:()=>tU,renderHead:()=>aU,renderBodyAttrs:()=>eU,processTitleDirective:()=>YW,processMetaDirective:()=>XW,processHeadDirective:()=>ZW,getPageMeta:()=>iU,getHead:()=>m5,definePageMeta:()=>sU,applyHead:()=>$W});function m5(){return O1}function iU(){return j4}function nU(){O1={},cU.length=0,j4={}}function h1($){O1=oU(O1,$)}function oU($,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 H4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});h1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function sU($){if(j4={...j4,...$},$.title||$.description)H4({title:$.title,description:$.description})}function rU($){let Z=typeof $==="function"?$():$;h1({title:Z})}function aU($=O1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${g1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${g1(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${g1(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${g1(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${g1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
3773
+ `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function O0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,q=!1;while(Q<$.length){let U=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&U==="\\"){q=!0,Q++;continue}if(q=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,Q++;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&U==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&U==="}"){K--,Q++;continue}if(U==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(U===Z)J++;else if(U===Y){if(J--,J===0)return Q}Q++}return-1}function z2($,Z){let Y=Z,X={paren:0,bracket:0,brace:0},J=null,Q=0;while(Y<$.length){let G=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J){Y++;continue}if((G==='"'||G==="'")&&!J){J=G,Y++;continue}if(G===J&&J!=="`"){J=null,Y++;continue}if(G==="`"&&!J){J="`",Y++;continue}if(G==="`"&&J==="`"&&Q===0){J=null,Y++;continue}if(J==="`"&&G==="$"&&$[Y+1]==="{"){Q++,Y+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;Y++;continue}if(J){Y++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(Y,Y+2)==="}}"||$.slice(Y,Y+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}Y++}return{expression:$.slice(Z,Y),endPos:Y}}function y3($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+=K+$[G+1],G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}if(K==="|"&&$[G-1]==="\\"&&!J){Y=Y.slice(0,-1)+K;continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function H1($,Z){let Y=MU($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function MU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=O0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function v1($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),U=K.exec($),W=q?q.index:1/0,z=U?U.index:1/0;if(W<z)J++,Q=W+q[0].length;else if(z<1/0){if(J--,J===0)return z;Q=z+U[0].length}else break}return-1}function B2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=H1($,X);if(!J)return null;let Q=J.endPos,G=v1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],U=0,W="if",z=J.expression,B=0,_=0;while(U<K.length){let j=K.indexOf("@",U);if(j===-1)break;U=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){_++,U++;continue}if(/^@endif(?![a-z])/.test(H)){_--,U+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:W,condition:z,content:K.substring(B,U),start:Q+B,end:Q+U});let F=U+L[0].length,O=H1(K,F);if(!O){U++;continue}W="elseif",z=O.expression,U=O.endPos,B=U;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:W,condition:z,content:K.substring(B,U),start:Q+B,end:Q+U}),W="else",z=void 0,U+=5,B=U;continue}}U++}return q.push({type:W,condition:z,content:K.slice(B),start:Q+B,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function d5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=B2($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function z4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=J.exec($);continue}let K=Q.index,q=K+Q[0].length-1,U=O0($,"(",")",q);if(U===-1){Q=J.exec($);continue}let W=$.slice(q+1,U),z=U+1,B=v1($,Z,Y,z);if(B===-1){Q=J.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:W,content:_,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function P3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=H1($,X);if(!J)return null;let Q=J.endPos,G=v1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],U=0,W=null,z=0;while(U<K.length){let B=K.slice(U),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,W)W.content+=_[0];U+=_[0].length;continue}if(j){if(z--,W)W.content+=j[0];U+=j[0].length;continue}if(z>0){if(W)W.content+=K[U];U++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(W)q.push(W);let O=U+H[0].length,V=H1(K,O);if(!V){U++;continue}W={type:"case",value:V.expression,content:""},U=V.endPos}else if(L&&B.startsWith("@default")){if(W)q.push(W);W={type:"default",content:""},U+=L[0].length}else if(F&&B.startsWith("@break"))U+=F[0].length;else{if(W)W.content+=K[U];U++}}if(W)q.push(W);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:q,start:Z,end:G+10}}var _2=()=>{};function IU($){let Z=[],Y=0;while(Y<$.length){let X=$.indexOf("{{",Y),J=$.indexOf("{!!",Y),Q=!1,G;if(X===-1&&J===-1)break;else if(X===-1)G=J,Q=!0;else if(J===-1)G=X,Q=!1;else if(J<X)G=J,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let K=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?K==="{{{"?"}}}":"!!}":"}}",U=G+K.length,W=DU($,U,q);if(W===-1){Y=G+1;continue}let z=$.slice(U,W).trim(),B=W+q.length;Z.push({fullMatch:$.slice(G,B),expression:z,start:G,end:B,isRaw:Q}),Y=B}return Z}function DU($,Z,Y){let X=Z,J=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let K=$[X];if((X>0?$[X-1]:"")==="\\"&&J){X++;continue}if((K==='"'||K==="'")&&!J){J=K,X++;continue}if(K===J&&J!=="`"){J=null,X++;continue}if(K==="`"&&!J){J="`",X++;continue}if(K==="`"&&J==="`"&&G===0){J=null,X++;continue}if(J==="`"&&K==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(K==="{")G++;else if(K==="}")G--;X++;continue}if(J){X++;continue}if(K==="(")Q.paren++;else if(K===")")Q.paren--;else if(K==="[")Q.bracket++;else if(K==="]")Q.bracket--;else if(K==="{")Q.brace++;else if(K==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+Y.length)===Y)return X}X++}return-1}function EU($){let Z=y3($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=kU(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function kU($){let Z=$.trim();if(!Z)return null;let Y=Z.indexOf("(");if(Y===-1)return{name:Z,args:[]};let X=Z.slice(0,Y).trim(),J=Y+1,Q=O0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=O2(G);return{name:X,args:K}}function O2($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+="${",G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function SU($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=O0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function bU($){let Z=[],X=new W4($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),J=0;while(J<X.length){let Q=X[J],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,J++,J>=X.length)break}let K=X[J];if(K.type==="IDENTIFIER"&&(K.value==="const"||K.value==="let"||K.value==="var")){let q=K.value;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let W=U.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let z=J<X.length?X[J].start:$.length,B=j2(X,J,$);J=B.nextIndex,Z.push({type:"variable",name:W,value:$.slice(z,B.endPos),exported:G,start:K.start,end:B.endPos})}}else if(U.type==="PUNCTUATION"&&(U.value==="{"||U.value==="[")){let W=U.start,z=U.value==="{"?"}":"]",B=O0($,U.value,z,W);if(B!==-1){let _=$.slice(W,B+1);if(J=H2(X,B+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=j2(X,J,$);J=H.nextIndex;let L=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:L,value:`${$.slice(j,H.endPos)}; ${q} ${_} = ${L}`,exported:G,start:K.start,end:H.endPos})}}}}else if(K.type==="IDENTIFIER"&&K.value==="function"){let q=G?X[J-1].start:K.start;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let W=U.value;J++;let z=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){z=X[J].start;break}J++}if(z!==-1){let B=O0($,"{","}",z);if(B!==-1)Z.push({type:"function",name:W,value:$.slice(q,B+1).replace(/^export\s+/,""),exported:G,start:q,end:B+1}),J=H2(X,B+1)}}}else J++}return Z}function j2($,Z,Y){let X=Z,J={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:Y.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")J.paren++;else if(G.value===")")J.paren--;else if(G.value==="[")J.bracket++;else if(G.value==="]")J.bracket--;else if(G.value==="{")J.brace++;else if(G.value==="}")J.brace--;if(G.value===";"&&J.paren===0&&J.bracket===0&&J.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(J.paren===0&&J.bracket===0&&J.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function H2($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var L2=()=>{};var B4=C(()=>{_2();L2()});function yU($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=P3(X,G);if(!K)break;try{let q;if($0(K.expression))q=Z0(K.expression,Object.keys(Z))(...Object.values(Z));else q=e(K.expression,Z);let U="",W=!1;for(let z of K.cases)if(z.type==="default"){if(!W)U=z.content.trim()}else try{let B;if(z.value&&$0(z.value))B=Z0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=e(z.value,Z);if(q===B){U=z.content.trim(),W=!0;break}}catch{continue}X=X.substring(0,G)+U+X.substring(K.end),J=!0}catch(q){let U=q instanceof Error?q.message:String(q),W=r("Switch",`Error evaluating @switch expression: ${U}`,p.EVALUATION_ERROR);X=X.substring(0,G)+W+X.substring(K.end);break}}return X}function x1($,Z,Y){let X=$;X=yU(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=H1(X,K+7);if(!q)break;let U=q.endPos,W=v1(X,"unless","endunless",U);if(W===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(U,W),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(z))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(z))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(z))!==null)V.push({pos:R.index,type:"else"});V.sort((w,A)=>w.pos-A.pos);for(let w of V)if(w.type==="open")H++;else if(w.type==="close")H--;else if(w.type==="else"&&H===0){_=w.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(W+10),Q=!0}}X=v3(X,Z,Y),X=x3(X,Z,Y),X=C3(X,Z);let J=()=>{let Q=d5(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",U=!1;for(let W of K.branches){if(U)break;if(W.type==="else")q=W.content,U=!0;else try{let z;if(W.condition&&$0(W.condition))z=Z0(W.condition,Object.keys(Z))(...Object.values(Z));else if(W.condition)z=e(W.condition,Z);if(z)q=W.content,U=!0}catch(z){q=r(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${z instanceof Error?z.message:String(z)}`,p.EVALUATION_ERROR),U=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let U=q instanceof Error?q.message:String(q),W=r("If",`Error processing @if block: ${U}`,p.EVALUATION_ERROR);X=X.substring(0,K.start)+W+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function F2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function C3($,Z){let Y=$;function X(K,q,U,W){let z=1,B=W,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function J(K,q,U){let W=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${U}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")W++;else if(L.type==="close")W--;else if(L.type==="else"&&W===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let U=q.index,W,z,B=Y.slice(U+5),_=F2(B);if(_)W=_.value,z=U+5+_.consumed;else z=U+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=J(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=W?j1(`auth?.check && auth?.user?.[${W}]`,Z):j1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,U)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let U=q.index,W,z,B=Y.slice(U+6),_=F2(B);if(_)W=_.value,z=U+6+_.consumed;else z=U+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=J(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=W?j1(`!auth?.check || !auth?.user?.[${W}]`,Z):j1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,U)+O+Y.substring(j+9),K=!0}}function Q(K,q,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[K];if(q)W.push(q);if(U){let z=j1(U,Z);W.push(z)}return Z.permissions.check(...W)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,U=K==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),w=new RegExp(`@${q}(?![a-z])`,"g"),A=new RegExp(`@${U}\\s*\\(`,"g"),N=/@else(?![a-z])/g,M=[],T;while((T=R.exec(F))!==null)M.push({pos:T.index,type:"open"});while((T=w.exec(F))!==null)M.push({pos:T.index,type:"close"});while((T=A.exec(F))!==null)M.push({pos:T.index,type:"elseDirective"});while((T=N.exec(F))!==null)M.push({pos:T.index,type:"else"});M.sort((b,P)=>b.pos-P.pos);for(let b of M){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],D=0;for(let b=0;b<O.length;b++){let P=O[b];if(I.push({content:F.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let d=F.slice(P.pos+`@${U}`.length),f=G(d);if(f){I[I.length-1]={content:F.slice(D,P.pos)},D=P.pos+`@${U}`.length+f.paramsEnd,I.push({content:"",ability:f.ability,type:f.type,id:f.id}),I.pop();let m=O[b+1],o=m?m.pos:F.length;I.push({content:F.slice(D,o),ability:f.ability,type:f.type,id:f.id}),D=o}}else D=P.pos+5}if(D<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=Q(j.ability,j.type,j.id),k=K==="can"?E:!E,S="";if(k)S=I[0]?.content||"";else{let b=!1;for(let P=1;P<I.length;P++){let d=I[P];if(d.isFinalElse){S=d.content,b=!0;break}if(d.ability){let f=Q(d.ability,d.type,d.id);if(K==="can"?f:!f){S=d.content,b=!0;break}}}if(!b&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)S=P.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),W=!0}}return Y}function v3($,Z,Y){let X=$;function J(Q,G,K,q,U){let W=!0;while(W){W=!1;let z=new RegExp(`@${G}\\s*\\(`),B=Q.match(z);if(!B||B.index===void 0)break;let _=B.index,j=H1(Q,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=v1(Q,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,L),O=j.expression,V=-1,R=0,w=0;while(w<F.length){let A=F.indexOf("@",w);if(A===-1)break;let N=F.substring(A);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){R++,w=A+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){R--,w=A+1;continue}if(R===0&&/^@else(?![a-z])/.test(N)){V=A;break}w=A+1}try{let A=q(O.trim()),N;if(V!==-1){let M=F.slice(0,V),T=F.slice(V+5);N=A?M:T}else N=A?F:"";Q=Q.substring(0,_)+N+Q.substring(L+`@${K}`.length),W=!0}catch(A){let N=A instanceof Error?A.message:String(A),M=r(U,`Error processing @${G} directive: ${N}`,p.EVALUATION_ERROR);Q=Q.substring(0,_)+M+Q.substring(L+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=j1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=j1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function x3($,Z,Y){let X=$,J="development";function Q(G,K,q,U){let W=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,W.lastIndex=0;let L=W.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,U=J===E[2]}let V=1,R=O,w=-1;while(V>0&&R<j.length){W.lastIndex=R,z.lastIndex=R;let E=W.exec(j),k=z.exec(j),S=E?E.index:1/0,b=k?k.index:1/0;if(S<b)V++,R=S+E[0].length;else if(b<1/0){if(V--,V===0){w=b;break}R=b+k[0].length}else break}if(w===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let A=j.substring(O,w),N=-1,M=0,T=0;while(T<A.length){let E=A.indexOf("@",T);if(E===-1)break;let k=A.substring(E);if(B.test(k)){M++,T=E+1;continue}if(_.test(k)){M--,T=E+1;continue}if(M===0&&/^@else(?![a-z])/.test(k)){N=E;break}T=E+1}let I;if(N!==-1){let E=A.slice(0,N),k=A.slice(N+5);I=U?E:k}else I=U?A:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(w+D),H=!0}return j}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var _4=C(()=>{W2();J1();B4();F0()});function V2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function f1($,Z){if(!$)return Z?.nonceGenerator?.()??V2();let Y=f3.get($);if(!Y)Y=Z?.nonceGenerator?.()??V2(),f3.set($,Y);return Y}function Iw($){f3.delete($)}function w2($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function h3($,Z){return`<meta http-equiv="Content-Security-Policy" content="${w2($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Dw($){return{enabled:!0,directives:{strict:PU,moderate:g3,relaxed:CU,api:vU}[$]||g3,useNonce:$==="strict",addMetaTag:!0}}function Ew($,Z){let Y={...$};for(let[X,J]of Object.entries(Z)){let Q=X,G=Y[Q];if(J===void 0||J===null)continue;if(typeof J==="boolean")Y[Q]=G||J;else if(Array.isArray(J)){let K=Array.isArray(G)?G:[],q=[...new Set([...K,...J])];Y[Q]=q}}return Y}function R2($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?f1(Y,Z):void 0,J=h3(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3774
+ ${J}`)}function kw($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function A2($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?f1(Z,Q):void 0;return h3(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return f1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=f1(Z,Q);return J}function Sw(){return[xU,fU]}function bw($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[Y,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${Y} allows insecure resources`);return Z}function gU($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function yw($,Z){if(!$.enabled)return{};let Y=$.useNonce?f1(Z,$):void 0,X=w2($.directives,Y);return{[gU($.reportOnly)]:X}}var f3,PU,g3,CU,vU,xU,fU,Pw;var N2=C(()=>{f3=new WeakMap;PU={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},g3={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},CU={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},vU={"default-src":["'none'"],"frame-ancestors":["'none'"]};xU={name:"csp",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?f1(Y,Q):void 0;return h3(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},fU={name:"cspNonce",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return f1(Y,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};Pw={enabled:!1,reportOnly:!1,directives:g3,useNonce:!1,addMetaTag:!0}});import{Buffer as T2}from"buffer";import M2 from"crypto";function dU($=hU){let Z=M2.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return z5=Z,Z}function mU(){if(!z5)dU();return z5}function fw(){z5=null}function gw($){z5=$}function uU($=I2){let Z=mU();return`<input type="hidden" name="${$}" value="${Z}">`}function D2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return uU(X||I2)})}function hw($,Z){let Y=Z??z5;if(!Y)return!1;let X=T2.from($),J=T2.from(Y);if(X.length!==J.length)return!1;return M2.timingSafeEqual(X,J)}var hU=40,I2="_token",z5=null;var E2=()=>{};async function k2($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await lU(J,Q,Z,Y,X);else J=await pU(J,Q,Z,Y,X)}return J}async function lU($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,U=$,W=E1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=W.exec(U);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?S2(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);z.push({original:_,processed:r("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${O}`,p.EVALUATION_ERROR),startIndex:L})}B=W.exec(U)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];U=U.replace(j,H)}return U}async function pU($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,q=E1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],W=q.exec(K);while(W!==null){let[_,j=""]=W,H=W.index||0;try{let L=S2(j),F=await G("",L,Y,X);U.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(J.debug)console.error(`Error processing custom directive @${Q}:`,L);U.push({original:_,processed:r("CustomDirective",`Error in @${Q}(${j}): ${F}`,p.EVALUATION_ERROR),startIndex:H})}W=q.exec(K)}let z=E1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);U.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${Q}:`,H);U.push({original:_,processed:r("CustomDirective",`Error in @${Q}: ${L}`,p.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];K=K.replace(j,H)}return K}function S2($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var b2=C(()=>{J1();$5()});var d3={};l(d3,{useTitle:()=>rU,useSeoMeta:()=>H4,usePageTitle:()=>rU,useHead:()=>h1,resetHead:()=>nU,renderHtmlAttrs:()=>tU,renderHead:()=>aU,renderBodyAttrs:()=>eU,processTitleDirective:()=>YW,processMetaDirective:()=>XW,processHeadDirective:()=>ZW,getPageMeta:()=>iU,getHead:()=>m5,definePageMeta:()=>sU,applyHead:()=>$W});function m5(){return O1}function iU(){return j4}function nU(){O1={},cU.length=0,j4={}}function h1($){O1=oU(O1,$)}function oU($,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 H4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});h1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function sU($){if(j4={...j4,...$},$.title||$.description)H4({title:$.title,description:$.description})}function rU($){let Z=typeof $==="function"?$():$;h1({title:Z})}function aU($=O1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${g1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${g1(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${g1(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${g1(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${g1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
3775
3775
  `)}function tU($=O1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${g1(Y)}"`).join(" ")}function eU($=O1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${g1(Y)}"`).join(" ")}function g1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function $W($=O1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[J,Q]of Object.entries(Z))if(Q!==void 0)X.setAttribute(J,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function ZW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
3776
- `,""}),headContent:Z.trim()}}function YW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q;return h1({title:G}),""})}function XW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let q=Q?G:K,U=Q?q:Z[(q||"").trim()]??q,z=J.includes(":")?{property:J,content:U}:{name:J,content:U};return h1({meta:[z]}),""})}var O1,cU,j4;var u5=P(()=>{O1={},cU=[],j4={}});import JW from"crypto";function w0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function QW($){return{...m3,...$.forms?.classes}}function O4($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function GW(){return JW.randomUUID()}function iw($,Z,Y,X){let J=QW(X),Q=$;return Q=qW(Q,Z),Q=c5(Q,Z),Q=u3(Q,Z,J),Q=l3(Q,Z,J),Q}function c5($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=GW();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${w0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${w0(Q)}">`;return X}),Y}function u3($,Z,Y=m3){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,q,U="")=>{let W=Q||G||"POST",z=K||q||"",B=L1(U),_=W.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${w0(j)}" action="${w0(z)}"${B?` ${B}`:""}>`;if(H+=`
3776
+ `,""}),headContent:Z.trim()}}function YW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q;return h1({title:G}),""})}function XW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let q=Q?G:K,U=Q?q:Z[(q||"").trim()]??q,z=J.includes(":")?{property:J,content:U}:{name:J,content:U};return h1({meta:[z]}),""})}var O1,cU,j4;var u5=C(()=>{O1={},cU=[],j4={}});import JW from"crypto";function w0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function QW($){return{...m3,...$.forms?.classes}}function O4($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function GW(){return JW.randomUUID()}function iw($,Z,Y,X){let J=QW(X),Q=$;return Q=qW(Q,Z),Q=c5(Q,Z),Q=u3(Q,Z,J),Q=l3(Q,Z,J),Q}function c5($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=GW();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${w0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${w0(Q)}">`;return X}),Y}function u3($,Z,Y=m3){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,q,U="")=>{let W=Q||G||"POST",z=K||q||"",B=L1(U),_=W.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${w0(j)}" action="${w0(z)}"${B?` ${B}`:""}>`;if(H+=`
3777
3777
  ${c5("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
3778
3778
  ${c5(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,q,U="")=>{let W=Q||G||"",z=K||q||"",B=L1(U),_=l5(W,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=p5(W,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=O4(O?O[1]:"",Y.input,F,Y.inputError),R=B.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${w0(L)}" name="${w0(W)}" value="${w0(j)}" class="${V}"${R?` ${R}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let q=L1(G),U=l5(Q,Z)||K.trim(),W=p5(Q,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=O4(z?z[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${w0(Q)}" class="${B}"${_?` ${_}`:""}>${w0(U)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let q=L1(G),U=l5(Q,Z),W=p5(Q,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=O4(z?z[1]:"",Y.input,W,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(U!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(U)?U.some((V)=>String(V)===F):String(U)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${w0(Q)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="1",K="")=>{let q=L1(K),U=l5(Q,Z),W=U!==void 0&&(Array.isArray(U)?U.some((j)=>String(j)===G):U===!0||String(U)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${w0(Q)}" value="${w0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=L1(K),U=l5(Q,Z),W=U!==void 0&&U===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${w0(Q)}" value="${w0(G)}" class="${B}"${W?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=L1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),U=q?q[1]:"",W=K.includes("multiple"),z=p5(Q,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=O4(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${w0(Q)}"`,`class="${_}"`];if(U)H.push(`accept="${w0(U)}"`);if(W)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let q=L1(G),U=q.match(/class=['"]([^'"]+)['"]/i),W=U?U[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${w0(Q)}" class="${W}"${z?` ${z}`:""}>${K}</label>`}),X}function l3($,Z,Y=m3){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(p5(J,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return y2(J,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return y2(J,Z)}let q=K.trim();if($0(q)){let U=e(q,Z);return U!==void 0?String(U):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function p5($,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 y2($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function l5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function L1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}function nw($,Z){P2[$]=Z}function p3($){let[Z,...Y]=$.split(":"),X=Y.length>0?Y.join(":").split(","):[];return{name:Z.trim(),params:X}}function KW($,Z,Y,X={}){let J=[],Q=Y.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let K=p3(G),q=P2[K.name];if(!q){console.warn(`Unknown validation rule: ${K.name}`);continue}if(K.name==="confirmed"){let W=`${$}_confirmation`;K.params=[X[W]]}let U=q(Z,K.params||[],$);if(U)J.push(K.message||U)}return{field:$,valid:J.length===0,errors:J}}function ow($,Z){let Y={};for(let[X,J]of Object.entries(Z)){let Q=KW(X,$[X],J,$);if(!Q.valid)Y[X]=Q.errors}return Y}function qW($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(Y,X,J,Q)=>{let G=J.split("|").map((q)=>q.trim()),K=[];for(let q of G){let U=p3(q);switch(U.name){case"required":K.push("required");break;case"email":K.push('type="email"');break;case"url":K.push('type="url"');break;case"numeric":case"integer":if(K.push('type="number"'),U.name==="integer")K.push('step="1"');break;case"min":if(U.params?.[0])K.push(`minlength="${U.params[0]}"`);break;case"max":if(U.params?.[0])K.push(`maxlength="${U.params[0]}"`);break;case"regex":if(U.params?.[0])K.push(`pattern="${U.params[0]}"`);break}}return`<!-- @validate:${X}:${J} -->${K.length>0?`<!-- attrs:${K.join(" ")} -->`:""}`})}function sw($){C2[$.name]=$}function UW($,Z,Y={}){let X=[],J=Z.split("|").map((Q)=>Q.trim());for(let Q of J){let G=p3(Q),K=C2[G.name];if(!K){console.warn(`Unknown validation rule: ${G.name}`);continue}let q=K.validate($,G.params||[],Y);if(q!==!0)X.push(q)}return{valid:X.length===0,errors:X}}function rw($,Z){let Y={},X=!0;for(let[J,Q]of Object.entries(Z)){let G=UW($[J],Q,$);if(!G.valid)X=!1,Y[J]=G.errors}return{valid:X,errors:Y}}function aw($,Z){let Y=JSON.stringify(Z);return`
3779
3779
  <script>
@@ -3827,8 +3827,8 @@ catch { return 'Please enter a valid URL'; } },
3827
3827
  }
3828
3828
  });
3829
3829
  })();
3830
- </script>`.trim()}var m3,P2,C2;var v2=P(()=>{F0();m3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};P2={required:($,Z,Y)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${Y} field is required.`;return null},email:($,Z,Y)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${Y} field must be a valid email address.`;return null},min:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${Y} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${Y} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${Y} field must have at least ${X} items.`;return null},max:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${Y} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${Y} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${Y} field must not have more than ${X} items.`;return null},confirmed:($,Z,Y)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${Y} confirmation does not match.`;return null},numeric:($,Z,Y)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${Y} field must be a number.`;return null},integer:($,Z,Y)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${Y} field must be an integer.`;return null},alpha:($,Z,Y)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${Y} field must only contain letters.`;return null},alphanumeric:($,Z,Y)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${Y} field must only contain letters and numbers.`;return null},url:($,Z,Y)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${Y} field must be a valid URL.`}},regex:($,Z,Y)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${Y} field format is invalid.`;return null}catch{return`The ${Y} field has an invalid validation pattern.`}},in:($,Z,Y)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${Y} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,Y)=>{if(!$)return null;if(Z.includes(String($)))return`The ${Y} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,Y)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${Y} field must be a valid date.`;return null},before:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X>=J)return`The ${Y} field must be before ${Z[0]}.`;return null},after:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X<=J)return`The ${Y} field must be after ${Z[0]}.`;return null}};C2={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length>=Y||`Must be at least ${Y} characters`;if(typeof $==="number")return $>=Y||`Must be at least ${Y}`;if(Array.isArray($))return $.length>=Y||`Must have at least ${Y} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length<=Y||`Must be no more than ${Y} characters`;if(typeof $==="number")return $<=Y||`Must be no more than ${Y}`;if(Array.isArray($))return $.length<=Y||`Must have no more than ${Y} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[Y,X]=Z.map(Number);if(typeof $==="string")return $.length>=Y&&$.length<=X||`Must be between ${Y} and ${X} characters`;if(typeof $==="number")return $>=Y&&$<=X||`Must be between ${Y} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,Y)=>{let X=Object.keys(Y);for(let J of X)if(J.endsWith("_confirmation")&&Y[J]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length===Y||`Must be exactly ${Y} characters`;if(Array.isArray($))return $.length===Y||`Must have exactly ${Y} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}}});var dW={};l(dW,{waitForLocale:()=>VW,processTranslateDirective:()=>s3,preloadTranslationsBackground:()=>LW,preloadTranslations:()=>g2,loadTranslationLazy:()=>n5,loadTranslation:()=>d2,isLoading:()=>HW,isLoaded:()=>OW,isICUFormat:()=>l2,getTranslationSync:()=>h2,getTranslationCacheStats:()=>BW,getTranslationAsync:()=>FW,getTranslation:()=>L4,getLoadingState:()=>jW,getLoadingLocales:()=>wW,formatICU:()=>m2,defaultI18nConfig:()=>F4,createTranslateFilter:()=>hW,clearTranslationCache:()=>zW,cancelPendingLoads:()=>RW});import i3 from"path";async function WW(){if(i5!==void 0)return i5;try{i5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{i5=null}return i5}function zW($){if($)delete k0[$];else for(let Z of Object.keys(k0))delete k0[Z]}function BW(){let $=Object.entries(k0).map(([Z,Y])=>({locale:Z,loadedAt:new Date(Y.loadedAt),keyCount:f2(Y.translations)}));return{size:Object.keys(k0).length,locales:Object.keys(k0),entries:$}}function f2($,Z=0){for(let Y of Object.values($))if(Z++,Y&&typeof Y==="object"&&!Array.isArray(Y))Z=f2(Y,Z);return Z}function _W($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function jW($){if(k0[$])return"loaded";return G1[$]||"idle"}function HW($){return G1[$]==="loading"}function OW($){return!!k0[$]}async function g2($,Z){let{locales:Y,parallel:X=!0,priority:J={},onLocaleLoaded:Q,onComplete:G,onError:K}=$,q=X?Y:[...Y].sort((U,W)=>(J[W]||0)-(J[U]||0));if(X){let U=q.map(async(W)=>{try{await n5(W,Z),Q?.(W)}catch(z){K?.(W,z instanceof Error?z:Error(String(z)))}});await Promise.all(U)}else for(let U of q)try{await n5(U,Z),Q?.(U)}catch(W){K?.(U,W instanceof Error?W:Error(String(W)))}G?.()}function LW($,Z){queueMicrotask(()=>{g2($,Z).catch((Y)=>{if(Z.debug)console.error("Background preload error:",Y)})})}async function n5($,Z){if({...F4,...Z.i18n}.cache&&k0[$]){let J=k0[$],Q=Z.i18n?.cacheMaxAge??0;if(!_W(J,Q))return J.translations}if(p0[$]?.state==="loading")return p0[$].promise;G1[$]="loading";let X=n3($,Z).then((J)=>{return G1[$]="loaded",delete p0[$],J}).catch((J)=>{throw G1[$]="error",p0[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return p0[$]={promise:X,state:"loading"},X}function h2($){return k0[$]?.translations}async function FW($,Z){let Y=h2($);if(Y)return Y;return n5($,Z)}async function VW($,Z){if(k0[$])return k0[$].translations;if(p0[$]){if(Z)return Promise.race([p0[$].promise,new Promise((Y,X)=>setTimeout(()=>X(Error(`Timeout waiting for locale: ${$}`)),Z))]);return p0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function wW(){return Object.entries(G1).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function RW($){if($)delete p0[$],delete G1[$];else{for(let Z of Object.keys(p0))delete p0[Z];for(let Z of Object.keys(G1))delete G1[Z]}}async function n3($,Z){let Y={...F4,...Z.i18n},X=i3.isAbsolute(Y.translationsDir)?Y.translationsDir:i3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let J=await WW(),Q=J?await J($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:IW(Y.format)}):await AW($,Y,X);if(Q===void 0){if($!==Y.defaultLocale)return n3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)k0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Y.defaultLocale)return n3(Y.defaultLocale,Z);return{}}}async function AW($,Z,Y){let X=i3.join(Y,`${$}${NW(Z.format)}`);try{let J=await import(X);return J.default||J}catch(J){try{let Q=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return TW(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function NW($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function TW($){let Z={},Y=$.split(`
3831
- `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,U,W]=q,z=U.trim(),B=W.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=MW(B)}}return Z}function MW($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function IW($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function d2($,Z){return n5($,Z)}function DW($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function m2($,Z={}){return u2($,Z)}function u2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=EW($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=kW(Q,Z),X=J+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function EW($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function kW($,Z){let Y=SW($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return bW(J,Y.slice(2).join(","),Z);case"select":return PW(J,Y.slice(2).join(","));case"selectordinal":return CW(J,Y.slice(2).join(","));case"number":return xW(J,Y[2]?.trim());case"date":return fW(J,Y[2]?.trim());case"time":return gW(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function SW($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function bW($,Z,Y){let X=Number($)||0,J=o3(Z),Q=`=${X}`;if(J[Q])return c3(J[Q],X,Y);let G=yW(X);if(J[G])return c3(J[G],X,Y);if(J.other)return c3(J.other,X,Y);return String(X)}function c3($,Z,Y){let X=$.replace(/#/g,String(Z));return u2(X,Y)}function yW($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function PW($,Z){let Y=String($||""),X=o3(Z);if(X[Y])return X[Y];return X.other||String($)}function CW($,Z){let Y=Number($)||0,X=o3(Z),J=vW(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function vW($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function o3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function xW($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function fW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function gW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function l2($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function L4($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(l2(G))return m2(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=DW(q,K)}for(let[K,q]of Object.entries(X)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(q))}return G}async function s3($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...F4,...X.i18n},K=await d2(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await x2(J,Q,async(W,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return j0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return L4(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return r("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,p.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...J.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return J=await x2(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return j0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return L4(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return r("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,p.EVALUATION_ERROR)}}),J}async function x2($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}function hW($,Z=!0){return(Y,X={})=>{return L4(Y,$,Z,X)}}var i5,F4,k0,p0,G1;var p2=P(()=>{J1();F0();F4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},k0={},p0={},G1={}});var t3={};l(t3,{streamingSuspenseDirective:()=>n2,streamToResponse:()=>tW,streamTemplateSimple:()=>oW,streamTemplate:()=>uW,renderStreamingPage:()=>pW,registerStreamingDirectives:()=>rW,processStreamDirectives:()=>iW,processSectionDirectives:()=>aW,islandDirective:()=>o2,generateHydrationRuntime:()=>eW,extractStreamBoundaries:()=>nW,createStreamRenderer:()=>sW,buildSuspenseResolveScript:()=>a3,SUSPENSE_RESOLVER_RUNTIME:()=>i2});import V4 from"path";function mW($){let Z=[],Y=0,X;c2.lastIndex=0;while((X=c2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let J=X[1],Q=X[2];Z.push({type:"suspense",name:J,content:Q}),Y=X.index+X[0].length}if(Y<$.length){let J=$.slice(Y);if(J.trim())Z.push({type:Z.length===0?"shell":"content",content:J})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function uW($,Z={},Y={}){let X={...C1,...Y,streaming:{...r3,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:V4.dirname($)};if(q.trim())await m1(q,W,$);let z=mW(U),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(d1.source,"g");if(!(j!=="manual"&&H.test(U))){let F=await R0(U,W,$,X,B);for(let O=0;O<F.length;O+=J)Q.enqueue(F.slice(O,O+J)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(d1.source,"g"),V;while((V=O.exec(U))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let R=0;for(let w of F){if(w.start>R){let N=U.slice(R,w.start);if(N.trim()){let M=await R0(N,W,$,X,B);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let A=await R0(w.content,W,$,X,B);Q.enqueue(A),await new Promise((N)=>setTimeout(N,0)),R=w.end}if(R<U.length){let w=U.slice(R);if(w.trim()){let A=await R0(w,W,$,X,B);Q.enqueue(A)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await R0(L.content,W,$,X,B);Q.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3830
+ </script>`.trim()}var m3,P2,C2;var v2=C(()=>{F0();m3={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};P2={required:($,Z,Y)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${Y} field is required.`;return null},email:($,Z,Y)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${Y} field must be a valid email address.`;return null},min:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length<X)return`The ${Y} field must be at least ${X} characters.`;if(typeof $==="number"&&$<X)return`The ${Y} field must be at least ${X}.`;if(Array.isArray($)&&$.length<X)return`The ${Y} field must have at least ${X} items.`;return null},max:($,Z,Y)=>{if(!$)return null;let X=Number(Z[0]);if(typeof $==="string"&&$.length>X)return`The ${Y} field must not exceed ${X} characters.`;if(typeof $==="number"&&$>X)return`The ${Y} field must not exceed ${X}.`;if(Array.isArray($)&&$.length>X)return`The ${Y} field must not have more than ${X} items.`;return null},confirmed:($,Z,Y)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${Y} confirmation does not match.`;return null},numeric:($,Z,Y)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${Y} field must be a number.`;return null},integer:($,Z,Y)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${Y} field must be an integer.`;return null},alpha:($,Z,Y)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${Y} field must only contain letters.`;return null},alphanumeric:($,Z,Y)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${Y} field must only contain letters and numbers.`;return null},url:($,Z,Y)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${Y} field must be a valid URL.`}},regex:($,Z,Y)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${Y} field format is invalid.`;return null}catch{return`The ${Y} field has an invalid validation pattern.`}},in:($,Z,Y)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${Y} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,Y)=>{if(!$)return null;if(Z.includes(String($)))return`The ${Y} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,Y)=>{if(!$)return null;let X=new Date($);if(Number.isNaN(X.getTime()))return`The ${Y} field must be a valid date.`;return null},before:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X>=J)return`The ${Y} field must be before ${Z[0]}.`;return null},after:($,Z,Y)=>{if(!$)return null;let X=new Date($),J=new Date(Z[0]);if(X<=J)return`The ${Y} field must be after ${Z[0]}.`;return null}};C2={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length>=Y||`Must be at least ${Y} characters`;if(typeof $==="number")return $>=Y||`Must be at least ${Y}`;if(Array.isArray($))return $.length>=Y||`Must have at least ${Y} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length<=Y||`Must be no more than ${Y} characters`;if(typeof $==="number")return $<=Y||`Must be no more than ${Y}`;if(Array.isArray($))return $.length<=Y||`Must have no more than ${Y} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[Y,X]=Z.map(Number);if(typeof $==="string")return $.length>=Y&&$.length<=X||`Must be between ${Y} and ${X} characters`;if(typeof $==="number")return $>=Y&&$<=X||`Must be between ${Y} and ${X}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,Y)=>{let X=Object.keys(Y);for(let J of X)if(J.endsWith("_confirmation")&&Y[J]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y<X||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let Y=new Date(String($)),X=new Date(Z[0]);return Y>X||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let Y=Number(Z[0]);if(typeof $==="string")return $.length===Y||`Must be exactly ${Y} characters`;if(Array.isArray($))return $.length===Y||`Must have exactly ${Y} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}}});var dW={};l(dW,{waitForLocale:()=>VW,processTranslateDirective:()=>s3,preloadTranslationsBackground:()=>LW,preloadTranslations:()=>g2,loadTranslationLazy:()=>n5,loadTranslation:()=>d2,isLoading:()=>HW,isLoaded:()=>OW,isICUFormat:()=>l2,getTranslationSync:()=>h2,getTranslationCacheStats:()=>BW,getTranslationAsync:()=>FW,getTranslation:()=>L4,getLoadingState:()=>jW,getLoadingLocales:()=>wW,formatICU:()=>m2,defaultI18nConfig:()=>F4,createTranslateFilter:()=>hW,clearTranslationCache:()=>zW,cancelPendingLoads:()=>RW});import i3 from"path";async function WW(){if(i5!==void 0)return i5;try{i5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{i5=null}return i5}function zW($){if($)delete k0[$];else for(let Z of Object.keys(k0))delete k0[Z]}function BW(){let $=Object.entries(k0).map(([Z,Y])=>({locale:Z,loadedAt:new Date(Y.loadedAt),keyCount:f2(Y.translations)}));return{size:Object.keys(k0).length,locales:Object.keys(k0),entries:$}}function f2($,Z=0){for(let Y of Object.values($))if(Z++,Y&&typeof Y==="object"&&!Array.isArray(Y))Z=f2(Y,Z);return Z}function _W($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}function jW($){if(k0[$])return"loaded";return G1[$]||"idle"}function HW($){return G1[$]==="loading"}function OW($){return!!k0[$]}async function g2($,Z){let{locales:Y,parallel:X=!0,priority:J={},onLocaleLoaded:Q,onComplete:G,onError:K}=$,q=X?Y:[...Y].sort((U,W)=>(J[W]||0)-(J[U]||0));if(X){let U=q.map(async(W)=>{try{await n5(W,Z),Q?.(W)}catch(z){K?.(W,z instanceof Error?z:Error(String(z)))}});await Promise.all(U)}else for(let U of q)try{await n5(U,Z),Q?.(U)}catch(W){K?.(U,W instanceof Error?W:Error(String(W)))}G?.()}function LW($,Z){queueMicrotask(()=>{g2($,Z).catch((Y)=>{if(Z.debug)console.error("Background preload error:",Y)})})}async function n5($,Z){if({...F4,...Z.i18n}.cache&&k0[$]){let J=k0[$],Q=Z.i18n?.cacheMaxAge??0;if(!_W(J,Q))return J.translations}if(p0[$]?.state==="loading")return p0[$].promise;G1[$]="loading";let X=n3($,Z).then((J)=>{return G1[$]="loaded",delete p0[$],J}).catch((J)=>{throw G1[$]="error",p0[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return p0[$]={promise:X,state:"loading"},X}function h2($){return k0[$]?.translations}async function FW($,Z){let Y=h2($);if(Y)return Y;return n5($,Z)}async function VW($,Z){if(k0[$])return k0[$].translations;if(p0[$]){if(Z)return Promise.race([p0[$].promise,new Promise((Y,X)=>setTimeout(()=>X(Error(`Timeout waiting for locale: ${$}`)),Z))]);return p0[$].promise}throw Error(`Locale "${$}" is not loading. Call loadTranslationLazy first.`)}function wW(){return Object.entries(G1).filter(([$,Z])=>Z==="loading").map(([$])=>$)}function RW($){if($)delete p0[$],delete G1[$];else{for(let Z of Object.keys(p0))delete p0[Z];for(let Z of Object.keys(G1))delete G1[Z]}}async function n3($,Z){let Y={...F4,...Z.i18n},X=i3.isAbsolute(Y.translationsDir)?Y.translationsDir:i3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let J=await WW(),Q=J?await J($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:IW(Y.format)}):await AW($,Y,X);if(Q===void 0){if($!==Y.defaultLocale)return n3(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)k0[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Y.defaultLocale)return n3(Y.defaultLocale,Z);return{}}}async function AW($,Z,Y){let X=i3.join(Y,`${$}${NW(Z.format)}`);try{let J=await import(X);return J.default||J}catch(J){try{let Q=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return TW(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function NW($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function TW($){let Z={},Y=$.split(`
3831
+ `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,U,W]=q,z=U.trim(),B=W.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=MW(B)}}return Z}function MW($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function IW($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function d2($,Z){return n5($,Z)}function DW($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function m2($,Z={}){return u2($,Z)}function u2($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=EW($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=kW(Q,Z),X=J+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function EW($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function kW($,Z){let Y=SW($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return bW(J,Y.slice(2).join(","),Z);case"select":return PW(J,Y.slice(2).join(","));case"selectordinal":return CW(J,Y.slice(2).join(","));case"number":return xW(J,Y[2]?.trim());case"date":return fW(J,Y[2]?.trim());case"time":return gW(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function SW($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function bW($,Z,Y){let X=Number($)||0,J=o3(Z),Q=`=${X}`;if(J[Q])return c3(J[Q],X,Y);let G=yW(X);if(J[G])return c3(J[G],X,Y);if(J.other)return c3(J.other,X,Y);return String(X)}function c3($,Z,Y){let X=$.replace(/#/g,String(Z));return u2(X,Y)}function yW($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function PW($,Z){let Y=String($||""),X=o3(Z);if(X[Y])return X[Y];return X.other||String($)}function CW($,Z){let Y=Number($)||0,X=o3(Z),J=vW(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function vW($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function o3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function xW($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function fW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function gW($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function l2($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function L4($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(l2(G))return m2(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=DW(q,K)}for(let[K,q]of Object.entries(X)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(q))}return G}async function s3($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...F4,...X.i18n},K=await d2(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await x2(J,Q,async(W,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return j0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return L4(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return r("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,p.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...J.matchAll(q)];console.warn(`Found ${W.length} @translate matches`),W.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return J=await x2(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return j0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return L4(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return r("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,p.EVALUATION_ERROR)}}),J}async function x2($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}function hW($,Z=!0){return(Y,X={})=>{return L4(Y,$,Z,X)}}var i5,F4,k0,p0,G1;var p2=C(()=>{J1();F0();F4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},k0={},p0={},G1={}});var t3={};l(t3,{streamingSuspenseDirective:()=>n2,streamToResponse:()=>tW,streamTemplateSimple:()=>oW,streamTemplate:()=>uW,renderStreamingPage:()=>pW,registerStreamingDirectives:()=>rW,processStreamDirectives:()=>iW,processSectionDirectives:()=>aW,islandDirective:()=>o2,generateHydrationRuntime:()=>eW,extractStreamBoundaries:()=>nW,createStreamRenderer:()=>sW,buildSuspenseResolveScript:()=>a3,SUSPENSE_RESOLVER_RUNTIME:()=>i2});import V4 from"path";function mW($){let Z=[],Y=0,X;c2.lastIndex=0;while((X=c2.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let J=X[1],Q=X[2];Z.push({type:"suspense",name:J,content:Q}),Y=X.index+X[0].length}if(Y<$.length){let J=$.slice(Y);if(J.trim())Z.push({type:Z.length===0?"shell":"content",content:J})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function uW($,Z={},Y={}){let X={...C1,...Y,streaming:{...r3,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...Z,__filename:$,__dirname:V4.dirname($)};if(q.trim())await m1(q,W,$);let z=mW(U),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(d1.source,"g");if(!(j!=="manual"&&H.test(U))){let F=await R0(U,W,$,X,B);for(let O=0;O<F.length;O+=J)Q.enqueue(F.slice(O,O+J)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(d1.source,"g"),V;while((V=O.exec(U))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let R=0;for(let w of F){if(w.start>R){let N=U.slice(R,w.start);if(N.trim()){let M=await R0(N,W,$,X,B);Q.enqueue(M),await new Promise((T)=>setTimeout(T,0))}}let A=await R0(w.content,W,$,X,B);Q.enqueue(A),await new Promise((N)=>setTimeout(N,0)),R=w.end}if(R<U.length){let w=U.slice(R);if(w.trim()){let A=await R0(w,W,$,X,B);Q.enqueue(A)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await R0(L.content,W,$,X,B);Q.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;Q.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3832
3832
  <template data-suspense-fallback>Loading...</template>
3833
3833
  </div>`),j.set(L.name,R0(L.content,W,$,X,B))}Q.enqueue(`
3834
3834
  <script>
@@ -4014,25 +4014,25 @@ else {
4014
4014
  }
4015
4015
  };
4016
4016
  })();
4017
- </script>`,cW,n2,o2;var e3=P(()=>{g5();r0();w4();V0();r3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},d1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,c2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;cW=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;n2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},o2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",U=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
4017
+ </script>`,cW,n2,o2;var e3=C(()=>{g5();r0();w4();V0();r3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},d1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,c2=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;cW=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;n2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},o2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",U=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
4018
4018
  ${U}
4019
4019
  <script type="application/json" data-island-props="${G}">
4020
4020
  ${q?`{${q}}`:"{}"}
4021
4021
  </script>
4022
4022
  </div>`}}});var a2={};l(a2,{warnUnbalancedTags:()=>$6,findUnbalancedTags:()=>r2});function F1($){return $.replace(/[^\n]/g," ")}function r2($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,F1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,F1).replace(/<!--[\s\S]*?-->/g,F1).replace(/\{\{\{[\s\S]*?\}\}\}/g,F1).replace(/\{\{[\s\S]*?\}\}/g,F1).replace(/\{!![\s\S]*?!!\}/g,F1).replace(/"[^"]*"/g,F1).replace(/'[^']*'/g,F1),Y=new Map,X=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,Q;while((Q=J.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],U=Q[3]==="/";if($z.has(q.toLowerCase()))continue;if(U)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let W=Y.get(q);if(W)W.count++;else{let z=Z.slice(0,Q.index).split(`
4023
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(Zz.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,U=X.get(K)??0;if(q!==U)G.push({tag:K,opened:q,closed:U,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function $6($,Z){let Y;try{Y=r2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(s2.has(X))return;s2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let U=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${U} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var $z,Zz,s2;var Z6=P(()=>{$z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Zz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);s2=new Set});import h0 from"path";import Y6 from"fs";function t2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function e2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class $Y{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let _=[J,J.toLowerCase(),t2(J),e2(J)];for(let j of _)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${t2(J)}.stx`,`${e2(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let _=h0.resolve(h0.dirname(Z),`${J}.stx`);if(await i(_))return _;return null}let K=[],q=Y.componentsDir||"",U=X?.__originalFilePath;if(U)K.push(h0.join(h0.dirname(U),"components"));if(q)K.push(q);let W=h0.join(h0.dirname(Z),"components");if(!K.includes(W))K.push(W);let z=process.cwd(),B=[h0.resolve(z,"src/components"),h0.resolve(z,"components"),h0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=h0.join(_,j);if(await i(H))return H}try{if(!Y6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Y6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=h0.join(_,L.name);for(let O of G){let V=h0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var S0;var X6=P(()=>{V0();S0=new $Y});function V1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yz($){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 J6;var Q6=P(()=>{J6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=Yz($),J=(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,q=[];if(X.reactive)q.push(`:href="${V1(X.value)}"`);else q.push(`href="${V1(X.value)}"`);if(J)q.push(`class="${V1(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${V1(Q)}"`),q.push(`data-stx-exact-active-class="${V1(G)}"`),K)q.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,z]of Object.entries($.static)){if(U.has(W))continue;if(typeof z==="boolean"){if(z)q.push(V1(W))}else q.push(`${V1(W)}="${V1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function I0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function K6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function ZY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=Xz[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function q6($,Z,Y,X){return Z.map((J)=>`${o5($,J,void 0,Y,X)} ${J}w`).join(", ")}function Jz($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${o5($,G,void 0,X,J)} ${Q}x`}).join(", ")}function o5($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function Qz($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Xz,G6,U6;var W6=P(()=>{Xz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},G6=[320,640,768,1024,1280,1536,1920];U6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=I0($,"src")||"",J=I0($,"alt")||"",Q=I0($,"width"),G=I0($,"height"),K=I0($,"sizes"),q=I0($,"srcset"),U=I0($,"densities"),W=I0($,"format"),z=I0($,"placeholder"),B=I0($,"placeholderColor")||"#e5e7eb",_=I0($,"provider"),j=I0($,"class")||I0($,"className")||"",H=I0($,"style")||"",L=I0($,"quality"),F=K6($,"lazy",!0),O=K6($,"preload",!1),V=K6($,"picture",!1)||!!W,R=Q?Number.parseInt(Q):void 0,w=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=q6(X,G6,_,W),N=ZY(K);else if(!A&&U){let S=U.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));A=Jz(X,S,R,_,W)}else if(K)N=ZY(K);let M=[];if(H)M.push(H);if(R&&w)M.push(`aspect-ratio:${R}/${w}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=Qz(R||16,w||9,B);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")M.push(`background-image:url(${B0(z)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=o5(X,R,w,_,W),I=[];if(I.push(`src="${B0(T)}"`),I.push(`alt="${B0(J)}"`),Q)I.push(`width="${B0(Q)}"`);if(G)I.push(`height="${B0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${B0(j)}"`);if(M.length>0)I.push(`style="${B0(M.join(";"))}"`);if(A)I.push(`srcset="${B0(A)}"`);if(N)I.push(`sizes="${B0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(D.has(S))continue;if(typeof b==="boolean"){if(b)I.push(B0(S))}else I.push(`${B0(S)}="${B0(b)}"`)}let E=`<img ${I.join(" ")} />`,k="";if(O){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";k=`<link rel="preload" as="image" href="${B0(T)}"${b?` type="${b}"`:""}${A?` imagesrcset="${B0(A)}"`:""}${N?` imagesizes="${B0(N)}"`:""} />
4024
- `}if(V){let S=[];if(W==="avif"||W==="auto"){let b=o5(X,R,w,_,"avif"),y=A?q6(X,G6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${B0(y)}"${N?` sizes="${B0(N)}"`:""} />`)}if(W==="webp"||W==="auto"){let b=o5(X,R,w,_,"webp"),y=A?q6(X,G6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${B0(y)}"${N?` sizes="${B0(N)}"`:""} />`)}return`${k}<picture>
4023
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(Zz.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,U=X.get(K)??0;if(q!==U)G.push({tag:K,opened:q,closed:U,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function $6($,Z){let Y;try{Y=r2($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(s2.has(X))return;s2.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let U=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${U} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var $z,Zz,s2;var Z6=C(()=>{$z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Zz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);s2=new Set});import h0 from"path";import Y6 from"fs";function t2($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function e2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class $Y{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let _=[J,J.toLowerCase(),t2(J),e2(J)];for(let j of _)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${t2(J)}.stx`,`${e2(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let _=h0.resolve(h0.dirname(Z),`${J}.stx`);if(await i(_))return _;return null}let K=[],q=Y.componentsDir||"",U=X?.__originalFilePath;if(U)K.push(h0.join(h0.dirname(U),"components"));if(q)K.push(q);let W=h0.join(h0.dirname(Z),"components");if(!K.includes(W))K.push(W);let z=process.cwd(),B=[h0.resolve(z,"src/components"),h0.resolve(z,"components"),h0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=h0.join(_,j);if(await i(H))return H}try{if(!Y6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Y6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=h0.join(_,L.name);for(let O of G){let V=h0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var S0;var X6=C(()=>{V0();S0=new $Y});function V1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yz($){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 J6;var Q6=C(()=>{J6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=Yz($),J=(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,q=[];if(X.reactive)q.push(`:href="${V1(X.value)}"`);else q.push(`href="${V1(X.value)}"`);if(J)q.push(`class="${V1(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${V1(Q)}"`),q.push(`data-stx-exact-active-class="${V1(G)}"`),K)q.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[W,z]of Object.entries($.static)){if(U.has(W))continue;if(typeof z==="boolean"){if(z)q.push(V1(W))}else q.push(`${V1(W)}="${V1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function B0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function K6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function ZY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=Xz[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function q6($,Z,Y,X){return Z.map((J)=>`${o5($,J,void 0,Y,X)} ${J}w`).join(", ")}function Jz($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${o5($,G,void 0,X,J)} ${Q}x`}).join(", ")}function o5($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function Qz($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var Xz,G6,U6;var W6=C(()=>{Xz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},G6=[320,640,768,1024,1280,1536,1920];U6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=D0($,"src")||"",J=D0($,"alt")||"",Q=D0($,"width"),G=D0($,"height"),K=D0($,"sizes"),q=D0($,"srcset"),U=D0($,"densities"),W=D0($,"format"),z=D0($,"placeholder"),B=D0($,"placeholderColor")||"#e5e7eb",_=D0($,"provider"),j=D0($,"class")||D0($,"className")||"",H=D0($,"style")||"",L=D0($,"quality"),F=K6($,"lazy",!0),O=K6($,"preload",!1),V=K6($,"picture",!1)||!!W,R=Q?Number.parseInt(Q):void 0,w=G?Number.parseInt(G):void 0,A=q||"",N="";if(!A&&K)A=q6(X,G6,_,W),N=ZY(K);else if(!A&&U){let S=U.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));A=Jz(X,S,R,_,W)}else if(K)N=ZY(K);let M=[];if(H)M.push(H);if(R&&w)M.push(`aspect-ratio:${R}/${w}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=Qz(R||16,w||9,B);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")M.push(`background-image:url(${B0(z)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let T=o5(X,R,w,_,W),I=[];if(I.push(`src="${B0(T)}"`),I.push(`alt="${B0(J)}"`),Q)I.push(`width="${B0(Q)}"`);if(G)I.push(`height="${B0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${B0(j)}"`);if(M.length>0)I.push(`style="${B0(M.join(";"))}"`);if(A)I.push(`srcset="${B0(A)}"`);if(N)I.push(`sizes="${B0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,b]of Object.entries($.static)){if(D.has(S))continue;if(typeof b==="boolean"){if(b)I.push(B0(S))}else I.push(`${B0(S)}="${B0(b)}"`)}let E=`<img ${I.join(" ")} />`,k="";if(O){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";k=`<link rel="preload" as="image" href="${B0(T)}"${b?` type="${b}"`:""}${A?` imagesrcset="${B0(A)}"`:""}${N?` imagesizes="${B0(N)}"`:""} />
4024
+ `}if(V){let S=[];if(W==="avif"||W==="auto"){let b=o5(X,R,w,_,"avif"),P=A?q6(X,G6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${B0(P)}"${N?` sizes="${B0(N)}"`:""} />`)}if(W==="webp"||W==="auto"){let b=o5(X,R,w,_,"webp"),P=A?q6(X,G6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${B0(P)}"${N?` sizes="${B0(N)}"`:""} />`)}return`${k}<picture>
4025
4025
  ${S.join(`
4026
4026
  `)}
4027
4027
  ${E}
4028
- </picture>`}return`${k}${E}`}}});function w1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var Gz="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",z6;var B6=P(()=>{z6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=B5($,"src")||"",J=B5($,"alt")||"",Q=B5($,"fallback")||"/images/safe-image-default.svg",G=B5($,"class")||B5($,"className")||"",K=B5($,"fallbackClassName")||"",q=[];if(q.push(`src="${w1(X)}"`),q.push(`alt="${w1(J)}"`),G)q.push(`class="${w1(G)}"`);if(q.push(`data-fallback="${w1(Q)}"`),K)q.push(`data-fallback-class="${w1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(U.has(B))continue;if(typeof _==="boolean"){if(_)q.push(w1(B))}else q.push(`${w1(B)}="${w1(_)}"`)}let W=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${Gz}${W}`;return W}}});function _6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function s5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function R4($,Z,Y){let X=s5($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var j6;var H6=P(()=>{j6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=_6(s5($,"color")||"#6366f1"),J=_6(s5($,"initialColor")||s5($,"initial-color")||""),Q=_6(s5($,"height")||"3px"),G=R4($,"duration",2000),K=R4($,"throttle",200),q=R4($,"zIndex",999999)||R4($,"z-index",999999),U=J?`linear-gradient(to right, ${J}, ${X})`:X;return`
4028
+ </picture>`}return`${k}${E}`}}});function w1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var Gz="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",z6;var B6=C(()=>{z6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=B5($,"src")||"",J=B5($,"alt")||"",Q=B5($,"fallback")||"/images/safe-image-default.svg",G=B5($,"class")||B5($,"className")||"",K=B5($,"fallbackClassName")||"",q=[];if(q.push(`src="${w1(X)}"`),q.push(`alt="${w1(J)}"`),G)q.push(`class="${w1(G)}"`);if(q.push(`data-fallback="${w1(Q)}"`),K)q.push(`data-fallback-class="${w1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(U.has(B))continue;if(typeof _==="boolean"){if(_)q.push(w1(B))}else q.push(`${w1(B)}="${w1(_)}"`)}let W=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${Gz}${W}`;return W}}});function _6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function s5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function R4($,Z,Y){let X=s5($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var j6;var H6=C(()=>{j6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=_6(s5($,"color")||"#6366f1"),J=_6(s5($,"initialColor")||s5($,"initial-color")||""),Q=_6(s5($,"height")||"3px"),G=R4($,"duration",2000),K=R4($,"throttle",200),q=R4($,"zIndex",999999)||R4($,"z-index",999999),U=J?`linear-gradient(to right, ${J}, ${X})`:X;return`
4029
4029
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${U};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
4030
4030
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
4031
4031
  </div>
4032
4032
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
4033
4033
  <script>
4034
4034
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
4035
- </script>`}}});function c0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function XY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Kz($,Z,Y){let X=XY($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var YY,O6;var L6=P(()=>{YY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},O6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=c0(XY($,"position")||"top-right"),J=Kz($,"max",5),Q=YY[X]||YY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${J}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
4035
+ </script>`}}});function c0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function XY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Kz($,Z,Y){let X=XY($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var YY,O6;var L6=C(()=>{YY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},O6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=c0(XY($,"position")||"top-right"),J=Kz($,"max",5),Q=YY[X]||YY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${J}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
4036
4036
  <style>
4037
4037
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
4038
4038
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -4040,7 +4040,7 @@ ${E}
4040
4040
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
4041
4041
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
4042
4042
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
4043
- </style>`}}});function A4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var JY,F6;var V6=P(()=>{JY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},F6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=A4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=c0(X),Q=A4($,"size")||"md",G=A4($,"closeOnBackdrop")!=="false",K=A4($,"closeOnEscape")!=="false",q=JY[Q]||JY.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
4043
+ </style>`}}});function A4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var JY,F6;var V6=C(()=>{JY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},F6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=A4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=c0(X),Q=A4($,"size")||"md",G=A4($,"closeOnBackdrop")!=="false",K=A4($,"closeOnEscape")!=="false",q=JY[Q]||JY.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
4044
4044
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
4045
4045
  <div style="padding:1.5rem">${Z}</div>
4046
4046
  </div>
@@ -4049,7 +4049,7 @@ ${E}
4049
4049
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
4050
4050
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
4051
4051
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
4052
- </style>`}}});function _5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var QY,w6;var R6=P(()=>{QY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},w6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=_5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=c0(X),Q=_5($,"side")||"right",G=_5($,"size")||"md",K=_5($,"closeOnBackdrop")!=="false",q=_5($,"closeOnEscape")!=="false",U=_5($,"overlay")!=="false",W=QY[G]||QY.md,z=Q==="left",B=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
4052
+ </style>`}}});function _5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var QY,w6;var R6=C(()=>{QY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},w6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=_5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=c0(X),Q=_5($,"side")||"right",G=_5($,"size")||"md",K=_5($,"closeOnBackdrop")!=="false",q=_5($,"closeOnEscape")!=="false",U=_5($,"overlay")!=="false",W=QY[G]||QY.md,z=Q==="left",B=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
4053
4053
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${W};max-width:100vw;transform:${_};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
4054
4054
  <div style="padding:1.5rem">${Z}</div>
4055
4055
  </div>
@@ -4058,7 +4058,7 @@ ${E}
4058
4058
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
4059
4059
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
4060
4060
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
4061
- </style>`}}});var Bz={};l(Bz,{preloadIconCollection:()=>KY,IconBuiltin:()=>N4});import{existsSync as qz,readFileSync as Uz}from"fs";function GY($){try{return J0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(qz(Y))return Y;return null}function Wz($){if(u1.has($))return u1.get($);let Z=GY($);if(!Z)return null;try{let Y=JSON.parse(Uz(Z,"utf8"));return u1.set($,Y.icons),Y.icons}catch{return null}}async function zz($){if(u1.has($))return u1.get($);let Z=GY($);if(!Z)return null;try{let Y=await Bun.file(Z).json();return u1.set($,Y.icons),Y.icons}catch{return null}}function j5($,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}async function KY($="lucide"){await zz($)}var u1,N4;var A6=P(()=>{u1=new Map;N4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=j5($,"name")??j5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let O=X.split(":");J=O[0],Q=O[1]}let G=c0(j5($,"size")||"24"),K=c0(j5($,"color")||"currentColor"),q=c0(j5($,"class")||""),U=c0(j5($,"style")||""),W=u1.get(J)??Wz(J);if(!W)return`<!-- Icon: collection "${J}" not loaded -->`;let z=W[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${J} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function _z(){return`
4061
+ </style>`}}});var Bz={};l(Bz,{preloadIconCollection:()=>KY,IconBuiltin:()=>N4});import{existsSync as qz,readFileSync as Uz}from"fs";function GY($){try{return J0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(qz(Y))return Y;return null}function Wz($){if(u1.has($))return u1.get($);let Z=GY($);if(!Z)return null;try{let Y=JSON.parse(Uz(Z,"utf8"));return u1.set($,Y.icons),Y.icons}catch{return null}}async function zz($){if(u1.has($))return u1.get($);let Z=GY($);if(!Z)return null;try{let Y=await Bun.file(Z).json();return u1.set($,Y.icons),Y.icons}catch{return null}}function j5($,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}async function KY($="lucide"){await zz($)}var u1,N4;var A6=C(()=>{u1=new Map;N4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=j5($,"name")??j5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let O=X.split(":");J=O[0],Q=O[1]}let G=c0(j5($,"size")||"24"),K=c0(j5($,"color")||"currentColor"),q=c0(j5($,"class")||""),U=c0(j5($,"style")||""),W=u1.get(J)??Wz(J);if(!W)return`<!-- Icon: collection "${J}" not loaded -->`;let z=W[Q];if(!z)return`<!-- Icon: "${Q}" not found in ${J} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function _z(){return`
4062
4062
  (function(){
4063
4063
  var tip=null,hideTimer=null,currentEl=null;
4064
4064
 
@@ -4161,7 +4161,7 @@ document.addEventListener("focusout",function(e){
4161
4161
  if(el) hideTip();
4162
4162
  });
4163
4163
  })();
4164
- `}function qY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function UY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var N6;var T6=P(()=>{N6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=UY(Z,"fallback"),J=X.rest,Q=UY(J,"error"),G=Q.rest,K=X.region??qY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??qY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function T4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var M6;var I6=P(()=>{M6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(T4($,"name")||"v").replace(/["'<>]/g,""),J=(T4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=T4($,"class"),G=T4($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function WY(){S0.registerBuiltin(J6),S0.registerBuiltin(U6),S0.registerBuiltin(z6),S0.registerBuiltin(j6),S0.registerBuiltin(O6),S0.registerBuiltin(F6),S0.registerBuiltin(w6),S0.registerBuiltin(N4),S0.registerBuiltin(N6),S0.registerBuiltin(M6)}var zY=P(()=>{Q6();W6();B6();H6();L6();V6();R6();A6();T6();I6();X6();Q6();W6();B6();H6();L6();V6();R6();A6();T6();I6()});import H5 from"path";function D6($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function E6($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){J=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=Q+1+q.length;while(H<$.length&&$[H]!==">")H++;J=H+1;continue}let U=Q+1+q.length,W=null,z=U,B=-1,_=!1;while(U<$.length){let H=$[U];if(W){if(H==="\\"&&U+1<$.length){U+=2;continue}if(H===W)W=null;U++;continue}if(H==='"'||H==="'"){W=H,U++;continue}if(H==="/"&&U+1<$.length&&$[U+1]===">"){B=U+2,_=!0;break}if(H===">"){B=U+1;break}U++}if(B===-1){J=Q+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(Q,B),tagName:q,attributes:j,content:"",startIndex:Q,endIndex:B,isSelfClosing:!0}),J=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(A!==-1&&A<N){let M=$[A+H.length];if(M===" "||M===">"||M==="/"||M===`
4164
+ `}function qY($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function UY($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var N6;var T6=C(()=>{N6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=UY(Z,"fallback"),J=X.rest,Q=UY(J,"error"),G=Q.rest,K=X.region??qY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??qY($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function T4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var M6;var I6=C(()=>{M6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(T4($,"name")||"v").replace(/["'<>]/g,""),J=(T4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=T4($,"class"),G=T4($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function WY(){S0.registerBuiltin(J6),S0.registerBuiltin(U6),S0.registerBuiltin(z6),S0.registerBuiltin(j6),S0.registerBuiltin(O6),S0.registerBuiltin(F6),S0.registerBuiltin(w6),S0.registerBuiltin(N4),S0.registerBuiltin(N6),S0.registerBuiltin(M6)}var zY=C(()=>{Q6();W6();B6();H6();L6();V6();R6();A6();T6();I6();X6();Q6();W6();B6();H6();L6();V6();R6();A6();T6();I6()});import H5 from"path";function D6($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function E6($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){J=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=Q+1+q.length;while(H<$.length&&$[H]!==">")H++;J=H+1;continue}let U=Q+1+q.length,W=null,z=U,B=-1,_=!1;while(U<$.length){let H=$[U];if(W){if(H==="\\"&&U+1<$.length){U+=2;continue}if(H===W)W=null;U++;continue}if(H==='"'||H==="'"){W=H,U++;continue}if(H==="/"&&U+1<$.length&&$[U+1]===">"){B=U+2,_=!0;break}if(H===">"){B=U+1;break}U++}if(B===-1){J=Q+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(Q,B),tagName:q,attributes:j,content:"",startIndex:Q,endIndex:B,isSelfClosing:!0}),J=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let A=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(A!==-1&&A<N){let M=$[A+H.length];if(M===" "||M===">"||M==="/"||M===`
4165
4165
  `||M==="\t")F++;O=A+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){J=B;continue}let R=$.slice(B,V),w=V+L.length;X.push({fullMatch:$.slice(Q,w),tagName:q,attributes:j,content:R,startIndex:Q,endIndex:w,isSelfClosing:!1}),J=w}}return X}function k6($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}function jz($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;if(J.startsWith("@")||J.startsWith(":")){while(Y<X&&$[Y]!=='"'&&$[Y]!=="'")Y++;if(Y<X){let Q=$[Y];Y++;while(Y<X&&$[Y]!==Q){if($[Y]==="\\")Y++;Y++}Y++}continue}while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]="true"}return Z}function ZA($){let Z=[],Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X&&$[Y]!==G){if($[Y]==="\\"&&Y+1<X)Y++,Q+=$[Y];else Q+=$[Y];Y++}if(Y<X)Y++}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z.push({name:J,value:Q})}else Z.push({name:J,value:!0})}return Z}async function YA($,Z,Y,X){let J=$;return J=J.replace(/<stx-loading-indicator([^>]*?)(?:\s*\/>|><\/stx-loading-indicator>)/gi,(Q,G)=>{let K=G.match(/color=["']([^"']+)["']/i),q=G.match(/initial-color=["']([^"']+)["']/i),U=G.match(/height=["']([^"']+)["']/i),W=G.match(/duration=["']([^"']+)["']/i),z=G.match(/throttle=["']([^"']+)["']/i),B=G.match(/z-index=["']([^"']+)["']/i),_=(L)=>L.replace(/[;{}()]/g,"").replace(/url/gi,""),j={color:_(K?.[1]||"#6366f1"),initialColor:_(q?.[1]||""),height:_(U?.[1]||"3px"),duration:W?Number.parseInt(W[1]):2000,throttle:z?Number.parseInt(z[1]):200,zIndex:B?Number.parseInt(B[1]):999999},H=j.initialColor?`linear-gradient(to right, ${j.initialColor}, ${j.color})`:j.color;return`
4166
4166
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${j.height};background:${H};z-index:${j.zIndex};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
4167
4167
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
@@ -4169,15 +4169,15 @@ document.addEventListener("focusout",function(e){
4169
4169
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
4170
4170
  <script>
4171
4171
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${j.throttle})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
4172
- </script>`}),J}async function XA($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[U,W]=q,z=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[H5.resolve(H5.dirname(Y),`${B}.stx`),H5.resolve(H5.dirname(Y),B),H5.resolve(X.componentsDir||"components",`${B}.stx`),H5.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function JA($,Z,Y,X,J,Q){let G=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,U;while((U=q.exec(G))!==null){let W=U.index,z=W+U[0].length-1,B=1,_=z+1;while(_<G.length&&B>0){if(G[_]==="(")B++;else if(G[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=G.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let w={};if(O)try{w=j0(O,Z)}catch(E){let k=E instanceof Error?E.message:String(E);G=G.replace(G.substring(W,H),`[Error parsing component props: ${k}]`);continue}let A="",N=H,T=G.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)A=T[1].trim(),N=H+T[0].length;let I=G.substring(W,N),D=await K1(F,w,A,X,Z,Y,J,K,Q);G=G.substring(0,W)+D+G.substring(N),q.lastIndex=0}return G}async function QA($,Z,Y,X,J,Q){let G=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]),U=w$(G);return G=U.output,G=await _(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await _(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await _(G,/[a-z][a-z0-9]*/,!1,q),G=R$(G,U.scripts),G;async function _(j,H,L,F){let O=j,V=E6(O,H,F);for(let R=V.length-1;R>=0;R--){let w=V[R],A=L?D6(w.tagName):w.tagName,N=jz(w.attributes),M={};for(let[I,D]of Object.entries(N)){if(I.startsWith("@"))continue;if(I.startsWith("__stx_")){let E=I.slice(6);M[E]=k6(D,J);continue}if(I.startsWith(":")){let E=I.slice(1),k=D==="true"?E:D;try{if(!$0(k)){if(J.debug)console.error(`Unsafe expression in :${E} binding: ${k}`);M[E]=D}else{let S=Z0(k,Object.keys(Z));M[E]=S(...Object.values(Z))}}catch(S){if(J.debug)console.error(`Error evaluating :${E} binding:`,S);M[E]=D}continue}if(typeof D==="string"&&D.includes("{{")&&D.includes("}}")){let E=D.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(E)try{let k=E[1];if(!$0(k)){if(J.debug)console.error(`Unsafe expression in ${I}: ${k}`);M[I]=D}else{let S=Z0(k,Object.keys(Z));M[I]=S(...Object.values(Z))}}catch(k){if(J.debug)console.error(`Error evaluating expression for ${I}:`,k);M[I]=D}else{let k=D,S=/\{\{\s*([\s\S]+?)\s*\}\}/g,b;while((b=S.exec(D))!==null)try{let y=b[1];if(!$0(y)){if(J.debug)console.error(`Unsafe expression in ${I}: ${y}`);continue}let f=Z0(y,Object.keys(Z))(...Object.values(Z));k=k.replace(b[0],String(f??""))}catch(y){if(J.debug)console.error(`Error evaluating expression in ${I}:`,y)}M[I]=k}}else M[I]=D}let T=await K1(A,M,w.content,X,Z,Y,J,K,Q);O=O.substring(0,w.startIndex)+T+O.substring(w.endIndex)}return O}}var BY=P(()=>{F0();V0();A$()});var FY={};l(FY,{processESImports:()=>LY,processComponents:()=>I4});import M4 from"fs";import v0 from"path";function Oz($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!J.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let U=Q(q.slice(6));X.serverDynamic[U]=k6(K,Y);continue}if(q.startsWith(":")){let U=Q(q.slice(1)),W=K==="true"?U:K;try{if(!$0(W)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${W}`);X.clientReactive[U]=W;continue}let z=Object.keys(Z),_=Z0(W,z)(...Object.values(Z));if(_===void 0){let j=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[U]=W;continue}}X.serverDynamic[U]=_}catch{X.clientReactive[U]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let W=U[1];if($0(W)){let B=Z0(W,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${W}`);X.static[q]=K}}catch(W){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,W);X.static[q]=K}else{let W=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!$0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=Z0(_,Object.keys(Z))(...Object.values(Z));W=W.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=W}continue}X.static[q]=K}return X}function Lz($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]="true"}return Z}function jY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Fz($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(S0.isBuiltin(J))Z.add(J)}return[...Z].sort()}function Vz($){let Z=HY.get($);if(Z)return Z;let Y=new Map,X=[v0.join($,"src"),v0.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=M4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let U=v0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(U,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!Y.has(W))Y.set(W,U);let z=W.toLowerCase();if(!Y.has(z))Y.set(z,U);let B=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,U)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return HY.set($,Y),Y}function wz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=v0.join(Y,"node_modules",$);try{if(M4.statSync(X).isDirectory())return X}catch{}let J=v0.dirname(Y);if(J===Y)return null;Y=J}}async function LY($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(U,W,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,R=null,w=null;if(V.startsWith(".")||V.startsWith("/")){let M=v0.resolve(G,V);if(M.endsWith(".stx"))w=M;else{let T=`${M}.stx`;try{if(M4.statSync(T).isFile())w=T}catch{try{if(M4.statSync(M).isDirectory())R=M}catch{}}}}else R=wz(V,G);if(!R&&!w)continue;let A=!1,N=(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),J.add(T)};if(O&&w)N(O,w),A=!0;else if(F){let M=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),T=R?Vz(R):null;for(let{source:I,local:D}of M){let E=null;if(w)E=w;else if(T)E=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)N(D,E),A=!0}}if(A)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return U;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${W}>${_}</script>`}),K}async function Rz($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[U,W]=q,z=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${B}.stx`),v0.resolve(v0.dirname(Y),B),v0.resolve(X.componentsDir||"components",`${B}.stx`),v0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function Az($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,U;while((U=q.exec(Q))!==null){let W=U.index,z=W+U[0].length-1,B=1,_=z+1;while(_<Q.length&&B>0){if(Q[_]==="(")B++;else if(Q[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=Q.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let w={};if(O)try{w=j0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);Q=Q.replace(Q.substring(W,H),`[Error parsing component props: ${E}]`);continue}let A="",N=H,T=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)A=T[1].trim(),N=H+T[0].length;let I=await K1(F,w,A,G,Z,Y,X,K,J);Q=Q.substring(0,W)+I+Q.substring(N),q.lastIndex=0}return Q}async function Nz($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=w$(Q);return Q=q.output,Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,Hz),Q=R$(Q,q.scripts),Q;async function B(_,j,H,L){if(!_)return _;let F=_,O=E6(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],w=H?D6(R.tagName):R.tagName,A=Lz(R.attributes),N=Oz(A,Z,X),M=S0.getBuiltin(R.tagName),T=M?await VY(w,G,Z,Y,X):!1;if(M&&!T){let k={context:Z,filePath:Y,options:X,dependencies:J},S=M.render(N,R.content,k);if(Object.keys(N.clientReactive).length>0)S=OY(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([y,d])=>`${y}="${jY(d)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}let I={};for(let[k,S]of Object.entries(N.static))I[k]=S;for(let[k,S]of Object.entries(N.serverDynamic))I[k]=S;let E=await K1(w,I,R.content,G,Z,Y,X,K,J);if(Object.keys(N.clientReactive).length>0)E=OY(E,N.clientReactive);if(Object.keys(N.events).length>0){let k=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(k){let S=Object.entries(N.events).map(([y,d])=>`${y}="${jY(d)}"`).join(" "),b=k[1].length+k[2].length;E=E.substring(0,b)+" "+S+E.substring(b)}}F=F.substring(0,R.startIndex)+E+F.substring(R.endIndex)}return F}}function OY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),J=Y[1].length+Y[2].length;return $.substring(0,J)+" "+X+$.substring(J)}async function I4($,Z,Y,X,J){if(!_Y)WY(),_Y=!0;let Q=await LY($,Z,Y,X,J);Q=await Rz(Q,Z,Y,X,J),Q=await Az(Q,Z,Y,X,J);for(let G=0;G<3;G++){let K=Q;if(Q=await Nz(Q,Z,Y,X,J),Q===K)break}if(X.debug){let G=Fz(Q);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var _Y=!1,Hz,HY;var S6=P(()=>{X6();zY();BY();V0();F0();Hz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);HY=new Map});var D4={};l(D4,{stripTypeScript:()=>TY,hasVariables:()=>kY,extractVariables:()=>m1,extractScriptFromTemplate:()=>EY,convertToCommonJS:()=>y6});import O5 from"path";import r5 from"process";function Tz($){let Z=[],Y=0,X=$.split(`
4172
+ </script>`}),J}async function XA($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[U,W]=q,z=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[H5.resolve(H5.dirname(Y),`${B}.stx`),H5.resolve(H5.dirname(Y),B),H5.resolve(X.componentsDir||"components",`${B}.stx`),H5.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function JA($,Z,Y,X,J,Q){let G=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,U;while((U=q.exec(G))!==null){let W=U.index,z=W+U[0].length-1,B=1,_=z+1;while(_<G.length&&B>0){if(G[_]==="(")B++;else if(G[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=G.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let w={};if(O)try{w=j0(O,Z)}catch(E){let k=E instanceof Error?E.message:String(E);G=G.replace(G.substring(W,H),`[Error parsing component props: ${k}]`);continue}let A="",N=H,T=G.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)A=T[1].trim(),N=H+T[0].length;let I=G.substring(W,N),D=await K1(F,w,A,X,Z,Y,J,K,Q);G=G.substring(0,W)+D+G.substring(N),q.lastIndex=0}return G}async function QA($,Z,Y,X,J,Q){let G=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]),U=w$(G);return G=U.output,G=await _(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await _(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await _(G,/[a-z][a-z0-9]*/,!1,q),G=R$(G,U.scripts),G;async function _(j,H,L,F){let O=j,V=E6(O,H,F);for(let R=V.length-1;R>=0;R--){let w=V[R],A=L?D6(w.tagName):w.tagName,N=jz(w.attributes),M={};for(let[I,D]of Object.entries(N)){if(I.startsWith("@"))continue;if(I.startsWith("__stx_")){let E=I.slice(6);M[E]=k6(D,J);continue}if(I.startsWith(":")){let E=I.slice(1),k=D==="true"?E:D;try{if(!$0(k)){if(J.debug)console.error(`Unsafe expression in :${E} binding: ${k}`);M[E]=D}else{let S=Z0(k,Object.keys(Z));M[E]=S(...Object.values(Z))}}catch(S){if(J.debug)console.error(`Error evaluating :${E} binding:`,S);M[E]=D}continue}if(typeof D==="string"&&D.includes("{{")&&D.includes("}}")){let E=D.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(E)try{let k=E[1];if(!$0(k)){if(J.debug)console.error(`Unsafe expression in ${I}: ${k}`);M[I]=D}else{let S=Z0(k,Object.keys(Z));M[I]=S(...Object.values(Z))}}catch(k){if(J.debug)console.error(`Error evaluating expression for ${I}:`,k);M[I]=D}else{let k=D,S=/\{\{\s*([\s\S]+?)\s*\}\}/g,b;while((b=S.exec(D))!==null)try{let P=b[1];if(!$0(P)){if(J.debug)console.error(`Unsafe expression in ${I}: ${P}`);continue}let f=Z0(P,Object.keys(Z))(...Object.values(Z));k=k.replace(b[0],String(f??""))}catch(P){if(J.debug)console.error(`Error evaluating expression in ${I}:`,P)}M[I]=k}}else M[I]=D}let T=await K1(A,M,w.content,X,Z,Y,J,K,Q);O=O.substring(0,w.startIndex)+T+O.substring(w.endIndex)}return O}}var BY=C(()=>{F0();V0();A$()});var FY={};l(FY,{processESImports:()=>LY,processComponents:()=>I4});import M4 from"fs";import v0 from"path";function Oz($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!J.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let U=Q(q.slice(6));X.serverDynamic[U]=k6(K,Y);continue}if(q.startsWith(":")){let U=Q(q.slice(1)),W=K==="true"?U:K;try{if(!$0(W)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${W}`);X.clientReactive[U]=W;continue}let z=Object.keys(Z),_=Z0(W,z)(...Object.values(Z));if(_===void 0){let j=W.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!z.includes(F))){X.clientReactive[U]=W;continue}}X.serverDynamic[U]=_}catch{X.clientReactive[U]=W}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let W=U[1];if($0(W)){let B=Z0(W,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${W}`);X.static[q]=K}}catch(W){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,W);X.static[q]=K}else{let W=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!$0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=Z0(_,Object.keys(Z))(...Object.values(Z));W=W.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=W}continue}X.static[q]=K}return X}function Lz($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]="true"}return Z}function jY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Fz($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(S0.isBuiltin(J))Z.add(J)}return[...Z].sort()}function Vz($){let Z=HY.get($);if(Z)return Z;let Y=new Map,X=[v0.join($,"src"),v0.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=M4.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let U=v0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(U,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let W=q.name.slice(0,-4);if(!Y.has(W))Y.set(W,U);let z=W.toLowerCase();if(!Y.has(z))Y.set(z,U);let B=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,U)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return HY.set($,Y),Y}function wz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=v0.join(Y,"node_modules",$);try{if(M4.statSync(X).isDirectory())return X}catch{}let J=v0.dirname(Y);if(J===Y)return null;Y=J}}async function LY($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(U,W,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,R=null,w=null;if(V.startsWith(".")||V.startsWith("/")){let M=v0.resolve(G,V);if(M.endsWith(".stx"))w=M;else{let T=`${M}.stx`;try{if(M4.statSync(T).isFile())w=T}catch{try{if(M4.statSync(M).isDirectory())R=M}catch{}}}}else R=wz(V,G);if(!R&&!w)continue;let A=!1,N=(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),J.add(T)};if(O&&w)N(O,w),A=!0;else if(F){let M=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),T=R?Vz(R):null;for(let{source:I,local:D}of M){let E=null;if(w)E=w;else if(T)E=T.get(I)??T.get(I.toLowerCase())??T.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)N(D,E),A=!0}}if(A)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return U;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${W}>${_}</script>`}),K}async function Rz($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[U,W]=q,z=W.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${B}.stx`),v0.resolve(v0.dirname(Y),B),v0.resolve(X.componentsDir||"components",`${B}.stx`),v0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function Az($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,U;while((U=q.exec(Q))!==null){let W=U.index,z=W+U[0].length-1,B=1,_=z+1;while(_<Q.length&&B>0){if(Q[_]==="(")B++;else if(Q[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=Q.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let w={};if(O)try{w=j0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);Q=Q.replace(Q.substring(W,H),`[Error parsing component props: ${E}]`);continue}let A="",N=H,T=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)A=T[1].trim(),N=H+T[0].length;let I=await K1(F,w,A,G,Z,Y,X,K,J);Q=Q.substring(0,W)+I+Q.substring(N),q.lastIndex=0}return Q}async function Nz($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=w$(Q);return Q=q.output,Q=await B(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await B(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await B(Q,/[a-z][a-z0-9]*/,!1,Hz),Q=R$(Q,q.scripts),Q;async function B(_,j,H,L){if(!_)return _;let F=_,O=E6(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],w=H?D6(R.tagName):R.tagName,A=Lz(R.attributes),N=Oz(A,Z,X),M=S0.getBuiltin(R.tagName),T=M?await VY(w,G,Z,Y,X):!1;if(M&&!T){let k={context:Z,filePath:Y,options:X,dependencies:J},S=M.render(N,R.content,k);if(Object.keys(N.clientReactive).length>0)S=OY(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([P,d])=>`${P}="${jY(d)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}let I={};for(let[k,S]of Object.entries(N.static))I[k]=S;for(let[k,S]of Object.entries(N.serverDynamic))I[k]=S;let E=await K1(w,I,R.content,G,Z,Y,X,K,J);if(Object.keys(N.clientReactive).length>0)E=OY(E,N.clientReactive);if(Object.keys(N.events).length>0){let k=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(k){let S=Object.entries(N.events).map(([P,d])=>`${P}="${jY(d)}"`).join(" "),b=k[1].length+k[2].length;E=E.substring(0,b)+" "+S+E.substring(b)}}F=F.substring(0,R.startIndex)+E+F.substring(R.endIndex)}return F}}function OY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),J=Y[1].length+Y[2].length;return $.substring(0,J)+" "+X+$.substring(J)}async function I4($,Z,Y,X,J){if(!_Y)WY(),_Y=!0;let Q=await LY($,Z,Y,X,J);Q=await Rz(Q,Z,Y,X,J),Q=await Az(Q,Z,Y,X,J);for(let G=0;G<3;G++){let K=Q;if(Q=await Nz(Q,Z,Y,X,J),Q===K)break}if(X.debug){let G=Fz(Q);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var _Y=!1,Hz,HY;var S6=C(()=>{X6();zY();BY();V0();F0();Hz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);HY=new Map});var D4={};l(D4,{stripTypeScript:()=>TY,hasVariables:()=>kY,extractVariables:()=>m1,extractScriptFromTemplate:()=>EY,convertToCommonJS:()=>y6});import O5 from"path";import r5 from"process";function Tz($){let Z=[],Y=0,X=$.split(`
4173
4173
  `);for(let J of X){let Q=Y,G=null,K=!1;for(let q=0;q<J.length;q++){let U=J[q];if(K){K=!1;continue}if(U==="\\"){K=!0;continue}if(G){if(U===G)G=null;continue}if(U==="'"||U==='"'||U==="`"){G=U;continue}if(U==="/"&&q+1<J.length&&J[q+1]==="/")break;if(U==="{")Y++;else if(U==="}")Y--}if(Q===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let U=J.match(/(?:const|let|var)\s+(\w+)/);if(U)Z.push(U[1])}else{let U=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let z=U[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...z)}}}}return[...new Set(Z)]}function TY($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let J=[],Q="",G=0,K=0,q=null;for(let U=0;U<X.length;U++){let W=X[U];if(q){if(Q+=W,W===q)q=null;continue}if(W==='"'||W==="'"||W==="`"){q=W,Q+=W;continue}if(W==="<")G++;else if(W===">"&&G>0)G--;else if(W==="(")K++;else if(W===")")K--;if(W===","&&G===0&&K===0){J.push(Q),Q="";continue}Q+=W}if(Q)J.push(Q);return J.map((U)=>{let W=U.trim(),z=W.startsWith("..."),B=z?W.slice(3):W,_=-1,j=0;for(let w=0;w<B.length;w++)if(B[w]==="<")j++;else if(B[w]===">")j--;else if(B[w]===":"&&j===0){_=w;break}if(_===-1)return U;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let w=0;w<F.length;w++)if(F[w]==="<")V++;else if(F[w]===">")V--;else if(F[w]==="="&&V===0){O=w;break}let R=z?"...":"";if(O!==-1)return`${R}${L} = ${F.substring(O+1).trim()}`;return`${R}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,J,Q)=>{if(!Q.includes(":"))return X;return`${J}(${Y(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=X.exec(Z))!==null){let G=J.index+J[0].length-1,K=1,q=G+1,U=0,W=null;while(q<Z.length&&K>0){let _=Z[q];if(W){if(_===W)W=null;q++;continue}if(_==='"'||_==="'"||_==="`"){W=_,q++;continue}if(_==="<")U++;else if(_===">"&&U>0)U--;else if(U===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let B=Y(z);Q.push({start:G+1,end:q,replacement:B})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=Q[G];Z=Z.substring(0,K)+U+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,J)=>{if(!J.includes(":"))return X;if(J.includes("{")||J.includes("}"))return X;return`(${J.split(",").map((G)=>{let[K,...q]=G.split("="),U=K.split(":")[0].trim();if(q.length>0)return`${U} = ${q.join("=").trim()}`;return U}).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,`
4174
4174
 
4175
- `),Z}async function m1($,Z,Y,X={}){if(!$.trim())return;let J;try{let C=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=C.transformSync(v)}catch{J=TY($)}let Q={exports:{}},G=Q.exports,K=r5.cwd(),q={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of U)try{let v=O5.resolve(K,"node_modules",C),x=O5.join(v,"package.json"),g=JSON.parse(J0("fs").readFileSync(x,"utf8")),u=g.main||"index.js";if(g.exports){let s=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof s==="string")u=s;else if(s?.bun)u=s.bun;else if(s?.import)u=s.import;else if(s?.default)u=s.default}q[C]=await import(O5.resolve(v,u))}catch{}let W=(C)=>{if(q[C])return q[C];return J0(C)},z=Z.props||{},B=Object.assign((C)=>{if(!C)return z;let v={};for(let[x,g]of Object.entries(C)){let u=z[x];if(u!==void 0)v[x]=u;else if(typeof g==="function")v[x]=g();else v[x]=g}return v},z),_=(C)=>{if(!C)return z;let v={...z};for(let[x,g]of Object.entries(C)){let u=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[x]===void 0&&u.default!==void 0)v[x]=typeof u.default==="function"?u.default():u.default}return v},j=()=>Z.slots||{},H=(C,v)=>{let x={...C};for(let[g,u]of Object.entries(v))if(x[g]===void 0)if(typeof u==="function")x[g]=u();else x[g]=u;return x},L=(C)=>{let v=()=>C;return v.set=(x)=>{},v.update=(x)=>{},v},F=(C)=>{let v,x=!1;return()=>{if(!x)try{v=C(),x=!0}catch{v=void 0}return v}},O=(C)=>{},V=(C)=>C(),R=(C)=>{},w=(C)=>{},A=(C)=>{},N=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),T=(C)=>{h1(C);let v=Z.__stx_runtime_head||{},x=C||{};Z.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},I=(C)=>{H4(C);let v=m5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},D=(C)=>({value:C}),E=(C)=>C,k=(C)=>({value:typeof C==="function"?C():C}),S=(C,v)=>{},b=(C)=>{},y=(C)=>{},d=(C)=>C?C():Promise.resolve(),f=(C)=>(v,...x)=>{},m=(C)=>{},o=(C,v)=>{},N0=(C,v)=>v,$1=()=>({value:"light"}),y0=()=>({value:!1}),D0={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:{}},X0=new Proxy(D0,{get(C,v){if(v in C)return C[v];return},set(C,v,x){return C[v]=x,!0}}),L0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},W0=console;try{let C=y6(J,Y),v=new Set(Object.keys(z)),x=Object.keys(Z).filter((t)=>!v.has(t)&&t!=="props"),g=x.map((t)=>Z[t]),u=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),s=[],G0=[];for(let[t,n0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(u.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;s.push(t),G0.push(n0)}let P0=Tz(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
4175
+ `),Z}async function m1($,Z,Y,X={}){if(!$.trim())return;let J;try{let y=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=y.transformSync(v)}catch{J=TY($)}let Q={exports:{}},G=Q.exports,K=r5.cwd(),q={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((y)=>y[1]).filter((y)=>!y.startsWith("node:")&&!y.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(y));for(let y of U)try{let v=O5.resolve(K,"node_modules",y),x=O5.join(v,"package.json"),g=JSON.parse(J0("fs").readFileSync(x,"utf8")),u=g.main||"index.js";if(g.exports){let s=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof s==="string")u=s;else if(s?.bun)u=s.bun;else if(s?.import)u=s.import;else if(s?.default)u=s.default}q[y]=await import(O5.resolve(v,u))}catch{}let W=(y)=>{if(q[y])return q[y];return J0(y)},z=Z.props||{},B=Object.assign((y)=>{if(!y)return z;let v={};for(let[x,g]of Object.entries(y)){let u=z[x];if(u!==void 0)v[x]=u;else if(typeof g==="function")v[x]=g();else v[x]=g}return v},z),_=(y)=>{if(!y)return z;let v={...z};for(let[x,g]of Object.entries(y)){let u=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[x]===void 0&&u.default!==void 0)v[x]=typeof u.default==="function"?u.default():u.default}return v},j=()=>Z.slots||{},H=(y,v)=>{let x={...y};for(let[g,u]of Object.entries(v))if(x[g]===void 0)if(typeof u==="function")x[g]=u();else x[g]=u;return x},L=(y)=>{let v=()=>y;return v.set=(x)=>{},v.update=(x)=>{},v},F=(y)=>{let v,x=!1;return()=>{if(!x)try{v=y(),x=!0}catch{v=void 0}return v}},O=(y)=>{},V=(y)=>y(),R=(y)=>{},w=(y)=>{},A=(y)=>{},N=()=>{let y=Z.__stxServeContext,v=Z.__stxServeSearch??y?.search??"",x=y?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:x,name:"",fullPath:x+v,hash:"",matched:[]}},M=()=>({push:(y)=>{},replace:(y)=>{},back:()=>{},forward:()=>{},go:(y)=>{}}),T=(y)=>{h1(y);let v=Z.__stx_runtime_head||{},x=y||{};Z.__stx_runtime_head={...v,...x.title&&{title:x.title},meta:[...v.meta||[],...x.meta||[]],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],htmlAttrs:{...v.htmlAttrs||{},...x.htmlAttrs||{}},bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs||{}}}},I=(y)=>{H4(y);let v=m5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...v.title&&{title:v.title},meta:v.meta?[...v.meta]:[]}},D=(y)=>({value:y}),E=(y)=>y,k=(y)=>({value:typeof y==="function"?y():y}),S=(y,v)=>{},b=(y)=>{},P=(y)=>{},d=(y)=>y?y():Promise.resolve(),f=(y)=>(v,...x)=>{},m=(y)=>{},o=(y,v)=>{},N0=(y,v)=>v,$1=()=>({value:"light"}),y0=()=>({value:!1}),E0={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:{}},X0=new Proxy(E0,{get(y,v){if(v in y)return y[v];return},set(y,v,x){return y[v]=x,!0}}),L0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},W0=console;try{let y=y6(J,Y),v=new Set(Object.keys(z)),x=Object.keys(Z).filter((t)=>!v.has(t)&&t!=="props"),g=x.map((t)=>Z[t]),u=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),s=[],G0=[];for(let[t,n0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(u.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(y))continue;s.push(t),G0.push(n0)}let P0=Tz(y).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
4176
4176
  `),M1=Z.params??{},U0=[],I1=[];for(let t=0;t<x.length;t++){if(x[t]==="params")continue;U0.push(x[t]),I1.push(g[t])}let U$=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...s,...U0,`return (async () => {
4177
- ${C}
4177
+ ${y}
4178
4178
  ${P0}
4179
4179
  return module.exports
4180
- })()`)(Q,G,W,z,B,_,H,L,F,O,V,R,w,A,N,M,T,I,D,E,k,S,b,y,d,f,m,j,o,N0,$1,y0,X0,L0,W0,D0.confirm,D0.alert,D0.fetch,M1,...G0,...I1);if(X.preserveExisting){for(let[t,n0]of Object.entries(U$))if(!(t in Z)||Z[t]===void 0)Z[t]=n0}else Object.assign(Z,U$);for(let[t,n0]of Object.entries(z))if(!(t in Z))Z[t]=n0}catch(C){if(r5.env.STX_DEBUG){let v=C instanceof Error?C.message:String(C);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await kz(J,Z,Y)}catch(v){if(r5.env.STX_DEBUG){let x=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function y6($,Z){let Y=Z?O5.dirname(Z):r5.cwd(),X=$.split(`
4180
+ })()`)(Q,G,W,z,B,_,H,L,F,O,V,R,w,A,N,M,T,I,D,E,k,S,b,P,d,f,m,j,o,N0,$1,y0,X0,L0,W0,E0.confirm,E0.alert,E0.fetch,M1,...G0,...I1);if(X.preserveExisting){for(let[t,n0]of Object.entries(U$))if(!(t in Z)||Z[t]===void 0)Z[t]=n0}else Object.assign(Z,U$);for(let[t,n0]of Object.entries(z))if(!(t in Z))Z[t]=n0}catch(y){if(r5.env.STX_DEBUG){let v=y instanceof Error?y.message:String(y);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await kz(J,Z,Y)}catch(v){if(r5.env.STX_DEBUG){let x=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${x}`)}}}}function y6($,Z){let Y=Z?O5.dirname(Z):r5.cwd(),X=$.split(`
4181
4181
  `),J=[],Q=0;while(Q<X.length){let G=X[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<X.length;Q++){for(let q of X[Q])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let U=Q;U<X.length&&!q;U++){let W=null,z=!1,B=X[U];for(let _=0;_<B.length;_++){let j=B[_];if(z){z=!1;continue}if(j==="\\"){z=!0;continue}if(W){if(j===W)W=null;continue}if(j==='"'||j==="'"||j==="`"){W=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){Q=U+1,q=!0;break}}}}if(!q)Q=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),U=G.match(/^import\s+['"](.+)['"]/),W=(z)=>{if(z.startsWith("."))return O5.resolve(Y,z);return z};if(K){let[,z,B]=K,_=W(B);J.push(`const ${z} = await import('${_}')`),J.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,B]=q,_=z.trim(),j=W(B);J.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)J.push(`module.exports.${L} = ${L};`)}}else if(U){let z=W(U[1]);J.push(`await import('${z}')`)}else J.push(G);Q++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))J.push(X[Q]),Q++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=wY(X,Q),{type:q,name:U,value:W}=K;J.push(`${q} ${U} = ${W};`),J.push(`module.exports.${U} = ${U};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=b6(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=wY(X,Q),{type:q,name:U,value:W}=K;J.push(`${q} ${U} = ${W};`),J.push(`module.exports.${U} = ${U};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=b6(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[Q].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[Q]=K;let U=b6(q,Q);if(J.push(U.functionCode),U.name)J.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],U=X[Q].replace(/^export\s+/,""),W=0,z=Q;for(;z<X.length;z++){let B=X[z];for(let _ of B)if(_==="{")W++;else if(_==="}")W--;if(z>Q)U+=`
4182
4182
  `+B;if(W<=0&&z>=Q)break}J.push(U),J.push(`module.exports.${q} = ${q};`),Q=z+1}else J.push(G),Q++}else if(G.includes("module.exports"))J.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))J.push(G),Q++;else Q++}return Mz(J.join(`
4183
4183
  `),Y)}function Mz($,Z){let Y=$.length,X="",J=0,Q=null,G=!1,K=!1,q=0;while(J<Y){let U=$[J],W=$[J+1];if(G){if(X+=U,U===`
@@ -4187,7 +4187,7 @@ ${w}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}l
4187
4187
  ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:J,name:Q,value:K,nextIndex:q}}function b6($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,J]=X,Q=Y.replace(/^export\s+/,""),G=Z;if(Dz(Y)){let K=Ez($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function RY($){let Z=$.trim();if(Z.startsWith("{"))return O0(Z,"{","}",0)===-1;if(Z.startsWith("["))return O0(Z,"[","]",0)===-1;return!DY(Z)}function DY($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let J=0;J<$.length;J++){let Q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[J+1]==="{"){X++,J++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function Dz($){let Z=$.indexOf("{");if(Z===-1)return!0;return O0($,"{","}",Z)===-1}function AY($,Z,Y){let X=Y,J=Z+1;while(J<$.length&&!DY(X)){let Q=$[J];X+=`
4188
4188
  ${Q}`,J++}while(J<$.length){let Q=$[J].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
4189
4189
  ${$[J]}`,J++;else break}return{value:X,nextIndex:J}}function Ez($,Z,Y){let X=Y,J=Z+1;while(J<$.length){let Q=X.indexOf("{");if(Q!==-1){if(O0(X,"{","}",Q)!==-1)break}let G=$[J];X+=`
4190
- ${G}`,J++}return{functionCode:X,nextIndex:J}}function NY($,Z){let Y=e($,Z)??e(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...r5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function kz($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,K]=Q;try{let q=K.trim().replace(/;$/,""),U=NY(q,Z);if(U!==void 0)Z[G]=U}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),U=NY(q,Z);if(U!==void 0)Z[G]=U}catch{}}}function EY($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function kY($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var a5=P(()=>{u5();a1();F0()});var xY={};l(xY,{processLoops:()=>P6});function yz($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)continue;let W=X.substring(K+1,U),z=U+1,B=W.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=W.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=j0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;Q.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=Q[G];X=X.substring(0,K)+U+X.substring(q)}return X}function E4($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,U=K+1,W=null,z=!1;while(U<X.length&&q>0){let j=X[U];if(z){z=!1,U++;continue}if(j==="\\"&&W){z=!0,U++;continue}if(W){if(j===W)W=null;U++;continue}if(j==='"'||j==="'"||j==="`"){W=j,U++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}U++}if(q!==0)break;let B=X.substring(K+1,U),_=Y(B);X=X.substring(0,G)+_+X.substring(U+1)}return X}function Pz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);I5(Q);let U=Z0(Q,G)(...K),W=JSON.stringify(U),z=Buffer.from(W,"utf8").toString("base64");return`__stx_${J}="${z}"`}catch(G){return X}}),Y}function Cz($,Z){let Y=$;return Y=E4(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if($0(Q)){let K=Z0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?k4:""}catch{return""}}),Y=E4(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if($0(Q)){let K=Z0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?S4:""}catch{return""}}),Y}function vz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,k4),Z=Z.replace(/@continue(?!\()/g,S4),Z}function SY($){let Z=$.includes(k4),Y=Z?$.substring(0,$.indexOf(k4)):$;return{hasBreak:Z,content:Y}}function bY($){let Z=$.includes(S4),Y=Z?$.substring(0,$.indexOf(S4)):$;return{hasContinue:Z,content:Y}}function PY($){let Z=$;return Z=E4(Z,"@break",(Y)=>{let X=Y.trim();if(!D5(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=E4(Z,"@continue",(Y)=>{let X=Y.trim();if(!D5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function xz($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,z)=>W.pos-z.pos);let K=[],q=0;for(let W of X)q+=W.delta,K.push({pos:W.pos,depth:q});function U(W){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=W)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(U(Y.index)>0)continue;let W=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,w=V,A=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(R>0&&w<$.length){A.lastIndex=w,N.lastIndex=w;let S=A.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)R++,w=S.index+S[0].length;else{if(R--,R===0){M=b.index;break}w=b.index+11}}if(M===-1)continue;let T=$.substring(V,M),I=M+11,D=-1,E=0,k=0;while(k<T.length){let S=T.indexOf("@",k);if(S===-1)break;let b=T.substring(S);if(/^@forelse\s*\(/.test(b))E++,k=S+1;else if(b.startsWith("@endforelse"))E--,k=S+11;else if(E===0&&b.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){D=S;break}k=S+1}else k=S+1}if(D===-1)continue;return{start:W,end:I,arrayExpr:F,itemVar:O,foreachContent:T.substring(0,D),emptyContent:T.substring(D+6)}}return null}function yY($,Z){let Y=$;while(!0){let X=xz(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:U}=X;try{let W;if($0(G))W=Z0(G,Object.keys(Z))(...Object.values(Z));else W=e(G,Z);let z;if(!Array.isArray(W)||W.length===0)z=U;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,J)+z+Y.substring(Q)}catch(W){let z=W instanceof Error?W.message:String(W),B=r("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,p.EVALUATION_ERROR);Y=Y.substring(0,J)+B+Y.substring(Q)}}return Y}function P6($,Z,Y,X){let J=$;J=yY(J,Z);function Q(q){let U=/@foreach\s*\(/g,W;while((W=U.exec(q))!==null){let z=W.index,B=W.index+W[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),R=L.substring(F+4),w=H+1,A=1,N=w,M=/@foreach\s*\(/g,T=/@endforeach/g;while(A>0&&N<q.length){M.lastIndex=N,T.lastIndex=N;let I=M.exec(q),D=T.exec(q);if(!D)break;if(I&&I.index<D.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(w,D.index),k=D.index+11;return{start:O,end:k,arrayExpr:V,itemVar:R,content:E}}N=D.index+11}}}return null}function G(q,U){let W=q;while(!0){let z=Q(W);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if($0(F))O=Z0(F,Object.keys(U))(...Object.values(U));else O=e(F,U);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=r("Foreach",`Error in @foreach: ${F} is not iterable`,p.TYPE_ERROR);W=W.substring(0,B)+D+W.substring(_);continue}let R=X?.loops?.useAltLoopVariable??bz,w=H.trim(),A=null,N,M=!1;if(w.includes("=>")){let D=w.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])A=D[0],N=D[1];else N=w}else if(!w.startsWith("[")&&!w.startsWith("{")&&w.includes(",")){let D=w.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],A=D[1],M=!0;else N=w}else N=w;let T="",I=O;for(let D=0;D<I.length;D++){let E=I[D],k={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...U,loop:k,$loop:k};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))f.forEach((m,o)=>{if(m)S[m]=E[o]});else S[N]=E}else S[N]=E;if(A)if(!M&&V&&Array.isArray(E)&&E.length===2)S[A]=E[0],S[N]=E[1];else S[A]=D;let b=Cz(L,S),y=bY(b);if(y.hasContinue){T+=y.content;continue}let d=SY(b);if(d.hasBreak){T+=d.content;break}if(b=yY(b,S),b=G(b,S),b=x1(b,S,Y),b=vz(b),d=SY(b),d.hasBreak){T+=d.content;break}if(y=bY(b),y.hasContinue){T+=y.content;continue}b=s0(b,S,Y),b=Pz(b,S),b=yz(b,S),T+=b}W=W.substring(0,B)+T+W.substring(_)}catch(F){let O=r("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,p.EVALUATION_ERROR);W=W.substring(0,B)+O+W.substring(_)}}return W}J=G(J,Z),J=vY(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??Sz;return J=hz(J,Z,K),J}function CY($){return D5($)}function vY($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,U=O0(J,"(",")",q);if(U===-1)break;let W=J.slice(q+1,U),z=U+1,B=z4(J.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!CY(W)){let H=r("For",`Unsafe expression in @for: ${W}`,p.UNSAFE_EXPRESSION);J=J.substring(0,K)+H+J.substring(j),Q=!0;continue}try{let H=fz(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let A=gz({forExpr:W,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});J=J.substring(0,K)+A+J.substring(j),Q=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=PY(V);let w=Function(...F,`
4190
+ ${G}`,J++}return{functionCode:X,nextIndex:J}}function NY($,Z){let Y=e($,Z)??e(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...r5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function kz($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,K]=Q;try{let q=K.trim().replace(/;$/,""),U=NY(q,Z);if(U!==void 0)Z[G]=U}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),U=NY(q,Z);if(U!==void 0)Z[G]=U}catch{}}}function EY($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function kY($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var a5=C(()=>{u5();a1();F0()});var xY={};l(xY,{processLoops:()=>P6});function yz($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")"){if(q--,q===0)break}U++}if(q!==0)continue;let W=X.substring(K+1,U),z=U+1,B=W.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=W.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=j0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;Q.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:U}=Q[G];X=X.substring(0,K)+U+X.substring(q)}return X}function E4($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,U=K+1,W=null,z=!1;while(U<X.length&&q>0){let j=X[U];if(z){z=!1,U++;continue}if(j==="\\"&&W){z=!0,U++;continue}if(W){if(j===W)W=null;U++;continue}if(j==='"'||j==="'"||j==="`"){W=j,U++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}U++}if(q!==0)break;let B=X.substring(K+1,U),_=Y(B);X=X.substring(0,G)+_+X.substring(U+1)}return X}function Pz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);I5(Q);let U=Z0(Q,G)(...K),W=JSON.stringify(U),z=Buffer.from(W,"utf8").toString("base64");return`__stx_${J}="${z}"`}catch(G){return X}}),Y}function Cz($,Z){let Y=$;return Y=E4(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if($0(Q)){let K=Z0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?k4:""}catch{return""}}),Y=E4(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if($0(Q)){let K=Z0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?S4:""}catch{return""}}),Y}function vz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,k4),Z=Z.replace(/@continue(?!\()/g,S4),Z}function SY($){let Z=$.includes(k4),Y=Z?$.substring(0,$.indexOf(k4)):$;return{hasBreak:Z,content:Y}}function bY($){let Z=$.includes(S4),Y=Z?$.substring(0,$.indexOf(S4)):$;return{hasContinue:Z,content:Y}}function PY($){let Z=$;return Z=E4(Z,"@break",(Y)=>{let X=Y.trim();if(!D5(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=E4(Z,"@continue",(Y)=>{let X=Y.trim();if(!D5(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function xz($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((W,z)=>W.pos-z.pos);let K=[],q=0;for(let W of X)q+=W.delta,K.push({pos:W.pos,depth:q});function U(W){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=W)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(U(Y.index)>0)continue;let W=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,w=V,A=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(R>0&&w<$.length){A.lastIndex=w,N.lastIndex=w;let S=A.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)R++,w=S.index+S[0].length;else{if(R--,R===0){M=b.index;break}w=b.index+11}}if(M===-1)continue;let T=$.substring(V,M),I=M+11,D=-1,E=0,k=0;while(k<T.length){let S=T.indexOf("@",k);if(S===-1)break;let b=T.substring(S);if(/^@forelse\s*\(/.test(b))E++,k=S+1;else if(b.startsWith("@endforelse"))E--,k=S+11;else if(E===0&&b.startsWith("@empty")){if(T.length<=S+6||!/[a-z]/i.test(T[S+6])){D=S;break}k=S+1}else k=S+1}if(D===-1)continue;return{start:W,end:I,arrayExpr:F,itemVar:O,foreachContent:T.substring(0,D),emptyContent:T.substring(D+6)}}return null}function yY($,Z){let Y=$;while(!0){let X=xz(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:U}=X;try{let W;if($0(G))W=Z0(G,Object.keys(Z))(...Object.values(Z));else W=e(G,Z);let z;if(!Array.isArray(W)||W.length===0)z=U;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,J)+z+Y.substring(Q)}catch(W){let z=W instanceof Error?W.message:String(W),B=r("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,p.EVALUATION_ERROR);Y=Y.substring(0,J)+B+Y.substring(Q)}}return Y}function P6($,Z,Y,X){let J=$;J=yY(J,Z);function Q(q){let U=/@foreach\s*\(/g,W;while((W=U.exec(q))!==null){let z=W.index,B=W.index+W[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),R=L.substring(F+4),w=H+1,A=1,N=w,M=/@foreach\s*\(/g,T=/@endforeach/g;while(A>0&&N<q.length){M.lastIndex=N,T.lastIndex=N;let I=M.exec(q),D=T.exec(q);if(!D)break;if(I&&I.index<D.index)A++,N=I.index+I[0].length;else{if(A--,A===0){let E=q.substring(w,D.index),k=D.index+11;return{start:O,end:k,arrayExpr:V,itemVar:R,content:E}}N=D.index+11}}}return null}function G(q,U){let W=q;while(!0){let z=Q(W);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if($0(F))O=Z0(F,Object.keys(U))(...Object.values(U));else O=e(F,U);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=r("Foreach",`Error in @foreach: ${F} is not iterable`,p.TYPE_ERROR);W=W.substring(0,B)+D+W.substring(_);continue}let R=X?.loops?.useAltLoopVariable??bz,w=H.trim(),A=null,N,M=!1;if(w.includes("=>")){let D=w.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])A=D[0],N=D[1];else N=w}else if(!w.startsWith("[")&&!w.startsWith("{")&&w.includes(",")){let D=w.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],A=D[1],M=!0;else N=w}else N=w;let T="",I=O;for(let D=0;D<I.length;D++){let E=I[D],k={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...U,loop:k,$loop:k};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))f.forEach((m,o)=>{if(m)S[m]=E[o]});else S[N]=E}else S[N]=E;if(A)if(!M&&V&&Array.isArray(E)&&E.length===2)S[A]=E[0],S[N]=E[1];else S[A]=D;let b=Cz(L,S),P=bY(b);if(P.hasContinue){T+=P.content;continue}let d=SY(b);if(d.hasBreak){T+=d.content;break}if(b=yY(b,S),b=G(b,S),b=x1(b,S,Y),b=vz(b),d=SY(b),d.hasBreak){T+=d.content;break}if(P=bY(b),P.hasContinue){T+=P.content;continue}b=s0(b,S,Y),b=Pz(b,S),b=yz(b,S),T+=b}W=W.substring(0,B)+T+W.substring(_)}catch(F){let O=r("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,p.EVALUATION_ERROR);W=W.substring(0,B)+O+W.substring(_)}}return W}J=G(J,Z),J=vY(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??Sz;return J=hz(J,Z,K),J}function CY($){return D5($)}function vY($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,U=O0(J,"(",")",q);if(U===-1)break;let W=J.slice(q+1,U),z=U+1,B=z4(J.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!CY(W)){let H=r("For",`Unsafe expression in @for: ${W}`,p.UNSAFE_EXPRESSION);J=J.substring(0,K)+H+J.substring(j),Q=!0;continue}try{let H=fz(W),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let A=gz({forExpr:W,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});J=J.substring(0,K)+A+J.substring(j),Q=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(A,N)=>{return`\${${N}}`});V=PY(V);let w=Function(...F,`
4191
4191
  let result = '';
4192
4192
  for (${W}) {
4193
4193
  result += \`${V}\`;
@@ -4209,7 +4209,7 @@ ${G}`,J++}return{functionCode:X,nextIndex:J}}function NY($,Z){let Y=e($,Z)??e(`(
4209
4209
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
4210
4210
  }
4211
4211
  return result;
4212
- `)(...j);X=X.substring(0,G)+F+X.substring(B),J=!0}catch(_){let j=r("While",`Error in @while(${U}): ${_ instanceof Error?_.message:String(_)}`,p.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),J=!0}}return X}var Sz=1000,bz=!1,k4="<!--__STX_BREAK__-->",S4="<!--__STX_CONTINUE__-->";var C6=P(()=>{_4();J1();r0();B4();F0()});import q0 from"path";function v6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function dz($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,q=1,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")")q--;U++}if(q!==0)break;let W=X.substring(K+1,U-1),z=`${Y}(${W})`;X=X.substring(0,G)+z+X.substring(U),J.lastIndex=G+z.length,Q=J.exec(X)}return X}function mz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function uz($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},U=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
4212
+ `)(...j);X=X.substring(0,G)+F+X.substring(B),J=!0}catch(_){let j=r("While",`Error in @while(${U}): ${_ instanceof Error?_.message:String(_)}`,p.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),J=!0}}return X}var Sz=1000,bz=!1,k4="<!--__STX_BREAK__-->",S4="<!--__STX_CONTINUE__-->";var C6=C(()=>{_4();J1();r0();B4();F0()});import q0 from"path";function v6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function dz($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,q=1,U=K+1;while(U<X.length&&q>0){if(X[U]==="(")q++;else if(X[U]===")")q--;U++}if(q!==0)break;let W=X.substring(K+1,U-1),z=`${Y}(${W})`;X=X.substring(0,G)+z+X.substring(U),J.lastIndex=G+z.length,Q=J.exec(X)}return X}function mz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function uz($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(z)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===z){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let z=1;while(Q<G&&z>0)if(Z[Q]==="{")z++,Q++;else if(Z[Q]==="}")z--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},U=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
4213
4213
  `)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},W=()=>{if(J!==0)return;let z=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))W();Q++}return Y.join(", ")}function hY($,Z=""){return`
4214
4214
  (function() {
4215
4215
  var { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
@@ -4244,20 +4244,20 @@ ${uz($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeR
4244
4244
  } finally {
4245
4245
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
4246
4246
  }
4247
- })();`}function pz($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function xA(){dY.clear()}function cz($){if($.__onceStore instanceof Set)return $.__onceStore;return dY}async function x6($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||q0.join(q0.dirname(Y),"partials");if(G&&!q0.isAbsolute(G))G=q0.resolve(process.cwd(),G);let K=dz($,"@partial","@include"),q=cz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),w=R.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let A=w[1],N=U(A,G,Y),M="";if(N&&await Bun.file(N).exists())J.add(N),M=`@include(${R})`;K=K.substring(0,L)+M+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,w=V+1;while(w<K.length&&R>0){if(K[w]==="(")R++;else if(K[w]===")")R--;w++}if(R!==0)break;let A=K.substring(V+1,w-1),N=v6(A,0);if(N===-1){L.lastIndex=w;continue}let M=A.substring(0,N).trim(),T=A.substring(N+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=w;continue}let D=I[1],E=T.substring(I[0].length),k,S=v6(E,0);if(S!==-1)k=E.substring(S+1).trim();try{let b=`Boolean(${M})`,y;if($0(b)){let m=Z0(b,Object.keys(Z));y=Boolean(m(...Object.values(Z)))}else y=Boolean(e(b,Z));let d=H?!y:y,f="";if(d){let m=U(D,G,Y);if(m&&await Bun.file(m).exists())J.add(m);f=`@include('${D}'${k?`, ${k}`:""})`}K=K.substring(0,O)+f+K.substring(w),L.lastIndex=0}catch(b){let y=b instanceof Error?b.message:String(b),d=Q0("Include",`Error evaluating ${j} condition: ${y}`,Y,$,O);K=K.substring(0,O)+d+K.substring(w),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),w=K.substring(L,V+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){j.lastIndex=0,K=K.replace(w,"");continue}let[,N,M,T,I]=A;try{let D,E=M.trim();if($0(E))D=Z0(E,Object.keys(Z))(...Object.values(Z));else D=e(E,Z);let k="";if(Array.isArray(D)&&D.length>0)for(let S of D){let b={...Z,[T]:S},y=await z(N,b,$,L);k+=y}else if(I)k=await z(I,{},$,L);K=K.substring(0,L)+k+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+Q0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),w=K.substring(L,V+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){j.lastIndex=0,K=K.replace(w,"");continue}let N=A[1],M=R.slice(A[0].length),T,I=M.match(/^\s*,\s*\{/);if(I){M=M.slice(I[0].length-1);let k=1,S=1;while(S<M.length&&k>0){if(M[S]==="{")k++;else if(M[S]==="}"){if(k--,k===0)break}S++}T=M.substring(0,S+1),M=M.slice(S+1)}let D,E=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let k=JSON.parse(N.replace(/'/g,'"')),S={};if(T)try{S=j0(T,Z)}catch(y){let d=y instanceof Error?y.message:String(y);if(X.debug){let f=Q0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,w);K=K.replace(w,()=>f)}else K=K.replace(w,()=>D||"");continue}let b=!1;for(let y of k){let d=U(y,G,Y);if(!d)continue;if(await i(d)){let f=await z(y,S,$,L);K=K.replace(w,()=>f),b=!0;break}}if(!b)if(D!==void 0)K=K.replace(w,()=>D);else if(X.debug){let y=Q0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,w);K=K.replace(w,()=>y)}else K=K.replace(w,"")}catch(k){let S=k instanceof Error?k.message:String(k),b=Q0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,w);K=K.replace(w,()=>b)}j.lastIndex=0}}function U(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=q0.resolve(H),V=q0.resolve(q0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=q0.resolve(H,F);else R=q0.resolve(V,F);let w=q0.normalize(R),A=w.startsWith(O+q0.sep)||w===O,N=w.startsWith(V+q0.sep)||w===V,M=!1,T=q0.dirname(V);if(w.startsWith(T+q0.sep)){if(!q0.relative(T,w).split(q0.sep).some((k)=>k.startsWith(".")&&k!=="."&&k!==".."))M=!0}if(!A&&!N&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return w}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let W=q0.resolve(Y);Q.add(W);async function z(j,H={},L,F){let O=U(j,G,Y);if(!O)return Q0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=q0.resolve(O);if(Q.has(V)){let R=[...Q,V].map((w)=>q0.basename(w)).join(" -> ");return Q0("Include",`Circular include detected: ${R}`,Y,L,F)}try{J.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return Q0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (e3(),t3));R=f(R,Z)}if(R&&(X.debug||!x5()&&!o$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (Z6(),a2));f(R,O)}catch{}let w=R;try{let{processESImports:f}=await Promise.resolve().then(() => (S6(),FY));await f(R,Z,O,X,J)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let A=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)w=A[1].trim();let M=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(D)],k="",S=null;for(let f of E){let m=f[1]||"",o=f[2]||"",N0=m.includes("server"),$1=l1(m),y0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:L0}=await Promise.resolve().then(() => (t5(),gY)),W0=X0(o,{filePath:O,projectRoot:process.cwd()});o=W0.code,y0=L0(W0.styles)}catch(X0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}if($1&&o.trim())o=p1(o);if(!N0)try{let{hasUserImports:X0,bundleClientScript:L0}=await Promise.resolve().then(() => (O$(),H$));if(X0(o))o=await L0(o,O,{projectRoot:process.cwd()})}catch(X0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}let D0=mz(o);if(D0&&!N0){S=`stx_scope_${q0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++fY}`;let X0=X1(o),L0=lz(X0,S);k+=`${y0}<script data-stx-scoped>${L0}</script>
4248
- `;continue}if(N0)try{let{extractVariables:X0}=await Promise.resolve().then(() => (a5(),D4));await X0(o,I,O)}catch(X0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,X0)}if(!N0&&!D0){let X0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${q0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++fY}`;let L0=X1(o),W0=`
4247
+ })();`}function pz($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function xA(){dY.clear()}function cz($){if($.__onceStore instanceof Set)return $.__onceStore;return dY}async function x6($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||q0.join(q0.dirname(Y),"partials");if(G&&!q0.isAbsolute(G))G=q0.resolve(process.cwd(),G);let K=dz($,"@partial","@include"),q=cz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),w=R.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=V;continue}let A=w[1],N=U(A,G,Y),M="";if(N&&await Bun.file(N).exists())J.add(N),M=`@include(${R})`;K=K.substring(0,L)+M+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,w=V+1;while(w<K.length&&R>0){if(K[w]==="(")R++;else if(K[w]===")")R--;w++}if(R!==0)break;let A=K.substring(V+1,w-1),N=v6(A,0);if(N===-1){L.lastIndex=w;continue}let M=A.substring(0,N).trim(),T=A.substring(N+1).trim(),I=T.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=w;continue}let D=I[1],E=T.substring(I[0].length),k,S=v6(E,0);if(S!==-1)k=E.substring(S+1).trim();try{let b=`Boolean(${M})`,P;if($0(b)){let m=Z0(b,Object.keys(Z));P=Boolean(m(...Object.values(Z)))}else P=Boolean(e(b,Z));let d=H?!P:P,f="";if(d){let m=U(D,G,Y);if(m&&await Bun.file(m).exists())J.add(m);f=`@include('${D}'${k?`, ${k}`:""})`}K=K.substring(0,O)+f+K.substring(w),L.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),d=Q0("Include",`Error evaluating ${j} condition: ${P}`,Y,$,O);K=K.substring(0,O)+d+K.substring(w),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),w=K.substring(L,V+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){j.lastIndex=0,K=K.replace(w,"");continue}let[,N,M,T,I]=A;try{let D,E=M.trim();if($0(E))D=Z0(E,Object.keys(Z))(...Object.values(Z));else D=e(E,Z);let k="";if(Array.isArray(D)&&D.length>0)for(let S of D){let b={...Z,[T]:S},P=await z(N,b,$,L);k+=P}else if(I)k=await z(I,{},$,L);K=K.substring(0,L)+k+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+Q0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),w=K.substring(L,V+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){j.lastIndex=0,K=K.replace(w,"");continue}let N=A[1],M=R.slice(A[0].length),T,I=M.match(/^\s*,\s*\{/);if(I){M=M.slice(I[0].length-1);let k=1,S=1;while(S<M.length&&k>0){if(M[S]==="{")k++;else if(M[S]==="}"){if(k--,k===0)break}S++}T=M.substring(0,S+1),M=M.slice(S+1)}let D,E=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let k=JSON.parse(N.replace(/'/g,'"')),S={};if(T)try{S=j0(T,Z)}catch(P){let d=P instanceof Error?P.message:String(P);if(X.debug){let f=Q0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,w);K=K.replace(w,()=>f)}else K=K.replace(w,()=>D||"");continue}let b=!1;for(let P of k){let d=U(P,G,Y);if(!d)continue;if(await i(d)){let f=await z(P,S,$,L);K=K.replace(w,()=>f),b=!0;break}}if(!b)if(D!==void 0)K=K.replace(w,()=>D);else if(X.debug){let P=Q0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,w);K=K.replace(w,()=>P)}else K=K.replace(w,"")}catch(k){let S=k instanceof Error?k.message:String(k),b=Q0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,w);K=K.replace(w,()=>b)}j.lastIndex=0}}function U(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=q0.resolve(H),V=q0.resolve(q0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=q0.resolve(H,F);else R=q0.resolve(V,F);let w=q0.normalize(R),A=w.startsWith(O+q0.sep)||w===O,N=w.startsWith(V+q0.sep)||w===V,M=!1,T=q0.dirname(V);if(w.startsWith(T+q0.sep)){if(!q0.relative(T,w).split(q0.sep).some((k)=>k.startsWith(".")&&k!=="."&&k!==".."))M=!0}if(!A&&!N&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${w}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return w}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let W=q0.resolve(Y);Q.add(W);async function z(j,H={},L,F){let O=U(j,G,Y);if(!O)return Q0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=q0.resolve(O);if(Q.has(V)){let R=[...Q,V].map((w)=>q0.basename(w)).join(" -> ");return Q0("Include",`Circular include detected: ${R}`,Y,L,F)}try{J.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(f){let m=f instanceof Error?f.message:String(f);return Q0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (e3(),t3));R=f(R,Z)}if(R&&(X.debug||!x5()&&!o$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (Z6(),a2));f(R,O)}catch{}let w=R;try{let{processESImports:f}=await Promise.resolve().then(() => (S6(),FY));await f(R,Z,O,X,J)}catch(f){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,f instanceof Error?f.message:f)}let A=w.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(A)w=A[1].trim();let M=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(M)T=`<style${M[1]}>${M[2]}</style>`;w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[f,m]of Object.entries(H))I[f]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(D)],k="",S=null;for(let f of E){let m=f[1]||"",o=f[2]||"",N0=m.includes("server"),$1=l1(m),y0="";try{let{extractAndStripCssImports:X0,renderVendorStyleTags:L0}=await Promise.resolve().then(() => (t5(),gY)),W0=X0(o,{filePath:O,projectRoot:process.cwd()});o=W0.code,y0=L0(W0.styles)}catch(X0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}if($1&&o.trim())o=p1(o);if(!N0)try{let{hasUserImports:X0,bundleClientScript:L0}=await Promise.resolve().then(() => (O$(),H$));if(X0(o))o=await L0(o,O,{projectRoot:process.cwd()})}catch(X0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,X0 instanceof Error?X0.message:X0)}let E0=mz(o);if(E0&&!N0){S=`stx_scope_${q0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++fY}`;let X0=X1(o),L0=lz(X0,S);k+=`${y0}<script data-stx-scoped>${L0}</script>
4248
+ `;continue}if(N0)try{let{extractVariables:X0}=await Promise.resolve().then(() => (a5(),D4));await X0(o,I,O)}catch(X0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,X0)}if(!N0&&!E0){let X0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${q0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++fY}`;let L0=X1(o),W0=`
4249
4249
  if (!window.stx._scopes) window.stx._scopes = {};
4250
4250
  window.stx._scopes['${S}'] = { __destroyCallbacks: __destroyHooks };
4251
- `,C=hY(L0,W0);k+=`${y0}<script data-stx-scoped${X0?` ${X0}`:""}>${C}</script>
4252
- `}}if(S){let f=pz(w,S);if(w=f.html,f.mergedIntoExisting)k=k.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await x6(w,I,O,X,J,Q);let{processLoops:b}=await Promise.resolve().then(() => (C6(),xY)),y=b(w,I,O);y=x1(y,I,O);let d=e1(R);if(y=s0(y,I,O,{forceSignals:d}),T)y+=`
4253
- `+T;if(k)y+=`
4254
- `+k;return y}catch(R){let w=R instanceof Error?R.message:String(R);return Q0("Include",`Error processing include ${j}: ${w}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let w=R[1],A,N=V.substring(R[0].length),M=v6(N,0);if(M!==-1)A=N.substring(M+1).trim();let T={};if(A)try{T=j0(A,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,Q0("Include",`Error parsing include variables for ${w}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(w,T,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function f6($,Z){let Y=$;function X(J,Q,G,K){let q=J,U=!0;while(U){U=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=q.match(W);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let w=q.slice(O),A=w.match(H),N=w.match(L),M=A?O+A.index:1/0,T=N?O+N.index:1/0;if(M<T)F++,O=M+(A[0].length||1);else if(T<1/0){if(F--,F===0){V=T;break}O=T+G.length+1}else break}if(V===-1)break;let R=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(R);else Z[_].push(R);q=q.substring(0,B)+q.substring(V+`@${G}`.length),U=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function g6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
4255
- `)})}var fY=0,vA,dY;var mY=P(()=>{_4();r0();$5();F0();V0();vA=new b5(500),dY=new Set});import*as h6 from"path";async function uY($,Z,Y=""){if(h6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return pY($,Z,Y,"@js","@endjs")}async function lY($,Z,Y=""){if(h6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return pY($,Z,Y,"@ts","@endts")}async function pY($,Z,Y,X,J){let Q=$,G=E1(`${X}([\\s\\S]*?)${J}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:U,content:W,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=W.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((w)=>w.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
4251
+ `,y=hY(L0,W0);k+=`${y0}<script data-stx-scoped${X0?` ${X0}`:""}>${y}</script>
4252
+ `}}if(S){let f=pz(w,S);if(w=f.html,f.mergedIntoExisting)k=k.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(w.includes("@include")||w.includes("@partial"))w=await x6(w,I,O,X,J,Q);let{processLoops:b}=await Promise.resolve().then(() => (C6(),xY)),P=b(w,I,O);P=x1(P,I,O);let d=e1(R);if(P=s0(P,I,O,{forceSignals:d}),T)P+=`
4253
+ `+T;if(k)P+=`
4254
+ `+k;return P}catch(R){let w=R instanceof Error?R.message:String(R);return Q0("Include",`Error processing include ${j}: ${w}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let w=R[1],A,N=V.substring(R[0].length),M=v6(N,0);if(M!==-1)A=N.substring(M+1).trim();let T={};if(A)try{T=j0(A,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,Q0("Include",`Error parsing include variables for ${w}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(w,T,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function f6($,Z){let Y=$;function X(J,Q,G,K){let q=J,U=!0;while(U){U=!1;let W=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),z=q.match(W);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${Q}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let w=q.slice(O),A=w.match(H),N=w.match(L),M=A?O+A.index:1/0,T=N?O+N.index:1/0;if(M<T)F++,O=M+(A[0].length||1);else if(T<1/0){if(F--,F===0){V=T;break}O=T+G.length+1}else break}if(V===-1)break;let R=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(R);else Z[_].push(R);q=q.substring(0,B)+q.substring(V+`@${G}`.length),U=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function g6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
4255
+ `)})}var fY=0,vA,dY;var mY=C(()=>{_4();r0();$5();F0();V0();vA=new b5(500),dY=new Set});import*as h6 from"path";async function uY($,Z,Y=""){if(h6.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return pY($,Z,Y,"@js","@endjs")}async function lY($,Z,Y=""){if(h6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return pY($,Z,Y,"@ts","@endts")}async function pY($,Z,Y,X,J){let Q=$,G=E1(`${X}([\\s\\S]*?)${J}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:U,content:W,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=W.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((w)=>w.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
4256
4256
  ${j}
4257
4257
  ${F}
4258
- `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(U,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=Q0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,U);console.error(j),Q=Q.replace(U,"")}return Q}var cY=P(()=>{$5();V0()});function iz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function iY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return iz(X,Q||"_method")})}function mA($,Z="_method"){if($&&typeof $[Z]==="string")return $[Z].toUpperCase();return null}async function nY($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(Q,Z,Y,X);if(typeof q==="string")Q=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let U=Q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
4258
+ `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(U,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=Q0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,U);console.error(j),Q=Q.replace(U,"")}return Q}var cY=C(()=>{$5();V0()});function iz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function iY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return iz(X,Q||"_method")})}function mA($,Z="_method"){if($&&typeof $[Z]==="string")return $[Z].toUpperCase();return null}async function nY($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(Q,Z,Y,X);if(typeof q==="string")Q=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let U=Q0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
4259
4259
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${d0(U)}</div>
4260
- `)}}}return Q}async function oY($,Z,Y,X){return nY($,Z,Y,X,"before")}async function sY($,Z,Y,X){return nY($,Z,Y,X,"after")}var rY=P(()=>{r0();V0()});import{defineRoute as rA,defineRoutes as aA,resetRoutes as tA,route as eA,setAppUrl as $N}from"stx-router";import{route as nz}from"stx-router";function aY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?j0(J,{}):{};return nz(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var tY=P(()=>{F0()});function ZN($,Z){if(!i0.exact[$])i0.exact[$]=[];i0.exact[$].push(Z)}function YN($,Z){let Y=typeof $==="string"?new RegExp($):$;i0.patterns.push({pattern:Y,callback:Z})}async function eY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(i0.exact[$])for(let X of i0.exact[$])await Promise.resolve(X(Z,$));if(i0.exact[Y])for(let X of i0.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of i0.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}function XN(){i0.patterns=[],i0.exact={}}var i0;var $X=P(()=>{i0={patterns:[],exact:{}}});function ZX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>ZX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function YX($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(U){return J.some(([W,z])=>U>=W&&U<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let U=Q[0],W=Q[2];if(!W||!W.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=W,j=!1;while((B=z.exec(W))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let w=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=ZX(w);if(A){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${A}"`);else _=_.replace(B[0],` class="${A}"`)}else _=_.replace(B[0],"");j=!0;continue}if(oz.has(H)){if(w)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(w===null||w===void 0||w===!1)_=_.replace(B[0],"");else{let A=String(w).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${A}"`)}j=!0}catch{continue}}if(j){let H=U.endsWith("/>")?" /":"",F=`<${Q[1]}${_}${H}>`;q.push({start:Q.index,end:Q.index+U.length,replacement:F})}}for(let U=q.length-1;U>=0;U--){let{start:W,end:z,replacement:B}=q[U];Y=Y.slice(0,W)+B+Y.slice(z)}return Y}var oz;var XX=P(()=>{oz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function c1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||sz.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function az($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function t0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=az($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function JX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function L5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function R1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function A1($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function tz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function ez($){let Z=$,Y=0;while(Y<Z.length){let X=c1(Z,Y);if(!X)break;let J=L5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let U=R1(X.attrs,"v-for"),W=R1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=t0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=A1(B,{...X,start:0,end:X.end-X.start},W),j=`@foreach(${q})
4260
+ `)}}}return Q}async function oY($,Z,Y,X){return nY($,Z,Y,X,"before")}async function sY($,Z,Y,X){return nY($,Z,Y,X,"after")}var rY=C(()=>{r0();V0()});import{defineRoute as rA,defineRoutes as aA,resetRoutes as tA,route as eA,setAppUrl as $N}from"stx-router";import{route as nz}from"stx-router";function aY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?j0(J,{}):{};return nz(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var tY=C(()=>{F0()});function ZN($,Z){if(!i0.exact[$])i0.exact[$]=[];i0.exact[$].push(Z)}function YN($,Z){let Y=typeof $==="string"?new RegExp($):$;i0.patterns.push({pattern:Y,callback:Z})}async function eY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(i0.exact[$])for(let X of i0.exact[$])await Promise.resolve(X(Z,$));if(i0.exact[Y])for(let X of i0.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of i0.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}function XN(){i0.patterns=[],i0.exact={}}var i0;var $X=C(()=>{i0={patterns:[],exact:{}}});function ZX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>ZX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function YX($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(U){return J.some(([W,z])=>U>=W&&U<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let U=Q[0],W=Q[2];if(!W||!W.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=W,j=!1;while((B=z.exec(W))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let w=Function(...F,`return (${L})`)(...O);if(H==="class"){let A=ZX(w);if(A){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${A}"`);else _=_.replace(B[0],` class="${A}"`)}else _=_.replace(B[0],"");j=!0;continue}if(oz.has(H)){if(w)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(w===null||w===void 0||w===!1)_=_.replace(B[0],"");else{let A=String(w).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${A}"`)}j=!0}catch{continue}}if(j){let H=U.endsWith("/>")?" /":"",F=`<${Q[1]}${_}${H}>`;q.push({start:Q.index,end:Q.index+U.length,replacement:F})}}for(let U=q.length-1;U>=0;U--){let{start:W,end:z,replacement:B}=q[U];Y=Y.slice(0,W)+B+Y.slice(z)}return Y}var oz;var XX=C(()=>{oz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function c1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||sz.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function az($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function t0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=az($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function JX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function L5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function R1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function A1($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function tz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function ez($){let Z=$,Y=0;while(Y<Z.length){let X=c1(Z,Y);if(!X)break;let J=L5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let U=R1(X.attrs,"v-for"),W=R1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=t0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=A1(B,{...X,start:0,end:X.end-X.start},W),j=`@foreach(${q})
4261
4261
  `,H=`${j}${_}
4262
4262
  @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function $B($){let Z=$,Y=0;while(Y<Z.length){let X=c1(Z,Y);if(!X)break;let J=L5(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=t0(Z,X),K=R1(X.attrs,"v-if"),q=A1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let U=G.outerEnd,W=!0;while(W){let H=Z.slice(U).match(/^\s*/),L=H?H[0].length:0,F=c1(Z,U+L);if(!F){W=!1;break}let O=L5(F.attrs,"v-else-if"),V=JX(F.attrs,"v-else");if(O!==null){let R=t0(Z,F),w=R1(F.attrs,"v-else-if"),A=A1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},w);Q.push({type:"else-if",expr:O,outerStart:U,outerEnd:R.outerEnd,element:A,parsedTag:F}),U=R.outerEnd}else if(V){let R=t0(Z,F),w=R1(F.attrs,"v-else"),A=A1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},w);Q.push({type:"else",outerStart:U,outerEnd:R.outerEnd,element:A,parsedTag:F}),W=!1}else W=!1}let z=[];for(let H of Q)if(H.type==="if")z.push(`@if(${H.expr})
4263
4263
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
@@ -4265,7 +4265,7 @@ ${H.element}`);else z.push(`@else
4265
4265
  ${H.element}`);z.push("@endif");let B=z.join(`
4266
4266
  `),_=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function ZB($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function YB($){let Z=$,Y=0;while(Y<Z.length){let X=c1(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let W=K[1],z=K[2],B=K[3];J=J.replace(K[0],""),J+=` :${W}="${B}" @update:${W}="${B} = $event"`,K=J.match(G)}if(Q){let W=t0(Z,X),z=Z.slice(W.outerStart,W.outerEnd),B=A1(z,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,W.outerStart)+B+Z.slice(W.outerEnd),Y=W.outerStart+B.length;continue}let q=L5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(rz.has(X.tag.toLowerCase())){let W=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=t0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=A1(B,{...X,start:0,end:X.end-X.start},W);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let W=X.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=t0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=A1(B,{...X,start:0,end:X.end-X.start},W);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function XB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function JB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function QB($){let Z=$,Y=0;while(Y<Z.length){let X=c1(Z,Y);if(!X)break;let J=L5(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=t0(Z,X),G=R1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function GB($){let Z=$,Y=0;while(Y<Z.length){let X=c1(Z,Y);if(!X)break;let J=L5(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=t0(Z,X),G=R1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function KB($){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 qB($){let Z=$,Y=0;while(Y<Z.length){let X=c1(Z,Y);if(!X)break;if(!JX(X.attrs,"v-once")){Y=X.end;continue}let J=R1(X.attrs,"v-once"),Q=t0(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
4267
4267
  ${A1(G,{...X,start:0,end:X.end-X.start},J)}
4268
- @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function UB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function WB($){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 QX($){if(!tz($))return $;let Z=$;return Z=ez(Z),Z=$B(Z),Z=qB(Z),Z=XB(Z),Z=JB(Z),Z=YB(Z),Z=ZB(Z),Z=WB(Z),Z=QB(Z),Z=GB(Z),Z=KB(Z),Z=UB(Z),Z}var sz,rz;var GX=P(()=>{sz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),rz=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 b4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function KX($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let U=K.length-1;U>=0;U--){let W=K[U];try{let z=e(W.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${b4(W.expr)}" -->`;Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}let B=W.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=e(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await K1(z,_,W.slotContent,L,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,W.index)+F+Q.slice(W.index+W.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${b4(B)} -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}}return Q=await zB(Q,Z,Y,X,J),Q}async function zB($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let U=K.length-1;U>=0;U--){let W=K[U];try{let z=e(W.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${b4(W.expr)}" -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length);continue}let B=X.componentsDir||"components",_=await K1(z,{},"",B,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${b4(B)} -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}}return Q}var qX=P(()=>{V0();F0()});function UX($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function WX($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=d6($),q=[],U=new Map;if(Q)for(let W of K){let z=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;U.set(B,_)}}for(let W of K){let z=zX(W,Z,X,J,U,G);q.push(z)}return q.join(`
4268
+ @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function UB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function WB($){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 QX($){if(!tz($))return $;let Z=$;return Z=ez(Z),Z=$B(Z),Z=qB(Z),Z=XB(Z),Z=JB(Z),Z=YB(Z),Z=ZB(Z),Z=WB(Z),Z=QB(Z),Z=GB(Z),Z=KB(Z),Z=UB(Z),Z}var sz,rz;var GX=C(()=>{sz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),rz=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 b4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function KX($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let U=K.length-1;U>=0;U--){let W=K[U];try{let z=e(W.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${b4(W.expr)}" -->`;Q=Q.slice(0,W.index)+O+Q.slice(W.index+W.full.length);continue}let B=W.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=e(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await K1(z,_,W.slotContent,L,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,W.index)+F+Q.slice(W.index+W.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${b4(B)} -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}}return Q=await zB(Q,Z,Y,X,J),Q}async function zB($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let U=K.length-1;U>=0;U--){let W=K[U];try{let z=e(W.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${b4(W.expr)}" -->`;Q=Q.slice(0,W.index)+j+Q.slice(W.index+W.full.length);continue}let B=X.componentsDir||"components",_=await K1(z,{},"",B,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${b4(B)} -->`;Q=Q.slice(0,W.index)+_+Q.slice(W.index+W.full.length)}}return Q}var qX=C(()=>{V0();F0()});function UX($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function WX($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=d6($),q=[],U=new Map;if(Q)for(let W of K){let z=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;U.set(B,_)}}for(let W of K){let z=zX(W,Z,X,J,U,G);q.push(z)}return q.join(`
4269
4269
 
4270
4270
  `)}function d6($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,J="",Q=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)Q=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(Q){G+=q;let U=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,W,z,B]=U;if(W==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(W==="media"||W==="supports"||W==="container"){let _=d6(B);Z.push({selector:`@${W} ${z.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
4271
4271
  `)})}else Z.push({selector:`@${W} ${z.trim()}`,declarations:B.trim()})}G="",Q=!1}else if(J.trim()){J+=q;let U=J.match(/([^{]+)\{([^}]*)\}/);if(U)Z.push({selector:U[1].trim(),declarations:U[2].trim()});J=""}continue}}if(Q)G+=q;else J+=q}return Z}function zX($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let W=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(W)||W} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=d6(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>zX(B,Z,Y,X,J,Q)).join(`
@@ -4292,7 +4292,7 @@ ${R.join(`
4292
4292
  </body>
4293
4293
  </html>`}function u6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function _X($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:J=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let U of X){let W=U.name?`name="${U.name}"`:U.property?`property="${U.property}"`:U.charset!=null?"charset=":U["http-equiv"]?`http-equiv="${U["http-equiv"]}"`:"";if(W&&K.includes(W))continue;q.push(` <meta ${Object.entries(U).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let U of J){if(U.href&&K.includes(`href="${U.href}"`))continue;q.push(` <link ${Object.entries(U).map(([W,z])=>`${W}="${z}"`).join(" ")}>`)}for(let U of Q)if(U.src){if(K.includes(`src="${U.src}"`))continue;q.push(` <script ${Object.entries(U).filter(([W])=>W!=="content").map(([W,z])=>`${W}="${z}"`).join(" ")}></script>`)}else if(U.content){if(K.includes(U.content))continue;q.push(` <script>${U.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
4294
4294
  `)}
4295
- ${$.slice(Y)}`}function jX($,Z={},Y={}){if(u6($))return $;return HB($,Z,Y)}var LN="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";function v4($){let Z=$,Y=new Set,X=new Set,J=()=>{if(x0)X.add(x0);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),e5)X.forEach((K)=>C4.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),J}function x4($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,e5)X.forEach((G)=>C4.add(G));else X.forEach((G)=>G())},Q=()=>{if(x0)X.add(x0);if(Y){let G=x0;x0=J,P4.push(J);try{Z=$()}finally{P4.pop(),x0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function f4($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=x0;x0=J,P4.push(J);try{Y=$()}finally{P4.pop(),x0=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function l6($){if(e5){$();return}e5=!0;try{$()}finally{e5=!1,C4.forEach((Z)=>Z()),C4.clear()}}function p6($){OB.push($)}function c6($){LB.push($)}function g4($){return typeof $==="function"&&$._isSignal===!0}function h4($){return typeof $==="function"&&$._isDerived===!0}function i6($){if(g4($)||h4($))return $();return $}function d4($){let Z=x0;x0=null;try{return $()}finally{x0=Z}}function FB($,Z){let Y=typeof $==="function"?$:()=>$,X=v4([]),J=x4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return f4(()=>{if(Y(),!Q){Q=!0;return}if(d4(()=>X().length))X.set([])}),[J,(K,q)=>{let U={action:K};X.set([...X(),U]);let W=()=>{let z=X().filter((B)=>B!==U);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(W,W);return W}]}var x0=null,P4,e5=!1,C4,OB,LB;var n6=P(()=>{P4=[],C4=new Set,OB=[],LB=[]});var OX={};l(OX,{useOptimistic:()=>FB,untrack:()=>i6,state:()=>v4,peek:()=>d4,onMount:()=>p6,onDestroy:()=>c6,isSignal:()=>g4,isDerived:()=>h4,generateSignalsRuntimeDev:()=>m4,generateSignalsRuntime:()=>HX,effect:()=>f4,derived:()=>x4,default:()=>wB,batch:()=>l6});function HX(){try{let $=VB(m4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return m4()}}function VB($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let J=$.indexOf(X,Y);if(J===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,J));let Q=1,G=J+X.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function m4(){return`
4295
+ ${$.slice(Y)}`}function jX($,Z={},Y={}){if(u6($))return $;return HB($,Z,Y)}var LN="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";function v4($){let Z=$,Y=new Set,X=new Set,J=()=>{if(x0)X.add(x0);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),e5)X.forEach((K)=>C4.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),J}function x4($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,e5)X.forEach((G)=>C4.add(G));else X.forEach((G)=>G())},Q=()=>{if(x0)X.add(x0);if(Y){let G=x0;x0=J,P4.push(J);try{Z=$()}finally{P4.pop(),x0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Q}function f4($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=x0;x0=J,P4.push(J);try{Y=$()}finally{P4.pop(),x0=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function l6($){if(e5){$();return}e5=!0;try{$()}finally{e5=!1,C4.forEach((Z)=>Z()),C4.clear()}}function p6($){OB.push($)}function c6($){LB.push($)}function g4($){return typeof $==="function"&&$._isSignal===!0}function h4($){return typeof $==="function"&&$._isDerived===!0}function i6($){if(g4($)||h4($))return $();return $}function d4($){let Z=x0;x0=null;try{return $()}finally{x0=Z}}function FB($,Z){let Y=typeof $==="function"?$:()=>$,X=v4([]),J=x4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return f4(()=>{if(Y(),!Q){Q=!0;return}if(d4(()=>X().length))X.set([])}),[J,(K,q)=>{let U={action:K};X.set([...X(),U]);let W=()=>{let z=X().filter((B)=>B!==U);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(W,W);return W}]}var x0=null,P4,e5=!1,C4,OB,LB;var n6=C(()=>{P4=[],C4=new Set,OB=[],LB=[]});var OX={};l(OX,{useOptimistic:()=>FB,untrack:()=>i6,state:()=>v4,peek:()=>d4,onMount:()=>p6,onDestroy:()=>c6,isSignal:()=>g4,isDerived:()=>h4,generateSignalsRuntimeDev:()=>m4,generateSignalsRuntime:()=>HX,effect:()=>f4,derived:()=>x4,default:()=>wB,batch:()=>l6});function HX(){try{let $=VB(m4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return m4()}}function VB($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let J=$.indexOf(X,Y);if(J===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,J));let Q=1,G=J+X.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function m4(){return`
4296
4296
  // STX Signals Runtime (Development Build)
4297
4297
  console.log('[stx] signals runtime loading');
4298
4298
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -9513,7 +9513,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
9513
9513
  }
9514
9514
  }
9515
9515
  })();
9516
- `}var wB;var LX=P(()=>{n6();n6();wB={state:v4,derived:x4,effect:f4,batch:l6,onMount:p6,onDestroy:c6,isSignal:g4,isDerived:h4,untrack:i6,peek:d4,generateSignalsRuntime:HX,generateSignalsRuntimeDev:m4}});var o6={};l(o6,{templateCache:()=>FX,readFileCached:()=>RB,invalidateFileCacheByDir:()=>NB,invalidateFileCache:()=>AB,hashFilePath:()=>$$,getCachedSignalsRuntime:()=>IB,getCachedRouterScript:()=>DB,clearDevCaches:()=>EB,checkCache:()=>kB,cacheTemplate:()=>SB,__setSignalsGeneratorsForTest:()=>MB});import N1 from"fs";import F5 from"path";async function RB($){let Y;for(let X=0;X<3;X++)try{let Q=(await N1.promises.stat($)).mtime.getTime(),G=i1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),U=(await N1.promises.stat($)).mtime.getTime();if(U!==Q)continue;return i1.set($,{content:K,mtime:U}),K}catch(J){Y=J;break}throw i1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function AB($){i1.delete($)}function NB($){for(let Z of i1.keys())if(Z.startsWith($))i1.delete(Z)}function MB($){VX=$}async function IB($=!1){let Z=VX??await Promise.resolve().then(() => (LX(),OX));if($)return Z.generateSignalsRuntimeDev();if(u4===null)u4=Z.generateSignalsRuntime();return u4}async function DB(){if(l4===null){let{getRouterScript:$}=await import("stx-router");l4=$()}return l4}function EB(){i1.clear(),u4=null,TB=null,l4=null}function wX($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function kB($,Z){try{if(!Z.cachePath)return null;let Y=F5.resolve(Z.cachePath),X=F5.join(Y,`${$$($)}.html`),J=F5.join(Y,`${$$($)}.meta.json`);if(!await i(X)||!await i(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==wX(Z))return null;if((await N1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await N1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function SB($,Z,Y,X){try{if(!X.cachePath)return;let J=F5.resolve(X.cachePath);await N1.promises.mkdir(J,{recursive:!0});let Q=F5.join(J,`${$$($)}.html`),G=F5.join(J,`${$$($)}.meta.json`),K=await N1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:wX(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),FX.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function $$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,bB)}var FX,i1,u4=null,TB=null,VX=null,l4=null,bB=16;var s6=P(()=>{V0();FX=new Map,i1=new Map});function RX($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9516
+ `}var wB;var LX=C(()=>{n6();n6();wB={state:v4,derived:x4,effect:f4,batch:l6,onMount:p6,onDestroy:c6,isSignal:g4,isDerived:h4,untrack:i6,peek:d4,generateSignalsRuntime:HX,generateSignalsRuntimeDev:m4}});var o6={};l(o6,{templateCache:()=>FX,readFileCached:()=>RB,invalidateFileCacheByDir:()=>NB,invalidateFileCache:()=>AB,hashFilePath:()=>$$,getCachedSignalsRuntime:()=>IB,getCachedRouterScript:()=>DB,clearDevCaches:()=>EB,checkCache:()=>kB,cacheTemplate:()=>SB,__setSignalsGeneratorsForTest:()=>MB});import N1 from"fs";import F5 from"path";async function RB($){let Y;for(let X=0;X<3;X++)try{let Q=(await N1.promises.stat($)).mtime.getTime(),G=i1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),U=(await N1.promises.stat($)).mtime.getTime();if(U!==Q)continue;return i1.set($,{content:K,mtime:U}),K}catch(J){Y=J;break}throw i1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function AB($){i1.delete($)}function NB($){for(let Z of i1.keys())if(Z.startsWith($))i1.delete(Z)}function MB($){VX=$}async function IB($=!1){let Z=VX??await Promise.resolve().then(() => (LX(),OX));if($)return Z.generateSignalsRuntimeDev();if(u4===null)u4=Z.generateSignalsRuntime();return u4}async function DB(){if(l4===null){let{getRouterScript:$}=await import("stx-router");l4=$()}return l4}function EB(){i1.clear(),u4=null,TB=null,l4=null}function wX($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function kB($,Z){try{if(!Z.cachePath)return null;let Y=F5.resolve(Z.cachePath),X=F5.join(Y,`${$$($)}.html`),J=F5.join(Y,`${$$($)}.meta.json`);if(!await i(X)||!await i(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==wX(Z))return null;if((await N1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await N1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function SB($,Z,Y,X){try{if(!X.cachePath)return;let J=F5.resolve(X.cachePath);await N1.promises.mkdir(J,{recursive:!0});let Q=F5.join(J,`${$$($)}.html`),G=F5.join(J,`${$$($)}.meta.json`),K=await N1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:wX(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),FX.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function $$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,bB)}var FX,i1,u4=null,TB=null,VX=null,l4=null,bB=16;var s6=C(()=>{V0();FX=new Map,i1=new Map});function RX($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9517
9517
  `;let J=/\{\{([\s\S]*?)\}\}/g;while((X=J.exec($))!==null)Y+=X[1]+`
9518
9518
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,U,W=!1;while((U=q.exec(Y))!==null)if(!K.has(U[1])){W=!0;break}if(!G&&!W)return $;let z=`<script type="module">
9519
9519
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -9550,23 +9550,23 @@ if(window.stx)window.stx._latestSetup=${G};
9550
9550
  `)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},_=()=>{if(J!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let R=V.trim();if(!R)return;let w=R.indexOf(":"),N=(w>=0?R.slice(w+1).trim():R).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let R=V.trim().replace(/^\.\.\./,"");if(!R)return;let w=R.split(/[\s=]/)[0];if(w&&!X.has(w))Y.push(w),X.add(w)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(B())continue;if(Z[Q]==="'"||Z[Q]==='"'){W(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){z(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&U()){q(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))_();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function $9($,Z,Y,X){if(!n4($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await SX(J,Y,X);if(J=Q,J=await AX(J,Z),J=RX(J),G)if(J.includes("</head>"))J=J.replace("</head>",`${G}
9551
9551
  </head>`);else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
9552
9552
  ${G}`);else J=J+`
9553
- `+G;let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=q&&/data-stx/.test(q[1]);if(!G&&!U&&q&&!/data-stx-auto/.test(q[1])){let W=/<body[^>]*>/i,z=/<(script|style)\b[\s\S]*?<\/\1>/gi,B=[],_;while((_=z.exec(J))!==null)B.push([_.index,_.index+_[0].length]);let j=0,H=-1;while(j<J.length){W.lastIndex=j;let L=W.exec(J.slice(j));if(!L)break;let F=j+L.index;if(!B.some(([V,R])=>F>=V&&F<R)){H=F;break}j=F+L[0].length}if(H!==-1){let L=J.slice(0,H),F=J.slice(H).replace(W,(O)=>O.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=L+F}}return J}var yB=0,p4,DX,MX,r6,hB;var Z9=P(()=>{t5();B4();V0();p4=/<script\b([^>]*)>/gi,DX=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;MX=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"]);r6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);hB=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import V5 from"path";function PX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function CX($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=V5.join(J,$);if(await Bun.file(G).exists())return G;J=V5.dirname(J)}X=V5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=V5.resolve(Z,$);else X=V5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function vX($,Z,Y){let X=$,J=V5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[U,W,z,B]=G;if(PX(z))continue;let _=await CX(z,J,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:o0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
9553
+ `+G;let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=q&&/data-stx/.test(q[1]);if(!G&&!U&&q&&!/data-stx-auto/.test(q[1])){let W=/<body[^>]*>/i,z=/<(script|style)\b[\s\S]*?<\/\1>/gi,B=[],_;while((_=z.exec(J))!==null)B.push([_.index,_.index+_[0].length]);let j=0,H=-1;while(j<J.length){W.lastIndex=j;let L=W.exec(J.slice(j));if(!L)break;let F=j+L.index;if(!B.some(([V,R])=>F>=V&&F<R)){H=F;break}j=F+L[0].length}if(H!==-1){let L=J.slice(0,H),F=J.slice(H).replace(W,(O)=>O.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=L+F}}return J}var yB=0,p4,DX,MX,r6,hB;var Z9=C(()=>{t5();B4();V0();p4=/<script\b([^>]*)>/gi,DX=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;MX=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"]);r6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);hB=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import V5 from"path";function PX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function CX($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=V5.join(J,$);if(await Bun.file(G).exists())return G;J=V5.dirname(J)}X=V5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=V5.resolve(Z,$);else X=V5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function vX($,Z,Y){let X=$,J=V5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[U,W,z,B]=G;if(PX(z))continue;let _=await CX(z,J,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:o0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
9554
9554
  // Source: ${z}
9555
9555
  ${j}
9556
9556
  </script>`;X=X.replace(U,H),Q.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[U,W,z,B]=q,_=W+B;if(PX(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await CX(z,J,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9557
9557
  /* Source: ${z} */
9558
9558
  ${L}
9559
- </style>`;X=X.replace(U,F),K.lastIndex=0}catch(L){}}}return X}var xX=P(()=>{a1()});function o4($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,q=G+1,U=null,W=!1;while(q<Y.length&&K>0){let V=Y[q];if(W){W=!1,q++;continue}if(V==="\\"&&U){W=!0,q++;continue}if(U){if(V===U)U=null;q++;continue}if(V==='"'||V==="'"||V==="`"){U=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(Q,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let R=z[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),R;if($0(V))R=Z0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let w;if(O==="true")w=JSON.stringify(R,null,2);else w=JSON.stringify(R);let A=w.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+A+Y.substring(q+1),X.lastIndex=Q+A.length}catch(V){u0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+B.length}}return Y}function s4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function fX($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let U=Z.slice(G,q-1).trim(),W=q,z=Z.slice(W),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=W+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,R=F.slice(0,F.length-V),w=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(w){let[N,M,T="",I]=w,D=`<${M}${T} data-stx-memo="${U}"${I}>`;A=_.slice(0,L)+D+R.slice(N.length)+_.slice(L+R.length)}else A=`${_.slice(0,L)}<div data-stx-memo="${U}">${R}</div>${_.slice(L+R.length)}`;J.push({start:Q,end:j,replacement:A}),Y.lastIndex=j}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Y9($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function gX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,q=!1,U=!1,W=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(U){if(H==='"')U=!1}else if(H==="'")q=!0;else if(H==='"')U=!0;else if(H===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let B=$.slice(W+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(J,W)+" x-cloak>",J=W+1}return X+=$.slice(J),X}function hX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,Q);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=Q+J[0].length,q=!1,U=!1,W=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(U){if(j==='"')U=!1}else if(j==="'")q=!0;else if(j==='"')U=!0;else if(j===">"){W=K;break}K++}if(W===-1)continue;let z=$.slice(Q+J[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!uB.test(z))continue;let B=$[W-1]==="/",_=B?W-1:W;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var uB;var X9=P(()=>{J1();F0();uB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function r4($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},J=X.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:q}of lB){if(J.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let U=$.match(G);if(U&&U.length>0){let W=$.split(`
9559
+ </style>`;X=X.replace(U,F),K.lastIndex=0}catch(L){}}}return X}var xX=C(()=>{a1()});function o4($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,q=G+1,U=null,W=!1;while(q<Y.length&&K>0){let V=Y[q];if(W){W=!1,q++;continue}if(V==="\\"&&U){W=!0,q++;continue}if(U){if(V===U)U=null;q++;continue}if(V==='"'||V==="'"||V==="`"){U=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(Q,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let R=z[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),R;if($0(V))R=Z0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let w;if(O==="true")w=JSON.stringify(R,null,2);else w=JSON.stringify(R);let A=w.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+A+Y.substring(q+1),X.lastIndex=Q+A.length}catch(V){u0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+B.length}}return Y}function s4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function fX($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let U=Z.slice(G,q-1).trim(),W=q,z=Z.slice(W),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=W+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,R=F.slice(0,F.length-V),w=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),A;if(w){let[N,M,T="",I]=w,D=`<${M}${T} data-stx-memo="${U}"${I}>`;A=_.slice(0,L)+D+R.slice(N.length)+_.slice(L+R.length)}else A=`${_.slice(0,L)}<div data-stx-memo="${U}">${R}</div>${_.slice(L+R.length)}`;J.push({start:Q,end:j,replacement:A}),Y.lastIndex=j}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Y9($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function gX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,q=!1,U=!1,W=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(U){if(H==='"')U=!1}else if(H==="'")q=!0;else if(H==='"')U=!0;else if(H===">"){W=K;break}K++}if(W===-1)continue;if($.slice(G,W+1).includes("x-cloak"))continue;let B=$.slice(W+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(J,W)+" x-cloak>",J=W+1}return X+=$.slice(J),X}function hX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,Q);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=Q+J[0].length,q=!1,U=!1,W=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(U){if(j==='"')U=!1}else if(j==="'")q=!0;else if(j==='"')U=!0;else if(j===">"){W=K;break}K++}if(W===-1)continue;let z=$.slice(Q+J[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!uB.test(z))continue;let B=$[W-1]==="/",_=B?W-1:W;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var uB;var X9=C(()=>{J1();F0();uB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function r4($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},J=X.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:q}of lB){if(J.some((W)=>K.includes(W)||G.source.includes(W)))continue;G.lastIndex=0;let U=$.match(G);if(U&&U.length>0){let W=$.split(`
9560
9560
  `),z=[];W.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))z.push(j+1)});let B=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";Q.push(` \u2717 ${K}${B}
9561
9561
  \u2192 ${q}`)}}if(Q.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9562
9562
  ${Q.join(`
9563
9563
  `)}
9564
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var lB;var J9=P(()=>{lB=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var dX={};l(dX,{getStoreScript:()=>pB,clearStoreCache:()=>cB});import a4 from"path";async function pB($){let Z;if($)Z=a4.resolve($);else{let W=await X4();Z=a4.resolve(W.root||process.cwd(),W.storesDir||"stores")}let Y=w5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),J=[];try{for await(let W of X.scan({cwd:Z,absolute:!0})){let z=a4.basename(W,".ts");if(["index","types"].includes(z))continue;if(W.includes(".d.ts"))continue;J.push(W)}}catch{return w5.set(Z,""),null}if(J.length===0)return w5.set(Z,""),null;let Q=[];for(let W of J){let z=await Bun.file(W).text();Q.push({file:W,hasUseStore:/useStore\s*\(/.test(z)})}Q.sort((W,z)=>{if(W.hasUseStore===z.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=Q.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()});for(let W of G)try{let z=await Bun.file(W).text(),B=a4.basename(W,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9564
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var lB;var J9=C(()=>{lB=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var dX={};l(dX,{getStoreScript:()=>pB,clearStoreCache:()=>cB});import a4 from"path";async function pB($){let Z;if($)Z=a4.resolve($);else{let W=await X4();Z=a4.resolve(W.root||process.cwd(),W.storesDir||"stores")}let Y=w5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),J=[];try{for await(let W of X.scan({cwd:Z,absolute:!0})){let z=a4.basename(W,".ts");if(["index","types"].includes(z))continue;if(W.includes(".d.ts"))continue;J.push(W)}}catch{return w5.set(Z,""),null}if(J.length===0)return w5.set(Z,""),null;let Q=[];for(let W of J){let z=await Bun.file(W).text();Q.push({file:W,hasUseStore:/useStore\s*\(/.test(z)})}Q.sort((W,z)=>{if(W.hasUseStore===z.hasUseStore)return 0;return W.hasUseStore?1:-1});let G=Q.map((W)=>W.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()});for(let W of G)try{let z=await Bun.file(W).text(),B=a4.basename(W,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9565
9565
  ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${W}:`,z)}if(K.length===0)return w5.set(Z,""),null;let U=`;(function(){
9566
9566
  ${K.join(`
9567
9567
 
9568
9568
  `)}
9569
- })();`;return w5.set(Z,U),U}function cB(){w5.clear()}var w5;var mX=P(()=>{g5();a1();w5=new Map});var lX={};l(lX,{processDeferDirectives:()=>rB});function iB(){return`stx-defer-${++uX}`}function nB($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function oB($,Z,Y){let{trigger:X,value:J}=nB(Z),Q=Y,G,K,q,U=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)G=U[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:X,triggerValue:J,content:Q,placeholder:G,loading:K,error:q}}function sB($,Z){let{trigger:Y,triggerValue:X}=Z,J;switch(Y){case"visible":J=`
9569
+ })();`;return w5.set(Z,U),U}function cB(){w5.clear()}var w5;var mX=C(()=>{g5();a1();w5=new Map});var lX={};l(lX,{processDeferDirectives:()=>rB});function iB(){return`stx-defer-${++uX}`}function nB($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function oB($,Z,Y){let{trigger:X,value:J}=nB(Z),Q=Y,G,K,q,U=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)G=U[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)K=W[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:X,triggerValue:J,content:Q,placeholder:G,loading:K,error:q}}function sB($,Z){let{trigger:Y,triggerValue:X}=Z,J;switch(Y){case"visible":J=`
9570
9570
  const observer = new IntersectionObserver((entries) => {
9571
9571
  if (entries[0].isIntersecting) {
9572
9572
  observer.disconnect();
@@ -11516,7 +11516,7 @@ else {
11516
11516
  });
11517
11517
  })();
11518
11518
  </script>
11519
- `})}var l_;var WJ=P(()=>{l_={createVirtualList:Q9,processVirtualListDirectives:G9,processInfiniteListDirectives:KJ,processVirtualGridDirectives:qJ,generateVirtualListCSS:QJ,useVirtualList:GJ}});function zJ(){return`<script data-stx-hydration-runtime>
11519
+ `})}var l_;var WJ=C(()=>{l_={createVirtualList:Q9,processVirtualListDirectives:G9,processInfiniteListDirectives:KJ,processVirtualGridDirectives:qJ,generateVirtualListCSS:QJ,useVirtualList:GJ}});function zJ(){return`<script data-stx-hydration-runtime>
11520
11520
  (function() {
11521
11521
  'use strict';
11522
11522
 
@@ -11910,7 +11910,7 @@ else {
11910
11910
  <script type="application/json" id="stx-island-manifest">
11911
11911
  ${JSON.stringify(Z)}
11912
11912
  </script>
11913
- `}var a_;var MJ=P(()=>{a_={processPartialHydrationDirectives:HJ,processStaticDirectives:AJ,generatePartialHydrationCSS:OJ,generateIslandManifest:NJ,createIslandRegistry:jJ,hydrateIsland:LJ,hydrateByStrategy:FJ,hydrateAll:VJ,isHydrated:wJ,onHydrated:RJ}});var xJ={};l(xJ,{watchMultiple:()=>SJ,watchEffect:()=>bJ,watch:()=>kJ,unref:()=>IJ,toRefs:()=>DJ,throttledComputed:()=>vJ,stxWatchMultiple:()=>SJ,stxWatchEffect:()=>bJ,stxWatch:()=>kJ,stxUnref:()=>IJ,stxToRefs:()=>DJ,stxThrottledComputed:()=>vJ,stxShallowRef:()=>EJ,stxRef:()=>A5,stxIsRef:()=>T1,stxDebouncedComputed:()=>CJ,stxComputed:()=>Y$,shallowRef:()=>EJ,ref:()=>A5,processWatchDirectives:()=>PJ,processComputedDirectives:()=>yJ,isRef:()=>T1,default:()=>t_,debouncedComputed:()=>CJ,computed:()=>Y$});function A5($){let Z=$,Y=new Set,X={get value(){if(e0){let J=Z$.get(X);if(!J)J=new Set,Z$.set(X,J);J.add(e0)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=Z$.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function T1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function IJ($){return T1($)?$.value:$}function DJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=A5($[Y]);return Z}function EJ($){return A5($)}function Y$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,q=new Set,U=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function W(){K.clear();let B=e0;e0=U,t4.push(U);try{return Y()}finally{t4.pop(),e0=B}}let z={get value(){if(e0){let B=Z$.get(z);if(!B)B=new Set,Z$.set(z,B);B.add(e0)}if(G){let B=W();if(!J(Q,B))Q=B;G=!1}return Q},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function kJ($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,U=!1,W=()=>{if(T1($))return J?n1($.value):$.value;return $()},z=()=>{if(!q||U)return;let j=W();if(K!==void 0&&Object.is(K,j)&&!J)return;let H=()=>{if(Z(j,K),K=J?n1(j):j,G)_()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(T1($))B=$.subscribe(()=>z());else B=Y$($).subscribe(()=>z());if(X)K=void 0,z();else K=W();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{U=!0},_.resume=()=>{U=!1},_}function SJ($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((z)=>T1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>T1(B)?B.value:void 0);if(Z(z,Q),Q=[...z],J)W()},U=$.map((z)=>{if(T1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let W=()=>{G=!1,U.forEach((z)=>z())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function bJ($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let q=e0;e0=G,t4.push(G);try{X=$()}finally{t4.pop(),e0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function yJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function PJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
11913
+ `}var a_;var MJ=C(()=>{a_={processPartialHydrationDirectives:HJ,processStaticDirectives:AJ,generatePartialHydrationCSS:OJ,generateIslandManifest:NJ,createIslandRegistry:jJ,hydrateIsland:LJ,hydrateByStrategy:FJ,hydrateAll:VJ,isHydrated:wJ,onHydrated:RJ}});var xJ={};l(xJ,{watchMultiple:()=>SJ,watchEffect:()=>bJ,watch:()=>kJ,unref:()=>IJ,toRefs:()=>DJ,throttledComputed:()=>vJ,stxWatchMultiple:()=>SJ,stxWatchEffect:()=>bJ,stxWatch:()=>kJ,stxUnref:()=>IJ,stxToRefs:()=>DJ,stxThrottledComputed:()=>vJ,stxShallowRef:()=>EJ,stxRef:()=>A5,stxIsRef:()=>T1,stxDebouncedComputed:()=>CJ,stxComputed:()=>Y$,shallowRef:()=>EJ,ref:()=>A5,processWatchDirectives:()=>PJ,processComputedDirectives:()=>yJ,isRef:()=>T1,default:()=>t_,debouncedComputed:()=>CJ,computed:()=>Y$});function A5($){let Z=$,Y=new Set,X={get value(){if(e0){let J=Z$.get(X);if(!J)J=new Set,Z$.set(X,J);J.add(e0)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=Z$.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function T1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function IJ($){return T1($)?$.value:$}function DJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=A5($[Y]);return Z}function EJ($){return A5($)}function Y$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,q=new Set,U=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function W(){K.clear();let B=e0;e0=U,t4.push(U);try{return Y()}finally{t4.pop(),e0=B}}let z={get value(){if(e0){let B=Z$.get(z);if(!B)B=new Set,Z$.set(z,B);B.add(e0)}if(G){let B=W();if(!J(Q,B))Q=B;G=!1}return Q},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function kJ($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,U=!1,W=()=>{if(T1($))return J?n1($.value):$.value;return $()},z=()=>{if(!q||U)return;let j=W();if(K!==void 0&&Object.is(K,j)&&!J)return;let H=()=>{if(Z(j,K),K=J?n1(j):j,G)_()};if(Q==="sync")H();else if(Q==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(T1($))B=$.subscribe(()=>z());else B=Y$($).subscribe(()=>z());if(X)K=void 0,z();else K=W();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{U=!0},_.resume=()=>{U=!1},_}function SJ($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((z)=>T1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>T1(B)?B.value:void 0);if(Z(z,Q),Q=[...z],J)W()},U=$.map((z)=>{if(T1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let W=()=>{G=!1,U.forEach((z)=>z())};return W.pause=()=>{K=!0},W.resume=()=>{K=!1},W}function bJ($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let q=e0;e0=G,t4.push(G);try{X=$()}finally{t4.pop(),e0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function yJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function PJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
11914
11914
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
11915
11915
  (function() {
11916
11916
  // Watch implementation for ${Q}
@@ -11922,9 +11922,9 @@ else {
11922
11922
  }
11923
11923
  })();
11924
11924
  </script>
11925
- `})}function n1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>n1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(n1(J),n1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(n1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=n1($[Y]);return Z}function CJ($,Z=100){let Y=A5($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return Y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function vJ($,Z=100){let Y=A5($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return Y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var e0=null,t4,Z$,t_;var fJ=P(()=>{t4=[],Z$=new WeakMap;t_={ref:A5,computed:Y$,watch:kJ,watchMultiple:SJ,watchEffect:bJ,isRef:T1,unref:IJ,toRefs:DJ,shallowRef:EJ,debouncedComputed:CJ,throttledComputed:vJ,processComputedDirectives:yJ,processWatchDirectives:PJ}});var mJ={};l(mJ,{v:()=>e_,processHasErrorsDirective:()=>dJ,processFormValidationDirectives:()=>Zj,processErrorsDirective:()=>hJ,processErrorDirective:()=>gJ,defineForm:()=>$j,Validator:()=>N5});class N5{rules=[];defaultValue="";addRule($){let Z=new N5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new N5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new N5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function $j($,Z){let Y=Object.keys($),X={},J={},Q={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),J[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function U(O){K[O]=!0;let V=await $[O].validate(X[O],X);return J[O]=V,K[O]=!1,V.length===0}async function W(){q=!0;let O=await Promise.all(Y.map(U));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),J[O]=[],Q[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(Q[O]=V,V)U(O)}function H(O){return{value:X[O],errors:J[O],touched:Q[O],dirty:G[O],valid:J[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let w of Y)Q[w]=!0;if(await W())await O(X)}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((O)=>J[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:W,validateField:U,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function gJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
11925
+ `})}function n1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>n1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(n1(J),n1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(n1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=n1($[Y]);return Z}function CJ($,Z=100){let Y=A5($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return Y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function vJ($,Z=100){let Y=A5($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return Y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var e0=null,t4,Z$,t_;var fJ=C(()=>{t4=[],Z$=new WeakMap;t_={ref:A5,computed:Y$,watch:kJ,watchMultiple:SJ,watchEffect:bJ,isRef:T1,unref:IJ,toRefs:DJ,shallowRef:EJ,debouncedComputed:CJ,throttledComputed:vJ,processComputedDirectives:yJ,processWatchDirectives:PJ}});var mJ={};l(mJ,{v:()=>e_,processHasErrorsDirective:()=>dJ,processFormValidationDirectives:()=>Zj,processErrorsDirective:()=>hJ,processErrorDirective:()=>gJ,defineForm:()=>$j,Validator:()=>N5});class N5{rules=[];defaultValue="";addRule($){let Z=new N5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new N5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new N5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function $j($,Z){let Y=Object.keys($),X={},J={},Q={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),J[O]=[],Q[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function U(O){K[O]=!0;let V=await $[O].validate(X[O],X);return J[O]=V,K[O]=!1,V.length===0}async function W(){q=!0;let O=await Promise.all(Y.map(U));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),J[O]=[],Q[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(Q[O]=V,V)U(O)}function H(O){return{value:X[O],errors:J[O],touched:Q[O],dirty:G[O],valid:J[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let w of Y)Q[w]=!0;if(await W())await O(X)}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((O)=>J[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:W,validateField:U,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function gJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>{return G.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
11926
11926
  `)}catch{return""}})}function hJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>G.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
11927
- `)}catch{return""}})}function dJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return G}catch{return""}})}function Zj($,Z,Y){let X=$;return X=gJ(X,Z,Y),X=hJ(X,Z,Y),X=dJ(X,Z,Y),X}var e_;var uJ=P(()=>{e_=new N5});var cJ={};l(cJ,{processXElementDirectives:()=>Yj,hasXElementDirectives:()=>pJ,generateXElementRuntime:()=>lJ});function lJ(){return`<script data-stx-scoped>
11927
+ `)}catch{return""}})}function dJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let W of K)if(q&&typeof q==="object"&&W in q)q=q[W];else return"";let U=q;if(!U||!Array.isArray(U)||U.length===0)return"";return G}catch{return""}})}function Zj($,Z,Y){let X=$;return X=gJ(X,Z,Y),X=hJ(X,Z,Y),X=dJ(X,Z,Y),X}var e_;var uJ=C(()=>{e_=new N5});var cJ={};l(cJ,{processXElementDirectives:()=>Yj,hasXElementDirectives:()=>pJ,generateXElementRuntime:()=>lJ});function lJ(){return`<script data-stx-scoped>
11928
11928
  (function() {
11929
11929
  'use strict';
11930
11930
 
@@ -12213,7 +12213,7 @@ else {
12213
12213
  `+Z}import e4 from"fs";import $7 from"path";function Jj($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function Qj($,Z){let Y=$7.basename($);for(let X of Z)if(X.startsWith("*.")){let J=X.slice(1);if(Y.endsWith(J))return!0}else if(X.includes("*")){let J=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(J.test(Y)||J.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function Gj($,Z,Y){let X=$7.extname($).toLowerCase(),J=Xj[X],Q=(Y.maxFileSizeKB||500)*1024;if(Z>Q)return!1;if(Y.exclude&&Qj($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(J&&Y[J]===!0)return!0;if(!J)return!1;return!1}function iJ($,Z,Y,X){let J=e4.readdirSync($,{withFileTypes:!0});for(let Q of J){let G=$7.join($,Q.name);if(Q.isDirectory()){if(["node_modules",".git",".stx"].includes(Q.name))continue;iJ(G,Z,Y,X)}else if(Q.isFile()){let K=e4.statSync(G),q=$7.relative(Z,G);if(Gj(q,K.size,Y)){let U=e4.readFileSync(G),W=Jj(U),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:W,size:K.size})}}}}function T5($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!e4.existsSync($))return{entries:[],totalSize:0,fileCount:0};iJ($,$,Y,X),X.sort((Q,G)=>Q.url.localeCompare(G.url));let J=X.reduce((Q,G)=>Q+G.size,0);return{entries:X,totalSize:J,fileCount:X.length}}function X$($){if($.entries.length===0)return"[]";return`[
12214
12214
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
12215
12215
  `)}
12216
- ]`}function K9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var Xj;var Z7=P(()=>{Xj={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function q9($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function Y7($){return q9($).className}function nJ($){return{className:"ExpirationPlugin",importFrom:"workbox-expiration",options:{...$.maxEntries&&{maxEntries:$.maxEntries},...$.maxAgeSeconds&&{maxAgeSeconds:$.maxAgeSeconds},...$.purgeOnQuotaError!==void 0&&{purgeOnQuotaError:$.purgeOnQuotaError}}}}function oJ($){return{className:"CacheableResponsePlugin",importFrom:"workbox-cacheable-response",options:{...$.statuses&&{statuses:$.statuses},...$.headers&&{headers:$.headers}}}}function Kj($){return{className:"BackgroundSyncPlugin",importFrom:"workbox-background-sync",options:{name:$.name,...$.maxRetentionTime&&{maxRetentionTime:$.maxRetentionTime},...$.forceSyncFallback!==void 0&&{forceSyncFallback:$.forceSyncFallback}}}}function sJ($){let Z=q9($.strategy),Y=[];if($.maxAgeSeconds||$.maxEntries)Y.push(nJ({maxAgeSeconds:$.maxAgeSeconds,maxEntries:$.maxEntries,purgeOnQuotaError:!0}));if($.strategy==="network-first"||$.strategy==="stale-while-revalidate")Y.push(oJ({statuses:[0,200]}));return{urlPattern:$.pattern,handler:Z.className,options:{cacheName:$.cacheName,...Y.length>0&&{plugins:Y}}}}function qj($){return $.map((Z)=>sJ(Z))}function U9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,J=[];for(let Q of Y){let G=Y7(Q.strategy),K=[];if(Q.maxAgeSeconds||Q.maxEntries||X?.maxEntries){let U=Q.maxEntries||X?.maxEntries||100,W=Q.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
12216
+ ]`}function K9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var Xj;var Z7=C(()=>{Xj={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function q9($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function Y7($){return q9($).className}function nJ($){return{className:"ExpirationPlugin",importFrom:"workbox-expiration",options:{...$.maxEntries&&{maxEntries:$.maxEntries},...$.maxAgeSeconds&&{maxAgeSeconds:$.maxAgeSeconds},...$.purgeOnQuotaError!==void 0&&{purgeOnQuotaError:$.purgeOnQuotaError}}}}function oJ($){return{className:"CacheableResponsePlugin",importFrom:"workbox-cacheable-response",options:{...$.statuses&&{statuses:$.statuses},...$.headers&&{headers:$.headers}}}}function Kj($){return{className:"BackgroundSyncPlugin",importFrom:"workbox-background-sync",options:{name:$.name,...$.maxRetentionTime&&{maxRetentionTime:$.maxRetentionTime},...$.forceSyncFallback!==void 0&&{forceSyncFallback:$.forceSyncFallback}}}}function sJ($){let Z=q9($.strategy),Y=[];if($.maxAgeSeconds||$.maxEntries)Y.push(nJ({maxAgeSeconds:$.maxAgeSeconds,maxEntries:$.maxEntries,purgeOnQuotaError:!0}));if($.strategy==="network-first"||$.strategy==="stale-while-revalidate")Y.push(oJ({statuses:[0,200]}));return{urlPattern:$.pattern,handler:Z.className,options:{cacheName:$.cacheName,...Y.length>0&&{plugins:Y}}}}function qj($){return $.map((Z)=>sJ(Z))}function U9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,J=[];for(let Q of Y){let G=Y7(Q.strategy),K=[];if(Q.maxAgeSeconds||Q.maxEntries||X?.maxEntries){let U=Q.maxEntries||X?.maxEntries||100,W=Q.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
12217
12217
  maxEntries: ${U},
12218
12218
  ${W?`maxAgeSeconds: ${W},`:""}
12219
12219
  purgeOnQuotaError: true,
@@ -12517,7 +12517,7 @@ self.addEventListener('message', (event) => {
12517
12517
  event.waitUntil(syncQueue.pushRequest({ request }));
12518
12518
  }
12519
12519
  });
12520
- `}function B9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function aJ($){if(B9($))return z9;let{generateServiceWorker:Z}=(X7(),R9(eJ));return Z}var _9=P(()=>{Z7()});var eJ={};l(eJ,{isWorkboxEnabled:()=>H9,getServiceWorkerFileName:()=>J$,generateServiceWorkerAuto:()=>$Q,generateServiceWorker:()=>j9});function j9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},J=Y.routes||[],Q=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,U=Y.backgroundSync,W=Y.cacheStorage,z=Z?T5(Z,$):null,B=z?X$(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
12520
+ `}function B9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function aJ($){if(B9($))return z9;let{generateServiceWorker:Z}=(X7(),R9(eJ));return Z}var _9=C(()=>{Z7()});var eJ={};l(eJ,{isWorkboxEnabled:()=>H9,getServiceWorkerFileName:()=>J$,generateServiceWorkerAuto:()=>$Q,generateServiceWorker:()=>j9});function j9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},J=Y.routes||[],Q=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,U=Y.backgroundSync,W=Y.cacheStorage,z=Z?T5(Z,$):null,B=z?X$(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
12521
12521
  * Service Worker - Auto-generated by stx
12522
12522
  * Cache Version: ${Q}
12523
12523
  *
@@ -13343,7 +13343,7 @@ self.addEventListener('message', (event) => {
13343
13343
  event.waitUntil(registerFormSync(event.data.payload));
13344
13344
  }
13345
13345
  });
13346
- `}function J$($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function H9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function $Q($,Z){if(!$.pwa?.enabled)return"";if(H9($)){let{generateWorkboxServiceWorker:Y}=(_9(),R9(tJ));return Y($,Z)}return j9($,Z)}var X7=P(()=>{Z7()});var XQ={};l(XQ,{injectPwaTags:()=>ZQ,generateThemeColorMeta:()=>Vj,generateSwRegistrationScript:()=>YQ,generatePwaTags:()=>J7,generateManifestLink:()=>Fj});function J7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",J=J$($),Q=`
13346
+ `}function J$($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function H9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function $Q($,Z){if(!$.pwa?.enabled)return"";if(H9($)){let{generateWorkboxServiceWorker:Y}=(_9(),R9(tJ));return Y($,Z)}return j9($,Z)}var X7=C(()=>{Z7()});var XQ={};l(XQ,{injectPwaTags:()=>ZQ,generateThemeColorMeta:()=>Vj,generateSwRegistrationScript:()=>YQ,generatePwaTags:()=>J7,generateManifestLink:()=>Fj});function J7($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",J=J$($),Q=`
13347
13347
  <!-- stx PWA Meta Tags -->
13348
13348
  <link rel="manifest" href="/manifest.json">
13349
13349
  <meta name="theme-color" content="${O9(Y?.themeColor||"#000000")}">
@@ -13401,7 +13401,7 @@ if ('serviceWorker' in navigator) {
13401
13401
  });
13402
13402
  });
13403
13403
  }
13404
- </script>`}function Fj(){return'<link rel="manifest" href="/manifest.json">'}function Vj($){return`<meta name="theme-color" content="${O9($)}">`}function O9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var L9=P(()=>{X7()});var GQ={};l(GQ,{validateClientScript:()=>r4,processOnceDirective:()=>s4,processJsonDirective:()=>o4,processDirectives:()=>R0,injectRouterScript:()=>NX});import b0 from"path";import{deriveLayoutGroup as wj}from"stx-router/layout-metadata";function JQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rj($,Z){let Y=$.length,X=Z,J=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
13404
+ </script>`}function Fj(){return'<link rel="manifest" href="/manifest.json">'}function Vj($){return`<meta name="theme-color" content="${O9($)}">`}function O9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var L9=C(()=>{X7()});var GQ={};l(GQ,{validateClientScript:()=>r4,processOnceDirective:()=>s4,processJsonDirective:()=>o4,processDirectives:()=>R0,injectRouterScript:()=>NX});import b0 from"path";import{deriveLayoutGroup as wj}from"stx-router/layout-metadata";function JQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rj($,Z){let Y=$.length,X=Z,J=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
13405
13405
  `,X+2),X===-1)return-1;X+=1,J=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,J=!0;continue}if(K==="/"&&J){let q=X+1,U=!1;while(q<Y){let W=$[q];if(W==="\\"){q+=2;continue}if(W==="[")U=!0;else if(W==="]")U=!1;else if(W==="/"&&!U){q++;break}else if(W===`
13406
13406
  `){q=-1;break}q++}if(q===-1){X++,J=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,J=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
13407
13407
  `)break;X++}J=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}if(Q.length===0)J=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,J=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))J=!1;else J=!0;X++}return-1}async function R0($,Z,Y,X,J){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let Q=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!x5()&&!o$())&&Y&&Y.endsWith(".stx"))$6($,Y);try{return await Y8.timeAsync("template-processing",async()=>{let G=await Aj($,Z,Y,X,J);if(Q)G=Y9(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},U=(Z.__stx_runtime_head||null)??m5(),W=(Z.__stx_head_raw||"").trim(),z,B=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),W=W.replace(B[0],"").trim();let _=Z.__sections?.title,j=U.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...U.meta||[]],link:[...K.link||[],...U.link||[]],script:[...K.script||[],...U.script||[]],headRaw:[K.headRaw,W].filter(Boolean).join(`
@@ -13416,24 +13416,24 @@ ${V}`:V,Z.__sections=j}}if(H)try{let O;if(b0.isAbsolute(H))O=H,J.add(H);else O=a
13416
13416
  ${q}`,z(q)}catch(O){return u0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await QQ(q,Z,Y,G,J))}function Nj($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,J)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function Tj($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(Y)&&Q!==void 0)X[J]=Q;$.$env=X}async function Mj($,Z){await G5(()=>eY($,Z),void 0,(Y)=>{u0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function Ij($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (a5(),D4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let U=q instanceof Error?q:Error(String(q));u0.log(U,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${U.message}`)}}}async function Dj($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (r0(),t9));return X($,Z,{skipServer:!0})}catch(X){let J=X instanceof Error?X:Error(String(X));return u0.log(J,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${J.message}`),$}}async function QQ($,Z,Y,X,J){let Q=$,G=X;if(await Ij(Q,Z,Y),Q=await Dj(Q,Z,Y),Q=await uY(Q,Z,Y),Q=await lY(Q,Z,Y),Q=await k2(Q,Z,Y,G),e1(Q))Q=a6(Q,Z),Q=e6(Q,Z);Q=t6(Q);let{processStreamDirectives:K}=await Promise.resolve().then(() => (e3(),t3));Q=K(Q,Z),Q=P6(Q,Z,Y,G),Q=await I4(Q,Z,Y,G,J),Q=await KX(Q,Z,Y,G,J),Q=S9(Q,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => lX);Q=q(Q,Z,Y);let{processTeleportDirectives:U}=await Promise.resolve().then(() => cX);Q=U(Q,Z,Y);let{processTransitionDirectives:W,processTransitionAttributes:z}=await Promise.resolve().then(() => sX);Q=W(Q,Z,Y),Q=z(Q);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => aX);Q=B(Q,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => tX);Q=_(Q,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => YJ);Q=j(Q,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => JJ);Q=H(Q,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (WJ(),UJ));Q=L(Q,Z,Y),Q=F(Q,Z,Y),Q=O(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:R}=await Promise.resolve().then(() => (MJ(),TJ));Q=V(Q,Z,Y),Q=R(Q);let{processComputedDirectives:w,processWatchDirectives:A}=await Promise.resolve().then(() => (fJ(),xJ));Q=w(Q,Z,Y),Q=A(Q,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (uJ(),mJ));Q=N(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:T,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (u5(),d3));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=M(Q);if(Q=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
13417
13417
  `;if(Q=T(Q,Z),Q=I(Q,Z),Q=aY(Q),Q=C3(Q,Z),Q=D2(Q),Q=iY(Q),Q=await x6(Q,Z,Y,G,J),Q=await I4(Q,Z,Y,G,J),Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=Y9(Q),Q=x1(Q,Z,Y),Q=v3(Q,Z),Q=x3(Q,Z),Q=c5(Q,Z),Q=u3(Q,Z),Q=l3(Q,Z),Q=await q2(Q,Z,Y,G),Q=await T7(Q,Z,Y),Q=await s3(Q,Z,Y,G),Q=W7(Q,Z,Y,G),Q=IZ(Q,Z,Y,G),Q=DZ(Q,Z,Y),Q=EZ(Q,Z,Y,G),Q=A2(Q,Z,Y,G),Q=o4(Q,Z),Q=s4(Q),Q=fX(Q),!G.skipEventDirectives)Q=Z2(Q,Z,Y);if(Q=G2(Q,Z,Y),G.debug){let x=/\bx-data\s*=/.test(Q),g=n4($);if(x&&g)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
13418
13418
  Both work on the same page, but they manage separate scopes.
13419
- Prefer signals (state/derived/effect) for new components.`)}Q=YX(Q,Z),Q=await s0(Q,Z,Y),Q=gX(Q),Q=hX(Q),Q=oZ(Q);let{processXElementDirectives:k}=await Promise.resolve().then(() => cJ);Q=k(Q);let S=Z.__originalFilePath||Y,b=Q$(Z);if(Q=await $9(Q,G,S,b),Q=await sY(Q,Z,Y,G),G.media?.image?.autoSiblings){let x=G.publicDir||"public",{rewriteImagesWithSiblings:g}=await Promise.resolve().then(() => (y9(),b9));Q=await g(Q,{publicDir:x})}if(G.seo?.enabled)Q=kZ(Q,Z,G);let y=(x,g)=>{if(!g)return x;if(/<\/head>/i.test(x))return x.replace(/<\/head>/i,`${g}
13419
+ Prefer signals (state/derived/effect) for new components.`)}Q=YX(Q,Z),Q=await s0(Q,Z,Y),Q=gX(Q),Q=hX(Q),Q=oZ(Q);let{processXElementDirectives:k}=await Promise.resolve().then(() => cJ);Q=k(Q);let S=Z.__originalFilePath||Y,b=Q$(Z);if(Q=await $9(Q,G,S,b),Q=await sY(Q,Z,Y,G),G.media?.image?.autoSiblings){let x=G.publicDir||"public",{rewriteImagesWithSiblings:g}=await Promise.resolve().then(() => (y9(),b9));Q=await g(Q,{publicDir:x})}if(G.seo?.enabled)Q=kZ(Q,Z,G);let P=(x,g)=>{if(!g)return x;if(/<\/head>/i.test(x))return x.replace(/<\/head>/i,`${g}
13420
13420
  </head>`);if(/<head\b[^>]*>/i.test(x))return x.replace(/(<head\b[^>]*>)/i,`$1
13421
13421
  ${g}`);if(/<html\b[^>]*>/i.test(x))return x.replace(/(<html\b[^>]*>)/i,`$1
13422
13422
  <head>
13423
13423
  ${g}
13424
- </head>`);return x},{renderHead:d,getHead:f}=await Promise.resolve().then(() => (u5(),d3)),m=Z.__stx_runtime_head,o=m&&(m.title||m.meta?.length||m.link?.length)?m:f();if(o.title||o.meta?.length||o.link?.length){let x=d(o);if(x)Q=y(Q,x)}if(E.headContent)Q=y(Q,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)Q=R2(Q,G.csp,Z);if(G.analytics?.enabled)Q=D9(Q,G);if(G.heatmap?.enabled)Q=q8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:x}=await Promise.resolve().then(() => (L9(),XQ));Q=x(Q,G)}let N0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),$1=/\bSTX\.\w+/.test(Q),y0=/window\.STX\s*=/.test(Q);if(N0&&$1&&!y0){let g=`<script data-stx-scoped>
13424
+ </head>`);return x},{renderHead:d,getHead:f}=await Promise.resolve().then(() => (u5(),d3)),m=Z.__stx_runtime_head,o=m&&(m.title||m.meta?.length||m.link?.length)?m:f();if(o.title||o.meta?.length||o.link?.length){let x=d(o);if(x)Q=P(Q,x)}if(E.headContent)Q=P(Q,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)Q=R2(Q,G.csp,Z);if(G.analytics?.enabled)Q=D9(Q,G);if(G.heatmap?.enabled)Q=q8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:x}=await Promise.resolve().then(() => (L9(),XQ));Q=x(Q,G)}let N0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),$1=/\bSTX\.\w+/.test(Q),y0=/window\.STX\s*=/.test(Q);if(N0&&$1&&!y0){let g=`<script data-stx-scoped>
13425
13425
  ${pZ()}
13426
- </script>`;if(Q.includes("</head>")){let u=Q.indexOf("</head>"),G0=Q.slice(0,u).indexOf("<script");if(G0!==-1){let E0=Q.slice(0,G0),P0=Q.slice(G0);Q=E0+g+`
13426
+ </script>`;if(Q.includes("</head>")){let u=Q.indexOf("</head>"),G0=Q.slice(0,u).indexOf("<script");if(G0!==-1){let T0=Q.slice(0,G0),P0=Q.slice(G0);Q=T0+g+`
13427
13427
  `+P0}else Q=Q.replace("</head>",`${g}
13428
13428
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
13429
13429
  ${g}`);else Q=g+`
13430
- `+Q}{let x=/<script\s+server\b[^>]*>/gi,g,u=[];while((g=x.exec(Q))!==null){let s=g.index+g[0].length,G0=Rj(Q,s);if(G0===-1)continue;let E0=G0+9;while(E0<Q.length&&/\s/.test(Q[E0]))E0++;u.push({start:g.index,end:E0})}for(let s=u.length-1;s>=0;s--){let{start:G0,end:E0}=u[s];Q=Q.substring(0,G0)+Q.substring(E0)}}let D0=y4(Q,Y);if(D0.hasScoped)Q=D0.html;let X0=Z.__stx_event_bindings||[],L0=!1,W0=[],C=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:v}=await Promise.resolve().then(() => (Z9(),yX));for(let x of v(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))W0.push({match:x.fullMatch,attrs:x.attrs,content:x.body});for(let{match:x,attrs:g,content:u}of W0){L0=!0;let s=u;r4(u,Y,X.strict);let G0=await G$(u,{eventBindings:X0,attrs:g,hasColonDirectives:C,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(x,()=>G0)}if(L0)Z.__stx_event_bindings=[];return Q}var o1="<!--PARENT_CONTENT_PLACEHOLDER-->";var w4=P(()=>{mZ();A$();z7();cZ();sZ();E9();N7();O7();Y2();t5();K2();U2();_4();N2();E2();b2();J1();u5();r0();v2();p2();mY();cY();C6();I7();rY();$5();tY();H3();V0();$X();XX();GX();qX();m6();Z9();S6();xX();X9();J9();F0();Z6();X9();J9()});function bj($){let Z=[],Y=[];return yj($,Z),Pj($,Z,Y),Cj($,Y),vj($,Z),{valid:Z.length===0,errors:Z,warnings:Y}}function yj($,Z){let Y=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(Y!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${Y} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Pj($,Z,Y){for(let X of Ej){let J=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(J)||[]).length,K=($.match(Q)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");K+=($.match(q)||[]).length}if(G>K)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${K} closing`,suggestion:`Add ${G-K} missing ${X.close} tag(s)`});else if(K>G)Y.push({type:"directive",message:`Extra ${X.close} found: ${K-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function Cj($,Z){for(let Y of kj)if(Y.pattern.test($))Z.push({type:"syntax",message:Y.message,suggestion:Y.suggestion})}function vj($,Z){for(let Y of Sj)if(Y.pattern.test($))Z.push({type:"expression",message:`Security warning: ${Y.message}`,suggestion:"Remove dangerous code from template expressions"})}function xj($,Z){let Y=$.slice(0,Z).split(`
13431
- `);return{line:Y.length,column:Y[Y.length-1].length+1}}function fj($,Z,Y){let X=[];switch($){case"if":case"elseif":case"unless":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(Y.length===0||!Y[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(Y.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(Y.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(Y.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function gj($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function hj($){let Z=$.matchAll(/@([a-z]+)/gi),Y=new Set;for(let X of Z){let J=X[1].toLowerCase();if(!J.startsWith("end"))Y.add(J)}return Array.from(Y)}var Ej,kj,Sj;var KQ=P(()=>{Ej=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],kj=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],Sj=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}]});var BQ={};l(BQ,{renderSlot:()=>UQ,processSlots:()=>zQ,parseSlots:()=>qQ,parseSlotElement:()=>mj,extractSlotContent:()=>pj,applySlots:()=>cj});function dj($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function qQ($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,J=[],Q;while((Q=X.exec($))!==null){let[W,z,B,_,j]=Q,H=z||B||_,L=Q.index+W.length,F=dj($,L);if(F!==-1){let O=$.slice(L,F-11).trim();J.push({start:Q.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}J.sort((W,z)=>z.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[W,z,B,_,j,H]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${z}${O?" "+O:""}>${H}</${z}>`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:V})}let U=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=U.exec(Y))!==null){let[W,z,B,_,j]=q,H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${z}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:O})}G.sort((W,z)=>z.start-W.start);for(let W of G){let z=Z.named.get(W.slotName);if(z)z.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function mj($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function UQ($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[U,W]=q.split(":").map((B)=>B.trim()),z=W||U;if(Z[U]!==void 0)G[z]=Z[U]}}else G[Q]=Z;J=uj(J,G)}return J}function uj($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=WQ(J,Z);return d0(String(Q??""))}catch{return`{{ ${X} }}`}})}function WQ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!$0($))return;return Z0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function zQ($,Z,Y){let X=$;X=await lj(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,U)=>{let W=Z.named.get(K),z=U?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=WQ(F,Y)}return await UQ(W,_,z,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function lj($,Z,Y){let X=[],J=[];$.replace(Z,(K,...q)=>{let U=q[q.length-2];return J.push({match:K,index:U}),X.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:q,index:U}=J[K];G=G.slice(0,U)+Q[K]+G.slice(U+q.length)}return G}function pj($){let Z=qQ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function cj($,Z,Y,X){return await zQ($,{default:Z,named:Y},X)}var _Q=P(()=>{r0();F0()});import ij from"fs";import h from"path";function jQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oj($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function l1($){return!oj($)}function p1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function sj($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(W)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===W){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let W=1;while(J<Q&&W>0)if($[J]==="{")W++,J++;else if($[J]==="}")W--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},q=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
13432
- `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(X!==0)return;let W=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(J<Q){if(q())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))U();J++}return Z}function rj($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function aj($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function tj($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let J=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let q of rj(K)){let U=q.trim();if(!U||U.startsWith("..."))continue;let W=aj(U);if(W===-1)continue;let z=U.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=U.slice(W+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[z]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function VY($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(L))return!0}let U=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],W=typeof J.root==="string"?h.resolve(J.root):void 0,z=W??h.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(h.join(h.dirname(j),"components"));_(Z),_(h.join(h.dirname(X),"components")),_(J.componentsDir);let H=J._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(W)_(h.resolve(W,"resources/views/components")),_(h.resolve(W,"resources/components")),_(h.resolve(W,"src/components")),_(h.resolve(W,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return i(h.resolve(h.dirname(X),`${Q}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of U)if(await i(h.join(F,O)))return!0}return!1}function ej($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function K1($,Z,Y,X,J,Q,G,K=new Set,q){let{extractVariables:U}=await Promise.resolve().then(() => (a5(),D4)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let z=new Set(W);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&ej(B)?B:"";try{let j=(C)=>C.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=J.__importedComponents;if(O){let C=[L,L.toLowerCase(),j(L),H(L)];for(let v of C)if(O.has(v)){F=O.get(v);break}}let V=[];if(!F){let C=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],v=[...new Set(C)],x=J.__originalFilePath,g=[];if(x){let U0=h.join(h.dirname(x),"components");g.push(U0)}if(X)g.push(X);let u=h.join(h.dirname(Q),"components");if(!g.includes(u))g.push(u);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let s=G._pluginComponentDirs;if(Array.isArray(s)){for(let U0 of s)if(typeof U0==="string"&&!g.includes(U0))g.push(U0)}let G0=typeof G.root==="string"?h.resolve(G.root):void 0,E0=G0??h.dirname(Q),P0=[];if(G0)P0.push(h.resolve(G0,"resources/views/components")),P0.push(h.resolve(G0,"resources/components")),P0.push(h.resolve(G0,"src/components")),P0.push(h.resolve(G0,"components"));P0.push(h.resolve(import.meta.dir,"components"));for(let U0 of P0)if(!g.includes(U0))g.push(U0);let M1=[...new Set(g.map((U0)=>{if(!U0)return U0;return h.isAbsolute(U0)?U0:h.resolve(E0,U0)}))];if(g.length=0,g.push(...M1),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(Q),`${L}.stx`),V.push(F);else for(let U0 of g){if(!U0)continue;for(let I1 of v){let M5=h.join(U0,I1);if(V.push(M5),await i(M5)){F=M5;break}}if(F)break;if(!F)try{let I1=await import("fs");if(!I1.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let U$=8,t=[{path:U0,depth:0}];while(t.length>0&&!F){let n0=t.pop();if(n0.depth>=U$)continue;let K7;try{K7=I1.readdirSync(n0.path,{withFileTypes:!0})}catch{continue}for(let W$ of K7){if(!W$.isDirectory())continue;if(W$.name==="node_modules"||W$.name.startsWith("."))continue;let V9=h.join(n0.path,W$.name);for(let TQ of v){let q7=h.join(V9,TQ);if(V.push(q7),await i(q7)){F=q7;break}}if(F)break;t.push({path:V9,depth:n0.depth+1})}}}catch{}if(F)break}}if(!F||!await i(F)){let C=V.length>0?`
13430
+ `+Q}{let x=/<script\s+server\b[^>]*>/gi,g,u=[];while((g=x.exec(Q))!==null){let s=g.index+g[0].length,G0=Rj(Q,s);if(G0===-1)continue;let T0=G0+9;while(T0<Q.length&&/\s/.test(Q[T0]))T0++;u.push({start:g.index,end:T0}),x.lastIndex=T0}for(let s=u.length-1;s>=0;s--){let{start:G0,end:T0}=u[s];Q=Q.substring(0,G0)+Q.substring(T0)}}let E0=y4(Q,Y);if(E0.hasScoped)Q=E0.html;let X0=Z.__stx_event_bindings||[],L0=!1,W0=[],y=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:v}=await Promise.resolve().then(() => (Z9(),yX));for(let x of v(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))W0.push({match:x.fullMatch,attrs:x.attrs,content:x.body});for(let{match:x,attrs:g,content:u}of W0){L0=!0;let s=u;r4(u,Y,X.strict);let G0=await G$(u,{eventBindings:X0,attrs:g,hasColonDirectives:y,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(x,()=>G0)}if(L0)Z.__stx_event_bindings=[];return Q}var o1="<!--PARENT_CONTENT_PLACEHOLDER-->";var w4=C(()=>{mZ();A$();z7();cZ();sZ();E9();N7();O7();Y2();t5();K2();U2();_4();N2();E2();b2();J1();u5();r0();v2();p2();mY();cY();C6();I7();rY();$5();tY();H3();V0();$X();XX();GX();qX();m6();Z9();S6();xX();X9();J9();F0();Z6();X9();J9()});function bj($){let Z=[],Y=[];return yj($,Z),Pj($,Z,Y),Cj($,Y),vj($,Z),{valid:Z.length===0,errors:Z,warnings:Y}}function yj($,Z){let Y=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(Y!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${Y} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Pj($,Z,Y){for(let X of Ej){let J=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(J)||[]).length,K=($.match(Q)||[]).length;if(X.altClose){let q=new RegExp(X.altClose,"g");K+=($.match(q)||[]).length}if(G>K)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${K} closing`,suggestion:`Add ${G-K} missing ${X.close} tag(s)`});else if(K>G)Y.push({type:"directive",message:`Extra ${X.close} found: ${K-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function Cj($,Z){for(let Y of kj)if(Y.pattern.test($))Z.push({type:"syntax",message:Y.message,suggestion:Y.suggestion})}function vj($,Z){for(let Y of Sj)if(Y.pattern.test($))Z.push({type:"expression",message:`Security warning: ${Y.message}`,suggestion:"Remove dangerous code from template expressions"})}function xj($,Z){let Y=$.slice(0,Z).split(`
13431
+ `);return{line:Y.length,column:Y[Y.length-1].length+1}}function fj($,Z,Y){let X=[];switch($){case"if":case"elseif":case"unless":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(Y.length===0||!Y[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(Y.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(Y.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(Y.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function gj($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function hj($){let Z=$.matchAll(/@([a-z]+)/gi),Y=new Set;for(let X of Z){let J=X[1].toLowerCase();if(!J.startsWith("end"))Y.add(J)}return Array.from(Y)}var Ej,kj,Sj;var KQ=C(()=>{Ej=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],kj=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],Sj=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}]});var BQ={};l(BQ,{renderSlot:()=>UQ,processSlots:()=>zQ,parseSlots:()=>qQ,parseSlotElement:()=>mj,extractSlotContent:()=>pj,applySlots:()=>cj});function dj($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function qQ($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,J=[],Q;while((Q=X.exec($))!==null){let[W,z,B,_,j]=Q,H=z||B||_,L=Q.index+W.length,F=dj($,L);if(F!==-1){let O=$.slice(L,F-11).trim();J.push({start:Q.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}J.sort((W,z)=>z.start-W.start);for(let W of J)Y=Y.slice(0,W.start)+Y.slice(W.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[W,z,B,_,j,H]=q,L=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${z}${O?" "+O:""}>${H}</${z}>`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:V})}let U=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=U.exec(Y))!==null){let[W,z,B,_,j]=q,H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${z}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+W.length,slotName:_,element:O})}G.sort((W,z)=>z.start-W.start);for(let W of G){let z=Z.named.get(W.slotName);if(z)z.content+=W.element;else Z.named.set(W.slotName,{name:W.slotName,content:W.element});Y=Y.slice(0,W.start)+Y.slice(W.end)}return Z.default=Y.trim(),Z}function mj($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function UQ($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[U,W]=q.split(":").map((B)=>B.trim()),z=W||U;if(Z[U]!==void 0)G[z]=Z[U]}}else G[Q]=Z;J=uj(J,G)}return J}function uj($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=WQ(J,Z);return d0(String(Q??""))}catch{return`{{ ${X} }}`}})}function WQ($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!$0($))return;return Z0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function zQ($,Z,Y){let X=$;X=await lj(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,U)=>{let W=Z.named.get(K),z=U?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=WQ(F,Y)}return await UQ(W,_,z,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function lj($,Z,Y){let X=[],J=[];$.replace(Z,(K,...q)=>{let U=q[q.length-2];return J.push({match:K,index:U}),X.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:q,index:U}=J[K];G=G.slice(0,U)+Q[K]+G.slice(U+q.length)}return G}function pj($){let Z=qQ($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function cj($,Z,Y,X){return await zQ($,{default:Z,named:Y},X)}var _Q=C(()=>{r0();F0()});import ij from"fs";import h from"path";function jQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oj($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function l1($){return!oj($)}function p1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function sj($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(W)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===W){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let W=1;while(J<Q&&W>0)if($[J]==="{")W++,J++;else if($[J]==="}")W--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},q=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
13432
+ `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(X!==0)return;let W=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(J<Q){if(q())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))U();J++}return Z}function rj($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function aj($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function tj($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let J=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let q of rj(K)){let U=q.trim();if(!U||U.startsWith("..."))continue;let W=aj(U);if(W===-1)continue;let z=U.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=U.slice(W+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[z]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function VY($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(L))return!0}let U=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],W=typeof J.root==="string"?h.resolve(J.root):void 0,z=W??h.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(h.join(h.dirname(j),"components"));_(Z),_(h.join(h.dirname(X),"components")),_(J.componentsDir);let H=J._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(W)_(h.resolve(W,"resources/views/components")),_(h.resolve(W,"resources/components")),_(h.resolve(W,"src/components")),_(h.resolve(W,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return i(h.resolve(h.dirname(X),`${Q}.stx`));for(let L of B){let F=h.isAbsolute(L)?L:h.resolve(z,L);for(let O of U)if(await i(h.join(F,O)))return!0}return!1}function ej($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function K1($,Z,Y,X,J,Q,G,K=new Set,q){let{extractVariables:U}=await Promise.resolve().then(() => (a5(),D4)),W=K??new Set;if(W.has($))return`[Circular component reference: ${$}]`;let z=new Set(W);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&ej(B)?B:"";try{let j=(y)=>y.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),H=(y)=>y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=J.__importedComponents;if(O){let y=[L,L.toLowerCase(),j(L),H(L)];for(let v of y)if(O.has(v)){F=O.get(v);break}}let V=[];if(!F){let y=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],v=[...new Set(y)],x=J.__originalFilePath,g=[];if(x){let U0=h.join(h.dirname(x),"components");g.push(U0)}if(X)g.push(X);let u=h.join(h.dirname(Q),"components");if(!g.includes(u))g.push(u);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let s=G._pluginComponentDirs;if(Array.isArray(s)){for(let U0 of s)if(typeof U0==="string"&&!g.includes(U0))g.push(U0)}let G0=typeof G.root==="string"?h.resolve(G.root):void 0,T0=G0??h.dirname(Q),P0=[];if(G0)P0.push(h.resolve(G0,"resources/views/components")),P0.push(h.resolve(G0,"resources/components")),P0.push(h.resolve(G0,"src/components")),P0.push(h.resolve(G0,"components"));P0.push(h.resolve(import.meta.dir,"components"));for(let U0 of P0)if(!g.includes(U0))g.push(U0);let M1=[...new Set(g.map((U0)=>{if(!U0)return U0;return h.isAbsolute(U0)?U0:h.resolve(T0,U0)}))];if(g.length=0,g.push(...M1),L.startsWith("./")||L.startsWith("../"))F=h.resolve(h.dirname(Q),`${L}.stx`),V.push(F);else for(let U0 of g){if(!U0)continue;for(let I1 of v){let M5=h.join(U0,I1);if(V.push(M5),await i(M5)){F=M5;break}}if(F)break;if(!F)try{let I1=await import("fs");if(!I1.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let U$=8,t=[{path:U0,depth:0}];while(t.length>0&&!F){let n0=t.pop();if(n0.depth>=U$)continue;let K7;try{K7=I1.readdirSync(n0.path,{withFileTypes:!0})}catch{continue}for(let W$ of K7){if(!W$.isDirectory())continue;if(W$.name==="node_modules"||W$.name.startsWith("."))continue;let V9=h.join(n0.path,W$.name);for(let TQ of v){let q7=h.join(V9,TQ);if(V.push(q7),await i(q7)){F=q7;break}}if(F)break;t.push({path:V9,depth:n0.depth+1})}}}catch{}if(F)break}}if(!F||!await i(F)){let y=V.length>0?`
13433
13433
  Searched paths:
13434
13434
  ${V.map((v)=>` - ${v}`).join(`
13435
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(F);let R;if(K$.has(F))R=K$.get(F);else try{R=await Bun.file(F).text(),K$.set(F,R)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let w=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[C,v]of Object.entries(J))if(!C.startsWith("__")||w.has(C))A[C]=v;let N={...A,...Z,props:Z,slot:Y,__processedComponents:z,__sections:{}};tj(R,N);let M=R,T=M.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(T)M=T[1].trim();let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...R.matchAll(I)],E=[];for(let C of D){let v=C[1]||"",x=C[2]||"",g=v.includes("server");if(l1(v)&&x.trim())x=p1(x);if(g&&x)try{await U(x,N,F)}catch(s){}if(!g){let s=x.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(s.includes("{{")&&s.includes("}}"))s=s0(s,N,F);let G0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");E.push(`<script${G0}>${s}</script>`)}}let k=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),S=k?k[1]:"",b=k?k[2]:"",y="",d=S&&/\bscoped\b/i.test(S);if(k)y=`<style${S}>${b}</style>`;let f=M;if(f=f.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),k)f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(f=f.replace(C,(x,g)=>{let u=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(u)v.push(`<style${u[1]}>${u[2]}</style>`);return""}),f=f.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)y=`${y}${v.join(`
13436
- `)}`}if(Y&&f.includes("{{ text || slot }}"))f=f.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:m,applySlots:o}=await Promise.resolve().then(() => (_Q(),BQ)),{defaultSlot:N0,namedSlots:$1}=m(Y);f=await o(f,N0||Y,$1,N);for(let[C,v]of Object.entries(N))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let x=R7(v);N[C]=x}}let y0=E.some((C)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),D0={...G,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:y0,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let X0=await R0(f,N,F,D0,q),L0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++nj}_${Math.random().toString(36).slice(2,8)}`,W0=X0;if(y0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${jQ(JSON.stringify(Z))}"`}catch{}let v=_?` stx-hydrate="${jQ(_)}"`:"";if(W0=`<div data-stx-scope="${L0}"${C}${v}>${X0}</div>`,W0=E.map((g)=>{let u=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!u)return g;let[,s,G0]=u,E0=X1(G0),P0=`
13435
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${y}`}q.add(F);let R;if(K$.has(F))R=K$.get(F);else try{R=await Bun.file(F).text(),K$.set(F,R)}catch(y){return`[Error loading component: ${y instanceof Error?y.message:String(y)}]`}let w=new Set(["__originalFilePath","__importedComponents"]),A={};for(let[y,v]of Object.entries(J))if(!y.startsWith("__")||w.has(y))A[y]=v;let N={...A,...Z,props:Z,slot:Y,__processedComponents:z,__sections:{}};tj(R,N);let M=R,T=M.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(T)M=T[1].trim();let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...R.matchAll(I)],E=[];for(let y of D){let v=y[1]||"",x=y[2]||"",g=v.includes("server");if(l1(v)&&x.trim())x=p1(x);if(g&&x)try{await U(x,N,F)}catch(s){}if(!g){let s=x.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(s.includes("{{")&&s.includes("}}"))s=s0(s,N,F);let G0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");E.push(`<script${G0}>${s}</script>`)}}let k=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),S=k?k[1]:"",b=k?k[2]:"",P="",d=S&&/\bscoped\b/i.test(S);if(k)P=`<style${S}>${b}</style>`;let f=M;if(f=f.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),k)f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let y=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(f=f.replace(y,(x,g)=>{let u=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(u)v.push(`<style${u[1]}>${u[2]}</style>`);return""}),f=f.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)P=`${P}${v.join(`
13436
+ `)}`}if(Y&&f.includes("{{ text || slot }}"))f=f.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:m,applySlots:o}=await Promise.resolve().then(() => (_Q(),BQ)),{defaultSlot:N0,namedSlots:$1}=m(Y);f=await o(f,N0||Y,$1,N);for(let[y,v]of Object.entries(N))if(typeof v==="string"){if(v.includes("<")&&v.includes(">")||v.includes("&lt;")||v.includes("&quot;")){let x=R7(v);N[y]=x}}let y0=E.some((y)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(y)),E0={...G,componentsDir:h.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:y0,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let X0=await R0(f,N,F,E0,q),L0=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++nj}_${Math.random().toString(36).slice(2,8)}`,W0=X0;if(y0){let y="";if(Object.keys(Z).length>0)try{y=` data-stx-props="${jQ(JSON.stringify(Z))}"`}catch{}let v=_?` stx-hydrate="${jQ(_)}"`:"";if(W0=`<div data-stx-scope="${L0}"${y}${v}>${X0}</div>`,W0=E.map((g)=>{let u=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!u)return g;let[,s,G0]=u,T0=X1(G0),P0=`
13437
13437
  (function() {
13438
13438
  const { state, derived, effect, batch, defineEmits, defineExpose, defineSlots, defineProps, withDefaults, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, inject, ref, reactive, computed, watch, watchEffect, nextTick } = window.stx;
13439
13439
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -13445,23 +13445,23 @@ ${V.map((v)=>` - ${v}`).join(`
13445
13445
  const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
13446
13446
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
13447
13447
 
13448
- ${E0}
13448
+ ${T0}
13449
13449
 
13450
13450
  // Register all defined signals and functions in this scope
13451
13451
  const __localVars = {};
13452
13452
  try {
13453
- ${sj(E0).map((M1)=>`if (typeof ${M1} !== 'undefined') __localVars['${M1}'] = ${M1};`).join(`
13453
+ ${sj(T0).map((M1)=>`if (typeof ${M1} !== 'undefined') __localVars['${M1}'] = ${M1};`).join(`
13454
13454
  `)}
13455
13455
  }
13456
13456
  catch (e) {}
13457
13457
  Object.assign(__scopeVars, __localVars);
13458
13458
  })();`;if(_)return`<script type="stx/island" data-stx-island="${L0}" data-stx-scoped${s}>${P0}</script>`;return`<script data-stx-scoped${s}>${P0}</script>`}).join(`
13459
13459
  `)+`
13460
- `+W0,y)W0+=`
13461
- `+y}else{if(y)W0+=`
13462
- `+y;if(E.length>0){let C=N.__stx_event_bindings||[],v=Q$(N),x=await Promise.all(E.map(async(g)=>{let u=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!u)return g;return await G$(u[1],{eventBindings:C,templateContent:W0,filePath:F,projectRoot:process.cwd(),serverData:v})}));W0+=`
13460
+ `+W0,P)W0+=`
13461
+ `+P}else{if(P)W0+=`
13462
+ `+P;if(E.length>0){let y=N.__stx_event_bindings||[],v=Q$(N),x=await Promise.all(E.map(async(g)=>{let u=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!u)return g;return await G$(u[1],{eventBindings:y,templateContent:W0,filePath:F,projectRoot:process.cwd(),serverData:v})}));W0+=`
13463
13463
  `+x.join(`
13464
- `),N.__stx_event_bindings=[]}}if(d){let C=y4(W0,F);if(C.hasScoped)W0=C.html}return W0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete($)}}async function i($){return Bun.file($).exists()}function F9($,Z){let Y=h.resolve(Z),X=h.resolve($),J=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(J))return X;return null}async function $4($,Z,Y,X){let J=await $H($,Z,Y,X);if(J===null)return null;let Q=F9(J,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(F9(J,q))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function $H($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let B=h.join(Q,$),_=F9(B,Q);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await i(_)&&X)X.add(_);return _}let G=h.join(J,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await i(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=h.resolve(J),U=process.cwd();for(let B=0;B<10;B++){let _=h.join(q,"layouts"),j=!1;try{j=ij.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=h.dirname(q);if(H===q||H.length<U.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,B);if(await i(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=h.join(B,_);if(await i(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=h.join(Y.partialsDir||J,"layouts",B[1]);if(await i(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await i(K)){let B=h.join(K,$);if(await i(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let W=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(W,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(J.includes("temp")){let B=h.join(h.dirname(J),"layouts",$);if(await i(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function HQ($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
13464
+ `),N.__stx_event_bindings=[]}}if(d){let y=y4(W0,F);if(y.hasScoped)W0=y.html}return W0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete($)}}async function i($){return Bun.file($).exists()}function F9($,Z){let Y=h.resolve(Z),X=h.resolve($),J=Y.endsWith(h.sep)?Y:Y+h.sep;if(X===Y||X.startsWith(J))return X;return null}async function $4($,Z,Y,X){let J=await $H($,Z,Y,X);if(J===null)return null;let Q=F9(J,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=h.isAbsolute(K)?K:h.resolve(process.cwd(),K);if(F9(J,q))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function $H($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let B=h.join(Q,$),_=F9(B,Q);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await i(_)&&X)X.add(_);return _}let G=h.join(J,$);if(await i(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await i(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=h.resolve(J),U=process.cwd();for(let B=0;B<10;B++){let _=h.join(q,"layouts"),j=!1;try{j=ij.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=h.dirname(q);if(H===q||H.length<U.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=h.join(K,B);if(await i(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=h.isAbsolute(Y.layoutsDir)?Y.layoutsDir:h.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=h.join(B,_);if(await i(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await i(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=h.join(Y.partialsDir||J,"layouts",B[1]);if(await i(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=h.join(Y.partialsDir,"layouts"),await i(K)){let B=h.join(K,$);if(await i(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let W=Y.partialsDir||h.join(process.cwd(),"views"),z=h.join(W,$);if(await i(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(J.includes("temp")){let B=h.join(h.dirname(J),"layouts",$);if(await i(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function HQ($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
13465
13465
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,J=G[q].trim();let U=Math.max(0,q-2),W=Math.min(G.length,q+3);Q=G.slice(U,W).map((z,B)=>{let _=U+B+1;return`${_===X?"> ":" "}${_}: ${z}`}).join(`
13466
13466
  `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return HQ($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function Q0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=HQ(X,J,Q),q=Y.split("/").pop(),U=0;if(typeof J==="number"&&J>=0&&X){let z=X.lastIndexOf(`
13467
13467
  `,Math.max(0,J-1));U=J-(z+1)+1}let W="";if(G>0)W+=`
@@ -13476,7 +13476,7 @@ ${a.yellow}${a.bold}Message:${a.reset} ${Z}
13476
13476
  `,K)W+=`
13477
13477
  ${a.blue}${a.bold}Context:${a.reset}
13478
13478
  ${a.dim}${K}${a.reset}
13479
- `;return W}function GM(){K$.clear()}function KM(){return{size:K$.size,maxSize:500}}var K$,nj=0,a;var V0=P(()=>{t5();r0();$5();w4();a1();m6();KQ();a5();K$=new b5(500);a={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});var gY={};l(gY,{renderVendorStyleTags:()=>FQ,processClientScript:()=>G$,generateServerDataBridge:()=>i4,extractBridgeData:()=>Q$,extractAndStripCssImports:()=>LQ});import s1 from"path";import q$ from"fs";function YH($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function XH($,Z){let Y=Z;while(!0){let X=s1.join(Y,"node_modules",$,"package.json");if(q$.existsSync(X))return s1.dirname(X);let J=s1.dirname(Y);if(J===Y)return null;Y=J}}function JH($,Z){if(!$||typeof $!=="object")return null;let Y=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Y(J.import);if(typeof J.default==="object")return Y(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let J of Object.keys($)){let Q=J.indexOf("*");if(Q===-1)continue;let G=J.slice(0,Q),K=J.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:J,prefix:G,suffix:K}}if(X){let J=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=Y($[X.pattern]);if(Q)return Q.replace("*",J)}return null}function QH($,Z){let Y=YH($);if(!Y||!Y.subpath)return null;let X=XH(Y.pkg,Z);if(!X)return null;let J;try{J=JSON.parse(q$.readFileSync(s1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=JH(J.exports,Q);if(!G)return null;let K=s1.resolve(X,G);return q$.existsSync(K)?K:null}function LQ($,Z){let Y=Z.filePath?s1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),J=new Set,Q=[];return{code:$.replace(ZH,(K,q)=>{let U;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(U=q.startsWith("/")?q:s1.resolve(Y,q),!q$.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(q,X)}catch{W=QH(q,X)}if(!W)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),""}if(J.has(U))return"";J.add(U);try{let W=q$.readFileSync(U,"utf8");Q.push({source:q,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`)}return""}),styles:Q}}function GH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FQ($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${GH(Z.source)}" data-stx-layer="vendor">
13479
+ `;return W}function GM(){K$.clear()}function KM(){return{size:K$.size,maxSize:500}}var K$,nj=0,a;var V0=C(()=>{t5();r0();$5();w4();a1();m6();KQ();a5();K$=new b5(500);a={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});var gY={};l(gY,{renderVendorStyleTags:()=>FQ,processClientScript:()=>G$,generateServerDataBridge:()=>i4,extractBridgeData:()=>Q$,extractAndStripCssImports:()=>LQ});import s1 from"path";import q$ from"fs";function YH($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function XH($,Z){let Y=Z;while(!0){let X=s1.join(Y,"node_modules",$,"package.json");if(q$.existsSync(X))return s1.dirname(X);let J=s1.dirname(Y);if(J===Y)return null;Y=J}}function JH($,Z){if(!$||typeof $!=="object")return null;let Y=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Y(J.import);if(typeof J.default==="object")return Y(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let J of Object.keys($)){let Q=J.indexOf("*");if(Q===-1)continue;let G=J.slice(0,Q),K=J.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:J,prefix:G,suffix:K}}if(X){let J=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=Y($[X.pattern]);if(Q)return Q.replace("*",J)}return null}function QH($,Z){let Y=YH($);if(!Y||!Y.subpath)return null;let X=XH(Y.pkg,Z);if(!X)return null;let J;try{J=JSON.parse(q$.readFileSync(s1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=JH(J.exports,Q);if(!G)return null;let K=s1.resolve(X,G);return q$.existsSync(K)?K:null}function LQ($,Z){let Y=Z.filePath?s1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),J=new Set,Q=[];return{code:$.replace(ZH,(K,q)=>{let U;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(U=q.startsWith("/")?q:s1.resolve(Y,q),!q$.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(q,X)}catch{W=QH(q,X)}if(!W)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),""}if(J.has(U))return"";J.add(U);try{let W=q$.readFileSync(U,"utf8");Q.push({source:q,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`)}return""}),styles:Q}}function GH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FQ($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${GH(Z.source)}" data-stx-layer="vendor">
13480
13480
  @layer vendor {
13481
13481
  ${Z.contents}
13482
13482
  }
@@ -13542,7 +13542,7 @@ ${U}${F}
13542
13542
  'use strict';
13543
13543
  ${X}${Y}
13544
13544
  ${U}
13545
- })()</script>`}var ZH,KH,qH,UH,_H,LH;var t5=P(()=>{V0();ZH=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;KH=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],qH=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],UH=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"]);_H={left:0,middle:1,right:2};LH=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 VH from"fs";import q1 from"path";var VQ=[72,96,128,144,152,192,384,512],wQ=[120,152,167,180],RQ=[16,32];async function wH($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let J=q1.isAbsolute(X.src)?X.src:q1.resolve(process.cwd(),X.src);if(!await Bun.file(J).exists())return Y.errors.push(`Source icon not found: ${J}`),Y.success=!1,Y;let Q=q1.resolve(Z,X.outputDir||"pwa-icons");try{VH.mkdirSync(Q,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Q}`),Y.success=!1,Y}let G=X.sizes||VQ,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let U;try{U=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
13545
+ })()</script>`}var ZH,KH,qH,UH,_H,LH;var t5=C(()=>{V0();ZH=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;KH=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],qH=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],UH=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"]);_H={left:0,middle:1,right:2};LH=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 VH from"fs";import q1 from"path";var VQ=[72,96,128,144,152,192,384,512],wQ=[120,152,167,180],RQ=[16,32];async function wH($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let J=q1.isAbsolute(X.src)?X.src:q1.resolve(process.cwd(),X.src);if(!await Bun.file(J).exists())return Y.errors.push(`Source icon not found: ${J}`),Y.success=!1,Y;let Q=q1.resolve(Z,X.outputDir||"pwa-icons");try{VH.mkdirSync(Q,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Q}`),Y.success=!1,Y}let G=X.sizes||VQ,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let U;try{U=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
13546
13546
  Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await U.default(J).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=q1.join(Q,`icon-${L}x${L}.png`);if(await U.default(J).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=q1.join(Q,`icon-${L}x${L}.webp`);await U.default(J).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of wQ){let O=q1.join(Q,`apple-touch-icon-${F}x${F}.png`);await U.default(J).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=q1.join(Q,"apple-touch-icon.png");await U.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of RQ){let F=q1.join(Q,`favicon-${L}x${L}.png`);await U.default(J).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=q1.join(Q,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(U){let W=U instanceof Error?U.message:String(U);Y.errors.push(`Icon generation failed: ${W}`),Y.success=!1}return Y}function LM($){let Z=$.sizes||VQ,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,J=$.generateAppleIcons??!0,Q=[];for(let G of Z)if(Q.push(`${Y}/icon-${G}x${G}.png`),X)Q.push(`${Y}/icon-${G}x${G}.webp`);if(J){Q.push(`${Y}/apple-touch-icon.png`);for(let G of wQ)Q.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of RQ)Q.push(`${Y}/favicon-${G}x${G}.png`);return Q.push(`${Y}/icon-maskable-512x512.png`),Q}async function FM(){try{return await import("sharp"),!0}catch{return!1}}function RH($,Z,Y,X){let J=[],Q=X.join(" ");for(let G of $)if(J.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:Q}),Y)J.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:Q});return J}function AH($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function NH($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function TH($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function MH($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function AQ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,J=X?.sizes||[72,96,128,144,152,192,384,512],Q=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:RH(J,Q,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=AH(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let U=NH($);if(U)q.share_target=U;let W=TH($);if(W)q.file_handlers=W;let z=MH($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function wM($){let Z=AQ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function RM($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function AM($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let J=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!J.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${J.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!Q.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import NQ from"path";async function IH($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=NQ.isAbsolute(Z.page)?Z.page:NQ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (w4(),GQ)),J=await Bun.file(Y).text();return await X(J,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return DH($)}function DH($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",J=Z?.fallbackMessage||"Please check your internet connection and try again.",Q=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
13547
13547
  <html lang="en">
13548
13548
  <head>