@stacksjs/stx 0.2.806 → 0.2.810

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 (85) hide show
  1. package/dist/{chunk-avxppqs2.js → chunk-09dfp38y.js} +1 -1
  2. package/dist/{chunk-q4h6qqnx.js → chunk-0d2wgdv3.js} +1 -1
  3. package/dist/chunk-0khbjbvg.js +2 -0
  4. package/dist/{chunk-mgadcrww.js → chunk-0z96accg.js} +4 -4
  5. package/dist/{chunk-6d2vmbe5.js → chunk-1dvj9fk1.js} +1 -1
  6. package/dist/chunk-1xj0vmrs.js +2 -0
  7. package/dist/chunk-32wcsw1n.js +2 -0
  8. package/dist/{chunk-nzqxed1d.js → chunk-43g83xk1.js} +1 -1
  9. package/dist/{chunk-08wa1md0.js → chunk-4k42f3ca.js} +1 -1
  10. package/dist/chunk-51q4z1g6.js +2 -0
  11. package/dist/{chunk-7202hcz5.js → chunk-61j62gya.js} +1 -1
  12. package/dist/{chunk-svbymgat.js → chunk-6df7h4ay.js} +4 -4
  13. package/dist/chunk-6k0273zm.js +2 -0
  14. package/dist/chunk-6tefkmq9.js +2 -0
  15. package/dist/{chunk-cg2zq9bx.js → chunk-87c3w0xd.js} +1 -1
  16. package/dist/{chunk-4pf2zamx.js → chunk-93rd9wf9.js} +1 -1
  17. package/dist/{chunk-kmva29mx.js → chunk-9k4fvbrz.js} +1 -1
  18. package/dist/{chunk-74vh3mkn.js → chunk-9pcrtvje.js} +1 -1
  19. package/dist/{chunk-2r9xpsvf.js → chunk-af54x4dj.js} +1 -1
  20. package/dist/{chunk-w5m60jvz.js → chunk-awvgv3wx.js} +4 -4
  21. package/dist/{chunk-grbpwg3w.js → chunk-bkjfbhyp.js} +1 -1
  22. package/dist/{chunk-hn2me1qx.js → chunk-bmkm1c8s.js} +8 -5
  23. package/dist/{chunk-0x14wwg4.js → chunk-d2nd3608.js} +1 -1
  24. package/dist/{chunk-q75dt2k5.js → chunk-damrq7b8.js} +1 -1
  25. package/dist/chunk-e2ywh4ax.js +2 -0
  26. package/dist/{chunk-p3ma0p7m.js → chunk-ezdj63ds.js} +2 -2
  27. package/dist/{chunk-awd8yxgt.js → chunk-f1wwn3tg.js} +1 -1
  28. package/dist/{chunk-ge64g6kx.js → chunk-frq9x6th.js} +2 -2
  29. package/dist/{chunk-c7t22z4q.js → chunk-ftfvezbd.js} +1 -1
  30. package/dist/{chunk-3fprmhmc.js → chunk-gdc9s90b.js} +1 -1
  31. package/dist/{chunk-jebsepea.js → chunk-ge9fbfd0.js} +1 -1
  32. package/dist/{chunk-0ma47bxs.js → chunk-gmqtk1wn.js} +1 -1
  33. package/dist/{chunk-v5sk63p3.js → chunk-gqse3ae0.js} +1 -1
  34. package/dist/{chunk-w1dpknpd.js → chunk-h7h38k0r.js} +1 -1
  35. package/dist/{chunk-rjadbasx.js → chunk-h8mqh8ds.js} +2 -2
  36. package/dist/{chunk-2fjn0p49.js → chunk-h8p8ekbk.js} +1 -1
  37. package/dist/{chunk-y8f6b8hz.js → chunk-hn5tnxk1.js} +2 -2
  38. package/dist/chunk-hv5wqtq6.js +2 -0
  39. package/dist/{chunk-v315gfg7.js → chunk-j68h08nm.js} +1 -1
  40. package/dist/{chunk-r51j09px.js → chunk-jmzxgp9p.js} +1 -1
  41. package/dist/chunk-jye7txe4.js +3 -0
  42. package/dist/chunk-kgw99r6d.js +2 -0
  43. package/dist/{chunk-4vfrjf9g.js → chunk-knpzhqns.js} +1 -1
  44. package/dist/{chunk-cfbjf654.js → chunk-merxtsaf.js} +1 -1
  45. package/dist/{chunk-qcevvkbt.js → chunk-np3rrzg4.js} +1 -1
  46. package/dist/{chunk-pzbwnga6.js → chunk-nv77aaqa.js} +6 -6
  47. package/dist/chunk-p6b21gkk.js +2 -0
  48. package/dist/{chunk-8g7vp3ez.js → chunk-prj88r9z.js} +2 -2
  49. package/dist/{chunk-1hdjk3g6.js → chunk-q0em38za.js} +2 -2
  50. package/dist/{chunk-nrqv8s48.js → chunk-qckgv0vz.js} +1 -1
  51. package/dist/{chunk-ksxzn0ej.js → chunk-qyqebgw2.js} +2 -2
  52. package/dist/{chunk-gbpx8cgx.js → chunk-r81yx50m.js} +1 -1
  53. package/dist/{chunk-tqt1r238.js → chunk-rmbm30ew.js} +3 -3
  54. package/dist/{chunk-8m3sq2av.js → chunk-ry9fpa1j.js} +1 -1
  55. package/dist/{chunk-ze3jn44s.js → chunk-s04bbm66.js} +1 -1
  56. package/dist/{chunk-wjdxjv5z.js → chunk-stdbnr1p.js} +1 -1
  57. package/dist/{chunk-czxagy9e.js → chunk-t8njsjr9.js} +4 -4
  58. package/dist/{chunk-xyp7ytt9.js → chunk-vqry8gqr.js} +1 -1
  59. package/dist/{chunk-sezkby30.js → chunk-x0s53atg.js} +1 -1
  60. package/dist/chunk-x293v8r5.js +2 -0
  61. package/dist/{chunk-baj56evy.js → chunk-x8663zag.js} +1 -1
  62. package/dist/{chunk-vtk3j75t.js → chunk-xz1qz9b9.js} +1 -1
  63. package/dist/{chunk-36t1dd5h.js → chunk-yd0b6am5.js} +1 -1
  64. package/dist/{chunk-pgnv7c0g.js → chunk-yehy1zs5.js} +5 -5
  65. package/dist/{chunk-h4fget39.js → chunk-yfpm91fg.js} +1 -1
  66. package/dist/chunk-zmtggvf0.js +2 -0
  67. package/dist/cli.js +7 -7
  68. package/dist/craft-entry.js +1 -1
  69. package/dist/craft.js +1 -1
  70. package/dist/pwa.js +1 -1
  71. package/dist/ssg.js +2 -2
  72. package/package.json +5 -5
  73. package/dist/chunk-2y5r17t7.js +0 -2
  74. package/dist/chunk-48wewqj0.js +0 -2
  75. package/dist/chunk-843vgf3d.js +0 -2
  76. package/dist/chunk-999yab6m.js +0 -2
  77. package/dist/chunk-b8swhn3k.js +0 -2
  78. package/dist/chunk-br3s0433.js +0 -2
  79. package/dist/chunk-hhxv14s1.js +0 -3
  80. package/dist/chunk-kqk6y6yz.js +0 -2
  81. package/dist/chunk-pdmem0aw.js +0 -2
  82. package/dist/chunk-v0efb82v.js +0 -2
  83. package/dist/chunk-w040grtj.js +0 -2
  84. package/dist/chunk-y2enams2.js +0 -2
  85. package/dist/chunk-ypjxp2vs.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{W,Ne}from"./chunk-pzbwnga6.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Qt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{W,Ne}from"./chunk-nv77aaqa.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Qt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{Qt};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{_}from"./chunk-pzbwnga6.js";import{i}from"./chunk-svbymgat.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
2
+ import{_}from"./chunk-nv77aaqa.js";import{i}from"./chunk-6df7h4ay.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let n=u[t[0]];console.log(`
3
3
  ${e.bold}${t[0]}${e.reset} - ${n.description}`),console.log(` Usage: ${e.cyan}${n.usage}${e.reset}
4
4
  `)}else{console.log(`
5
5
  ${e.bold}Available Commands:${e.reset}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ps,or,Of}from"./chunk-knpzhqns.js";import"./chunk-y7sf7aj0.js";import"./chunk-hn5tnxk1.js";import"./chunk-0z96accg.js";import"./chunk-1carv1dw.js";import"./chunk-h8mqh8ds.js";import"./chunk-93rd9wf9.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import{At}from"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Of as declareBareLoopHead,At as parseLoopBinding,or as processLoops,ps as reportDeferredLoopWarnings};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{fr}from"./chunk-hn2me1qx.js";import{$r}from"./chunk-gebb12ak.js";import{a}from"./chunk-rjadbasx.js";import{j,Ye}from"./chunk-cmnze7at.js";import{dc}from"./chunk-6s9bk98p.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function ar(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function X(e,r={}){return new fr(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=X(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function be(e){return e.includes("data-stx-runtime")}function lc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=ar(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
2
+ import{fr}from"./chunk-bmkm1c8s.js";import{$r}from"./chunk-gebb12ak.js";import{a}from"./chunk-h8mqh8ds.js";import{j,Ye}from"./chunk-cmnze7at.js";import{dc}from"./chunk-6s9bk98p.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function ar(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function X(e,r={}){return new fr(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=X(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function be(e){return e.includes("data-stx-runtime")}function lc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=ar(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
3
3
  `+e.slice(t);let n=$r(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
5
5
  `+e.slice(o)}if(j(e))return Ye(e,(o)=>`${o}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function cr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-2r9xpsvf.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-2r9xpsvf.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function uc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${dc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
7
+ ${e}`}async function cr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-af54x4dj.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-af54x4dj.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function uc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${dc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function we(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-2r9xpsvf.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
9
+ ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function we(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-af54x4dj.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
10
10
  `)}"></script>
11
11
  `}else i.ownedRoutes=g}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
12
- `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-2r9xpsvf.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
12
+ `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-af54x4dj.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
13
13
  </body>`+e.slice(d+7)}
14
14
  export{ar,X,be,lc,cr,uc,we};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{xe,mi,hi,sg,Nt,qc,og,Kc,Kh,De,yn,Le}from"./chunk-pzbwnga6.js";import{el,r}from"./chunk-3vpgr6nk.js";import"./chunk-c7t22z4q.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{xe as BROWSER_CORE_IMPORTS,sg as STX_AUTO_IMPORTS,mi as extractAndStripCssImports,De as extractBridgeData,el as findInterpolationEnd,Kc as generateAutoImportDestructuring,Kh as generateBrowserAutoImportDestructuring,yn as generateServerDataBridge,Nt as injectBrowserCoreAutoImports,Le as processClientScript,og as referencesName,hi as renderVendorStyleTags,r as stripCommentsAndLiterals,qc as transformAutoImports};
2
+ import{xe,mi,hi,sg,Nt,qc,og,Kc,Kh,De,yn,Le}from"./chunk-nv77aaqa.js";import{el,r}from"./chunk-3vpgr6nk.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{xe as BROWSER_CORE_IMPORTS,sg as STX_AUTO_IMPORTS,mi as extractAndStripCssImports,De as extractBridgeData,el as findInterpolationEnd,Kc as generateAutoImportDestructuring,Kh as generateBrowserAutoImportDestructuring,yn as generateServerDataBridge,Nt as injectBrowserCoreAutoImports,Le as processClientScript,og as referencesName,hi as renderVendorStyleTags,r as stripCommentsAndLiterals,qc as transformAutoImports};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tr,i}from"./chunk-6df7h4ay.js";import"./chunk-ezdj63ds.js";import"./chunk-t8njsjr9.js";import"./chunk-c84pxd2k.js";import"./chunk-9pcrtvje.js";import"./chunk-jye7txe4.js";import"./chunk-knpzhqns.js";import"./chunk-y7sf7aj0.js";import"./chunk-hn5tnxk1.js";import{we}from"./chunk-0z96accg.js";import"./chunk-1carv1dw.js";import"./chunk-4k42f3ca.js";import"./chunk-h8mqh8ds.js";import"./chunk-93rd9wf9.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import{Oe,zs,Hs}from"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{tr as buildModulesTag,we as injectRouterScript,i as processDirectives,zs as processJsonDirective,Hs as processOnceDirective,Oe as validateClientScript};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{oa,Yg,ia,Zg,Dl,Ll,Qg,em}from"./chunk-r81yx50m.js";import"./chunk-d2nd3608.js";import"./chunk-ge9fbfd0.js";import"./chunk-prj88r9z.js";import"./chunk-7sh9fa3q.js";import"./chunk-hn5tnxk1.js";import"./chunk-0z96accg.js";import"./chunk-1carv1dw.js";import"./chunk-h8mqh8ds.js";import"./chunk-93rd9wf9.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import{Pt,Jf}from"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{oa as buildScriptVirtualFile,Yg as buildVirtualSource,Pt as extractScriptBlocks,Jf as extractTemplateExpressions,Dl as findRuntimeTypeDeclarations,Ll as findStxModuleDeclarations,em as formatTypecheckDiagnostics,Zg as sourcePathFor,Qg as typecheckStxFiles,ia as virtualPathFor};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{If,ds}from"./chunk-74vh3mkn.js";import"./chunk-hhxv14s1.js";import"./chunk-y7sf7aj0.js";import"./chunk-1carv1dw.js";import{kr}from"./chunk-pzbwnga6.js";import"./chunk-c7t22z4q.js";import"./chunk-m7hfcxt3.js";import{st}from"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{st as freeIdentifiers,ds as processComponents,If as processESImports,kr as rendersAsElement};
2
+ import{If,ds}from"./chunk-9pcrtvje.js";import"./chunk-jye7txe4.js";import"./chunk-y7sf7aj0.js";import"./chunk-1carv1dw.js";import{kr}from"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import{st}from"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{st as freeIdentifiers,ds as processComponents,If as processESImports,kr as rendersAsElement};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Rc,s,fe}from"./chunk-pzbwnga6.js";import{nt}from"./chunk-5emrarpf.js";import{c}from"./chunk-0rjcbqk3.js";import o from"fs";import l from"path";var Df=new Map,m=new Map;async function Oh(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function Nh(e){m.delete(e)}function Mh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Dh(e){x=e}async function Lf(e=!1){let t=x??await import("./chunk-1ydz2w3t.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function jf(){if(S===null){let{getRouterScript:e}=await import("./chunk-nrqv8s48.js");S=e()}return S}var y={};async function Lh(e,t=!1){let n=e==="runtime"?await Lf(t):await jf(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,u=new Map,p=0;function C(e){return c(process.cwd(),"module-bundles",`${e}.js`)}function jh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=u.get(t),i=n!==void 0;if(i)u.delete(t),p-=n.length*2;u.set(t,e),p+=e.length*2;while(u.size>1&&(u.size>E||p>T)){let r=u.keys().next().value;p-=u.get(r).length*2,u.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(l.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function Xo(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function Bh(){m.clear(),fe(),Rc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function lr(e,t){try{if(!t.cachePath)return null;let n=l.resolve(t.cachePath),i=l.join(n,`${vs(e)}.html`),r=l.join(n,`${vs(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==nt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function ur(e,t,n,i){try{if(!i.cachePath)return;let r=l.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=l.join(r,`${vs(e)}.html`),a=l.join(r,`${vs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:nt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Df.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function vs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
2
+ import{Rc,s,fe}from"./chunk-nv77aaqa.js";import{nt}from"./chunk-5emrarpf.js";import{c}from"./chunk-0rjcbqk3.js";import o from"fs";import l from"path";var Df=new Map,m=new Map;async function Oh(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(r){n=r;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function Nh(e){m.delete(e)}function Mh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function Dh(e){x=e}async function Lf(e=!1){let t=x??await import("./chunk-1ydz2w3t.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function jf(){if(S===null){let{getRouterScript:e}=await import("./chunk-qckgv0vz.js");S=e()}return S}var y={};async function Lh(e,t=!1){let n=e==="runtime"?await Lf(t):await jf(),i=e==="runtime"&&t?"runtime-debug":e,r=y[i];if(!r||r.content!==n)r={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=r;return{content:n,hash:r.hash,url:`/_stx/${e}.${r.hash}.js`}}var E=500,T=33554432,u=new Map,p=0;function C(e){return c(process.cwd(),"module-bundles",`${e}.js`)}function jh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=u.get(t),i=n!==void 0;if(i)u.delete(t),p-=n.length*2;u.set(t,e),p+=e.length*2;while(u.size>1&&(u.size>E||p>T)){let r=u.keys().next().value;p-=u.get(r).length*2,u.delete(r)}if(!i)try{let r=C(t);if(!o.existsSync(r))o.mkdirSync(l.dirname(r),{recursive:!0}),o.writeFileSync(r,e)}catch{}return`/_stx/modules.${t}.js`}function Xo(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function Bh(){m.clear(),fe(),Rc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function lr(e,t){try{if(!t.cachePath)return null;let n=l.resolve(t.cachePath),i=l.join(n,`${vs(e)}.html`),r=l.join(n,`${vs(e)}.meta.json`);if(!await s(i)||!await s(r))return null;let g=await Bun.file(r).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==nt())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await s(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function ur(e,t,n,i){try{if(!i.cachePath)return;let r=l.resolve(i.cachePath);await o.promises.mkdir(r,{recursive:!0});let g=l.join(r,`${vs(e)}.html`),a=l.join(r,`${vs(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:nt(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Df.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(r){console.warn(`Failed to cache template ${e}:`,r)}}var _=16;function vs(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
3
3
  export{Df,Oh,Nh,Mh,Dh,Lf,jf,Lh,jh,Xo,Bh,lr,ur,vs};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{tm}from"./chunk-ry9fpa1j.js";import"./chunk-rmbm30ew.js";import"./chunk-gb3tv53p.js";import"./chunk-09dfp38y.js";import"./chunk-prj88r9z.js";import"./chunk-6df7h4ay.js";import"./chunk-ezdj63ds.js";import"./chunk-t8njsjr9.js";import"./chunk-c84pxd2k.js";import"./chunk-9pcrtvje.js";import"./chunk-jye7txe4.js";import"./chunk-knpzhqns.js";import"./chunk-y7sf7aj0.js";import"./chunk-hn5tnxk1.js";import"./chunk-0z96accg.js";import"./chunk-1carv1dw.js";import"./chunk-4k42f3ca.js";import"./chunk-h8mqh8ds.js";import"./chunk-93rd9wf9.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{tm as buildForProduction};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-ybjfr7e8.js";import"./chunk-r9e0r6jx.js";import"./chunk-gebb12ak.js";import{b,x,C,Y}from"./chunk-pzbwnga6.js";import"./chunk-m7hfcxt3.js";import"./chunk-c7t22z4q.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,S=b(64),w=new Set,k=0,R=new Set(h);function T(){l.clear(),S.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=S.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(w.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),S.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-ybjfr7e8.js";import"./chunk-r9e0r6jx.js";import"./chunk-gebb12ak.js";import{b,x,C,Y}from"./chunk-nv77aaqa.js";import"./chunk-m7hfcxt3.js";import"./chunk-ftfvezbd.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,S=b(64),w=new Set,k=0,R=new Set(h);function T(){l.clear(),S.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=S.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(w.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),S.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Lt,ie,u,f,A,t,ae,q,l,ke,ki,F,Sn,_i,Ft,Ci,rl,Rr,sl,it,ol,Ar,il,kn,Ei,al,Pr,Or,_e,Ti}from"./chunk-gebb12ak.js";import{ai,$c,o,C,Oe,pn,Ne,pe,G,vr,fn,Bs,jc,mn,Cr,zs,Hs,Bc,fi,Fc,zc,Hc,Vc,De,Le,Vs,Fe,s,bn,h,p,U,Z,Se,_,T}from"./chunk-pzbwnga6.js";import{Dt}from"./chunk-m7hfcxt3.js";import{vn}from"./chunk-c7t22z4q.js";import{y}from"./chunk-p3ma0p7m.js";import{gr,Ps}from"./chunk-hn2me1qx.js";import{pc,fc,dr,Qe,gc,I}from"./chunk-rjadbasx.js";import{Zo,Qo,ei,ti}from"./chunk-3z0e637x.js";import{ac,ds}from"./chunk-74vh3mkn.js";import{as,cs,ls}from"./chunk-czxagy9e.js";import{ms,Uo,Wo,hs,ys,qo}from"./chunk-y8f6b8hz.js";import{ps,or}from"./chunk-4vfrjf9g.js";import{Do}from"./chunk-c84pxd2k.js";import{se,Fo,zo,Ho}from"./chunk-y7sf7aj0.js";import{ar,be,lc,cr,uc}from"./chunk-mgadcrww.js";import{j,Ye}from"./chunk-cmnze7at.js";import{mc,hc}from"./chunk-4pf2zamx.js";import{E,_n,$i}from"./chunk-c5vzr1va.js";import us from"fs";import ce from"path";function dt(){return`
2
+ import{Lt,ie,u,f,A,t,ae,q,l,ke,ki,F,Sn,_i,Ft,Ci,rl,Rr,sl,it,ol,Ar,il,kn,Ei,al,Pr,Or,_e,Ti}from"./chunk-gebb12ak.js";import{ai,$c,o,C,Oe,pn,Ne,pe,G,vr,fn,Bs,jc,mn,Cr,zs,Hs,Bc,fi,Fc,zc,Hc,Vc,De,Le,Vs,Fe,s,bn,h,p,U,Z,Se,_,T}from"./chunk-nv77aaqa.js";import{Dt}from"./chunk-m7hfcxt3.js";import{vn}from"./chunk-ftfvezbd.js";import{y}from"./chunk-ezdj63ds.js";import{gr,Ps}from"./chunk-bmkm1c8s.js";import{pc,fc,dr,Qe,gc,I}from"./chunk-h8mqh8ds.js";import{Zo,Qo,ei,ti}from"./chunk-3z0e637x.js";import{ac,ds}from"./chunk-9pcrtvje.js";import{as,cs,ls}from"./chunk-t8njsjr9.js";import{ms,Uo,Wo,hs,ys,qo}from"./chunk-hn5tnxk1.js";import{ps,or}from"./chunk-knpzhqns.js";import{Do}from"./chunk-c84pxd2k.js";import{se,Fo,zo,Ho}from"./chunk-y7sf7aj0.js";import{ar,be,lc,cr,uc}from"./chunk-0z96accg.js";import{j,Ye}from"./chunk-cmnze7at.js";import{mc,hc}from"./chunk-93rd9wf9.js";import{E,_n,$i}from"./chunk-c5vzr1va.js";import us from"fs";import ce from"path";function dt(){return`
3
3
  // STX Lifecycle Runtime
4
4
  (function() {
5
5
  if (typeof window === 'undefined') return;
@@ -1558,7 +1558,7 @@ ${M}
1558
1558
  </style>`;a=a.replace(x,O),v.lastIndex=0}catch(M){}}}return a}import ot from"path";var rs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ss=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function os(r,e){if(!e||!r.includes("/"))return r;let c=ot.dirname(e);return r.replace(rs,(a,d,n,g)=>{let v=ot.resolve(c,g);return`${d}${n}${v.split(ot.sep).join("/")}${n}`})}function un(r,e){if(!e||!r.includes("<script"))return r;return r.replace(ss,(c,a,d,n)=>`${a}${os(d,e)}${n}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function dn(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function En(r,e){let c=r.length,a=e,d=!0,n=[],g=(v)=>v+9<=c&&r[v]==="<"&&r[v+1]==="/"&&(r[v+2]==="s"||r[v+2]==="S")&&(r[v+3]==="c"||r[v+3]==="C")&&(r[v+4]==="r"||r[v+4]==="R")&&(r[v+5]==="i"||r[v+5]==="I")&&(r[v+6]==="p"||r[v+6]==="P")&&(r[v+7]==="t"||r[v+7]==="T")&&(r[v+8]===">"||/\s/.test(r[v+8]));while(a<c){let v=r[a];if(g(a))return a;if(v==="/"&&r[a+1]==="/"){if(a=r.indexOf(`
1559
1559
  `,a+2),a===-1)return-1;a+=1,d=!0;continue}if(v==="/"&&r[a+1]==="*"){let m=r.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,d=!0;continue}if(v==="/"&&d){let m=a+1,x=!1;while(m<c){let b=r[m];if(b==="\\"){m+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){m++;break}else if(b===`
1560
1560
  `){m=-1;break}m++}if(m===-1){a++,d=!1;continue}while(m<c&&/[a-z]/.test(r[m]))m++;a=m,d=!1;continue}if(v==="'"||v==='"'){let m=v;a++;while(a<c){if(r[a]==="\\"){a+=2;continue}if(r[a]===m){a++;break}if(r[a]===`
1561
- `)break;a++}d=!1;continue}if(v==="`"){a++;while(a<c){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}if(n.length===0)d=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<c){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,d=!1;break}if(r[a]==="$"&&r[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))d=!1;else d=!0;a++}return-1}function Tn(r,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let d=a.index+a[0].length,n=r.indexOf("</script>",d);if(n===-1)return null;let g=r.indexOf(">",n);if(g===-1)return null;return{start:a.index,end:g+1}}var fs=4096;async function at(r,e,c){if(c.buildMode!=="serve"||e.length<fs)return null;let{registerServeModuleBundle:a}=await import("./chunk-2r9xpsvf.js");return`<script ${r} src="${a(e)}"></script>`}async function tr(r,e,c,a){try{let{registeredModuleIdsIn:d,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-v315gfg7.js")),g=[],v=await n(d(...r),{minify:$i(e.buildMode,e.minifyClient),collectInputs:g});for(let m of g)c?.add(m);if(a)a.inputs=g,a.code=v??void 0;if(!v)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-2r9xpsvf.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(v)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${v.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function gs(r,e,c,a){let d={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:S}=await o("stx/framework-composables",()=>import("./chunk-7202hcz5.js"));d.frameworkScript=await S(r)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-br3s0433.js"))}catch{}let g=e.storesDir,v=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=v?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],b=[],w=null;for(let S=0;S<8;S++){let k=null,D="",R=!1;try{if(n){let H=v?await n.getStoreScript(g).then((V)=>V?{code:V,stores:["*"],functions:null}:null):await n.getStoreScriptFor(g,[m],{reads:n.storesReadInFiles([...x,...b]),runOnce:!0});if(H)k=H.code,D=H.stores.join(","),R=!!H.functions&&!v}}catch{}if(w!==null&&D===w)break;w=D;let M=R?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",O=k?`<script ${M}>${k}</script>`:null;d.storeCode=k,d.storeTag=k?await at(M,k,e)??O:null;let N={};d.modulesTag=await tr([r,O],e,c,N),d.modulesCode=N.code??null,x=N.inputs??[],d.composableTag=null,d.composableCode=null,b=[];try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-y2enams2.js")),V=e.composablesDir,P=[d.modulesCode??d.modulesTag,O,d.frameworkScript].filter((B)=>B!==null),L=await H(e._layerComposableDirs??V,r,P,b);if(L)d.composableCode=L,d.composableTag=await at('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(v||!n)break}return d}async function vs(r,e,c,a={}){let{withModuleSubstitutes:d,moduleSubstitutionKey:n}=await import("./chunk-kmva29mx.js"),g=await import("./chunk-cbx7qght.js"),{messages:v,webModules:m}=e,x=null,b=null,w=n()===""&&!a.__stx_native_screen;if(v&&g.pageMessagesEnabled(e)&&w)try{x=await g.loadPageMessages(process.cwd(),v)}catch(M){bs(M)}if(m&&Object.keys(m).length&&w)try{b=await(await import("./chunk-bfm5cedw.js")).loadWebModules(process.cwd(),m)}catch(M){ws(M)}let S=new Map([...b??[],...x?.stubs??[]]),k=()=>gs(r,e,c,a),D=S.size?await d(S,k):await k(),R=null;if(x){let M=g.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),O=g.pageMessagesScript(x,g.pageLanguages(r,x),M);if(O)R=await at('data-stx-scoped data-stx-run="always" data-stx-messages',O,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${O.replace(/<\/script/gi,"<\\/script")}</script>`}return[R,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((M)=>M!==null)}var gn=!1;function bs(r){if(gn)return;gn=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var hn=!1;function ws(r){if(hn)return;hn=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function xs(r,e=""){let c=Tn(r,"data-stx-runtime");if(!c)return r;let a=ar(r);if(a===-1||a===c.start){if(!e)return r;return r.slice(0,c.end)+e+r.slice(c.end)}if(a<c.start)return r.slice(0,a)+r.slice(c.start,c.end)+e+`
1561
+ `)break;a++}d=!1;continue}if(v==="`"){a++;while(a<c){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}if(n.length===0)d=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<c){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,d=!1;break}if(r[a]==="$"&&r[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))d=!1;else d=!0;a++}return-1}function Tn(r,e){let c=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${c}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let d=a.index+a[0].length,n=r.indexOf("</script>",d);if(n===-1)return null;let g=r.indexOf(">",n);if(g===-1)return null;return{start:a.index,end:g+1}}var fs=4096;async function at(r,e,c){if(c.buildMode!=="serve"||e.length<fs)return null;let{registerServeModuleBundle:a}=await import("./chunk-af54x4dj.js");return`<script ${r} src="${a(e)}"></script>`}async function tr(r,e,c,a){try{let{registeredModuleIdsIn:d,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-j68h08nm.js")),g=[],v=await n(d(...r),{minify:$i(e.buildMode,e.minifyClient),collectInputs:g});for(let m of g)c?.add(m);if(a)a.inputs=g,a.code=v??void 0;if(!v)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-af54x4dj.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(v)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${v.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function gs(r,e,c,a){let d={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:S}=await o("stx/framework-composables",()=>import("./chunk-61j62gya.js"));d.frameworkScript=await S(r)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-e2ywh4ax.js"))}catch{}let g=e.storesDir,v=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=v?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],b=[],w=null;for(let S=0;S<8;S++){let k=null,D="",R=!1;try{if(n){let H=v?await n.getStoreScript(g).then((V)=>V?{code:V,stores:["*"],functions:null}:null):await n.getStoreScriptFor(g,[m],{reads:n.storesReadInFiles([...x,...b]),runOnce:!0});if(H)k=H.code,D=H.stores.join(","),R=!!H.functions&&!v}}catch{}if(w!==null&&D===w)break;w=D;let M=R?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",O=k?`<script ${M}>${k}</script>`:null;d.storeCode=k,d.storeTag=k?await at(M,k,e)??O:null;let N={};d.modulesTag=await tr([r,O],e,c,N),d.modulesCode=N.code??null,x=N.inputs??[],d.composableTag=null,d.composableCode=null,b=[];try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-zmtggvf0.js")),V=e.composablesDir,P=[d.modulesCode??d.modulesTag,O,d.frameworkScript].filter((B)=>B!==null),L=await H(e._layerComposableDirs??V,r,P,b);if(L)d.composableCode=L,d.composableTag=await at('data-stx-scoped data-stx-run="always" data-stx-composables',L,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${L}</script>`}catch{}if(v||!n)break}return d}async function vs(r,e,c,a={}){let{withModuleSubstitutes:d,moduleSubstitutionKey:n}=await import("./chunk-9k4fvbrz.js"),g=await import("./chunk-cbx7qght.js"),{messages:v,webModules:m}=e,x=null,b=null,w=n()===""&&!a.__stx_native_screen;if(v&&g.pageMessagesEnabled(e)&&w)try{x=await g.loadPageMessages(process.cwd(),v)}catch(M){bs(M)}if(m&&Object.keys(m).length&&w)try{b=await(await import("./chunk-bfm5cedw.js")).loadWebModules(process.cwd(),m)}catch(M){ws(M)}let S=new Map([...b??[],...x?.stubs??[]]),k=()=>gs(r,e,c,a),D=S.size?await d(S,k):await k(),R=null;if(x){let M=g.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),O=g.pageMessagesScript(x,g.pageLanguages(r,x),M);if(O)R=await at('data-stx-scoped data-stx-run="always" data-stx-messages',O,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${O.replace(/<\/script/gi,"<\\/script")}</script>`}return[R,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((M)=>M!==null)}var gn=!1;function bs(r){if(gn)return;gn=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var hn=!1;function ws(r){if(hn)return;hn=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function xs(r,e=""){let c=Tn(r,"data-stx-runtime");if(!c)return r;let a=ar(r);if(a===-1||a===c.start){if(!e)return r;return r.slice(0,c.end)+e+r.slice(c.end)}if(a<c.start)return r.slice(0,a)+r.slice(c.start,c.end)+e+`
1562
1562
  `+r.slice(a,c.start)+r.slice(c.end);let d=r.slice(c.start,c.end),n=r.slice(0,c.start)+r.slice(c.end),g=ar(n);if(g===-1)return d+e+`
1563
1563
  `+n;return n.slice(0,g)+d+e+`
1564
1564
  `+n.slice(g)}function Ss(r){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return r.replace(e,(c,a,d)=>{let n=r.slice(0,d);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(r,e,c,a,d){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return r;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Se(r,c);let n=!e.__stxProcessingDepth;mn(e);for(let g of a._layerGraph?.configDependencies??[])d.add(g);if(n&&a.runtimeConfig)await vn(e,c,a.runtimeConfig);if(n)Hc(e),e.__stx_scope_seq??={n:0,key:Vs(String(e.__filename??c))},e.__stx_head_injections=Ci(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!_n())&&c&&c.endsWith(".stx"))Do(r,c);try{return await ie.timeAsync("template-processing",async()=>{let g=await ks(r,e,c,a,d);if(n)g=fi(g);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=_e(a.app?.head,{known:Or,source:"app.head"}),x=(e.__stx_runtime_head||null)??Ti(),b=(e.__stx_head_raw||"").trim(),w,S=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(S)w=S[1].trim(),b=b.replace(S[0],"").trim();let k=e.__sections?.title,D=k?_(k,e,c):void 0,R=x.title||w||D,M=!x.title&&(!!w||!!D),O=x.meta||[],N=new Set(O.map((X)=>it(X)).filter(Boolean)),H={...v,...R&&{title:R},meta:[...(v.meta||[]).filter((X)=>!N.has(it(X))),...O],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
@@ -1573,7 +1573,7 @@ ${m.trim()}
1573
1573
  @endsection`}}if(O&&m.includes("<script")){let P=G(m),L=P.scripts.map((B)=>yn(B,c)??B);m=vr(P.output,L)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(P,L,B)=>(M[L]=B,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(P,L,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return P;try{let X=u(B.trim(),e);if(X===void 0)return P;let ee=(e.__stx_inline_section_values??=[]).push(X)-1;return M[L]=`{{ __stx_inline_section_values[${ee}] }}`,""}catch{return P}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(P,L,B)=>{if(B.includes("@parent"))M[L]=B.replace("@parent",Te);else M[L]=B.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(P,L,B)=>M[L]||B||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=ls(m,R),O){let P=[],L=G(m),B=pe(L.output,pn,(X,K)=>`\x00STX_ORPHAN_STYLE_${K}\x00`);if(m=B.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,K,ee)=>{let te=K==="SCRIPT"?yn(L.scripts[Number(ee)],c):B.tokens[Number(ee)];if(te)P.push(te);return""}),P.length>0){let X=P.join(`
1574
1574
  `);M.content=M.content?`${M.content}
1575
1575
  ${X}`:X,e.__sections=M}}if(O)try{let P;if(ce.isAbsolute(O))P=O,d.add(O);else P=await ke(()=>bn(O,c,g,d),null,()=>{throw new ae(`Failed to resolve layout path: ${O}`,c,void 0,void 0,`Layout referenced from ${c}`)});if(!P){let te=(J)=>{if(!J)return[];try{let me=ce.isAbsolute(J)?J:ce.resolve(process.cwd(),J);return us.readdirSync(me).filter((we)=>we.endsWith(".stx")).map((we)=>we.replace(/\.stx$/,""))}catch{return[]}},ne=[...te(g.layoutsDir),...te(g.fallbackLayoutsDir)].filter((J,me,we)=>we.indexOf(J)===me).sort(),le=[g.layoutsDir,g.fallbackLayoutsDir].filter((J)=>typeof J==="string"&&J.length>0),de=le.length>0?` Searched: ${le.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",oe=`Layout not found: ${O} (referenced from ${c})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:g.layoutsDir?`. No .stx layouts found in ${g.layoutsDir}`:"")+de;if(F.log(Error(oe),{layoutPath:O,filePath:c,available:ne},"error"),console.error(`[stx] ${oe}`),g.debug)throw new ae(oe,c);return m}let L=await ke(()=>Bun.file(P).text(),"",()=>{throw new ae(`Failed to read layout file: ${P}`,c,void 0,void 0,"Layout content could not be loaded")});L=un(L,P);let B=L.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(g.debug)console.log(`Found nested layout: ${B[1]} in ${P}`);let te={},ne=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(oe,J,me)=>(te[J]=me.trim(),""));for(let[oe,J]of Object.entries(te))if(M[oe]&&M[oe].includes(Te)){let me=M[oe].indexOf(Te);M[oe]=M[oe].slice(0,me)+J+M[oe].slice(me+Te.length)}else if(!M[oe])M[oe]=J;let le={...e,__sections:M},de=`@layout('${B[1]}')${ne}`;return await i(de,le,P,g,d)}let X=L.replace(/\{\{--[\s\S]*?--\}\}/g,""),K=cs(X,R),ee={};return K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(te,ne,le)=>(ee[ne]=le.trim(),`@slot('${ne}')`)),K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(te,ne,le)=>{if(M[ne]){let de=M[ne];if(de.includes(Te)){let oe=ee[ne]||"",J=de.indexOf(Te);de=de.slice(0,J)+oe+de.slice(J+Te.length)}return de}return le||""}),K=$s(K,M),K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),K=ls(K,R),e.__originalFilePath=c,m=await $n(K,e,P,g,d),m=`<!-- stx-layout: ${O} -->
1576
- ${m}`,w(m)}catch(P){if(P instanceof q)throw P;throw new ae(`Error processing layout ${O}: ${P instanceof Error?P.message:String(P)}`,c)}return w(await $n(m,e,c,g,d))}function $s(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,d)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return d||""})}function Es(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[d,n]of Object.entries(process.env))if(d.startsWith(c)&&n!==void 0)a[d]=n;r.$env=a}async function _s(r,e){await ke(()=>Jt(r,e),void 0,(c)=>{F.log(c,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${c.message}`)})}var ct="data-stx-source";function yn(r,e){if(!r)return r;let c=/^<script\b([^>]*)>/i.exec(r);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return r;return`<script ${ct}="${encodeURIComponent(e)}"${r.slice(7)}`}function Ts(r){let e=new RegExp(`${ct}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function wn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(r,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wn(r)}</span><span style="display:block;margin-top:4px">${wn(c)}</span></div>`}async function Cs(r,e,c,a){let{scanScriptTags:d}=await o("stx/signal-processing",()=>import("./chunk-v5sk63p3.js")),n=[],g=!E()&&!_n();for(let m of d(r)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=En(r,b);if(w===-1)continue;let S=r.slice(b,w);if(!S.trim())continue;let k=Ts(x)??c,D={index:m.start,length:w+9-m.start};try{let{extractVariables:R}=await o("stx/variable-extractor",()=>import("./chunk-cfbjf654.js"));await R(S,e,k,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:k,kind:M.kind,message:M.message}),!g)return;n.push({...D,markup:xn(k,M.kind,M.message)})}})}catch(R){let M=R instanceof Error?R:Error(String(R));if(F.log(M,{filePath:k,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${k}: ${M.message}`),g)n.push({...D,markup:xn(k,"unknown",M.message)})}}if(n.length===0)return r;let v=r;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function As(r,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-3fprmhmc.js"));return a(r,e,{skipServer:!0})}catch(a){let d=a instanceof Error?a:Error(String(a));return F.log(d,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${d.message}`),r}}async function $n(r,e,c,a,d){let n=r,g=a;if(n=await Cs(n,e,c,a),n=await qt(n,e,c),n=await Ut(n,e,c),n=await As(n,e,c),n=await Rt(n,e,c,g),Se(n))n=Uo(n,e),n=ys(n,e),n=hs(n,e);n=Wo(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-ypjxp2vs.js"));n=v(n,e),n=or(n,e,c,g,!0),n=await nn(n,e,c,g,d),n=await ds(n,e,c,g,d),n=pc(n,e,c,g);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-bj6ax0he.js"));n=m(n,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-rxc1076r.js"));n=x(n,e,c);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-d3gncxq1.js"));n=b(n,e,c),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:k}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,c),n=k(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-1rwfgmmk.js"));n=D(n,e,c);let{processAsyncDirectives:R}=await o("stx/async-components",()=>import("./chunk-xgqyzkt2.js"));n=R(n,e,c);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-cxpnkgvw.js"));n=M(n,e,c);let{processVirtualListDirectives:O,processVirtualGridDirectives:N,processInfiniteListDirectives:H}=await o("stx/virtual-scrolling",()=>import("./chunk-tzb0n60s.js"));n=O(n,e,c),n=N(n,e,c),n=H(n,e,c);let{processPartialHydrationDirectives:V,processStaticDirectives:P}=await o("stx/partial-hydration",()=>import("./chunk-da886asf.js"));n=V(n,e,c),n=P(n);let{processComputedDirectives:L,processWatchDirectives:B}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,c),n=B(n,e,c);let{processFormValidationDirectives:X}=await o("stx/forms-validation",()=>import("./chunk-q75dt2k5.js"));n=X(n,e,c);let{processHeadDirective:K,processTitleDirective:ee,processMetaDirective:te,resetHead:ne}=await o("stx/head",()=>import("./chunk-ycr9bkww.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ne();let le=K(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
1576
+ ${m}`,w(m)}catch(P){if(P instanceof q)throw P;throw new ae(`Error processing layout ${O}: ${P instanceof Error?P.message:String(P)}`,c)}return w(await $n(m,e,c,g,d))}function $s(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,a,d)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return d||""})}function Es(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let c=e.envPrefix||"STX_PUBLIC_",a={};for(let[d,n]of Object.entries(process.env))if(d.startsWith(c)&&n!==void 0)a[d]=n;r.$env=a}async function _s(r,e){await ke(()=>Jt(r,e),void 0,(c)=>{F.log(c,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${c.message}`)})}var ct="data-stx-source";function yn(r,e){if(!r)return r;let c=/^<script\b([^>]*)>/i.exec(r);if(!c||!/\bserver\b/.test(c[1])||c[1].includes(ct))return r;return`<script ${ct}="${encodeURIComponent(e)}"${r.slice(7)}`}function Ts(r){let e=new RegExp(`${ct}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function wn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function xn(r,e,c){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${wn(r)}</span><span style="display:block;margin-top:4px">${wn(c)}</span></div>`}async function Cs(r,e,c,a){let{scanScriptTags:d}=await o("stx/signal-processing",()=>import("./chunk-gqse3ae0.js")),n=[],g=!E()&&!_n();for(let m of d(r)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=En(r,b);if(w===-1)continue;let S=r.slice(b,w);if(!S.trim())continue;let k=Ts(x)??c,D={index:m.start,length:w+9-m.start};try{let{extractVariables:R}=await o("stx/variable-extractor",()=>import("./chunk-merxtsaf.js"));await R(S,e,k,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:k,kind:M.kind,message:M.message}),!g)return;n.push({...D,markup:xn(k,M.kind,M.message)})}})}catch(R){let M=R instanceof Error?R:Error(String(R));if(F.log(M,{filePath:k,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${k}: ${M.message}`),g)n.push({...D,markup:xn(k,"unknown",M.message)})}}if(n.length===0)return r;let v=r;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function As(r,e,c){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-gdc9s90b.js"));return a(r,e,{skipServer:!0})}catch(a){let d=a instanceof Error?a:Error(String(a));return F.log(d,{filePath:c,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${c}: ${d.message}`),r}}async function $n(r,e,c,a,d){let n=r,g=a;if(n=await Cs(n,e,c,a),n=await qt(n,e,c),n=await Ut(n,e,c),n=await As(n,e,c),n=await Rt(n,e,c,g),Se(n))n=Uo(n,e),n=ys(n,e),n=hs(n,e);n=Wo(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-6tefkmq9.js"));n=v(n,e),n=or(n,e,c,g,!0),n=await nn(n,e,c,g,d),n=await ds(n,e,c,g,d),n=pc(n,e,c,g);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-bj6ax0he.js"));n=m(n,e,c);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-rxc1076r.js"));n=x(n,e,c);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-d3gncxq1.js"));n=b(n,e,c),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:k}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,c),n=k(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-1rwfgmmk.js"));n=D(n,e,c);let{processAsyncDirectives:R}=await o("stx/async-components",()=>import("./chunk-xgqyzkt2.js"));n=R(n,e,c);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-cxpnkgvw.js"));n=M(n,e,c);let{processVirtualListDirectives:O,processVirtualGridDirectives:N,processInfiniteListDirectives:H}=await o("stx/virtual-scrolling",()=>import("./chunk-tzb0n60s.js"));n=O(n,e,c),n=N(n,e,c),n=H(n,e,c);let{processPartialHydrationDirectives:V,processStaticDirectives:P}=await o("stx/partial-hydration",()=>import("./chunk-da886asf.js"));n=V(n,e,c),n=P(n);let{processComputedDirectives:L,processWatchDirectives:B}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=L(n,e,c),n=B(n,e,c);let{processFormValidationDirectives:X}=await o("stx/forms-validation",()=>import("./chunk-damrq7b8.js"));n=X(n,e,c);let{processHeadDirective:K,processTitleDirective:ee,processMetaDirective:te,resetHead:ne}=await o("stx/head",()=>import("./chunk-ycr9bkww.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ne();let le=K(n);if(n=le.content,le.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${le.headContent}
1577
1577
  `;if(n=ee(n,e),n=te(n,e,c),n=Gt(n),n=Fo(n,e),n=At(n),n=zt(n),n=await as(n,e,c,g,d),n=await ds(n,e,c,g,d),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=fi(n),n=se(n,e,c),n=ps(n),e.__stxProcessingDepth===1)n=Vc(n,e);if(n=jc(n,e,{filePath:c,buildMode:g.buildMode}),n=zo(n,e),n=Ho(n,e),n=We(n,e),n=Ht(n,e),n=Bt(n,e),n=await xt(n,e,c,g),n=await gc(n,e,c),n=await mc(n,e,c,g),n=hc(n,e,c,g),n=Zo(n,e,c,g),n=Qo(n,e,c),n=ei(n,e,c,g),n=Tt(n,e,c,g),n=zs(n,e),n=Hs(n),n=Bc(n),!g.skipEventDirectives)n=$c(n,e,c);if(n=wt(n,e,c),g.debug){let z=/\bx-data\s*=/.test(n),W=ms(r);if(z&&W)console.warn(`[stx] ${c}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1578
1578
  Both work on the same page, but they manage separate scopes.
1579
1579
  Prefer signals (state/derived/effect) for new components.`)}n=ac(n,e),n=await _(n,e,c),n=Fc(n),n=zc(n),n=gt(n);let{processXElementDirectives:de}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=de(n);let oe=e.__originalFilePath||c,J=De(e);if(n=await qo(n,g,oe,J),n=Pt(n,e),n=await Kt(n,e,c,g),g.media?.image?.autoSiblings){let z=g.publicDir||"public",{rewriteImagesWithSiblings:W}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-9wmjmas8.js"));n=await W(n,{publicDir:z})}if(g.seo?.enabled)n=ti(n,e,g);let me=(z,W,Q=!0)=>{if(!W)return z;let he=W.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),re=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(z),fe=re?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(re[0]):null;if(he&&re&&fe){if(Q){let Ce=re.index+fe.index;z=z.slice(0,Ce)+he[0]+z.slice(Ce+fe[0].length)}if(W=W.replace(he[0],"").trim(),!W)return z}if(/<\/head>/i.test(z))return z.replace(/<\/head>/i,`${W}
@@ -1587,6 +1587,6 @@ ${dt()}
1587
1587
  `+Ce}else n=n.replace("</head>",`${W}
1588
1588
  </head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
1589
1589
  ${W}`);else n=W+`
1590
- `+n}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-v5sk63p3.js")),W=[];for(let Q of z(n)){if(!/\bserver\b/i.test(Q.attrs))continue;let he=Q.start+Q.fullMatch.indexOf(">")+1,re=En(n,he);if(re===-1)continue;let fe=re+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;W.push({start:Q.start,end:fe})}if(W.length>0){let Q=Array(W.length+1),he=0;for(let re=0;re<W.length;re++){let{start:fe,end:Ce}=W[re];Q[re]=n.slice(he,fe),he=Ce}Q[W.length]=n.slice(he),n=Q.join("")}}let lt=Bs(n,c);if(lt.hasScoped)n=lt.html;let Dn=e.__stx_event_bindings||[],Ke=!1,ut=[],In=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:On}=await o("stx/signal-processing",()=>import("./chunk-v5sk63p3.js"));for(let z of On(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:z.fullMatch,attrs:z.attrs,content:z.body});for(let{match:z,attrs:W,content:Q}of ut){Ke=!0;let he=Q;Oe(Q,c,a.strict,e.__originalFilePath);let re=await Le(Q,{eventBindings:Dn,attrs:W,hasColonDirectives:In,templateContent:r,filePath:c,projectRoot:process.cwd(),production:$i(a.buildMode,a.minifyClient),serverData:J});n=n.replace(z,()=>re)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let z=e.__stx_event_bindings||[];if(z.length>0){let W=ai(z);if(W){let Q=n.lastIndexOf("</body>");n=Q===-1?n+W:n.slice(0,Q)+W+`
1590
+ `+n}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-gqse3ae0.js")),W=[];for(let Q of z(n)){if(!/\bserver\b/i.test(Q.attrs))continue;let he=Q.start+Q.fullMatch.indexOf(">")+1,re=En(n,he);if(re===-1)continue;let fe=re+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;W.push({start:Q.start,end:fe})}if(W.length>0){let Q=Array(W.length+1),he=0;for(let re=0;re<W.length;re++){let{start:fe,end:Ce}=W[re];Q[re]=n.slice(he,fe),he=Ce}Q[W.length]=n.slice(he),n=Q.join("")}}let lt=Bs(n,c);if(lt.hasScoped)n=lt.html;let Dn=e.__stx_event_bindings||[],Ke=!1,ut=[],In=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:On}=await o("stx/signal-processing",()=>import("./chunk-gqse3ae0.js"));for(let z of On(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ut.push({match:z.fullMatch,attrs:z.attrs,content:z.body});for(let{match:z,attrs:W,content:Q}of ut){Ke=!0;let he=Q;Oe(Q,c,a.strict,e.__originalFilePath);let re=await Le(Q,{eventBindings:Dn,attrs:W,hasColonDirectives:In,templateContent:r,filePath:c,projectRoot:process.cwd(),production:$i(a.buildMode,a.minifyClient),serverData:J});n=n.replace(z,()=>re)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let z=e.__stx_event_bindings||[];if(z.length>0){let W=ai(z);if(W){let Q=n.lastIndexOf("</body>");n=Q===-1?n+W:n.slice(0,Q)+W+`
1591
1591
  `+n.slice(Q)}e.__stx_event_bindings=[]}}if(!be(n)&&lc(n))n=await cr(n,g);if(n=uc(n),g.csp?.enabled&&g.csp.useNonce&&typeof e.cspNonce==="string")n=_t(n,e.cspNonce);return n}
1592
1592
  export{yt,Re,rc,is,No,Mo,tr,i};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Cl,El}from"./chunk-yehy1zs5.js";import"./chunk-w6n4y2xg.js";import"./chunk-0d2wgdv3.js";import"./chunk-xz1qz9b9.js";import"./chunk-f1wwn3tg.js";import"./chunk-mmh2k7ab.js";import"./chunk-k86573fe.js";import"./chunk-r81yx50m.js";import"./chunk-ry9fpa1j.js";import"./chunk-rmbm30ew.js";import"./chunk-a0r4dpzs.js";import"./chunk-r1vkk7qp.js";import"./chunk-ncyjaxyz.js";import"./chunk-s04bbm66.js";import"./chunk-cfbpvm5e.js";import"./chunk-vkn133cs.js";import"./chunk-s90m43sm.js";import"./chunk-bphwhfbd.js";import"./chunk-s9xs2ff4.js";import"./chunk-xrd1md4j.js";import"./chunk-x8663zag.js";import"./chunk-yd0b6am5.js";import"./chunk-549end3k.js";import"./chunk-fn3q1gtr.js";import"./chunk-p8wq37hd.js";import"./chunk-tb4wmzzd.js";import"./chunk-h8p8ekbk.js";import"./chunk-d2nd3608.js";import"./chunk-gb3tv53p.js";import"./chunk-qyqebgw2.js";import"./chunk-baj6w8ja.js";import"./chunk-hwcfgs3e.js";import{Qt}from"./chunk-09dfp38y.js";import"./chunk-ge9fbfd0.js";import"./chunk-prj88r9z.js";import"./chunk-7sh9fa3q.js";import{Re,i}from"./chunk-6df7h4ay.js";import"./chunk-ezdj63ds.js";import"./chunk-t8njsjr9.js";import"./chunk-c84pxd2k.js";import"./chunk-9pcrtvje.js";import"./chunk-jye7txe4.js";import"./chunk-knpzhqns.js";import"./chunk-y7sf7aj0.js";import"./chunk-hn5tnxk1.js";import{we}from"./chunk-0z96accg.js";import"./chunk-1carv1dw.js";import{lr,ur}from"./chunk-4k42f3ca.js";import{Ss,B,a}from"./chunk-h8mqh8ds.js";import"./chunk-93rd9wf9.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import{m,Le}from"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";import"./chunk-dvbd5fxe.js";import"./chunk-bejj0gra.js";export{Ss as buildWebComponents,ur as cacheTemplate,lr as checkCache,Qt as classifyAllScripts,Cl as createMiddleware,El as createRoute,B as defaultConfig,m as extractVariables,we as injectRouterScript,a as loadStxConfig,Le as processClientScript,i as processDirectives,Re as readMarkdownFile};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Om,ba,lu,Nm,Mm,Dm,Lm,jm,uu,du,Bm,Fm,zm,Hm}from"./chunk-yd0b6am5.js";import"./chunk-6df7h4ay.js";import"./chunk-ezdj63ds.js";import"./chunk-t8njsjr9.js";import"./chunk-c84pxd2k.js";import"./chunk-9pcrtvje.js";import"./chunk-jye7txe4.js";import"./chunk-knpzhqns.js";import"./chunk-y7sf7aj0.js";import"./chunk-hn5tnxk1.js";import"./chunk-0z96accg.js";import"./chunk-1carv1dw.js";import"./chunk-4k42f3ca.js";import"./chunk-h8mqh8ds.js";import"./chunk-93rd9wf9.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{lu as SUSPENSE_RESOLVER_RUNTIME,ba as buildSuspenseResolveScript,jm as createStreamRenderer,Dm as extractStreamBoundaries,Hm as generateHydrationRuntime,du as islandDirective,Fm as processSectionDirectives,Mm as processStreamDirectives,Bm as registerStreamingDirectives,Nm as renderStreamingPage,Om as streamTemplate,Lm as streamTemplateSimple,zm as streamToResponse,uu as streamingSuspenseDirective};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$h,Pf,Je,ic,Rh,as,cs,ls}from"./chunk-czxagy9e.js";import"./chunk-74vh3mkn.js";import"./chunk-hhxv14s1.js";import"./chunk-y7sf7aj0.js";import"./chunk-1carv1dw.js";import"./chunk-pzbwnga6.js";import"./chunk-c7t22z4q.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Rh as clearOnceStore,ic as onceStore,Je as partialsCache,as as processIncludes,cs as processStackPushDirectives,ls as processStackReplacements,$h as resetUnscopedSignalWarnings,Pf as topLevelElements};
2
+ import{$h,Pf,Je,ic,Rh,as,cs,ls}from"./chunk-t8njsjr9.js";import"./chunk-9pcrtvje.js";import"./chunk-jye7txe4.js";import"./chunk-y7sf7aj0.js";import"./chunk-1carv1dw.js";import"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Rh as clearOnceStore,ic as onceStore,Je as partialsCache,as as processIncludes,cs as processStackPushDirectives,ls as processStackReplacements,$h as resetUnscopedSignalWarnings,Pf as topLevelElements};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{A,t,l}from"./chunk-gebb12ak.js";import{Z}from"./chunk-pzbwnga6.js";import{Jo}from"./chunk-2ws2qe1k.js";import C from"path";var L;async function W(){if(L!==void 0)return L;try{let e=await import("@stacksjs/ts-i18n");L=e.loadLocale??null}catch{L=null}return L}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},k={},v={},R={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&k[e]){let r=k[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(v[e]?.state==="loading")return v[e].promise;R[e]="loading";let n=T(e,s).then((r)=>(R[e]="loaded",delete v[e],r)).catch((r)=>{throw R[e]="error",v[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return v[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)k[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=o;if(i.cache)k[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
2
+ import{A,t,l}from"./chunk-gebb12ak.js";import{Z}from"./chunk-nv77aaqa.js";import{Jo}from"./chunk-2ws2qe1k.js";import C from"path";var L;async function W(){if(L!==void 0)return L;try{let e=await import("@stacksjs/ts-i18n");L=e.loadLocale??null}catch{L=null}return L}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},k={},v={},R={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&k[e]){let r=k[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(v[e]?.state==="loading")return v[e].promise;R[e]="loading";let n=T(e,s).then((r)=>(R[e]="loaded",delete v[e],r)).catch((r)=>{throw R[e]="error",v[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return v[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)k[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=o;if(i.cache)k[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
3
  `),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let c=o.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let c=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=c&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return E(r[o],n,i);let c=ce(n);if(r[c])return E(r[c],n,i);if(r.other)return E(r.other,n,i);return String(n)}function E(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let c=String(o);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),a=c.split("|");c=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function mc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...P,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,S=JSON.parse(x);return typeof S.data==="object"?S.data:{}},()=>A(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?Z(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return l("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>A(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Z(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return l("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...c)=>{let u=i(o,...c).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:c,replacement:u})=>o.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function hc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,c,u)=>{let a=n.get(u);return a?`<${c}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),S=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=S&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${S[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function yc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],c=await Jo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of c)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var bc={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},wc={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
4
  export{mc,hc,yc,bc,wc};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{wf,vf,he,xf,ec,en,tn,Sh,tc,nn,Qn,Sf,kf,_f,os,rn,Cf,sn,nc,kh}from"./chunk-jebsepea.js";import"./chunk-8g7vp3ez.js";import"./chunk-7sh9fa3q.js";import"./chunk-rjadbasx.js";import"./chunk-4pf2zamx.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-hn2me1qx.js";import"./chunk-pzbwnga6.js";import"./chunk-c7t22z4q.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Qn as MODULE_SPECIFIER_PREFIX,wf as bundleCacheDir,vf as bundleCacheEntryLimit,kh as bundleClientEntriesSplit,sn as bundleClientScript,tn as clearBundleFailures,he as clientBundleDependencies,en as getBundleFailures,nn as hasUserImports,rn as moduleSubstitutionKey,kf as normalizeRegistrySpecifiers,Cf as queueClientBundleBuild,ec as recordBundleFailure,Sf as registryIdForPath,tc as resolveBundlerFallback,_f as rewriteRegistryImports,Sh as setBundlerFallbackMode,xf as shouldLogBundlerDiagnostics,nc as tempBuildName,os as withModuleSubstitutes};
2
+ import{wf,vf,he,xf,ec,en,tn,Sh,tc,nn,Qn,Sf,kf,_f,os,rn,Cf,sn,nc,kh}from"./chunk-ge9fbfd0.js";import"./chunk-prj88r9z.js";import"./chunk-7sh9fa3q.js";import"./chunk-h8mqh8ds.js";import"./chunk-93rd9wf9.js";import"./chunk-2ws2qe1k.js";import"./chunk-vbc8a8fh.js";import"./chunk-3z0e637x.js";import"./chunk-bmkm1c8s.js";import"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Qn as MODULE_SPECIFIER_PREFIX,wf as bundleCacheDir,vf as bundleCacheEntryLimit,kh as bundleClientEntriesSplit,sn as bundleClientScript,tn as clearBundleFailures,he as clientBundleDependencies,en as getBundleFailures,nn as hasUserImports,rn as moduleSubstitutionKey,kf as normalizeRegistrySpecifiers,Cf as queueClientBundleBuild,ec as recordBundleFailure,Sf as registryIdForPath,tc as resolveBundlerFallback,_f as rewriteRegistryImports,Sh as setBundlerFallbackMode,xf as shouldLogBundlerDiagnostics,nc as tempBuildName,os as withModuleSubstitutes};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{pl,fl}from"./chunk-ybjfr7e8.js";import{f,A,st,d}from"./chunk-gebb12ak.js";import{V,yr,Ns,Ms,oi,ii,Ds,wr,Ne,pe,G,xr,oe,J,O,rt,Sr,li,Er,Fe,s,p,U,wn}from"./chunk-pzbwnga6.js";import{n}from"./chunk-hhxv14s1.js";import{se}from"./chunk-y7sf7aj0.js";import{r}from"./chunk-3vpgr6nk.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Rt}from"crypto";import Q from"fs";import K from"path";import{decode as on,generateThumbHash as an}from"ts-images";import{createImageDeliveryCatalog as bt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Yt from"fs";import Re from"os";import{join as gt}from"path";import{fileURLToPath as mt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Qt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,yt=[];async function en(){if(Ae<Qt()){Ae++;return}await new Promise((e)=>yt.push(e)),Ae++}function tn(){Ae--,yt.shift()?.()}var nn="@stacksjs/stx/builtins/image-warmup-worker";function rn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Yt.existsSync(mt(i)))return mt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(nn,e):void 0;return i&&sn(i)?i:void 0}catch{return}}function sn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,gt(t.BUN_INSTALL||gt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var ht=!1;function he(e){if(!ht)ht=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return he("node:worker_threads has no Worker in this runtime");let i=rn();if(!i)return he("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await en();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(he(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(he(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(he(`the worker exited with code ${y} before it was ready`)))})})}finally{tn()}}var cn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ln=[320,640,960,1280,1920],ye="/_stx/images",un=`stx:${ye}:alpha-1`,fn=`stx:${ye}:opaque-1`,dn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function gn(e,t){let i=K.dirname(Bun.resolveSync(e,t));while(i!==K.dirname(i)){let o=K.join(i,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=K.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=dn.map((t)=>{let i;try{i=e?gn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var vt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[vt]??={catalog:new Map,transparent:new Set},e[vt]}var wt=new Set;function mn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=K.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Rt("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function $t(e,t=`stx:${ye}`){let i=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=K.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await Q.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function At(e,t=e){let i=await Q.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=K.join(t,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!cn.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function St(e,t){return e.map((i)=>({key:mn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...hn(i.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Me(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function bn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await on(new Uint8Array(await Q.promises.readFile(m?.path??l.fallback.path)));if(yn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=Q.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)Q.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!wt.has(o))wt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await an(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return K.join(e,"undecodable.json")}function $n(e){try{let t=Q.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function Sn(e,t){try{Q.mkdirSync(K.dirname(Ue(e)),{recursive:!0}),Q.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function Ct(e){try{let t=Q.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function kt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Lo(e){let t=kt(e);return t?be().catalog.get(t):void 0}function jo(e){let t=kt(e);return t?be().transparent.has(t):!1}function Bo(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Ah(e){let t=Lo(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Bo(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:jo(e)?void 0:t.placeholder?.dataUrl}}function us(){let e=be();e.catalog=new Map,e.transparent=new Set}function Cn(e){let t=be();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function Ph(e,t,i={}){if(!e||!Q.existsSync(e))return us(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Cn(h.state),h.result}let o=await At(e);if(o.length===0)return us(),{count:0,fingerprint:""};let a=$n(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=Ct(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return us(),{count:0,fingerprint:""};let l=$t(K.join(t,"_stx","images"),`${un}:${xt()}`),m={outDir:K.join(t,"_stx","images"),storage:$t(K.join(t,"_stx","images"),`${fn}:${xt()}`),baseUrl:ye,widths:ln,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await bt({...m,entries:St(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((R)=>R.relativePath)),S=!1;for(let R of c){if(w.has(R.relativePath))continue;let P=Ct(R.absolutePath);if(!P)continue;a[R.relativePath]=P,S=!0}if(S)Sn(t,a);if(u.length===0)return us(),{count:0,fingerprint:""};y=await bt({...m,entries:St(u,l)})}let v=await bn(y.entries),b=xn(y.entries,v),C=be();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Rt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=oi(e,o);if(a!==void 0)return a;for(let c of ii(e,t,i,o))if(await s(c))return c;return null}}var ue=new Pt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Rn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function He(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Rn.has(t)}function ie(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var qe={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(wr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...ie(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var kn=new Map;function Xe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return kn.get(t)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function Z(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ve(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ge(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function In(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function En(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ke={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=Z(e,"src")||"",a=Lo(o),c=Z(e,"alt")||"",l=Z(e,"width")||(a?String(a.source.width):void 0),m=Z(e,"height")||(a?String(a.source.height):void 0),u=Z(e,"sizes"),y=Z(e,"srcset"),v=Z(e,"densities"),b=Z(e,"format"),C=jo(o)||Xe(o)?.transparent===!0,x=Z(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=Z(e,"placeholderColor")||"#e5e7eb",w=Z(e,"provider"),S=Z(e,"class")||Z(e,"className")||"",R=Z(e,"style")||"",P=Z(e,"objectFit")||Z(e,"fit"),k=Z(e,"objectPosition")||Z(e,"position"),N=Z(e,"quality"),H=Ie(e,"lazy",!0),z=Ie(e,"preload",!1),F=Ie(e,"priority",!1),q=Z(e,"loading"),B=Z(e,"decoding")||"async",E=!!a||Ie(e,"picture",!1)||!!b,T=l?Number.parseInt(l):void 0,j=m?Number.parseInt(m):void 0,W=y||"",X="";if(a)W=a.sources[a.fallback.format]||"",X=u?Ve(u):"100vw";else if(!W&&u&&w&&w!=="local"&&w!=="static")W=Ge(o,Ze,w,b),X=Ve(u);else if(!W&&v){let I=v.split(/\s+/).map((_)=>Number.parseFloat(_.replace("x","")));W=In(o,I,T,w,b)}else if(u)X=Ve(u);let L=[];if(R)L.push(R);if(P)L.push(`object-fit:${P}`);if(k)L.push(`object-position:${k}`);if(T&&j)L.push(`aspect-ratio:${T}/${j}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let I=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:Xe(o);if(I&&x==="color")L.push(`background-color:${I.color}`),D.push("backgroundColor");else if(I)L.push(`background-color:${I.color}`),L.push(`background-image:url(${I.dataUrl})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let _=En(T||16,j||9,h);L.push(`background-image:url(${_})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")L.push(`background-image:url(${n(x)})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||xe(o,T,j,w,b),Y=[];if(Y.push(`src="${n(wr($e,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let le=q||(F||z?"eager":H?"lazy":"");if(le)Y.push(`loading="${n(le)}"`);if(F)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(B)}"`),S)Y.push(`class="${n(S)}"`);if(L.length>0)Y.push(`style="${n(L.join(";"))}"`);if(W)Y.push(`srcset="${n(wr(W,"fetched"))}"`);if(X)Y.push(`sizes="${n(X)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let I=typeof e.static.onload==="string"?e.static.onload:"",_=_n(D)+(I?`;${I}`:"");Y.push(`onload="${n(_)}"`),te.add("onload")}Y.push(...ie(e,te)),Y.push(...ae(e,te));let Te=`<img ${Y.join(" ")} />`,M="";if(z){let _=b==="webp"?"image/webp":b==="avif"?"image/avif":"";M=`<link rel="preload" as="image" href="${n($e)}"${_?` type="${_}"`:""}${W?` imagesrcset="${n(W)}"`:""}${X?` imagesizes="${n(X)}"`:""} />
2
+ import{pl,fl}from"./chunk-ybjfr7e8.js";import{f,A,st,d}from"./chunk-gebb12ak.js";import{V,yr,Ns,Ms,oi,ii,Ds,wr,Ne,pe,G,xr,oe,J,O,rt,Sr,li,Er,Fe,s,p,U,wn}from"./chunk-nv77aaqa.js";import{n}from"./chunk-jye7txe4.js";import{se}from"./chunk-y7sf7aj0.js";import{r}from"./chunk-3vpgr6nk.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Rt}from"crypto";import Q from"fs";import K from"path";import{decode as on,generateThumbHash as an}from"ts-images";import{createImageDeliveryCatalog as bt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Yt from"fs";import Re from"os";import{join as gt}from"path";import{fileURLToPath as mt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Qt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,yt=[];async function en(){if(Ae<Qt()){Ae++;return}await new Promise((e)=>yt.push(e)),Ae++}function tn(){Ae--,yt.shift()?.()}var nn="@stacksjs/stx/builtins/image-warmup-worker";function rn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Yt.existsSync(mt(i)))return mt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(nn,e):void 0;return i&&sn(i)?i:void 0}catch{return}}function sn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,gt(t.BUN_INSTALL||gt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var ht=!1;function he(e){if(!ht)ht=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return he("node:worker_threads has no Worker in this runtime");let i=rn();if(!i)return he("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await en();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(he(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(he(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(he(`the worker exited with code ${y} before it was ready`)))})})}finally{tn()}}var cn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ln=[320,640,960,1280,1920],ye="/_stx/images",un=`stx:${ye}:alpha-1`,fn=`stx:${ye}:opaque-1`,dn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function gn(e,t){let i=K.dirname(Bun.resolveSync(e,t));while(i!==K.dirname(i)){let o=K.join(i,"package.json");if(Q.existsSync(o)){let a=JSON.parse(Q.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=K.dirname(i)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=dn.map((t)=>{let i;try{i=e?gn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var vt=Symbol.for("stx.image-delivery");function be(){let e=globalThis;return e[vt]??={catalog:new Map,transparent:new Set},e[vt]}var wt=new Set;function mn(e){return`/${e.split(K.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=K.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Rt("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function $t(e,t=`stx:${ye}`){let i=(o)=>`${ye}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=K.join(e,o);try{let c=await Q.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=K.join(e,o);await Q.promises.mkdir(K.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await Q.promises.writeFile(l,a),await Q.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function At(e,t=e){let i=await Q.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=K.join(t,a.name);if(a.isDirectory()){o.push(...await At(e,c));continue}if(!a.isFile()||!cn.has(K.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:K.relative(e,c)})}return o}function St(e,t){return e.map((i)=>({key:mn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...hn(i.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Me(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function bn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await on(new Uint8Array(await Q.promises.readFile(m?.path??l.fallback.path)));if(yn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=Q.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)Q.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!wt.has(o))wt.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await an(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return K.join(e,"undecodable.json")}function $n(e){try{let t=Q.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function Sn(e,t){try{Q.mkdirSync(K.dirname(Ue(e)),{recursive:!0}),Q.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function Ct(e){try{let t=Q.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function kt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Lo(e){let t=kt(e);return t?be().catalog.get(t):void 0}function jo(e){let t=kt(e);return t?be().transparent.has(t):!1}function Bo(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function Ah(e){let t=Lo(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:Bo(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:jo(e)?void 0:t.placeholder?.dataUrl}}function us(){let e=be();e.catalog=new Map,e.transparent=new Set}function Cn(e){let t=be();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function Ph(e,t,i={}){if(!e||!Q.existsSync(e))return us(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Cn(h.state),h.result}let o=await At(e);if(o.length===0)return us(),{count:0,fingerprint:""};let a=$n(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=Ct(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return us(),{count:0,fingerprint:""};let l=$t(K.join(t,"_stx","images"),`${un}:${xt()}`),m={outDir:K.join(t,"_stx","images"),storage:$t(K.join(t,"_stx","images"),`${fn}:${xt()}`),baseUrl:ye,widths:ln,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await bt({...m,entries:St(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((R)=>R.relativePath)),S=!1;for(let R of c){if(w.has(R.relativePath))continue;let P=Ct(R.absolutePath);if(!P)continue;a[R.relativePath]=P,S=!0}if(S)Sn(t,a);if(u.length===0)return us(),{count:0,fingerprint:""};y=await bt({...m,entries:St(u,l)})}let v=await bn(y.entries),b=xn(y.entries,v),C=be();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Rt("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class Pt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=oi(e,o);if(a!==void 0)return a;for(let c of ii(e,t,i,o))if(await s(c))return c;return null}}var ue=new Pt;var re="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Rn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function He(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Rn.has(t)}function ie(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${wn(c,We(String(a)))}"`)}return i}function An(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var qe={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(wr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...ie(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var kn=new Map;function Xe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return kn.get(t)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ze=[320,640,768,1024,1280,1536,1920];function Z(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ve(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ge(e,t,i,o){return t.map((a)=>`${xe(e,a,void 0,i,o)} ${a}w`).join(", ")}function In(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${xe(e,l,void 0,o,a)} ${c}x`}).join(", ")}function xe(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(t)c.set("w",String(t));if(i)c.set("h",String(i));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function En(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ke={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=Z(e,"src")||"",a=Lo(o),c=Z(e,"alt")||"",l=Z(e,"width")||(a?String(a.source.width):void 0),m=Z(e,"height")||(a?String(a.source.height):void 0),u=Z(e,"sizes"),y=Z(e,"srcset"),v=Z(e,"densities"),b=Z(e,"format"),C=jo(o)||Xe(o)?.transparent===!0,x=Z(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=Z(e,"placeholderColor")||"#e5e7eb",w=Z(e,"provider"),S=Z(e,"class")||Z(e,"className")||"",R=Z(e,"style")||"",P=Z(e,"objectFit")||Z(e,"fit"),k=Z(e,"objectPosition")||Z(e,"position"),N=Z(e,"quality"),H=Ie(e,"lazy",!0),z=Ie(e,"preload",!1),F=Ie(e,"priority",!1),q=Z(e,"loading"),B=Z(e,"decoding")||"async",E=!!a||Ie(e,"picture",!1)||!!b,T=l?Number.parseInt(l):void 0,j=m?Number.parseInt(m):void 0,W=y||"",X="";if(a)W=a.sources[a.fallback.format]||"",X=u?Ve(u):"100vw";else if(!W&&u&&w&&w!=="local"&&w!=="static")W=Ge(o,Ze,w,b),X=Ve(u);else if(!W&&v){let I=v.split(/\s+/).map((_)=>Number.parseFloat(_.replace("x","")));W=In(o,I,T,w,b)}else if(u)X=Ve(u);let L=[];if(R)L.push(R);if(P)L.push(`object-fit:${P}`);if(k)L.push(`object-position:${k}`);if(T&&j)L.push(`aspect-ratio:${T}/${j}`);let D=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let I=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:Xe(o);if(I&&x==="color")L.push(`background-color:${I.color}`),D.push("backgroundColor");else if(I)L.push(`background-color:${I.color}`),L.push(`background-image:url(${I.dataUrl})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundColor","backgroundImage");else{let _=En(T||16,j||9,h);L.push(`background-image:url(${_})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")L.push(`background-image:url(${n(x)})`),L.push("background-size:cover"),L.push("background-repeat:no-repeat"),D.push("backgroundImage");let $e=a?.fallback.url||xe(o,T,j,w,b),Y=[];if(Y.push(`src="${n(wr($e,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let le=q||(F||z?"eager":H?"lazy":"");if(le)Y.push(`loading="${n(le)}"`);if(F)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(B)}"`),S)Y.push(`class="${n(S)}"`);if(L.length>0)Y.push(`style="${n(L.join(";"))}"`);if(W)Y.push(`srcset="${n(wr(W,"fetched"))}"`);if(X)Y.push(`sizes="${n(X)}"`);let te=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(D.length>0){let I=typeof e.static.onload==="string"?e.static.onload:"",_=_n(D)+(I?`;${I}`:"");Y.push(`onload="${n(_)}"`),te.add("onload")}Y.push(...ie(e,te)),Y.push(...ae(e,te));let Te=`<img ${Y.join(" ")} />`,M="";if(z){let _=b==="webp"?"image/webp":b==="avif"?"image/avif":"";M=`<link rel="preload" as="image" href="${n($e)}"${_?` type="${_}"`:""}${W?` imagesrcset="${n(W)}"`:""}${X?` imagesizes="${n(X)}"`:""} />
3
3
  `}if(E){let I=[];if(a)for(let _ of Bo(a))I.push(`<source type="image/${_.format}" srcset="${n(_.srcset)}"${X?` sizes="${n(X)}"`:""} />`);if(!a&&(b==="avif"||b==="auto")){let _=xe(o,T,j,w,"avif"),ee=W?Ge(o,Ze,w,"avif"):`${_}`;I.push(`<source type="image/avif" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}if(!a&&(b==="webp"||b==="auto")){let _=xe(o,T,j,w,"webp"),ee=W?Ge(o,Ze,w,"webp"):`${_}`;I.push(`<source type="image/webp" srcset="${n(ee)}"${X?` sizes="${n(X)}"`:""} />`)}return`${M}<picture>
4
4
  ${I.join(`
5
5
  `)}
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Df,Oh,Nh,Mh,Dh,Lf,jf,Lh,jh,Xo,Bh,lr,ur,vs}from"./chunk-08wa1md0.js";import{nt}from"./chunk-5emrarpf.js";import"./chunk-pzbwnga6.js";import"./chunk-c7t22z4q.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Dh as __setSignalsGeneratorsForTest,nt as cacheEngineFingerprint,ur as cacheTemplate,lr as checkCache,Bh as clearDevCaches,jf as getCachedRouterScript,Lf as getCachedSignalsRuntime,Lh as getServeClientAsset,Xo as getServeModuleBundle,vs as hashFilePath,Nh as invalidateFileCache,Mh as invalidateFileCacheByDir,Oh as readFileCached,jh as registerServeModuleBundle,Df as templateCache};
2
+ import{Df,Oh,Nh,Mh,Dh,Lf,jf,Lh,jh,Xo,Bh,lr,ur,vs}from"./chunk-4k42f3ca.js";import{nt}from"./chunk-5emrarpf.js";import"./chunk-nv77aaqa.js";import"./chunk-ftfvezbd.js";import"./chunk-m7hfcxt3.js";import"./chunk-gebb12ak.js";import"./chunk-r9e0r6jx.js";import"./chunk-ybjfr7e8.js";export{Dh as __setSignalsGeneratorsForTest,nt as cacheEngineFingerprint,ur as cacheTemplate,lr as checkCache,Bh as clearDevCaches,jf as getCachedRouterScript,Lf as getCachedSignalsRuntime,Lh as getServeClientAsset,Xo as getServeModuleBundle,vs as hashFilePath,Nh as invalidateFileCache,Mh as invalidateFileCacheByDir,Oh as readFileCached,jh as registerServeModuleBundle,Df as templateCache};