// @bun
var{defineProperty:u,getOwnPropertyNames:hQ,getOwnPropertyDescriptor:dQ}=Object,uQ=Object.prototype.hasOwnProperty;function lQ(Q){return this[Q]}var EZ=(Q)=>{var Z=(e??=new WeakMap).get(Q),$;if(Z)return Z;if(Z=u({},"__esModule",{value:!0}),Q&&typeof Q==="object"||typeof Q==="function"){for(var Y of hQ(Q))if(!uQ.call(Z,Y))u(Z,Y,{get:lQ.bind(Q,Y),enumerable:!($=dQ(Q,Y))||$.enumerable})}return e.set(Q,Z),Z},e;var pQ=(Q)=>Q;function cQ(Q,Z){this[Q]=pQ.bind(null,Z)}var QQ=(Q,Z)=>{for(var $ in Z)u(Q,$,{get:Z[$],enumerable:!0,configurable:!0,set:cQ.bind(Z,$)})};var m=(Q,Z)=>()=>(Q&&(Z=Q(Q=0)),Z);var l=import.meta.require;import ZQ from"process";function $Q(Q="STX_PUBLIC_"){let Z={},$={};for(let[Y,X]of Object.entries(ZQ.env)){if(!Y.startsWith(Q)||X===void 0)continue;Z[`import.meta.env.${Y}`]=JSON.stringify(X),$[Y]=X}return Z["import.meta.env"]=JSON.stringify($),Z}function SZ(Q="STX_PUBLIC_"){let Z={};for(let[$,Y]of Object.entries(ZQ.env))if($.startsWith(Q)&&Y!==void 0)Z[$]=Y;return Z}var YQ=()=>{};function vZ(Q){C={...C,...Q}}function xZ(){C={...JQ}}function gZ(){return{...C}}function aQ(Q){let Z="",$=null,Y=!1;for(let X=0;X<Q.length;X++){let J=Q[X];if(Y){Y=!1;continue}if(J==="\\"&&$){Y=!0;continue}if($){if($==="`"&&J==="$"&&X+1<Q.length&&Q[X+1]==="{"){let W=1;X+=2;while(X<Q.length&&W>0){if(Q[X]==="{")W++;else if(Q[X]==="}")W--;if(W>0)Z+=Q[X],X++}continue}if(J===$)$=null;continue}if(J==='"'||J==="'"||J==="`"){$=J;continue}Z+=J}return Z}function iQ(Q,Z){let $=/[$A-Z_a-z][$\w]*/g,Y;while((Y=$.exec(Q))!==null){let X=Y[0],J=Q[Y.index-1];if(oQ.has(X))throw Error(`Potentially unsafe expression (matched /\\b${X}\\b/; identifier ${X}): ${Z}`);if(J==="."&&WQ.has(X))throw Error(`Potentially unsafe expression (matched /.${X}/; property ${X}): ${Z}`)}}function rQ(Q){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,$;while(($=Z.exec(Q))!==null){let Y=$[2];if(!WQ.has(Y))continue;let X=Q.slice(0,$.index).match(/\S(?=\s*$)/)?.[0],J=Q.slice($.index+$[0].length).match(/^\s*(\S)/)?.[1];if(!((X==="{"||X===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${$[2]}): ${Q}`)}}function o(Q){let Z=Q.trim(),$=aQ(Z);iQ($,Z),rQ(Z);for(let Y of c)if(Y.test($))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${Z}`);if(!C.allowBracketNotation&&sQ.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function zQ(Q){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[$,Y]of Object.entries(Q)){if($.startsWith("__")||c.some((X)=>X.test($)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))Z[$]=p(Y);else Z[$]=Y}return Z}function p(Q,Z=0){if(Z>=C.maxSanitizeDepth)return"[Object too deep]";if(Q===null||typeof Q!=="object")return Q;if(Array.isArray(Q))return Q.map((Y)=>p(Y,Z+1));if(Q instanceof Date||Q instanceof RegExp||Q instanceof Map||Q instanceof Set||Q instanceof Error)return Q;let $={};for(let[Y,X]of Object.entries(Q)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(X&&typeof X==="object")$[Y]=p(X,Z+1);else $[Y]=X}return $}function P(Q,Z){try{let $=zQ(Z),Y=Object.keys($),X=Object.values($);return tQ(Q,Y)(...X)}catch{return}}function fZ(Q){try{return o(Q),!0}catch{return!1}}function mZ(Q){try{return o(Q),null}catch(Z){return Z instanceof Error?Z.message:String(Z)}}function hZ(Q,Z){try{let $=P(Q,Z);return Boolean($)}catch{return!1}}function dZ(Q,Z){try{let $=P(Q,Z);if(Array.isArray($))return $;if($&&typeof $==="object"&&"length"in $){let Y=$.length;if(typeof Y==="number"&&Number.isFinite(Y)&&Y>=0&&Number.isInteger(Y))return Array.from($)}return[]}catch{return[]}}function uZ(Q,Z){try{let $=P(Q,Z);if($&&typeof $==="object"&&!Array.isArray($))return $;return{}}catch{return{}}}function tQ(Q,Z){let $=o(Q),Y=/^[A-Za-z_$][\w$]*$/,X=[],J=[];for(let z=0;z<Z.length;z++){let U=Z[z];if(!Y.test(U))continue;if(nQ.has(U))continue;X.push(z),J.push(U)}let W=Function(...J,`
    'use strict';
    try {
      return ${$};
    }
catch (e) {
      if (e instanceof ReferenceError || e instanceof TypeError) {
        return undefined;
      }
      throw e;
    }
  `);if(J.length===Z.length)return W;return(...z)=>{let U=Array(X.length);for(let G=0;G<X.length;G++)U[G]=z[X[G]];return W(...U)}}function lZ(Q,Z){try{if(typeof Q!=="string")return;if(Q.length>XQ)throw Error(`safeEvaluateCode: input exceeds ${XQ} chars`);for(let W of c)if(W.test(Q))throw Error("Potentially unsafe code detected");let $=zQ(Z),Y=Object.keys($),X=Object.values($);return Function(...Y,`
      'use strict';
      ${Q}
    `)(...X)}catch{return}}function eQ(Q){let Z=Q.trim(),$=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of $)if(Y.test(Z))return!1;return!0}function pZ(Q,Z,$,Y,X=1000){if(!eQ(Z))throw Error(`Unsafe expression in @${Q}: ${Z}`);let J=$.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(W,z)=>{return`\${${z}}`});if(Q==="for")return Function(...Y,`
      'use strict';
      let result = '';
      for (${Z}) {
        result += \`${J}\`;
      }
      return result;
    // eslint-disable-next-line pickier/no-unused-vars
    `);else return Function(...Y,`
      'use strict';
      let result = '';
      let __safeCounter = 0;
      const __maxIterations = ${X};
      while (${Z} && __safeCounter < __maxIterations) {
        __safeCounter++;
        result += \`${J}\`;
      }
      // Surface the truncation both inline (for end users) and via
      // console.warn (for developers running \`stx dev\`). A silent cut-off
      // made pages render half a list with no breadcrumb.
      if (__safeCounter >= __maxIterations) {
        result += '<!-- [Loop Error]: Maximum iterations exceeded -->';
        if (typeof console !== 'undefined' && typeof console.warn === 'function') {
          console.warn('[stx] @while loop hit max iterations (' + __maxIterations + '); template output was truncated. Raise via createSafeForLoop(..., maxIterations) if intentional.');
        }
      }
      return result;
    // eslint-disable-next-line pickier/no-unused-vars
    `)}var JQ,C,c,oQ,WQ,sQ,nQ,XQ=65536;var GQ=m(()=>{JQ={maxSanitizeDepth:10,allowBracketNotation:!1},C={...JQ};c=[/\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/],oQ=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"]),WQ=new Set(["__proto__","constructor","prototype"]),sQ=/[\w)\]]\s*\[\s*['"]/;nQ=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"])});class ZZ{source;pos=0;line=1;column=0;tokens=[];constructor(Q){this.source=Q}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let Q=this.nextToken();if(Q)this.tokens.push(Q)}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 Q=this.pos,Z=this.line,$=this.column,Y=this.source[this.pos];if(/\s/.test(Y))return this.readWhitespace(Q,Z,$);if(Y==="/"&&this.peek(1)==="/")return this.readLineComment(Q,Z,$);if(Y==="/"&&this.peek(1)==="*")return this.readBlockComment(Q,Z,$);if(Y==='"'||Y==="'")return this.readString(Y,Q,Z,$);if(Y==="`")return this.readTemplateString(Q,Z,$);if(/\d/.test(Y)||Y==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(Q,Z,$);if(/[a-z_$]/i.test(Y))return this.readIdentifier(Q,Z,$);if(Y==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:Q,end:this.pos,line:Z,column:$};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:Q,end:this.pos,line:Z,column:$};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:Q,end:this.pos,line:Z,column:$}}if(Y==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:Q,end:this.pos,line:Z,column:$};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:Q,end:this.pos,line:Z,column:$}}if(Y==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:Q,end:this.pos,line:Z,column:$};if(Y==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(Q,Z,$);let X=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let J of X)if(this.source.slice(this.pos,this.pos+J.length)===J)return this.advance(J.length),{type:"OPERATOR",value:J,start:Q,end:this.pos,line:Z,column:$};if(/[+\-*/%<>=!&|^~?:]/.test(Y))return this.advance(),{type:"OPERATOR",value:Y,start:Q,end:this.pos,line:Z,column:$};if(/[()[\]{},;.]/.test(Y))return this.advance(),{type:"PUNCTUATION",value:Y,start:Q,end:this.pos,line:Z,column:$};return this.advance(),{type:"PUNCTUATION",value:Y,start:Q,end:this.pos,line:Z,column:$}}readWhitespace(Q,Z,$){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readLineComment(Q,Z,$){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
`)this.advance();return{type:"COMMENT",value:this.source.slice(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readBlockComment(Q,Z,$){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(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readString(Q,Z,$,Y){this.advance();while(this.pos<this.source.length){let X=this.source[this.pos];if(X==="\\"){this.advance(2);continue}if(X===Q){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:$,column:Y}}readTemplateString(Q,Z,$){this.advance();let Y=0,X=256;while(this.pos<this.source.length){let J=this.source[this.pos];if(J==="\\"){this.advance(2);continue}if(J==="$"&&this.peek(1)==="{"){if(Y>=X){this.pos=this.source.length;break}this.advance(2),Y++;continue}if(J==="{"&&Y>0){Y++,this.advance();continue}if(J==="}"&&Y>0){Y--,this.advance();continue}if(J==="`"&&Y===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readNumber(Q,Z,$){if(this.source[this.pos]==="0"){let Y=this.peek(1)?.toLowerCase();if(Y==="x"||Y==="o"||Y==="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(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}}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(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readIdentifier(Q,Z,$){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}readDirective(Q,Z,$){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(Q,this.pos),start:Q,end:this.pos,line:Z,column:$}}advance(Q=1){for(let Z=0;Z<Q&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
`)this.line++,this.column=0;else this.column++;this.pos++}}peek(Q){return this.source[this.pos+Q]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState(Q){this.pos=Q.pos,this.line=Q.line,this.column=Q.column}}function v(Q,Z,$,Y=0){let X=0,J=Y,W=null,z=0,U=!1;while(J<Q.length){let G=Q[J];if(W&&U){U=!1,J++;continue}if(W&&G==="\\"){U=!0,J++;continue}if(U=!1,(G==='"'||G==="'"||G==="`")&&!W){W=G,J++;continue}if(G===W&&W!=="`"){W=null,J++;continue}if(W==="`"&&G==="$"&&Q[J+1]==="{"){z++,J+=2;continue}if(z>0&&G==="}"){z--,J++;continue}if(G==="`"&&W==="`"&&z===0){W=null,J++;continue}if(W){J++;continue}if(G===Z)X++;else if(G===$){if(X--,X===0)return J}J++}return-1}function oZ(Q,Z){let $=Z,Y={paren:0,bracket:0,brace:0},X=null,J=0;while($<Q.length){let W=Q[$];if(($>0?Q[$-1]:"")==="\\"&&X){$++;continue}if((W==='"'||W==="'")&&!X){X=W,$++;continue}if(W===X&&X!=="`"){X=null,$++;continue}if(W==="`"&&!X){X="`",$++;continue}if(W==="`"&&X==="`"&&J===0){X=null,$++;continue}if(X==="`"&&W==="$"&&Q[$+1]==="{"){J++,$+=2;continue}if(J>0){if(W==="{")J++;else if(W==="}")J--;$++;continue}if(X){$++;continue}if(Y.paren===0&&Y.bracket===0&&Y.brace===0){if(Q.slice($,$+2)==="}}"||Q.slice($,$+3)==="!!}")break;if(W===","||W===";")break}if(W==="(")Y.paren++;else if(W===")"){if(Y.paren--,Y.paren<0)break}else if(W==="[")Y.bracket++;else if(W==="]"){if(Y.bracket--,Y.bracket<0)break}else if(W==="{")Y.brace++;else if(W==="}"){if(Y.brace--,Y.brace<0)break}$++}return{expression:Q.slice(Z,$),endPos:$}}function sZ(Q){let Z=[],$="",Y={paren:0,bracket:0,brace:0},X=null,J=0;for(let W=0;W<Q.length;W++){let z=Q[W];if((W>0?Q[W-1]:"")==="\\"&&X){$+=z;continue}if((z==='"'||z==="'")&&!X){X=z,$+=z;continue}if(z===X&&X!=="`"){X=null,$+=z;continue}if(z==="`"&&!X){X="`",$+=z;continue}if(z==="`"&&X==="`"&&J===0){X=null,$+=z;continue}if(X==="`"&&z==="$"&&Q[W+1]==="{"){J++,$+=z+Q[W+1],W++;continue}if(J>0&&z==="{"){J++,$+=z;continue}if(J>0&&z==="}"){J--,$+=z;continue}if(X){$+=z;continue}if(z==="(")Y.paren++;else if(z===")")Y.paren--;else if(z==="[")Y.bracket++;else if(z==="]")Y.bracket--;else if(z==="{")Y.brace++;else if(z==="}")Y.brace--;if(z==="|"&&Q[W+1]!=="|"&&(W===0||Q[W-1]!=="|")&&Q[W-1]!=="\\"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Z.push($.trim()),$="";continue}if(z==="|"&&Q[W-1]==="\\"&&!X){$=$.slice(0,-1)+z;continue}$+=z}if($.trim())Z.push($.trim());return Z}var wZ={};QQ(wZ,{useTitle:()=>zZ,useSeoMeta:()=>d,usePageTitle:()=>zZ,useHead:()=>S,resetHead:()=>XZ,renderHtmlAttrs:()=>UZ,renderHead:()=>GZ,renderBodyAttrs:()=>FZ,processTitleDirective:()=>OZ,processMetaDirective:()=>_Z,processHeadDirective:()=>HZ,getPageMeta:()=>YZ,getHead:()=>s,definePageMeta:()=>WZ,applyHead:()=>BZ});function s(){return b}function YZ(){return h}function XZ(){b={},$Z.length=0,h={}}function S(Q){b=JZ(b,Q)}function JZ(Q,Z){return{title:Z.title??Q.title,titleTemplate:Z.titleTemplate??Q.titleTemplate,base:Z.base??Q.base,meta:[...Q.meta||[],...Z.meta||[]],link:[...Q.link||[],...Z.link||[]],script:[...Q.script||[],...Z.script||[]],style:[...Q.style||[],...Z.style||[]],htmlAttrs:{...Q.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...Q.bodyAttrs,...Z.bodyAttrs}}}function d(Q){let Z=[];if(Q.description)Z.push({name:"description",content:Q.description});if(Q.keywords){let U=Array.isArray(Q.keywords)?Q.keywords.join(", "):Q.keywords;Z.push({name:"keywords",content:U})}if(Q.author)Z.push({name:"author",content:Q.author});if(Q.robots)Z.push({name:"robots",content:Q.robots});let $=Q.ogTitle??Q.title,Y=Q.ogDescription??Q.description;if($)Z.push({property:"og:title",content:$});if(Y)Z.push({property:"og:description",content:Y});if(Q.ogImage)Z.push({property:"og:image",content:Q.ogImage});if(Q.ogUrl)Z.push({property:"og:url",content:Q.ogUrl});if(Q.ogType)Z.push({property:"og:type",content:Q.ogType});if(Q.ogSiteName)Z.push({property:"og:site_name",content:Q.ogSiteName});if(Q.ogLocale)Z.push({property:"og:locale",content:Q.ogLocale});let X=Q.twitterTitle??Q.title,J=Q.twitterDescription??Q.description,W=Q.twitterImage??Q.ogImage;if(Q.twitterCard)Z.push({name:"twitter:card",content:Q.twitterCard});if(X)Z.push({name:"twitter:title",content:X});if(J)Z.push({name:"twitter:description",content:J});if(W)Z.push({name:"twitter:image",content:W});if(Q.twitterSite)Z.push({name:"twitter:site",content:Q.twitterSite});if(Q.twitterCreator)Z.push({name:"twitter:creator",content:Q.twitterCreator});if(Q.articleAuthor)Z.push({property:"article:author",content:Q.articleAuthor});if(Q.articlePublishedTime)Z.push({property:"article:published_time",content:Q.articlePublishedTime});if(Q.articleModifiedTime)Z.push({property:"article:modified_time",content:Q.articleModifiedTime});if(Q.articleSection)Z.push({property:"article:section",content:Q.articleSection});if(Q.articleTags)for(let U of Q.articleTags)Z.push({property:"article:tag",content:U});let z=[];if(Q.canonical)z.push({rel:"canonical",href:Q.canonical});S({title:Q.title,titleTemplate:Q.titleTemplate,meta:Z,link:z})}function WZ(Q){if(h={...h,...Q},Q.title||Q.description)d({title:Q.title,description:Q.description})}function zZ(Q){let Z=typeof Q==="function"?Q():Q;S({title:Z})}function GZ(Q=b){let Z=[];if(Q.title){let $=Q.title;if(Q.titleTemplate)$=typeof Q.titleTemplate==="function"?Q.titleTemplate($):Q.titleTemplate.replace("%s",$);Z.push(`<title>${y($)}</title>`)}if(Q.base){let $=Object.entries(Q.base).map(([Y,X])=>`${Y}="${y(X)}"`).join(" ");Z.push(`<base ${$}>`)}for(let $ of Q.meta||[]){let Y=Object.entries($).filter(([X,J])=>J!==void 0).map(([X,J])=>{return`${X==="httpEquiv"?"http-equiv":X}="${y(String(J))}"`}).join(" ");Z.push(`<meta ${Y}>`)}for(let $ of Q.link||[]){let Y=Object.entries($).filter(([X,J])=>J!==void 0).map(([X,J])=>`${X}="${y(String(J))}"`).join(" ");Z.push(`<link ${Y}>`)}for(let $ of Q.script||[]){let{content:Y,...X}=$,J=Object.entries(X).filter(([W,z])=>z!==void 0).map(([W,z])=>{if(typeof z==="boolean")return z?W:"";return`${W}="${y(String(z))}"`}).filter(Boolean).join(" ");if(Y)Z.push(`<script ${J}>${Y}</script>`);else Z.push(`<script ${J}></script>`)}for(let $ of Q.style||[]){let Y=$.type?` type="${$.type}"`:"";Z.push(`<style${Y}>${$.content}</style>`)}return Z.join(`
`)}function UZ(Q=b){if(!Q.htmlAttrs)return"";return Object.entries(Q.htmlAttrs).map(([Z,$])=>`${Z}="${y($)}"`).join(" ")}function FZ(Q=b){if(!Q.bodyAttrs)return"";return Object.entries(Q.bodyAttrs).map(([Z,$])=>`${Z}="${y($)}"`).join(" ")}function y(Q){return Q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function BZ(Q=b){if(typeof document>"u")return;if(Q.title){let Z=Q.title;if(Q.titleTemplate)Z=typeof Q.titleTemplate==="function"?Q.titleTemplate(Z):Q.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of Q.meta||[]){let $=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if($){let Y=document.querySelector($);if(!Y){if(Y=document.createElement("meta"),Z.name)Y.setAttribute("name",Z.name);if(Z.property)Y.setAttribute("property",Z.property);document.head.appendChild(Y)}Y.setAttribute("content",Z.content)}}for(let Z of Q.link||[]){let $=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,Y=document.querySelector($);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[X,J]of Object.entries(Z))if(J!==void 0)Y.setAttribute(X,String(J))}if(Q.htmlAttrs)for(let[Z,$]of Object.entries(Q.htmlAttrs))document.documentElement.setAttribute(Z,$);if(Q.bodyAttrs)for(let[Z,$]of Object.entries(Q.bodyAttrs))document.body.setAttribute(Z,$)}function HZ(Q){let Z="";return{content:Q.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,X)=>{return Z+=X.trim()+`
`,""}),headContent:Z.trim()}}function OZ(Q,Z){return Q.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,($,Y,X,J)=>{let W=Y?X:Z[(J||"").trim()]??J;return S({title:W}),""})}function _Z(Q,Z){return Q.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,($,Y,X,J,W,z)=>{let U=J?W:z,G=J?U:Z[(U||"").trim()]??U,H=X.includes(":")?{property:X,content:G}:{name:X,content:G};return S({meta:[H]}),""})}var b,$Z,h;var UQ=m(()=>{b={},$Z=[],h={}});var jZ={};QQ(jZ,{stripTypeScript:()=>OQ,hasVariables:()=>TZ,extractVariables:()=>AZ,extractScriptFromTemplate:()=>DZ,convertToCommonJS:()=>_Q});import x from"path";function RZ(Q){let Z=[],$=0,Y=Q.split(`
`);for(let X of Y){let J=null,W=!1;for(let z=0;z<X.length;z++){let U=X[z];if(W){W=!1;continue}if(U==="\\"){W=!0;continue}if(J){if(U===J)J=null;continue}if(U==="'"||U==='"'||U==="`"){J=U;continue}if(U==="/"&&z+1<X.length&&X[z+1]==="/")break;if(U==="{")$++;else if(U==="}")$--}if($===0){let z=X.match(/(?:const|let|var)\s+(\w+)\s*=/);if(z)Z.push(z[1]);else{let U=X.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let B=U[1].slice(1,-1).split(",").map((H)=>{let R=H.split(":");return(R.length>1?R[1]:R[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...B)}}}}return[...new Set(Z)]}function OQ(Q){let Z=Q;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){if(!Y.includes(":"))return Y;let X=[],J="",W=0,z=0,U=null;for(let G=0;G<Y.length;G++){let B=Y[G];if(U){if(J+=B,B===U)U=null;continue}if(B==='"'||B==="'"||B==="`"){U=B,J+=B;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(B==="(")z++;else if(B===")")z--;if(B===","&&W===0&&z===0){X.push(J),J="";continue}J+=B}if(J)X.push(J);return X.map((G)=>{let B=G.trim(),H=B.startsWith("..."),R=H?B.slice(3):B,_=-1,q=0;for(let V=0;V<R.length;V++)if(R[V]==="<")q++;else if(R[V]===">")q--;else if(R[V]===":"&&q===0){_=V;break}if(_===-1)return G;let D=R.substring(0,_).trim().replace(/\?$/,""),T=R.substring(_+1),j=-1,L=0;for(let V=0;V<T.length;V++)if(T[V]==="<")L++;else if(T[V]===">")L--;else if(T[V]==="="&&L===0){j=V;break}let E=H?"...":"";if(j!==-1)return`${E}${D} = ${T.substring(j+1).trim()}`;return`${E}${D}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,X,J)=>{if(!J.includes(":"))return Y;return`${X}(${$(J)})`});{let Y=/\b(function\s+\w*\s*)\(/g,X,J=[];while((X=Y.exec(Z))!==null){let W=X.index+X[0].length-1,z=1,U=W+1,G=0,B=null;while(U<Z.length&&z>0){let _=Z[U];if(B){if(_===B)B=null;U++;continue}if(_==='"'||_==="'"||_==="`"){B=_,U++;continue}if(_==="<")G++;else if(_===">"&&G>0)G--;else if(G===0){if(_==="(")z++;else if(_===")")z--}if(z>0)U++}if(z!==0)continue;let H=Z.substring(W+1,U);if(!H.includes(":"))continue;let R=$(H);J.push({start:W+1,end:U,replacement:R})}for(let W=J.length-1;W>=0;W--){let{start:z,end:U,replacement:G}=J[W];Z=Z.substring(0,z)+G+Z.substring(U)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,X)=>{if(!X.includes(":"))return Y;if(X.includes("{")||X.includes("}"))return Y;return`(${X.split(",").map((W)=>{let[z,...U]=W.split("="),G=z.split(":")[0].trim();if(U.length>0)return`${G} = ${U.join("=").trim()}`;return G}).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,`

`),Z}async function AZ(Q,Z,$,Y={}){if(!Q.trim())return;let X;try{let F=new Bun.Transpiler({loader:"ts",target:"browser",define:$Q()}),O=Q.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");O=O.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),X=F.transformSync(O)}catch{X=OQ(Q)}let J={exports:{}},W=J.exports,z=process.cwd(),U={},G=[...X.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((F)=>F[1]).filter((F)=>!F.startsWith("node:")&&!F.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(F));for(let F of G)try{let O=x.resolve(z,"node_modules",F),w=x.join(O,"package.json"),K=JSON.parse(l("fs").readFileSync(w,"utf8")),M=K.main||"index.js";if(K.exports){let I=typeof K.exports==="string"?K.exports:K.exports["."];if(typeof I==="string")M=I;else if(I?.bun)M=I.bun;else if(I?.import)M=I.import;else if(I?.default)M=I.default}U[F]=await import(x.resolve(O,M))}catch{}let B=(F)=>{if(U[F])return U[F];return l(F)},H=Z.props||{},R=Object.assign((F)=>{if(!F)return H;let O={};for(let[w,K]of Object.entries(F)){let M=H[w];if(M!==void 0)O[w]=M;else if(typeof K==="function")O[w]=K();else O[w]=K}return O},H),_=(F)=>{if(!F)return H;let O={...H};for(let[w,K]of Object.entries(F)){let M=K&&typeof K==="object"&&!Array.isArray(K)?K:{type:K};if(O[w]===void 0&&M.default!==void 0)O[w]=typeof M.default==="function"?M.default():M.default}return O},q=()=>Z.slots||{},N=(F,O)=>{let w={...F};for(let[K,M]of Object.entries(O))if(w[K]===void 0)if(typeof M==="function")w[K]=M();else w[K]=M;return w},D=(F)=>{let O=()=>F;return O.set=(w)=>{},O.update=(w)=>{},O},T=(F)=>{let O,w=!1;return()=>{if(!w)try{O=F(),w=!0}catch{O=void 0}return O}},j=(F)=>{},L=(F)=>F(),E=(F)=>{},V=(F)=>{},k=(F)=>{},qQ=()=>({params:{},query:{},path:"",name:"",fullPath:"",hash:"",matched:[]}),KQ=()=>({push:(F)=>{},replace:(F)=>{},back:()=>{},forward:()=>{},go:(F)=>{}}),MQ=(F)=>{S(F);let O=Z.__stx_runtime_head||{},w=F||{};Z.__stx_runtime_head={...O,...w.title&&{title:w.title},meta:[...O.meta||[],...w.meta||[]],link:[...O.link||[],...w.link||[]],script:[...O.script||[],...w.script||[]],htmlAttrs:{...O.htmlAttrs||{},...w.htmlAttrs||{}},bodyAttrs:{...O.bodyAttrs||{},...w.bodyAttrs||{}}}},VQ=(F)=>{d(F);let O=s();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...O.title&&{title:O.title},meta:O.meta?[...O.meta]:[]}},NQ=(F)=>({value:F}),DQ=(F)=>F,TQ=(F)=>({value:typeof F==="function"?F():F}),jQ=(F,O)=>{},IQ=(F)=>{},PQ=(F)=>{},bQ=(F)=>F?F():Promise.resolve(),LQ=(F)=>(O,...w)=>{},EQ=(F)=>{},kQ=(F,O)=>{},yQ=(F,O)=>O,SQ=()=>({value:"light"}),CQ=()=>({value:!1}),f={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:{}},vQ=new Proxy(f,{get(F,O){if(O in F)return F[O];return},set(F,O,w){return F[O]=w,!0}}),xQ={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},gQ=console;try{let F=_Q(X,$),O=new Set(Object.keys(H)),w=Object.keys(Z).filter((A)=>!O.has(A)&&A!=="props"),K=w.map((A)=>Z[A]),M=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"]),I=[],i=[];for(let[A,g]of Object.entries(H)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(A))continue;if(M.has(A))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${A}\\b`).test(F))continue;I.push(A),i.push(g)}let fQ=RZ(F).map((A)=>`module.exports.${A} = typeof ${A} !== 'undefined' ? ${A} : module.exports.${A};`).join(`
        `),mQ=Z.params??{},r=[],n=[];for(let A=0;A<w.length;A++){if(w[A]==="params")continue;r.push(w[A]),n.push(K[A])}let t=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",...I,...r,`return (async () => {
        ${F}
        ${fQ}
        return module.exports
      })()`)(J,W,B,H,R,_,N,D,T,j,L,E,V,k,qQ,KQ,MQ,VQ,NQ,DQ,TQ,jQ,IQ,PQ,bQ,LQ,EQ,q,kQ,yQ,SQ,CQ,vQ,xQ,gQ,f.confirm,f.alert,f.fetch,mQ,...i,...n);if(Y.preserveExisting){for(let[A,g]of Object.entries(t))if(!(A in Z)||Z[A]===void 0)Z[A]=g}else Object.assign(Z,t);for(let[A,g]of Object.entries(H))if(!(A in Z))Z[A]=g}catch{try{await NZ(X,Z,$)}catch{}}}function _Q(Q,Z){let $=Z?x.dirname(Z):process.cwd(),Y=Q.split(`
`),X=[],J=0;while(J<Y.length){let W=Y[J].trim();if(W.startsWith("interface ")||W.startsWith("export interface ")||W.startsWith("type ")||W.startsWith("export type ")){if(W.includes("{")&&!W.includes("}")){let z=0;for(;J<Y.length;J++){for(let U of Y[J])if(U==="{")z++;else if(U==="}")z--;if(z<=0)break}}J++;continue}if(W.startsWith("definePageMeta(")){let z=0,U=!1;for(let G=J;G<Y.length&&!U;G++){let B=null,H=!1,R=Y[G];for(let _=0;_<R.length;_++){let q=R[_];if(H){H=!1;continue}if(q==="\\"){H=!0;continue}if(B){if(q===B)B=null;continue}if(q==='"'||q==="'"||q==="`"){B=q;continue}if(q==="(")z++;else if(q===")"){if(z--,z===0){J=G+1,U=!0;break}}}}if(!U)J=Y.length;continue}if(W.startsWith("import ")){let z=W.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),U=W.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),G=W.match(/^import\s+['"](.+)['"]/),B=(H)=>{if(H.startsWith("."))return x.resolve($,H);return H};if(z){let[,H,R]=z,_=B(R);X.push(`const ${H} = await import('${_}')`),X.push(`module.exports.${H} = ${H};`)}else if(U){let[,H,R]=U,_=H.trim(),q=B(R);X.push(`const { ${_} } = await import('${q}')`);for(let N of _.split(",")){let D=N.trim().split(/\s+as\s+/).pop()?.trim();if(D)X.push(`module.exports.${D} = ${D};`)}}else if(G){let H=B(G[1]);X.push(`await import('${H}')`)}else X.push(W);J++;continue}if(W.startsWith("export const ")||W.startsWith("export let ")||W.startsWith("export var ")){let z=FQ(Y,J),{type:U,name:G,value:B}=z;X.push(`${U} ${G} = ${B};`),X.push(`module.exports.${G} = ${G};`),J=z.nextIndex}else if(W.startsWith("export function ")||W.startsWith("export async function ")){let z=a(Y,J);X.push(z.functionCode),X.push(`module.exports.${z.name} = ${z.name};`),J=z.nextIndex}else if(W.startsWith("const ")||W.startsWith("let ")||W.startsWith("var ")){let z=FQ(Y,J),{type:U,name:G,value:B}=z;X.push(`${U} ${G} = ${B};`),X.push(`module.exports.${G} = ${G};`),J=z.nextIndex}else if(W.startsWith("function ")||W.startsWith("async function ")){let z=a(Y,J);X.push(z.functionCode),X.push(`module.exports.${z.name} = ${z.name};`),J=z.nextIndex}else if(W.startsWith("export default function ")||W.startsWith("export default async function ")){let z=Y[J].replace(/^(\s*)export\s+default\s+/,"$1"),U=[...Y];U[J]=z;let G=a(U,J);if(X.push(G.functionCode),G.name)X.push(`module.exports.default = ${G.name};`);J=G.nextIndex}else if(W.startsWith("export default ")){let z=W.replace(/^export\s+default\s+/,"").replace(/;$/,"");X.push(`module.exports.default = ${z};`),J++}else if(W.startsWith("class ")||W.startsWith("export class ")){let z=W.match(/(?:export\s+)?class\s+(\w+)/);if(z){let U=z[1],G=Y[J].replace(/^export\s+/,""),B=0,H=J;for(;H<Y.length;H++){let R=Y[H];for(let _ of R)if(_==="{")B++;else if(_==="}")B--;if(H>J)G+=`
`+R;if(B<=0&&H>=J)break}X.push(G),X.push(`module.exports.${U} = ${U};`),J=H+1}else X.push(W),J++}else if(W.includes("module.exports"))X.push(W),J++;else if(W.trim()&&!W.startsWith("//"))X.push(W),J++;else J++}return qZ(X.join(`
`),$)}function qZ(Q,Z){let $=Q.length,Y="",X=0,J=null,W=!1,z=!1,U=0;while(X<$){let G=Q[X],B=Q[X+1];if(W){if(Y+=G,G===`
`)W=!1;X++;continue}if(z){if(Y+=G,G==="*"&&B==="/"){Y+=B,X+=2,z=!1;continue}X++;continue}if(!J&&G==="/"&&B==="/"){W=!0,Y+=G,X++;continue}if(!J&&G==="/"&&B==="*"){z=!0,Y+=G,X++;continue}if(J){if(Y+=G,G==="\\"){Y+=B,X+=2;continue}if(G===J&&J!=="`"){J=null,X++;continue}if(J==="`"){if(G==="$"&&B==="{"){U++,Y+=B,X+=2;continue}if(G==="`"){J=null,X++;continue}}X++;continue}if(U>0){if(G==="{")U++;else if(G==="}")U--}if(G==='"'||G==="'"||G==="`"){J=G,Y+=G,X++;continue}if(G==="a"&&Q.startsWith("await",X)){let H=KZ(Q,X);if(H){let{quote:R,path:_,end:q}=H;if(_.startsWith(".")){let N=x.resolve(Z,_);Y+=`await import(${R}${N}${R})`,X=q;continue}}}Y+=G,X++}return Y}function KZ(Q,Z){let $=Z+5;if($>=Q.length)return null;if(!/\s/.test(Q[$]))return null;while($<Q.length&&/\s/.test(Q[$]))$++;if(!Q.startsWith("import",$))return null;$+=6;while($<Q.length&&/\s/.test(Q[$]))$++;if(Q[$]!=="(")return null;$++;while($<Q.length&&/\s/.test(Q[$]))$++;let Y=Q[$];if(Y!=="'"&&Y!=='"')return null;$++;let X=$;while($<Q.length&&Q[$]!==Y)if(Q[$]==="\\")$+=2;else $++;if($>=Q.length)return null;let J=Q.slice(X,$);$++;while($<Q.length&&/\s/.test(Q[$]))$++;if(Q[$]!==")")return null;return{quote:Y,path:J,end:$+1}}function wQ(Q,Z){let $=Q[Z];if($!=="{"&&$!=="[")return null;let X=v(Q,$,$==="{"?"}":"]",Z);if(X===-1)return null;return{pattern:Q.slice(Z,X+1),endPos:X+1}}function RQ(Q){let Z=[],$=Q.slice(1,-1).trim();if(!$)return Z;let Y=0,X=0,J="";while(Y<$.length){let W=$[Y];if(W==="{"||W==="["){if(X++,X===1){let z=wQ($,Y);if(z){let U=RQ(z.pattern);Z.push(...U),Y=z.endPos,J="";continue}}}else if(W==="}"||W==="]")X--;if(X>0){Y++;continue}if(W===","){if(J.trim())Z.push(J.trim());J="",Y++;continue}if(W===":"){J="",Y++;continue}if(W==="="){if(J.trim())Z.push(J.trim());J="",Y++;while(Y<$.length&&$[Y]!==","&&X===0){if($[Y]==="{"||$[Y]==="[")X++;else if($[Y]==="}"||$[Y]==="]")X--;Y++}continue}if(/[\w$]/.test(W))J+=W;Y++}if(J.trim())Z.push(J.trim());return Z}function FQ(Q,Z){let $=Q[Z].trim(),Y=$.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!Y){let G=$.match(/^(?:export\s+)?(const|let|var)\s+/);if(G){let B=$.slice(G[0].length),H=Z;if((B.startsWith("{")||B.startsWith("["))&&!B.includes(B.startsWith("{")?"}":"]")){let _=B.startsWith("{")?"}":"]",q=B;for(let N=Z+1;N<Q.length;N++)if(q+=" "+Q[N].trim(),H=N,Q[N].includes(_))break;B=q}let R=wQ(B,0);if(R){let _=G[1],q=R.pattern,N=B.slice(R.endPos).trim();if(N.startsWith("=")){let D=N.slice(1).trim(),T=D,j=Math.max(H,Z);if(BQ(D)){let k=HQ(Q,j,D);T=k.value,j=k.nextIndex}else j=j+1;T=T.trim().replace(/;$/,"");let L=RQ(q),E=`__stx_src_${Z}`,V=L.map((k)=>`module.exports.${k} = ${k};`).join(`
`);return{type:_,name:E,value:`${T}; ${_} ${q} = ${E};
${V}`,nextIndex:j}}}}throw Error(`Failed to parse variable declaration: ${$}`)}let[,X,J,W]=Y,z=W,U=Z;if(BQ(W)){let G=HQ(Q,Z,W);z=G.value,U=G.nextIndex}else U=Z+1;while(U<Q.length){let G=Q[U].trim();if(G.startsWith(".")||G.startsWith("?."))z+=`
${Q[U]}`,U++;else break}return z=z.trim().replace(/;$/,""),{type:X,name:J,value:z,nextIndex:U}}function a(Q,Z){let $=Q[Z].trim(),Y=$.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${$}`);let[,X]=Y,J=$.replace(/^export\s+/,""),W=Z;if(MZ($)){let z=VZ(Q,Z,J);J=z.functionCode,W=z.nextIndex}else W=Z+1;return{name:X,functionCode:J,nextIndex:W}}function BQ(Q){let Z=Q.trim();if(Z.startsWith("{"))return v(Z,"{","}",0)===-1;if(Z.startsWith("["))return v(Z,"[","]",0)===-1;return!AQ(Z)}function AQ(Q){let Z={paren:0,bracket:0,brace:0},$=null,Y=0;for(let X=0;X<Q.length;X++){let J=Q[X];if((X>0?Q[X-1]:"")==="\\"&&$)continue;if((J==='"'||J==="'")&&!$){$=J;continue}if(J===$&&$!=="`"){$=null;continue}if(J==="`"&&!$){$="`";continue}if(J==="`"&&$==="`"&&Y===0){$=null;continue}if($==="`"&&J==="$"&&Q[X+1]==="{"){Y++,X++;continue}if(Y>0&&J==="{"){Y++;continue}if(Y>0&&J==="}"){Y--;continue}if($)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&$===null}function MZ(Q){let Z=Q.indexOf("{");if(Z===-1)return!0;return v(Q,"{","}",Z)===-1}function HQ(Q,Z,$){let Y=$,X=Z+1;while(X<Q.length&&!AQ(Y)){let J=Q[X];Y+=`
${J}`,X++}while(X<Q.length){let J=Q[X].trim();if(J.startsWith(".")||J.startsWith("?."))Y+=`
${Q[X]}`,X++;else break}return{value:Y,nextIndex:X}}function VZ(Q,Z,$){let Y=$,X=Z+1;while(X<Q.length){let J=Y.indexOf("{");if(J!==-1){if(v(Y,"{","}",J)!==-1)break}let W=Q[X];Y+=`
${W}`,X++}return{functionCode:Y,nextIndex:X}}async function NZ(Q,Z,$){let Y=Q.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of Y){let[,,W,z]=J;try{let U=z.trim().replace(/;$/,""),G=P(U,Z)??P(`(${U})`,Z);if(G!==void 0)Z[W]=G}catch{try{let U=z.trim().replace(/;$/,""),G=P(`(${U})`,Z);if(G!==void 0)Z[W]=G}catch(U){console.warn(`Failed to parse export ${W} in fallback:`,U)}}}let X=Q.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of X){let[,,W,z]=J;if(!(W in Z))try{let U=z.trim().replace(/;$/,""),G=P(U,Z)??P(`(${U})`,Z);if(G!==void 0)Z[W]=G}catch{}}}function DZ(Q){let Z=Q.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),$=Z?Z[1]:"",Y=Z?Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):Q;return{scriptContent:$,templateWithoutScript:Y}}function TZ(Q){let Z=Q.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var IZ=m(()=>{UQ();YQ();GQ()});IZ();export{OQ as stripTypeScript,TZ as hasVariables,AZ as extractVariables,DZ as extractScriptFromTemplate,_Q as convertToCommonJS};
