@stacksjs/stx 0.2.747 → 0.2.748

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 (81) hide show
  1. package/dist/{chunk-bas06v5y.js → chunk-0k80h9hw.js} +1 -1
  2. package/dist/{chunk-181r1814.js → chunk-0xk2de0f.js} +1 -1
  3. package/dist/{chunk-g78zvf6j.js → chunk-1q726kxm.js} +1 -1
  4. package/dist/{chunk-kb1ghegh.js → chunk-1wqee608.js} +2 -2
  5. package/dist/{chunk-8b6stw4x.js → chunk-1x2c002k.js} +1 -1
  6. package/dist/{chunk-hp3vebgn.js → chunk-2n68bepn.js} +2 -2
  7. package/dist/chunk-2p91t0qh.js +2 -0
  8. package/dist/{chunk-r6jjx157.js → chunk-2y669dqd.js} +1 -1
  9. package/dist/{chunk-m5a8zgft.js → chunk-3eveprd2.js} +1 -1
  10. package/dist/{chunk-d25pawk8.js → chunk-3h238w91.js} +2 -2
  11. package/dist/{chunk-2gcj7sty.js → chunk-4kfpm7k5.js} +1 -1
  12. package/dist/{chunk-s8vj3xs0.js → chunk-54xfrj8m.js} +5 -5
  13. package/dist/{chunk-k9tay7g7.js → chunk-5gndpknd.js} +1 -1
  14. package/dist/{chunk-z24bjeny.js → chunk-5p961dp2.js} +1 -1
  15. package/dist/{chunk-z6kz9jqc.js → chunk-69y16gf3.js} +2 -2
  16. package/dist/{chunk-rwsyemkp.js → chunk-738110r3.js} +1 -1
  17. package/dist/{chunk-d7tgfndt.js → chunk-7v4xxcc1.js} +1 -1
  18. package/dist/{chunk-6xytp0tk.js → chunk-7wj8cdzz.js} +1 -1
  19. package/dist/{chunk-c3bdjva4.js → chunk-915p9d5k.js} +1 -1
  20. package/dist/chunk-9f3mf7qj.js +2 -0
  21. package/dist/chunk-aeqzgrq6.js +2 -0
  22. package/dist/{chunk-qgpy8cye.js → chunk-anpw201a.js} +1 -1
  23. package/dist/chunk-ap79ecs3.js +3 -0
  24. package/dist/{chunk-dnt3q3jv.js → chunk-aws32yq9.js} +1 -1
  25. package/dist/{chunk-7fdw7p3e.js → chunk-be9sm3sf.js} +1 -1
  26. package/dist/{chunk-pach41d0.js → chunk-c1k0f8nt.js} +1 -1
  27. package/dist/{chunk-4wpp8zqg.js → chunk-c60wgqnf.js} +1 -1
  28. package/dist/{chunk-e8g374pz.js → chunk-cwq30a2f.js} +1 -1
  29. package/dist/{chunk-stkxvrxd.js → chunk-dngnd01p.js} +1 -1
  30. package/dist/{chunk-8a40gq1k.js → chunk-dzfqbj6v.js} +1 -1
  31. package/dist/{chunk-4w8zdkxw.js → chunk-e14tnzt9.js} +1 -1
  32. package/dist/chunk-evfpmrvx.js +2 -0
  33. package/dist/{chunk-mjjb720w.js → chunk-fx12nez8.js} +1 -1
  34. package/dist/{chunk-y4rm4gpv.js → chunk-h69yazjn.js} +2 -2
  35. package/dist/{chunk-3xa9vxyq.js → chunk-h6zm6atc.js} +4 -4
  36. package/dist/{chunk-3v3dssk7.js → chunk-hkn2swbq.js} +1 -1
  37. package/dist/{chunk-v364k1q7.js → chunk-hpre1xce.js} +1 -1
  38. package/dist/{chunk-7hky61eh.js → chunk-hz56qzj4.js} +1 -1
  39. package/dist/{chunk-v5yhcpg3.js → chunk-jw7swqvf.js} +1 -1
  40. package/dist/{chunk-et11hr3d.js → chunk-k0kt643q.js} +1 -1
  41. package/dist/{chunk-xjv46712.js → chunk-k0wqy6jk.js} +4 -4
  42. package/dist/{chunk-6jgt685n.js → chunk-kzpbd65z.js} +1 -1
  43. package/dist/{chunk-72a5fgj3.js → chunk-mk696gth.js} +5 -5
  44. package/dist/chunk-njx1b3cd.js +2 -0
  45. package/dist/{chunk-6ph5jasj.js → chunk-p8zsnhhe.js} +6 -6
  46. package/dist/{chunk-zsqg1cy6.js → chunk-pz52sq7x.js} +1 -1
  47. package/dist/{chunk-ewf7sq6y.js → chunk-rsaq309e.js} +1 -1
  48. package/dist/{chunk-4rer7y75.js → chunk-s6twntcw.js} +1 -1
  49. package/dist/{chunk-mt41rpec.js → chunk-s7ffpaf9.js} +1 -1
  50. package/dist/{chunk-byxksw9c.js → chunk-skm53nnd.js} +1 -1
  51. package/dist/chunk-snrqq3wh.js +2 -0
  52. package/dist/{chunk-3rc07ans.js → chunk-t276cc57.js} +1 -1
  53. package/dist/{chunk-ttrjc1w5.js → chunk-tftna6zb.js} +3 -3
  54. package/dist/chunk-tqpkpyqf.js +2 -0
  55. package/dist/{chunk-cczxhrbh.js → chunk-twc23s14.js} +1 -1
  56. package/dist/{chunk-zeqybrbc.js → chunk-txbre9zy.js} +1 -1
  57. package/dist/{chunk-y6t6djz7.js → chunk-vd84rnx9.js} +1 -1
  58. package/dist/chunk-vqr0afr9.js +2 -0
  59. package/dist/{chunk-chxhfdpc.js → chunk-w9564he2.js} +1 -1
  60. package/dist/{chunk-1ewtjh1w.js → chunk-x0sxzebr.js} +1 -1
  61. package/dist/chunk-xzszbafv.js +2 -0
  62. package/dist/chunk-ygb3n26r.js +2 -0
  63. package/dist/{chunk-yfg0fwkk.js → chunk-z0zd1nxd.js} +3 -3
  64. package/dist/cli.js +7 -7
  65. package/dist/craft-entry.js +1 -1
  66. package/dist/craft.js +1 -1
  67. package/dist/native/runtime/native-host.js +2 -0
  68. package/dist/pwa.js +1 -1
  69. package/dist/ssg.js +2 -2
  70. package/package.json +5 -5
  71. package/dist/chunk-1kdw7cms.js +0 -2
  72. package/dist/chunk-2bgrwygq.js +0 -2
  73. package/dist/chunk-2e2yh6t5.js +0 -2
  74. package/dist/chunk-6amq1fnc.js +0 -2
  75. package/dist/chunk-7017n280.js +0 -2
  76. package/dist/chunk-9hbgp70k.js +0 -2
  77. package/dist/chunk-a5j9sbff.js +0 -2
  78. package/dist/chunk-b8wgnpat.js +0 -3
  79. package/dist/chunk-g0n18v7m.js +0 -2
  80. package/dist/chunk-n79ww4aq.js +0 -2
  81. package/dist/chunk-r8e80xr8.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{oe,de,pn,Pt,It,m,r,fe,p}from"./chunk-6ph5jasj.js";import{mt,Re,Ha,Jr,xo,So,i}from"./chunk-s8vj3xs0.js";import{ae,xr,Se,B,wn}from"./chunk-wpwh529h.js";import{wt,lr,ys,bs,vs,xt,St,kt,_t,Ct,Et,Ze}from"./chunk-4s1k8k2a.js";import{us,a,P}from"./chunk-d25pawk8.js";import{dt,Tn,_e,M,Gi,no,Br,Ue,Xi,Ce}from"./chunk-yfg0fwkk.js";import{ir,ar}from"./chunk-bas06v5y.js";import{Cn}from"./chunk-mjjb720w.js";import{e,sn,tr,y}from"./chunk-z6kz9jqc.js";import{Ge}from"./chunk-xjv46712.js";import{$e}from"./chunk-1xjv71dw.js";import{G,ye,be}from"./chunk-3xa9vxyq.js";import{l}from"./chunk-h2y36t58.js";import{K}from"./chunk-byaasw3f.js";async function zn(t){try{let n=await Bun.file(t).text(),s=Nn(n),d=Un(n,t),o=Wn(n,s),c=Vn(n,s);return{file:t,metrics:s,issues:d,suggestions:o,performance:c}}catch(n){throw Error(`Failed to analyze template ${t}: ${n instanceof Error?n.message:String(n)}`)}}function Nn(t){let n=t.split(`
2
+ import{oe,de,pn,Pt,It,m,r,fe,p}from"./chunk-p8zsnhhe.js";import{mt,Re,Ha,Jr,xo,So,i}from"./chunk-54xfrj8m.js";import{ae,xr,Se,B,wn}from"./chunk-wpwh529h.js";import{wt,lr,ys,bs,vs,xt,St,kt,_t,Ct,Et,Ze}from"./chunk-4s1k8k2a.js";import{us,a,P}from"./chunk-3h238w91.js";import{dt,Tn,_e,M,Gi,no,Br,Ue,Xi,Ce}from"./chunk-z0zd1nxd.js";import{ir,ar}from"./chunk-0k80h9hw.js";import{Cn}from"./chunk-fx12nez8.js";import{e,sn,tr,y}from"./chunk-69y16gf3.js";import{Ge}from"./chunk-k0wqy6jk.js";import{$e}from"./chunk-1xjv71dw.js";import{G,ye,be}from"./chunk-h6zm6atc.js";import{l}from"./chunk-h2y36t58.js";import{K}from"./chunk-byaasw3f.js";async function zn(t){try{let n=await Bun.file(t).text(),s=Nn(n),d=Un(n,t),o=Wn(n,s),c=Vn(n,s);return{file:t,metrics:s,issues:d,suggestions:o,performance:c}}catch(n){throw Error(`Failed to analyze template ${t}: ${n instanceof Error?n.message:String(n)}`)}}function Nn(t){let n=t.split(`
3
3
  `),s=t.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),o=(s?s[1]:"").split(`
4
4
  `).length,c={conditionals:(t.match(/@(if|unless|elseif|else|endif|endunless)\b/g)||[]).length,loops:(t.match(/@(foreach|for|endforeach|endfor|while|endwhile)\b/g)||[]).length,includes:(t.match(/@(include|component|extends|section|yield)\b/g)||[]).length,custom:0,total:0};c.total=c.conditionals+c.loops+c.includes+c.custom;let u=(t.match(/\{\{[\s\S]*?\}\}/g)||[]).length,f=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length,g=(t.match(/@(?:if|unless|elseif|foreach|for|while)\s*\([^)]+\)/g)||[]).length,h=u+f+g,x=(t.match(/<[A-Z][^>]*>/g)||[]).length,v=(t.match(/@(?:layout|extends)\(/g)||[]).length,S=0,T=0;for(let k of n)if(/@(?:if|unless|foreach|for|while|section)\b/.test(k)&&!/@end/.test(k)&&!/@else/.test(k))T++,S=Math.max(S,T);else if(/@end(?:if|unless|foreach|for|while|section)\b/.test(k))T--;let w=S>=4?3:0,b=Math.min(10,Math.ceil(c.total*0.5+h*0.1+x*0.3+(o>10?o*0.05:0)+w));return{lines:n.length,characters:t.length,directives:c,expressions:h,components:x,layouts:v,scriptLines:o,complexity:b}}function Un(t,n){let s=[],d=Kt(t,"if","endif");if(d>0)s.push({type:"error",category:"syntax",message:`Found ${d} unmatched @if directive(s)`,suggestion:"Ensure every @if has a corresponding @endif"});let o=Kt(t,"foreach","endforeach");if(o>0)s.push({type:"error",category:"syntax",message:`Found ${o} unmatched @foreach directive(s)`,suggestion:"Ensure every @foreach has a corresponding @endforeach"});let c=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(c&&c.length>0)s.push({type:"warning",category:"performance",message:"Nested loops detected which may impact performance",suggestion:"Consider preprocessing data or using more efficient data structures"});let u=(t.match(/\{!![\s\S]*?!!\}/g)||[]).length;if(u>0)s.push({type:"warning",category:"security",message:`Found ${u} raw output expression(s) {!! !!}`,suggestion:"Ensure raw outputs are properly sanitized to prevent XSS"});let f=t.match(/<img[^>]*>/g);if(f){let x=f.filter((v)=>!v.includes("alt="));if(x.length>0)s.push({type:"warning",category:"accessibility",message:`Found ${x.length} image(s) without alt attributes`,suggestion:"Add alt attributes to all images for screen reader accessibility"})}let g=t.split(`
5
5
  `).filter((x)=>x.length>120);if(g.length>0)s.push({type:"info",category:"maintainability",message:`Found ${g.length} line(s) longer than 120 characters`,suggestion:"Consider breaking long lines for better readability"});let h=(t.match(/style\s*=\s*["'][^"']*["']/g)||[]).length;if(h>3)s.push({type:"info",category:"maintainability",message:`Found ${h} inline style attributes`,suggestion:"Consider moving styles to CSS classes for better maintainability"});return s}function Wn(t,n){let s=[];if(n.complexity>7)s.push({type:"refactor",message:"Template complexity is high. Consider breaking into smaller components.",impact:"high",effort:"medium"});else if(n.complexity>5&&n.directives.total>8)s.push({type:"optimization",message:"Template has moderate complexity. Consider component extraction for reusability.",impact:"medium",effort:"low"});if(n.lines>100&&n.components===0)s.push({type:"refactor",message:"Large template with no components. Consider extracting reusable parts into components.",impact:"medium",effort:"medium"});if(n.expressions>20)s.push({type:"optimization",message:"Many template expressions detected. Consider preprocessing some data in the script section.",impact:"medium",effort:"low"});let d=t.match(/@foreach[\s\S]*?@foreach[\s\S]*?@endforeach[\s\S]*?@endforeach/g);if(d&&d.length>0)s.push({type:"optimization",message:"Nested loops detected. Consider preprocessing data or optimizing data structures.",impact:"high",effort:"medium"});if(n.directives.total===0&&n.expressions<5)s.push({type:"optimization",message:"Template appears static. Consider enabling aggressive caching.",impact:"high",effort:"low"});if(n.scriptLines>50)s.push({type:"refactor",message:"Large script section. Consider moving complex logic to external modules.",impact:"medium",effort:"medium"});return s}function Vn(t,n){let s=1;if(s+=n.directives.conditionals*0.1,s+=n.directives.loops*0.5,s+=n.directives.includes*2,s+=n.expressions*0.05,s+=n.components*1,n.scriptLines>10)s+=n.scriptLines*0.1;let d;if(n.expressions===0&&n.directives.total===0)d="high";else if(n.expressions<5&&n.directives.total<3)d="medium";else d="low";let o=[];if(s>10)o.push("Consider optimizing template complexity");if(d==="low"&&n.directives.total>5)o.push("Reduce dynamic content for better caching");if(n.components===0&&n.lines>40)o.push("Extract components to improve reusability and performance");return{estimatedRenderTime:Math.round(s*100)/100,complexityScore:n.complexity,cacheability:d,recommendations:o}}function Kt(t,n,s){let d=t.replace(/<!--[\s\S]*?-->/g,""),o=(d.match(new RegExp(`@${n}\\b`,"g"))||[]).length,c=(d.match(new RegExp(`@${s}\\b`,"g"))||[]).length;return Math.abs(o-c)}async function Mi(t=["**/*.stx"],n){let s=[],d=[];for(let c of t){let u=await Array.fromAsync(new Bun.Glob(c).scan({cwd:n||process.cwd(),onlyFiles:!0,absolute:!0}));d.push(...u.filter((f)=>f.endsWith(".stx")))}for(let c of d)try{let u=await zn(c);s.push(u)}catch(u){console.warn(`Failed to analyze ${c}:`,u)}let o=qn(s);return{results:s,summary:o}}function qn(t){let n=t.length,s=t.reduce((h,x)=>h+x.metrics.lines,0),d=n>0?t.reduce((h,x)=>h+x.metrics.complexity,0)/n:0,o=t.reduce((h,x)=>h+x.issues.length,0),c={};t.forEach((h)=>{h.issues.forEach((x)=>{c[x.category]=(c[x.category]||0)+1})});let u=n>0?t.reduce((h,x)=>h+x.performance.estimatedRenderTime,0)/n:0,f=Math.max(1,Math.min(10,Math.round(10-u/2-d/2))),g=[];if(d>6)g.push("Project has high average complexity. Consider refactoring complex templates.");if(o>n*2)g.push("High number of issues detected. Run detailed analysis on individual files.");if(c.security>0)g.push("Security issues found. Review raw output usage and input sanitization.");return{totalFiles:n,totalLines:s,avgComplexity:Math.round(d*100)/100,totalIssues:o,issuesByCategory:c,performanceScore:f,recommendations:g}}import{mkdir as Kn,readFile as Xn,readdir as Gn,stat as Xt,writeFile as Jn}from"fs/promises";import Te from"path";function en(t){if(t==="connectedCallback")return`method "${t}" is reserved; define "onConnect" instead, which the element calls once it is connected, rendered and bound`;if(t==="disconnectedCallback")return`method "${t}" is reserved; define "onDisconnect" instead, which the element calls as it leaves the DOM, before it releases its own listeners`;return`method "${t}" is reserved`}var tn=new Set(["constructor","connectedCallback","disconnectedCallback","attributeChangedCallback","adoptedCallback"]);function Yn(t){return t.replace(/\.stx$/i,"").split(/[^a-z0-9]+/i).filter(Boolean).map((n)=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}function Lt(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-z0-9]+/gi,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Qn(t){return/^[a-z][.0-9_a-z-]*-[.0-9_a-z-]*$/.test(t)&&!t.startsWith("xml")&&!/[A-Z]/.test(t)}function Zn(t){if(t===!0)return"open";if(t==="open"||t==="closed")return t;return!1}async function er(t){let n=[];async function s(d){let o=await Gn(d,{withFileTypes:!0});o.sort((c,u)=>c.name.localeCompare(u.name));for(let c of o){let u=Te.join(d,c.name);if(c.isDirectory()){if(!c.name.startsWith(".")&&c.name!=="node_modules")await s(u)}else if(c.isFile()&&c.name.endsWith(".stx")&&!/\.(?:test|spec)\.stx$/i.test(c.name))n.push(u)}}return await s(t),n}function nr(t,n){let s=t.match(/<script\b(?=[^>]*(?:\bcomponent\b|\bstx:component\b))[^>]*>([\s\S]*?)<\/script>/i);if(!s)return{};let d=s[1].trim();if(!d)return{};try{return JSON.parse(d)}catch(o){throw Error(`${n}: <script component> must contain JSON metadata (${o.message})`)}}function rr(t,n){let s={},d=[...t.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)];for(let o of d){if(!/\bclient\b/i.test(o[1])||/\bcomponent\b|\bstx:component\b/i.test(o[1]))continue;let c;try{c=new Bun.Transpiler({loader:"ts"}).transformSync(o[2])}catch(g){throw Error(`${n}: failed to transpile <script client> (${g.message})`)}let u=/(?:export\s+)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)\s*\(([^)]*)\)\s*\{/g,f;while(f=u.exec(c)){let g=f[1];if(tn.has(g))throw Error(`${n}: client ${en(g)}`);let h=u.lastIndex,x=1,v="",S=!1,T=h;for(;T<c.length&&x>0;T++){let b=c[T];if(S){S=!1;continue}if(v){if(b==="\\")S=!0;else if(b===v)v="";continue}if(b==='"'||b==="'"||b==="`")v=b;else if(b==="{")x++;else if(b==="}")x--}if(x!==0)throw Error(`${n}: unterminated client function "${g}"`);let w=f[0].includes("async")?"async ":"";s[g]=`${w}${g}(${f[2]}) {${c.slice(h,T-1)}}`,u.lastIndex=T}}return s}function sr(t){let n=t.match(/<template\b(?![^>]*\bshadowrootmode\b)[^>]*>([\s\S]*?)<\/template>/i);return(n?n[1]:t).replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").trim()}function Gt(t){return[...t.matchAll(/<style\b[^>]*>([\s\S]*?)<\/style>/gi)].map((n)=>n[1].trim()).filter(Boolean).join(`
@@ -887,7 +887,7 @@ else {
887
887
  };
888
888
  })();
889
889
  </script>
890
- `}function Ne(t,n,s={}){let d=Fr(n,s),o=t.lastIndexOf("</body>");if(o!==-1)return t.slice(0,o)+d+t.slice(o);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function ht(t){let n=t.toLowerCase();return n.endsWith(".css")||n.endsWith(".scss")||n.endsWith(".sass")||n.endsWith(".less")}function yt(t){let n=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>n.endsWith(d))}function bt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((s)=>s.test(t))}var tt=null;function vt(t){if(!tt)tt=new rn(t);return tt}function ot(){if(tt)tt.stop(),tt=null}import Tt from"path";var nt={name:"bun-plugin-stx",async setup(t){let s={...await a(),...t.config?.stx},d=new Set,o=s.webComponents?.enabled?`./${Tt.relative(Tt.dirname(t.config?.outdir||"dist"),s.webComponents.outputDir||"dist/web-components")}`:"/web-components",c=[];if(s.webComponents?.enabled)try{let u=await us(s,d);if(c.push(...u),s.debug&&u.length>0)console.log(`Successfully built ${u.length} web components`)}catch(u){console.error("Failed to build web components:",u)}t.onLoad({filter:/\.stx$/},async({path:u})=>{try{let f=new Set;if(s.cache&&s.cachePath){let b=await ir(u,s);if(b){if(s.debug)console.log(`Using cached version of ${u}`);return{contents:b,loader:"html"}}}let g=await Se(()=>Bun.file(u).text(),"",(b)=>{throw new xr(`Failed to read stx file: ${u}`,u,void 0,void 0,`File read error: ${b.message}`)});if(!g)throw new xr(`stx file is empty: ${u}`,u);let{scriptContent:h,templateContent:x,allScripts:v}=oe.time("script-extraction",()=>{let b=g,k=de(g);if(k)b=k.content.trim();let _=g.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],E="",R=[];for(let C of _){let D=C.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",I=C.match(/<script\b([^>]*)>/i),V=I?I[1]:"";if(/\bserver\b/i.test(V))E=D;else R.push(C)}let A=b.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:E,templateContent:A,allScripts:R}}),S={__filename:u,__dirname:Tt.dirname(u),__stx:{webComponentsPath:o,builtComponents:c}};await Se(()=>m(h,S,u),void 0,(b)=>{let k=new ae(`Script execution failed in ${u}: ${b.message}`,u,void 0,void 0,h.substring(0,100));if(B.log(k,{filePath:u,scriptContent:h}),s.debug)throw k});let w=await oe.timeAsync("directive-processing",async()=>await i(x,S,u,s,f));if(v.length>0){let{interpolateScriptsInTemplate:b}=await import("./chunk-cczxhrbh.js"),k=b(v.join(`
890
+ `}function Ne(t,n,s={}){let d=Fr(n,s),o=t.lastIndexOf("</body>");if(o!==-1)return t.slice(0,o)+d+t.slice(o);if(t.includes("</html>"))return t.replace("</html>",`${d}</html>`);return t+d}function ht(t){let n=t.toLowerCase();return n.endsWith(".css")||n.endsWith(".scss")||n.endsWith(".sass")||n.endsWith(".less")}function yt(t){let n=t.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((d)=>n.endsWith(d))}function bt(t){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((s)=>s.test(t))}var tt=null;function vt(t){if(!tt)tt=new rn(t);return tt}function ot(){if(tt)tt.stop(),tt=null}import Tt from"path";var nt={name:"bun-plugin-stx",async setup(t){let s={...await a(),...t.config?.stx},d=new Set,o=s.webComponents?.enabled?`./${Tt.relative(Tt.dirname(t.config?.outdir||"dist"),s.webComponents.outputDir||"dist/web-components")}`:"/web-components",c=[];if(s.webComponents?.enabled)try{let u=await us(s,d);if(c.push(...u),s.debug&&u.length>0)console.log(`Successfully built ${u.length} web components`)}catch(u){console.error("Failed to build web components:",u)}t.onLoad({filter:/\.stx$/},async({path:u})=>{try{let f=new Set;if(s.cache&&s.cachePath){let b=await ir(u,s);if(b){if(s.debug)console.log(`Using cached version of ${u}`);return{contents:b,loader:"html"}}}let g=await Se(()=>Bun.file(u).text(),"",(b)=>{throw new xr(`Failed to read stx file: ${u}`,u,void 0,void 0,`File read error: ${b.message}`)});if(!g)throw new xr(`stx file is empty: ${u}`,u);let{scriptContent:h,templateContent:x,allScripts:v}=oe.time("script-extraction",()=>{let b=g,k=de(g);if(k)b=k.content.trim();let _=g.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],E="",R=[];for(let C of _){let D=C.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",I=C.match(/<script\b([^>]*)>/i),V=I?I[1]:"";if(/\bserver\b/i.test(V))E=D;else R.push(C)}let A=b.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:E,templateContent:A,allScripts:R}}),S={__filename:u,__dirname:Tt.dirname(u),__stx:{webComponentsPath:o,builtComponents:c}};await Se(()=>m(h,S,u),void 0,(b)=>{let k=new ae(`Script execution failed in ${u}: ${b.message}`,u,void 0,void 0,h.substring(0,100));if(B.log(k,{filePath:u,scriptContent:h}),s.debug)throw k});let w=await oe.timeAsync("directive-processing",async()=>await i(x,S,u,s,f));if(v.length>0){let{interpolateScriptsInTemplate:b}=await import("./chunk-twc23s14.js"),k=b(v.join(`
891
891
  `),S),_=w.search(/<\/body>/i);if(_!==-1)w=w.slice(0,_)+k+`
892
892
  `+w.slice(_);else w+=`
893
893
  ${k}`}if(w=await be(w),f.forEach((b)=>d.add(b)),s.cache&&s.cachePath){if(await ar(u,w,f,s),s.debug)console.log(`Cached template ${u} with ${f.size} dependencies`)}return{contents:w,loader:"html"}}catch(f){let g=f instanceof Error?f:new ae(`Plugin processing failed: ${String(f)}`,u);if(B.log(g,{filePath:u,buildConfig:t.config}),wn.logDetailedError(g,{filePath:u,plugin:"bun-plugin-stx"}),s.debug)console.error("stx Plugin Error:",g);let h=g,x=h.line||null,v=h.context||null;return{contents:s.debug||K()?`<!DOCTYPE html>
@@ -950,7 +950,7 @@ ${k}`}if(w=await be(w),f.forEach((b)=>d.add(b)),s.cache&&s.cachePath){if(await a
950
950
  <h1>Something went wrong</h1>
951
951
  <p>An internal error occurred. Please try again later.</p>
952
952
  </body>
953
- </html>`,loader:"html"}}})}};async function Or(t,n={}){let s=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,c=null,u=n.hmrPort||s+1,f=ge.resolve(t);if(!Be.existsSync(f))return console.error(`${e.red}Error: File not found: ${e.bright}${f}${e.reset}`),!1;if(f.endsWith(".md"))return Ft(f,n);else if(!f.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${f}${e.reset}. Only .stx and .md files are supported.`),!1;let g=l(process.cwd(),"output");Be.mkdirSync(g,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let h=null,x=async()=>{try{let D={name:"public-assets",setup(ve){ve.onResolve({filter:/^\/(images|fonts|assets|public)\//},(le)=>({path:le.path,external:!0}))}},I=await Bun.build({entrypoints:[f],outdir:g,plugins:[D,nt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!I.success)return console.error(`${e.red}Build failed:${e.reset}`,I.logs),!1;let V=I.outputs.find((ve)=>ve.path.endsWith(".html"));if(!V)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return h=await Bun.file(V.path).text(),!0}catch(D){return console.error(`${e.red}Error building stx file:${e.reset}`,D),!1}};if(!await x())return!1;let S=ge.dirname(f);await sn(S);let T=s;try{if(T=await Ve(s),T!==s)console.log(`${e.yellow}Port ${s} is busy, using port ${T} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let D=n.hmrPort||T+1;c=vt({wsPort:D,verbose:!1}),u=c.start(D)}let w={},b=null,k;try{let{loadStxConfig:D}=await import("./chunk-n79ww4aq.js"),I=await D();if(k=n.stxOptions?.serverApi??I.serverApi,I?.apiRouter)b=I?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(I?.apiRoutes){w=I.apiRoutes;let V=Object.keys(w).length;if(V>0)console.log(`${e.blue}Loaded ${e.bright}${V} API route${V>1?"s":""}${e.reset}`)}if(I?.broadcasting?.enabled)try{let{startBroadcasting:V,loadChannels:Y}=await import("./chunk-h6jba844.js"),ve=I.broadcasting;await V(ve);let le=ve.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${le}/ws${e.reset}`);let Pe=ge.join(process.cwd(),"channels.ts");if(Be.existsSync(Pe))try{let ne=await Y(Pe);console.log(`${e.blue}Loaded ${e.bright}${ne} broadcast channel${ne!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ne){console.warn(`${e.yellow}Failed to load channels.ts: ${ne.message}${e.reset}`)}}catch(V){console.warn(`${e.yellow}Broadcasting failed to start: ${V.message}${e.reset}`)}}catch{}let{createServerApi:_,isServerApiSource:E}=await import("./chunk-rwsyemkp.js"),R=await _(process.cwd(),k);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${T}/${e.reset}...`),o)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${u}${e.reset}`);let A=zr({port:T,async fetch(D){return Cn(D,await(async()=>{let I=new URL(D.url);if([g,ge.dirname(f),ge.join(process.cwd(),"public")].some((ne)=>E(ge.join(ne,I.pathname),process.cwd(),k)))return new Response("Not Found",{status:404});if(b)try{let ne=await b.handleRequest(D);if(ne.status!==404)return ne}catch{}if(w[I.pathname])try{return await w[I.pathname](D)}catch(ne){return new Response(JSON.stringify({error:ne.message}),{status:500,headers:{"Content-Type":"application/json"}})}let V=await R(D);if(V)return V;if(I.pathname==="/")return(async()=>{let F=await y(h||"");if(o)F=Ne(F,u);if(n.native)if(F.includes("<head>"))F=F.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(F.includes("<html"))F=F.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else F="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+F;if(n.titlebarHidden)if(F.includes("<head>"))F=F.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(F.includes("<html"))F=F.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else F=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${F}`;return F})().then((F)=>new Response(F,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Y=ge.join(g,I.pathname);if(Be.existsSync(Y)&&Be.statSync(Y).isFile()){let ne=Bun.file(Y),F=ge.extname(Y).toLowerCase(),L="text/plain";if(F===".ts"||F===".tsx"){let Fe=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),ze=await ne.text(),Je=Fe.transformSync(ze);return new Response(Je,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":L="text/html";break;case".css":L="text/css";break;case".js":L="text/javascript";break;case".json":L="application/json";break;case".png":L="image/png";break;case".jpg":case".jpeg":L="image/jpeg";break;case".gif":L="image/gif";break;case".woff":L="font/woff";break;case".woff2":L="font/woff2";break;case".ttf":L="font/ttf";break;case".otf":L="font/otf";break;case".eot":L="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":L}})}let ve=ge.dirname(f),le=ge.join(ve,I.pathname);if(Be.existsSync(le)&&Be.statSync(le).isFile()){let ne=Bun.file(le),F=ge.extname(le).toLowerCase(),L="text/plain";if(F===".ts"||F===".tsx"){let Fe=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),ze=await ne.text(),Je=Fe.transformSync(ze);return new Response(Je,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":L="text/html";break;case".css":L="text/css";break;case".js":L="text/javascript";break;case".json":L="application/json";break;case".png":L="image/png";break;case".jpg":case".jpeg":L="image/jpeg";break;case".gif":L="image/gif";break;case".svg":L="image/svg+xml";break;case".ico":L="image/x-icon";break;case".woff":L="font/woff";break;case".woff2":L="font/woff2";break;case".ttf":L="font/ttf";break;case".otf":L="font/otf";break;case".eot":L="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":L}})}let Pe=ge.join(process.cwd(),"public",I.pathname);if(Be.existsSync(Pe)&&Be.statSync(Pe).isFile()){let ne=Bun.file(Pe),F=ge.extname(Pe).toLowerCase(),L="application/octet-stream";if(F===".ts"||F===".tsx"){let Fe=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),ze=await ne.text(),Je=Fe.transformSync(ze);return new Response(Je,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":L="text/html";break;case".css":L="text/css";break;case".js":L="text/javascript";break;case".json":L="application/json";break;case".png":L="image/png";break;case".jpg":case".jpeg":L="image/jpeg";break;case".gif":L="image/gif";break;case".svg":L="image/svg+xml";break;case".ico":L="image/x-icon";break;case".woff":L="font/woff";break;case".woff2":L="font/woff2";break;case".ttf":L="font/ttf";break;case".otf":L="font/otf";break;case".eot":L="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":L}})}return new Response("Not Found",{status:404})})())},error(D){return new Response(`<pre>${D}
953
+ </html>`,loader:"html"}}})}};async function Or(t,n={}){let s=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,c=null,u=n.hmrPort||s+1,f=ge.resolve(t);if(!Be.existsSync(f))return console.error(`${e.red}Error: File not found: ${e.bright}${f}${e.reset}`),!1;if(f.endsWith(".md"))return Ft(f,n);else if(!f.endsWith(".stx"))return console.error(`${e.red}Error: Unsupported file type: ${e.bright}${f}${e.reset}. Only .stx and .md files are supported.`),!1;let g=l(process.cwd(),"output");Be.mkdirSync(g,{recursive:!0}),console.log(`${e.blue}Building ${e.bright}${t}${e.reset}...`);let h=null,x=async()=>{try{let D={name:"public-assets",setup(ve){ve.onResolve({filter:/^\/(images|fonts|assets|public)\//},(le)=>({path:le.path,external:!0}))}},I=await Bun.build({entrypoints:[f],outdir:g,plugins:[D,nt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!I.success)return console.error(`${e.red}Build failed:${e.reset}`,I.logs),!1;let V=I.outputs.find((ve)=>ve.path.endsWith(".html"));if(!V)return console.error(`${e.red}No HTML output found${e.reset}`),!1;return h=await Bun.file(V.path).text(),!0}catch(D){return console.error(`${e.red}Error building stx file:${e.reset}`,D),!1}};if(!await x())return!1;let S=ge.dirname(f);await sn(S);let T=s;try{if(T=await Ve(s),T!==s)console.log(`${e.yellow}Port ${s} is busy, using port ${T} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let D=n.hmrPort||T+1;c=vt({wsPort:D,verbose:!1}),u=c.start(D)}let w={},b=null,k;try{let{loadStxConfig:D}=await import("./chunk-vqr0afr9.js"),I=await D();if(k=n.stxOptions?.serverApi??I.serverApi,I?.apiRouter)b=I?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(I?.apiRoutes){w=I.apiRoutes;let V=Object.keys(w).length;if(V>0)console.log(`${e.blue}Loaded ${e.bright}${V} API route${V>1?"s":""}${e.reset}`)}if(I?.broadcasting?.enabled)try{let{startBroadcasting:V,loadChannels:Y}=await import("./chunk-h6jba844.js"),ve=I.broadcasting;await V(ve);let le=ve.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${le}/ws${e.reset}`);let Pe=ge.join(process.cwd(),"channels.ts");if(Be.existsSync(Pe))try{let ne=await Y(Pe);console.log(`${e.blue}Loaded ${e.bright}${ne} broadcast channel${ne!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(ne){console.warn(`${e.yellow}Failed to load channels.ts: ${ne.message}${e.reset}`)}}catch(V){console.warn(`${e.yellow}Broadcasting failed to start: ${V.message}${e.reset}`)}}catch{}let{createServerApi:_,isServerApiSource:E}=await import("./chunk-738110r3.js"),R=await _(process.cwd(),k);if(console.log(`${e.blue}Starting server on ${e.cyan}http://localhost:${T}/${e.reset}...`),o)console.log(`${e.magenta}Hot reload enabled on ws://localhost:${u}${e.reset}`);let A=zr({port:T,async fetch(D){return Cn(D,await(async()=>{let I=new URL(D.url);if([g,ge.dirname(f),ge.join(process.cwd(),"public")].some((ne)=>E(ge.join(ne,I.pathname),process.cwd(),k)))return new Response("Not Found",{status:404});if(b)try{let ne=await b.handleRequest(D);if(ne.status!==404)return ne}catch{}if(w[I.pathname])try{return await w[I.pathname](D)}catch(ne){return new Response(JSON.stringify({error:ne.message}),{status:500,headers:{"Content-Type":"application/json"}})}let V=await R(D);if(V)return V;if(I.pathname==="/")return(async()=>{let F=await y(h||"");if(o)F=Ne(F,u);if(n.native)if(F.includes("<head>"))F=F.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(F.includes("<html"))F=F.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else F="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+F;if(n.titlebarHidden)if(F.includes("<head>"))F=F.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(F.includes("<html"))F=F.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else F=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${F}`;return F})().then((F)=>new Response(F,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let Y=ge.join(g,I.pathname);if(Be.existsSync(Y)&&Be.statSync(Y).isFile()){let ne=Bun.file(Y),F=ge.extname(Y).toLowerCase(),L="text/plain";if(F===".ts"||F===".tsx"){let Fe=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),ze=await ne.text(),Je=Fe.transformSync(ze);return new Response(Je,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":L="text/html";break;case".css":L="text/css";break;case".js":L="text/javascript";break;case".json":L="application/json";break;case".png":L="image/png";break;case".jpg":case".jpeg":L="image/jpeg";break;case".gif":L="image/gif";break;case".woff":L="font/woff";break;case".woff2":L="font/woff2";break;case".ttf":L="font/ttf";break;case".otf":L="font/otf";break;case".eot":L="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":L}})}let ve=ge.dirname(f),le=ge.join(ve,I.pathname);if(Be.existsSync(le)&&Be.statSync(le).isFile()){let ne=Bun.file(le),F=ge.extname(le).toLowerCase(),L="text/plain";if(F===".ts"||F===".tsx"){let Fe=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),ze=await ne.text(),Je=Fe.transformSync(ze);return new Response(Je,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":L="text/html";break;case".css":L="text/css";break;case".js":L="text/javascript";break;case".json":L="application/json";break;case".png":L="image/png";break;case".jpg":case".jpeg":L="image/jpeg";break;case".gif":L="image/gif";break;case".svg":L="image/svg+xml";break;case".ico":L="image/x-icon";break;case".woff":L="font/woff";break;case".woff2":L="font/woff2";break;case".ttf":L="font/ttf";break;case".otf":L="font/otf";break;case".eot":L="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":L}})}let Pe=ge.join(process.cwd(),"public",I.pathname);if(Be.existsSync(Pe)&&Be.statSync(Pe).isFile()){let ne=Bun.file(Pe),F=ge.extname(Pe).toLowerCase(),L="application/octet-stream";if(F===".ts"||F===".tsx"){let Fe=new Bun.Transpiler({loader:F===".tsx"?"tsx":"ts"}),ze=await ne.text(),Je=Fe.transformSync(ze);return new Response(Je,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(F){case".html":L="text/html";break;case".css":L="text/css";break;case".js":L="text/javascript";break;case".json":L="application/json";break;case".png":L="image/png";break;case".jpg":case".jpeg":L="image/jpeg";break;case".gif":L="image/gif";break;case".svg":L="image/svg+xml";break;case".ico":L="image/x-icon";break;case".woff":L="font/woff";break;case".woff2":L="font/woff2";break;case".ttf":L="font/ttf";break;case".otf":L="font/otf";break;case".eot":L="application/vnd.ms-fontobject";break}return new Response(ne,{headers:{"Content-Type":L}})}return new Response("Not Found",{status:404})})())},error(D){return new Response(`<pre>${D}
954
954
  ${D.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
955
955
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
956
956
  ${e.bright}\u2192 ${e.cyan}http://localhost:${T}/${e.reset}`),console.log(`
@@ -1437,12 +1437,12 @@ ${w.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
1437
1437
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
1438
1438
  ${e.bright}\u2192 ${e.cyan}http://localhost:${x}/${e.reset}`),console.log(`
1439
1439
  ${e.yellow}Routes:${e.reset}`);let S=new Set(f.map((w)=>w.routeTemplate)),T=Object.entries(u).filter(([w])=>!S.has(w)).sort(([w],[b])=>w.localeCompare(b)).map(([w,b])=>({route:w==="/"?"/":w,filePath:Ee.relative(process.cwd(),b.filePath),fileType:b.fileType}));for(let w of f){let b=w.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");T.push({route:b,filePath:Ee.relative(process.cwd(),w.filePath),fileType:"stx"})}if(T.sort((w,b)=>w.route.localeCompare(b.route)),T.forEach((w,b)=>{let _=b===T.length-1?"\u2514\u2500 ":"\u251C\u2500 ",E=w.fileType==="md"?`${e.magenta}(markdown)${e.reset}`:"";console.log(` ${e.green}${_}${w.route}${e.reset} \u2192 ${e.bright}${w.filePath}${e.reset} ${E}`)}),console.log(`
1440
- Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(v.url.toString(),()=>{if(d)Ke.watch(c,{recursive:!0}).close();v.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let w=Ke.watch(c,{recursive:!0},async(b,k)=>{if(!k)return;if(k.endsWith(".stx")||k.endsWith(".js")||k.endsWith(".ts")||k.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${k}${e.yellow} changed, rebuilding...${e.reset}`),Ge.clear(),fe(),await g()});process.on("SIGINT",()=>{w.close(),v.stop(),process.exit(0)})}return!0}function an(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:Wr}=globalThis.Bun;import me from"fs";import te from"path";async function ln(t){try{return pn(await Bun.file(t).text())}catch{return}}function zt(t){let n=Bun.file(t),s=te.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},c=[".js",".css",".json"].includes(s)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(n,{headers:{"Content-Type":d[s]||"application/octet-stream",...c}})}async function Dr(t=".",n={}){let s=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,c=null,u=n.hmrPort||s+1,f=te.resolve(t),{loadStxConfig:g}=await import("./chunk-n79ww4aq.js"),h=await g(f),{createServerApi:x,isServerApiSource:v}=await import("./chunk-rwsyemkp.js"),S=n.stxOptions?.serverApi??h.serverApi,T=await x(f,S),w=h.root&&h.root!=="."?te.join(f,h.root):f,b=n.pagesDir||h.pagesDir||"pages",k=te.join(w,b);if(!me.existsSync(k)&&!h._layerPageDirs?.some((O)=>me.existsSync(O)))return console.error(`${e.red}Error: No '${b}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${k}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${b}/index.stx for the homepage.${e.reset}`),!1;let _=G(w,{pagesDir:b,pagesDirs:h._layerPageDirs?[k,...h._layerPageDirs.slice(1)]:void 0});if(_.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${k}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${_.length}${e.blue} routes${e.reset}`);let E=h?._pluginPageDirs||[],R=[];for(let{dir:O,prefix:j}of E)if(me.existsSync(O)){let z=G(te.dirname(O),{pagesDir:te.basename(O)});for(let Q of z){let q=j==="/"?Q.pattern:`${j}${Q.pattern==="/"?"":Q.pattern}`;R.push({route:{...Q,pattern:q},prefix:j})}if(z.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${z.length}${e.blue} routes at ${e.cyan}${j}${e.reset}`)}let A=new Map,C=null,D=null;if(n.stxOptions?.shell!==!1){if(D=await Gi(f,n.stxOptions?.shell),D){if(C=await no(D,n.stxOptions||{}),C)console.log(`${e.blue}Using app shell: ${e.bright}${te.relative(f,D)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}xt(),await kt(f);let I=St();if(I.length>0)console.log(`${e.blue}Loaded ${e.bright}${I.length}${e.blue} middleware: ${e.dim}${I.join(", ")}${e.reset}`);let V={},Y=null;try{let{loadStxConfig:O}=await import("./chunk-n79ww4aq.js"),j=await O(f);if(j?.apiRouter)Y=j?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(j?.apiRoutes){V=j.apiRoutes;let z=Object.keys(V).length;if(z>0)console.log(`${e.blue}Loaded ${e.bright}${z} API route${z>1?"s":""}${e.reset}`)}if(j?.broadcasting?.enabled)try{let{startBroadcasting:z,loadChannels:Q}=await import("./chunk-h6jba844.js"),q=j.broadcasting;await z(q);let Oe=q.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${Oe}/ws${e.reset}`);let we=te.join(process.cwd(),"channels.ts");if(me.existsSync(we))try{let N=await Q(we);console.log(`${e.blue}Loaded ${e.bright}${N} broadcast channel${N!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(N){console.warn(`${e.yellow}Failed to load channels.ts: ${N.message}${e.reset}`)}}catch(z){console.warn(`${e.yellow}Broadcasting failed to start: ${z.message}${e.reset}`)}}catch{}let ve=l(f,"output");me.mkdirSync(ve,{recursive:!0});let le=new Map,Pe=new Set,ne=async(O)=>{let j=bs(k,O);if(!j)return null;try{let z=await Bun.build({entrypoints:[j],outdir:ve,plugins:[nt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!z.success)return null;let Q=z.outputs.find((q)=>q.path.endsWith(".html"));if(!Q)return null;return await Bun.file(Q.path).text()}catch{return null}},F=new Map,L=async(O,j)=>{try{let{processDirectives:z,extractVariables:Q,defaultConfig:q,loadStxConfig:Oe,injectRouterScript:we}=await import("./chunk-n79ww4aq.js"),{checkCache:N,cacheTemplate:J,readFileCached:W,templateCache:pe}=await import("./chunk-z24bjeny.js"),X=await Oe(f),We=(ie)=>{if(!ie)return ie;if(te.isAbsolute(ie))return ie;return te.resolve(f,ie)},ce={...q,...X,...n.stxOptions,autoShell:!0};if(n.debugDirectives)ce.debug=!0;ce.partialsDir=We(ce.partialsDir),ce.componentsDir=We(ce.componentsDir),ce.layoutsDir=We(ce.layoutsDir),ce.storesDir=We(ce.storesDir||"stores"),ce.cachePath=We(ce.cachePath)??l(f,"cache");let H=!j&&!n.profile,re=ce.cache!==!1;if(re&&H){let ie=pe.get(O.filePath);if(ie)try{if((await me.promises.stat(O.filePath)).mtime.getTime()<=ie.mtime){let He=!0;for(let ke of ie.dependencies){if(!me.existsSync(ke)){He=!1;break}if((await me.promises.stat(ke)).mtime.getTime()>ie.mtime){He=!1;break}}if(He){let ke=ie.output;if(C)ke=Ue(ke,{preserveHead:!0});let st=F.get(O.filePath);return{route:O,content:ke,status:st?.status??await ln(O.filePath),headers:st?.headers}}}}catch{}let Ie=await N(O.filePath,ce);if(Ie){let je=Ie;if(C)je=Ue(je,{preserveHead:!0});let He=F.get(O.filePath);return{route:O,content:je,status:He?.status??await ln(O.filePath),headers:He?.headers}}}let Z=re?await W(O.filePath):await Bun.file(O.filePath).text(),se=pn(Z),{classifyAllScripts:ue}=await import("./chunk-n79ww4aq.js"),U=ue(Z),Le=U.server.map((ie)=>ie.content),De=Z;for(let ie of U.server)De=De.replace(ie.fullTag,"");let ee={__filename:O.filePath,__dirname:te.dirname(O.filePath),__stx_options:ce,params:j??{},__stx_runtime_head:{}};for(let ie of Le)try{await Q(ie,ee,O.filePath)}catch(Ie){if(n.stxOptions?.debug)console.error("[stx] variable extraction error",O.filePath,Ie?.message||Ie)}let Ae=new Set,he;if(n.profile){let ie=performance.now();he=await z(De,ee,O.filePath,ce,Ae);let Ie=performance.now()-ie,je=te.relative(f,O.filePath)||O.filePath;console.log(`[stx:profile] ${je} \u2192 ${Ie.toFixed(2)}ms`)}else he=await z(De,ee,O.filePath,ce,Ae);if(!C)he=await we(he,{router:ce.router});{let{interpolateScriptExpressions:ie}=await import("./chunk-cczxhrbh.js");he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Ie,je,He)=>{if(!/function\s+__stx_setup_/.test(He))return Ie;return`<script${je}>${ie(He,ee)}</script>`})}if(C)he=Ue(he,{preserveHead:!0});if(re&&H)await J(O.filePath,he,Ae,ce);let{extractStreamBoundaries:at}=await import("./chunk-et11hr3d.js"),Ye=at(ee),rt=ee.__streamTemplates;if(rt&&typeof rt==="object"&&Object.keys(rt).length>0){let ie=ee.streamBoundaries||{},Ie={...ce,autoShell:!1},je=Object.keys(rt).map((ke)=>({id:ke,render:async()=>{let st=typeof ie[ke]==="function"?await ie[ke]():void 0;return z(rt[ke],{...ee,$boundary:st},O.filePath,Ie,new Set)}})),He=new Set(je.map((ke)=>ke.id));Ye=[...(Ye||[]).filter((ke)=>!He.has(ke.id)),...je]}if(Ye&&Ye.length>0)Pe.add(O.pattern);else Ye=void 0;let Wt=Pt(ee),Vt=It(ee);if(H)F.set(O.filePath,{status:Wt,headers:Vt});return{route:O,content:he,status:Wt??se,headers:Vt,boundaries:Ye}}catch(z){return console.error(`${e.red}Error building ${e.bright}${O.pattern}${e.reset}:`,z),null}},Fe=8,ze=async()=>{let O=new Set(le.keys()),j=new Set(A.keys());le.clear(),A.clear();let z=n.prebuild===!1?_.filter((q)=>O.has(q.pattern)):_,Q=n.prebuild===!1?R.filter(({route:q})=>j.has(q.pattern)):R;for(let q=0;q<z.length;q+=Fe){let Oe=z.slice(q,q+Fe),we=await Promise.all(Oe.map((N)=>L(N)));for(let N of we)if(N)le.set(N.route.pattern,N)}for(let q=0;q<Q.length;q+=Fe){let Oe=Q.slice(q,q+Fe),we=await Promise.all(Oe.map(({route:N})=>L(N)));for(let N of we)if(N)A.set(N.route.pattern,N)}return le.size>0};if(console.log(`${e.blue}${n.prebuild===!1?"Rendering pages on request...":"Building pages..."}${e.reset}`),!(n.prebuild===!1?_.length+R.length>0:await ze()))return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await sn(f);let Xe=s;try{if(Xe=await Ve(s),Xe!==s)console.log(`${e.yellow}Port ${s} is busy, using port ${Xe} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let O=n.hmrPort||Xe+1;c=vt({wsPort:O,verbose:!1}),u=c.start(O)}let Rt=(O,j)=>{let Q=`<script data-stx-route-params>(function(){var p=${JSON.stringify(j).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(O.includes("</head>"))return O.replace("</head>",`${Q}</head>`);if(O.includes("<body"))return O.replace(/<body([^>]*)>/,`<body$1>${Q}`);return Q+O};console.log(`${e.blue}Starting server...${e.reset}`);let Ot=Wr({port:Xe,hostname:n.hostname,async fetch(O){let j=new URL(O.url),z=n.stxOptions?.offline??h.offline;if(j.pathname===xo&&z?.enabled){if(!["GET","HEAD"].includes(O.method))return new Response("Method Not Allowed",{status:405,headers:{Allow:"GET, HEAD"}});return new Response(O.method==="HEAD"?null:So(z,Jr()),{headers:{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-store","Service-Worker-Allowed":"/"}})}let Q=h?.publicDir||"public",q=te.join(f,Q,j.pathname),Oe=te.join(f,j.pathname),we=te.join(ve,j.pathname);if([q,Oe,we].some((H)=>v(H,f,S)))return new Response("Not Found",{status:404});let[N,J,W]=await Promise.all([me.promises.stat(q).catch(()=>null),me.promises.stat(Oe).catch(()=>null),me.promises.stat(we).catch(()=>null)]);if(N?.isFile()&&!v(q,f,S))return zt(q);if(J?.isFile()&&!v(Oe,f,S))return zt(Oe);if(W?.isFile()&&!v(we,f,S))return zt(we);if(j.pathname.startsWith("/_stx/component/")){let H=decodeURIComponent(j.pathname.slice(16));if(H)try{let re=`<${H} />`,Z={...buildConfig,autoShell:!1},se=await processDirectives(re,{},te.join(f,"components",`${H}.stx`),Z,new Set);return new Response(se,{headers:{"Content-Type":"text/html"}})}catch(re){return new Response(`<div class="stx-async-error">${re.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(j.pathname==="/_stx/img"){let{handleImageRequest:H}=await import("./chunk-75wdm7kd.js"),re=await H(O,{publicDir:te.join(f,Q),cacheDir:l(f,"cache","img")});if(re)return re}if(Y)try{let H=await Y.handleRequest(O);if(H.status!==404)return H}catch{}if(V[j.pathname])try{return await V[j.pathname](O)}catch(H){return new Response(JSON.stringify({error:H.message}),{status:500,headers:{"Content-Type":"application/json"}})}let pe=await T(O);if(pe)return pe;let X=lr(j.pathname,_);if(X){let H=le.get(X.route.pattern),re=Pe.has(X.route.pattern);if(!H||X.route.isDynamic&&Object.keys(X.params).length>0||re){let Z=await L(X.route,X.params);if(Z){if(H=Z,!X.route.isDynamic&&!re)le.set(X.route.pattern,Z)}}if(H){let Z=H.status??200,se=H.headers??{},ue=(X.route.filePath?mt(await Bun.file(X.route.filePath).text().catch(()=>"")):null)??{};if(ue.validate){if(!await ue.validate({params:X.params})){let De=await ne(404);if(De){let ee=De;if(ee=await y(ee,f),o)ee=Ne(ee,u);return new Response(ee,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(ue.middleware){let Le=_t(j.pathname,X.params,ue,j.search),De=Ct(Le,null,O,{isServer:!0}),ee=await Et(ue.middleware,De);if(ee.redirect){let Ae=ee.redirect.path,he=ee.redirect.options.redirectCode||302,at=new Headers(ee.responseHeaders);return at.set("Location",Ae),new Response(null,{status:he,headers:at})}if(ee.abort){let{statusCode:Ae,message:he}=ee.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${Ae}</title></head><body><h1>Error ${Ae}</h1><p>${he}</p></body></html>`,{status:Ae,headers:{"Content-Type":"text/html"}})}if(Object.keys(ee.state).length>0){let Ae=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(ee.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;H.content=H.content.replace("</head>",`${Ae}</head>`)}}let U=H.content;if(C&&Xi(O)){let Le=Ze(U),De=ye(U),ee=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Ae=ee?Tn(ee[1].trim()):"";if(Object.keys(X.params).length>0)U=Rt(U,X.params);U=await y(U,f);let he=h?.router?.container||"main";return U=Ce(U,he,!0),new Response(U,{status:Z,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Le.layout,"X-STX-Layout-Group":Le.group,"X-STX-Runtime":De?"true":"false",...Ae&&{"X-STX-Title":encodeURIComponent(Ae)},[Ha]:Jr(),...M(),"Cache-Control":dt}})}if(C)U=Br(C,U);if(Object.keys(X.params).length>0)U=Rt(U,X.params);if(U=await y(U,f),o)U=Ne(U,u);if(n.native)if(U.includes("<head>"))U=U.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else U="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+U;if(n.titlebarHidden)if(U.includes("<head>"))U=U.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else U=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${U}`;if(H.boundaries&&H.boundaries.length>0){let{renderStreamingPage:Le,streamToResponse:De}=await import("./chunk-et11hr3d.js");return De(Le(U,H.boundaries,{timeoutMs:30000}),{status:Z,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(U,{status:Z,headers:{"Content-Type":"text/html",...M(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...se}})}}if(R.length>0){let H=R.map((Z)=>Z.route),re=lr(j.pathname,H);if(re){let Z=A.get(re.route.pattern);if(!Z||re.route.isDynamic){let se=await L(re.route,re.params);if(se){if(Z=se,!re.route.isDynamic)A.set(re.route.pattern,se)}}if(Z){let se=Z.content;if(C)se=Br(C,se);if(Object.keys(re.params).length>0)se=Rt(se,re.params);if(se=await y(se,f),o)se=Ne(se,u);return new Response(se,{status:Z.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:Z}of E)if(Z!=="/"&&j.pathname.startsWith(Z)){let se=A.get(Z)||A.get(Z+"/");if(!se){let ue=R.find(({route:U})=>U.pattern===Z||U.pattern===`${Z}/`);if(ue){let U=await L(ue.route);if(U)se=U,A.set(ue.route.pattern,U)}}if(se){let ue=se.content;if(C)ue=Br(C,ue);if(ue=await y(ue,f),o)ue=Ne(ue,u);return new Response(ue,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(wt(j.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let We=le.get("/");if(We){let H=We.content;if(H=await y(H,f),o)H=Ne(H,u);if(n.native)if(H.includes("<head>"))H=H.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else H="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+H;return new Response(H,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let ce=await ne(404);if(ce){let H=ce;if(H=await y(H,f),o)H=Ne(H,u);return new Response(H,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(O){let j=await ne(500);if(j)return new Response(j,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${O}
1440
+ Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(v.url.toString(),()=>{if(d)Ke.watch(c,{recursive:!0}).close();v.stop()}),d){console.log(`${e.blue}Watching for changes...${e.reset}`);let w=Ke.watch(c,{recursive:!0},async(b,k)=>{if(!k)return;if(k.endsWith(".stx")||k.endsWith(".js")||k.endsWith(".ts")||k.endsWith(".md"))console.log(`${e.yellow}File ${e.bright}${k}${e.yellow} changed, rebuilding...${e.reset}`),Ge.clear(),fe(),await g()});process.on("SIGINT",()=>{w.close(),v.stop(),process.exit(0)})}return!0}function an(t){return String(t??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:Wr}=globalThis.Bun;import me from"fs";import te from"path";async function ln(t){try{return pn(await Bun.file(t).text())}catch{return}}function zt(t){let n=Bun.file(t),s=te.extname(t).toLowerCase(),d={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},c=[".js",".css",".json"].includes(s)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(n,{headers:{"Content-Type":d[s]||"application/octet-stream",...c}})}async function Dr(t=".",n={}){let s=n.port||3000,d=n.watch!==!1,o=n.hotReload!==!1&&d,c=null,u=n.hmrPort||s+1,f=te.resolve(t),{loadStxConfig:g}=await import("./chunk-vqr0afr9.js"),h=await g(f),{createServerApi:x,isServerApiSource:v}=await import("./chunk-738110r3.js"),S=n.stxOptions?.serverApi??h.serverApi,T=await x(f,S),w=h.root&&h.root!=="."?te.join(f,h.root):f,b=n.pagesDir||h.pagesDir||"pages",k=te.join(w,b);if(!me.existsSync(k)&&!h._layerPageDirs?.some((O)=>me.existsSync(O)))return console.error(`${e.red}Error: No '${b}' directory found${e.reset}`),console.log(`${e.dim}Looked in: ${e.bright}${k}${e.reset}`),console.log(`${e.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${e.reset}`),console.log(`${e.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${e.reset}`),console.log(`${e.dim}Starting fresh? Create ${b}/index.stx for the homepage.${e.reset}`),!1;let _=G(w,{pagesDir:b,pagesDirs:h._layerPageDirs?[k,...h._layerPageDirs.slice(1)]:void 0});if(_.length===0)return console.error(`${e.red}Error: No page files found in ${e.bright}${k}${e.reset}`),!1;console.log(`${e.blue}Found ${e.bright}${_.length}${e.blue} routes${e.reset}`);let E=h?._pluginPageDirs||[],R=[];for(let{dir:O,prefix:j}of E)if(me.existsSync(O)){let z=G(te.dirname(O),{pagesDir:te.basename(O)});for(let Q of z){let q=j==="/"?Q.pattern:`${j}${Q.pattern==="/"?"":Q.pattern}`;R.push({route:{...Q,pattern:q},prefix:j})}if(z.length>0)console.log(`${e.blue}Plugin pages: ${e.bright}${z.length}${e.blue} routes at ${e.cyan}${j}${e.reset}`)}let A=new Map,C=null,D=null;if(n.stxOptions?.shell!==!1){if(D=await Gi(f,n.stxOptions?.shell),D){if(C=await no(D,n.stxOptions||{}),C)console.log(`${e.blue}Using app shell: ${e.bright}${te.relative(f,D)}${e.reset} ${e.dim}(deprecated: use layouts/default.stx instead)${e.reset}`)}}xt(),await kt(f);let I=St();if(I.length>0)console.log(`${e.blue}Loaded ${e.bright}${I.length}${e.blue} middleware: ${e.dim}${I.join(", ")}${e.reset}`);let V={},Y=null;try{let{loadStxConfig:O}=await import("./chunk-vqr0afr9.js"),j=await O(f);if(j?.apiRouter)Y=j?.apiRouter,console.log(`${e.blue}Using custom router for API handling${e.reset}`);if(j?.apiRoutes){V=j.apiRoutes;let z=Object.keys(V).length;if(z>0)console.log(`${e.blue}Loaded ${e.bright}${z} API route${z>1?"s":""}${e.reset}`)}if(j?.broadcasting?.enabled)try{let{startBroadcasting:z,loadChannels:Q}=await import("./chunk-h6jba844.js"),q=j.broadcasting;await z(q);let Oe=q.port??6001;console.log(`${e.magenta}Broadcasting on ${e.cyan}ws://localhost:${Oe}/ws${e.reset}`);let we=te.join(process.cwd(),"channels.ts");if(me.existsSync(we))try{let N=await Q(we);console.log(`${e.blue}Loaded ${e.bright}${N} broadcast channel${N!==1?"s":""}${e.blue} from channels.ts${e.reset}`)}catch(N){console.warn(`${e.yellow}Failed to load channels.ts: ${N.message}${e.reset}`)}}catch(z){console.warn(`${e.yellow}Broadcasting failed to start: ${z.message}${e.reset}`)}}catch{}let ve=l(f,"output");me.mkdirSync(ve,{recursive:!0});let le=new Map,Pe=new Set,ne=async(O)=>{let j=bs(k,O);if(!j)return null;try{let z=await Bun.build({entrypoints:[j],outdir:ve,plugins:[nt],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...n.stxOptions});if(!z.success)return null;let Q=z.outputs.find((q)=>q.path.endsWith(".html"));if(!Q)return null;return await Bun.file(Q.path).text()}catch{return null}},F=new Map,L=async(O,j)=>{try{let{processDirectives:z,extractVariables:Q,defaultConfig:q,loadStxConfig:Oe,injectRouterScript:we}=await import("./chunk-vqr0afr9.js"),{checkCache:N,cacheTemplate:J,readFileCached:W,templateCache:pe}=await import("./chunk-5p961dp2.js"),X=await Oe(f),We=(ie)=>{if(!ie)return ie;if(te.isAbsolute(ie))return ie;return te.resolve(f,ie)},ce={...q,...X,...n.stxOptions,autoShell:!0};if(n.debugDirectives)ce.debug=!0;ce.partialsDir=We(ce.partialsDir),ce.componentsDir=We(ce.componentsDir),ce.layoutsDir=We(ce.layoutsDir),ce.storesDir=We(ce.storesDir||"stores"),ce.cachePath=We(ce.cachePath)??l(f,"cache");let H=!j&&!n.profile,re=ce.cache!==!1;if(re&&H){let ie=pe.get(O.filePath);if(ie)try{if((await me.promises.stat(O.filePath)).mtime.getTime()<=ie.mtime){let He=!0;for(let ke of ie.dependencies){if(!me.existsSync(ke)){He=!1;break}if((await me.promises.stat(ke)).mtime.getTime()>ie.mtime){He=!1;break}}if(He){let ke=ie.output;if(C)ke=Ue(ke,{preserveHead:!0});let st=F.get(O.filePath);return{route:O,content:ke,status:st?.status??await ln(O.filePath),headers:st?.headers}}}}catch{}let Ie=await N(O.filePath,ce);if(Ie){let je=Ie;if(C)je=Ue(je,{preserveHead:!0});let He=F.get(O.filePath);return{route:O,content:je,status:He?.status??await ln(O.filePath),headers:He?.headers}}}let Z=re?await W(O.filePath):await Bun.file(O.filePath).text(),se=pn(Z),{classifyAllScripts:ue}=await import("./chunk-vqr0afr9.js"),U=ue(Z),Le=U.server.map((ie)=>ie.content),De=Z;for(let ie of U.server)De=De.replace(ie.fullTag,"");let ee={__filename:O.filePath,__dirname:te.dirname(O.filePath),__stx_options:ce,params:j??{},__stx_runtime_head:{}};for(let ie of Le)try{await Q(ie,ee,O.filePath)}catch(Ie){if(n.stxOptions?.debug)console.error("[stx] variable extraction error",O.filePath,Ie?.message||Ie)}let Ae=new Set,he;if(n.profile){let ie=performance.now();he=await z(De,ee,O.filePath,ce,Ae);let Ie=performance.now()-ie,je=te.relative(f,O.filePath)||O.filePath;console.log(`[stx:profile] ${je} \u2192 ${Ie.toFixed(2)}ms`)}else he=await z(De,ee,O.filePath,ce,Ae);if(!C)he=await we(he,{router:ce.router});{let{interpolateScriptExpressions:ie}=await import("./chunk-twc23s14.js");he=he.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(Ie,je,He)=>{if(!/function\s+__stx_setup_/.test(He))return Ie;return`<script${je}>${ie(He,ee)}</script>`})}if(C)he=Ue(he,{preserveHead:!0});if(re&&H)await J(O.filePath,he,Ae,ce);let{extractStreamBoundaries:at}=await import("./chunk-k0kt643q.js"),Ye=at(ee),rt=ee.__streamTemplates;if(rt&&typeof rt==="object"&&Object.keys(rt).length>0){let ie=ee.streamBoundaries||{},Ie={...ce,autoShell:!1},je=Object.keys(rt).map((ke)=>({id:ke,render:async()=>{let st=typeof ie[ke]==="function"?await ie[ke]():void 0;return z(rt[ke],{...ee,$boundary:st},O.filePath,Ie,new Set)}})),He=new Set(je.map((ke)=>ke.id));Ye=[...(Ye||[]).filter((ke)=>!He.has(ke.id)),...je]}if(Ye&&Ye.length>0)Pe.add(O.pattern);else Ye=void 0;let Wt=Pt(ee),Vt=It(ee);if(H)F.set(O.filePath,{status:Wt,headers:Vt});return{route:O,content:he,status:Wt??se,headers:Vt,boundaries:Ye}}catch(z){return console.error(`${e.red}Error building ${e.bright}${O.pattern}${e.reset}:`,z),null}},Fe=8,ze=async()=>{let O=new Set(le.keys()),j=new Set(A.keys());le.clear(),A.clear();let z=n.prebuild===!1?_.filter((q)=>O.has(q.pattern)):_,Q=n.prebuild===!1?R.filter(({route:q})=>j.has(q.pattern)):R;for(let q=0;q<z.length;q+=Fe){let Oe=z.slice(q,q+Fe),we=await Promise.all(Oe.map((N)=>L(N)));for(let N of we)if(N)le.set(N.route.pattern,N)}for(let q=0;q<Q.length;q+=Fe){let Oe=Q.slice(q,q+Fe),we=await Promise.all(Oe.map(({route:N})=>L(N)));for(let N of we)if(N)A.set(N.route.pattern,N)}return le.size>0};if(console.log(`${e.blue}${n.prebuild===!1?"Rendering pages on request...":"Building pages..."}${e.reset}`),!(n.prebuild===!1?_.length+R.length>0:await ze()))return console.error(`${e.red}No pages were successfully built${e.reset}`),!1;await sn(f);let Xe=s;try{if(Xe=await Ve(s),Xe!==s)console.log(`${e.yellow}Port ${s} is busy, using port ${Xe} instead${e.reset}`)}catch{return console.error(`${e.red}Could not find an available port${e.reset}`),!1}if(o){let O=n.hmrPort||Xe+1;c=vt({wsPort:O,verbose:!1}),u=c.start(O)}let Rt=(O,j)=>{let Q=`<script data-stx-route-params>(function(){var p=${JSON.stringify(j).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(O.includes("</head>"))return O.replace("</head>",`${Q}</head>`);if(O.includes("<body"))return O.replace(/<body([^>]*)>/,`<body$1>${Q}`);return Q+O};console.log(`${e.blue}Starting server...${e.reset}`);let Ot=Wr({port:Xe,hostname:n.hostname,async fetch(O){let j=new URL(O.url),z=n.stxOptions?.offline??h.offline;if(j.pathname===xo&&z?.enabled){if(!["GET","HEAD"].includes(O.method))return new Response("Method Not Allowed",{status:405,headers:{Allow:"GET, HEAD"}});return new Response(O.method==="HEAD"?null:So(z,Jr()),{headers:{"Content-Type":"application/javascript; charset=utf-8","Cache-Control":"no-store","Service-Worker-Allowed":"/"}})}let Q=h?.publicDir||"public",q=te.join(f,Q,j.pathname),Oe=te.join(f,j.pathname),we=te.join(ve,j.pathname);if([q,Oe,we].some((H)=>v(H,f,S)))return new Response("Not Found",{status:404});let[N,J,W]=await Promise.all([me.promises.stat(q).catch(()=>null),me.promises.stat(Oe).catch(()=>null),me.promises.stat(we).catch(()=>null)]);if(N?.isFile()&&!v(q,f,S))return zt(q);if(J?.isFile()&&!v(Oe,f,S))return zt(Oe);if(W?.isFile()&&!v(we,f,S))return zt(we);if(j.pathname.startsWith("/_stx/component/")){let H=decodeURIComponent(j.pathname.slice(16));if(H)try{let re=`<${H} />`,Z={...buildConfig,autoShell:!1},se=await processDirectives(re,{},te.join(f,"components",`${H}.stx`),Z,new Set);return new Response(se,{headers:{"Content-Type":"text/html"}})}catch(re){return new Response(`<div class="stx-async-error">${re.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(j.pathname==="/_stx/img"){let{handleImageRequest:H}=await import("./chunk-75wdm7kd.js"),re=await H(O,{publicDir:te.join(f,Q),cacheDir:l(f,"cache","img")});if(re)return re}if(Y)try{let H=await Y.handleRequest(O);if(H.status!==404)return H}catch{}if(V[j.pathname])try{return await V[j.pathname](O)}catch(H){return new Response(JSON.stringify({error:H.message}),{status:500,headers:{"Content-Type":"application/json"}})}let pe=await T(O);if(pe)return pe;let X=lr(j.pathname,_);if(X){let H=le.get(X.route.pattern),re=Pe.has(X.route.pattern);if(!H||X.route.isDynamic&&Object.keys(X.params).length>0||re){let Z=await L(X.route,X.params);if(Z){if(H=Z,!X.route.isDynamic&&!re)le.set(X.route.pattern,Z)}}if(H){let Z=H.status??200,se=H.headers??{},ue=(X.route.filePath?mt(await Bun.file(X.route.filePath).text().catch(()=>"")):null)??{};if(ue.validate){if(!await ue.validate({params:X.params})){let De=await ne(404);if(De){let ee=De;if(ee=await y(ee,f),o)ee=Ne(ee,u);return new Response(ee,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(ue.middleware){let Le=_t(j.pathname,X.params,ue,j.search),De=Ct(Le,null,O,{isServer:!0}),ee=await Et(ue.middleware,De);if(ee.redirect){let Ae=ee.redirect.path,he=ee.redirect.options.redirectCode||302,at=new Headers(ee.responseHeaders);return at.set("Location",Ae),new Response(null,{status:he,headers:at})}if(ee.abort){let{statusCode:Ae,message:he}=ee.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${Ae}</title></head><body><h1>Error ${Ae}</h1><p>${he}</p></body></html>`,{status:Ae,headers:{"Content-Type":"text/html"}})}if(Object.keys(ee.state).length>0){let Ae=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(ee.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;H.content=H.content.replace("</head>",`${Ae}</head>`)}}let U=H.content;if(C&&Xi(O)){let Le=Ze(U),De=ye(U),ee=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i),Ae=ee?Tn(ee[1].trim()):"";if(Object.keys(X.params).length>0)U=Rt(U,X.params);U=await y(U,f);let he=h?.router?.container||"main";return U=Ce(U,he,!0),new Response(U,{status:Z,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Le.layout,"X-STX-Layout-Group":Le.group,"X-STX-Runtime":De?"true":"false",...Ae&&{"X-STX-Title":encodeURIComponent(Ae)},[Ha]:Jr(),...M(),"Cache-Control":dt}})}if(C)U=Br(C,U);if(Object.keys(X.params).length>0)U=Rt(U,X.params);if(U=await y(U,f),o)U=Ne(U,u);if(n.native)if(U.includes("<head>"))U=U.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else U="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+U;if(n.titlebarHidden)if(U.includes("<head>"))U=U.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else U=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${U}`;if(H.boundaries&&H.boundaries.length>0){let{renderStreamingPage:Le,streamToResponse:De}=await import("./chunk-k0kt643q.js");return De(Le(U,H.boundaries,{timeoutMs:30000}),{status:Z,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(U,{status:Z,headers:{"Content-Type":"text/html",...M(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...se}})}}if(R.length>0){let H=R.map((Z)=>Z.route),re=lr(j.pathname,H);if(re){let Z=A.get(re.route.pattern);if(!Z||re.route.isDynamic){let se=await L(re.route,re.params);if(se){if(Z=se,!re.route.isDynamic)A.set(re.route.pattern,se)}}if(Z){let se=Z.content;if(C)se=Br(C,se);if(Object.keys(re.params).length>0)se=Rt(se,re.params);if(se=await y(se,f),o)se=Ne(se,u);return new Response(se,{status:Z.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:Z}of E)if(Z!=="/"&&j.pathname.startsWith(Z)){let se=A.get(Z)||A.get(Z+"/");if(!se){let ue=R.find(({route:U})=>U.pattern===Z||U.pattern===`${Z}/`);if(ue){let U=await L(ue.route);if(U)se=U,A.set(ue.route.pattern,U)}}if(se){let ue=se.content;if(C)ue=Br(C,ue);if(ue=await y(ue,f),o)ue=Ne(ue,u);return new Response(ue,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}if(wt(j.pathname))return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}});let We=le.get("/");if(We){let H=We.content;if(H=await y(H,f),o)H=Ne(H,u);if(n.native)if(H.includes("<head>"))H=H.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else H="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+H;return new Response(H,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let ce=await ne(404);if(ce){let H=ce;if(H=await y(H,f),o)H=Ne(H,u);return new Response(H,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(O){let j=await ne(500);if(j)return new Response(j,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${O}
1441
1441
  ${O.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
1442
1442
  ${e.blue}stx${e.reset} ${e.green}${process.env.stx_VERSION||"v0.0.10"}${e.reset} ${e.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${e.reset}`),console.log(`
1443
1443
  ${e.bright}\u2192 ${e.cyan}http://localhost:${Xe}/${e.reset}`),o)console.log(`${e.dim} HMR: ws://localhost:${u}${e.reset}`);console.log(`
1444
1444
  ${e.yellow}Routes:${e.reset}`);let At=[...vs(_,f)];for(let{route:O}of R)At.push(`${O.pattern}`);if(At.forEach((O,j)=>{let Q=j===At.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${e.green}${Q}${e.reset}${O}`)}),console.log(`
1445
- Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(Ot.url.toString(),()=>{if(c)ot();Ot.stop()}),n.native){let O,j=te.join(k,"index.stx");if(me.existsSync(j)){let Q=await Bun.file(j).text();O=gt(Q)}let z=h?.app?.window??{};await Qe(Xe,{title:h?.app?.head?.title||te.basename(f)||"stx App",width:z.width,height:z.height,darkMode:z.darkMode,hotReload:z.hotReload,titlebarHidden:z.titlebarHidden??n.titlebarHidden===!0,nativeSidebar:!!O,sidebarConfig:O})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let O=(N)=>N.startsWith("public/")||N.startsWith("public\\"),j=(N)=>{let J=N.toLowerCase();return J.endsWith(".stx")||J.endsWith(".html")||J.endsWith(".md")},z=new Map,Q=()=>{let N=new Set([f,...h._layerGraph?.layers.map((J)=>J.root)??[],...h._layerGraph?.configDependencies.map((J)=>te.dirname(J))??[]].filter((J)=>me.existsSync(J)).map((J)=>me.realpathSync(J)));for(let J of h._layerGraph?.layers??[])for(let W of Object.values(J.resources)){if(!me.existsSync(W))continue;let pe=me.realpathSync(W);if(![...N].some((X)=>pe===X||pe.startsWith(`${X}${te.sep}`)))N.add(pe)}for(let[J,W]of z)if(!N.has(J))W.close(),z.delete(J);for(let J of N)if(!z.has(J)&&me.existsSync(J))z.set(J,me.watch(J,{recursive:!0},(W,pe)=>{Oe(J,W,pe).catch((X)=>console.error("[stx] Layer rebuild failed:",X))}))},q=Promise.resolve(),Oe=(N,J,W)=>(q=q.catch(()=>{}).then(()=>we(N,J,W)),q),we=async(N,J,W)=>{if(!W||bt(W))return;if(yt(W)){if(h._layerGraph){let pe=await g(f);Object.assign(h,pe),_.splice(0,_.length,...G(w,{pagesDir:b,pagesDirs:pe._layerPageDirs?[k,...pe._layerPageDirs.slice(1)]:void 0})),Q()}if(O(W)){if(console.log(`${e.cyan}${W} changed${e.reset}`),o&&c)c.reload(W)}else if(j(W)){console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),Ge.clear(),fe();try{let{invalidateFileCache:pe,templateCache:X}=await import("./chunk-z24bjeny.js");pe(te.resolve(N,W)),X.delete(te.resolve(N,W))}catch{}if(D&&W){if(te.resolve(N,W)===D||te.basename(D)===W){let X=await no(D,n.stxOptions||{});if(X)C=X}}if(await ze(),await tr(f),o&&c)c.reload(W)}else{console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),Ge.clear(),fe();try{let{invalidateFileCache:pe,templateCache:X}=await import("./chunk-z24bjeny.js");pe(te.resolve(N,W)),X.delete(te.resolve(N,W))}catch{}if(await ze(),o&&c)c.reload(W)}}else if(ht(W)){if(console.log(`${e.cyan}CSS ${W} changed${e.reset}`),o&&c)c.updateCss(W)}};Q(),process.on("SIGINT",()=>{for(let N of z.values())N.close();if(c)ot();Ot.stop(),process.exit(0)})}return!0}import Nt from"fs";import it from"path";async function Vr(t){try{let s=(await Bun.file(t).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return[];let d=s[1],o=[],c=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,u;while((u=c.exec(d))!==null){let f=u[1],g=u[2]||u[3]||u[4];if(!g)continue;let h={name:g},x=f.match(/@type\s+\{([^}]+)\}/i);if(x)h.type=x[1].trim();if(f.match(/@required/i))h.required=!0;let S=f.match(/@default\s+(.+?)(?:\s+|$)/i);if(S)h.default=S[1].trim();let T=f.split(`
1445
+ Press ${e.cyan}h${e.reset} + ${e.cyan}Enter${e.reset} to show shortcuts`),qe(Ot.url.toString(),()=>{if(c)ot();Ot.stop()}),n.native){let O,j=te.join(k,"index.stx");if(me.existsSync(j)){let Q=await Bun.file(j).text();O=gt(Q)}let z=h?.app?.window??{};await Qe(Xe,{title:h?.app?.head?.title||te.basename(f)||"stx App",width:z.width,height:z.height,darkMode:z.darkMode,hotReload:z.hotReload,titlebarHidden:z.titlebarHidden??n.titlebarHidden===!0,nativeSidebar:!!O,sidebarConfig:O})}if(d){console.log(`${e.blue}Watching for changes...${e.reset}`);let O=(N)=>N.startsWith("public/")||N.startsWith("public\\"),j=(N)=>{let J=N.toLowerCase();return J.endsWith(".stx")||J.endsWith(".html")||J.endsWith(".md")},z=new Map,Q=()=>{let N=new Set([f,...h._layerGraph?.layers.map((J)=>J.root)??[],...h._layerGraph?.configDependencies.map((J)=>te.dirname(J))??[]].filter((J)=>me.existsSync(J)).map((J)=>me.realpathSync(J)));for(let J of h._layerGraph?.layers??[])for(let W of Object.values(J.resources)){if(!me.existsSync(W))continue;let pe=me.realpathSync(W);if(![...N].some((X)=>pe===X||pe.startsWith(`${X}${te.sep}`)))N.add(pe)}for(let[J,W]of z)if(!N.has(J))W.close(),z.delete(J);for(let J of N)if(!z.has(J)&&me.existsSync(J))z.set(J,me.watch(J,{recursive:!0},(W,pe)=>{Oe(J,W,pe).catch((X)=>console.error("[stx] Layer rebuild failed:",X))}))},q=Promise.resolve(),Oe=(N,J,W)=>(q=q.catch(()=>{}).then(()=>we(N,J,W)),q),we=async(N,J,W)=>{if(!W||bt(W))return;if(yt(W)){if(h._layerGraph){let pe=await g(f);Object.assign(h,pe),_.splice(0,_.length,...G(w,{pagesDir:b,pagesDirs:pe._layerPageDirs?[k,...pe._layerPageDirs.slice(1)]:void 0})),Q()}if(O(W)){if(console.log(`${e.cyan}${W} changed${e.reset}`),o&&c)c.reload(W)}else if(j(W)){console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),Ge.clear(),fe();try{let{invalidateFileCache:pe,templateCache:X}=await import("./chunk-5p961dp2.js");pe(te.resolve(N,W)),X.delete(te.resolve(N,W))}catch{}if(D&&W){if(te.resolve(N,W)===D||te.basename(D)===W){let X=await no(D,n.stxOptions||{});if(X)C=X}}if(await ze(),await tr(f),o&&c)c.reload(W)}else{console.log(`${e.yellow}${W} changed, rebuilding...${e.reset}`),Ge.clear(),fe();try{let{invalidateFileCache:pe,templateCache:X}=await import("./chunk-5p961dp2.js");pe(te.resolve(N,W)),X.delete(te.resolve(N,W))}catch{}if(await ze(),o&&c)c.reload(W)}}else if(ht(W)){if(console.log(`${e.cyan}CSS ${W} changed${e.reset}`),o&&c)c.updateCss(W)}};Q(),process.on("SIGINT",()=>{for(let N of z.values())N.close();if(c)ot();Ot.stop(),process.exit(0)})}return!0}import Nt from"fs";import it from"path";async function Vr(t){try{let s=(await Bun.file(t).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!s)return[];let d=s[1],o=[],c=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,u;while((u=c.exec(d))!==null){let f=u[1],g=u[2]||u[3]||u[4];if(!g)continue;let h={name:g},x=f.match(/@type\s+\{([^}]+)\}/i);if(x)h.type=x[1].trim();if(f.match(/@required/i))h.required=!0;let S=f.match(/@default\s+(.+?)(?:\s+|$)/i);if(S)h.default=S[1].trim();let T=f.split(`
1446
1446
  `).map((w)=>w.trim().replace(/^\*\s*/,"")).filter((w)=>!w.startsWith("@")&&w.length>0);h.description=T.join(" ").trim(),o.push(h)}if(o.length===0){let f=d.match(/module\.exports\s*=\s*\{([^}]+)\}/i);if(f){let h=f[1].split(",").map((x)=>x.trim()).filter(Boolean);for(let x of h){let[v]=x.split(":").map((S)=>S.trim());if(v)o.push({name:v})}}}return o}catch(n){return console.error(`Error extracting props from ${t}:`,n),[]}}async function qr(t){try{let n=await Bun.file(t).text(),s=n.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||n.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(s)return s[1].split(`
1447
1447
  `).map((d)=>d.trim().replace(/^\*\s*/,"")).join(" ").trim();return""}catch{return""}}async function Kr(t,n=!1,s){let d=it.basename(t,".stx"),o=await Vr(t),c=await qr(t),u="";if(n&&s)u=`<${s}></${s}>`;else{let f=o.map((g)=>{if(g.type==="boolean")return`:${g.name}="true"`;return`${g.name}="value"`}).join(`
1448
1448
  `);u=`<${d}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Zn,i}from"./chunk-54xfrj8m.js";import"./chunk-69y16gf3.js";import"./chunk-91pycazt.js";import"./chunk-cwq30a2f.js";import"./chunk-k0wqy6jk.js";import"./chunk-aws32yq9.js";import"./chunk-ap79ecs3.js";import"./chunk-bj0z4gve.js";import"./chunk-2n68bepn.js";import{be}from"./chunk-h6zm6atc.js";import"./chunk-8f14cgm8.js";import"./chunk-0k80h9hw.js";import"./chunk-3h238w91.js";import"./chunk-1q726kxm.js";import"./chunk-6ew10ptg.js";import"./chunk-5f6x6fyp.js";import"./chunk-dxsdr77m.js";import"./chunk-4s1k8k2a.js";import{Ie,Ps,Is}from"./chunk-p8zsnhhe.js";import"./chunk-3eveprd2.js";import"./chunk-nzwcbt98.js";import"./chunk-wpwh529h.js";import"./chunk-zn3c0ew5.js";import"./chunk-27agaezn.js";export{Zn as buildModulesTag,be as injectRouterScript,i as processDirectives,Ps as processJsonDirective,Is as processOnceDirective,Ie as validateClientScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fe,vn,Ds,li,O}from"./chunk-nzwcbt98.js";import{bn}from"./chunk-m5a8zgft.js";import{Rr,_,Gc,ot,yi,Xc}from"./chunk-27agaezn.js";import{A}from"./chunk-zn3c0ew5.js";import{Ms,u,f,Mt,d,q,B,b,Fs,ke,He,zs}from"./chunk-wpwh529h.js";import{s,ge}from"./chunk-q1db41k8.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-byaasw3f.js";import Xe from"path";import kt from"process";import{AsyncLocalStorage as ko}from"async_hooks";var cr=new ko;function fn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function lr(e,n){return cr.run(fn(e),n)}async function ur(e,n){let t=cr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=JSON.stringify(l,(v,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function vr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(n&&R[1]==="const")return;let P=R[2];if(!a.has(P))i.push(P),a.add(P);return}let T=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){if(n&&t.slice(c).startsWith("const"))return;T[1].split(",").forEach((P)=>{let M=P.trim();if(!M)return;let G=M.indexOf(":"),L=(G>=0?M.slice(G+1).trim():M).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let D=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&t.slice(c).startsWith("const"))return;D[1].split(",").forEach((P)=>{let M=P.trim().replace(/^\.\.\./,"");if(!M)return;let G=M.split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function xs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ro(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ss(e,n){let t=`{ ${Ro(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import An from"fs";import Ae from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var fr=new Map;function ks(e,n=!0){let t=fr.get(e);if(n&&t)return t;let i=new Map,a=[Ae.join(e,"src"),Ae.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=An.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of v){let T=Ae.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;l(T,y+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let D=R.name.slice(0,-4);if(!i.has(D))i.set(D,T);let N=D.toLowerCase();if(!i.has(N))i.set(N,T);let j=H(D);if(!i.has(j))i.set(j,T)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)fr.set(e,i);return i}function _s(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=Ae.join(t,"node_modules",e);try{if(An.statSync(i).isDirectory())return i}catch{}let a=Ae.dirname(t);if(a===t)return null;t=a}}function Cs(e,n,t={}){return[Ae.resolve(Ae.dirname(n),`${e}.stx`),Ae.resolve(Ae.dirname(n),e),Ae.resolve(t.componentsDir||"components",`${e}.stx`),Ae.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function dr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function qo(e,n){let[t,i,a]=dr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*Ko(e,n,t={},i){let a=dr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ae.resolve(Ae.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[Ae.join(Ae.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ae.join(Ae.dirname(n),"components"),Ae.resolve(c,"src/components"),Ae.resolve(c,"components"),...import.meta.dir?[Ae.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let R of l)yield Ae.join(v,R);try{for(let R of An.readdirSync(v,{withFileTypes:!0}))if(R.isDirectory())for(let T of l)yield Ae.join(v,R.name,T)}catch{}}}function pr(e,n,t={},i){let a=qo(e,i);if(a!==void 0)return a;for(let l of Ko(e,n,t,i))try{if(An.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}import Ys from"fs";import ce from"path";import ht from"path";import qt from"fs";var Co=new Set(["touchstart","touchmove","wheel","mousewheel"]);function os(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Co.has(e.toLowerCase())}var xr=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"]),_r={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"},To=new Set(["ctrl","alt","shift","meta"]),Er={left:0,middle:1,right:2};function Sr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(To.has(i))n.systemKeys.push(i);else if(i in Er)n.mouse=i;else if(i in _r||/^[a-z]$/.test(i))n.keys.push(_r[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function kr(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,R=l.index,T=R+c.length,D=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,G,F]=P,L=G.split("."),Q=L[0];if(!xr.has(Q))continue;N.push({attribute:`@${G}`,event:Q,handler:F,modifiers:Sr(L.slice(1)),elementId:D})}let M=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=M.exec(v))!==null){let[,G,F]=P,L=G.split("."),Q=L[0];if(!xr.has(Q))continue;N.push({attribute:`@${G}`,event:Q,handler:F,modifiers:Sr(L.slice(1)),elementId:D})}if(N.length>0)t.push({originalTag:c,elementId:D,events:N,startIndex:R,endIndex:T})}return t}function Ao(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Er[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Io(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function as(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Oo(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ao(e),a=Io(as(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(os(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{Fe,vn,Ds,li,O}from"./chunk-nzwcbt98.js";import{bn}from"./chunk-3eveprd2.js";import{Rr,_,Gc,ot,yi,Xc}from"./chunk-27agaezn.js";import{A}from"./chunk-zn3c0ew5.js";import{Ms,u,f,Mt,d,q,B,b,Fs,ke,He,zs}from"./chunk-wpwh529h.js";import{s,ge}from"./chunk-q1db41k8.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-byaasw3f.js";import Xe from"path";import kt from"process";import{AsyncLocalStorage as ko}from"async_hooks";var cr=new ko;function fn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function lr(e,n){return cr.run(fn(e),n)}async function ur(e,n){let t=cr.getStore();if(!t)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=JSON.stringify(l,(v,R)=>{if(R===void 0||typeof R==="function"||typeof R==="symbol"||typeof R==="bigint"||typeof R==="number"&&!Number.isFinite(R))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(R&&typeof R==="object"&&!Array.isArray(R)&&Object.getPrototypeOf(R)!==Object.prototype&&Object.getPrototypeOf(R)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return R}),y=JSON.parse(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function vr(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let R=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(R){if(n&&R[1]==="const")return;let P=R[2];if(!a.has(P))i.push(P),a.add(P);return}let T=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){if(n&&t.slice(c).startsWith("const"))return;T[1].split(",").forEach((P)=>{let M=P.trim();if(!M)return;let G=M.indexOf(":"),L=(G>=0?M.slice(G+1).trim():M).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let D=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(n&&t.slice(c).startsWith("const"))return;D[1].split(",").forEach((P)=>{let M=P.trim().replace(/^\.\.\./,"");if(!M)return;let G=M.split(/[\s=]/)[0];if(G&&!a.has(G))i.push(G),a.add(G)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function xs(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Ro(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ss(e,n){let t=`{ ${Ro(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import An from"fs";import Ae from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var fr=new Map;function ks(e,n=!0){let t=fr.get(e);if(n&&t)return t;let i=new Map,a=[Ae.join(e,"src"),Ae.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=An.readdirSync(c,{withFileTypes:!0})}catch{return}for(let R of v){let T=Ae.join(c,R.name);if(R.isDirectory()){if(R.name==="node_modules"||R.name.startsWith("."))continue;l(T,y+1)}else if(R.isFile()&&R.name.endsWith(".stx")){let D=R.name.slice(0,-4);if(!i.has(D))i.set(D,T);let N=D.toLowerCase();if(!i.has(N))i.set(N,T);let j=H(D);if(!i.has(j))i.set(j,T)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)fr.set(e,i);return i}function _s(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=Ae.join(t,"node_modules",e);try{if(An.statSync(i).isDirectory())return i}catch{}let a=Ae.dirname(t);if(a===t)return null;t=a}}function Cs(e,n,t={}){return[Ae.resolve(Ae.dirname(n),`${e}.stx`),Ae.resolve(Ae.dirname(n),e),Ae.resolve(t.componentsDir||"components",`${e}.stx`),Ae.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function dr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function qo(e,n){let[t,i,a]=dr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*Ko(e,n,t={},i){let a=dr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield Ae.resolve(Ae.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[Ae.join(Ae.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],Ae.join(Ae.dirname(n),"components"),Ae.resolve(c,"src/components"),Ae.resolve(c,"components"),...import.meta.dir?[Ae.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let R of l)yield Ae.join(v,R);try{for(let R of An.readdirSync(v,{withFileTypes:!0}))if(R.isDirectory())for(let T of l)yield Ae.join(v,R.name,T)}catch{}}}function pr(e,n,t={},i){let a=qo(e,i);if(a!==void 0)return a;for(let l of Ko(e,n,t,i))try{if(An.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}import Ys from"fs";import ce from"path";import ht from"path";import qt from"fs";var Co=new Set(["touchstart","touchmove","wheel","mousewheel"]);function os(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Co.has(e.toLowerCase())}var xr=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"]),_r={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"},To=new Set(["ctrl","alt","shift","meta"]),Er={left:0,middle:1,right:2};function Sr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(To.has(i))n.systemKeys.push(i);else if(i in Er)n.mouse=i;else if(i in _r||/^[a-z]$/.test(i))n.keys.push(_r[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function kr(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,R=l.index,T=R+c.length,D=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,G,F]=P,L=G.split("."),Q=L[0];if(!xr.has(Q))continue;N.push({attribute:`@${G}`,event:Q,handler:F,modifiers:Sr(L.slice(1)),elementId:D})}let M=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=M.exec(v))!==null){let[,G,F]=P,L=G.split("."),Q=L[0];if(!xr.has(Q))continue;N.push({attribute:`@${G}`,event:Q,handler:F,modifiers:Sr(L.slice(1)),elementId:D})}if(N.length>0)t.push({originalTag:c,elementId:D,events:N,startIndex:R,endIndex:T})}return t}function Ao(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Er[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Io(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function as(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Oo(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Ao(e),a=Io(as(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(os(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${t}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function Po(e,n=""){let t=kr(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let R of c.events)R.elementId=v[1]}for(let v of c.events){let R=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),T=new RegExp(`\\s*${R}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${R}\\s*=\\s*'[^']*'`,"g");y=y.replace(T,""),y=y.replace(D,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function $r(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function fc(e,n,t){if(Xc(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Po(e,$r(n)),R=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...R,...v],y}let i=kr(e,$r(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],R=v.originalTag;if(!R.includes(" id="))R=R.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let T=R.match(/id=["']([^"']+)["']/);if(T)for(let D of v.events)D.elementId=T[1]}for(let T of v.events){let D=T.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),N=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");R=R.replace(N,""),R=R.replace(j,"")}a=a.slice(0,v.startIndex)+R+a.slice(v.endIndex)}let l=Go(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
- `+a.slice(c);else a+=l;return a}function Cr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Tt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Cr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Cr(y[1],!1).has(n))return!0;return!1}var Tr="",In,lt=/^[A-Za-z_$][\w$]*$/,Do=new Set(["if","for","while","switch","with"]),Ar=["(","[","{"],Ir=[")","]","}"],Mo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function jo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function cs(e){if(In&&e===Tr)return In;let{code:n,tokens:t}=jo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let M=t[P].text;if(["(","[","{"].includes(M))a.push(P);else if([")","]","}"].includes(M)){let G=a.at(-1);if(G!==void 0&&["()","[]","{}"].includes(t[G].text+M))a.pop(),i.set(G,P),i.set(P,G)}}function l(P,M){let G=[],F=P;for(let L=P;L<M;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??M)<M){L=i.get(L);continue}if(t[L].text===",")G.push([F,L]),F=L+1}return G.push([F,M]),G}let c=[];function y(P,M,G,F=!1){if(t[P]?.text==="...")P++;if(P>=M)return;let L=t[P].text;if(lt.test(L)){if(G.add(L),G===T)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=M)return;for(let[te,ne]of l(P+1,Q)){let ae=te;if(L==="{")for(let me=te;me<ne;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&i.has(me))me=i.get(me)}y(ae,ne,G,F)}}function v(P,M){let G=new Set;for(let[F,L]of l(P,M))y(F,L,G);return G}function R(P){let M=P;for(;M<t.length;M++){let G=t[M].text;if(["(","[","{"].includes(G)&&i.has(M)){M=i.get(M);continue}if([",",";",")","]","}"].includes(G))break}return t[Math.max(P,M-1)]?.end??n.length}let T=new Set,D=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let M=P-1,G=M,F;if(t[M]?.text===")"&&i.has(M))G=i.get(M),F=v(G+1,M);else if(t[M]&&lt.test(t[M].text))F=new Set([t[M].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:R(L);D.push({start:t[G].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let M=t[P-1]?.text;if(!M||Do.has(M)||!lt.test(M)&&M!=="*"&&M!=="]")continue;let G=i.get(P),F=G+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;D.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:M!=="catch",names:v(P+1,G)})}function N(P){let M=P;for(;M<t.length;M++){let G=t[M].text;if(Ar.includes(G)&&i.has(M)){M=i.get(M);continue}if(G===";"||Ir.includes(G))break;let F=t[M-1];if(M>P&&Mo.has(G)&&F.text!==".")break;if(M>P&&/[\n\r]/.test(n.slice(F.end,t[M].start))&&(/^[\w$]+$/.test(F.text)||Ir.includes(F.text)||['"',"'","`"].includes(F.text))&&lt.test(G)&&!["in","of","instanceof"].includes(G))break}return M}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let M=t[P+1]?.text==="await"?P+2:P+1;if(t[M]?.text!=="("||!i.has(M))continue;let G=i.get(M),F=G+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:M,headEnd:G,start:t[M].start,end:Q})}for(let P=0;P<t.length;P++){let M=t[P].text,G=t[P-1]?.text;if(G==="."||t[P+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(M==="const"||M==="let"||M==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ne=0;for(let ae=P+1;ae<=F;ae++){let me=t[ae]?.text;if(ae<F&&Ar.includes(me)&&i.has(ae)&&i.get(ae)<F){ae=i.get(ae);continue}if(ae<F&&me===":"&&!te)Q=!0;else if(ae<F&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<F&&Q&&me==="<")ne++;else if(ae<F&&Q&&me===">"&&ne>0)ne--;else if(ae===F||me===","&&ne===0)y(L,ae,T,M==="var"),L=ae+1,Q=!1,te=!1}}else if(M==="function"||M==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&&lt.test(t[F].text)&&t[F].text!=="extends")T.add(t[F].text),c.push({name:t[F].text,token:F})}else if(M==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&&lt.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")T.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ne,ae]of l(Q+1,te)){let me=ae-1;while(me>=ne&&!lt.test(t[me].text))me--;if(me>=ne&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return Tr=e,In={code:n,scopes:D,loops:j,declarations:T,sites:c,tokens:t,pairs:i},In}function ls(e){let n=cs(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(cs(e).declarations)}function cn(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=cs(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let R=new Set,T=new Map;for(let j of a){if(!n.has(j.name))continue;R.add(j.token);let P=j.file?-1:y[j.token],M=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];M=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)M=[F.start,F.end]}let G=T.get(j.name);if(G)G.push(M);else T.set(j.name,[M])}let D=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&lt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let M=P+1;M<c.get(P);M++)D.add(M)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||R.has(j)||D.has(j))continue;let M=l[j-1]?.text;if(M==="#"||M==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(M==="{"||M===","))continue;let G=l[j].start;if(T.get(P)?.some(([F,L])=>G>=F&&G<L))continue;if(t.some((F)=>G>=F.start&&G<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.747";var Or=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Lo(){let e=globalThis;return e[Or]??=new Map,e[Or]}function o(e,n){let t=Lo(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var Bo=/<\/(script)/gi;function ln(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Bo,"<\\/$1")}import Mr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,zo=500;function $t(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!St.has(t)){if(St.size>=zo){let i=St.keys().next().value;if(i)St.delete(i)}St.set(t,new RegExp(e,n))}return St.get(t)}class Pr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let R=`${t}:${v}`,T=a.get(R);if(!T){if(a.size>=l){let D=a.keys().next().value;if(D)a.delete(D)}T=Function(...n,`
115
+ `+a.slice(c);else a+=l;return a}function Cr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Tt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Cr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Cr(y[1],!1).has(n))return!0;return!1}var Tr="",In,lt=/^[A-Za-z_$][\w$]*$/,Do=new Set(["if","for","while","switch","with"]),Ar=["(","[","{"],Ir=[")","]","}"],Mo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function jo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function cs(e){if(In&&e===Tr)return In;let{code:n,tokens:t}=jo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let M=t[P].text;if(["(","[","{"].includes(M))a.push(P);else if([")","]","}"].includes(M)){let G=a.at(-1);if(G!==void 0&&["()","[]","{}"].includes(t[G].text+M))a.pop(),i.set(G,P),i.set(P,G)}}function l(P,M){let G=[],F=P;for(let L=P;L<M;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??M)<M){L=i.get(L);continue}if(t[L].text===",")G.push([F,L]),F=L+1}return G.push([F,M]),G}let c=[];function y(P,M,G,F=!1){if(t[P]?.text==="...")P++;if(P>=M)return;let L=t[P].text;if(lt.test(L)){if(G.add(L),G===T)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=M)return;for(let[te,ne]of l(P+1,Q)){let ae=te;if(L==="{")for(let me=te;me<ne;me++){if(t[me].text===":"){ae=me+1;break}if(t[me].text==="=")break;if(["(","[","{"].includes(t[me].text)&&i.has(me))me=i.get(me)}y(ae,ne,G,F)}}function v(P,M){let G=new Set;for(let[F,L]of l(P,M))y(F,L,G);return G}function R(P){let M=P;for(;M<t.length;M++){let G=t[M].text;if(["(","[","{"].includes(G)&&i.has(M)){M=i.get(M);continue}if([",",";",")","]","}"].includes(G))break}return t[Math.max(P,M-1)]?.end??n.length}let T=new Set,D=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let M=P-1,G=M,F;if(t[M]?.text===")"&&i.has(M))G=i.get(M),F=v(G+1,M);else if(t[M]&&lt.test(t[M].text))F=new Set([t[M].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:R(L);D.push({start:t[G].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let M=t[P-1]?.text;if(!M||Do.has(M)||!lt.test(M)&&M!=="*"&&M!=="]")continue;let G=i.get(P),F=G+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;D.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:M!=="catch",names:v(P+1,G)})}function N(P){let M=P;for(;M<t.length;M++){let G=t[M].text;if(Ar.includes(G)&&i.has(M)){M=i.get(M);continue}if(G===";"||Ir.includes(G))break;let F=t[M-1];if(M>P&&Mo.has(G)&&F.text!==".")break;if(M>P&&/[\n\r]/.test(n.slice(F.end,t[M].start))&&(/^[\w$]+$/.test(F.text)||Ir.includes(F.text)||['"',"'","`"].includes(F.text))&&lt.test(G)&&!["in","of","instanceof"].includes(G))break}return M}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let M=t[P+1]?.text==="await"?P+2:P+1;if(t[M]?.text!=="("||!i.has(M))continue;let G=i.get(M),F=G+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:M,headEnd:G,start:t[M].start,end:Q})}for(let P=0;P<t.length;P++){let M=t[P].text,G=t[P-1]?.text;if(G==="."||t[P+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(M==="const"||M==="let"||M==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ne=0;for(let ae=P+1;ae<=F;ae++){let me=t[ae]?.text;if(ae<F&&Ar.includes(me)&&i.has(ae)&&i.get(ae)<F){ae=i.get(ae);continue}if(ae<F&&me===":"&&!te)Q=!0;else if(ae<F&&me==="="&&ne===0)Q=!1,te=!0;else if(ae<F&&Q&&me==="<")ne++;else if(ae<F&&Q&&me===">"&&ne>0)ne--;else if(ae===F||me===","&&ne===0)y(L,ae,T,M==="var"),L=ae+1,Q=!1,te=!1}}else if(M==="function"||M==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&&lt.test(t[F].text)&&t[F].text!=="extends")T.add(t[F].text),c.push({name:t[F].text,token:F})}else if(M==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&&lt.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")T.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ne,ae]of l(Q+1,te)){let me=ae-1;while(me>=ne&&!lt.test(t[me].text))me--;if(me>=ne&&t[me].text!=="type")c.push({name:t[me].text,token:me,file:!0})}}}}return Tr=e,In={code:n,scopes:D,loops:j,declarations:T,sites:c,tokens:t,pairs:i},In}function ls(e){let n=cs(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function On(e){return new Set(cs(e).declarations)}function cn(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=cs(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let R=new Set,T=new Map;for(let j of a){if(!n.has(j.name))continue;R.add(j.token);let P=j.file?-1:y[j.token],M=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];M=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)M=[F.start,F.end]}let G=T.get(j.name);if(G)G.push(M);else T.set(j.name,[M])}let D=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&&lt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let M=P+1;M<c.get(P);M++)D.add(M)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||R.has(j)||D.has(j))continue;let M=l[j-1]?.text;if(M==="#"||M==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(M==="{"||M===","))continue;let G=l[j].start;if(T.get(P)?.some(([F,L])=>G>=F&&G<L))continue;if(t.some((F)=>G>=F.start&&G<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.748";var Or=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Lo(){let e=globalThis;return e[Or]??=new Map,e[Or]}function o(e,n){let t=Lo(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var Bo=/<\/(script)/gi;function ln(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Bo,"<\\/$1")}import Mr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var St=new Map,zo=500;function $t(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!St.has(t)){if(St.size>=zo){let i=St.keys().next().value;if(i)St.delete(i)}St.set(t,new RegExp(e,n))}return St.get(t)}class Pr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let R=`${t}:${v}`,T=a.get(R);if(!T){if(a.size>=l){let D=a.keys().next().value;if(D)a.delete(D)}T=Function(...n,`
116
116
  'use strict';
117
117
  try {
118
118
  return ${v};
@@ -193,7 +193,7 @@ else {
193
193
  // STX: auto-generated event bindings
194
194
  ${e.map((t,i)=>da(t,i)).join(`
195
195
  `)}`}function zr(e){let n=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let y=i[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let R=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&R===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){R++,c+=2;continue}if(i[c]==="}"&&R>0){R--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(y==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
196
- `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),R=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let N=R[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=R[0].length;continue}let T=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){T[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),M=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(M&&!M.startsWith("_")&&!t.has(M))n.push(M),t.add(M)}),c+=T[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let N=D[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=D[0].length;continue}}c++}return n}var ga=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function ma(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!ga.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=R.exec(e))!==null)i(l[1]);let T=/@model\s*=\s*["']([^"']*)["']/gi;while((l=T.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Me(e,n={}){let t=e,i="",a=!1,l=[],c=ni(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=ri(c.styles),v=Ot(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:R,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-zeqybrbc.js"));if(R(t))t=await T(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Ic(t);t=Q.code,i=Oc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${mn(t,n.serverData)}${i}`,t=A(t),!a&&Le(n.attrs||""))t=je(t);let D=pa(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
196
+ `)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),R=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(R){let N=R[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=R[0].length;continue}let T=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(T){T[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),M=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(M&&!M.startsWith("_")&&!t.has(M))n.push(M),t.add(M)}),c+=T[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let N=D[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=D[0].length;continue}}c++}return n}var ga=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function ma(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!ga.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let R=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=R.exec(e))!==null)i(l[1]);let T=/@model\s*=\s*["']([^"']*)["']/gi;while((l=T.exec(e))!==null)i(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)i(l[1]);return n}async function Me(e,n={}){let t=e,i="",a=!1,l=[],c=ni(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=ri(c.styles),v=Ot(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:R,bundleClientScript:T}=await o("stx/client-script-bundler",()=>import("./chunk-txbre9zy.js"));if(R(t))t=await T(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Ic(t);t=Q.code,i=Oc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${mn(t,n.serverData)}${i}`,t=A(t),!a&&Le(n.attrs||""))t=je(t);let D=pa(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
197
197
  ${ln(`${i}${t}
198
198
  ${D}`)}
199
199
  </script>`}let M=yi(e),G=/function __stx_setup_/.test(t),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function L(Q){let te=Q.length>0?`
@@ -287,8 +287,8 @@ ${R.join(`
287
287
  `){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")j=!0;else if(P==="]")j=!1;else if(P==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},N=()=>{if(i!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((L)=>{let Q=L.trim().split(":");return Q[Q.length-1].trim()});for(let L of F)if(L&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(L)&&!t.has(L))n.push(L),t.add(L);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let F=P[2];if(!t.has(F))n.push(F),t.add(F);return}let M=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let F=M[1];if(!t.has(F))n.push(F),t.add(F);return}let G=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(G){let F=G[1];if(!t.has(F))n.push(F),t.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&T()){D();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))N();a++}return n}function wl(e){let n=[],t=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function Sl(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function $l(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of wl(y)){let R=v.trim();if(!R||R.startsWith("..."))continue;let T=Sl(R);if(T===-1)continue;let D=R.slice(0,T).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(n[D]!==void 0)continue;let N=R.slice(T+1).trim();if(!N)continue;try{let j=Object.keys(n).filter(Mt),P=Function(...j,`"use strict"; return (${N});`);n[D]=P(...j.map((M)=>n[M]))}catch{}}}catch{}}var vl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Gf(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!vl.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(R,T)=>(a.lastIndex=T,a.exec(R)?.index===T?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let R of l){if(c+=R.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(R.end).trim())return null;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}function co(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function wr(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),y=t.__importedComponents;if(y){for(let ne of[l,l.toLowerCase(),c(l),H(l)])if(y.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${H(l)}.stx`])],R=typeof a.root==="string"?ce.resolve(a.root):void 0,T=R??ce.dirname(i),D=[],N=(ne)=>{if(ne&&!D.includes(ne))D.push(ne)},j=t.__originalFilePath;if(j)N(ce.join(ce.dirname(j),"components"));if(co(n,a))N(a._rootComponentsDir);N(n),N(a._rootComponentsDir),N(ce.join(ce.dirname(i),"components")),N(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])N(ne);let P=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!P)for(let ne of a._targetComponentDirs??[])N(ne);if(R)N(ce.resolve(R,"resources/views/components")),N(ce.resolve(R,"resources/components")),N(ce.resolve(R,"src/components")),N(ce.resolve(R,"components"));for(let ne of a._layerComponentDirs??[])N(ne);let M=a._pluginComponentDirs;if(Array.isArray(M))for(let ne of M)N(typeof ne==="string"?ne:null);if(N(a.fallbackComponentsDir),P)for(let ne of a._targetComponentDirs??[])N(ne);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let G=to(ce.resolve(import.meta.dir,"components")),F=D.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(T,ne)),L=`${v.join("\x00")}\x00\x00${F.join("\x00")}`,Q=qs.get(L);if(Q!==void 0)return Q;let te=!1;e:for(let ne of F){if(to(ne)===G)continue;for(let ae of v)if(await r(ce.join(ne,ae))){te=!0;break e}}return qs.set(L,te),te}function to(e){let n=Xs.get(e);if(n!==void 0)return n;let t=e;try{t=Ys.realpathSync(e)}catch{}return Xs.set(e,t),t}function Xf(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Nc(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function El(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=E(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var no=new Set;function so(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&no.has(a))return;no.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
288
288
  searched:
289
289
  ${t.map((v)=>` - ${v}`).join(`
290
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function ro(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function oi(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Be(e,n,t,i,a,l,c,y=new Set,v,R=tt(a),T,D=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-6xytp0tk.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let M=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let G=M&&M!=="load"&&Xf(M)?M:"";try{let F=(se)=>se.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=D.endsWith(".stx")?D.slice(0,-4):D,Q=null,te=a.__importedComponents;if(te){let se=[L,L.toLowerCase(),F(L),H(L)];for(let le of se)if(te.has(le)){Q=te.get(le);break}}let ne=[];if(!Q){let se=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(se)],_e=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),_e){let be=ce.join(ce.dirname(_e),"components");he.push(be)}let Ve=c._rootComponentsDir;if(typeof Ve==="string"&&co(i,c)&&!he.includes(Ve))he.push(Ve);if(i&&!he.includes(i))he.push(i);if(typeof Ve==="string"&&!he.includes(Ve))he.push(Ve);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ct=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),nt=(T?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Kt=Object.hasOwn(n,"checked")||Boolean(T?.reactiveProps?.includes("checked")),ts=Object.hasOwn(n,"value")||Boolean(T?.reactiveProps?.includes("value")),gt=!nt.includes("valuechange")&&(Kt||nt.includes("change")&&!ts),yt=c._nativeHostAttrs&&/^textinput$/i.test(L),_n=nt.includes("update:value")&&!nt.includes("input"),wn=c._nativeHostAttrs&&/^video$/i.test(L),Sn=Object.hasOwn(n,"src")||Boolean(T?.reactiveProps?.includes("src")),_t=Object.hasOwn(n,"source")||Boolean(T?.reactiveProps?.includes("source")),$n=wn&&Sn&&!_t&&(T?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(T?.reactiveProps?.includes(be)),En=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),Zt=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ct||gt)&&(!yt||_n)&&(!wn||$n)&&!En;for(let be of Zt?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let st=typeof c.root==="string"?ce.resolve(c.root):void 0,$o=st??ce.dirname(l),wt=[];if(st)wt.push(ce.resolve(st,"resources/views/components")),wt.push(ce.resolve(st,"resources/components")),wt.push(ce.resolve(st,"src/components")),wt.push(ce.resolve(st,"components"));wt.push(ce.resolve(import.meta.dir,"components"));for(let be of wt)if(!he.includes(be))he.push(be);let rr=c._pluginComponentDirs;if(Array.isArray(rr)){for(let be of rr)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(Zt){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let ir=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve($o,be)}))];he.length=0,he.push(...ir);let ns=`${L}\x00${l}\x00${ir.join("\x00")}`,ss=Kn.get(ns);if(ss)if(await r(ss))Q=ss;else Kn.delete(ns);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ne.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let kn of le){let Rn=ce.join(be,kn);if(ne.push(Rn),await r(Rn)){Q=Rn;break}}if(Q)break;if(!Q)try{let kn=await import("fs");if(!kn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let vo=8,rs=[{path:be,depth:0}];while(rs.length>0&&!Q){let Cn=rs.pop();if(Cn.depth>=vo)continue;let or;try{or=kn.readdirSync(Cn.path,{withFileTypes:!0})}catch{continue}for(let Tn of or){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let ar=ce.join(Cn.path,Tn.name);for(let Eo of le){let is=ce.join(ar,Eo);if(ne.push(is),await r(is)){Q=is;break}}if(Q)break;rs.push({path:ar,depth:Cn.depth+1})}}}catch{}if(Q)break}if(Q)Kn.set(ns,Q)}if(!Q||!await r(Q))return so(e,l,ne),ro(e);v.add(Q);let ae;if(tn.has(Q))ae=tn.get(Q);else try{ae=await Bun.file(Q).text(),tn.set(Q,ae)}catch(se){let le=se instanceof Error?se.message:String(se);return so(e,l,[Q],le),ro(e)}if(T)for(let se of new Set([...Object.keys(n),...T.reactiveProps??[]])){let le=se.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let _e=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(ae))T.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(ae))T.consumedProps?.add(se)}let me=new Set(["__originalFilePath","__importedComponents",Mn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[se,le]of Object.entries(a))if(!se.startsWith("__")||me.has(se))Ee[se]=le;let Te=R.length>0?{[Wn]:[...R]}:{},ze=t;if(t.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-7hky61eh.js"));ze=await se(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ze)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-y6t6djz7.js"));ze=await se(ze,{...a,__processedComponents:j,...Te},l,c,v)}let $e=[];if(Nc(ze)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-cczxhrbh.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:R.length>0?{...a,...Te}:a;ze=se(ze,le,l);for(let _e of ze.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(_e[1].trim())}let rt=X(ze),ut=[],Ct=rt.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,le)=>{let _e=rt.scripts[Number(le)]||"",he=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ve=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!Ve||["module","text/javascript","application/javascript"].includes(Ve),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ct)return ut.push(_e),"";return _e}),{extractSlotContent:Xn}=await o("stx/slots",()=>import("./chunk-chxhfdpc.js")),ft=Xn(Ct),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[se,le]of ft.namedSlots)dt[se]=le.content;let pt=a.__stx_scope_seq??={n:0,key:Os(String(a.__filename??l))},Dt=ao(e,process.cwd()),it=`stx_${(Dt.endsWith(".stx")?Dt.slice(0,-4):Dt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,We={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Ct,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:xe(ae)||Nc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};$l(ae,We);let jt=ae,sn=de(jt);if(sn)jt=sn.content.trim();let Jn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Lt=[...ae.matchAll(Jn)];for(let[,se,le]of Lt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Ie(le,Q,c.strict);let Ze=[],Bt=null,Gn=Lt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,Je=null,zt=null,rn=0,Wt=null;if(hl(c),Gn&&Js>0){let se=xl({props:n,slot:ze,slotContext:t.trim()?bl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:it});if(se!==null){bt=`${Q}\x00${x(ae)}\x00${se}`;let le=Zn.get(bt);if(le){for(let _e of le.dependencies)v.add(_e);if(qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)_e.add(he);a.__stx_preserved_client_expressions=[..._e]}return le.output}Je=new Set(v),zt=Kr(a),rn=pt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let se of Lt){let le=se[1]||"",_e=se[2]||"",he=le.includes("server");if(Le(le)&&_e.trim())_e=je(_e);if(he&&_e){for(let Ce of Ne(_e))Ft.add(Ce);try{await N(_e,We,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Bt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ce.includes("{{")&&Ce.includes("}}"),nt=Ce.includes("{!!")&&Ce.includes("!!}");if(ct||nt)Ce=ai(Ce,We,Q);let Kt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ze.push(`<script${Kt}>${Ce}</script>`)}}let qe=X(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=qe?qe[1]:"",Yn=qe?qe[2]:"",Ge="",ee=Vt&&/\bscoped\b/i.test(Vt);if(qe)Ge=`<style${Vt}>${El(Yn,We,Q)}</style>`;let re=jt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(se,(_e,he)=>{let Ve=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ve)le.push(`<style${Ve[1]}>${Ve[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)Ge=`${Ge}${le.join(`
291
- `)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-chxhfdpc.js")),{defaultSlot:ye,namedSlots:Re}=ft,Ue=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ct),Ye=c._nativeHostAttrs===!0&&Ze.length>0||Ue&&Ze.length>0||Ze.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),Qn=(se)=>Ye?Ai(se,it):se,es=new Map([...Re].map(([se,le])=>[se,{...le,content:Qn(le.content)}]));re=await ue(re,Qn(ye),es,We,Ye?it:"");let on=oi(Ze),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((se)=>!Ft.has(se));if(on.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete We.__stx_client_signal_names;let Ht=R.filter((se)=>!Ft.has(se)&&!(se in n));if(Ht.length>0)We[Wn]=Ht;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Ye||Ze.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:xn}=await o("stx/process",()=>import("./chunk-2e2yh6t5.js")),Qe=await xn(re,We,Q,an,v),at=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let se of Qe.matchAll(/\{\{([\s\S]*?)\}\}/g))at.add(se[1].trim());if(at.size>0)a.__stx_preserved_client_expressions=[...at];let et=it,Ke=Qe;if(Ye){let se="";if(Object.keys(n).length>0)try{se=` data-stx-props="${Ks(JSON.stringify(n))}"`}catch{}let le=G?` stx-hydrate="${Ks(G)}"`:"",_e=Object.fromEntries(Object.entries(dt).map(([gt,yt])=>[gt,Boolean(yt)])),he=Object.keys(_e).length>0?` data-stx-slots="${Ks(JSON.stringify(_e))}"`:"",Ve=` data-stx-scope="${et}"${se}${he}${le}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Qe),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),nt=Ce?"span":"div",Kt=ct&&c._nativeHostAttrs?' style="display:flex;flex:1;min-height:0;min-width:0"':Ce||ct?' style="display:contents"':"";Ke=Gf(Qe,Ve)??`<${nt}${Ve} data-stx-component-wrapper${Kt}>${Qe}</${nt}>`;let ts=await Promise.all(Ze.map(async(gt)=>{let yt=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return gt;let[,_n,wn]=yt,Sn=Yi(gt,We,Q);if(Sn!==null)return Sn;let _t=await Rl(wn,Q,c.buildMode==="compile"),$n=mn(_t.clientCode,De(We)),{vendorStyleTags:mt}=_t,En=$n?`function(__scopeId) {
290
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function ro(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function oi(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Be(e,n,t,i,a,l,c,y=new Set,v,R=tt(a),T,D=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-7wj8cdzz.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let M=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let G=M&&M!=="load"&&Xf(M)?M:"";try{let F=(se)=>se.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=D.endsWith(".stx")?D.slice(0,-4):D,Q=null,te=a.__importedComponents;if(te){let se=[L,L.toLowerCase(),F(L),H(L)];for(let le of se)if(te.has(le)){Q=te.get(le);break}}let ne=[];if(!Q){let se=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(se)],_e=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),_e){let be=ce.join(ce.dirname(_e),"components");he.push(be)}let Ve=c._rootComponentsDir;if(typeof Ve==="string"&&co(i,c)&&!he.includes(Ve))he.push(Ve);if(i&&!he.includes(i))he.push(i);if(typeof Ve==="string"&&!he.includes(Ve))he.push(Ve);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ct=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),nt=(T?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Kt=Object.hasOwn(n,"checked")||Boolean(T?.reactiveProps?.includes("checked")),ts=Object.hasOwn(n,"value")||Boolean(T?.reactiveProps?.includes("value")),gt=!nt.includes("valuechange")&&(Kt||nt.includes("change")&&!ts),yt=c._nativeHostAttrs&&/^textinput$/i.test(L),_n=nt.includes("update:value")&&!nt.includes("input"),wn=c._nativeHostAttrs&&/^video$/i.test(L),Sn=Object.hasOwn(n,"src")||Boolean(T?.reactiveProps?.includes("src")),_t=Object.hasOwn(n,"source")||Boolean(T?.reactiveProps?.includes("source")),$n=wn&&Sn&&!_t&&(T?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(T?.reactiveProps?.includes(be)),En=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),Zt=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ct||gt)&&(!yt||_n)&&(!wn||$n)&&!En;for(let be of Zt?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let st=typeof c.root==="string"?ce.resolve(c.root):void 0,$o=st??ce.dirname(l),wt=[];if(st)wt.push(ce.resolve(st,"resources/views/components")),wt.push(ce.resolve(st,"resources/components")),wt.push(ce.resolve(st,"src/components")),wt.push(ce.resolve(st,"components"));wt.push(ce.resolve(import.meta.dir,"components"));for(let be of wt)if(!he.includes(be))he.push(be);let rr=c._pluginComponentDirs;if(Array.isArray(rr)){for(let be of rr)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(Zt){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let ir=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve($o,be)}))];he.length=0,he.push(...ir);let ns=`${L}\x00${l}\x00${ir.join("\x00")}`,ss=Kn.get(ns);if(ss)if(await r(ss))Q=ss;else Kn.delete(ns);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ne.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let kn of le){let Rn=ce.join(be,kn);if(ne.push(Rn),await r(Rn)){Q=Rn;break}}if(Q)break;if(!Q)try{let kn=await import("fs");if(!kn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let vo=8,rs=[{path:be,depth:0}];while(rs.length>0&&!Q){let Cn=rs.pop();if(Cn.depth>=vo)continue;let or;try{or=kn.readdirSync(Cn.path,{withFileTypes:!0})}catch{continue}for(let Tn of or){if(!Tn.isDirectory())continue;if(Tn.name==="node_modules"||Tn.name.startsWith("."))continue;let ar=ce.join(Cn.path,Tn.name);for(let Eo of le){let is=ce.join(ar,Eo);if(ne.push(is),await r(is)){Q=is;break}}if(Q)break;rs.push({path:ar,depth:Cn.depth+1})}}}catch{}if(Q)break}if(Q)Kn.set(ns,Q)}if(!Q||!await r(Q))return so(e,l,ne),ro(e);v.add(Q);let ae;if(tn.has(Q))ae=tn.get(Q);else try{ae=await Bun.file(Q).text(),tn.set(Q,ae)}catch(se){let le=se instanceof Error?se.message:String(se);return so(e,l,[Q],le),ro(e)}if(T)for(let se of new Set([...Object.keys(n),...T.reactiveProps??[]])){let le=se.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let _e=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(ae))T.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(ae)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(ae))T.consumedProps?.add(se)}let me=new Set(["__originalFilePath","__importedComponents",Mn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[se,le]of Object.entries(a))if(!se.startsWith("__")||me.has(se))Ee[se]=le;let Te=R.length>0?{[Wn]:[...R]}:{},ze=t;if(t.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-hz56qzj4.js"));ze=await se(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ze)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-vd84rnx9.js"));ze=await se(ze,{...a,__processedComponents:j,...Te},l,c,v)}let $e=[];if(Nc(ze)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-twc23s14.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:R.length>0?{...a,...Te}:a;ze=se(ze,le,l);for(let _e of ze.matchAll(/\{\{([\s\S]*?)\}\}/g))$e.push(_e[1].trim())}let rt=X(ze),ut=[],Ct=rt.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,le)=>{let _e=rt.scripts[Number(le)]||"",he=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ve=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!Ve||["module","text/javascript","application/javascript"].includes(Ve),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ct)return ut.push(_e),"";return _e}),{extractSlotContent:Xn}=await o("stx/slots",()=>import("./chunk-w9564he2.js")),ft=Xn(Ct),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[se,le]of ft.namedSlots)dt[se]=le.content;let pt=a.__stx_scope_seq??={n:0,key:Os(String(a.__filename??l))},Dt=ao(e,process.cwd()),it=`stx_${(Dt.endsWith(".stx")?Dt.slice(0,-4):Dt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,We={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Ct,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:xe(ae)||Nc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...$e]};$l(ae,We);let jt=ae,sn=de(jt);if(sn)jt=sn.content.trim();let Jn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Lt=[...ae.matchAll(Jn)];for(let[,se,le]of Lt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Ie(le,Q,c.strict);let Ze=[],Bt=null,Gn=Lt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,Je=null,zt=null,rn=0,Wt=null;if(hl(c),Gn&&Js>0){let se=xl({props:n,slot:ze,slotContext:t.trim()?bl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...R].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:it});if(se!==null){bt=`${Q}\x00${x(ae)}\x00${se}`;let le=Zn.get(bt);if(le){for(let _e of le.dependencies)v.add(_e);if(qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)_e.add(he);a.__stx_preserved_client_expressions=[..._e]}return le.output}Je=new Set(v),zt=Kr(a),rn=pt.n,Wt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Ft=new Set;for(let se of Lt){let le=se[1]||"",_e=se[2]||"",he=le.includes("server");if(Le(le)&&_e.trim())_e=je(_e);if(he&&_e){for(let Ce of Ne(_e))Ft.add(Ce);try{await N(_e,We,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")Bt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ce.includes("{{")&&Ce.includes("}}"),nt=Ce.includes("{!!")&&Ce.includes("!!}");if(ct||nt)Ce=ai(Ce,We,Q);let Kt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ze.push(`<script${Kt}>${Ce}</script>`)}}let qe=X(ae).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Vt=qe?qe[1]:"",Yn=qe?qe[2]:"",Ge="",ee=Vt&&/\bscoped\b/i.test(Vt);if(qe)Ge=`<style${Vt}>${El(Yn,We,Q)}</style>`;let re=jt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),qe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(se,(_e,he)=>{let Ve=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ve)le.push(`<style${Ve[1]}>${Ve[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)Ge=`${Ge}${le.join(`
291
+ `)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-w9564he2.js")),{defaultSlot:ye,namedSlots:Re}=ft,Ue=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ct),Ye=c._nativeHostAttrs===!0&&Ze.length>0||Ue&&Ze.length>0||Ze.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),Qn=(se)=>Ye?Ai(se,it):se,es=new Map([...Re].map(([se,le])=>[se,{...le,content:Qn(le.content)}]));re=await ue(re,Qn(ye),es,We,Ye?it:"");let on=oi(Ze),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((se)=>!Ft.has(se));if(on.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...on])];else delete We.__stx_client_signal_names;let Ht=R.filter((se)=>!Ft.has(se)&&!(se in n));if(Ht.length>0)We[Wn]=Ht;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||Ye||Ze.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:xn}=await o("stx/process",()=>import("./chunk-njx1b3cd.js")),Qe=await xn(re,We,Q,an,v),at=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let se of Qe.matchAll(/\{\{([\s\S]*?)\}\}/g))at.add(se[1].trim());if(at.size>0)a.__stx_preserved_client_expressions=[...at];let et=it,Ke=Qe;if(Ye){let se="";if(Object.keys(n).length>0)try{se=` data-stx-props="${Ks(JSON.stringify(n))}"`}catch{}let le=G?` stx-hydrate="${Ks(G)}"`:"",_e=Object.fromEntries(Object.entries(dt).map(([gt,yt])=>[gt,Boolean(yt)])),he=Object.keys(_e).length>0?` data-stx-slots="${Ks(JSON.stringify(_e))}"`:"",Ve=` data-stx-scope="${et}"${se}${he}${le}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Qe),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Qe),nt=Ce?"span":"div",Kt=ct&&c._nativeHostAttrs?' style="display:flex;flex:1;min-height:0;min-width:0"':Ce||ct?' style="display:contents"':"";Ke=Gf(Qe,Ve)??`<${nt}${Ve} data-stx-component-wrapper${Kt}>${Qe}</${nt}>`;let ts=await Promise.all(Ze.map(async(gt)=>{let yt=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return gt;let[,_n,wn]=yt,Sn=Yi(gt,We,Q);if(Sn!==null)return Sn;let _t=await Rl(wn,Q,c.buildMode==="compile"),$n=mn(_t.clientCode,De(We)),{vendorStyleTags:mt}=_t,En=$n?`function(__scopeId) {
292
292
  ${$n}
293
293
  return (${_t.factoryBody})(__scopeId);
294
294
  }`:_t.factoryBody,Zt=G?null:hs(a,En),st=Zt?`window.__stxComponentFactories[${JSON.stringify(Zt)}](${JSON.stringify(et)});`:`(${En})(${JSON.stringify(et)});`;if(G)return`${mt}<script type="stx/island" data-stx-island="${et}" data-stx-scoped data-stx-owner="${et}"${_n}>${st}</script>`;return`${mt}<script data-stx-scoped data-stx-run="always" data-stx-owner="${et}"${_n}>${st}</script>`}));if(Ke=Ke+`
@@ -314,7 +314,7 @@ ${Se.yellow}${Se.bold}Message:${Se.reset} ${n}
314
314
  `,y)T+=`
315
315
  ${Se.blue}${Se.bold}Context:${Se.reset}
316
316
  ${Se.dim}${y}${Se.reset}
317
- `;return T}function fe(){tn.clear(),Kn.clear(),qs.clear(),Xs.clear(),Zn.clear()}function wh(){return{size:tn.size,maxSize:500}}var Zs=w(128);async function Rl(e,n,t){let i=x(e,n,t),a=Zs.get(i);if(a){if(Es(a.deps))return a;Zs.delete(i)}let l=ni(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=ri(l.styles);c=Ot(c).code;let{hasUserImports:v,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-zeqybrbc.js")),T=[],D=!1;if(v(c)){let L=c;c=await R(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:T}),D=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-3v3dssk7.js"));c=N(c);let j=A(c),P=_l(j),M=new Set(z(j,!0).split(",").map((L)=>L.trim())),G=`function(__scopeId) {
317
+ `;return T}function fe(){tn.clear(),Kn.clear(),qs.clear(),Xs.clear(),Zn.clear()}function wh(){return{size:tn.size,maxSize:500}}var Zs=w(128);async function Rl(e,n,t){let i=x(e,n,t),a=Zs.get(i);if(a){if(Es(a.deps))return a;Zs.delete(i)}let l=ni(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=ri(l.styles);c=Ot(c).code;let{hasUserImports:v,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-txbre9zy.js")),T=[],D=!1;if(v(c)){let L=c;c=await R(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:T}),D=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-hkn2swbq.js"));c=N(c);let j=A(c),P=_l(j),M=new Set(z(j,!0).split(",").map((L)=>L.trim())),G=`function(__scopeId) {
318
318
  ${ot("const",[...Gc,...P],j)}
319
319
  const __scope = window.stx._scopes = window.stx._scopes || {};
320
320
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Jm,Va,Ym,Ua,df,pf,sn,tr,Zm,ff,gf,Qm,y}from"./chunk-z6kz9jqc.js";import"./chunk-bas06v5y.js";import"./chunk-6ph5jasj.js";import"./chunk-m5a8zgft.js";import"./chunk-nzwcbt98.js";import"./chunk-wpwh529h.js";import"./chunk-zn3c0ew5.js";import"./chunk-27agaezn.js";export{sn as buildCss,ff as extractClassNames,pf as fingerprintConfig,gf as generateCss,Zm as getCachedCSS,Jm as getCssServeAsset,y as injectCss,Va as loadCssEngine,Ua as loadCssEngineConfig,tr as rebuildCss,Ym as resetCssCache,df as resolveUserCssConfig,Qm as withLinkedModuleBundles};
2
+ import{Jm,Va,Ym,Ua,df,pf,sn,tr,Zm,ff,gf,Qm,y}from"./chunk-69y16gf3.js";import"./chunk-0k80h9hw.js";import"./chunk-p8zsnhhe.js";import"./chunk-3eveprd2.js";import"./chunk-nzwcbt98.js";import"./chunk-wpwh529h.js";import"./chunk-zn3c0ew5.js";import"./chunk-27agaezn.js";export{sn as buildCss,ff as extractClassNames,pf as fingerprintConfig,gf as generateCss,Zm as getCachedCSS,Jm as getCssServeAsset,y as injectCss,Va as loadCssEngine,Ua as loadCssEngineConfig,tr as rebuildCss,Ym as resetCssCache,df as resolveUserCssConfig,Qm as withLinkedModuleBundles};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{f,d}from"./chunk-wpwh529h.js";import{J,I,p}from"./chunk-6ph5jasj.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",g=u[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Cl(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Vg(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function El(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(I(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!I(s,r))return e;let a=_(s,o);if(a===void 0)return e;return p(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!f(t))return;return d(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Tl(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,g)=>{let m=o.named.get(u),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=J(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=p(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${p(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await El(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Ug(t){let o=Cl(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Wg(t,o,i,r,e){return await Tl(t,{default:o,named:i},r,e)}
2
+ import{f,d}from"./chunk-wpwh529h.js";import{J,I,p}from"./chunk-p8zsnhhe.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",g=u[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Cl(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Vg(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function El(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(I(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!I(s,r))return e;let a=_(s,o);if(a===void 0)return e;return p(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!f(t))return;return d(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Tl(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,g)=>{let m=o.named.get(u),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=J(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=p(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${p(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await El(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Ug(t){let o=Cl(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Wg(t,o,i,r,e){return await Tl(t,{default:o,named:i},r,e)}
3
3
  export{Cl,Vg,El,Tl,Ug,Wg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{m,ti,Ac,Pc,Hf,Vf,Uf,Wf,qf,Os,Kf,Le,Y,je,Gf,wr,Xf,Nc,oi,Be,r,hn,Dc,h,fe,wh}from"./chunk-6ph5jasj.js";import"./chunk-m5a8zgft.js";import"./chunk-nzwcbt98.js";import"./chunk-wpwh529h.js";import"./chunk-zn3c0ew5.js";import"./chunk-27agaezn.js";export{fe as clearComponentCache,oi as componentClientSignalNames,ti as convertToCommonJS,h as createDetailedErrorMessage,qf as extractDirectiveNames,Ac as extractScriptFromTemplate,m as extractVariables,r as fileExists,wh as getComponentCacheStats,Vf as getPositionInfo,Y as getSharedTranspiler,Dc as getSourceLineInfo,Wf as hasDirectives,Pc as hasVariables,Xf as isHydrateTrigger,Kf as isJavaScriptScript,Be as renderComponentWithSlot,hn as resolveTemplatePath,Gf as scopeOnRootElement,Os as scopeSequenceKey,Le as shouldTranspileTypeScript,Nc as slotContentHasExpressions,je as transpileTypeScript,wr as userComponentFileExists,Uf as validateDirective,Hf as validateTemplate};
2
+ import{m,ti,Ac,Pc,Hf,Vf,Uf,Wf,qf,Os,Kf,Le,Y,je,Gf,wr,Xf,Nc,oi,Be,r,hn,Dc,h,fe,wh}from"./chunk-p8zsnhhe.js";import"./chunk-3eveprd2.js";import"./chunk-nzwcbt98.js";import"./chunk-wpwh529h.js";import"./chunk-zn3c0ew5.js";import"./chunk-27agaezn.js";export{fe as clearComponentCache,oi as componentClientSignalNames,ti as convertToCommonJS,h as createDetailedErrorMessage,qf as extractDirectiveNames,Ac as extractScriptFromTemplate,m as extractVariables,r as fileExists,wh as getComponentCacheStats,Vf as getPositionInfo,Y as getSharedTranspiler,Dc as getSourceLineInfo,Wf as hasDirectives,Pc as hasVariables,Xf as isHydrateTrigger,Kf as isJavaScriptScript,Be as renderComponentWithSlot,hn as resolveTemplatePath,Gf as scopeOnRootElement,Os as scopeSequenceKey,Le as shouldTranspileTypeScript,Nc as slotContentHasExpressions,je as transpileTypeScript,wr as userComponentFileExists,Uf as validateDirective,Hf as validateTemplate};