@stacksjs/stx 0.2.752 → 0.2.753

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 (83) hide show
  1. package/dist/{chunk-9m5a0w1f.js → chunk-1bk3t4s1.js} +3 -3
  2. package/dist/{chunk-jvwhfvae.js → chunk-1mmtkbhf.js} +1 -1
  3. package/dist/{chunk-hj2c5gc0.js → chunk-1sb6z37d.js} +1 -1
  4. package/dist/{chunk-hna49fa0.js → chunk-37j288h1.js} +2 -2
  5. package/dist/{chunk-6h6d4dmp.js → chunk-3h2e5jte.js} +4 -4
  6. package/dist/{chunk-pz9fkc3a.js → chunk-3t737sdr.js} +1 -1
  7. package/dist/{chunk-de1t3bge.js → chunk-3tg9bsbc.js} +1 -1
  8. package/dist/{chunk-jkcj6hec.js → chunk-4jwp2per.js} +1 -1
  9. package/dist/{chunk-42qysase.js → chunk-572rs7vb.js} +1 -1
  10. package/dist/{chunk-dxke9aed.js → chunk-5afjh2ms.js} +1 -1
  11. package/dist/{chunk-74ef2ddd.js → chunk-5cyzd17z.js} +1 -1
  12. package/dist/{chunk-bdkhfz0f.js → chunk-5q1mnc79.js} +1 -1
  13. package/dist/{chunk-nex4xbfm.js → chunk-6z8rdsc6.js} +1 -1
  14. package/dist/chunk-7ygjbxm8.js +2 -0
  15. package/dist/{chunk-sg9qdw1m.js → chunk-80gbx1jn.js} +1 -1
  16. package/dist/{chunk-q35ycczj.js → chunk-8q8202pj.js} +2 -2
  17. package/dist/{chunk-j9q20q5c.js → chunk-8qhw7me1.js} +1 -1
  18. package/dist/{chunk-5e8drz6b.js → chunk-8x3axvek.js} +2 -2
  19. package/dist/{chunk-c73nzqhx.js → chunk-8zr9xhf3.js} +1 -1
  20. package/dist/{chunk-wbje8n06.js → chunk-9b5k0fvr.js} +1 -1
  21. package/dist/{chunk-d58mnfez.js → chunk-9d9rn9qs.js} +6 -6
  22. package/dist/{chunk-z19p6kvm.js → chunk-9mtc6m11.js} +1 -1
  23. package/dist/{chunk-65pcryzp.js → chunk-af1e9spb.js} +1 -1
  24. package/dist/chunk-bn13c7ma.js +2 -0
  25. package/dist/{chunk-pg27jtrb.js → chunk-bymeqhjp.js} +1 -1
  26. package/dist/chunk-cpexmwbs.js +2 -0
  27. package/dist/chunk-cr12w7hv.js +2 -0
  28. package/dist/{chunk-ykdytk2v.js → chunk-ecpr2jsc.js} +1 -1
  29. package/dist/chunk-engy7e5m.js +2 -0
  30. package/dist/chunk-enzptxpw.js +2 -0
  31. package/dist/{chunk-nvbzfd33.js → chunk-fcp5mde5.js} +1 -1
  32. package/dist/{chunk-m8h1pzsm.js → chunk-fedcrvrm.js} +1 -1
  33. package/dist/chunk-fmsrzpb4.js +3 -0
  34. package/dist/chunk-gbve6fgb.js +2 -0
  35. package/dist/{chunk-bq1x6dck.js → chunk-gv6w1j3z.js} +1 -1
  36. package/dist/chunk-h3w9sx7w.js +2 -0
  37. package/dist/{chunk-9n5ka90m.js → chunk-hf0n98x2.js} +1 -1
  38. package/dist/{chunk-5m7nms3h.js → chunk-k4yjbkgb.js} +1 -1
  39. package/dist/{chunk-c9160ee1.js → chunk-kf80wm87.js} +1 -1
  40. package/dist/{chunk-8x2dt9bz.js → chunk-p5hbpmws.js} +1 -1
  41. package/dist/chunk-pe5643ce.js +2 -0
  42. package/dist/{chunk-njs32vff.js → chunk-q82kcwn4.js} +1 -1
  43. package/dist/{chunk-vxzsd20z.js → chunk-qeyjbnpn.js} +4 -4
  44. package/dist/{chunk-5wtzvst5.js → chunk-qmy12s7k.js} +5 -5
  45. package/dist/{chunk-q34hq7ds.js → chunk-rra9xhgg.js} +2 -2
  46. package/dist/chunk-rx71g5z4.js +2 -0
  47. package/dist/{chunk-1jd38rkt.js → chunk-s20j5yns.js} +1 -1
  48. package/dist/{chunk-6821yap6.js → chunk-sva555j3.js} +1 -1
  49. package/dist/{chunk-keac1yzp.js → chunk-tcrxk0mv.js} +3 -3
  50. package/dist/{chunk-fqbrb93b.js → chunk-tg8z1h11.js} +1 -1
  51. package/dist/{chunk-vzs95jbq.js → chunk-th2ej2dz.js} +1 -1
  52. package/dist/{chunk-ad34bp0a.js → chunk-tkp7npcj.js} +1 -1
  53. package/dist/{chunk-q7mp5rpq.js → chunk-va57s6yw.js} +1 -1
  54. package/dist/{chunk-sy6fp5zh.js → chunk-vch68zrs.js} +1 -1
  55. package/dist/{chunk-sbt7npsg.js → chunk-vpzadc7t.js} +2 -2
  56. package/dist/{chunk-ppm3xqmm.js → chunk-wad1w2d2.js} +1 -1
  57. package/dist/{chunk-tn46gth4.js → chunk-we96m579.js} +1 -1
  58. package/dist/{chunk-qxe705x2.js → chunk-wjtn0ywp.js} +1 -1
  59. package/dist/{chunk-4xddf5jj.js → chunk-wzb2g38x.js} +1 -1
  60. package/dist/{chunk-z7ffy766.js → chunk-xe7wyaac.js} +1 -1
  61. package/dist/{chunk-cs0a6b79.js → chunk-y1h6z9cy.js} +1 -1
  62. package/dist/{chunk-gszbqenb.js → chunk-y627cbst.js} +1 -1
  63. package/dist/{chunk-by2f4tbt.js → chunk-zpqqdyb4.js} +5 -5
  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/compiler/headwind-to-style.js +8 -0
  68. package/dist/native/compiler/inline-style.js +8 -0
  69. package/dist/native/compiler/ir.d.ts +1 -0
  70. package/dist/pwa.js +1 -1
  71. package/dist/ssg.js +2 -2
  72. package/package.json +5 -5
  73. package/dist/chunk-19nz5bjv.js +0 -2
  74. package/dist/chunk-1p5a0vw7.js +0 -2
  75. package/dist/chunk-8qtk0ryc.js +0 -2
  76. package/dist/chunk-aa2wtw0x.js +0 -2
  77. package/dist/chunk-bva6fwey.js +0 -3
  78. package/dist/chunk-dc2c3fta.js +0 -2
  79. package/dist/chunk-f51bhqcy.js +0 -2
  80. package/dist/chunk-n3j00c1s.js +0 -2
  81. package/dist/chunk-pcfnwzme.js +0 -2
  82. package/dist/chunk-tez98608.js +0 -2
  83. package/dist/chunk-tkv6rfj1.js +0 -2
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Sn}from"./chunk-5hrm7rtx.js";import{W,S,Pt,It,wr,m,zc,ci,V,E}from"./chunk-d58mnfez.js";import{Yt}from"./chunk-z19p6kvm.js";import{n}from"./chunk-bva6fwey.js";import{K}from"./chunk-4nmb776w.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function N(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var dt="private, no-store";function $n(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function _e(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function M(t){return{Vary:J(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=$n(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=$n(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
- `}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-cs5gf4zp.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function Ji(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function ro(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Yt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-f51bhqcy.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Fr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{Sn}from"./chunk-5hrm7rtx.js";import{W,S,Pt,It,wr,m,zc,ci,V,E}from"./chunk-9d9rn9qs.js";import{Yt}from"./chunk-9mtc6m11.js";import{n}from"./chunk-fmsrzpb4.js";import{K}from"./chunk-4nmb776w.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function N(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var dt="private, no-store";function $n(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function _e(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function M(t){return{Vary:J(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rn(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=$n(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=$n(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
+ `}import P from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-cs5gf4zp.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function Ji(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=P.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function ro(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Yt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-enzptxpw.js"),A=await b(),d={__filename:t,__dirname:P.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Fr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -28,5 +28,5 @@ ${c}
28
28
  `));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
29
29
  `));if(R.length>0)d.push(R.filter((x)=>!u.has(x)).join(`
30
30
  `));return d.push(y),d.join(`
31
- `)}import O from"fs";import H from"path";function Zi(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function Qi(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ea(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function T(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function so(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function B(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!so(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(T(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(T(e,a.value,a))}}return r}function ta(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function An(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Pt(s),c=It(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-gszbqenb.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-19nz5bjv.js"),{defaultConfig:h}=await import("./chunk-65pcryzp.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!ci(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await B(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=wr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!ci(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=E(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?V(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(zc(t.html,i)),context:e,cookies:s.cookies}}
31
+ `)}import O from"fs";import H from"path";function Zi(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function Qi(t,r){let e=H.join(r,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ea(t){let r=H.join(t,"manifest.json");if(!O.existsSync(r))return null;try{let e=O.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function T(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function so(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function B(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!so(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(T(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(T(e,a.value,a))}}return r}function ta(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function An(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Pt(s),c=It(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-y627cbst.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-rx71g5z4.js"),{defaultConfig:h}=await import("./chunk-af1e9spb.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!ci(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await B(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=wr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!ci(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=E(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?V(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(zc(t.html,i)),context:e,cookies:s.cookies}}
32
32
  export{dt,$n,_e,M,Rn,Ji,ro,Fr,Ue,Yi,Ce,Zi,Qi,ea,so,ta,An};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Eo,To,$o,ih,ns,ah}from"./chunk-ad34bp0a.js";export{ns as clearImageDeliveryCatalog,ih as deliveredImage,$o as efficientDeliverySources,Eo as getImageDelivery,To as isTransparentImage,ah as prepareImageDelivery};
2
+ import{Eo,To,$o,ih,ns,ah}from"./chunk-tkp7npcj.js";export{ns as clearImageDeliveryCatalog,ih as deliveredImage,$o as efficientDeliverySources,Eo as getImageDelivery,To as isTransparentImage,ah as prepareImageDelivery};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{k}from"./chunk-d58mnfez.js";import{i}from"./chunk-by2f4tbt.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{k}from"./chunk-9d9rn9qs.js";import{i}from"./chunk-zpqqdyb4.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,c}from"./chunk-5hrm7rtx.js";import{r,yn,h}from"./chunk-d58mnfez.js";import{Qe}from"./chunk-mdsrnd6s.js";import{ms,hs}from"./chunk-c0v9ng82.js";import{lc,Fo,ps,gs}from"./chunk-snfmgp7a.js";import{ic,ac}from"./chunk-cs0a6b79.js";import{vt}from"./chunk-am4wadh7.js";import{cn,mc,fr,gr}from"./chunk-myr79xxf.js";import{g}from"./chunk-0dve54ne.js";import{qs}from"./chunk-5bkha4ej.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Ht}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function nt(e,s={}){let{duration:i,delay:o,ease:n,direction:l,custom:d}={...B,...s};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
2
+ import{t,c}from"./chunk-5hrm7rtx.js";import{r,yn,h}from"./chunk-9d9rn9qs.js";import{Qe}from"./chunk-mdsrnd6s.js";import{ms,hs}from"./chunk-c0v9ng82.js";import{lc,Fo,ps,gs}from"./chunk-snfmgp7a.js";import{ic,ac}from"./chunk-y1h6z9cy.js";import{vt}from"./chunk-am4wadh7.js";import{cn,mc,fr,gr}from"./chunk-myr79xxf.js";import{g}from"./chunk-0dve54ne.js";import{qs}from"./chunk-5bkha4ej.js";import Q from"fs";import N from"path";import{loadConfigWithResult as Ht}from"bunfig";var B={duration:300,delay:0,ease:"ease",direction:"both"};function nt(e,s={}){let{duration:i,delay:o,ease:n,direction:l,custom:d}={...B,...s};if(e==="custom"&&d)return d;switch(e){case"fade":return`${l==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${l==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":l==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1307,6 +1307,6 @@ ${y}
1307
1307
  customElements.define('${s}', ${d});
1308
1308
  `}async function Ze(e,s,i,o){if(s.length<1)return c("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let n=s[0].replace(/['"]/g,""),d=(i.__stx_options||{}).componentsDir||"components",p=q.isAbsolute(d)?[q.join(d,`${n}.stx`),q.join(q.dirname(o),`${n}.stx`)]:[q.join(q.dirname(o),d,`${n}.stx`),q.join(process.cwd(),d,`${n}.stx`),q.join(q.dirname(o),`${n}.stx`)],u=null;for(let f of p)if(await r(f)){u=await Bun.file(f).text();break}if(!u)return c("WebComponent",`Component file not found: ${n}.stx`,t.FILE_NOT_FOUND);let m=Ft(u,n);return`<script type="module">
1309
1309
  ${qt(m)}
1310
- </script>`}var j={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:cn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},ic,ac,ms,hs,De,ke,Ae,Pe,_e,Oe,Fe,$e,...qs],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Ut(e,s,i){let o=s||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),l=N.join(n,"resources","views"),d=N.join(n,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,s){let i=s.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function Ef(e,s){let i=!e.root,o=Ut(e.root,e.pagesDir,s);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${s}::${o.root}`;if(!et.has(n))et.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let n={};for(let l of ue){let d=e[l];if(typeof d==="string"&&d)n[l]=d}Se.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let l of ue){let d=e[l];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Bt(d,n))continue;e[l]=N.join(n,d)}}for(let n of ue){let l=e[n];if(typeof l!=="string"||!l||N.isAbsolute(l))continue;e[n]=N.resolve(s,l)}return e}function Jt(e,s){let i=Se.get(e);for(let o of ue){let n=e[o];if(typeof n!=="string"||!n)continue;let l=N.isAbsolute(n)?n:N.join(s,n);if(Q.existsSync(l))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(mc(e.stateDir),e.stateDir=fr(),e.cachePath=gr(e.cachePath),e.build)e.build.cacheDir=gr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=gr(e.media.cache.directory);if(e.story)e.story.outDir=gr(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function jo(e,s=Ht){try{return await s(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let s=e?N.resolve(e):process.cwd(),i=de.get(s);if(i&&i.signature!==ps(i.graph)){let l=Y.get(s);if(Y.delete(s),de.delete(s),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-bdkhfz0f.js"),{partialsCache:p}=await import("./chunk-m8h1pzsm.js");if(d(),p.clear(),l&&i.configSignature===gs(i.graph)){let u=l.then(async(m)=>{let y={...i.graph};await Fo(y,s),de.set(s,{graph:y,signature:ps(y),configSignature:gs(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(s,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(s);if(o)return o;let n=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(N.join(s,`stx.config${v}`))),p=l.some((v)=>Q.existsSync(N.join(s,"config",`ui${v}`))),u;if(d&&p){let v=await jo({name:"ui",cwd:N.join(s,"config"),defaultConfig:j,errorPolicy:"throw",verbose:!1});u=(await jo({name:"stx",alias:"ui",cwd:s,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await jo({name:"stx",alias:"ui",cwd:s,defaultConfig:j,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await lc(s,j);u=v.config,de.set(s,{graph:v.graph,signature:ps(v.graph),configSignature:gs(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-k83z4nyg.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-ppm3xqmm.js");await b(s,u.runtimeConfig)}Kt(u),Gt(u),Ef(u,s),Jt(u,s);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[s]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-ycxwf633.js"),b=[],x=[];for(let k of f){let S=typeof k==="string"?k:k[0],_=typeof k==="string"?{}:k[1]||{};try{let A,E;try{let w=g.resolve(S,{paths:[s]});A=await import(w),E=N.dirname(w)}catch{let w=N.resolve(s,S);A=await import(w),E=N.dirname(w)}let I=A.default||A;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(N.resolve(E,C))}if(I.pages){let w=N.resolve(E,I.pages),C=_.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(_,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1310
+ </script>`}var j={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:cn,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:Ie,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Ze,hasEndTag:!1,description:"Include a web component in the template"},ic,ac,ms,hs,De,ke,Ae,Pe,_e,Oe,Fe,$e,...qs],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Ut(e,s,i){let o=s||"pages";if(e)return{root:e,pagesDir:o};let n=i||process.cwd(),l=N.join(n,"resources","views"),d=N.join(n,"resources","layouts");if(Q.existsSync(l)&&Q.existsSync(d))return{root:"resources",pagesDir:"views"};let p=N.join(n,"resources","views","pages");if(Q.existsSync(p))return{root:"resources/views",pagesDir:o};return{root:".",pagesDir:o}}var et=new Set,ue=["partialsDir","componentsDir","layoutsDir"],Se=new WeakMap;function Bt(e,s){let i=s.replace(/[\\/]+$/,"");if(!i||i===".")return!0;let o=e.replace(/\\/g,"/"),n=i.replace(/\\/g,"/");return o===n||o.startsWith(`${n}/`)}function Ef(e,s){let i=!e.root,o=Ut(e.root,e.pagesDir,s);if(e.root=o.root,e.pagesDir=o.pagesDir,i&&o.root!=="."){let n=`${s}::${o.root}`;if(!et.has(n))et.add(n),console.warn(`[stx] No "root" in config \u2014 inferred "${o.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Se.has(e)){let n={};for(let l of ue){let d=e[l];if(typeof d==="string"&&d)n[l]=d}Se.set(e,n)}if(e.root&&e.root!=="."){let n=e.root;for(let l of ue){let d=e[l];if(typeof d!=="string"||!d)continue;if(N.isAbsolute(d)||Bt(d,n))continue;e[l]=N.join(n,d)}}for(let n of ue){let l=e[n];if(typeof l!=="string"||!l||N.isAbsolute(l))continue;e[n]=N.resolve(s,l)}return e}function Jt(e,s){let i=Se.get(e);for(let o of ue){let n=e[o];if(typeof n!=="string"||!n)continue;let l=N.isAbsolute(n)?n:N.join(s,n);if(Q.existsSync(l))continue;let d=i?.[o]??n,p=e.root,u=!!p&&p!==".";console.warn(`[stx] ${String(o)} resolves to "${l}", which does not exist. Configured as "${d}"`+(u?`, resolved under root "${p}".`:"."))}}function Kt(e){if(e.customDirectives)e.customDirectives=[...e.customDirectives];if(e.middleware)e.middleware=[...e.middleware];if(e.apiRoutes)e.apiRoutes={...e.apiRoutes}}function Gt(e){if(mc(e.stateDir),e.stateDir=fr(),e.cachePath=gr(e.cachePath),e.build)e.build.cacheDir=gr(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=gr(e.media.cache.directory);if(e.story)e.story.outDir=gr(e.story.outDir)}var K=null,Y=new Map,de=new Map,se=null;async function jo(e,s=Ht){try{return await s(e)}catch(i){if(i instanceof Error&&i.name==="ConfigNotFoundError")return{config:e.defaultConfig};throw i}}async function a(e){let s=e?N.resolve(e):process.cwd(),i=de.get(s);if(i&&i.signature!==ps(i.graph)){let l=Y.get(s);if(Y.delete(s),de.delete(s),!e)K=null,se=null;let{clearComponentCache:d}=await import("./chunk-5q1mnc79.js"),{partialsCache:p}=await import("./chunk-fedcrvrm.js");if(d(),p.clear(),l&&i.configSignature===gs(i.graph)){let u=l.then(async(m)=>{let y={...i.graph};await Fo(y,s),de.set(s,{graph:y,signature:ps(y),configSignature:gs(y)});let f={...m,_layerGraph:y};if(!e)K=f;return f});return Y.set(s,u),u}}if(!e){if(K)return K;if(se)return se}let o=Y.get(s);if(o)return o;let n=(async()=>{let l=[".ts",".js",".mjs",".cjs",".json"],d=l.some((v)=>Q.existsSync(N.join(s,`stx.config${v}`))),p=l.some((v)=>Q.existsSync(N.join(s,"config",`ui${v}`))),u;if(d&&p){let v=await jo({name:"ui",cwd:N.join(s,"config"),defaultConfig:j,errorPolicy:"throw",verbose:!1});u=(await jo({name:"stx",alias:"ui",cwd:s,defaultConfig:v.config,errorPolicy:"throw",verbose:!1})).config}else u=(await jo({name:"stx",alias:"ui",cwd:s,defaultConfig:j,errorPolicy:"throw",verbose:!1})).config;if(u.extends!==void 0||i){let v=await lc(s,j);u=v.config,de.set(s,{graph:v.graph,signature:ps(v.graph),configSignature:gs(v.graph)})}if(u.runtimeConfig){let{resolveRuntimeConfig:v}=await import("./chunk-k83z4nyg.js");v(u.runtimeConfig,{});let{generateRuntimeConfigTypes:b}=await import("./chunk-wad1w2d2.js");await b(s,u.runtimeConfig)}Kt(u),Gt(u),Ef(u,s),Jt(u,s);let m=[],y=new Set((u.plugins??[]).map((v)=>typeof v==="string"?v:v[0]));for(let v of u.componentPackages??["@stacksjs/components"]){let b=`${v}/stx-plugin`;if(y.has(b)||y.has(v))continue;try{g.resolve(b,{paths:[s]}),m.push(b)}catch{}}let f=[...u.plugins??[],...m];if(f.length>0){let{pluginManager:v}=await import("./chunk-ycxwf633.js"),b=[],x=[];for(let k of f){let S=typeof k==="string"?k:k[0],_=typeof k==="string"?{}:k[1]||{};try{let A,E;try{let w=g.resolve(S,{paths:[s]});A=await import(w),E=N.dirname(w)}catch{let w=N.resolve(s,S);A=await import(w),E=N.dirname(w)}let I=A.default||A;if(!v.has(I.name))await v.register(I,u);if(I.components){let w=Array.isArray(I.components)?I.components:[I.components];for(let C of w)b.push(N.resolve(E,C))}if(I.pages){let w=N.resolve(E,I.pages),C=_.path||"/";x.push({dir:w,prefix:C})}if(I.setup){let w={addDirective:(C)=>{u.customDirectives=u.customDirectives||[],u.customDirectives.push(C)},addRoute:(C,D)=>{u.apiRoutes=u.apiRoutes||{},u.apiRoutes[C]=D},addMiddleware:(C)=>{u.middleware=u.middleware||[],u.middleware.push(C)},pluginDir:E,config:u};await I.setup(_,w)}process.stderr.write(`[stx] Plugin loaded: ${I.name||S}
1311
1311
  `)}catch(A){console.warn(`[stx] Failed to load plugin ${S}:`,A.message)}}u._pluginComponentDirs=b,u._pluginPageDirs=x}return u})();if(Y.set(s,n),n.catch(()=>{if(Y.get(s)===n)Y.delete(s)}),!e)se=n,n.then((l)=>{K=l}).catch(()=>{});return n}var P=new Proxy(j,{get(e,s){if(K&&s in K)return K[s];if(!se)a().catch((i)=>{console.warn("[stx] Failed to load config file:",i?.message||i)});return e[s]}});function hh(e){return e}function yh(e){let s=[],i=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")s.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")s.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")s.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")s.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)s.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)s.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let o=["auto","manual","sections"];if(!o.includes(e.streaming.strategy))s.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let o=["json","yaml","yml","js"];if(!o.includes(e.i18n.format))s.push({path:"i18n.format",message:`i18n.format must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)s.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)s.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let o=["AA","AAA"];if(!o.includes(e.a11y.level))s.push({path:"a11y.level",message:`a11y.level must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let o=["progressive","islands"];if(!o.includes(e.hydration.mode))s.push({path:"hydration.mode",message:`hydration.mode must be one of: ${o.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let o=["none","eager","lazy"];if(!o.includes(e.hydration.preload))s.push({path:"hydration.preload",message:`hydration.preload must be one of: ${o.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))s.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")s.push({path:`customDirectives[${n}].name`,message:"Custom directive must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")s.push({path:`customDirectives[${n}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))s.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((o,n)=>{if(!o.name||typeof o.name!=="string")s.push({path:`middleware[${n}].name`,message:"Middleware must have a name string",severity:"error"});if(!o.handler||typeof o.handler!=="function")s.push({path:`middleware[${n}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!o.timing||!["before","after"].includes(o.timing))s.push({path:`middleware[${n}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)i.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)i.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)s.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let o=["fullscreen","standalone","minimal-ui","browser"];if(!o.includes(e.pwa.manifest.display))s.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let o=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!o.includes(e.pwa.manifest.orientation))s.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.routes){let o=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((n,l)=>{if(!n.pattern||typeof n.pattern!=="string")s.push({path:`pwa.routes[${l}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!o.includes(n.strategy))s.push({path:`pwa.routes[${l}].strategy`,message:`PWA route strategy must be one of: ${o.join(", ")}`,severity:"error"});if(n.maxAgeSeconds!==void 0&&(typeof n.maxAgeSeconds!=="number"||n.maxAgeSeconds<0))s.push({path:`pwa.routes[${l}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(n.maxEntries!==void 0&&(typeof n.maxEntries!=="number"||n.maxEntries<1))s.push({path:`pwa.routes[${l}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))s.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((n)=>typeof n!=="number"||n<16||n>1024).length>0)s.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let o=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((l)=>!o.includes(l)).length>0)s.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${o.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)i.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)i.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:s.length===0,errors:s,warnings:i}}
1312
1312
  export{ec,tc,lr,Ye,nc,ds,j,Ef,jo,a,P,hh,yh};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{u,f,R,d,q}from"./chunk-5hrm7rtx.js";import{z,Ss,U,Ie,de,vr,Le,je,r,h,xe,k}from"./chunk-d58mnfez.js";import{ot}from"./chunk-kyk4ekng.js";import{A}from"./chunk-89h4snzd.js";import{se}from"./chunk-tary163t.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{T,kn}from"./chunk-4nmb776w.js";import C from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let b=a[i];if(b==="("||b==="["||b==="{")c++;else if(b===")"||b==="]"||b==="}")c--;else if(b===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,b=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=b.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),b.lastIndex=g+N.length,s=b.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,b=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
2
+ import{u,f,R,d,q}from"./chunk-5hrm7rtx.js";import{z,Ss,U,Ie,de,vr,Le,je,r,h,xe,k}from"./chunk-9d9rn9qs.js";import{ot}from"./chunk-kyk4ekng.js";import{A}from"./chunk-89h4snzd.js";import{se}from"./chunk-tary163t.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{T,kn}from"./chunk-4nmb776w.js";import C from"path";import{existsSync as St}from"fs";function at(a,t){let c=0;for(let i=t;i<a.length;i++){let b=a[i];if(b==="("||b==="["||b==="{")c++;else if(b===")"||b==="]"||b==="}")c--;else if(b===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,b=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=b.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),b.lastIndex=g+N.length,s=b.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,b=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
3
3
  `)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<g-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},rt=()=>{if(b!==0)return;let N=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let H=N[2];if(!i.has(H))c.push(H),i.add(H);return}let et=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let H=et[1];if(!i.has(H))c.push(H),i.add(H);return}let Y=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!i.has(H))c.push(H),i.add(H)}};while(s<g){if(Z())continue;if(t[s]==="'"||t[s]==='"'){e(t[s]);continue}if(t[s]==="`"){D();continue}if(t[s]==="{"){b++,s++;continue}if(t[s]==="}"){b--,s++;continue}if(b===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))rt();s++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
4
4
  (function() {
5
5
  ${ot("var",c)}
@@ -44,10 +44,10 @@ ${s}
44
44
  }
45
45
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
46
46
  }
47
- })();`;return c+a+i}function It(a,t){if(L(a)){let b=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(b)return{html:a,mergedIntoExisting:b[1],stamped:!0,root:"body"};return{html:Xe(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],b=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:b};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:b}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function sh(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function wf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],b=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){b=Math.max(0,b-1);continue}if(b===0)i.push(D);if(!Z)b++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ge=new U(500),Ga=new Set;function oh(){Ga.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return Ga}async function Qr(a,t,c,i,b,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,v,x)=>{let p=v.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),v});{let m=/@includeIf\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")")n--;_++}if(n!==0)break;let l=e.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=_;continue}let O=o[1],P=Z(O,g,c),E="";if(P&&await Bun.file(P).exists())b.add(P),E=`@include(${l})`;e=e.substring(0,x)+E+e.substring(_),m.lastIndex=0}}for(let[m,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,_=n+p[0].length-1,l=1,o=_+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(_+1,o-1),P=at(O,0);if(P===-1){x.lastIndex=o;continue}let E=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let w=W[1],J=V.substring(W[0].length),B,I=at(J,0);if(I!==-1)B=J.substring(I+1).trim();try{let M=`Boolean(${E})`,j;if(f(M)){let it=d(M,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(M,t));let tt=v?!j:j,nt="";if(tt){let it=Z(w,g,c);if(it&&await Bun.file(it).exists())b.add(it);nt=`@include('${w}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(M){let j=M instanceof Error?M.message:String(M),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,E,V,W]=O;try{let w,J=E.trim();if(f(J))w=d(J,Object.keys(t))(...Object.values(t));else w=u(J,t);let B="";if(Array.isArray(w)&&w.length>0)for(let I of w){let M={...t,[V]:I},j=await et(P,M,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(_+1),m.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(_+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],E=l.slice(O[0].length),V,W=E.match(/^\s*,\s*\{/);if(W){E=E.slice(W[0].length-1);let B=1,I=1;while(I<E.length&&B>0){if(E[I]==="{")B++;else if(E[I]==="}"){if(B--,B===0)break}I++}V=E.substring(0,I+1),E=E.slice(I+1)}let w,J=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),I={};if(V)try{I=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>w||"");continue}let M=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,I,a,x);e=e.replace(o,()=>nt),M=!0;break}}if(!M)if(w!==void 0)e=e.replace(o,()=>w);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let I=B instanceof Error?B.message:String(B),M=h("Include",`Error processing @includeFirst: ${I}`,c,a,x,o);e=e.replace(o,()=>M)}m.lastIndex=0}}function Z(m,v,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(v),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let w=C.resolve(W,p);if(w.startsWith(`${C.resolve(W)}${C.sep}`)&&St(w))return w}l=C.resolve(v,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(_+C.sep)||o===_,E=!1,V=C.dirname(_);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))E=!0}if(!O&&!P&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,v,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:v,partialsDir:g}),h("Include",v,c,x,p)}async function et(m,v={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let _=C.resolve(n);if(s.has(_)){let l=[...s,_].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{b.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(y){let K=y instanceof Error?y.message:String(y);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-gszbqenb.js");l=y(l,t)}if(l&&(i.debug||!T()&&!kn()))try{let{warnUnbalancedTags:y}=await import("./chunk-6jtjhx7w.js");y(l,n)}catch{}try{let{processESImports:y}=await import("./chunk-9n5ka90m.js");l=await y(l,t,n,i,b)}catch(y){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,y instanceof Error?y.message:y)}let o=l,O=de(o);if(O)o=O.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,K,S)=>{if(!ft(K))return"";return W.push({attrs:K,body:S}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...t};w.__stx_signals_gate=xe(l,n);for(let[y,K]of Object.entries(v))w[y]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((y,K)=>{let S=(y[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(S)}),I="",M=null,j=!1,tt=!1;for(let y of B){let K=y[1]||"",S=y[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=Le(K);if(!X&&!/\bsrc\s*=/i.test(K))Ie(S,n,i.strict);if(!X&&S.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-vzs95jbq.js");S=F(S,w,m)}let ct="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-bq1x6dck.js"),st=F(S,{filePath:n,projectRoot:process.cwd()});S=st.code,ct=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&S.trim())S=je(S);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-bq1x6dck.js");S=Q(S).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-z7ffy766.js");if(st(S))S=await bt(S,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-pg27jtrb.js");S=F(S)}let dt=$t(S);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-bq1x6dck.js"),st=Q(S,F(w));if(st)S=`${st}
47
+ })();`;return c+a+i}function It(a,t){if(L(a)){let b=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(b)return{html:a,mergedIntoExisting:b[1],stamped:!0,root:"body"};return{html:Xe(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],b=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:b};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:b}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function sh(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function wf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],b=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){b=Math.max(0,b-1);continue}if(b===0)i.push(D);if(!Z)b++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Ge=new U(500),Ga=new Set;function oh(){Ga.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return Ga}async function Qr(a,t,c,i,b,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,v,x)=>{let p=v.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),v});{let m=/@includeIf\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")")n--;_++}if(n!==0)break;let l=e.substring(p+1,_-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=_;continue}let O=o[1],P=Z(O,g,c),E="";if(P&&await Bun.file(P).exists())b.add(P),E=`@include(${l})`;e=e.substring(0,x)+E+e.substring(_),m.lastIndex=0}}for(let[m,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,_=n+p[0].length-1,l=1,o=_+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(_+1,o-1),P=at(O,0);if(P===-1){x.lastIndex=o;continue}let E=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let w=W[1],J=V.substring(W[0].length),B,I=at(J,0);if(I!==-1)B=J.substring(I+1).trim();try{let M=`Boolean(${E})`,j;if(f(M)){let it=d(M,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(M,t));let tt=v?!j:j,nt="";if(tt){let it=Z(w,g,c);if(it&&await Bun.file(it).exists())b.add(it);nt=`@include('${w}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(M){let j=M instanceof Error?M.message:String(M),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,E,V,W]=O;try{let w,J=E.trim();if(f(J))w=d(J,Object.keys(t))(...Object.values(t));else w=u(J,t);let B="";if(Array.isArray(w)&&w.length>0)for(let I of w){let M={...t,[V]:I},j=await et(P,M,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(_+1),m.lastIndex=0}catch(w){let J=w instanceof Error?w.message:String(w);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(_+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,v;while((v=m.exec(e))!==null){let x=v.index,p=x+v[0].length-1,n=1,_=p+1;while(_<e.length&&n>0){if(e[_]==="(")n++;else if(e[_]===")"){if(n--,n===0)break}_++}if(n!==0)break;let l=e.substring(p+1,_),o=e.substring(x,_+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],E=l.slice(O[0].length),V,W=E.match(/^\s*,\s*\{/);if(W){E=E.slice(W[0].length-1);let B=1,I=1;while(I<E.length&&B>0){if(E[I]==="{")B++;else if(E[I]==="}"){if(B--,B===0)break}I++}V=E.substring(0,I+1),E=E.slice(I+1)}let w,J=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)w=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),I={};if(V)try{I=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>w||"");continue}let M=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,I,a,x);e=e.replace(o,()=>nt),M=!0;break}}if(!M)if(w!==void 0)e=e.replace(o,()=>w);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let I=B instanceof Error?B.message:String(B),M=h("Include",`Error processing @includeFirst: ${I}`,c,a,x,o);e=e.replace(o,()=>M)}m.lastIndex=0}}function Z(m,v,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(v),_=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let w=C.resolve(W,p);if(w.startsWith(`${C.resolve(W)}${C.sep}`)&&St(w))return w}l=C.resolve(v,p)}else l=C.resolve(_,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(_+C.sep)||o===_,E=!1,V=C.dirname(_);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))E=!0}if(!O&&!P&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${_}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,v,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:v,partialsDir:g}),h("Include",v,c,x,p)}async function et(m,v={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let _=C.resolve(n);if(s.has(_)){let l=[...s,_].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{b.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(y){let K=y instanceof Error?y.message:String(y);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:y}=await import("./chunk-y627cbst.js");l=y(l,t)}if(l&&(i.debug||!T()&&!kn()))try{let{warnUnbalancedTags:y}=await import("./chunk-6jtjhx7w.js");y(l,n)}catch{}try{let{processESImports:y}=await import("./chunk-hf0n98x2.js");l=await y(l,t,n,i,b)}catch(y){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,y instanceof Error?y.message:y)}let o=l,O=de(o);if(O)o=O.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(E)V=`<style${E[1]}>${E[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(y,K,S)=>{if(!ft(K))return"";return W.push({attrs:K,body:S}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let w={...t};w.__stx_signals_gate=xe(l,n);for(let[y,K]of Object.entries(v))w[y]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((y,K)=>{let S=(y[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(S)}),I="",M=null,j=!1,tt=!1;for(let y of B){let K=y[1]||"",S=y[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=Le(K);if(!X&&!/\bsrc\s*=/i.test(K))Ie(S,n,i.strict);if(!X&&S.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-th2ej2dz.js");S=F(S,w,m)}let ct="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-gv6w1j3z.js"),st=F(S,{filePath:n,projectRoot:process.cwd()});S=st.code,ct=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&S.trim())S=je(S);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-gv6w1j3z.js");S=Q(S).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-xe7wyaac.js");if(st(S))S=await bt(S,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-bymeqhjp.js");S=F(S)}let dt=$t(S);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-gv6w1j3z.js"),st=Q(S,F(w));if(st)S=`${st}
48
48
  ${S}`}if(dt&&!X){j=!0,M=ut(n,t);let F=A(S),Q=gt(F,M);I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}">${Q}</script>
49
- `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-njs32vff.js");await F(S,w,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();M=ut(n,t);let Q=A(S),st=gt(Q,M);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}"${F?` ${F}`:""}>${st}</script>
50
- `}}if(W.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-vzs95jbq.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,S)=>{let X=W[Number(S)];return`<script${X.attrs}>${y(X.body,w,m)}</script>`})}if(M){let y=It(o,M);if(o=y.html,y.mergedIntoExisting){let S=M,X=y.mergedIntoExisting;I=I.split(`'${S}'`).join(`'${X}'`).split(`"${S}"`).join(`"${X}"`),M=X}else if(!y.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(y.stamped&&y.root!=="body"&&(j||tt)&&!pt.has(n)){let S=wf(o);if(S.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=y.stamped&&y.root!==null&&vr(y.root);I=Rt(I,K?M:null)}if(o.includes("@include")||o.includes("@partial"))o=await Qr(o,w,n,i,b,s);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-aa2wtw0x.js"),G=nt(o,w,n,void 0,!0);G=se(G,w,n),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-vyznvnew.js");if(G=ht(G,w,n,i),G=_t(G,w,n),G=xt(G,w,n,i),G=k(G,w,n),V)G+=`
49
+ `;continue}if(X)try{let{extractVariables:F}=await import("./chunk-q82kcwn4.js");await F(S,w,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();M=ut(n,t);let Q=A(S),st=gt(Q,M);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;I+=`${ct}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}"${F?` ${F}`:""}>${st}</script>
50
+ `}}if(W.length>0){let{interpolateScriptExpressions:y}=await import("./chunk-th2ej2dz.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,S)=>{let X=W[Number(S)];return`<script${X.attrs}>${y(X.body,w,m)}</script>`})}if(M){let y=It(o,M);if(o=y.html,y.mergedIntoExisting){let S=M,X=y.mergedIntoExisting;I=I.split(`'${S}'`).join(`'${X}'`).split(`"${S}"`).join(`"${X}"`),M=X}else if(!y.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(y.stamped&&y.root!=="body"&&(j||tt)&&!pt.has(n)){let S=wf(o);if(S.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${S.length} top-level elements (${S.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=y.stamped&&y.root!==null&&vr(y.root);I=Rt(I,K?M:null)}if(o.includes("@include")||o.includes("@partial"))o=await Qr(o,w,n,i,b,s);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-cr12w7hv.js"),G=nt(o,w,n,void 0,!0);G=se(G,w,n),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-vyznvnew.js");if(G=ht(G,w,n,i),G=_t(G,w,n),G=xt(G,w,n,i),G=k(G,w,n),V)G+=`
51
51
  `+V;if(I)G+=`
52
52
  `+I;return G}catch(l){if(l instanceof q)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(e))!==null){let m=H.index,v=m+H[0].length-1,x=1,p=v+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let n=e.substring(m,p),_=e.substring(v+1,p-1),l=_.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,P=_.substring(l[0].length),E=at(P,0);if(E!==-1)O=P.substring(E+1).trim();let V={};if(O)try{V=R(O,t)}catch(w){let J=w instanceof Error?w.message:String(w);e=e.replace(n,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let W=await et(o,V,a,m);e=e.substring(0,m)+W+e.substring(p),Y.lastIndex=0}return e}function es(a,t){let c=a;function i(b,s,g,e){let D=b,Z=!0;while(Z){Z=!1;let rt=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),N=D.match(rt);if(!N||N.index===void 0)break;let et=N.index,Y=N[1],H=et+N[0].length,m=new RegExp(`@${s}\\(`),v=new RegExp(`@${g}(?![a-z])`),x=1,p=H,n=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(v),P=o?p+o.index:1/0,E=O?p+O.index:1/0;if(P<E)x++,p=P+(o[0].length||1);else if(E<1/0){if(x--,x===0){n=E;break}p=E+g.length+1}else break}if(n===-1)break;let _=D.slice(H,n);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(_);else t[Y].push(_);D=D.substring(0,et)+D.substring(n+`@${g}`.length),Z=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function ts(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
53
53
  `)})}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ia,ql,jn,Zg,Kl,Gl,Xl,Qg}from"./chunk-sg9qdw1m.js";import"./chunk-d58mnfez.js";import"./chunk-nvbzfd33.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{jn as Validator,ql as defineForm,Kl as processErrorDirective,Gl as processErrorsDirective,Qg as processFormValidationDirectives,Xl as processHasErrorsDirective,ia as useForm,Zg as v};
2
+ import{ia,ql,jn,Zg,Kl,Gl,Xl,Qg}from"./chunk-80gbx1jn.js";import"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{jn as Validator,ql as defineForm,Kl as processErrorDirective,Gl as processErrorsDirective,Qg as processFormValidationDirectives,Xl as processHasErrorsDirective,ia as useForm,Zg as v};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Kr}from"./chunk-srjhnk6w.js";import{S}from"./chunk-d58mnfez.js";import{a}from"./chunk-hna49fa0.js";import{We,re}from"./chunk-ftk2jdg8.js";import{ja}from"./chunk-sbt7npsg.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var eu=`
2
+ import{Kr}from"./chunk-srjhnk6w.js";import{S}from"./chunk-9d9rn9qs.js";import{a}from"./chunk-37j288h1.js";import{We,re}from"./chunk-ftk2jdg8.js";import{ja}from"./chunk-vpzadc7t.js";import{L}from"./chunk-f4gqzg1y.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var eu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Wg}from"./chunk-fqbrb93b.js";import"./chunk-hna49fa0.js";import"./chunk-cs0a6b79.js";import"./chunk-qeh8f4bk.js";import"./chunk-snfmgp7a.js";import"./chunk-c0v9ng82.js";import"./chunk-mdsrnd6s.js";import"./chunk-d58mnfez.js";import"./chunk-nvbzfd33.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{Wg as buildApp};
2
+ import{Wg}from"./chunk-tg8z1h11.js";import"./chunk-37j288h1.js";import"./chunk-y1h6z9cy.js";import"./chunk-qeh8f4bk.js";import"./chunk-snfmgp7a.js";import"./chunk-c0v9ng82.js";import"./chunk-mdsrnd6s.js";import"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{Wg as buildApp};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_}from"./chunk-kyk4ekng.js";import{A,_n}from"./chunk-89h4snzd.js";import{C,Y}from"./chunk-d58mnfez.js";import{a}from"./chunk-hna49fa0.js";import{Te,en,tn,nn}from"./chunk-sy6fp5zh.js";import{yt}from"./chunk-q35ycczj.js";import{ft,Bn,Kt,ce}from"./chunk-kb8654dp.js";import{T,Rr}from"./chunk-4nmb776w.js";import p from"path";var c=new Map;function v(i,n){for(let s of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of i.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(s[1]??"").split(",")){let l=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of i.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(s[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Mm(i){let n;if(i)n=p.resolve(i);else{let t=await a();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${tn()}`,o=new Bun.Glob("*.ts"),r=[];try{for await(let t of o.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return ce(c,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>Te(t))])],f=ft(l()),d=Kt(c,s,f);if(d!==void 0)return d||null;if(r.length===0)return ce(c,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let b=u.map((t)=>t.file),m=[],g=new Set,x=Y({loader:"ts",target:"browser",define:C()});for(let t of b)try{let e=await Bun.file(t).text(),y=p.basename(t,".ts");if(v(e,g),en(e))e=await nn(e,t,{projectRoot:process.cwd(),externalizeUserModules:T()});e=yt(e),e=A(e),e=_n(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=x.transformSync(e),m.push(`// Store: ${y}
2
+ import{_}from"./chunk-kyk4ekng.js";import{A,_n}from"./chunk-89h4snzd.js";import{C,Y}from"./chunk-9d9rn9qs.js";import{a}from"./chunk-37j288h1.js";import{Te,en,tn,nn}from"./chunk-vch68zrs.js";import{yt}from"./chunk-8q8202pj.js";import{ft,Bn,Kt,ce}from"./chunk-kb8654dp.js";import{T,Rr}from"./chunk-4nmb776w.js";import p from"path";var c=new Map;function v(i,n){for(let s of i.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(s[1])n.add(s[1]);for(let s of i.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let o of(s[1]??"").split(",")){let l=((o.includes(":")?o.split(":").pop():o)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(l))n.add(l)}for(let s of i.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let o of(s[1]??"").split(",")){let r=o.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(r))n.add(r)}}async function Mm(i){let n;if(i)n=p.resolve(i);else{let t=await a();n=p.resolve(t.root||process.cwd(),t.storesDir||"stores")}let s=`${n}\x00${tn()}`,o=new Bun.Glob("*.ts"),r=[];try{for await(let t of o.scan({cwd:n,absolute:!0})){let e=p.basename(t,".ts");if(["index","types"].includes(e))continue;if(t.includes(".d.ts"))continue;r.push(t)}}catch{return ce(c,s,"",""),null}let l=()=>[...new Set([...r,...r.flatMap((t)=>Te(t))])],f=ft(l()),d=Kt(c,s,f);if(d!==void 0)return d||null;if(r.length===0)return ce(c,s,f,""),null;let u=[];for(let t of r){let e=await Bun.file(t).text();u.push({file:t,hasUseStore:/useStore\s*\(/.test(e)})}u.sort((t,e)=>{if(t.hasUseStore===e.hasUseStore)return 0;return t.hasUseStore?1:-1});let b=u.map((t)=>t.file),m=[],g=new Set,x=Y({loader:"ts",target:"browser",define:C()});for(let t of b)try{let e=await Bun.file(t).text(),y=p.basename(t,".ts");if(v(e,g),en(e))e=await nn(e,t,{projectRoot:process.cwd(),externalizeUserModules:T()});e=yt(e),e=A(e),e=_n(e),e=e.replace(/^export\s+(default\s+)?/gm,""),e=x.transformSync(e),m.push(`// Store: ${y}
3
3
  ${e.trim()}`)}catch(e){console.warn(`[stx] Failed to load store ${t}:`,e)}if(m.length===0)return ce(c,s,f,""),null;let S=m.join(`
4
4
 
5
5
  `),h=`;(function(){
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-kyk4ekng.js";import"./chunk-89h4snzd.js";import{w,x,C,Y}from"./chunk-d58mnfez.js";import"./chunk-5hrm7rtx.js";import"./chunk-r6s35xw9.js";import"./chunk-nvbzfd33.js";import f from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=w(64),S=new Set,k=0,R=new Set(b);function T(){l.clear(),h.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=h.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(S.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-kyk4ekng.js";import"./chunk-89h4snzd.js";import{w,x,C,Y}from"./chunk-9d9rn9qs.js";import"./chunk-5hrm7rtx.js";import"./chunk-r6s35xw9.js";import"./chunk-fcp5mde5.js";import f from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=w(64),S=new Set,k=0,R=new Set(b);function T(){l.clear(),h.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=h.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(S.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$l,Kg,Rl,Al,Gg,Xg}from"./chunk-j9q20q5c.js";import"./chunk-d58mnfez.js";import"./chunk-nvbzfd33.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{Xg as applySlots,Gg as extractSlotContent,Kg as parseSlotElement,$l as parseSlots,Al as processSlots,Rl as renderSlot};
2
+ import{$l,Kg,Rl,Al,Gg,Xg}from"./chunk-8qhw7me1.js";import"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{Xg as applySlots,Gg as extractSlotContent,Kg as parseSlotElement,$l as parseSlots,Al as processSlots,Rl as renderSlot};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{m,ri,Oc,Nc,qf,Kf,Gf,Xf,Jf,Ns,Yf,Le,Y,je,Zf,xr,Qf,Lc,ai,Be,r,yn,jc,h,fe,_h}from"./chunk-d58mnfez.js";import"./chunk-nvbzfd33.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{fe as clearComponentCache,ai as componentClientSignalNames,ri as convertToCommonJS,h as createDetailedErrorMessage,Jf as extractDirectiveNames,Oc as extractScriptFromTemplate,m as extractVariables,r as fileExists,_h as getComponentCacheStats,Kf as getPositionInfo,Y as getSharedTranspiler,jc as getSourceLineInfo,Xf as hasDirectives,Nc as hasVariables,Qf as isHydrateTrigger,Yf as isJavaScriptScript,Be as renderComponentWithSlot,yn as resolveTemplatePath,Zf as scopeOnRootElement,Ns as scopeSequenceKey,Le as shouldTranspileTypeScript,Lc as slotContentHasExpressions,je as transpileTypeScript,xr as userComponentFileExists,Gf as validateDirective,qf as validateTemplate};
2
+ import{m,ri,Oc,Nc,qf,Kf,Gf,Xf,Jf,Ns,Yf,Le,Y,je,Zf,xr,Qf,Lc,ai,Be,r,yn,jc,h,fe,_h}from"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{fe as clearComponentCache,ai as componentClientSignalNames,ri as convertToCommonJS,h as createDetailedErrorMessage,Jf as extractDirectiveNames,Oc as extractScriptFromTemplate,m as extractVariables,r as fileExists,_h as getComponentCacheStats,Kf as getPositionInfo,Y as getSharedTranspiler,jc as getSourceLineInfo,Xf as hasDirectives,Nc as hasVariables,Qf as isHydrateTrigger,Yf as isJavaScriptScript,Be as renderComponentWithSlot,yn as resolveTemplatePath,Zf as scopeOnRootElement,Ns as scopeSequenceKey,Le as shouldTranspileTypeScript,Lc as slotContentHasExpressions,je as transpileTypeScript,xr as userComponentFileExists,Gf as validateDirective,qf as validateTemplate};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{U}from"./chunk-d58mnfez.js";import{Fe,O,Dt}from"./chunk-r6s35xw9.js";import{dt,_e,M,Ce,ea,so,ta,An}from"./chunk-9m5a0w1f.js";import{wt,ue,Ze}from"./chunk-mdsrnd6s.js";import{xo}from"./chunk-qxe705x2.js";import{Pn}from"./chunk-amwxbvdp.js";import{ye}from"./chunk-vxzsd20z.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import H from"zlib";import{promisify as Q}from"util";var K=Q(H.brotliCompress),ee=Q(H.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,V=new Map,z=0;function ie(t,e){if(e.length>Y/8)return;V.set(t,e),z+=e.length;for(let[o,r]of V){if(z<=Y)break;V.delete(o),z-=r.length}}async function En(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=V.get(g);if(!l)l=r==="br"?await K(a,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new U(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",M(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${_e(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",M(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let A=await x;return A?l(A):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cg(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=ea(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Pn(r.routeRules),f=new G,h=xo(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?O(l):void 0,v=new Map,_=new Map,x=new Map,A=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Dt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Ze(i.html)),A.set(n.pattern,ye(i.html));let j=T.join(e,n.fragmentPath);if(await Bun.file(j).exists()){let P=await Bun.file(j).text();_.set(n.pattern,m?Dt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=ue(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return En(n,await Fe(m??O(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),B=pe[R]||"application/octet-stream",X=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=_e(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,B)=>{q[R]=c[B+1]});break}}if(!C){let p=wt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=a(i),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=_.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...A.has(C.pattern)?{"X-STX-Runtime":A.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...M(),...N.cache?{}:{"Cache-Control":dt}}})}}let d=so(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...M(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:B,cookies:X,status:F,headers:I}=await An(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return ta(B,X,I);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:D}=await import("./chunk-gszbqenb.js"),L=new Headers({...M(),...I,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(P&&!d){let k=Ze(c);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",ye(c)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return D(S(P&&!d?Ce(c,r.routerContainer||"main",!0):c,R,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...M(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,D]of Object.entries(I??{}))w.set(S,D);if(w.set("Vary",M(w.get("Vary")).Vary),P&&!d){let S=Ze(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",ye(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Ce(c,r.routerContainer||"main",!0),{status:F??u.status??200,headers:w})}return new Response(c,{status:F??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
2
+ import{U}from"./chunk-9d9rn9qs.js";import{Fe,O,Dt}from"./chunk-r6s35xw9.js";import{dt,_e,M,Ce,ea,so,ta,An}from"./chunk-1bk3t4s1.js";import{wt,ue,Ze}from"./chunk-mdsrnd6s.js";import{xo}from"./chunk-wjtn0ywp.js";import{Pn}from"./chunk-amwxbvdp.js";import{ye}from"./chunk-qeyjbnpn.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import H from"zlib";import{promisify as Q}from"util";var K=Q(H.brotliCompress),ee=Q(H.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,V=new Map,z=0;function ie(t,e){if(e.length>Y/8)return;V.set(t,e),z+=e.length;for(let[o,r]of V){if(z<=Y)break;V.delete(o),z-=r.length}}async function En(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=V.get(g);if(!l)l=r==="br"?await K(a,{params:{[H.constants.BROTLI_PARAM_QUALITY]:h,[H.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new U(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",M(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${_e(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",M(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let A=await x;return A?l(A):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Cg(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=ea(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=Pn(r.routeRules),f=new G,h=xo(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?O(l):void 0,v=new Map,_=new Map,x=new Map,A=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Dt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Ze(i.html)),A.set(n.pattern,ye(i.html));let j=T.join(e,n.fragmentPath);if(await Bun.file(j).exists()){let P=await Bun.file(j).text();_.set(n.pattern,m?Dt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=ue(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return En(n,await Fe(m??O(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),B=pe[R]||"application/octet-stream",X=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=_e(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,B)=>{q[R]=c[B+1]});break}}if(!C){let p=wt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=a(i),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=_.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...A.has(C.pattern)?{"X-STX-Runtime":A.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...M(),...N.cache?{}:{"Cache-Control":dt}}})}}let d=so(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...M(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:B,cookies:X,status:F,headers:I}=await An(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return ta(B,X,I);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:D}=await import("./chunk-y627cbst.js"),L=new Headers({...M(),...I,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(P&&!d){let k=Ze(c);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",ye(c)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return D(S(P&&!d?Ce(c,r.routerContainer||"main",!0):c,R,{timeoutMs:30000}),{status:F??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...M(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,D]of Object.entries(I??{}))w.set(S,D);if(w.set("Vary",M(w.get("Vary")).Vary),P&&!d){let S=Ze(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",ye(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Ce(c,r.routerContainer||"main",!0),{status:F??u.status??200,headers:w})}return new Response(c,{status:F??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
3
  export{En,Cg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Og}from"./chunk-s20j5yns.js";import"./chunk-1bk3t4s1.js";import"./chunk-hnzfzm0k.js";import"./chunk-9mtc6m11.js";import"./chunk-wjtn0ywp.js";import"./chunk-zpqqdyb4.js";import"./chunk-8x3axvek.js";import"./chunk-02c0zcaw.js";import"./chunk-k4yjbkgb.js";import"./chunk-3h2e5jte.js";import"./chunk-tkp7npcj.js";import"./chunk-fmsrzpb4.js";import"./chunk-tary163t.js";import"./chunk-8q8202pj.js";import"./chunk-qeyjbnpn.js";import"./chunk-5s8bt976.js";import"./chunk-we96m579.js";import"./chunk-37j288h1.js";import"./chunk-y1h6z9cy.js";import"./chunk-qeh8f4bk.js";import"./chunk-snfmgp7a.js";import"./chunk-c0v9ng82.js";import"./chunk-mdsrnd6s.js";import"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{Og as buildForProduction};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{k}from"./chunk-d58mnfez.js";import{le}from"./chunk-rzqd4t77.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ia(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var ql=ia;class jn{rules=[];defaultValue="";addRule(e){let t=new jn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new jn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new jn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Zg=new jn;function Kl(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
2
+ import{k}from"./chunk-9d9rn9qs.js";import{le}from"./chunk-rzqd4t77.js";function g(e,t){let r={};for(let n of e)r[n]=le(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=le(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function ia(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=le(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var ql=ia;class jn{rules=[];defaultValue="";addRule(e){let t=new jn;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new jn;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new jn;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var Zg=new jn;function Kl(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
3
3
  `)}catch{return""}})}function Gl(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>k(c,{...t,message:l},r)).join(`
4
4
  `)}catch{return""}})}function Xl(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function Qg(e,t,r){let n=e;return n=Kl(n,t,r),n=Gl(n,t,r),n=Xl(n,t,r),n}export{ia,ql,jn,Zg,Kl,Gl,Xl,Qg};
@@ -1,8 +1,8 @@
1
1
  // @bun
2
- import{ot,Qc}from"./chunk-kyk4ekng.js";import{A}from"./chunk-89h4snzd.js";import{z,ks,o,un,W,S,bc,Ot,hn,Le,je}from"./chunk-d58mnfez.js";import{ir}from"./chunk-vxzsd20z.js";import{L}from"./chunk-f4gqzg1y.js";import{an}from"./chunk-5s8bt976.js";var D=`(?:"[^"]*"|'[^']*'|[^>"'])*`,q=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,J=65536,K=4,M=new Map;function ch(){M.clear()}function Y(e){let i=[];for(let n of S(e,W)){let t=n.token.match(/^<script\b([^>]*)>/i),s=n.token.match(/<\/script\s*>$/i);if(!t||!s)continue;let a=t[0].length,f=n.token.length-s[0].length;i.push(Object.freeze({fullMatch:n.token,attrs:t[1],body:n.token.slice(a,f),start:n.start,end:n.end}))}return i}function ss(e,i={}){let n=e.length>=J,t=n?M.get(e):void 0;if(t===void 0){if(t=Y(e),n)bc(M,K),M.set(e,t)}let s=i.skipAttrs;if(!s)return t.slice();let a=[];for(let f of t)if(s.lastIndex=0,!s.test(f.attrs))a.push(f);return a}function Io(e){let i=e.trim(),n=i.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(n){let s=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:c}=F(a);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:c}}let t=i.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(t){let s=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:c}=F(s);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:c}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function F(e){let i=e.trim(),n=i.match(/^(\w+)\s*=>\s*(\w+)$/);if(n)return{itemVar:n[2],indexVar:n[1]};let t=i.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(t)return{itemVar:t[1],indexVar:t[2]||null};let s=i.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let a=i.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function os(e,i){return Qc(e,i)}function ee(e){let i=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,n=0,t;while((t=i.exec(e))!==null){let s=t[1];if(s.startsWith("if"))n++;else if(s==="endif")n--;else if(n===0)return!0}return!1}function sr(e){let i=new Set,n=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=n.exec(e))!==null){let a=s[1],f;while((f=t.exec(a))!==null)i.add(f[1])}return i}function te(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let i=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${D})>`,"iy"),n=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,t=S(e,(a,f)=>{i.lastIndex=f;let c=i.exec(a);if(!c||c.index!==f||!n.test(c[2]))return-1;return i.lastIndex}),s=[];for(let a of t){i.lastIndex=0;let f=i.exec(a.token);if(!f)continue;let c=f[2].match(n),p=Io(c?.[1]??c?.[2]??""),h=[p.itemVar,p.indexVar].filter(Boolean);if(h.length===0)continue;let r=f[1],g=/\/\s*>$/.test(a.token)||P.has(r.toLowerCase())?a.end:Z(e,a.start,r,a.end);if(g!==-1)s.push({start:a.start,end:g,vars:new Set(h)})}return s}var U=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function ne(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function G(e,i,n,t){if(!e)return!1;let s=ne(e),a=!1,f=!1,c=!1,p=/([a-zA-Z_$][\w$]*)/g,h;while((h=p.exec(s))!==null){let l=h[1];if(s.slice(0,h.index).trimEnd().endsWith("."))continue;if(U.has(l))continue;if(i.has(l)||t?.has(l))a=!0;else if(n&&l in n)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,u;while((u=r.exec(s))!==null){let l=u[1];if(s.slice(0,u.index).trimEnd().endsWith("."))continue;if(U.has(l)||n&&l in n)continue;c=!0}return(a||c)&&!f}function O(e,i,n){let t=n===void 0?` ${i}`:` ${i}="${n.replace(/"/g,"&quot;")}"`,s=e.trim(),a=s.match(q);if(a&&se(a[3],a[1])){let[,f,c,p]=a;return`<${f}${c}${t}>${p}</${f}>`}return`<template${t}>${s}</template>`}function se(e,i){let n=new RegExp(`<(/)?${i}(?=[\\s/>])`,"gi"),t=0,s;while((s=n.exec(e))!==null)if(s[1]){if(t--,t<0)return!1}else t++;return!0}function Oo(e,i){let n=sr(e);function t(s){let a=s,f=te(s),c=(u)=>{let g=new Set;for(let l of f)if(u>l.start&&u<l.end)for(let d of l.vars)g.add(d);return g},p=/@if\s*\(/g,h,r=[];while((h=p.exec(a))!==null){let u=h.index,g=u+h[0].length,l=1,d=g;while(d<a.length&&l>0){if(a[d]==="(")l++;else if(a[d]===")")l--;d++}if(l!==0)continue;let b=a.substring(g,d-1).trim(),w=d,E=1,y=w,m=/@(if\s*\(|endif)/g;m.lastIndex=w;let x;while((x=m.exec(a))!==null)if(x[1].startsWith("if"))E++;else if(x[1]==="endif"){if(E--,E===0){y=x.index+x[0].length;break}}if(E!==0)continue;let R=a.substring(w,y-6).trim(),v;if(ee(R)){let I=an(a.substring(u,y));if(I.length===0)continue;let k=I[0].branches.filter((C)=>C.type!=="else"),V=c(u);if(!(k.length>0&&k.every((C)=>G(C.condition,n,i,V))))continue;v=I[0].branches.map((C)=>{let N=t(C.content);if(C.type==="elseif")return O(N,"@else-if",C.condition??"");if(C.type==="else")return O(N,"@else");return O(N,"@if",C.condition??"")}).join(`
2
+ import{ot,Qc}from"./chunk-kyk4ekng.js";import{A}from"./chunk-89h4snzd.js";import{z,ks,o,un,W,S,bc,Ot,hn,Le,je}from"./chunk-9d9rn9qs.js";import{ir}from"./chunk-qeyjbnpn.js";import{L}from"./chunk-f4gqzg1y.js";import{an}from"./chunk-5s8bt976.js";var D=`(?:"[^"]*"|'[^']*'|[^>"'])*`,q=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,J=65536,K=4,M=new Map;function ch(){M.clear()}function Y(e){let i=[];for(let n of S(e,W)){let t=n.token.match(/^<script\b([^>]*)>/i),s=n.token.match(/<\/script\s*>$/i);if(!t||!s)continue;let a=t[0].length,f=n.token.length-s[0].length;i.push(Object.freeze({fullMatch:n.token,attrs:t[1],body:n.token.slice(a,f),start:n.start,end:n.end}))}return i}function ss(e,i={}){let n=e.length>=J,t=n?M.get(e):void 0;if(t===void 0){if(t=Y(e),n)bc(M,K),M.set(e,t)}let s=i.skipAttrs;if(!s)return t.slice();let a=[];for(let f of t)if(s.lastIndex=0,!s.test(f.attrs))a.push(f);return a}function Io(e){let i=e.trim(),n=i.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(n){let s=n[1].trim(),a=n[2].trim(),{itemVar:f,indexVar:c}=F(a);if(f)return{style:"as",iterable:s,itemVar:f,indexVar:c}}let t=i.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(t){let s=t[1].trim(),a=t[2].trim(),{itemVar:f,indexVar:c}=F(s);if(f)return{style:"in",iterable:a,itemVar:f,indexVar:c}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function F(e){let i=e.trim(),n=i.match(/^(\w+)\s*=>\s*(\w+)$/);if(n)return{itemVar:n[2],indexVar:n[1]};let t=i.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(t)return{itemVar:t[1],indexVar:t[2]||null};let s=i.match(/^(\w+)\s*,\s*(\w+)$/);if(s)return{itemVar:s[1],indexVar:s[2]};let a=i.match(/^(\w+)$/);if(a)return{itemVar:a[1],indexVar:null};return{itemVar:null,indexVar:null}}function os(e,i){return Qc(e,i)}function ee(e){let i=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,n=0,t;while((t=i.exec(e))!==null){let s=t[1];if(s.startsWith("if"))n++;else if(s==="endif")n--;else if(n===0)return!0}return!1}function sr(e){let i=new Set,n=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,s;while((s=n.exec(e))!==null){let a=s[1],f;while((f=t.exec(a))!==null)i.add(f[1])}return i}function te(e){if(!/[:@]for\s*=/.test(e)&&!/\bx-for\s*=/.test(e))return[];let i=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${D})>`,"iy"),n=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,t=S(e,(a,f)=>{i.lastIndex=f;let c=i.exec(a);if(!c||c.index!==f||!n.test(c[2]))return-1;return i.lastIndex}),s=[];for(let a of t){i.lastIndex=0;let f=i.exec(a.token);if(!f)continue;let c=f[2].match(n),p=Io(c?.[1]??c?.[2]??""),h=[p.itemVar,p.indexVar].filter(Boolean);if(h.length===0)continue;let r=f[1],g=/\/\s*>$/.test(a.token)||P.has(r.toLowerCase())?a.end:Z(e,a.start,r,a.end);if(g!==-1)s.push({start:a.start,end:g,vars:new Set(h)})}return s}var U=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function ne(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function G(e,i,n,t){if(!e)return!1;let s=ne(e),a=!1,f=!1,c=!1,p=/([a-zA-Z_$][\w$]*)/g,h;while((h=p.exec(s))!==null){let l=h[1];if(s.slice(0,h.index).trimEnd().endsWith("."))continue;if(U.has(l))continue;if(i.has(l)||t?.has(l))a=!0;else if(n&&l in n)f=!0}let r=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,u;while((u=r.exec(s))!==null){let l=u[1];if(s.slice(0,u.index).trimEnd().endsWith("."))continue;if(U.has(l)||n&&l in n)continue;c=!0}return(a||c)&&!f}function O(e,i,n){let t=n===void 0?` ${i}`:` ${i}="${n.replace(/"/g,"&quot;")}"`,s=e.trim(),a=s.match(q);if(a&&se(a[3],a[1])){let[,f,c,p]=a;return`<${f}${c}${t}>${p}</${f}>`}return`<template${t}>${s}</template>`}function se(e,i){let n=new RegExp(`<(/)?${i}(?=[\\s/>])`,"gi"),t=0,s;while((s=n.exec(e))!==null)if(s[1]){if(t--,t<0)return!1}else t++;return!0}function Oo(e,i){let n=sr(e);function t(s){let a=s,f=te(s),c=(u)=>{let g=new Set;for(let l of f)if(u>l.start&&u<l.end)for(let d of l.vars)g.add(d);return g},p=/@if\s*\(/g,h,r=[];while((h=p.exec(a))!==null){let u=h.index,g=u+h[0].length,l=1,d=g;while(d<a.length&&l>0){if(a[d]==="(")l++;else if(a[d]===")")l--;d++}if(l!==0)continue;let b=a.substring(g,d-1).trim(),w=d,E=1,y=w,m=/@(if\s*\(|endif)/g;m.lastIndex=w;let x;while((x=m.exec(a))!==null)if(x[1].startsWith("if"))E++;else if(x[1]==="endif"){if(E--,E===0){y=x.index+x[0].length;break}}if(E!==0)continue;let R=a.substring(w,y-6).trim(),v;if(ee(R)){let I=an(a.substring(u,y));if(I.length===0)continue;let k=I[0].branches.filter((C)=>C.type!=="else"),V=c(u);if(!(k.length>0&&k.every((C)=>G(C.condition,n,i,V))))continue;v=I[0].branches.map((C)=>{let N=t(C.content);if(C.type==="elseif")return O(N,"@else-if",C.condition??"");if(C.type==="else")return O(N,"@else");return O(N,"@if",C.condition??"")}).join(`
3
3
  `)}else{if(!G(b,n,i,c(u)))continue;v=O(t(R),"@if",b)}r.push({start:u,end:y,replacement:v}),p.lastIndex=y}for(let u=r.length-1;u>=0;u--){let{start:g,end:l,replacement:d}=r[u];a=a.substring(0,g)+d+a.substring(l)}return a}return t(e)}function re(e){let i=e.trim();if(i==="")return;if(i==="true")return!0;if(i==="false")return!1;if(i==="null")return!1;if(i==="undefined")return!1;if(i==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(i)){let s=Number(i);return s!==0&&!Number.isNaN(s)}let n=i.match(/^'((?:\\.|[^'\\])*)'$/);if(n)return n[1].length>0;let t=i.match(/^"((?:\\.|[^"\\])*)"$/);if(t)return t[1].length>0;return}var P=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),X=/<(script|style)\b/iy,ie=/<\/script/gi,oe=/<\/style/gi;function Z(e,i,n,t){if(P.has(n.toLowerCase()))return t;let s=n.toLowerCase(),a=e.length,f=1,c=t;while(c<a){let p=e.indexOf("<",c);if(p===-1)return-1;if(c=p,e.startsWith("<!--",c)){let g=e.indexOf("-->",c+4);if(g===-1)return-1;c=g+3;continue}X.lastIndex=c;let h=X.exec(e);if(h){let g=e.indexOf(">",c);if(g===-1)return-1;if(e[g-1]==="/"){c=g+1;continue}let l=h[1].toLowerCase()==="script"?ie:oe;l.lastIndex=c;let d=l.exec(e);if(d===null)return-1;let b=e.indexOf(">",d.index);if(b===-1)return-1;c=b+1;continue}if(e[c+1]==="/"){let g=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(c,c+64));if(!g){c++;continue}if(g[1].toLowerCase()===s){if(f--,c+=g[0].length,f===0)return c;continue}c+=g[0].length;continue}let r=/^<([a-z][\w-]*)\b/i.exec(e.slice(c,c+64));if(!r){c++;continue}let u=e.indexOf(">",c);if(u===-1)return-1;if(r[1].toLowerCase()===s){let g=e.slice(c,u+1);if(!(/\/\s*>$/.test(g)||P.has(s)))f++}c=u+1}return-1}var ce=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function ae(e,i){let n=i,t=e.length;for(;;){while(n<t&&e[n]!=="<")n++;if(n>=t)return!1;if(e.startsWith("<!--",n)){let f=e.indexOf("-->",n+4);if(f===-1)return!1;n=f+3;continue}break}if(e[n+1]==="/")return!1;let s=e.indexOf(">",n);if(s===-1)return!1;let a=e.slice(n,s+1);return ce.test(a)}function No(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let i=[],n=/<([a-zA-Z][\w-]*)/y,t=/\s/,s=new Set([":if",":show","x-if","x-show","@if","@show"]);S(e,(r,u)=>{n.lastIndex=u;let g=n.exec(r);if(!g||/^(?:script|style)$/i.test(g[1]))return-1;let l=n.lastIndex,d;while(l<r.length){let b=l;while(l<r.length&&t.test(r[l]))l++;let w=l;if(r[w]==="/"){w++;while(w<r.length&&t.test(r[w]))w++}if(r[w]===">"){if(d)i.push({start:u,end:w+1,tag:g[1],...d});return-1}if(l===b)return-1;let E=l;while(l<r.length&&!t.test(r[l])&&r[l]!=="="&&r[l]!==">")l++;if(l===E)return-1;let y=r.slice(E,l);if(y.startsWith("@")&&y.includes("("))return-1;let m=l,x=l;while(x<r.length&&t.test(r[x]))x++;if(r[x]!=="="){l=m;continue}x++;while(x<r.length&&t.test(r[x]))x++;let R=r[x];if(R==='"'||R==="'"){let v=r.indexOf(R,x+1);if(v===-1)return-1;if(!d&&R==='"'&&s.has(y))d={attrName:y,attrStart:b,attrEnd:v+1,value:r.slice(x+1,v)};l=v+1}else{l=x;while(l<r.length&&!t.test(r[l])&&r[l]!==">")l++}}return-1});let a=[],f=-1;for(let r of i){let{start:u,end:g,tag:l,attrName:d,value:b}=r;if(u<f)continue;let w=re(b);if(w===void 0)continue;let m=/\/\s*>$/.test(e.slice(u,g))||P.has(l.toLowerCase())?g:Z(e,u,l,g);if(m===-1)continue;if((d===":if"||d==="x-if"||d==="@if")&&ae(e,m))continue;if(w===!0){let R=e.slice(u,r.attrStart)+e.slice(r.attrEnd,g);a.push({start:u,end:g,replacement:R});continue}a.push({start:u,end:m,replacement:""}),f=m}if(a.length===0)return e;a.sort((r,u)=>r.start-u.start);let c=[],p=-1;for(let r of a){if(r.start<p)continue;c.push(r),p=r.end}let h=e;for(let r=c.length-1;r>=0;r--){let{start:u,end:g,replacement:l}=c[r];h=h.substring(0,u)+l+h.substring(g)}return h}var H=[":for","@for","x-for"];function is(e,i){if(!i||Object.keys(i).length===0)return e;if(!H.some((c)=>e.includes(`${c}=`)))return e;let n=sr(e);if(Array.isArray(i.__stx_client_signal_names)){for(let c of i.__stx_client_signal_names)if(typeof c==="string")n.add(c)}let t=e,s=[],a=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,f;while((f=a.exec(t))!==null){let[c,p,h]=f,r=f.index,u=r+c.length,g=H.map((v)=>({attr:v,m:new RegExp(`\\s${v}="([^"]*)"`).exec(h)})).find((v)=>v.m!==null);if(!g||!g.m)continue;let l=Io(g.m[1]);if(!l.iterable||!l.itemVar)continue;let d=l.iterable.trim().split(/[.[(]/)[0].trim();if(!d||n.has(d)||!(d in i))continue;let b=Z(t,r,p,u);if(b===-1)continue;let w=h.replace(new RegExp(`\\s${g.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),E=t.slice(u,b-`</${p}>`.length),y={...i,[l.itemVar]:void 0};if(l.indexVar)y[l.indexVar]=void 0;let m=is(E,y),x=l.indexVar?`${l.iterable} as ${l.indexVar} => ${l.itemVar}`:`${l.iterable} as ${l.itemVar}`,R=p.toLowerCase()==="template"?m:`<${p}${w}>${m}</${p}>`;s.push({start:r,end:b,replacement:`@foreach(${x})${R}@endforeach`}),a.lastIndex=b}for(let c=s.length-1;c>=0;c--){let{start:p,end:h,replacement:r}=s[c];t=t.slice(0,p)+r+t.slice(h)}return t}function as(e,i){let n=e,t=/@(for|foreach)\s*\(/g,s,a=[],f=[];while((s=t.exec(n))!==null){let c=s[1],p=s.index,h=p+s[0].length,r=1,u=h;while(u<n.length&&r>0){if(n[u]==="(")r++;else if(n[u]===")")r--;u++}if(r!==0)continue;let g=n.substring(h,u-1).trim(),l=u,d=Io(g),b=c==="for"?"@endfor":"@endforeach",w=1,E=l,y=c==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${c}\\s*\\(|end${c})`,"g");y.lastIndex=l;let m;while((m=y.exec(n))!==null)if(m[1].startsWith(c))w++;else if(w--,w===0){E=m.index+m[0].length;break}if(w!==0)continue;let x=()=>{let _=[d.itemVar,d.indexVar].filter(Boolean);if(_.length)f.push({start:p,end:E,vars:_})};if(d.iterable){let _=d.iterable.trim();if(_.startsWith("[")||_.startsWith("{")||_.startsWith("'")||_.startsWith('"')||_.startsWith("`")||/^-?\d/.test(_)){x();continue}let T=_.split(/[.[(]/)[0].trim(),C=i?T in i:!1,N=f.some((j)=>p>j.start&&p<j.end&&j.vars.includes(T));if(T&&(C||N)){x();continue}}if(d.style==="as")g=d.indexVar?`(${d.itemVar}, ${d.indexVar}) in ${d.iterable}`:`${d.itemVar} in ${d.iterable}`;let R=n.substring(l,E-b.length).trim(),v=i?{...i}:{};if(d.itemVar)delete v[d.itemVar];if(d.indexVar)delete v[d.indexVar];let I=as(R,v),k=I.match(q),V;if(k){let[,_,T,C]=k;V=`<${_}${T} @for="${g}">${C}</${_}>`}else V=`<template @for="${g}">${I}</template>`;a.push({start:p,end:E,replacement:V}),t.lastIndex=E}for(let c=a.length-1;c>=0;c--){let{start:p,end:h,replacement:r}=a[c];n=n.substring(0,p)+r+n.substring(h)}return n}function le(e){let i=new Set,n=[],t=0,s=0,a=e.length,f=(r)=>{let u=t+1;while(u<a){let g=e[u];if(g==="\\"){u+=2;continue}if(g===r)return u+1;u++}return a},c=()=>{let r=t+2;while(r<a&&e[r]!==`
4
4
  `)r++;return r},p=()=>{let r=t+2;while(r<a-1){if(e[r]==="*"&&e[r+1]==="/")return r+2;r++}return a},h=(r)=>{let u=r,g=0;while(u<a){let l=e[u];if(l==="/"&&e[u+1]==="/"){let d=u+2;while(d<a&&e[d]!==`
5
- `)d++;u=d;continue}if(l==="/"&&e[u+1]==="*"){let d=u+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;u=d+2;continue}if(l==='"'||l==="'"||l==="`"){let d=u+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===l){d++;break}d++}u=d;continue}if(l==="("||l==="["||l==="{"){g++,u++;continue}if(l===")"||l==="]"||l==="}"){g--,u++;continue}if(l===";"&&g===0)return u+1;u++}return a};while(t<a){let r=e[t];if(r==="/"&&e[t+1]==="/"){let u=c();n.push(e.slice(t,u)),t=u;continue}if(r==="/"&&e[t+1]==="*"){let u=p();n.push(e.slice(t,u)),t=u;continue}if(r==='"'||r==="'"||r==="`"){let u=f(r);n.push(e.slice(t,u)),t=u;continue}if(r==="{"){s++,n.push(r),t++;continue}if(r==="}"){s--,n.push(r),t++;continue}if(s===0){let u=t>0?e[t-1]:"";if(u===""||/\s/.test(u)||u===";"||u==="}"||u==="{"){let l=e.slice(t).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(l){let d=l[2],b=h(t+l[0].length);if(i.has(d)){n.push(`/* stx: deduped const ${d} */`),t=b;continue}i.add(d),n.push(e.slice(t,b)),t=b;continue}}}n.push(r),t++}return n.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function B(e,i,n){for(let t of n){if(t.start>=i)return!1;if(t.end>e)return!0}return!1}function fe(e,i,n){let t=0;while(t<e.length){let s=e.indexOf(i,t);if(s===-1)return!1;if(!B(s,s+i.length,n))return!0;t=s+i.length}return!1}function de(e,i){if(fe(e,"<body",i)){let s=new RegExp(`<body(${D})>`,"g"),a;while((a=s.exec(e))!==null)if(!B(a.index,a.index+a[0].length,i))return a.index+a[0].length-1;return null}let n=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D})>`,"gi"),t;while((t=n.exec(e))!==null){if(B(t.index,t.index+t[0].length,i))continue;if(ue.has(t[1].toLowerCase()))continue;return t.index+t[0].length-1}return null}function ge(e,i,n,t){let s=[],a=` data-stx="${t}"`,f=0,c=!1,p=(h)=>{if(n!==null&&!c&&n>=f&&n<=h)s.push(e.slice(f,n),a,e.slice(n,h)),c=!0;else s.push(e.slice(f,h))};for(let h of i){if(h.start<f)continue;p(h.start),f=h.end}return p(e.length),s.join("")}async function cs(e,i,n,t={}){let s=ss(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:c,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-z7ffy766.js"));for(let m of s){let x=m.body;if(Le(m.attrs))x=je(x);if(t.forceClientSetup||a.test(x)){f.push({content:x,start:m.start,end:m.end});continue}if(!c(x))continue;try{let R=await p(Ot(x).code,i||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(R))f.push({content:x,start:m.start,end:m.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let h=`${i??""}\x00${f.map((m)=>m.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(h).toString(36).slice(0,10)}`,u=[];for(let m=0;m<f.length;m++){let x=f[m].bundled??Ot(f[m].content).code;if(!f[m].bundled&&c(x))x=await p(x,i||"",{projectRoot:process.cwd()});x=yt(x);let R=A(x);u.push(`// \u2500\u2500 merged signal script #${m+1} \u2500\u2500
5
+ `)d++;u=d;continue}if(l==="/"&&e[u+1]==="*"){let d=u+2;while(d<a-1&&!(e[d]==="*"&&e[d+1]==="/"))d++;u=d+2;continue}if(l==='"'||l==="'"||l==="`"){let d=u+1;while(d<a){if(e[d]==="\\"){d+=2;continue}if(e[d]===l){d++;break}d++}u=d;continue}if(l==="("||l==="["||l==="{"){g++,u++;continue}if(l===")"||l==="]"||l==="}"){g--,u++;continue}if(l===";"&&g===0)return u+1;u++}return a};while(t<a){let r=e[t];if(r==="/"&&e[t+1]==="/"){let u=c();n.push(e.slice(t,u)),t=u;continue}if(r==="/"&&e[t+1]==="*"){let u=p();n.push(e.slice(t,u)),t=u;continue}if(r==='"'||r==="'"||r==="`"){let u=f(r);n.push(e.slice(t,u)),t=u;continue}if(r==="{"){s++,n.push(r),t++;continue}if(r==="}"){s--,n.push(r),t++;continue}if(s===0){let u=t>0?e[t-1]:"";if(u===""||/\s/.test(u)||u===";"||u==="}"||u==="{"){let l=e.slice(t).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(l){let d=l[2],b=h(t+l[0].length);if(i.has(d)){n.push(`/* stx: deduped const ${d} */`),t=b;continue}i.add(d),n.push(e.slice(t,b)),t=b;continue}}}n.push(r),t++}return n.join("")}var ue=new Set(["script","style","html","head","meta","link","title","!doctype"]);function B(e,i,n){for(let t of n){if(t.start>=i)return!1;if(t.end>e)return!0}return!1}function fe(e,i,n){let t=0;while(t<e.length){let s=e.indexOf(i,t);if(s===-1)return!1;if(!B(s,s+i.length,n))return!0;t=s+i.length}return!1}function de(e,i){if(fe(e,"<body",i)){let s=new RegExp(`<body(${D})>`,"g"),a;while((a=s.exec(e))!==null)if(!B(a.index,a.index+a[0].length,i))return a.index+a[0].length-1;return null}let n=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${D})>`,"gi"),t;while((t=n.exec(e))!==null){if(B(t.index,t.index+t[0].length,i))continue;if(ue.has(t[1].toLowerCase()))continue;return t.index+t[0].length-1}return null}function ge(e,i,n,t){let s=[],a=` data-stx="${t}"`,f=0,c=!1,p=(h)=>{if(n!==null&&!c&&n>=f&&n<=h)s.push(e.slice(f,n),a,e.slice(n,h)),c=!0;else s.push(e.slice(f,h))};for(let h of i){if(h.start<f)continue;p(h.start),f=h.end}return p(e.length),s.join("")}async function cs(e,i,n,t={}){let s=ss(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),a=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,f=[],{hasUserImports:c,bundleClientScript:p}=await o("stx/client-script-bundler",()=>import("./chunk-xe7wyaac.js"));for(let m of s){let x=m.body;if(Le(m.attrs))x=je(x);if(t.forceClientSetup||a.test(x)){f.push({content:x,start:m.start,end:m.end});continue}if(!c(x))continue;try{let R=await p(Ot(x).code,i||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(a.test(R))f.push({content:x,start:m.start,end:m.end})}catch{}}if(f.length===0)return{output:e,setupCode:null};let h=`${i??""}\x00${f.map((m)=>m.content).join("\x00")}`,r=`__stx_setup_${Bun.hash(h).toString(36).slice(0,10)}`,u=[];for(let m=0;m<f.length;m++){let x=f[m].bundled??Ot(f[m].content).code;if(!f[m].bundled&&c(x))x=await p(x,i||"",{projectRoot:process.cwd()});x=yt(x);let R=A(x);u.push(`// \u2500\u2500 merged signal script #${m+1} \u2500\u2500
6
6
  ${R}`)}let g=u.join(`
7
7
 
8
8
  `);g=le(g);let d=z(g).split(",").map((m)=>m.trim()).filter(Boolean),b=hn(g,n),w=`