@stacksjs/stx 0.2.317 → 0.2.319

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 (62) hide show
  1. package/dist/{chunk-vgwcpt59.js → chunk-0ggq64sc.js} +1 -1
  2. package/dist/{chunk-dexbmqrm.js → chunk-0saq3nwy.js} +1 -1
  3. package/dist/{chunk-6g4arx7a.js → chunk-1ppaw4xs.js} +1 -1
  4. package/dist/{chunk-gvw5agnj.js → chunk-5qseeh5t.js} +1 -1
  5. package/dist/{chunk-vah1scec.js → chunk-65hqene1.js} +1 -1
  6. package/dist/{chunk-bgj9ep3g.js → chunk-6c1ebjat.js} +1 -1
  7. package/dist/chunk-6xmx6stb.js +2 -0
  8. package/dist/{chunk-t088w4j2.js → chunk-8618n28z.js} +1 -1
  9. package/dist/{chunk-w3qdxrpv.js → chunk-8avktqwz.js} +1 -1
  10. package/dist/{chunk-knt8aerb.js → chunk-8z11nkyk.js} +1 -1
  11. package/dist/{chunk-s1enwpyh.js → chunk-95jjdgmb.js} +1 -1
  12. package/dist/{chunk-v7pagafp.js → chunk-9g14542g.js} +1 -1
  13. package/dist/{chunk-zrnh6ybt.js → chunk-9h4fkwtj.js} +1 -1
  14. package/dist/{chunk-1sv0pxa3.js → chunk-acctstj3.js} +1 -1
  15. package/dist/{chunk-43052kx3.js → chunk-b73h0vd8.js} +1 -1
  16. package/dist/{chunk-fxjyj3j9.js → chunk-bbq82jww.js} +5 -5
  17. package/dist/{chunk-dy6aq1fx.js → chunk-bxvqqejm.js} +1 -1
  18. package/dist/{chunk-asb365rs.js → chunk-djf1p5cy.js} +1 -1
  19. package/dist/{chunk-bnw3wnw8.js → chunk-egr5663e.js} +1 -1
  20. package/dist/{chunk-gg85dhn4.js → chunk-f9qrz82p.js} +1 -1
  21. package/dist/chunk-g8vf2fc7.js +2 -0
  22. package/dist/{chunk-j18h8dbg.js → chunk-gcavh7hk.js} +1 -1
  23. package/dist/{chunk-n25whneb.js → chunk-gpesxpwq.js} +2 -2
  24. package/dist/{chunk-x3s0e6wv.js → chunk-h63vszd3.js} +1 -1
  25. package/dist/{chunk-pn60d9sp.js → chunk-hxf6zg80.js} +1 -1
  26. package/dist/{chunk-7nes75cd.js → chunk-jdcn0ms1.js} +1 -1
  27. package/dist/{chunk-gd62grxx.js → chunk-jg2gbd58.js} +1 -1
  28. package/dist/{chunk-t9acxg0e.js → chunk-jr79tvvs.js} +1 -1
  29. package/dist/chunk-n0t2at1c.js +2 -0
  30. package/dist/{chunk-734mjk29.js → chunk-pknc4efv.js} +1 -1
  31. package/dist/{chunk-v1507pxw.js → chunk-prry9kgy.js} +1 -1
  32. package/dist/{chunk-tdrpxx1h.js → chunk-r3220h2n.js} +1 -1
  33. package/dist/{chunk-9yhtehv9.js → chunk-s2kxa1tb.js} +1 -1
  34. package/dist/{chunk-thhgk7x1.js → chunk-s5wwa0t4.js} +2 -2
  35. package/dist/{chunk-4zkwqprq.js → chunk-spzbfqjn.js} +17 -17
  36. package/dist/{chunk-60jcfv31.js → chunk-szkq9s8n.js} +1 -1
  37. package/dist/{chunk-860dhpmy.js → chunk-tqayztkh.js} +1 -1
  38. package/dist/{chunk-wvfed9sj.js → chunk-tzhcjtkr.js} +1 -1
  39. package/dist/{chunk-k2gsnfaa.js → chunk-v02j99gh.js} +2 -2
  40. package/dist/{chunk-46dsqwx0.js → chunk-v1j4myd8.js} +1 -1
  41. package/dist/chunk-vnh668fb.js +2 -0
  42. package/dist/{chunk-wd6skrxf.js → chunk-w33gx25k.js} +1 -1
  43. package/dist/{chunk-1zw2abe0.js → chunk-w3dfvxar.js} +1 -1
  44. package/dist/{chunk-vb16zpbw.js → chunk-w6ncyp18.js} +1 -1
  45. package/dist/{chunk-w84fgaqj.js → chunk-wb24hk90.js} +1 -1
  46. package/dist/{chunk-dm93r8kq.js → chunk-wcp0dt2c.js} +1 -1
  47. package/dist/{chunk-ndyxw7f5.js → chunk-wkcnyv6m.js} +1 -1
  48. package/dist/{chunk-gb3fk53c.js → chunk-ycgtkfbm.js} +1 -1
  49. package/dist/{chunk-f5mkztvk.js → chunk-yzb20ane.js} +1 -1
  50. package/dist/{chunk-9bc55xwj.js → chunk-yzy6e4je.js} +9 -9
  51. package/dist/{chunk-wb0n3rmf.js → chunk-z82sc99z.js} +1 -1
  52. package/dist/{chunk-r97y1cy2.js → chunk-zebypbks.js} +2 -2
  53. package/dist/cli.js +7 -7
  54. package/dist/craft-entry.js +1 -1
  55. package/dist/craft.js +1 -1
  56. package/dist/pwa.js +1 -1
  57. package/dist/ssg.js +2 -2
  58. package/package.json +5 -5
  59. package/dist/chunk-478m6jex.js +0 -2
  60. package/dist/chunk-50mk56ph.js +0 -2
  61. package/dist/chunk-mdbhyxnr.js +0 -2
  62. package/dist/chunk-sc70p4kj.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ao as e,Bo as f,Co as g,Do as h,Eo as i,Fo as j,Go as k,Ho as l,Io as m,wo as a,xo as b,yo as c,zo as d}from"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{m as stripStxRuntimeImports,b as scanScriptTags,l as rewriteStxImportSpecifiers,j as processSignals,h as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,k as findMarkupIndexOutsideScripts,i as extractExports,g as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,a as clearScriptScanCache};
2
+ import{Ao as e,Bo as f,Co as g,Do as h,Eo as i,Fo as j,Go as k,Ho as l,Io as m,wo as a,xo as b,yo as c,zo as d}from"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{m as stripStxRuntimeImports,b as scanScriptTags,l as rewriteStxImportSpecifiers,j as processSignals,h as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,k as findMarkupIndexOutsideScripts,i as extractExports,g as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,a as clearScriptScanCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Wv as y}from"./chunk-fxjyj3j9.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-css="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
2
+ import{Wv as y}from"./chunk-bbq82jww.js";import N from"fs";import B from"path";var Y="_stx";function L(M){return Bun.hash(M).toString(16).slice(0,8)}function T(M){let C=[],v=(q)=>{for(let g of N.readdirSync(q,{withFileTypes:!0})){let j=B.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(N.existsSync(M))v(M);return C}var S=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-runtime src="${M}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(M)=>`<script data-stx-router src="${M}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(M)=>`<link data-css="generated" rel="stylesheet" href="${M}">`}];function _(M,C=`/${Y}`){let v=[],q=new Set,g=0,j=M;for(let G of S)j=j.replace(G.pattern,(R,K,W)=>{if(/\b(?:src|href)\s*=/.test(K)||!W.trim())return R;let Q=`${G.prefix}.${L(W)}.${G.extension}`;if(!q.has(Q))q.add(Q),v.push({filename:Q,contents:W,contentType:G.contentType});return g+=W.length,G.replace(`${C}/${Q}`)});return{html:j,assets:v,bytesInlined:g}}function a(M){let C={pages:0,assets:0,bytesInlined:0},v=B.join(M,Y),q=new Set;for(let g of T(M)){let j=N.readFileSync(g,"utf8"),{html:G,assets:R,bytesInlined:K}=_(j);if(G===j)continue;for(let W of R){if(q.has(W.filename))continue;q.add(W.filename),N.mkdirSync(v,{recursive:!0}),N.writeFileSync(B.join(v,W.filename),W.contents),C.assets++}N.writeFileSync(g,G),C.bytesInlined+=K,C.pages++}return C}import z from"fs";import P from"path";var I=1024,E=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,d=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function b(M){return Bun.hash(M).toString(16).slice(0,8)}function p(M){let C=[],v=(q)=>{for(let g of z.readdirSync(q,{withFileTypes:!0})){let j=P.join(q,g.name);if(g.isDirectory())v(j);else if(g.isFile()&&j.endsWith(".html"))C.push(j)}};if(z.existsSync(M))v(M);return C}function D(M,C){let v=M.match(new RegExp(`\\b${C}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!v)return;return v[2]??v[3]??v[4]??""}function m(M,C,v){if(v.length<I)return!1;if(/\b(?:src|href)\s*=/i.test(C))return!1;if(M.toLowerCase()==="script"){if(!d.has((D(C,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function o(M){let C=[];for(let v of M.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))C.push([v.index,v.index+v[0].length]);return C}function s(M){let C={pages:0,assets:0,bytesInlined:0},v=p(M);if(v.length<2)return C;let q=new Map,g=new Map;for(let Q of v){let O=z.readFileSync(Q,"utf8");q.set(Q,O);let x=o(O);for(let U of O.matchAll(E)){let[w,V,J,$]=U;if(!m(V,J,$))continue;if(x.some(([A,k])=>U.index>=A&&U.index<k))continue;let H=`${V.toLowerCase()}\x00${$}`,X=g.get(H);if(X)X.push({file:Q,whole:w,tag:V,attrs:J,body:$});else g.set(H,[{file:Q,whole:w,tag:V,attrs:J,body:$}])}}let j=[...g.values()].filter((Q)=>new Set(Q.map((O)=>O.file)).size>1);if(j.length===0)return C;let G=P.join(M,Y),R=new Map(q),K=new Map,W=[];for(let Q of j){let{tag:O,body:x}=Q[0],U=O.toLowerCase()==="script",w=`${U?"chunk":"style"}.${b(x)}.${U?"js":"css"}`;W.push({filename:w,contents:x,contentType:U?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let V=`/${Y}/${w}`;for(let J of Q){let $=U?`<script${J.attrs} src="${V}"></script>`:`<link${J.attrs} rel="stylesheet" href="${V}">`,H=R.get(J.file),X=H.replace(J.whole,()=>$);if(X===H)continue;R.set(J.file,X),K.set(J.file,(K.get(J.file)??0)+J.body.length)}}z.mkdirSync(G,{recursive:!0});for(let Q of W)z.writeFileSync(P.join(G,Q.filename),Q.contents),C.assets++;for(let[Q,O]of R){if(O===q.get(Q))continue;z.writeFileSync(Q,O),C.pages++,C.bytesInlined+=K.get(Q)??0}return C}y();import Z from"fs";import F from"path";var h="layout-types.d.ts";function f(M){let C=[],v=(q,g)=>{let j;try{j=Z.readdirSync(q,{withFileTypes:!0})}catch{return}for(let G of j){if(G.name.startsWith("."))continue;let R=F.join(q,G.name);if(G.isDirectory())v(R,g?`${g}/${G.name}`:G.name);else if(G.isFile()&&G.name.endsWith(".stx")&&G.name!=="_layout.stx"){let K=G.name.slice(0,-4);C.push(g?`${g}/${K}`:K)}}};return v(M,""),C.sort()}function c(M){let C=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(M.length===0)return C.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),C.join(`
3
3
  `);return C.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...M.map((v)=>` '${v}': true`)," }","}","","export {}",""),C.join(`
4
4
  `)}function HM(M,C){if(!M)return[];let v=F.isAbsolute(M)?M:F.resolve(process.cwd(),M),q=f(v),g=c(q),j=F.join(C,h);try{if(Z.existsSync(j)&&Z.readFileSync(j,"utf8")===g)return q;Z.mkdirSync(C,{recursive:!0}),Z.writeFileSync(j,g)}catch{}return q}
5
5
  export{Y as Dk,_ as Ek,a as Fk,s as Gk,h as Hk,f as Ik,c as Jk,HM as Kk};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Wo as a,Xo as b}from"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as processLoops,a as parseLoopBinding};
2
+ import{Wo as a,Xo as b}from"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as processLoops,a as parseLoopBinding};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Xf as v,Yf as t,Zf as e,ag as HH,bg as KH,cg as QH,dg as YH,eg as ZH,fg as $H}from"./chunk-734mjk29.js";import{Ri as s}from"./chunk-1sv0pxa3.js";import{em as a,yr as i}from"./chunk-4zkwqprq.js";import{ou as h}from"./chunk-4ee1aaet.js";import{Uu as f}from"./chunk-ttny9g8k.js";import{existsSync as jH,readFileSync as WH}from"fs";import z from"path";function AH(Q,K="",V=""){let L=Q.startLine>1?`
2
+ import{Xf as v,Yf as t,Zf as e,ag as HH,bg as KH,cg as QH,dg as YH,eg as ZH,fg as $H}from"./chunk-pknc4efv.js";import{Ri as s}from"./chunk-acctstj3.js";import{em as a,yr as i}from"./chunk-spzbfqjn.js";import{ou as h}from"./chunk-4ee1aaet.js";import{Uu as f}from"./chunk-ttny9g8k.js";import{existsSync as jH,readFileSync as WH}from"fs";import z from"path";function AH(Q,K="",V=""){let L=Q.startLine>1?`
3
3
  `.repeat(Q.startLine-1):"",U=e(t(Q.code)),X=Q.kind==="client"||Q.kind==="plain"?KH(K,Q.code):"";return YH(`${L+U}
4
4
  ${X}
5
5
  export {}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Qo as a,So as b,Uo as c,Vo as d,aq as e,bq as f,cq as g,dq as h,eq as i,fq as j,gq as k,hq as l,iq as m,jq as n,kq as o,lq as p,mq as q,nq as r,oq as s,pq as t,qq as u,rq as v,sq as w,tq as x}from"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{e as validateTemplate,g as validateDirective,n as userComponentFileExists,m as transpileTypeScript,p as slotContentHasExpressions,k as shouldTranspileTypeScript,t as resolveTemplatePath,r as renderComponentWithSlot,j as isJavaScriptScript,o as isHydrateTrigger,d as hasVariables,h as hasDirectives,u as getSourceLineInfo,l as getSharedTranspiler,f as getPositionInfo,x as getComponentCacheStats,s as fileExists,a as extractVariables,c as extractScriptFromTemplate,i as extractDirectiveNames,v as createDetailedErrorMessage,b as convertToCommonJS,q as componentClientSignalNames,w as clearComponentCache};
2
+ import{Qo as a,So as b,Uo as c,Vo as d,aq as e,bq as f,cq as g,dq as h,eq as i,fq as j,gq as k,hq as l,iq as m,jq as n,kq as o,lq as p,mq as q,nq as r,oq as s,pq as t,qq as u,rq as v,sq as w,tq as x}from"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{e as validateTemplate,g as validateDirective,n as userComponentFileExists,m as transpileTypeScript,p as slotContentHasExpressions,k as shouldTranspileTypeScript,t as resolveTemplatePath,r as renderComponentWithSlot,j as isJavaScriptScript,o as isHydrateTrigger,d as hasVariables,h as hasDirectives,u as getSourceLineInfo,l as getSharedTranspiler,f as getPositionInfo,x as getComponentCacheStats,s as fileExists,a as extractVariables,c as extractScriptFromTemplate,i as extractDirectiveNames,v as createDetailedErrorMessage,b as convertToCommonJS,q as componentClientSignalNames,w as clearComponentCache};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{$f as e}from"./chunk-734mjk29.js";import{Fg as EF,tg as t,vg as kF,wg as UF,xg as wF}from"./chunk-n25whneb.js";import{Ig as BF}from"./chunk-dvvx1wny.js";import{yj as l,zj as d}from"./chunk-tph7b269.js";import{Lk as HF,Mk as IF,Nk as KF}from"./chunk-09zjty4k.js";import{ul as YF,wl as ZF}from"./chunk-r97y1cy2.js";import{$p as r,Ap as $F,Pp as GF,Xp as VF,Ym as s,rm as p,so as zF,tm as i,wr as o,yr as M}from"./chunk-4zkwqprq.js";import{au as qF}from"./chunk-bnw3wnw8.js";import{ju as XF}from"./chunk-ry1key0g.js";import{ru as WF}from"./chunk-ndyxw7f5.js";import{wu as QF}from"./chunk-18p8dqya.js";import{Uv as h,Wv as _F}from"./chunk-fxjyj3j9.js";import G from"fs";import q from"path";import{createHash as NF}from"crypto";_F();function u(Q){return NF("sha256").update(Q).digest("hex").slice(0,8)}function c(Q=!1){let z=Q?d():l(),Z=u(z);return{content:z,filename:`runtime.${Z}.js`,hash:Z}}function a(){let Q=h(),z=u(Q);return{content:Q,filename:`router.${z}.js`,hash:z}}function bF(Q){return{runtimeTag:Q.runtime?`<script src="/__stx/${Q.runtime.filename}"></script>`:"",routerTag:Q.router?`<script src="/__stx/${Q.router.filename}"></script>`:"",cssTag:Q.css?`<link rel="stylesheet" href="/__stx/${Q.css.filename}">`:""}}import n from"path";import{createHash as OF}from"crypto";function TF(Q={}){let z=new Set;return{context:new Proxy(Q,{get(X,F){if(F in X)return X[F];if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return},has(X,F){if(F in X)return!0;if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return!1}}),accessedKeys:z}}async function FF(Q,z,Z={}){let X=n.resolve(Q),F=await Bun.file(X).text(),U=OF("sha256").update(F).digest("hex").slice(0,16);p();let w={};try{w=await M(Z.configDir)}catch{}let H=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(F))!==null){let E=k[1];if(/\bserver\b/.test(E))H.push(k[2])}let W=new Set(H.flatMap((E)=>e(E))),{context:_}=TF({__filename:X,__dirname:n.dirname(X),__stx_serverDeclared:W}),N=new Set,x={...o,...w,...Z,buildMode:"compile",strict:!1},I=await r(F,_,X,x,N),O=t(I),j=i();return{route:z,sourceFile:Q,html:I,fragment:O,placeholders:j,hasServerScripts:H.length>0,serverScriptContent:H,dependencies:Array.from(N),contentHash:U,status:s(F),streamTemplates:_.__streamTemplates}}var MF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function JF(Q,z){let Z=0,X=0;if(!G.existsSync(Q))return{copied:Z,bytes:X};G.mkdirSync(z,{recursive:!0});function F(U,w){let H=G.readdirSync(U,{withFileTypes:!0});for(let V of H){if(MF.has(V.name))continue;let k=q.join(U,V.name),W=q.join(w,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),F(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),Z++,X+=G.statSync(W).size}}}return F(Q,z),{copied:Z,bytes:X}}async function qJ(Q={}){let z=Date.now(),Z=q.resolve(Q.root||process.cwd()),X=q.resolve(Z,Q.outputDir||".output");console.log("[stx build] Starting production build...");let F=await M(Z),U=q.resolve(Z,Q.componentsDir??F.componentsDir??"components"),w=q.resolve(Z,Q.partialsDir??F.partialsDir??"partials"),H=q.resolve(Z,Q.layoutsDir??F.layoutsDir??"layouts"),V=Q.publicDir??F.publicDir??"public",k=F.app?.head||{},W=F.app?.colorMode,_=F.router?.container||"main",N=Q.routeRules??F.routeRules??{},x=BF(N),I=Q.serverApi??F.serverApi,O=typeof I==="object"?I:{};if(I)YF(Z,O);if(F.runtimeConfig)QF(F.runtimeConfig,{});if(G.existsSync(X))G.rmSync(X,{recursive:!0});let j=[q.join(X,"public","__stx"),q.join(X,"public","assets"),q.join(X,"server","pages"),q.join(X,"server","fragments")];for(let Y of j)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let E=zF(Z,{pagesDirs:F._layerPageDirs}),LF=["components","layouts","partials"],y=E.filter((Y)=>{return!LF.some((B)=>Y.pattern.startsWith(`/${B}/`)||Y.pattern===`/${B}`)});console.log(`[stx build] Found ${y.length} page routes (${E.length-y.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let L=c(Q.debug),K=a();await Bun.write(q.join(X,"public","__stx",L.filename),L.content),await Bun.write(q.join(X,"public","__stx",K.filename),K.content),console.log(`[stx build] Runtime: ${L.filename} (${(L.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${K.filename} (${(K.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let R=[],v=[];for(let Y of y){let B=x(Y.pattern),b=B.rendering==="prerender";if(b&&(Y.pattern.includes(":")||Y.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${Y.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let J=await FF(Y.filePath,Y.pattern,{configDir:Z,componentsDir:U,partialsDir:w,layoutsDir:H,debug:Q.debug});if(R.push(J),J.html=J.html.replace(/runtime\.__STX_HASH__\.js/g,L.filename).replace(/router\.__STX_HASH__\.js/g,K.filename),J.html=VF(J.html,k,{bodyScripts:[`<script src="/__stx/${K.filename}"></script>`],...W&&{colorMode:W}}),W)J.html=$F(J.html,W);if(k.htmlAttrs)J.html=GF(J.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(J.html)){let $=J.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if($&&$[1]){let m=$[1];J.html=J.html.replace(" "+m,""),J.html=J.html.replace(/<body([^>]*)>/,`<body$1 ${m}>`)}}if(J.html=J.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),J.html=await qF(J.html),b){let $=await EF(J,{params:{},request:new Request(`http://stx.build${Y.pattern}`),method:"GET",__stx_strict_hydration:!0});if($.redirect||$.cookies?.length||$.boundaries?.length||$.headers&&Object.keys($.headers).length)throw Error(`Prerendered route ${Y.pattern} cannot set response headers/cookies, redirect or stream`);J.html=$.html,J.status=$.status??J.status,J.hasServerScripts=!1,J.serverScriptContent=[],J.placeholders={}}J.fragment=kF(J.html,_);let C=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),g=q.join("server","pages",`${C}.compiled.json`),f=q.join("server","fragments",`${C}.html`);await Bun.write(q.join(X,g),JSON.stringify(J,null,2)),await Bun.write(q.join(X,f),J.fragment),v.push({pattern:Y.pattern,compiledPath:g,fragmentPath:f,isDynamic:J.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("["),prerendered:b}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(J){if(Object.keys(B).length)throw J;console.error(`[stx build] \u2717 ${Y.pattern}:`,J instanceof Error?J.message:J)}}let P=q.resolve(Z,V);if(G.existsSync(P)){let{copied:Y,bytes:B}=JF(P,q.join(X,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${V}/`)}let A=KF(Z);if(A){let{copied:Y,bytes:B}=JF(A,q.join(X,"public",IF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${HF}/`)}let S={runtime:L.filename,router:K.filename},T=UF(v,S,X);if(T.routeRules=N,T.routerContainer=_,I)T.apiRoutes=await ZF(Z,X,O);if(F.runtimeConfig)await Bun.write(q.join(X,"server/runtime-config.json"),JSON.stringify(F.runtimeConfig)),await WF(Z,F.runtimeConfig);if(F._layerGraph)await Bun.write(q.join(X,"server/layers.json"),JSON.stringify(XF(F._layerGraph),null,2));wF(T,X);let D=Date.now()-z;return console.log(`
2
+ import{$f as e}from"./chunk-pknc4efv.js";import{Fg as EF,tg as t,vg as kF,wg as UF,xg as wF}from"./chunk-gpesxpwq.js";import{Ig as BF}from"./chunk-dvvx1wny.js";import{yj as l,zj as d}from"./chunk-tph7b269.js";import{Lk as HF,Mk as IF,Nk as KF}from"./chunk-09zjty4k.js";import{ul as YF,wl as ZF}from"./chunk-zebypbks.js";import{$p as r,Ap as $F,Pp as GF,Xp as VF,Ym as s,rm as p,so as zF,tm as i,wr as o,yr as M}from"./chunk-spzbfqjn.js";import{au as qF}from"./chunk-egr5663e.js";import{ju as XF}from"./chunk-ry1key0g.js";import{ru as WF}from"./chunk-wkcnyv6m.js";import{wu as QF}from"./chunk-18p8dqya.js";import{Uv as h,Wv as _F}from"./chunk-bbq82jww.js";import G from"fs";import q from"path";import{createHash as NF}from"crypto";_F();function u(Q){return NF("sha256").update(Q).digest("hex").slice(0,8)}function c(Q=!1){let z=Q?d():l(),Z=u(z);return{content:z,filename:`runtime.${Z}.js`,hash:Z}}function a(){let Q=h(),z=u(Q);return{content:Q,filename:`router.${z}.js`,hash:z}}function bF(Q){return{runtimeTag:Q.runtime?`<script src="/__stx/${Q.runtime.filename}"></script>`:"",routerTag:Q.router?`<script src="/__stx/${Q.router.filename}"></script>`:"",cssTag:Q.css?`<link rel="stylesheet" href="/__stx/${Q.css.filename}">`:""}}import n from"path";import{createHash as OF}from"crypto";function TF(Q={}){let z=new Set;return{context:new Proxy(Q,{get(X,F){if(F in X)return X[F];if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return},has(X,F){if(F in X)return!0;if(typeof F==="string"&&!F.startsWith("__"))z.add(F);return!1}}),accessedKeys:z}}async function FF(Q,z,Z={}){let X=n.resolve(Q),F=await Bun.file(X).text(),U=OF("sha256").update(F).digest("hex").slice(0,16);p();let w={};try{w=await M(Z.configDir)}catch{}let H=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(F))!==null){let E=k[1];if(/\bserver\b/.test(E))H.push(k[2])}let W=new Set(H.flatMap((E)=>e(E))),{context:_}=TF({__filename:X,__dirname:n.dirname(X),__stx_serverDeclared:W}),N=new Set,x={...o,...w,...Z,buildMode:"compile",strict:!1},I=await r(F,_,X,x,N),O=t(I),j=i();return{route:z,sourceFile:Q,html:I,fragment:O,placeholders:j,hasServerScripts:H.length>0,serverScriptContent:H,dependencies:Array.from(N),contentHash:U,status:s(F),streamTemplates:_.__streamTemplates}}var MF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function JF(Q,z){let Z=0,X=0;if(!G.existsSync(Q))return{copied:Z,bytes:X};G.mkdirSync(z,{recursive:!0});function F(U,w){let H=G.readdirSync(U,{withFileTypes:!0});for(let V of H){if(MF.has(V.name))continue;let k=q.join(U,V.name),W=q.join(w,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),F(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),Z++,X+=G.statSync(W).size}}}return F(Q,z),{copied:Z,bytes:X}}async function qJ(Q={}){let z=Date.now(),Z=q.resolve(Q.root||process.cwd()),X=q.resolve(Z,Q.outputDir||".output");console.log("[stx build] Starting production build...");let F=await M(Z),U=q.resolve(Z,Q.componentsDir??F.componentsDir??"components"),w=q.resolve(Z,Q.partialsDir??F.partialsDir??"partials"),H=q.resolve(Z,Q.layoutsDir??F.layoutsDir??"layouts"),V=Q.publicDir??F.publicDir??"public",k=F.app?.head||{},W=F.app?.colorMode,_=F.router?.container||"main",N=Q.routeRules??F.routeRules??{},x=BF(N),I=Q.serverApi??F.serverApi,O=typeof I==="object"?I:{};if(I)YF(Z,O);if(F.runtimeConfig)QF(F.runtimeConfig,{});if(G.existsSync(X))G.rmSync(X,{recursive:!0});let j=[q.join(X,"public","__stx"),q.join(X,"public","assets"),q.join(X,"server","pages"),q.join(X,"server","fragments")];for(let Y of j)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let E=zF(Z,{pagesDirs:F._layerPageDirs}),LF=["components","layouts","partials"],y=E.filter((Y)=>{return!LF.some((B)=>Y.pattern.startsWith(`/${B}/`)||Y.pattern===`/${B}`)});console.log(`[stx build] Found ${y.length} page routes (${E.length-y.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let L=c(Q.debug),K=a();await Bun.write(q.join(X,"public","__stx",L.filename),L.content),await Bun.write(q.join(X,"public","__stx",K.filename),K.content),console.log(`[stx build] Runtime: ${L.filename} (${(L.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${K.filename} (${(K.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let R=[],v=[];for(let Y of y){let B=x(Y.pattern),b=B.rendering==="prerender";if(b&&(Y.pattern.includes(":")||Y.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${Y.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let J=await FF(Y.filePath,Y.pattern,{configDir:Z,componentsDir:U,partialsDir:w,layoutsDir:H,debug:Q.debug});if(R.push(J),J.html=J.html.replace(/runtime\.__STX_HASH__\.js/g,L.filename).replace(/router\.__STX_HASH__\.js/g,K.filename),J.html=VF(J.html,k,{bodyScripts:[`<script src="/__stx/${K.filename}"></script>`],...W&&{colorMode:W}}),W)J.html=$F(J.html,W);if(k.htmlAttrs)J.html=GF(J.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(J.html)){let $=J.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if($&&$[1]){let m=$[1];J.html=J.html.replace(" "+m,""),J.html=J.html.replace(/<body([^>]*)>/,`<body$1 ${m}>`)}}if(J.html=J.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),J.html=await qF(J.html),b){let $=await EF(J,{params:{},request:new Request(`http://stx.build${Y.pattern}`),method:"GET",__stx_strict_hydration:!0});if($.redirect||$.cookies?.length||$.boundaries?.length||$.headers&&Object.keys($.headers).length)throw Error(`Prerendered route ${Y.pattern} cannot set response headers/cookies, redirect or stream`);J.html=$.html,J.status=$.status??J.status,J.hasServerScripts=!1,J.serverScriptContent=[],J.placeholders={}}J.fragment=kF(J.html,_);let C=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),g=q.join("server","pages",`${C}.compiled.json`),f=q.join("server","fragments",`${C}.html`);await Bun.write(q.join(X,g),JSON.stringify(J,null,2)),await Bun.write(q.join(X,f),J.fragment),v.push({pattern:Y.pattern,compiledPath:g,fragmentPath:f,isDynamic:J.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("["),prerendered:b}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(J){if(Object.keys(B).length)throw J;console.error(`[stx build] \u2717 ${Y.pattern}:`,J instanceof Error?J.message:J)}}let P=q.resolve(Z,V);if(G.existsSync(P)){let{copied:Y,bytes:B}=JF(P,q.join(X,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${V}/`)}let A=KF(Z);if(A){let{copied:Y,bytes:B}=JF(A,q.join(X,"public",IF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(B/1024).toFixed(1)}KB) from ${HF}/`)}let S={runtime:L.filename,router:K.filename},T=UF(v,S,X);if(T.routeRules=N,T.routerContainer=_,I)T.apiRoutes=await ZF(Z,X,O);if(F.runtimeConfig)await Bun.write(q.join(X,"server/runtime-config.json"),JSON.stringify(F.runtimeConfig)),await WF(Z,F.runtimeConfig);if(F._layerGraph)await Bun.write(q.join(X,"server/layers.json"),JSON.stringify(XF(F._layerGraph),null,2));wF(T,X);let D=Date.now()-z;return console.log(`
3
3
  [stx build] Done in ${D}ms \u2014 ${R.length} pages compiled`),{pageCount:R.length,assets:S,outputDir:X,duration:D}}
4
4
  export{u as Rf,c as Sf,a as Tf,bF as Uf,FF as Vf,qJ as Wf};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pi as a,Qi as b}from"./chunk-yzb20ane.js";import"./chunk-xwxdwqn9.js";import"./chunk-s2kxa1tb.js";import"./chunk-zebypbks.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as getStoreScript,b as clearStoreCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gl as a,hl as b,il as c,jl as d,kl as e,ll as f,ml as g,nl as h,ol as i,pl as j,ql as k,rl as l,sl as m,tl as n}from"./chunk-9yhtehv9.js";import"./chunk-r97y1cy2.js";import"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
2
+ import{gl as a,hl as b,il as c,jl as d,kl as e,ll as f,ml as g,nl as h,ol as i,pl as j,ql as k,rl as l,sl as m,tl as n}from"./chunk-s2kxa1tb.js";import"./chunk-zebypbks.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as shouldLogBundlerDiagnostics,f as setBundlerFallbackMode,l as rewriteRegistryImports,g as resolveBundlerFallback,j as registryIdForPath,c as recordBundleFailure,m as queueClientBundleBuild,k as normalizeRegistrySpecifiers,h as hasUserImports,d as getBundleFailures,a as clientBundleDependencies,e as clearBundleFailures,n as bundleClientScript,i as MODULE_SPECIFIER_PREFIX};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ri as a,Si as b,Ti as c}from"./chunk-1sv0pxa3.js";import"./chunk-xwxdwqn9.js";import"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
2
+ import{Ri as a,Si as b,Ti as c}from"./chunk-acctstj3.js";import"./chunk-xwxdwqn9.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as listComposableModules,b as getComposableScript,c as clearComposableCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Le as c,Me as d,Ne as e,Oe as f,Pe as g,Qe as h}from"./chunk-gvw5agnj.js";import{Xf as a,_f as b}from"./chunk-734mjk29.js";import"./chunk-1sv0pxa3.js";import"./chunk-xwxdwqn9.js";import"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
2
+ import{Le as c,Me as d,Ne as e,Oe as f,Pe as g,Qe as h}from"./chunk-5qseeh5t.js";import{Xf as a,_f as b}from"./chunk-pknc4efv.js";import"./chunk-acctstj3.js";import"./chunk-xwxdwqn9.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{d as virtualPathFor,g as typecheckStxFiles,e as sourcePathFor,h as formatTypecheckDiagnostics,f as findRuntimeTypeDeclarations,b as extractTemplateExpressions,a as extractScriptBlocks,c as buildVirtualSource};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Vg as a,Wg as b,Xg as c,Yg as d,Zg as e,_g as f}from"./chunk-860dhpmy.js";import"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
2
+ import{Vg as a,Wg as b,Xg as c,Yg as d,Zg as e,_g as f}from"./chunk-tqayztkh.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Te as a}from"./chunk-w84fgaqj.js";import"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as startInteractive};
2
+ import{Te as a}from"./chunk-wb24hk90.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as startInteractive};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$p as e,Yp as b,Zp as c,_p as d,vo as a}from"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
2
+ import{$p as e,Yp as b,Zp as c,_p as d,vo as a}from"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{d as validateClientScript,c as processOnceDirective,b as processJsonDirective,e as processDirectives,a as injectRouterScript};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ui as x,Vi as F,Wi as R}from"./chunk-xwxdwqn9.js";import{fm as K,hq as T,yr as k}from"./chunk-4zkwqprq.js";import{Pu as y,Qu as N}from"./chunk-xcsf7my7.js";import{Uu as v}from"./chunk-ttny9g8k.js";import j from"path";var P=new Map,E=new Map,h=["composables","functions"];function D(q){let z=j.basename(q,".ts");return z==="index"||z==="types"||q.endsWith(".d.ts")}async function f(q){if(q)return j.resolve(q);let z=`<default>:${process.cwd()}`,W=E.get(z);if(W!==void 0)return W;let H=await u();if(H!==null)E.set(z,H);return H}async function u(){let q=await k(),z=q.root||process.cwd(),W=q.composablesDir;if(W)return j.resolve(z,W);for(let H of h){let Q=j.resolve(z,H);try{let V=new Bun.Glob("**/*.ts");for await(let Z of V.scan({cwd:Q,absolute:!0}))if(!D(Z))return Q}catch{}}return null}async function b(q){let z=Array.isArray(q)?q:q?[j.resolve(q)]:(await k())._layerComposableDirs??[await f()].filter((H)=>!!H),W=new Map;for(let H of z){let Q=new Bun.Glob("**/*.ts");try{for await(let V of Q.scan({cwd:H,absolute:!0})){let Z=j.relative(H,V);if(!D(V)&&!W.has(Z))W.set(Z,V)}}catch{}}return{key:z.join("\x00"),files:[...W.values()].sort()}}async function o(q){let{files:z}=await b(q),W=T({loader:"ts",target:"browser",define:K()}),H=[];for(let Q of z)try{let V=await Bun.file(Q).text(),Z=W.scan(V).exports.filter(($)=>$!=="default");if(Z.length>0)H.push({file:Q,names:Z})}catch{}return H}function p(q,z){return new RegExp(`\\b${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(q)}function m(q,z,W){let H=new Map;for(let{file:$,names:G}of q)for(let O of G)if(!H.has(O))H.set(O,$);let Q=($)=>{let G=[];for(let[O,U]of H)if(p($,O))G.push(U);return G},V=new Set,Z=W.flatMap(Q);while(Z.length>0){let $=[];for(let G of Z){if(V.has(G))continue;V.add(G);for(let O of Q(z.get(G)??""))if(!V.has(O))$.push(O)}Z=$}return V}async function e(q,z,W){let{key:H,files:Q}=await b(q);if(!H)return null;let V=x(Q);if(Q.length===0)return R(P,H,V,""),null;Q.sort();let Z=T({loader:"ts",target:"browser",define:K()}),$=new Map,G=[];for(let J of Q)try{let Y=await Bun.file(J).text();$.set(J,Y);let L=Z.scan(Y).exports.filter((X)=>X!=="default");if(L.length>0)G.push({file:J,names:L})}catch{$.set(J,"")}let O=z===void 0?new Set(Q):m(G,$,W?[z,...W]:[z]);if(O.size===0)return null;let U=Q.filter((J)=>O.has(J)),A=`${H}\x00${U.join("\x00")}`,B=F(P,A,V);if(B!==void 0)return B||null;let M=[],w=new Set,I=new Set;for(let J of U)try{let Y=$.get(J)??await Bun.file(J).text(),L=j.basename(J,".ts");for(let X of Y.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])I.add(X[1]);try{for(let X of Z.scan(Y).exports)if(X!=="default")w.add(X)}catch{}Y=y(Y),Y=N(Y),Y=Y.replace(/^export\s+(default\s+)?/gm,""),Y=Z.transformSync(Y),M.push(`// Composable: ${L}
2
+ import{Ui as x,Vi as F,Wi as R}from"./chunk-xwxdwqn9.js";import{fm as K,hq as T,yr as k}from"./chunk-spzbfqjn.js";import{Pu as y,Qu as N}from"./chunk-xcsf7my7.js";import{Uu as v}from"./chunk-ttny9g8k.js";import j from"path";var P=new Map,E=new Map,h=["composables","functions"];function D(q){let z=j.basename(q,".ts");return z==="index"||z==="types"||q.endsWith(".d.ts")}async function f(q){if(q)return j.resolve(q);let z=`<default>:${process.cwd()}`,W=E.get(z);if(W!==void 0)return W;let H=await u();if(H!==null)E.set(z,H);return H}async function u(){let q=await k(),z=q.root||process.cwd(),W=q.composablesDir;if(W)return j.resolve(z,W);for(let H of h){let Q=j.resolve(z,H);try{let V=new Bun.Glob("**/*.ts");for await(let Z of V.scan({cwd:Q,absolute:!0}))if(!D(Z))return Q}catch{}}return null}async function b(q){let z=Array.isArray(q)?q:q?[j.resolve(q)]:(await k())._layerComposableDirs??[await f()].filter((H)=>!!H),W=new Map;for(let H of z){let Q=new Bun.Glob("**/*.ts");try{for await(let V of Q.scan({cwd:H,absolute:!0})){let Z=j.relative(H,V);if(!D(V)&&!W.has(Z))W.set(Z,V)}}catch{}}return{key:z.join("\x00"),files:[...W.values()].sort()}}async function o(q){let{files:z}=await b(q),W=T({loader:"ts",target:"browser",define:K()}),H=[];for(let Q of z)try{let V=await Bun.file(Q).text(),Z=W.scan(V).exports.filter(($)=>$!=="default");if(Z.length>0)H.push({file:Q,names:Z})}catch{}return H}function p(q,z){return new RegExp(`\\b${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(q)}function m(q,z,W){let H=new Map;for(let{file:$,names:G}of q)for(let O of G)if(!H.has(O))H.set(O,$);let Q=($)=>{let G=[];for(let[O,U]of H)if(p($,O))G.push(U);return G},V=new Set,Z=W.flatMap(Q);while(Z.length>0){let $=[];for(let G of Z){if(V.has(G))continue;V.add(G);for(let O of Q(z.get(G)??""))if(!V.has(O))$.push(O)}Z=$}return V}async function e(q,z,W){let{key:H,files:Q}=await b(q);if(!H)return null;let V=x(Q);if(Q.length===0)return R(P,H,V,""),null;Q.sort();let Z=T({loader:"ts",target:"browser",define:K()}),$=new Map,G=[];for(let J of Q)try{let Y=await Bun.file(J).text();$.set(J,Y);let L=Z.scan(Y).exports.filter((X)=>X!=="default");if(L.length>0)G.push({file:J,names:L})}catch{$.set(J,"")}let O=z===void 0?new Set(Q):m(G,$,W?[z,...W]:[z]);if(O.size===0)return null;let U=Q.filter((J)=>O.has(J)),A=`${H}\x00${U.join("\x00")}`,B=F(P,A,V);if(B!==void 0)return B||null;let M=[],w=new Set,I=new Set;for(let J of U)try{let Y=$.get(J)??await Bun.file(J).text(),L=j.basename(J,".ts");for(let X of Y.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(X[1])I.add(X[1]);try{for(let X of Z.scan(Y).exports)if(X!=="default")w.add(X)}catch{}Y=y(Y),Y=N(Y),Y=Y.replace(/^export\s+(default\s+)?/gm,""),Y=Z.transformSync(Y),M.push(`// Composable: ${L}
3
3
  ${Y.trim()}`)}catch(Y){console.warn(`[stx] Failed to load composable ${J}:`,Y)}if(M.length===0||w.size===0)return R(P,A,V,""),null;let g=[...w].map((J)=>` try { __c[${JSON.stringify(J)}] = ${J}; } catch (e) {}`).join(`
4
4
  `),S=JSON.stringify([...w]),C=M.join(`
5
5
 
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Al as g,ul as a,vl as b,wl as c,xl as d,yl as e,zl as f}from"./chunk-r97y1cy2.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-18p8dqya.js";import"./chunk-fxjyj3j9.js";import"./chunk-jryjwara.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
2
+ import{Al as g,ul as a,vl as b,wl as c,xl as d,yl as e,zl as f}from"./chunk-zebypbks.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-18p8dqya.js";import"./chunk-bbq82jww.js";import"./chunk-jryjwara.js";export{e as productionApiDispatcher,g as isServerApiSource,b as generateApiTypes,a as discoverServerApi,f as createServerApi,d as createApiDispatcher,c as buildServerApi};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{cw as Ce,dw as u}from"./chunk-jryjwara.js";function O(t){return t.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>g.includes(a))}function m(t){return O(t.replace(/^\//,""))}var g;var b=u(()=>{g=["components","layouts","partials","emails"]});import d from"fs";import y from"path";function x(t,e){let a=t.filter((s)=>!m(s.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let s of a){let i=[];for(let c of s.params){let h=s.pattern.includes(`:${c}?`)?"?":"";i.push(`${c}${h}: string`)}let l=i.join("; ");r.push(` '${s.pattern}': { ${l} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
- `),o=y.join(e,"route-types.d.ts");try{if(d.existsSync(o)&&d.readFileSync(o,"utf8")===n)return;d.mkdirSync(e,{recursive:!0}),d.writeFileSync(o,n)}catch{}}function S(t,e,a){let r=process.cwd(),n=y.relative(r,a),o=t.filter((i)=>!m(i.pattern)),s=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let i of o){let l=y.relative(r,i.filePath).replace(/\\/g,"/"),c=JSON.stringify(i.params),h=i.layout?`, layout: '${y.relative(r,i.layout).replace(/\\/g,"/")}'`:"";s.push(` { pattern: '${i.pattern}', filePath: '${l}', isDynamic: ${i.isDynamic}, params: ${c}${h} },`)}s.push("] as const",""),s.push("export type RouteName = typeof routes[number]['pattern']",""),d.mkdirSync(e,{recursive:!0}),d.writeFileSync(y.join(e,"routes.ts"),s.join(`
4
- `))}var M=u(()=>{b()});import D from"path";function k(t,e){let r=D.relative(e,t).replace(/\.(stx|md)$/,"");if(r=r.split(D.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function v(t){let e=[],a="",r=0;while(r<t.length){let n=t.slice(r),o=/^\/:([^/?*]+)\?/.exec(n);if(o){e.push(o[1]),a+="(?:/([^/]+))?",r+=o[0].length;continue}let s=/^:([^/?*]+)\*/.exec(n);if(s){e.push(s[1]),a+="(.+)",r+=s[0].length;continue}let i=/^:([^/?*]+)/.exec(n);if(i){e.push(i[1]),a+="([^/]+)",r+=i[0].length;continue}a+=t[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:e}}function V(t,e){let a=t===""?"/":t;for(let r of e){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((s,i)=>{o[s]=n[i+1]}),{route:r,params:o}}}return null}function W(t){let e=t.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return v(e)}var F=()=>{};import Se from"fs";import I from"path";function A(t,e){let a=[],r=I.dirname(t);while(r.startsWith(e)||r===e){let n=I.join(r,"_layout.stx");if(Se.existsSync(n))a.unshift(n);if(r===e)break;r=I.dirname(r)}return a}var N=()=>{};import P from"fs";import p from"path";function K(t,e){let a=[];if(!P.existsSync(t))return a;let r=P.readdirSync(t,{withFileTypes:!0});for(let n of r){let o=p.join(t,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(g.includes(n.name))continue;a.push(...K(o,e))}else if(n.isFile()){let s=p.extname(n.name);if(e.includes(s)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class C{routes;pagesDir;pagesDirs;config;constructor(t,e={}){this.config=e;let a=e.pagesDirs&&e.pagesDirs.length>0?e.pagesDirs:[e.pagesDir||"pages"];this.pagesDirs=a.map((o)=>p.resolve(t,o)),this.pagesDir=this.pagesDirs[0];let r=e.extensions||[".stx"],n=new Set;this.routes=[];for(let o of this.pagesDirs){let s=K(o,r),i=new Map;for(let l of s){let c=k(l,o),h=e.pagesDirs?c.replace(/:[\w]+/g,":param"):c;if(e.pagesDirs&&i.has(h))throw Error(`Conflicting layer pages for ${c}: ${i.get(h)} and ${l}`);if(i.set(h,l),n.has(h))continue;n.add(h);let{regex:xe,params:H}=v(c),_=e.layouts!==!1?A(l,o):[];this.routes.push({pattern:c,regex:xe,params:H,filePath:l,isDynamic:H.length>0,layout:_.length>0?_[_.length-1]:void 0})}}if(this.routes.sort((o,s)=>{if(!o.isDynamic&&s.isDynamic)return-1;if(o.isDynamic&&!s.isDynamic)return 1;let i=o.pattern.split("/").length,l=s.pattern.split("/").length;if(i!==l)return l-i;return o.pattern.localeCompare(s.pattern)}),e.emit!==!1){let o=p.resolve(t,e.stateDir||process.env.STX_DIR?.trim()||".stx");x(this.routes,o),S(this.routes,o,this.pagesDir)}}match(t){let e=t===""?"/":t;for(let a of this.routes){let r=e.match(a.regex);if(r){let n={};return a.params.forEach((o,s)=>{n[o]=r[s+1]}),{route:a,params:n}}}return null}resolve(t,e){let a=this.routes.find((n)=>n.pattern===t||n.filePath.includes(t));if(!a)return"#not-found";let r=a.pattern;if(e)for(let[n,o]of Object.entries(e))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(t){this.routes.push(t),this.routes.sort((e,a)=>{if(!e.isDynamic&&a.isDynamic)return-1;if(e.isDynamic&&!a.isDynamic)return 1;return e.pattern.localeCompare(a.pattern)})}getLayout(t){return t.layout??null}}function $(t,e){return new C(t,e)}function z(t,e){let a=[`${e}.stx`,"error.stx"];for(let r of a){let n=p.join(t,r);if(P.existsSync(n))return n}return null}function Y(t,e){return t.map((a)=>{let r=p.relative(e,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var J=u(()=>{M();F();N();b()});function Z(t){T=t.replace(/\/$/,"")}function Q(t,e,a={}){f[t]={path:e,name:t,params:a}}function ee(t){for(let[e,a]of Object.entries(t))if(typeof a==="string")f[e]={path:a,name:e};else f[e]={...a,name:e}}function te(t,e={},a=!1){let r=f[t];if(!r)return console.warn(`Route [${t}] not defined.`),"#undefined-route";let n={...r.params,...e},o=r.path;o=o.replace(/:(\w+)/g,(i,l)=>{let c=n[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${t}].`),`:${l}`;return delete n[l],encodeURIComponent(String(c))});let s=Object.entries(n);if(s.length>0){let i=s.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");o+=(o.includes("?")?"&":"?")+i}return a&&T?`${T}${o}`:o}function re(){for(let t of Object.keys(f))delete f[t];T=""}var f,T="";var ae=u(()=>{f={}});import ne from"fs";import oe from"path";function se(t,e={}){return{type:"redirect",path:t,options:{replace:e.replace??!1,external:e.external??!1,redirectCode:e.redirectCode??302}}}function ie(t){return{type:"abort",error:typeof t==="string"?{statusCode:500,message:t}:t}}function le(t,e={}){return{handler:t,mode:e.mode??"universal"}}function B(t){let e={};if(!t)return e;let a=t.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let s=n.trim(),i=o.join("=").trim();if(s)e[s]=decodeURIComponent(i)}}return e}function R(t,e,a={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function G(t,e){let a=t.headers.get("cookie")||"",r=B(a);return{get(n){return r[n]},set(n,o,s={}){r[n]=o,e.append("Set-Cookie",R(n,o,s))},delete(n){delete r[n],e.append("Set-Cookie",R(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function U(){return{get(t){if(typeof document>"u")return;return B(document.cookie)[t]},set(t,e,a={}){if(typeof document>"u")return;document.cookie=R(t,e,a)},delete(t){if(typeof document>"u")return;document.cookie=R(t,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return B(document.cookie)}}}function X(){let t=typeof window<"u"&&typeof window.localStorage<"u";return{get(e){if(!t)return null;try{return window.localStorage.getItem(e)}catch{return null}},set(e,a){if(!t)return;try{window.localStorage.setItem(e,a)}catch{}},remove(e){if(!t)return;try{window.localStorage.removeItem(e)}catch{}},isAvailable(){return t}}}function E(t,e){w.set(t,e)}function j(t){return w.get(t)}function ce(t){return w.has(t)}function ue(){w.clear()}function he(){return Array.from(w.keys())}async function de(t,e="middleware"){let a=oe.resolve(t,e);if(!ne.existsSync(a))return;let r=ne.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),s=oe.join(a,n);try{let l=(await import(s)).default;if(l&&typeof l.handler==="function")E(o,l);else if(typeof l==="function")E(o,{handler:l,mode:"universal"})}catch(i){console.warn(`Failed to load middleware '${o}' from ${s}:`,i)}}}function ke(t){let e={};if(!t)return e;let a=new URLSearchParams(t);for(let[r,n]of a)e[r]=n;return e}function pe(t,e,a,r=""){return{path:t,params:e,query:ke(r),fullPath:r?`${t}?${r}`:t,meta:a}}function fe(t,e,a,r){let n=r?.isServer??typeof window>"u",o=!n,s=new Headers;return{to:t,from:e,isClient:o,isServer:n,cookies:n&&a?G(a,s):U(),storage:X(),state:{},request:a,responseHeaders:s}}async function ge(t,e){let a=Array.isArray(t)?t:[t],r=e.isServer;for(let n of a){let o=j(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:e.state,responseHeaders:e.responseHeaders};if(o.mode==="server"&&!r)continue;try{let s=await o.handler(e);if(s){if(s.type==="redirect")return{passed:!1,redirect:s,state:e.state,responseHeaders:e.responseHeaders};if(s.type==="abort")return{passed:!1,abort:s,state:e.state,responseHeaders:e.responseHeaders}}}catch(s){return console.error(`Error in middleware '${n}':`,s),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:s instanceof Error?s.message:"Middleware error"}},state:e.state,responseHeaders:e.responseHeaders}}}return{passed:!0,state:e.state,responseHeaders:e.responseHeaders}}var w;var me=u(()=>{w=new Map});function q(t){let a=t.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function ye(t){let e=t.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=t.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=t.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=e?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||q(n)}}var ve=()=>{};function Ae(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}function we(){if(L)return L;return L=Ae(`
2
+ import{cw as Ee,dw as d}from"./chunk-jryjwara.js";function N(t){return t.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>v.includes(a))}function w(t){return N(t.replace(/^\//,""))}var v;var k=d(()=>{v=["components","layouts","partials","emails"]});import f from"fs";import b from"path";function A(t,e){let a=t.filter((s)=>!w(s.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let s of a){let l=[];for(let c of s.params){let u=s.pattern.includes(`:${c}?`)?"?":"";l.push(`${c}${u}: string`)}let i=l.join("; ");r.push(` '${s.pattern}': { ${i} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
+ `),o=b.join(e,"route-types.d.ts");try{if(f.existsSync(o)&&f.readFileSync(o,"utf8")===n)return;f.mkdirSync(e,{recursive:!0}),f.writeFileSync(o,n)}catch{}}function C(t,e,a){let r=process.cwd(),n=b.relative(r,a),o=t.filter((l)=>!w(l.pattern)),s=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let l of o){let i=b.relative(r,l.filePath).replace(/\\/g,"/"),c=JSON.stringify(l.params),u=l.layout?`, layout: '${b.relative(r,l.layout).replace(/\\/g,"/")}'`:"";s.push(` { pattern: '${l.pattern}', filePath: '${i}', isDynamic: ${l.isDynamic}, params: ${c}${u} },`)}s.push("] as const",""),s.push("export type RouteName = typeof routes[number]['pattern']",""),f.mkdirSync(e,{recursive:!0}),f.writeFileSync(b.join(e,"routes.ts"),s.join(`
4
+ `))}var P=d(()=>{k()});import K from"path";function T(t,e){let r=K.relative(e,t).replace(/\.(stx|md)$/,"");if(r=r.split(K.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function x(t){let e=[],a="",r=0;while(r<t.length){let n=t.slice(r),o=/^\/:([^/?*]+)\?/.exec(n);if(o){e.push(o[1]),a+="(?:/([^/]+))?",r+=o[0].length;continue}let s=/^:([^/?*]+)\*/.exec(n);if(s){e.push(s[1]),a+="(.+)",r+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(n);if(l){e.push(l[1]),a+="([^/]+)",r+=l[0].length;continue}a+=t[r].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),r+=1}return{regex:new RegExp(`^${a}$`),params:e}}function $(t,e){let a=t===""?"/":t;for(let r of e){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((s,l)=>{o[s]=n[l+1]}),{route:r,params:o}}}return null}function z(t){let e=t.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return x(e)}var B=()=>{};import Ce from"fs";import G from"path";function R(t,e){let a=[],r=G.dirname(t);while(r.startsWith(e)||r===e){let n=G.join(r,"_layout.stx");if(Ce.existsSync(n))a.unshift(n);if(r===e)break;r=G.dirname(r)}return a}var U=()=>{};import E from"fs";import p from"path";function Y(t,e){let a=[];if(!E.existsSync(t))return a;let r=E.readdirSync(t,{withFileTypes:!0});for(let n of r){let o=p.join(t,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(v.includes(n.name))continue;a.push(...Y(o,e))}else if(n.isFile()){let s=p.extname(n.name);if(e.includes(s)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class L{routes;pagesDir;pagesDirs;config;constructor(t,e={}){this.config=e;let a=e.pagesDirs&&e.pagesDirs.length>0?e.pagesDirs:[e.pagesDir||"pages"];this.pagesDirs=a.map((i)=>p.resolve(t,i)),this.pagesDir=this.pagesDirs[0];let r=e.extensions||[".stx"],n=(i)=>{let c=p.resolve(t,i);try{return E.realpathSync(c)}catch{return c}},o=(e.exclude??[]).filter((i)=>typeof i==="string"&&i.trim()!=="").map(n),s=(i)=>{if(o.length===0)return!1;let c=n(i);return o.some((u)=>c===u||c.startsWith(`${u}${p.sep}`))},l=new Set;this.routes=[];for(let i of this.pagesDirs){let c=Y(i,r).filter((h)=>!s(h)),u=new Map;for(let h of c){let m=T(h,i),y=e.pagesDirs?m.replace(/:[\w]+/g,":param"):m;if(e.pagesDirs&&u.has(y))throw Error(`Conflicting layer pages for ${m}: ${u.get(y)} and ${h}`);if(u.set(y,h),l.has(y))continue;l.add(y);let{regex:Ae,params:W}=x(m),I=e.layouts!==!1?R(h,i):[];this.routes.push({pattern:m,regex:Ae,params:W,filePath:h,isDynamic:W.length>0,layout:I.length>0?I[I.length-1]:void 0})}}if(this.routes.sort((i,c)=>{if(!i.isDynamic&&c.isDynamic)return-1;if(i.isDynamic&&!c.isDynamic)return 1;let u=i.pattern.split("/").length,h=c.pattern.split("/").length;if(u!==h)return h-u;return i.pattern.localeCompare(c.pattern)}),e.emit!==!1){let i=p.resolve(t,e.stateDir||process.env.STX_DIR?.trim()||".stx");A(this.routes,i),C(this.routes,i,this.pagesDir)}}match(t){let e=t===""?"/":t;for(let a of this.routes){let r=e.match(a.regex);if(r){let n={};return a.params.forEach((o,s)=>{n[o]=r[s+1]}),{route:a,params:n}}}return null}resolve(t,e){let a=this.routes.find((n)=>n.pattern===t||n.filePath.includes(t));if(!a)return"#not-found";let r=a.pattern;if(e)for(let[n,o]of Object.entries(e))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(t){this.routes.push(t),this.routes.sort((e,a)=>{if(!e.isDynamic&&a.isDynamic)return-1;if(e.isDynamic&&!a.isDynamic)return 1;return e.pattern.localeCompare(a.pattern)})}getLayout(t){return t.layout??null}}function J(t,e){return new L(t,e)}function Z(t,e){let a=[`${e}.stx`,"error.stx"];for(let r of a){let n=p.join(t,r);if(E.existsSync(n))return n}return null}function Q(t,e){return t.map((a)=>{let r=p.relative(e,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var ee=d(()=>{P();B();U();k()});function te(t){_=t.replace(/\/$/,"")}function re(t,e,a={}){g[t]={path:e,name:t,params:a}}function ae(t){for(let[e,a]of Object.entries(t))if(typeof a==="string")g[e]={path:a,name:e};else g[e]={...a,name:e}}function ne(t,e={},a=!1){let r=g[t];if(!r)return console.warn(`Route [${t}] not defined.`),"#undefined-route";let n={...r.params,...e},o=r.path;o=o.replace(/:(\w+)/g,(l,i)=>{let c=n[i];if(c===void 0)return console.warn(`Missing parameter [${i}] for route [${t}].`),`:${i}`;return delete n[i],encodeURIComponent(String(c))});let s=Object.entries(n);if(s.length>0){let l=s.map(([i,c])=>`${encodeURIComponent(i)}=${encodeURIComponent(String(c))}`).join("&");o+=(o.includes("?")?"&":"?")+l}return a&&_?`${_}${o}`:o}function se(){for(let t of Object.keys(g))delete g[t];_=""}var g,_="";var oe=d(()=>{g={}});import ie from"fs";import le from"path";function ce(t,e={}){return{type:"redirect",path:t,options:{replace:e.replace??!1,external:e.external??!1,redirectCode:e.redirectCode??302}}}function ue(t){return{type:"abort",error:typeof t==="string"?{statusCode:500,message:t}:t}}function he(t,e={}){return{handler:t,mode:e.mode??"universal"}}function X(t){let e={};if(!t)return e;let a=t.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let s=n.trim(),l=o.join("=").trim();if(s)e[s]=decodeURIComponent(l)}}return e}function O(t,e,a={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function j(t,e){let a=t.headers.get("cookie")||"",r=X(a);return{get(n){return r[n]},set(n,o,s={}){r[n]=o,e.append("Set-Cookie",O(n,o,s))},delete(n){delete r[n],e.append("Set-Cookie",O(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function q(){return{get(t){if(typeof document>"u")return;return X(document.cookie)[t]},set(t,e,a={}){if(typeof document>"u")return;document.cookie=O(t,e,a)},delete(t){if(typeof document>"u")return;document.cookie=O(t,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return X(document.cookie)}}}function H(){let t=typeof window<"u"&&typeof window.localStorage<"u";return{get(e){if(!t)return null;try{return window.localStorage.getItem(e)}catch{return null}},set(e,a){if(!t)return;try{window.localStorage.setItem(e,a)}catch{}},remove(e){if(!t)return;try{window.localStorage.removeItem(e)}catch{}},isAvailable(){return t}}}function M(t,e){S.set(t,e)}function V(t){return S.get(t)}function de(t){return S.has(t)}function pe(){S.clear()}function fe(){return Array.from(S.keys())}async function ge(t,e="middleware"){let a=le.resolve(t,e);if(!ie.existsSync(a))return;let r=ie.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),s=le.join(a,n);try{let i=(await import(s)).default;if(i&&typeof i.handler==="function")M(o,i);else if(typeof i==="function")M(o,{handler:i,mode:"universal"})}catch(l){console.warn(`Failed to load middleware '${o}' from ${s}:`,l)}}}function Te(t){let e={};if(!t)return e;let a=new URLSearchParams(t);for(let[r,n]of a)e[r]=n;return e}function me(t,e,a,r=""){return{path:t,params:e,query:Te(r),fullPath:r?`${t}?${r}`:t,meta:a}}function ye(t,e,a,r){let n=r?.isServer??typeof window>"u",o=!n,s=new Headers;return{to:t,from:e,isClient:o,isServer:n,cookies:n&&a?j(a,s):q(),storage:H(),state:{},request:a,responseHeaders:s}}async function ve(t,e){let a=Array.isArray(t)?t:[t],r=e.isServer;for(let n of a){let o=V(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:e.state,responseHeaders:e.responseHeaders};if(o.mode==="server"&&!r)continue;try{let s=await o.handler(e);if(s){if(s.type==="redirect")return{passed:!1,redirect:s,state:e.state,responseHeaders:e.responseHeaders};if(s.type==="abort")return{passed:!1,abort:s,state:e.state,responseHeaders:e.responseHeaders}}}catch(s){return console.error(`Error in middleware '${n}':`,s),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:s instanceof Error?s.message:"Middleware error"}},state:e.state,responseHeaders:e.responseHeaders}}}return{passed:!0,state:e.state,responseHeaders:e.responseHeaders}}var S;var we=d(()=>{S=new Map});function D(t){let a=t.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function be(t){let e=t.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=t.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=t.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=e?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||D(n)}}var xe=()=>{};function Re(t){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return t}}function Se(){if(F)return F;return F=Re(`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -2067,5 +2067,5 @@ else {
2067
2067
 
2068
2068
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
2069
2069
  })();
2070
- `),L}var L;var be=()=>{};var Te={};Ce(Te,{setAppUrl:()=>Z,runMiddleware:()=>ge,route:()=>te,resolveLayoutChain:()=>A,resetRoutes:()=>re,registerMiddleware:()=>E,patternToRegex:()=>v,navigateTo:()=>se,matchRoute:()=>V,loadMiddlewareFromDirectory:()=>de,isNonPageRoutePattern:()=>m,isNonPageRoutePath:()=>O,hasMiddleware:()=>ce,getRouterScript:()=>we,getMiddlewareNames:()=>he,getMiddleware:()=>j,generateRouteTypes:()=>x,generateRouteManifest:()=>S,formatRoutes:()=>Y,findErrorPage:()=>z,filePathToPattern:()=>k,extractLayoutMetadata:()=>ye,deriveLayoutGroup:()=>q,defineRoutes:()=>ee,defineRoute:()=>Q,defineMiddleware:()=>le,createStorageManager:()=>X,createServerCookieManager:()=>G,createRouter:()=>$,createRouteLocation:()=>pe,createMiddlewareContext:()=>fe,createClientCookieManager:()=>U,clearMiddleware:()=>ue,bracketPathToRegex:()=>W,abortNavigation:()=>ie,Router:()=>C,NON_PAGE_DIRS:()=>g});var Re=u(()=>{J();F();ae();me();N();ve();M();b();be()});
2071
- export{g as jv,O as kv,m as lv,x as mv,S as nv,k as ov,v as pv,V as qv,W as rv,A as sv,C as tv,$ as uv,z as vv,Y as wv,Z as xv,Q as yv,ee as zv,te as Av,re as Bv,se as Cv,ie as Dv,le as Ev,G as Fv,U as Gv,X as Hv,E as Iv,j as Jv,ce as Kv,ue as Lv,he as Mv,de as Nv,pe as Ov,fe as Pv,ge as Qv,q as Rv,ye as Sv,ve as Tv,we as Uv,Te as Vv,Re as Wv};
2070
+ `),F}var F;var ke=()=>{};var Le={};Ee(Le,{setAppUrl:()=>te,runMiddleware:()=>ve,route:()=>ne,resolveLayoutChain:()=>R,resetRoutes:()=>se,registerMiddleware:()=>M,patternToRegex:()=>x,navigateTo:()=>ce,matchRoute:()=>$,loadMiddlewareFromDirectory:()=>ge,isNonPageRoutePattern:()=>w,isNonPageRoutePath:()=>N,hasMiddleware:()=>de,getRouterScript:()=>Se,getMiddlewareNames:()=>fe,getMiddleware:()=>V,generateRouteTypes:()=>A,generateRouteManifest:()=>C,formatRoutes:()=>Q,findErrorPage:()=>Z,filePathToPattern:()=>T,extractLayoutMetadata:()=>be,deriveLayoutGroup:()=>D,defineRoutes:()=>ae,defineRoute:()=>re,defineMiddleware:()=>he,createStorageManager:()=>H,createServerCookieManager:()=>j,createRouter:()=>J,createRouteLocation:()=>me,createMiddlewareContext:()=>ye,createClientCookieManager:()=>q,clearMiddleware:()=>pe,bracketPathToRegex:()=>z,abortNavigation:()=>ue,Router:()=>L,NON_PAGE_DIRS:()=>v});var _e=d(()=>{ee();B();oe();we();U();xe();P();k();ke()});
2071
+ export{v as jv,N as kv,w as lv,A as mv,C as nv,T as ov,x as pv,$ as qv,z as rv,R as sv,L as tv,J as uv,Z as vv,Q as wv,te as xv,re as yv,ae as zv,ne as Av,se as Bv,ce as Cv,ue as Dv,he as Ev,j as Fv,q as Gv,H as Hv,M as Iv,V as Jv,de as Kv,pe as Lv,fe as Mv,ge as Nv,me as Ov,ye as Pv,ve as Qv,D as Rv,be as Sv,xe as Tv,Se as Uv,Le as Vv,_e as Wv};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$j as h,Uj as a,Vj as b,Wj as c,Xj as d,Yj as e,Zj as f,_j as g,ak as i,bk as j,ck as k,dk as l}from"./chunk-gd62grxx.js";import"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,l as hashFilePath,h as getServeClientAsset,f as getCachedSignalsRuntime,g as getCachedRouterScript,i as clearDevCaches,j as checkCache,k as cacheTemplate,e as __setSignalsGeneratorsForTest};
2
+ import{$j as h,Uj as a,Vj as b,Wj as c,Xj as d,Yj as e,Zj as f,_j as g,ak as i,bk as j,ck as k,dk as l}from"./chunk-jg2gbd58.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,l as hashFilePath,h as getServeClientAsset,f as getCachedSignalsRuntime,g as getCachedRouterScript,i as clearDevCaches,j as checkCache,k as cacheTemplate,e as __setSignalsGeneratorsForTest};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$t as k,Rt as a,St as b,Tt as c,Ut as d,Vt as e,Wt as f,Xt as g,Yt as h,Zt as i,_t as j,au as l}from"./chunk-bnw3wnw8.js";import"./chunk-4ee1aaet.js";import"./chunk-jryjwara.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
2
+ import{$t as k,Rt as a,St as b,Tt as c,Ut as d,Vt as e,Wt as f,Xt as g,Yt as h,Zt as i,_t as j,au as l}from"./chunk-egr5663e.js";import"./chunk-4ee1aaet.js";import"./chunk-jryjwara.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
@@ -17,7 +17,7 @@ catch (e) {
17
17
  }
18
18
  throw e;
19
19
  }
20
- `),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-1zw2abe0.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
20
+ `),U.set(X,q)}return q(...j)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:W,context:Q.slice()});return W}clear(){this.pool.length=0,this.fnCache.clear()}}var CQ=new bJ;class kJ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let W={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(W);while(this.violations.length>this.maxViolations)this.violations.shift();for(let V of this.violationHandlers)try{V(W)}catch{}let j=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(j);break;case"warn":console.warn(j);break;case"error":console.error(j);break;case"throw":if(F)throw Error(j);else console.warn(j);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var $J=null;function WQ(){if(!$J)$J=new kJ;return $J}var gQ=new Proxy({},{get(J,Q){return WQ()[Q]}});var xJ=[];function SJ(J){let Q=new ZJ(J);return xJ.push(Q),Q}function mQ(){for(let J of xJ)J.clear()}function UJ(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function hQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:EJ.statSync(Z).mtimeMs})}catch{}return Q}function iQ(J){for(let Q of J)try{if(EJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var O=null,WJ=!1,H=null,T="",A=!1,dJ=256,D=new Map,L=new Map,N=null,b=null;function y(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function FJ(J,Q){if(D.has(J))D.delete(J);else if(D.size>=dJ)D.delete(D.keys().next().value);D.set(J,Q)}function VQ(J){let Q=y(J);if(L.has(Q))L.delete(Q);else if(L.size>=dJ)L.delete(L.keys().next().value);return L.set(Q,J),Q}function eQ(J){let Q=L.get(J);if(Q===void 0)return;return L.delete(J),L.set(J,Q),Q}async function XQ(J){if(!N)return null;try{let Q=Bun.file(z.join(N,`cw-${y(J)}.css`));if(!await Q.exists())return null;return await Q.text()}catch{return null}}async function jQ(J,Q){if(!N)return;try{if(!fs.existsSync(N))fs.mkdirSync(N,{recursive:!0});await Bun.write(z.join(N,`cw-${y(J)}.css`),Q)}catch{}}async function fJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var qQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],GQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zQ(){let J=[],Q=process.cwd();while(Q!==z.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of qQ)J.push(z.join(Q,Z,...$));Q=z.dirname(Q)}return J}function YQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&z.join(Q,"Code","Tools","ts-css"),Q&&z.join(Q,"Code","Tools","crosswind"),Q&&z.join(Q,"repos","stacks-org","ts-css"),Q&&z.join(Q,"repos","stacks-org","crosswind"),z.join(process.cwd(),"..","ts-css"),z.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(z.join($,"packages","toolkit","dist","engine","index.js")),J.push(z.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(z.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function pJ(){if(WJ)return O;WJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let W=await fJ(F);if(W){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${z.dirname(z.dirname(F))}`);return W}}return null};if(process.env.CROSSWIND_SRC){let U=z.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return O=F,O}let Q=await J(zQ());if(Q)return O=Q,O;let Z=GQ;for(let U of Z){let F=await fJ(U);if(F){if(O=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return O}}let $=await J(YQ());if($)return O=$,O;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function J0(){VJ.clear(),O=null,WJ=!1,H=null,T="",D.clear(),L.clear(),b=null}var CJ=!1;async function mJ(J){try{let Q=yJ({name:"css",cwd:J})?"css":yJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!CJ)CJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=z.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function wQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-w3dfvxar.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=z.isAbsolute($.css)?$.css:z.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=z.isAbsolute($.css.config)?$.css.config:z.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await mJ(J)}function BQ(J){try{let Q=new WeakSet;return y(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function HQ(J){if(A)return T;A=!0;try{let Q=await pJ();if(!Q||!Q.build)return A=!1,"";if(!H)H=await mJ(J);if(!H)return A=!1,"";let Z=Q.defaultConfig?.theme||{},$=H.theme||{},U={...Q.defaultConfig,...H,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),W=await Q.build(U),j=performance.now()-F;if(T=W.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${W.classes.size} classes in ${j.toFixed(1)}ms`),U.output){let V=z.isAbsolute(U.output)?U.output:z.join(J,U.output),X=z.dirname(V);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(V,W.css)}return A=!1,W.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),A=!1,T}}async function Q0(J){H=null,await HQ(J)}function $0(){return T}function OQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let W of $[1].split(/\s+/))if(W.trim())Q.add(W.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let W=F[1].match(/'([^']+)'/g);if(W){for(let j of W)for(let V of j.slice(1,-1).split(/\s+/))if(V.trim())Q.add(V.trim())}F=U.exec(J)}return Q}var VJ=SJ(64);async function LQ(J,Q){let Z=VJ.get(UJ(J,Q,b));if(Z!==void 0)return Z;let $=await KQ(J,Q);if($)VJ.set(UJ(J,Q,b),$);return $}async function KQ(J,Q){try{let Z=await pJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):OQ(J);if($.size===0)return"";let U=Q?z.resolve(Q):process.cwd();if(!N)N=uJ(U,"cache");let F=[...$].sort().join(" "),W=`${b||"default"}::${F}`,j=D.get(W);if(j!==void 0)return FJ(W,j),j;let V=await XQ(W);if(V!==null)return FJ(W,V),V;if(!H)H=await wQ(U),b=BQ(H);let X=Z.defaultConfig||Z.config,q=H||{},G=LJ(X,q),{safelist:w,includePreflight:K,minify:M,tokenCSS:hJ}=G,XJ=G.config,_=new Z.CSSGenerator(XJ);for(let B of w)_.generate(B);for(let B of $)_.generate(B);let I=_.toCSS(K,M),jJ=XJ.shortcuts||q.shortcuts||{};for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean);for(let R of C)_.generate(R)}I=_.toCSS(K,M);let v=I.split(`
21
21
  `);for(let[B,f]of Object.entries(jJ)){if(!$.has(B)&&!w.includes(B))continue;let C=f.split(/\s+/).filter(Boolean),R=[],g=[];for(let u of C){let qJ=u.startsWith("dark:"),GJ=`.${(qJ?u.slice(5):u).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<v.length;k++){let zJ=v[k].trim();if(zJ===`${GJ} {`||zJ.startsWith(`${GJ} {`)){let E=k,YJ="";while(E<v.length){if(YJ+=v[E],v[E].includes("}"))break;E++}let d=YJ.match(/\{([^}]+)\}/);if(d)if(qJ)g.push(d[1].trim());else R.push(d[1].trim());break}}}if(R.length)I+=`
22
22
  .${B} { ${R.join(" ")} }`;if(g.length)I+=`
23
23
  @media (prefers-color-scheme: dark) { .dark .${B} { ${g.join(" ")} } }`}return I=hJ+I,FJ(W,I),jQ(W,I),I}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function Z0(J,Q,Z=!1,$=!1){let U=await LQ(J,Q);if(!U)return $?QJ(J):J;let F=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${VQ(U)}.css">`:`<style data-css="generated">
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$i as e,Xi as a,Yi as b,Zi as c,_i as d,aj as f,bj as g,cj as h,dj as i,ej as j,fj as k,gj as l,hj as m,ij as n}from"./chunk-60jcfv31.js";import"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
2
+ import{$i as e,Xi as a,Yi as b,Zi as c,_i as d,aj as f,bj as g,cj as h,dj as i,ej as j,fj as k,gj as l,hj as m,ij as n}from"./chunk-szkq9s8n.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Wf as a}from"./chunk-6c1ebjat.js";import"./chunk-pknc4efv.js";import"./chunk-gpesxpwq.js";import"./chunk-dvvx1wny.js";import"./chunk-tph7b269.js";import"./chunk-t41aaehf.js";import"./chunk-09zjty4k.js";import"./chunk-zebypbks.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as buildForProduction};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Am as d,Bm as e,Cm as f,Dm as g,Em as h,Fm as i,Gm as j,Hm as k,Im as l,Jm as m,Km as n,Lm as o,Mm as p,xm as a,ym as b,zm as c}from"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as usesSignalsInScript,p as unescapeHtml,n as resetRejectedExpressionWarnings,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,o as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
2
+ import{Am as d,Bm as e,Cm as f,Dm as g,Em as h,Fm as i,Gm as j,Hm as k,Im as l,Jm as m,Km as n,Lm as o,Mm as p,xm as a,ym as b,zm as c}from"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as usesSignalsInScript,p as unescapeHtml,n as resetRejectedExpressionWarnings,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,o as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$m as d,Dm as R,Lm as k,Lo as l,Qo as T,Up as m,an as c,vm as P,wm as D}from"./chunk-4zkwqprq.js";import{Ct as S,Et as v}from"./chunk-bnw3wnw8.js";import{Tv as XJ,Vv as YJ,Wv as ZJ}from"./chunk-fxjyj3j9.js";import{bw as QJ,ew as q}from"./chunk-jryjwara.js";var n=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function r(J,Y,Q){let X={fullTag:Q,content:Y,attrs:J};if(/\bserver\b/.test(J))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test(J))return{...X,type:"client"};if(n.test(Y))return{...X,type:"signals"};if(/\bclient\b/.test(J)||/\btype\s*=\s*["']module["']/.test(J)||/\bsrc\s*=/.test(J))return{...X,type:"client"};return{...X,type:"server"}}var s=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function y(J){let Y=[],Q=[],X=[],$=0;while($<J.length){let Z=J.indexOf("<",$);if(Z===-1)break;let U=v(J,Z);if(U>Z){$=U;continue}let W=S(J,Z);if(W>Z){let j=J.slice(Z,W),F=s.exec(j);if(F){let K=r(F[1],F[2],j);switch(K.type){case"signals":Y.push(K);break;case"client":Q.push(K);break;case"server":X.push(K);break}}$=W;continue}$=Z+(J.startsWith("<!--",Z)?4:1)}return{signals:Y,client:Q,server:X}}var o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function a(J){let Y=[],Q=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Q.exec(J))!==null)Y.push({start:X.index,end:X.index+X[0].length});return Y}function C(J,Y){return Y.some((Q)=>J>=Q.start&&J<Q.end)}function t(J){let Y=(J||"").trim();if(!Y)return null;if(/[\s>+~,:]/.test(Y))return null;let Q={},X=Y,$=X.match(/^[a-z][\w-]*/i);if($)Q.tag=$[0].toLowerCase(),X=X.slice($[0].length);while(X.length>0){let Z=X.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(Z){if(Q.attr=Z[1],Z[3]!==void 0&&Z[3]!=="")Q.attrValue=Z[3];X=X.slice(Z[0].length);continue}let U=X.match(/^#([\w-]+)/);if(U){Q.id=U[1],X=X.slice(U[0].length);continue}let W=X.match(/^\.([\w-]+)/);if(W){Q.className=W[1],X=X.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function e(J,Y){if(Y.attr){if(!(Y.attrValue===void 0?new RegExp(`\\b${Y.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Y.attr}\\s*=\\s*(["'])\\s*${Y.attrValue}\\s*\\1`,"i")).test(J))return!1}if(Y.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Y.id}\\s*\\1`,"i").test(J))return!1}if(Y.className){let Q=J.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(Y.className))return!1}return!0}function x(J,Y="main"){let Q=t(Y);if(!Q)return null;let X=/<([a-z][\w-]*)\b([^>]*)>/gi,$=a(J),Z;while((Z=X.exec(J))!==null){if(C(Z.index,$))continue;let U=Z[1].toLowerCase(),W=Z[2]||"";if(W.trimEnd().endsWith("/")||o.has(U))continue;if(Q.tag&&Q.tag!==U)continue;if(!e(W,Q))continue;let j=Z[0],F=Z.index+j.length,K=new RegExp(`<(/?)${U}\\b([^>]*)>`,"gi");K.lastIndex=F;let G=1,B;while((B=K.exec(J))!==null){if(C(B.index,$))continue;let w=B[1]==="/";if(!w&&(B[2]||"").trimEnd().endsWith("/"))continue;if(G+=w?-1:1,G===0)return{openTag:j,openIndex:Z.index,start:F,end:B.index,tagName:U}}return null}return null}var wJ="X-STX-Router",NJ="private, no-store";function AJ(J){return J.replace(/&#(\d+);/g,(Y,Q)=>f(Number(Q),Y)).replace(/&#x([0-9a-f]+);/gi,(Y,Q)=>f(Number.parseInt(Q,16),Y)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function f(J,Y){if(!Number.isInteger(J)||J<0||J>1114111)return Y;try{return String.fromCodePoint(J)}catch{return Y}}function g(J){return J.headers.get("X-STX-Router")==="true"}function JJ(J,Y){if(!J)return Y;return J.split(",").some((X)=>X.trim().toLowerCase()===Y.toLowerCase())?J:`${J}, ${Y}`}function IJ(J){return{Vary:JJ(J,"X-STX-Router")}}import E from"path";XJ();var $J="stx-page-head:",UJ=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,O=null;function WJ(){if(O!==null)return O;try{let{getRouterScript:J}=(ZJ(),QJ(YJ));O=`<script>${J()}</script>`}catch{O=""}return O}async function MJ(J,Y){if(Y===!1)return null;if(Y&&typeof Y==="string"){let X=E.resolve(J,Y);if(await Bun.file(X).exists())return X;return null}let Q=E.join(J,"app.stx");if(await Bun.file(Q).exists())return Q;return null}async function bJ(J,Y){try{let Q=await Bun.file(J).text(),X=Q,$=Q.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)X=$[1].trim();let Z=y(Q),U=[...Z.client.map((V)=>V.fullTag),...Z.signals.map((V)=>V.fullTag)],W=[],j=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=j.exec(Q))!==null)W.push(F[0]);let K=X;for(let V of Z.server)K=K.replace(V.fullTag,"");for(let V of Z.client)K=K.replace(V.fullTag,"");K=K.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let G="<!--__STX_PAGE_SLOT__-->";if(K=K.replace(/<slot\s*\/>/gi,G).replace(/<slot\s*>\s*<\/slot>/gi,G),!K.includes(G))return console.warn(`[stx] Shell ${J} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:w,defaultConfig:N,loadStxConfig:I}=await import("./chunk-wd6skrxf.js"),_=await I(),z={__filename:J,__dirname:E.dirname(J)};for(let V of U){let L=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(L&&!V.includes("client")&&!V.includes('type="module"'))await w(L[1],z,J)}let A=await B(K,z,J,{...N,..._,...Y},new Set),H=A.indexOf(G);if(H===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:A.substring(0,H),afterSlot:A.substring(H+G.length),filePath:J,shellScripts:U,shellStyles:W}}catch(Q){return console.error(`[stx] Error processing shell ${J}:`,Q),null}}function PJ(J,Y,Q){let X,$="",Z=Y.match(UJ);if(Z){Y=Y.replace(Z[0],"");try{let K=Buffer.from(Z[1],"base64").toString("utf8"),G=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(G)X=G[1].trim();$=K.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let U=Q||X||"stx App",W=WJ(),j="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{$m as d,Dm as R,Lm as k,Lo as l,Qo as T,Up as m,an as c,vm as P,wm as D}from"./chunk-spzbfqjn.js";import{Ct as S,Et as v}from"./chunk-egr5663e.js";import{Tv as XJ,Vv as YJ,Wv as ZJ}from"./chunk-bbq82jww.js";import{bw as QJ,ew as q}from"./chunk-jryjwara.js";var n=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function r(J,Y,Q){let X={fullTag:Q,content:Y,attrs:J};if(/\bserver\b/.test(J))return{...X,type:"server"};if(/\bdata-stx-scoped\b/.test(J))return{...X,type:"client"};if(n.test(Y))return{...X,type:"signals"};if(/\bclient\b/.test(J)||/\btype\s*=\s*["']module["']/.test(J)||/\bsrc\s*=/.test(J))return{...X,type:"client"};return{...X,type:"server"}}var s=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function y(J){let Y=[],Q=[],X=[],$=0;while($<J.length){let Z=J.indexOf("<",$);if(Z===-1)break;let U=v(J,Z);if(U>Z){$=U;continue}let W=S(J,Z);if(W>Z){let j=J.slice(Z,W),F=s.exec(j);if(F){let K=r(F[1],F[2],j);switch(K.type){case"signals":Y.push(K);break;case"client":Q.push(K);break;case"server":X.push(K);break}}$=W;continue}$=Z+(J.startsWith("<!--",Z)?4:1)}return{signals:Y,client:Q,server:X}}var o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function a(J){let Y=[],Q=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Q.exec(J))!==null)Y.push({start:X.index,end:X.index+X[0].length});return Y}function C(J,Y){return Y.some((Q)=>J>=Q.start&&J<Q.end)}function t(J){let Y=(J||"").trim();if(!Y)return null;if(/[\s>+~,:]/.test(Y))return null;let Q={},X=Y,$=X.match(/^[a-z][\w-]*/i);if($)Q.tag=$[0].toLowerCase(),X=X.slice($[0].length);while(X.length>0){let Z=X.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(Z){if(Q.attr=Z[1],Z[3]!==void 0&&Z[3]!=="")Q.attrValue=Z[3];X=X.slice(Z[0].length);continue}let U=X.match(/^#([\w-]+)/);if(U){Q.id=U[1],X=X.slice(U[0].length);continue}let W=X.match(/^\.([\w-]+)/);if(W){Q.className=W[1],X=X.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function e(J,Y){if(Y.attr){if(!(Y.attrValue===void 0?new RegExp(`\\b${Y.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${Y.attr}\\s*=\\s*(["'])\\s*${Y.attrValue}\\s*\\1`,"i")).test(J))return!1}if(Y.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${Y.id}\\s*\\1`,"i").test(J))return!1}if(Y.className){let Q=J.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(Y.className))return!1}return!0}function x(J,Y="main"){let Q=t(Y);if(!Q)return null;let X=/<([a-z][\w-]*)\b([^>]*)>/gi,$=a(J),Z;while((Z=X.exec(J))!==null){if(C(Z.index,$))continue;let U=Z[1].toLowerCase(),W=Z[2]||"";if(W.trimEnd().endsWith("/")||o.has(U))continue;if(Q.tag&&Q.tag!==U)continue;if(!e(W,Q))continue;let j=Z[0],F=Z.index+j.length,K=new RegExp(`<(/?)${U}\\b([^>]*)>`,"gi");K.lastIndex=F;let G=1,B;while((B=K.exec(J))!==null){if(C(B.index,$))continue;let w=B[1]==="/";if(!w&&(B[2]||"").trimEnd().endsWith("/"))continue;if(G+=w?-1:1,G===0)return{openTag:j,openIndex:Z.index,start:F,end:B.index,tagName:U}}return null}return null}var wJ="X-STX-Router",NJ="private, no-store";function AJ(J){return J.replace(/&#(\d+);/g,(Y,Q)=>f(Number(Q),Y)).replace(/&#x([0-9a-f]+);/gi,(Y,Q)=>f(Number.parseInt(Q,16),Y)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function f(J,Y){if(!Number.isInteger(J)||J<0||J>1114111)return Y;try{return String.fromCodePoint(J)}catch{return Y}}function g(J){return J.headers.get("X-STX-Router")==="true"}function JJ(J,Y){if(!J)return Y;return J.split(",").some((X)=>X.trim().toLowerCase()===Y.toLowerCase())?J:`${J}, ${Y}`}function IJ(J){return{Vary:JJ(J,"X-STX-Router")}}import E from"path";XJ();var $J="stx-page-head:",UJ=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,O=null;function WJ(){if(O!==null)return O;try{let{getRouterScript:J}=(ZJ(),QJ(YJ));O=`<script>${J()}</script>`}catch{O=""}return O}async function MJ(J,Y){if(Y===!1)return null;if(Y&&typeof Y==="string"){let X=E.resolve(J,Y);if(await Bun.file(X).exists())return X;return null}let Q=E.join(J,"app.stx");if(await Bun.file(Q).exists())return Q;return null}async function bJ(J,Y){try{let Q=await Bun.file(J).text(),X=Q,$=Q.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if($)X=$[1].trim();let Z=y(Q),U=[...Z.client.map((V)=>V.fullTag),...Z.signals.map((V)=>V.fullTag)],W=[],j=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,F;while((F=j.exec(Q))!==null)W.push(F[0]);let K=X;for(let V of Z.server)K=K.replace(V.fullTag,"");for(let V of Z.client)K=K.replace(V.fullTag,"");K=K.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let G="<!--__STX_PAGE_SLOT__-->";if(K=K.replace(/<slot\s*\/>/gi,G).replace(/<slot\s*>\s*<\/slot>/gi,G),!K.includes(G))return console.warn(`[stx] Shell ${J} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:B,extractVariables:w,defaultConfig:N,loadStxConfig:I}=await import("./chunk-w33gx25k.js"),_=await I(),z={__filename:J,__dirname:E.dirname(J)};for(let V of U){let L=V.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(L&&!V.includes("client")&&!V.includes('type="module"'))await w(L[1],z,J)}let A=await B(K,z,J,{...N,..._,...Y},new Set),H=A.indexOf(G);if(H===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:A.substring(0,H),afterSlot:A.substring(H+G.length),filePath:J,shellScripts:U,shellStyles:W}}catch(Q){return console.error(`[stx] Error processing shell ${J}:`,Q),null}}function PJ(J,Y,Q){let X,$="",Z=Y.match(UJ);if(Z){Y=Y.replace(Z[0],"");try{let K=Buffer.from(Z[1],"base64").toString("utf8"),G=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(G)X=G[1].trim();$=K.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let U=Q||X||"stx App",W=WJ(),j="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -26,5 +26,5 @@ ${W}
26
26
  `));if($.length>0)N.push($.join(`
27
27
  `));if(G.length>0)N.push(G.join(`
28
28
  `));return N.push(K),N.join(`
29
- `)}import M from"fs";import h from"path";function CJ(J,Y,Q){return{version:1,buildTime:new Date().toISOString(),routes:J,assets:Y,outputDir:Q}}function xJ(J,Y){let Q=h.join(Y,"manifest.json");M.writeFileSync(Q,JSON.stringify(J,null,2))}function fJ(J){let Y=h.join(J,"manifest.json");if(!M.existsSync(Y))return null;try{let Q=M.readFileSync(Y,"utf-8"),X=JSON.parse(Q);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Q){return console.warn("[stx] Failed to load manifest:",Q),null}}function b(J,Y,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(Y)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function KJ(J){let Y=J.headers.get("content-type")||"",Q={},X=($,Z)=>{let U=Q[$];if(U===void 0)Q[$]=Z;else if(Array.isArray(U))U.push(Z);else Q[$]=[U,Z]};if(Y.includes("multipart/form-data")){let $=await J.formData();for(let[Z,U]of $.entries())if(typeof U==="string")X(Z,U);return Q}if(Y.includes("application/x-www-form-urlencoded")){for(let[$,Z]of new URLSearchParams(await J.text()).entries())X($,Z);return Q}return Q}function FJ(J){if(!J)return!1;let Y=J.toUpperCase();return Y!=="GET"&&Y!=="HEAD"}async function p(J,Y={}){let Q=Y.request,X=Y.method??Q?.method;if(!Q||!FJ(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let $={};try{$=await KJ(Q)}catch{}let Z=await J.action({request:Q,form:$,params:Y.params??{},query:J.query??{},cookies:Y.cookies??{}});if(Z&&typeof Z==="object"){let U=Z,W=GJ(U.cookies),j=U.redirect;if(typeof j==="string"&&j)return{redirect:j,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:F,redirect:K,...G}=U;if(Object.assign(J,G),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function GJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let Y=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){Y.push(b(Q,X));continue}if(X&&typeof X==="object"){let $=X;if(typeof $.value!=="string")continue;Y.push(b(Q,$.value,$))}}return Y}function hJ(J,Y=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let $ of Y)X.append("Set-Cookie",$);for(let[$,Z]of Object.entries(Q??{}))if($.toLowerCase()!=="location")X.set($,Z);return new Response(null,{status:303,headers:X})}async function sJ(J,Y={}){return(await i(J,Y)).html}async function oJ(J,Y={}){let{html:Q,context:X,redirect:$,cookies:Z}=await i(J,Y),U=d(X),W=c(X);if($)return{html:Q,redirect:$,cookies:Z,status:U,headers:W};let{extractStreamBoundaries:j}=await import("./chunk-gg85dhn4.js"),F=j(X),K=J.streamTemplates;if(K&&Object.keys(K).length>0){let{processDirectives:G}=await import("./chunk-zrnh6ybt.js"),{defaultConfig:B}=await import("./chunk-1zw2abe0.js"),w=X.streamBoundaries||{},N={...B,autoShell:!1},I=Object.keys(K).map((z)=>({id:z,render:async()=>{let A=typeof w[z]==="function"?await w[z]():void 0;return G(K[z],{...X,$boundary:A},J.sourceFile,N,new Set)}})),_=new Set(I.map((z)=>z.id));F=[...(F||[]).filter((z)=>!_.has(z.id)),...I]}return{html:Q,boundaries:F&&F.length>0?F:void 0,cookies:Z,status:U,headers:W}}async function i(J,Y){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};if(!J.hasServerScripts&&!D(J.html))return{html:J.html,context:Q};for(let U of J.serverScriptContent)try{await T(U,Q,J.sourceFile)}catch(W){if(Y.__stx_strict_hydration)throw W;console.warn(`[stx] Server script error in ${J.sourceFile}:`,W)}let X=await p(Q,{request:Y.request,method:Y.method,params:Y.params??{},cookies:Y.cookies??{}}),$=(U)=>{let W=U.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),j=l(Q);if(!j)return W;let F=W.indexOf("</head>");return F<0?j+W:W.slice(0,F)+j+W.slice(F)};if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!D(J.html))return{html:$(J.html),context:Q,cookies:X.cookies};let Z=new Map;for(let[U,W]of Object.entries(J.placeholders))if(W.expression)try{let j=k(W.expression,Q);if(W.type==="raw")Z.set(U,j!==void 0&&j!==null?String(j):"");else Z.set(U,j!==void 0&&j!==null?R(String(j)):"")}catch(j){if(Y.__stx_strict_hydration)throw j;Z.set(U,"")}return{html:$(P(J.html,Z)),context:Q,cookies:X.cookies}}async function aJ(J,Y={}){if(!J.hasServerScripts&&!D(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};for(let $ of J.serverScriptContent)try{await T($,Q,J.sourceFile)}catch(Z){console.warn(`[stx] Server script error in ${J.sourceFile}:`,Z)}if(!D(J.fragment))return J.fragment;let X=new Map;for(let[$,Z]of Object.entries(J.placeholders))if(Z.expression)try{let U=k(Z.expression,Q);if(Z.type==="raw")X.set($,U!==void 0&&U!==null?String(U):"");else X.set($,U!==void 0&&U!==null?R(String(U)):"")}catch{X.set($,"")}return P(J.fragment,X)}
29
+ `)}import M from"fs";import h from"path";function CJ(J,Y,Q){return{version:1,buildTime:new Date().toISOString(),routes:J,assets:Y,outputDir:Q}}function xJ(J,Y){let Q=h.join(Y,"manifest.json");M.writeFileSync(Q,JSON.stringify(J,null,2))}function fJ(J){let Y=h.join(J,"manifest.json");if(!M.existsSync(Y))return null;try{let Q=M.readFileSync(Y,"utf-8"),X=JSON.parse(Q);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Q){return console.warn("[stx] Failed to load manifest:",Q),null}}function b(J,Y,Q={}){let X=`${encodeURIComponent(J)}=${encodeURIComponent(Y)}`;if(Q.maxAge!==void 0)X+=`; Max-Age=${Q.maxAge}`;if(Q.expires)X+=`; Expires=${Q.expires.toUTCString()}`;if(Q.path)X+=`; Path=${Q.path}`;if(Q.domain)X+=`; Domain=${Q.domain}`;if(Q.secure)X+="; Secure";if(Q.httpOnly)X+="; HttpOnly";if(Q.sameSite)X+=`; SameSite=${Q.sameSite}`;return X}async function KJ(J){let Y=J.headers.get("content-type")||"",Q={},X=($,Z)=>{let U=Q[$];if(U===void 0)Q[$]=Z;else if(Array.isArray(U))U.push(Z);else Q[$]=[U,Z]};if(Y.includes("multipart/form-data")){let $=await J.formData();for(let[Z,U]of $.entries())if(typeof U==="string")X(Z,U);return Q}if(Y.includes("application/x-www-form-urlencoded")){for(let[$,Z]of new URLSearchParams(await J.text()).entries())X($,Z);return Q}return Q}function FJ(J){if(!J)return!1;let Y=J.toUpperCase();return Y!=="GET"&&Y!=="HEAD"}async function p(J,Y={}){let Q=Y.request,X=Y.method??Q?.method;if(!Q||!FJ(X))return{ran:!1};if(typeof J.action!=="function")return{ran:!1};let $={};try{$=await KJ(Q)}catch{}let Z=await J.action({request:Q,form:$,params:Y.params??{},query:J.query??{},cookies:Y.cookies??{}});if(Z&&typeof Z==="object"){let U=Z,W=GJ(U.cookies),j=U.redirect;if(typeof j==="string"&&j)return{redirect:j,ran:!0,...W.length>0?{cookies:W}:{}};let{cookies:F,redirect:K,...G}=U;if(Object.assign(J,G),W.length>0)return{ran:!0,cookies:W}}return{ran:!0}}function GJ(J){if(!J||typeof J!=="object"||Array.isArray(J))return[];let Y=[];for(let[Q,X]of Object.entries(J)){if(!Q)continue;if(typeof X==="string"){Y.push(b(Q,X));continue}if(X&&typeof X==="object"){let $=X;if(typeof $.value!=="string")continue;Y.push(b(Q,$.value,$))}}return Y}function hJ(J,Y=[],Q){let X=new Headers({Location:J,"Cache-Control":"no-store"});for(let $ of Y)X.append("Set-Cookie",$);for(let[$,Z]of Object.entries(Q??{}))if($.toLowerCase()!=="location")X.set($,Z);return new Response(null,{status:303,headers:X})}async function sJ(J,Y={}){return(await i(J,Y)).html}async function oJ(J,Y={}){let{html:Q,context:X,redirect:$,cookies:Z}=await i(J,Y),U=d(X),W=c(X);if($)return{html:Q,redirect:$,cookies:Z,status:U,headers:W};let{extractStreamBoundaries:j}=await import("./chunk-f9qrz82p.js"),F=j(X),K=J.streamTemplates;if(K&&Object.keys(K).length>0){let{processDirectives:G}=await import("./chunk-9h4fkwtj.js"),{defaultConfig:B}=await import("./chunk-w3dfvxar.js"),w=X.streamBoundaries||{},N={...B,autoShell:!1},I=Object.keys(K).map((z)=>({id:z,render:async()=>{let A=typeof w[z]==="function"?await w[z]():void 0;return G(K[z],{...X,$boundary:A},J.sourceFile,N,new Set)}})),_=new Set(I.map((z)=>z.id));F=[...(F||[]).filter((z)=>!_.has(z.id)),...I]}return{html:Q,boundaries:F&&F.length>0?F:void 0,cookies:Z,status:U,headers:W}}async function i(J,Y){let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};if(!J.hasServerScripts&&!D(J.html))return{html:J.html,context:Q};for(let U of J.serverScriptContent)try{await T(U,Q,J.sourceFile)}catch(W){if(Y.__stx_strict_hydration)throw W;console.warn(`[stx] Server script error in ${J.sourceFile}:`,W)}let X=await p(Q,{request:Y.request,method:Y.method,params:Y.params??{},cookies:Y.cookies??{}}),$=(U)=>{let W=U.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),j=l(Q);if(!j)return W;let F=W.indexOf("</head>");return F<0?j+W:W.slice(0,F)+j+W.slice(F)};if(X.redirect)return{html:J.html,context:Q,redirect:X.redirect,cookies:X.cookies};if(!D(J.html))return{html:$(J.html),context:Q,cookies:X.cookies};let Z=new Map;for(let[U,W]of Object.entries(J.placeholders))if(W.expression)try{let j=k(W.expression,Q);if(W.type==="raw")Z.set(U,j!==void 0&&j!==null?String(j):"");else Z.set(U,j!==void 0&&j!==null?R(String(j)):"")}catch(j){if(Y.__stx_strict_hydration)throw j;Z.set(U,"")}return{html:$(P(J.html,Z)),context:Q,cookies:X.cookies}}async function aJ(J,Y={}){if(!J.hasServerScripts&&!D(J.fragment))return J.fragment;let Q={__filename:J.sourceFile,__dirname:J.sourceFile.replace(/[/\\][^/\\]+$/,""),...Y};for(let $ of J.serverScriptContent)try{await T($,Q,J.sourceFile)}catch(Z){console.warn(`[stx] Server script error in ${J.sourceFile}:`,Z)}if(!D(J.fragment))return J.fragment;let X=new Map;for(let[$,Z]of Object.entries(J.placeholders))if(Z.expression)try{let U=k(Z.expression,Q);if(Z.type==="raw")X.set($,U!==void 0&&U!==null?String(U):"");else X.set($,U!==void 0&&U!==null?R(String(U)):"")}catch{X.set($,"")}return P(J.fragment,X)}
30
30
  export{r as gg,y as hg,t as ig,x as jg,wJ as kg,NJ as lg,AJ as mg,g as ng,JJ as og,IJ as pg,MJ as qg,bJ as rg,PJ as sg,jJ as tg,RJ as ug,kJ as vg,CJ as wg,xJ as xg,fJ as yg,b as zg,KJ as Ag,FJ as Bg,p as Cg,hJ as Dg,sJ as Eg,oJ as Fg,aJ as Gg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Mo as a,No as b,Oo as c,Po as d,Qo as e,Ro as f,So as g,To as h,Uo as i,Vo as j}from"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
2
+ import{Mo as a,No as b,Oo as c,Po as d,Qo as e,Ro as f,So as g,To as h,Uo as i,Vo as j}from"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{em as c,hm as d,im as e,jm as f,km as g,lm as h,mm as i,nm as j,om as k,pm as l,qm as m}from"./chunk-4zkwqprq.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import{it as a,jt as b}from"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-bnw3wnw8.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-fxjyj3j9.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,m as processClientScript,g as injectBrowserCoreAutoImports,l as generateServerDataBridge,j as generateBrowserAutoImportDestructuring,i as generateAutoImportDestructuring,a as findInterpolationEnd,k as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
2
+ import{em as c,hm as d,im as e,jm as f,km as g,lm as h,mm as i,nm as j,om as k,pm as l,qm as m}from"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import{it as a,jt as b}from"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,m as processClientScript,g as injectBrowserCoreAutoImports,l as generateServerDataBridge,j as generateBrowserAutoImportDestructuring,i as generateAutoImportDestructuring,a as findInterpolationEnd,k as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  import{ew as H}from"./chunk-jryjwara.js";import P from"path";var $=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function G(...v){let w=new Set;for(let q of v){if(!q||!q.includes("__stxModules["))continue;for(let z of q.matchAll($))try{w.add(JSON.parse(`"${z[1]}"`))}catch{}}return[...w].sort()}async function T(v,w={}){if(v.length===0)return null;let q=process.cwd(),z=[],J=[];v.forEach((j,X)=>{let Z=j.startsWith("npm:")?j.slice(4):P.resolve(q,j),N=`__stxRegistered${X}`,O=JSON.stringify(j);z.push(`import * as ${N} from ${JSON.stringify(Z)};`),J.push(`if (!globalThis.__stxModules[${O}]) globalThis.__stxModules[${O}] = ${N};`)});let L=[...z,"globalThis.__stxModules = globalThis.__stxModules || {};",...J].join(`
3
- `),B;try{let{bundleClientScript:j}=await import("./chunk-t088w4j2.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-pn60d9sp.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-9aw5d4rr.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
3
+ `),B;try{let{bundleClientScript:j}=await import("./chunk-8618n28z.js");B=await j(L,P.join(q,".stx-module-registry.ts"),{projectRoot:q,minify:w.minify,externalizeUserModules:!1})}catch(j){return console.warn("[stx] could not build the page module registry (#1957):",j),null}let{transformAutoImports:Q,generateAutoImportDestructuring:U}=await import("./chunk-hxf6zg80.js"),F=Q(B),V=U(F.stxImports,F.browserImports),{transformStoreImports:W}=await import("./chunk-9aw5d4rr.js");B=W(F.code);let M=JSON.stringify(new Bun.CryptoHasher("md5").update(L).digest("hex").slice(0,12));return[";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${M}]) return;`,` __stxBundles[${M}] = true;`,V,B,"})();"].join(`
4
4
  `)}export{G as registeredModuleIdsIn,T as buildModuleRegistryScript};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{oq as M,sq as x}from"./chunk-4zkwqprq.js";import{yt as T}from"./chunk-bnw3wnw8.js";import{ew as N}from"./chunk-jryjwara.js";import V from"fs";import Z from"path";var y=new Map,W=new Map;async function R(j){let z;for(let J=0;J<3;J++)try{let X=(await V.promises.stat(j)).mtime.getTime(),Q=W.get(j);if(Q&&Q.mtime===X)return Q.content;let Y=await Bun.file(j).text(),K=(await V.promises.stat(j)).mtime.getTime();if(K!==X)continue;return W.set(j,{content:Y,mtime:K}),Y}catch(I){z=I;break}throw W.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function S(j){W.delete(j)}function _(j){for(let B of W.keys())if(B.startsWith(j))W.delete(B)}var q=null,w=null,G=null;function C(j){G=j}async function b(j=!1){let B=G??await import("./chunk-px0hqf1q.js");if(j)return B.generateSignalsRuntimeDev();if(q===null)q=B.generateSignalsRuntime();return q}var D=null;async function A(){if(D===null){let{getRouterScript:j}=await import("./chunk-wvfed9sj.js");D=j()}return D}var L={};async function g(j,B=!1){let z=j==="runtime"?await b(B):await A(),J=j==="runtime"&&B?"runtime-debug":j,I=L[J];if(!I||I.content!==z)I={content:z,hash:Bun.hash(z).toString(16).padStart(16,"0").slice(0,16)},L[J]=I;return{content:z,hash:I.hash,url:`/_stx/${j}.${I.hash}.js`}}function u(){W.clear(),x(),T(),q=null,w=null,D=null}function O(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}async function P(j,B){try{if(!B.cachePath)return null;let z=Z.resolve(B.cachePath),J=Z.join(z,`${U(j)}.html`),I=Z.join(z,`${U(j)}.meta.json`);if(!await M(J)||!await M(I))return null;let X=await Bun.file(I).text(),Q=JSON.parse(X);if(Q.cacheVersion!==B.cacheVersion)return null;if(Q.optionsSignature!==O(B))return null;if((await V.promises.stat(j)).mtime.getTime()>Q.mtime)return null;for(let $ of Q.dependencies)if(await M($)){if((await V.promises.stat($)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function p(j,B,z,J){try{if(!J.cachePath)return;let I=Z.resolve(J.cachePath);await V.promises.mkdir(I,{recursive:!0});let X=Z.join(I,`${U(j)}.html`),Q=Z.join(I,`${U(j)}.meta.json`),Y=await V.promises.stat(j);await Bun.write(X,B);let $={sourcePath:j,mtime:Y.mtime.getTime(),dependencies:Array.from(z),cacheVersion:J.cacheVersion,optionsSignature:O(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify($,null,2)),y.set(j,{output:B,mtime:Y.mtime.getTime(),dependencies:z})}catch(I){console.warn(`Failed to cache template ${j}:`,I)}}var v=16;function U(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,v)}
2
+ import{oq as M,sq as x}from"./chunk-spzbfqjn.js";import{yt as T}from"./chunk-egr5663e.js";import{ew as N}from"./chunk-jryjwara.js";import V from"fs";import Z from"path";var y=new Map,W=new Map;async function R(j){let z;for(let J=0;J<3;J++)try{let X=(await V.promises.stat(j)).mtime.getTime(),Q=W.get(j);if(Q&&Q.mtime===X)return Q.content;let Y=await Bun.file(j).text(),K=(await V.promises.stat(j)).mtime.getTime();if(K!==X)continue;return W.set(j,{content:Y,mtime:K}),Y}catch(I){z=I;break}throw W.delete(j),Error(`File not found: ${j}${z?` (${z.message})`:""}`)}function S(j){W.delete(j)}function _(j){for(let B of W.keys())if(B.startsWith(j))W.delete(B)}var q=null,w=null,G=null;function C(j){G=j}async function b(j=!1){let B=G??await import("./chunk-px0hqf1q.js");if(j)return B.generateSignalsRuntimeDev();if(q===null)q=B.generateSignalsRuntime();return q}var D=null;async function A(){if(D===null){let{getRouterScript:j}=await import("./chunk-tzhcjtkr.js");D=j()}return D}var L={};async function g(j,B=!1){let z=j==="runtime"?await b(B):await A(),J=j==="runtime"&&B?"runtime-debug":j,I=L[J];if(!I||I.content!==z)I={content:z,hash:Bun.hash(z).toString(16).padStart(16,"0").slice(0,16)},L[J]=I;return{content:z,hash:I.hash,url:`/_stx/${j}.${I.hash}.js`}}function u(){W.clear(),x(),T(),q=null,w=null,D=null}function O(j){let B={debug:j.debug===!0,middleware:(j.middleware??[]).map((z)=>({name:z.name,timing:z.timing,handler:String(z.handler)})),customDirectives:(j.customDirectives??[]).map((z)=>({name:z.name,hasEndTag:z.hasEndTag===!0,handler:String(z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(B)).digest("hex")}async function P(j,B){try{if(!B.cachePath)return null;let z=Z.resolve(B.cachePath),J=Z.join(z,`${U(j)}.html`),I=Z.join(z,`${U(j)}.meta.json`);if(!await M(J)||!await M(I))return null;let X=await Bun.file(I).text(),Q=JSON.parse(X);if(Q.cacheVersion!==B.cacheVersion)return null;if(Q.optionsSignature!==O(B))return null;if((await V.promises.stat(j)).mtime.getTime()>Q.mtime)return null;for(let $ of Q.dependencies)if(await M($)){if((await V.promises.stat($)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(z){return console.warn(`Cache error for ${j}:`,z),null}}async function p(j,B,z,J){try{if(!J.cachePath)return;let I=Z.resolve(J.cachePath);await V.promises.mkdir(I,{recursive:!0});let X=Z.join(I,`${U(j)}.html`),Q=Z.join(I,`${U(j)}.meta.json`),Y=await V.promises.stat(j);await Bun.write(X,B);let $={sourcePath:j,mtime:Y.mtime.getTime(),dependencies:Array.from(z),cacheVersion:J.cacheVersion,optionsSignature:O(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify($,null,2)),y.set(j,{output:B,mtime:Y.mtime.getTime(),dependencies:z})}catch(I){console.warn(`Failed to cache template ${j}:`,I)}}var v=16;function U(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,v)}
3
3
  export{y as Uj,R as Vj,S as Wj,_ as Xj,C as Yj,b as Zj,A as _j,g as $j,u as ak,P as bk,p as ck,U as dk};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{qu as a,ru as b}from"./chunk-ndyxw7f5.js";import"./chunk-18p8dqya.js";import"./chunk-jryjwara.js";export{a as prepareRuntimeConfig,b as generateRuntimeConfigTypes};
2
+ import{qu as a,ru as b}from"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-jryjwara.js";export{a as prepareRuntimeConfig,b as generateRuntimeConfigTypes};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ye as a}from"./chunk-prry9kgy.js";import"./chunk-gpesxpwq.js";import"./chunk-dvvx1wny.js";import"./chunk-zebypbks.js";import"./chunk-spzbfqjn.js";import"./chunk-raxr83fs.js";import"./chunk-at84gyvf.js";import"./chunk-397rqs12.js";import"./chunk-aqrp68m6.js";import"./chunk-egr5663e.js";import"./chunk-jwnbwemq.js";import"./chunk-ry1key0g.js";import"./chunk-4ee1aaet.js";import"./chunk-wkcnyv6m.js";import"./chunk-18p8dqya.js";import"./chunk-64ttktzc.js";import"./chunk-xcsf7my7.js";import"./chunk-2kv2gnzc.js";import"./chunk-ttny9g8k.js";import"./chunk-bbq82jww.js";import"./chunk-9ebfmdyb.js";import"./chunk-jryjwara.js";export{a as startProductionServer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{em as e,eo as f,fo as h,go as u,ho as l,po as m}from"./chunk-4zkwqprq.js";import{jt as D}from"./chunk-397rqs12.js";import{Uu as g}from"./chunk-ttny9g8k.js";import JJ from"path";import C from"fs";import S from"path";function k(K,Z,$,J){let Q=0;for(let j=Z;j<K.length;j++)if(K[j]===$)Q++;else if(K[j]===J&&!(J===">"&&K[j-1]==="=")){if(--Q===0)return j}return-1}function WJ(K){let Z=D(K),$=0,J=0,Q=[];for(let j=0;j<Z.length;j++)if("([{".includes(Z[j]))$++;else if(")]}".includes(Z[j]))$--;else if(Z[j]===","&&$===0)Q.push(K.slice(J,j).trim()),J=j+1;return Q.push(K.slice(J).trim()),Q}function R(K,Z){let $=D(K),J=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of $.matchAll(J)){let j=Q.index+Q[0].length,G="";if($[j]==="<"){let U=k($,j,"<",">");if(U<0)continue;G=K.slice(j+1,U),j=U+1;while(/\s/.test($[j]||"")&&j<$.length)j++}if($[j]!=="(")continue;let W=k($,j,"(",")");if(W>=0)return{type:G,args:WJ(K.slice(j+1,W))}}return null}var x=`
2
+ import{em as e,eo as f,fo as h,go as u,ho as l,po as m}from"./chunk-spzbfqjn.js";import{jt as D}from"./chunk-397rqs12.js";import{Uu as g}from"./chunk-ttny9g8k.js";import JJ from"path";import C from"fs";import S from"path";function k(K,Z,$,J){let Q=0;for(let j=Z;j<K.length;j++)if(K[j]===$)Q++;else if(K[j]===J&&!(J===">"&&K[j-1]==="=")){if(--Q===0)return j}return-1}function WJ(K){let Z=D(K),$=0,J=0,Q=[];for(let j=0;j<Z.length;j++)if("([{".includes(Z[j]))$++;else if(")]}".includes(Z[j]))$--;else if(Z[j]===","&&$===0)Q.push(K.slice(J,j).trim()),J=j+1;return Q.push(K.slice(J).trim()),Q}function R(K,Z){let $=D(K),J=new RegExp(`\\b(?:${Z.map((Q)=>Q.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let Q of $.matchAll(J)){let j=Q.index+Q[0].length,G="";if($[j]==="<"){let U=k($,j,"<",">");if(U<0)continue;G=K.slice(j+1,U),j=U+1;while(/\s/.test($[j]||"")&&j<$.length)j++}if($[j]!=="(")continue;let W=k($,j,"(",")");if(W>=0)return{type:G,args:WJ(K.slice(j+1,W))}}return null}var x=`
3
3
  type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
4
4
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
5
5
  type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;