@stacksjs/stx 0.2.899 → 0.2.901

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 (84) hide show
  1. package/dist/{chunk-hpqvq1r9.js → chunk-03ymcxsb.js} +1 -1
  2. package/dist/{chunk-9n5san33.js → chunk-0tzyr4cc.js} +1 -1
  3. package/dist/chunk-15qrs231.js +2 -0
  4. package/dist/{chunk-h2gnz7ja.js → chunk-1fxq73hk.js} +1 -1
  5. package/dist/{chunk-ft9h5qbs.js → chunk-235fkffb.js} +1 -1
  6. package/dist/chunk-3043ycz6.js +2 -0
  7. package/dist/{chunk-k352spys.js → chunk-52njxk3w.js} +1 -1
  8. package/dist/{chunk-rapr0m13.js → chunk-5hksy9tt.js} +1 -1
  9. package/dist/{chunk-8v2hsn4d.js → chunk-5qkd77vw.js} +1 -1
  10. package/dist/{chunk-jq49238b.js → chunk-6cnahhm1.js} +1 -1
  11. package/dist/{chunk-vgvxs1ag.js → chunk-6d10g8wf.js} +1 -1
  12. package/dist/{chunk-mjqsz20a.js → chunk-6fv02vzc.js} +1 -1
  13. package/dist/chunk-77nn1ckz.js +3 -0
  14. package/dist/{chunk-e5q1ammf.js → chunk-7tjfca0a.js} +1 -1
  15. package/dist/{chunk-1tb18a92.js → chunk-8kvqv885.js} +1 -1
  16. package/dist/{chunk-p4hm5srd.js → chunk-95tvzssr.js} +1 -1
  17. package/dist/{chunk-65rx54n6.js → chunk-9ehryt4w.js} +1 -1
  18. package/dist/{chunk-pd31ge72.js → chunk-9gjt51ac.js} +1 -1
  19. package/dist/{chunk-73nazfe5.js → chunk-9mjr6187.js} +1 -1
  20. package/dist/{chunk-avqxkbrd.js → chunk-a7x8897c.js} +1 -1
  21. package/dist/{chunk-7z1hqp86.js → chunk-at70apjf.js} +1 -1
  22. package/dist/{chunk-d1bwb2kz.js → chunk-bts9v10s.js} +1 -1
  23. package/dist/{chunk-2vqamyay.js → chunk-c05zj2m9.js} +1 -1
  24. package/dist/{chunk-3my2eef2.js → chunk-c2e4m8qq.js} +1 -1
  25. package/dist/{chunk-g065d7p7.js → chunk-ccgcj9tg.js} +1 -1
  26. package/dist/chunk-dvy101w4.js +2 -0
  27. package/dist/{chunk-4e28p8vf.js → chunk-e23yc82s.js} +4 -4
  28. package/dist/{chunk-3k4rteax.js → chunk-e42x1k6j.js} +1 -1
  29. package/dist/{chunk-v5v6w6rn.js → chunk-e9nyfgwk.js} +1 -1
  30. package/dist/{chunk-36mz0nwv.js → chunk-ecknsnr2.js} +1 -1
  31. package/dist/{chunk-gq3gttt5.js → chunk-ek4prrmd.js} +17 -17
  32. package/dist/{chunk-q6p96qq7.js → chunk-f32mtkqf.js} +4 -4
  33. package/dist/chunk-frf4qp4z.js +2 -0
  34. package/dist/{chunk-ytk4f2j9.js → chunk-frjpvdxn.js} +1 -1
  35. package/dist/{chunk-tga3nrn6.js → chunk-g4cs4dj8.js} +2 -2
  36. package/dist/{chunk-fsxk5fsh.js → chunk-gypna2zb.js} +2 -2
  37. package/dist/{chunk-4jtewn1v.js → chunk-h1bd9496.js} +1 -1
  38. package/dist/{chunk-40fpt0r6.js → chunk-hg31hs5d.js} +2 -2
  39. package/dist/chunk-kdh1s839.js +2 -0
  40. package/dist/{chunk-8rgy17fj.js → chunk-kmby9q2c.js} +2 -2
  41. package/dist/{chunk-e4xd1ca7.js → chunk-krdhn8h1.js} +1 -1
  42. package/dist/{chunk-70ez3njv.js → chunk-kxbk4505.js} +1 -1
  43. package/dist/{chunk-9jpsxqaf.js → chunk-kxh9rqdm.js} +1 -1
  44. package/dist/{chunk-javb4e3b.js → chunk-ndwvgwvs.js} +2 -2
  45. package/dist/{chunk-becs8132.js → chunk-ntvgvvrh.js} +1 -1
  46. package/dist/{chunk-9m45t60c.js → chunk-p80nnmha.js} +6 -6
  47. package/dist/{chunk-6hjcqaqr.js → chunk-pgqennwt.js} +1 -1
  48. package/dist/{chunk-0f2d61b3.js → chunk-pms1q3c6.js} +1 -1
  49. package/dist/{chunk-472w7t7p.js → chunk-q3we5jsk.js} +1 -1
  50. package/dist/{chunk-rrpfn9rr.js → chunk-qgcw5jy8.js} +1 -1
  51. package/dist/chunk-s43ty9bg.js +2 -0
  52. package/dist/{chunk-4wd5sn16.js → chunk-sn1qtgmc.js} +3 -3
  53. package/dist/{chunk-r9n86na1.js → chunk-sxkkxmkc.js} +10 -6
  54. package/dist/{chunk-dj8fyaea.js → chunk-v35zj9fq.js} +1 -1
  55. package/dist/{chunk-b6ctdvdf.js → chunk-vtan6nan.js} +2 -2
  56. package/dist/chunk-wkat7js9.js +2 -0
  57. package/dist/{chunk-q4yq72wh.js → chunk-xf2jf63c.js} +1 -1
  58. package/dist/{chunk-bmwcgmev.js → chunk-xk1pht3a.js} +1 -1
  59. package/dist/chunk-xr5xp6v0.js +2 -0
  60. package/dist/{chunk-e0bwzxfd.js → chunk-yar3c574.js} +4 -4
  61. package/dist/{chunk-eka2e4cm.js → chunk-ybpxtaft.js} +1 -1
  62. package/dist/{chunk-n8xjqsze.js → chunk-yf715phy.js} +1 -1
  63. package/dist/{chunk-cgqpn3e2.js → chunk-yjs11rre.js} +1 -1
  64. package/dist/{chunk-fe1wmmr5.js → chunk-ysncnbyf.js} +1 -1
  65. package/dist/cli.js +7 -7
  66. package/dist/craft-entry.js +1 -1
  67. package/dist/craft.js +1 -1
  68. package/dist/dev-server/serve-app.js +2 -1
  69. package/dist/native/runtime/craft-bridge.js +17 -3
  70. package/dist/native/runtime/craft.d.ts +1 -0
  71. package/dist/offline/app-service-worker.d.ts +2 -1
  72. package/dist/offline/app-service-worker.js +6 -1
  73. package/dist/pwa.js +1 -1
  74. package/dist/ssg.js +2 -2
  75. package/package.json +5 -5
  76. package/dist/chunk-3m37fzvh.js +0 -2
  77. package/dist/chunk-8a9gmbxa.js +0 -2
  78. package/dist/chunk-9vafweyd.js +0 -3
  79. package/dist/chunk-psyqrxg0.js +0 -2
  80. package/dist/chunk-ryp47rwp.js +0 -2
  81. package/dist/chunk-t9j000tb.js +0 -2
  82. package/dist/chunk-y10eaxgc.js +0 -2
  83. package/dist/chunk-zcys6b06.js +0 -2
  84. package/dist/chunk-zpwh9bpc.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{en,we,R}from"./chunk-0jdz31q1.js";import{Pi,nl,o,A,We,Oe,En,qe,ke,se,Mr,O,$n,oo,pl,fl,An,Fr,ao,co,gl,Bi,ml,hl,yl,bl,Ke,Ge,lo,Ye,s,In,b,g,Y,ae,Ne,P,qi}from"./chunk-9m45t60c.js";import{d,m,M,n,ce,te,u,Me,Ji,K,Ln,Yi,Zt,Zi,Pl,Wr,Il,vt,Ol,qr,Nl,jn,Qi,Ml,Kr,Xr,De,ea}from"./chunk-945zygwa.js";import{Jt}from"./chunk-esm0pnpz.js";import{Mn}from"./chunk-472w7t7p.js";import{S}from"./chunk-fsxk5fsh.js";import{Ar,Gs}from"./chunk-0b57fgpn.js";import{Bc,Fc,Tr,dt,zc,j}from"./chunk-40fpt0r6.js";import{xi,Si,ki,_i}from"./chunk-150cz8qq.js";import{kn,Nc,Rs}from"./chunk-eka2e4cm.js";import{Cs,Es,Ts}from"./chunk-q6p96qq7.js";import{Is,fi,gi,Os,Ns,mi}from"./chunk-8rgy17fj.js";import{As,ci}from"./chunk-8v2hsn4d.js";import{si}from"./chunk-de61k0ab.js";import{ge,li,ui,di}from"./chunk-5jrpzepc.js";import{kr,Re,Dc,_r,Lc}from"./chunk-e0bwzxfd.js";import{W,lt}from"./chunk-a7bqrjm5.js";import{Z}from"./chunk-65g78sge.js";import{Vc,Uc}from"./chunk-rapr0m13.js";import{I,Bn,ta}from"./chunk-qykbjg3z.js";import{Hn}from"./chunk-68r2zs20.js";import{L,c,f}from"./chunk-p92272k0.js";function ze(r){return/\bimport\s*\.\s*meta\b/.test(Hn(r))}function Br(r){let e=Oe(r),l=[],a=0;for(let h=0;h<e.length;h++){let t=e[h],p=t.name.toLowerCase();if(p==="template")a+=t.closing?-1:1;if(p!=="script"||t.closing)continue;let w=e[h+1];if(w?.name.toLowerCase()!=="script"||!w.closing)continue;l.push({start:t.start,end:w.end,attrs:t.attributes,body:r.slice(t.end,w.start),inert:a>0})}return l}function nt(r){return[...r].map(([e,l])=>l===!0?e:`${e}="${l.replace(/"/g,"&quot;")}"`).join(" ")}function wt(r){let e=Br(r);if(e.some((y)=>O(y.attrs).has("data-stx-module-bootstrap")))return r;let l=(y)=>{if(ze(y))return!0;try{return Z(y)}catch{return!1}};if(!e.some((y)=>l(y.body)||O(y.attrs).get("type")==="module"))return r;let a=new Bun.CryptoHasher("md5").update(r).digest("hex").slice(0,16),h="",t=0,p=!1,w=0;for(let y of e){let v=O(y.attrs),x=v.get("type");if(y.inert||v.has("data-stx-module-job")||v.has("data-stx-runtime")||v.has("data-stx-router"))continue;if(typeof x==="string"&&!["module","text/javascript","application/javascript"].includes(x.toLowerCase()))continue;if(![...v.keys()].some((T)=>/^data-stx-(?:scoped|modules|stores|(?:framework-)?composables)$/.test(T)))continue;let _=x==="module"||l(y.body);if(_)p=!0;if(!p)continue;if(!_&&(v.has("data-stx-owner")||v.has("data-stx-instance")))continue;h+=r.slice(t,y.start);let E=y.body,D=v.get("src");if(typeof D==="string")v.delete("src"),v.set("data-stx-source-url",D),E=`${_?"await":"return"} new Promise(function(resolve,reject){
2
+ import{en,we,R}from"./chunk-0jdz31q1.js";import{Pi,nl,o,A,We,Oe,En,qe,ke,se,Mr,O,$n,oo,pl,fl,An,Fr,ao,co,gl,Bi,ml,hl,yl,bl,Ke,Ge,lo,Ye,s,In,b,g,Y,ae,Ne,P,qi}from"./chunk-p80nnmha.js";import{d,m,M,n,ce,te,u,Me,Ji,K,Ln,Yi,Zt,Zi,Pl,Wr,Il,vt,Ol,qr,Nl,jn,Qi,Ml,Kr,Xr,De,ea}from"./chunk-945zygwa.js";import{Jt}from"./chunk-esm0pnpz.js";import{Mn}from"./chunk-q3we5jsk.js";import{S}from"./chunk-gypna2zb.js";import{Ar,Gs}from"./chunk-0b57fgpn.js";import{Bc,Fc,Tr,dt,zc,j}from"./chunk-hg31hs5d.js";import{xi,Si,ki,_i}from"./chunk-150cz8qq.js";import{kn,Nc,Rs}from"./chunk-ybpxtaft.js";import{Cs,Es,Ts}from"./chunk-f32mtkqf.js";import{Is,fi,gi,Os,Ns,mi}from"./chunk-kmby9q2c.js";import{As,ci}from"./chunk-5qkd77vw.js";import{si}from"./chunk-de61k0ab.js";import{ge,li,ui,di}from"./chunk-5jrpzepc.js";import{kr,Re,Dc,_r,Lc}from"./chunk-yar3c574.js";import{W,lt}from"./chunk-a7bqrjm5.js";import{Z}from"./chunk-65g78sge.js";import{Vc,Uc}from"./chunk-5hksy9tt.js";import{I,Bn,ta}from"./chunk-qykbjg3z.js";import{Hn}from"./chunk-68r2zs20.js";import{L,c,f}from"./chunk-p92272k0.js";function ze(r){return/\bimport\s*\.\s*meta\b/.test(Hn(r))}function Br(r){let e=Oe(r),l=[],a=0;for(let h=0;h<e.length;h++){let t=e[h],p=t.name.toLowerCase();if(p==="template")a+=t.closing?-1:1;if(p!=="script"||t.closing)continue;let w=e[h+1];if(w?.name.toLowerCase()!=="script"||!w.closing)continue;l.push({start:t.start,end:w.end,attrs:t.attributes,body:r.slice(t.end,w.start),inert:a>0})}return l}function nt(r){return[...r].map(([e,l])=>l===!0?e:`${e}="${l.replace(/"/g,"&quot;")}"`).join(" ")}function wt(r){let e=Br(r);if(e.some((y)=>O(y.attrs).has("data-stx-module-bootstrap")))return r;let l=(y)=>{if(ze(y))return!0;try{return Z(y)}catch{return!1}};if(!e.some((y)=>l(y.body)||O(y.attrs).get("type")==="module"))return r;let a=new Bun.CryptoHasher("md5").update(r).digest("hex").slice(0,16),h="",t=0,p=!1,w=0;for(let y of e){let v=O(y.attrs),x=v.get("type");if(y.inert||v.has("data-stx-module-job")||v.has("data-stx-runtime")||v.has("data-stx-router"))continue;if(typeof x==="string"&&!["module","text/javascript","application/javascript"].includes(x.toLowerCase()))continue;if(![...v.keys()].some((T)=>/^data-stx-(?:scoped|modules|stores|(?:framework-)?composables)$/.test(T)))continue;let _=x==="module"||l(y.body);if(_)p=!0;if(!p)continue;if(!_&&(v.has("data-stx-owner")||v.has("data-stx-instance")))continue;h+=r.slice(t,y.start);let E=y.body,D=v.get("src");if(typeof D==="string")v.delete("src"),v.set("data-stx-source-url",D),E=`${_?"await":"return"} new Promise(function(resolve,reject){
3
3
  var source=globalThis.__stxExecutingScript,script=document.createElement('script');
4
4
  for(var attr of source.attributes)if(!['type','src','data-stx-module-job'].includes(attr.name))script.setAttribute(attr.name,attr.value);
5
5
  ${_?"script.type='module';":""}
@@ -636,9 +636,9 @@ ${T.element}`);k.push("@endif");let _=k.join(`
636
636
  `),E=t[0].outerStart,D=t[t.length-1].outerEnd;e=e.slice(0,E)+_+e.slice(D),l=E+_.length}return e}function qn(r){return r.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Fn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=Rn.has(a.tag),t=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(w,y,v)=>{let x=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(y);if(!x||!v||!/^["']/.test(v))return w;let k=x[1]||"modelValue",_=x[2];if(h&&!x[1])return`@model${_}=${v}`;let E=v[0],D=v.slice(1,-1),T=`:${k}=${v} @update:${k}=${E}${D} = $event${E}`;if(_){let C=x[1]?`${k}Modifiers`:"modelModifiers",N=_.slice(1).split(".").map((q)=>`${q}: true`).join(", ");T+=` :${C}="{ ${N} }"`}return T});if(t===a.attrs){l=a.end;continue}let p=Pe(a.full,{...a,start:0,end:a.full.length},t);e=e.slice(0,a.start)+p+e.slice(a.end),l=a.start+p.length}return e}function Un(r){return r.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Vn(r){return r.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Wn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=Xe(a.attrs,"v-html");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let t=Te(e,a),p=_e(a.attrs,"v-html"),w=a.selfClosing?" /":"",y=`<${a.tag}${p}${w}>{!! ${h} !!}</${a.tag}>`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function Xn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;let h=Xe(a.attrs,"v-text");if(h===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let t=Te(e,a),p=_e(a.attrs,"v-text"),w=a.selfClosing?" /":"",y=`<${a.tag}${p}${w}>{{ ${h} }}</${a.tag}>`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function zn(r){return r.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function Kn(r){let e=r,l=0;while(l<e.length){let a=Ce(e,l);if(!a)break;if(!sr(a.attrs,"v-once")){l=a.end;continue}let h=_e(a.attrs,"v-once"),t=Te(e,a),p=e.slice(t.outerStart,t.outerEnd),y=`@once
637
637
  ${Pe(p,{...a,start:0,end:a.end-a.start},h)}
638
638
  @endonce`;e=e.slice(0,t.outerStart)+y+e.slice(t.outerEnd),l=t.outerStart+y.length}return e}function Jn(r){return r.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Gn(r){return r.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function ir(r){if(!On(r))return r;let e=r;return e=Pn(e),e=Nn(e),e=Kn(e),e=Un(e),e=Vn(e),e=Fn(e),e=qn(e),e=Gn(e),e=Wn(e),e=Xn(e),e=zn(e),e=Jn(e),e}function tt(r){return r.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var pt=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),Zn=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Qn(r,e){let l=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(r),a=l?l[1]:r,h=d(a,e);if(h&&typeof h==="string")return h;let t=a.trim();return pt.has(t)?t:null}function or(r){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(r);return e?e[1]:r}function ar(r,e,l){let a=e.replace(/\s*(?::is|v-bind:is|__stx_is)\s*=\s*"[^"]*"/gi,"").replace(/\b__stx_([\w-]+)\s*=\s*"([^"]*)"/g,(t,p,w)=>{let y=kn(w);if(y===null||y===void 0||y===!1)return"";if(y===!0)return p;return`${p}="${String(y).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}"`}).trim(),h=a?`<${r} ${a}>`:`<${r}>`;if(Zn.has(r))return a?`<${r} ${a}>`:`<${r}>`;return`${h}${l}</${r}>`}function cr(r,e,l){if(e!==void 0){let a=kn(e);return typeof a==="string"&&a?a:null}return Qn(r??"",l)}function lr(r,e){let l={},a=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,h;while((h=a.exec(r.trim()))!==null){let t=h[1]||h[2],p=h[3];if(h[1])try{l[t]=d(p,e)}catch{l[t]=p}else if(t.startsWith("__stx_"))l[t.slice(6)]=kn(p);else l[t]=p}return l}async function ur(r,e,l,a,h){let t=r,p=/<component\s+(?:(?::is|v-bind:is)\s*=\s*"([^"]*)"|__stx_is\s*=\s*"([^"]*)")([^>]*)>([\s\S]*?)<\/component>/gi,w=[],y;while((y=p.exec(t))!==null)w.push({full:y[0],expr:y[1],encoded:y[2],attrs:y[3],slotContent:y[4],index:y.index});for(let v=w.length-1;v>=0;v--){let x=w[v];try{let k=cr(x.expr,x.encoded,e);if(!k||typeof k!=="string"){let T=`<!-- dynamic component: could not resolve "${tt(or(x.expr??"a value a loop evaluated"))}" -->`;t=t.slice(0,x.index)+T+t.slice(x.index+x.full.length);continue}if(pt.has(k)){let T=ar(k,x.attrs,x.slotContent);t=t.slice(0,x.index)+T+t.slice(x.index+x.full.length);continue}let _=lr(x.attrs,e),E=a.componentsDir||"components",D=await Ye(k,_,x.slotContent,E,e,l,a,new Set,h??new Set);t=t.slice(0,x.index)+D+t.slice(x.index+x.full.length)}catch(k){let _=k instanceof Error?k.message:String(k),E=`<!-- dynamic component error: ${tt(_)} -->`;t=t.slice(0,x.index)+E+t.slice(x.index+x.full.length)}}return t=await Yn(t,e,l,a,h),t}async function Yn(r,e,l,a,h){let t=r,p=/<component\s+(?:(?::is|v-bind:is)\s*=\s*"([^"]*)"|__stx_is\s*=\s*"([^"]*)")([^>]*?)\/>/gi,w=[],y;while((y=p.exec(t))!==null)w.push({full:y[0],expr:y[1],encoded:y[2],attrs:y[3],index:y.index});for(let v=w.length-1;v>=0;v--){let x=w[v];try{let k=cr(x.expr,x.encoded,e);if(!k||typeof k!=="string"){let D=`<!-- dynamic component: could not resolve "${tt(or(x.expr??"a value a loop evaluated"))}" -->`;t=t.slice(0,x.index)+D+t.slice(x.index+x.full.length);continue}if(pt.has(k)){let D=ar(k,x.attrs,"");t=t.slice(0,x.index)+D+t.slice(x.index+x.full.length);continue}let _=a.componentsDir||"components",E=await Ye(k,lr(x.attrs,e),"",_,e,l,a,new Set,h??new Set);t=t.slice(0,x.index)+E+t.slice(x.index+x.full.length)}catch(k){let _=k instanceof Error?k.message:String(k),E=`<!-- dynamic component error: ${tt(_)} -->`;t=t.slice(0,x.index)+E+t.slice(x.index+x.full.length)}}return t}var Ac="X-STX-Build",ft=Symbol.for("stx.buildId");function _s(){let r=globalThis;if(!r[ft])r[ft]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return r[ft]}function dr(r,e=_s()){if(r.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(r))return null;return`
639
- <meta name="stx-build" content="${e}">`}var ni="/_stx/sw.js";function es(r){if(typeof r!=="string"||!r.startsWith("/"))return null;let e=[],l=[],a=r.replace(/\/+$/,"").split("/").slice(1).map((h)=>{let t=/^:(\w+)$/.exec(h)||/^\[(\w+)\]$/.exec(h);if(t)return e.push(t[1]),l.push("0"),"([^/]+)";return l.push(h),h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:r,re:`^/${a.join("/")}/?$`,names:e,sample:`/${l.join("/")}`}}function ts(r,e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let l=navigator.serviceWorker,a=window;if(a.stxOffline)return;let h=null,t=!1,p=!1,w=[],y={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>h,onUpdateReady(_){if(y.updateReady)try{_()}catch{}else w.push(_);return()=>{let E=w.indexOf(_);if(E!==-1)w.splice(E,1)}},applyUpdate(){let _=h&&h.waiting;if(!_)return!1;return p=!0,_.postMessage({type:"stx:activate-update",force:!0}),!0}};a.stxOffline=y;let v=(_)=>{if(!_.waiting||!l.controller||y.updateReady)return;y.updateReady=!0;let E=w.splice(0);for(let D of E)try{D()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};l.addEventListener("message",(_)=>{let E=_.data||{};if(E.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:E.url,kind:E.kind,fragment:!!E.fragment}}))}catch{}if(E.type==="stx:reachability"){if(a.stxOffline.reachable=E.reachable!==!1,Number(E.at)>0)a.stxOffline.reachedAt=Number(E.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:E.reachable!==!1,at:Number(E.at)||0}}))}catch{}}}),l.addEventListener("controllerchange",()=>{if(p)p=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&h&&h.waiting)h.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let x=()=>{if(t)return;if(e&&!e.some((_)=>{let E=_.replace(/\/+$/,"")||"/";return E==="/"||location.pathname===E||location.pathname.startsWith(`${E}/`)}))return;t=!0,window.removeEventListener("stx:load",k),l.register(r,{scope:"/"}).then((_)=>{h=_;try{l.controller?.postMessage({type:"stx:reachability?"})}catch{}if(_.waiting)v(_),_.waiting.postMessage({type:"stx:activate-update",reason:"load"});_.addEventListener("updatefound",()=>{let E=_.installing;if(!E)return;E.addEventListener("statechange",()=>{if(E.state==="installed")v(_)})})}).catch(()=>{if(t=!1,e)window.addEventListener("stx:load",k)})},k=()=>{let _=(E)=>{setTimeout(E,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>_(x));else _(x)};if(e)window.addEventListener("stx:load",k);if(!l.controller)if(document.readyState==="complete")k();else addEventListener("load",k);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function pr(r){let e=r?.filter((a)=>typeof a==="string"&&a.startsWith("/")&&!a.startsWith("//")),l=`(${ts.toString()})(${JSON.stringify("/_stx/sw.js")}${e?`,${JSON.stringify(e)}`:""})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(l).trim().replace(/;$/,"")}catch{return l}}function rs(r,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!r||!r.startsWith("/"))return null;let l=r.split(/[?#]/)[0].split("/").filter(Boolean)[0];return l?`/${l}`:"/"}var ns=`<script data-stx-offline>${pr()}</script>`;function fr(r){return r.registerOn===void 0?ns:`<script data-stx-offline>${pr(r.registerOn)}</script>`}function ri(r,e){let l=Number(r.precacheTimeoutMs),a={build:String(e||"dev"),pages:Array.from(new Set((r.pages||[]).filter((h)=>typeof h==="string"&&h.startsWith("/")))),staticPages:(r.staticPages||[]).filter((h)=>typeof h==="string"&&((r.pages||[]).includes(h)||(r.routes||[]).includes(h))),api:r.apiPrefix||"/api/",timeout:Math.max(500,Number(r.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(l)&&l>0?Math.min(2147483647,Math.max(1,Math.floor(l))):1e4,networkFirst:(r.networkFirst||[]).filter((h)=>typeof h==="string"&&h.startsWith("/")),updateOnColdStart:r.updateOnColdStart===!0,fallback:r.fallback||r.pages&&r.pages[0]||null,fallbackScope:rs(r.fallback||r.pages&&r.pages[0]||null,r.fallbackScope),routes:(r.routes||[]).map(es).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...r.exclude||[]],mediaMax:Math.max(10485760,Number(r.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(r.assetsMaxEntries)||500)};return`/* stx offline worker, build ${a.build} */
639
+ <meta name="stx-build" content="${e}">`}var ni="/_stx/sw.js";function es(r){if(typeof r!=="string"||!r.startsWith("/"))return null;let e=[],l=[],a=r.replace(/\/+$/,"").split("/").slice(1).map((h)=>{let t=/^:(\w+)$/.exec(h)||/^\[(\w+)\]$/.exec(h);if(t)return e.push(t[1]),l.push("0"),"([^/]+)";return l.push(h),h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:r,re:`^/${a.join("/")}/?$`,names:e,sample:`/${l.join("/")}`}}function ts(r,e){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let l=navigator.serviceWorker,a=window;if(a.stxOffline)return;let h=null,t=!1,p=!1,w=[],y={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>h,onUpdateReady(_){if(y.updateReady)try{_()}catch{}else w.push(_);return()=>{let E=w.indexOf(_);if(E!==-1)w.splice(E,1)}},applyUpdate(){let _=h&&h.waiting;if(!_)return!1;return p=!0,_.postMessage({type:"stx:activate-update",force:!0}),!0}};a.stxOffline=y;let v=(_)=>{if(!_.waiting||!l.controller||y.updateReady)return;y.updateReady=!0;let E=w.splice(0);for(let D of E)try{D()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};l.addEventListener("message",(_)=>{let E=_.data||{};if(E.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:E.url,kind:E.kind,fragment:!!E.fragment}}))}catch{}if(E.type==="stx:reachability"){if(a.stxOffline.reachable=E.reachable!==!1,Number(E.at)>0)a.stxOffline.reachedAt=Number(E.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:E.reachable!==!1,at:Number(E.at)||0}}))}catch{}}}),l.addEventListener("controllerchange",()=>{if(p)p=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&h&&h.waiting)h.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let x=()=>{if(t)return;if(e&&!e.some((_)=>{let E=_.replace(/\/+$/,"")||"/";return E==="/"||location.pathname===E||location.pathname.startsWith(`${E}/`)}))return;t=!0,window.removeEventListener("stx:load",k),l.register(r,{scope:"/"}).then((_)=>{h=_;try{l.controller?.postMessage({type:"stx:reachability?"})}catch{}if(_.waiting)v(_),_.waiting.postMessage({type:"stx:activate-update",reason:"load"});_.addEventListener("updatefound",()=>{let E=_.installing;if(!E)return;E.addEventListener("statechange",()=>{if(E.state==="installed")v(_)})})}).catch(()=>{if(t=!1,e)window.addEventListener("stx:load",k)})},k=()=>{let _=(E)=>{setTimeout(E,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>_(x));else _(x)};if(e)window.addEventListener("stx:load",k);if(!l.controller)if(document.readyState==="complete")k();else addEventListener("load",k);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",k);else k()}function pr(r){let e=r?.filter((a)=>typeof a==="string"&&a.startsWith("/")&&!a.startsWith("//")),l=`(${ts.toString()})(${JSON.stringify("/_stx/sw.js")}${e?`,${JSON.stringify(e)}`:""})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(l).trim().replace(/;$/,"")}catch{return l}}function rs(r,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!r||!r.startsWith("/"))return null;let l=r.split(/[?#]/)[0].split("/").filter(Boolean)[0];return l?`/${l}`:"/"}var ns=`<script data-stx-offline>${pr()}</script>`;function fr(r){return r.registerOn===void 0?ns:`<script data-stx-offline>${pr(r.registerOn)}</script>`}function ri(r,e,l=[]){let a=Number(r.precacheTimeoutMs),h={build:String(e||"dev"),pages:Array.from(new Set((r.pages||[]).filter((t)=>typeof t==="string"&&t.startsWith("/")))),exactPages:Array.from(new Set([...l,...r.pages||[],...r.routes||[]].filter((t)=>typeof t==="string"&&t.startsWith("/")&&!t.includes("[")&&!t.includes(":")&&!t.includes("*")).map((t)=>t.replace(/\/+$/,"")||"/"))),staticPages:(r.staticPages||[]).filter((t)=>typeof t==="string"&&((r.pages||[]).includes(t)||(r.routes||[]).includes(t))),api:r.apiPrefix||"/api/",timeout:Math.max(500,Number(r.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(a)&&a>0?Math.min(2147483647,Math.max(1,Math.floor(a))):1e4,networkFirst:(r.networkFirst||[]).filter((t)=>typeof t==="string"&&t.startsWith("/")),updateOnColdStart:r.updateOnColdStart===!0,fallback:r.fallback||r.pages&&r.pages[0]||null,fallbackScope:rs(r.fallback||r.pages&&r.pages[0]||null,r.fallbackScope),routes:(r.routes||[]).map(es).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...r.exclude||[]],mediaMax:Math.max(10485760,Number(r.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(r.assetsMaxEntries)||500)};return`/* stx offline worker, build ${h.build} */
640
640
  'use strict';
641
- var S = ${JSON.stringify(a)};
641
+ var S = ${JSON.stringify(h)};
642
642
  var SHELL = 'stx-shell-' + S.build;
643
643
  var ASSETS = 'stx-assets';
644
644
  var DATA = 'stx-data';
@@ -824,6 +824,10 @@ function routeKey(route, fragment) {
824
824
  }
825
825
 
826
826
  function routeOf(pathname) {
827
+ // The file router gives literal pages precedence over parameter routes.
828
+ // Otherwise a slow /workouts/library first opens the /workouts/:id shell,
829
+ // and its later response replaces that shell for every real workout too.
830
+ if (S.exactPages.indexOf(pathname.replace(/\\/+$/, '') || '/') !== -1) return null;
827
831
  for (var i = 0; i < S.routes.length; i++) {
828
832
  var match = new RegExp(S.routes[i].re).exec(pathname);
829
833
  if (!match) continue;
@@ -1350,7 +1354,7 @@ ${C}
1350
1354
  </style>`;a=a.replace(v,N),w.lastIndex=0}catch(C){}}}return a}import gt from"path";var is=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,os=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function as(r,e){if(!e||!r.includes("/"))return r;let l=gt.dirname(e);return r.replace(is,(a,h,t,p)=>{let w=gt.resolve(l,p);return`${h}${t}${w.split(gt.sep).join("/")}${t}`})}function wr(r,e){if(!e||!r.includes("<script"))return r;return r.replace(os,(l,a,h,t)=>`${a}${as(h,e)}${t}`)}var Ae="<!--PARENT_CONTENT_PLACEHOLDER-->";function vr(r){return r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Dr(r,e){let l=r.length,a=e,h=!0,t=[],p=(w)=>w+9<=l&&r[w]==="<"&&r[w+1]==="/"&&(r[w+2]==="s"||r[w+2]==="S")&&(r[w+3]==="c"||r[w+3]==="C")&&(r[w+4]==="r"||r[w+4]==="R")&&(r[w+5]==="i"||r[w+5]==="I")&&(r[w+6]==="p"||r[w+6]==="P")&&(r[w+7]==="t"||r[w+7]==="T")&&(r[w+8]===">"||/\s/.test(r[w+8]));while(a<l){let w=r[a];if(p(a))return a;if(w==="/"&&r[a+1]==="/"){if(a=r.indexOf(`
1351
1355
  `,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&r[a+1]==="*"){let y=r.indexOf("*/",a+2);if(y===-1)return-1;a=y+2,h=!0;continue}if(w==="/"&&h){let y=a+1,v=!1;while(y<l){let x=r[y];if(x==="\\"){y+=2;continue}if(x==="[")v=!0;else if(x==="]")v=!1;else if(x==="/"&&!v){y++;break}else if(x===`
1352
1356
  `){y=-1;break}y++}if(y===-1){a++,h=!1;continue}while(y<l&&/[a-z]/.test(r[y]))y++;a=y,h=!1;continue}if(w==="'"||w==='"'){let y=w;a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]===y){a++;break}if(r[a]===`
1353
- `)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function Ir(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var ls=4096;async function mt(r,e,l){if(ze(e)||Z(e)||l.buildMode!=="serve"||e.length<ls)return null;let{registerServeModuleBundle:a}=await import("./chunk-0f2d61b3.js");return`<script ${r} src="${a(e)}"></script>`}async function yr(r,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:t}=await o("stx/client-module-registry",()=>import("./chunk-ytk4f2j9.js")),p=[],w=await t(h(...r),{minify:ta(e.buildMode,e.minifyClient),collectInputs:p});for(let y of p)l?.add(y);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"&&!ze(w)&&!Z(w)){let{registerServeModuleBundle:y}=await import("./chunk-0f2d61b3.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${y(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function us(r,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:_}=await o("stx/framework-composables",()=>import("./chunk-rrpfn9rr.js"));h.frameworkScript=await _(r)}catch{}let t=null;try{t=await o("stx/store-loader",()=>import("./chunk-36mz0nwv.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(t?.pageStoresAll()??!0),y=w?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),v=[],x=[],k=null;for(let _=0;_<8;_++){let E=null,D="",T=!1;try{if(t){let U=w?await t.getStoreScript(p).then((V)=>V?{code:V,stores:["*"],functions:null}:null):await t.getStoreScriptFor(p,[y],{reads:t.storesReadInFiles([...v,...x]),runOnce:!0});if(U)E=U.code,D=U.stores.join(","),T=!!U.functions&&!w}}catch{}if(k!==null&&D===k)break;k=D;let C=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",N=E?`<script ${C}>${E}</script>`:null;h.storeCode=E,h.storeTag=E?await mt(C,E,e)??N:null;let q={};h.modulesTag=await yr([r,N],e,l,q),h.modulesCode=q.code??null,v=q.inputs??[],h.composableTag=null,h.composableCode=null,x=[];try{let{getComposableScript:U}=await o("stx/composable-loader",()=>import("./chunk-ryp47rwp.js")),V=e.composablesDir,H=[h.modulesCode??h.modulesTag,N,h.frameworkScript].filter((F)=>F!==null),B=await U(e._layerComposableDirs??V,r,H,x);if(B)h.composableCode=B,h.composableTag=await mt('data-stx-scoped data-stx-run="always" data-stx-composables',B,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{}if(w||!t)break}return h}async function ds(r,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:t}=await import("./chunk-2vqamyay.js"),p=await import("./chunk-kvjbpbmw.js"),{messages:w,webModules:y}=e,v=null,x=null,k=t()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{v=await p.loadPageMessages(process.cwd(),w)}catch(C){ps(C)}if(y&&Object.keys(y).length&&k)try{x=await(await import("./chunk-ayady5ws.js")).loadWebModules(process.cwd(),y)}catch(C){fs(C)}let _=new Map([...x??[],...v?.stubs??[]]),E=()=>us(r,e,l,a),D=_.size?await h(_,E):await E(),T=null;if(v){let C=p.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),N=p.pageMessagesScript(v,p.pageLanguages(r,v),C);if(N)T=await mt('data-stx-scoped data-stx-run="always" data-stx-messages',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${N.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((C)=>C!==null)}var xr=!1;function ps(r){if(xr)return;xr=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var Sr=!1;function fs(r){if(Sr)return;Sr=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function gs(r,e=""){let l=Ir(r,"data-stx-runtime");if(!l)return r;let a=kr(r);if(a===-1||a===l.start){if(!e)return r;return r.slice(0,l.end)+e+r.slice(l.end)}if(a<l.start)return r.slice(0,a)+r.slice(l.start,l.end)+e+`
1357
+ `)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function Ir(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var ls=4096;async function mt(r,e,l){if(ze(e)||Z(e)||l.buildMode!=="serve"||e.length<ls)return null;let{registerServeModuleBundle:a}=await import("./chunk-pms1q3c6.js");return`<script ${r} src="${a(e)}"></script>`}async function yr(r,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:t}=await o("stx/client-module-registry",()=>import("./chunk-frjpvdxn.js")),p=[],w=await t(h(...r),{minify:ta(e.buildMode,e.minifyClient),collectInputs:p});for(let y of p)l?.add(y);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"&&!ze(w)&&!Z(w)){let{registerServeModuleBundle:y}=await import("./chunk-pms1q3c6.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${y(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function us(r,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:_}=await o("stx/framework-composables",()=>import("./chunk-qgcw5jy8.js"));h.frameworkScript=await _(r)}catch{}let t=null;try{t=await o("stx/store-loader",()=>import("./chunk-ecknsnr2.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(t?.pageStoresAll()??!0),y=w?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),v=[],x=[],k=null;for(let _=0;_<8;_++){let E=null,D="",T=!1;try{if(t){let U=w?await t.getStoreScript(p).then((V)=>V?{code:V,stores:["*"],functions:null}:null):await t.getStoreScriptFor(p,[y],{reads:t.storesReadInFiles([...v,...x]),runOnce:!0});if(U)E=U.code,D=U.stores.join(","),T=!!U.functions&&!w}}catch{}if(k!==null&&D===k)break;k=D;let C=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",N=E?`<script ${C}>${E}</script>`:null;h.storeCode=E,h.storeTag=E?await mt(C,E,e)??N:null;let q={};h.modulesTag=await yr([r,N],e,l,q),h.modulesCode=q.code??null,v=q.inputs??[],h.composableTag=null,h.composableCode=null,x=[];try{let{getComposableScript:U}=await o("stx/composable-loader",()=>import("./chunk-xr5xp6v0.js")),V=e.composablesDir,H=[h.modulesCode??h.modulesTag,N,h.frameworkScript].filter((F)=>F!==null),B=await U(e._layerComposableDirs??V,r,H,x);if(B)h.composableCode=B,h.composableTag=await mt('data-stx-scoped data-stx-run="always" data-stx-composables',B,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{}if(w||!t)break}return h}async function ds(r,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:t}=await import("./chunk-c05zj2m9.js"),p=await import("./chunk-kvjbpbmw.js"),{messages:w,webModules:y}=e,v=null,x=null,k=t()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{v=await p.loadPageMessages(process.cwd(),w)}catch(C){ps(C)}if(y&&Object.keys(y).length&&k)try{x=await(await import("./chunk-ayady5ws.js")).loadWebModules(process.cwd(),y)}catch(C){fs(C)}let _=new Map([...x??[],...v?.stubs??[]]),E=()=>us(r,e,l,a),D=_.size?await h(_,E):await E(),T=null;if(v){let C=p.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),N=p.pageMessagesScript(v,p.pageLanguages(r,v),C);if(N)T=await mt('data-stx-scoped data-stx-run="always" data-stx-messages',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${N.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((C)=>C!==null)}var xr=!1;function ps(r){if(xr)return;xr=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var Sr=!1;function fs(r){if(Sr)return;Sr=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function gs(r,e=""){let l=Ir(r,"data-stx-runtime");if(!l)return r;let a=kr(r);if(a===-1||a===l.start){if(!e)return r;return r.slice(0,l.end)+e+r.slice(l.end)}if(a<l.start)return r.slice(0,a)+r.slice(l.start,l.end)+e+`
1354
1358
  `+r.slice(a,l.start)+r.slice(l.end);let h=r.slice(l.start,l.end),t=r.slice(0,l.start)+r.slice(l.end),p=kr(t);if(p===-1)return h+e+`
1355
1359
  `+t;return t.slice(0,p)+h+e+`
1356
1360
  `+t.slice(p)}function ms(r){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return r.replace(e,(l,a,h)=>{let t=r.slice(0,h);return t.lastIndexOf("<")>t.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(r,e,l,a,h){if(await R(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return r;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Ne(r,l);let t=!e.__stxProcessingDepth;An(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(t&&a.runtimeConfig)await Mn(e,l,a.runtimeConfig);if(t)yl(e),e.__stx_scope_seq??={n:0,key:lo(String(e.__filename??l))},e.__stx_head_injections=Zi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!I()&&!Bn())&&l&&l.endsWith(".stx"))si(r,l);try{return await we.timeAsync("template-processing",async()=>{let p=await hs(r,e,l,a,h);if(t)p=Bi(p);if(t&&a.autoShell&&a.buildMode!=="compile"){let w=De(a.app?.head,{known:Xr,source:"app.head"}),v=(e.__stx_runtime_head||null)??ea(),x=(e.__stx_head_raw||"").trim(),k,_=x.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)k=_[1].trim(),x=x.replace(_[0],"").trim();let E=e.__sections?.title,D=E?P(E,e,l):void 0,T=v.title||k||D,C=!v.title&&(!!k||!!D),N=v.meta||[],q=new Set(N.map((J)=>vt(J)).filter(Boolean)),U={...w,...T&&{title:T},meta:[...(w.meta||[]).filter((J)=>!q.has(vt(J))),...N],link:[...w.link||[],...v.link||[]],script:[...w.script||[],...v.script||[]],headRaw:[w.headRaw,x].filter(Boolean).join(`
@@ -1365,7 +1369,7 @@ ${y.trim()}
1365
1369
  @endsection`}}if(N&&y.includes("<script")){let H=se(y),B=H.scripts.map((F)=>$r(F,l)??F);y=Mr(H.output,B)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,B,F)=>(C[B]=F,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,B,F)=>{if(/^(['"]).*\1$/.test(F.trim()))return H;try{let J=d(F.trim(),e);if(J===void 0)return H;let G=(e.__stx_inline_section_values??=[]).push(J)-1;return C[B]=`{{ __stx_inline_section_values[${G}] }}`,""}catch{return H}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,B,F)=>{if(F.includes("@parent"))C[B]=F.replace("@parent",Ae);else C[B]=F.trim();return""}),e.__sections=C,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,B,F)=>C[B]||F||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||"");if(y=Ts(y,T),N){let H=[],B=se(y),F=ke(B.output,En,(J,de)=>`\x00STX_ORPHAN_STYLE_${de}\x00`);if(y=F.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(J,de,G)=>{let pe=de==="SCRIPT"?$r(B.scripts[Number(G)],l):F.tokens[Number(G)];if(pe)H.push(pe);return""}),H.length>0){let J=H.join(`
1366
1370
  `);C.content=C.content?`${C.content}
1367
1371
  ${J}`:J,e.__sections=C}}if(N)try{let H;if(le.isAbsolute(N))H=N,h.add(N);else H=await Me(()=>In(N,l,p,h),null,()=>{throw new ce(`Failed to resolve layout path: ${N}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ue=(Q)=>{if(!Q)return[];try{let xe=le.isAbsolute(Q)?Q:le.resolve(process.cwd(),Q);return cs.readdirSync(xe).filter(($e)=>$e.endsWith(".stx")).map(($e)=>$e.replace(/\.stx$/,""))}catch{return[]}},ne=[...ue(p.layoutsDir),...ue(p.fallbackLayoutsDir)].filter((Q,xe,$e)=>$e.indexOf(Q)===xe).sort(),ve=[p.layoutsDir,p.fallbackLayoutsDir].filter((Q)=>typeof Q==="string"&&Q.length>0),me=ve.length>0?` Searched: ${ve.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${N} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+me;if(K.log(Error(ie),{layoutPath:N,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),p.debug)throw new ce(ie,l);return y}let B=await Me(()=>Bun.file(H).text(),"",()=>{throw new ce(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});B=wr(B,H),B=B.replace(/\{\{--[\s\S]*?--\}\}/g,"");let F=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(F.includes(H)){let ue=[...F.slice(F.indexOf(H)),H];throw new ce(ue.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ue.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let J=B.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(J){if(p.debug)console.log(`Found nested layout: ${J[1]} in ${H}`);let ue={},ne=B.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,Q,xe)=>(ue[Q]=xe.trim(),""));for(let[ie,Q]of Object.entries(ue))if(C[ie]&&C[ie].includes(Ae)){let xe=C[ie].indexOf(Ae);C[ie]=C[ie].slice(0,xe)+Q+C[ie].slice(xe+Ae.length)}else if(!C[ie])C[ie]=Q;let ve={...e,__sections:C,__layoutChain:[...F,H]},me=`@layout('${J[1]}')${ne}`;return await i(me,ve,H,p,h)}let de=B.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=Es(de,T),pe={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ue,ne,ve)=>(pe[ne]=ve.trim(),`@slot('${ne}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ue,ne,ve)=>{if(C[ne]){let me=C[ne];if(me.includes(Ae)){let ie=pe[ne]||"",Q=me.indexOf(Ae);me=me.slice(0,Q)+ie+me.slice(Q+Ae.length)}return me}return ve||""}),G=ys(G,C),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||""),G=Ts(G,T),e.__originalFilePath=l,y=await Rr(G,e,H,p,h),y=`<!-- stx-layout: ${N} -->
1368
- ${y}`,k(y)}catch(H){if(H instanceof te)throw H;throw new ce(`Error processing layout ${N}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await Rr(y,e,l,p,h))}function ys(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function bs(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function ws(r,e){await Me(()=>nr(r,e),void 0,(l)=>{K.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function $r(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function vs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function Er(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Cr(r,e,l){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">${Er(r)}</span><span style="display:block;margin-top:4px">${Er(l)}</span></div>`}async function xs(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-hpqvq1r9.js")),t=[],p=!I()&&!Bn();for(let y of h(r)){let v=y.attrs;if(!/\bserver\b/.test(v))continue;let x=y.start+y.fullMatch.indexOf(">")+1,k=Dr(r,x);if(k===-1)continue;let _=r.slice(x,k);if(!_.trim())continue;let E=vs(v)??l,D={index:y.start,length:k+9-y.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-1tb18a92.js"));await T(_,e,E,{preserveExisting:!0,onFailure:(C)=>{if(C.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:E,kind:C.kind,message:C.message}),!p)return;t.push({...D,markup:Cr(E,C.kind,C.message)})}})}catch(T){let C=T instanceof Error?T:Error(String(T));if(K.log(C,{filePath:E,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${E}: ${C.message}`),p)t.push({...D,markup:Cr(E,"unknown",C.message)})}}if(t.length===0)return r;let w=r;for(let y of t.sort((v,x)=>x.index-v.index))w=w.slice(0,y.index)+y.markup+w.slice(y.index+y.length);return w}async function Ss(r,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-k352spys.js"));return a(r,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return K.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),r}}async function Rr(r,e,l,a,h){let t=r;await R();let p=a;if(t=await xs(t,e,l,a),t=await zt(t,e,l),t=await Kt(t,e,l),t=await Ss(t,e,l),await R(),t=await Nt(t,e,l,p),Ne(t))t=fi(t,e),t=Ns(t,e),t=Os(t,e);t=gi(t),await R();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-y10eaxgc.js"));t=w(t,e),t=await ci(t,e,l,p,!0),await R(),t=await ur(t,e,l,p,h),t=await Rs(t,e,l,p,h),await R(),t=Bc(t,e,l,p);let{processDeferDirectives:y}=await o("stx/defer",()=>import("./chunk-k2fw6paw.js"));t=y(t,e,l);let{processTeleportDirectives:v}=await o("stx/teleport",()=>import("./chunk-qzx6h6af.js"));t=v(t,e,l);let{processTransitionDirectives:x,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-726w7fm2.js"));t=x(t,e,l),t=k(t);let{processErrorBoundaryDirectives:_,stripRenderFailedMarkers:E}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));t=_(t,e,l),t=E(t);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-cp82351f.js"));t=D(t,e,l);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-tgwwa872.js"));t=T(t,e,l);let{processKeepAliveDirectives:C}=await o("stx/keep-alive",()=>import("./chunk-81qvg3yd.js"));t=C(t,e,l);let{processVirtualListDirectives:N,processVirtualGridDirectives:q,processInfiniteListDirectives:U}=await o("stx/virtual-scrolling",()=>import("./chunk-fznzn35q.js"));t=N(t,e,l),t=q(t,e,l),t=U(t,e,l),await R();let{processPartialHydrationDirectives:V,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-km1k3c4e.js"));t=V(t,e,l),t=H(t);let{processComputedDirectives:B,processWatchDirectives:F}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));t=B(t,e,l),t=F(t,e,l);let{processFormValidationDirectives:J}=await o("stx/forms-validation",()=>import("./chunk-dj8fyaea.js"));t=J(t,e,l);let{processHeadDirective:de,processTitleDirective:G,processMetaDirective:pe,resetHead:ue}=await o("stx/head",()=>import("./chunk-7rn7w53f.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ue();let ne=de(t);if(t=ne.content,ne.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ne.headContent}
1372
+ ${y}`,k(y)}catch(H){if(H instanceof te)throw H;throw new ce(`Error processing layout ${N}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await Rr(y,e,l,p,h))}function ys(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function bs(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function ws(r,e){await Me(()=>nr(r,e),void 0,(l)=>{K.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function $r(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function vs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function Er(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Cr(r,e,l){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">${Er(r)}</span><span style="display:block;margin-top:4px">${Er(l)}</span></div>`}async function xs(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-03ymcxsb.js")),t=[],p=!I()&&!Bn();for(let y of h(r)){let v=y.attrs;if(!/\bserver\b/.test(v))continue;let x=y.start+y.fullMatch.indexOf(">")+1,k=Dr(r,x);if(k===-1)continue;let _=r.slice(x,k);if(!_.trim())continue;let E=vs(v)??l,D={index:y.start,length:k+9-y.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-8kvqv885.js"));await T(_,e,E,{preserveExisting:!0,onFailure:(C)=>{if(C.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:E,kind:C.kind,message:C.message}),!p)return;t.push({...D,markup:Cr(E,C.kind,C.message)})}})}catch(T){let C=T instanceof Error?T:Error(String(T));if(K.log(C,{filePath:E,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${E}: ${C.message}`),p)t.push({...D,markup:Cr(E,"unknown",C.message)})}}if(t.length===0)return r;let w=r;for(let y of t.sort((v,x)=>x.index-v.index))w=w.slice(0,y.index)+y.markup+w.slice(y.index+y.length);return w}async function Ss(r,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-52njxk3w.js"));return a(r,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return K.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),r}}async function Rr(r,e,l,a,h){let t=r;await R();let p=a;if(t=await xs(t,e,l,a),t=await zt(t,e,l),t=await Kt(t,e,l),t=await Ss(t,e,l),await R(),t=await Nt(t,e,l,p),Ne(t))t=fi(t,e),t=Ns(t,e),t=Os(t,e);t=gi(t),await R();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-3043ycz6.js"));t=w(t,e),t=await ci(t,e,l,p,!0),await R(),t=await ur(t,e,l,p,h),t=await Rs(t,e,l,p,h),await R(),t=Bc(t,e,l,p);let{processDeferDirectives:y}=await o("stx/defer",()=>import("./chunk-k2fw6paw.js"));t=y(t,e,l);let{processTeleportDirectives:v}=await o("stx/teleport",()=>import("./chunk-qzx6h6af.js"));t=v(t,e,l);let{processTransitionDirectives:x,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-726w7fm2.js"));t=x(t,e,l),t=k(t);let{processErrorBoundaryDirectives:_,stripRenderFailedMarkers:E}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));t=_(t,e,l),t=E(t);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-cp82351f.js"));t=D(t,e,l);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-tgwwa872.js"));t=T(t,e,l);let{processKeepAliveDirectives:C}=await o("stx/keep-alive",()=>import("./chunk-81qvg3yd.js"));t=C(t,e,l);let{processVirtualListDirectives:N,processVirtualGridDirectives:q,processInfiniteListDirectives:U}=await o("stx/virtual-scrolling",()=>import("./chunk-fznzn35q.js"));t=N(t,e,l),t=q(t,e,l),t=U(t,e,l),await R();let{processPartialHydrationDirectives:V,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-km1k3c4e.js"));t=V(t,e,l),t=H(t);let{processComputedDirectives:B,processWatchDirectives:F}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));t=B(t,e,l),t=F(t,e,l);let{processFormValidationDirectives:J}=await o("stx/forms-validation",()=>import("./chunk-v35zj9fq.js"));t=J(t,e,l);let{processHeadDirective:de,processTitleDirective:G,processMetaDirective:pe,resetHead:ue}=await o("stx/head",()=>import("./chunk-7rn7w53f.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ue();let ne=de(t);if(t=ne.content,ne.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ne.headContent}
1369
1373
  `;if(t=G(t,e),t=pe(t,e,l),t=rr(t),t=li(t,e),t=jt(t),t=Qt(t),t=await Cs(t,e,l,p,h),t=await Rs(t,e,l,p,h),await R(),t=t.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),t=Bi(t),t=ge(t,e,l),t=As(t),await R(),e.__stxProcessingDepth===1)t=bl(t,e);if(t=pl(t,e,{filePath:l,buildMode:p.buildMode}),t=ui(t,e),t=di(t,e),t=et(t,e),t=Wt(t,e),t=Xt(t,e),t=await Ct(t,e,l,p),t=await zc(t,e,l),t=await Vc(t,e,l,p),await R(),t=Uc(t,e,l,p),t=xi(t,e,l,p),t=Si(t,e,l),t=ki(t,e,l,p),t=Ot(t,e,l,p),t=ao(t,e),t=co(t),t=gl(t),!p.skipEventDirectives)t=nl(t,e,l);if(t=fl(t,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await R(),p.debug){let X=/\bx-data\s*=/.test(t),z=Is(r);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
1370
1374
  Both work on the same page, but they manage separate scopes.
1371
1375
  Prefer signals (state/derived/effect) for new components.`)}t=Nc(t,e),t=await qi(t,e,l),await R(),t=ml(t),t=hl(t),t=$t(t);let{processXElementDirectives:ve}=await o("stx/x-element",()=>import("./chunk-2sz1kh9m.js"));t=ve(t);let me=e.__originalFilePath||l,ie=Ke(e);if(t=await mi(t,p,me,ie),await R(),t=Ft(t,e),t=await tr(t,e,l,p),await R(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-1pbghytr.js"));t=await z(t,{publicDir:X})}if(p.seo?.enabled)t=_i(t,e,p);let Q=(X,z,ee=!0)=>{if(!z)return X;let be=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),oe=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),he=oe?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(oe[0]):null;if(be&&oe&&he){if(ee){let Ie=oe.index+he.index;X=X.slice(0,Ie)+be[0]+X.slice(Ie+he[0].length)}if(z=z.replace(be[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
@@ -1377,6 +1381,6 @@ ${St()}
1377
1381
  </script>`;if(t.includes("</head>")){let ee=L(t),oe=t.slice(0,ee).indexOf("<script");if(oe!==-1){let he=t.slice(0,oe),Ie=t.slice(oe);t=he+z+`
1378
1382
  `+Ie}else t=f(t,z)}else if(t.includes("<body"))t=t.replace(/<body([^>]*)>/,`<body$1>
1379
1383
  ${z}`);else t=z+`
1380
- `+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-hpqvq1r9.js")),z=[];for(let ee of X(t)){if(!/\bserver\b/i.test(ee.attrs))continue;let be=ee.start+ee.fullMatch.indexOf(">")+1,oe=Dr(t,be);if(oe===-1)continue;let he=oe+9;while(he<t.length&&/\s/.test(t[he]))he++;z.push({start:ee.start,end:he})}if(z.length>0){let ee=Array(z.length+1),be=0;for(let oe=0;oe<z.length;oe++){let{start:he,end:Ie}=z[oe];ee[oe]=t.slice(be,he),be=Ie}ee[z.length]=t.slice(be),t=ee.join("")}}let yt=oo(t,l);if(yt.hasScoped)t=yt.html;let jr=e.__stx_event_bindings||[],rt=!1,bt=[],Nr=/\s:[a-z][\w.-]*\s*=/.test(t),{scanScriptTags:Hr}=await o("stx/signal-processing",()=>import("./chunk-hpqvq1r9.js"));for(let X of Hr(t,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))bt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:ee}of bt){rt=!0;let be=ee;We(ee,l,a.strict,e.__originalFilePath);let oe=await Ge(ee,{eventBindings:jr,attrs:z,hasColonDirectives:Nr,templateContent:r,filePath:l,projectRoot:process.cwd(),production:ta(a.buildMode,a.minifyClient),serverData:ie});t=t.replace(X,()=>oe)}if(rt)e.__stx_event_bindings=[];if(!rt&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=Pi(X);if(z){let ee=c(t);t=ee===-1?t+z:t.slice(0,ee)+z+`
1384
+ `+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-03ymcxsb.js")),z=[];for(let ee of X(t)){if(!/\bserver\b/i.test(ee.attrs))continue;let be=ee.start+ee.fullMatch.indexOf(">")+1,oe=Dr(t,be);if(oe===-1)continue;let he=oe+9;while(he<t.length&&/\s/.test(t[he]))he++;z.push({start:ee.start,end:he})}if(z.length>0){let ee=Array(z.length+1),be=0;for(let oe=0;oe<z.length;oe++){let{start:he,end:Ie}=z[oe];ee[oe]=t.slice(be,he),be=Ie}ee[z.length]=t.slice(be),t=ee.join("")}}let yt=oo(t,l);if(yt.hasScoped)t=yt.html;let jr=e.__stx_event_bindings||[],rt=!1,bt=[],Nr=/\s:[a-z][\w.-]*\s*=/.test(t),{scanScriptTags:Hr}=await o("stx/signal-processing",()=>import("./chunk-03ymcxsb.js"));for(let X of Hr(t,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))bt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:ee}of bt){rt=!0;let be=ee;We(ee,l,a.strict,e.__originalFilePath);let oe=await Ge(ee,{eventBindings:jr,attrs:z,hasColonDirectives:Nr,templateContent:r,filePath:l,projectRoot:process.cwd(),production:ta(a.buildMode,a.minifyClient),serverData:ie});t=t.replace(X,()=>oe)}if(rt)e.__stx_event_bindings=[];if(!rt&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=Pi(X);if(z){let ee=c(t);t=ee===-1?t+z:t.slice(0,ee)+z+`
1381
1385
  `+t.slice(ee)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!Re(t)&&Dc(t))t=await _r(t,p);if(t=Lc(t),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")t=It(t,e.cspNonce);return t}
1382
1386
  export{Pt,He,Ac,_s,ni,ri,yr,i};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Va,Du,nr,uh,Lu,ju,Bu,dh}from"./chunk-n8xjqsze.js";import"./chunk-9m45t60c.js";import"./chunk-472w7t7p.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{nr as Validator,Du as defineForm,Lu as processErrorDirective,ju as processErrorsDirective,dh as processFormValidationDirectives,Bu as processHasErrorsDirective,Va as useForm,uh as v};
2
+ import{Va,Du,nr,uh,Lu,ju,Bu,dh}from"./chunk-yf715phy.js";import"./chunk-p80nnmha.js";import"./chunk-q3we5jsk.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{nr as Validator,Du as defineForm,Lu as processErrorDirective,ju as processErrorsDirective,dh as processFormValidationDirectives,Bu as processHasErrorsDirective,Va as useForm,uh as v};
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import{Z}from"./chunk-65g78sge.js";import R from"path";var B=/__stxModules\["((?:[^"\\]|\\.)*)"\]/g;function ts(...d){let g=new Set;for(let l of d){if(!l||!l.includes("__stxModules["))continue;for(let e of l.matchAll(B))try{g.add(JSON.parse(`"${e[1]}"`))}catch{}}return[...g].sort()}function Eo(...d){let g=new Map,l=(e,n)=>{let o=g.get(e);if(o===null)return;if(n===null){g.set(e,null);return}let s=o??new Set;for(let i of n)s.add(i);g.set(e,s)};for(let e of d){if(!e||!e.includes("__stxModules["))continue;let n=[];for(let s of e.matchAll(/([\w$]+)\s*=\s*globalThis\.__stxModules\s*&&\s*globalThis\.__stxModules\["((?:[^"\\]|\\.)*)"\]/g)){let i;try{i=JSON.parse(`"${s[2]}"`)}catch{continue}n.push({variable:s[1],id:i,start:s.index+s[0].length,end:e.length})}let o=e.match(/__stxModules\["(?:[^"\\]|\\.)*"\]/g)?.length??0;if(n.length===0||o!==n.length){for(let s of ts(e))l(s,null);continue}for(let[s,i]of n.entries()){let p=n.slice(s+1).find((h)=>h.variable===i.variable);i.end=p?p.start:e.length}for(let s of n){let i=new Set,p=!1,h=s.variable.replace(/[$]/g,"\\$&"),r=e.slice(s.start,s.end);for(let a of r.matchAll(new RegExp(`(?<![\\w$.])${h}(?![\\w$])`,"g"))){let f=r.slice(a.index+s.variable.length,a.index+s.variable.length+200),c=/^\s*\[\s*(["'])([A-Za-z_$][\w$]*)\1\s*\]/.exec(f)??/^\s*\.\s*([A-Za-z_$][\w$]*)/.exec(f);if(c){i.add(c[c.length-1]);continue}if(/^\s*[!=]==?\s*(?:undefined|void 0)\b/.test(f))continue;p=!0;break}l(s.id,p?null:i)}}return g}function k(d,g,l){let e=[],n=[];return d.forEach((o,s)=>{let i=o.startsWith("npm:")?o.slice(4):R.resolve(g,o),p=`__stxRegistered${s}`,h=JSON.stringify(o),r=l?.get(o);if(r&&[...r].every((a)=>/^[A-Za-z_$][\w$]*$/.test(a))){let a=[...r].sort(),f=a.map((m,_)=>`${m} as ${p}_${_}`);e.push(a.length>0?`import { ${f.join(", ")} } from ${JSON.stringify(i)};`:`import ${JSON.stringify(i)};`);let c=a.map((m,_)=>`get ${JSON.stringify(m)}() { return ${p}_${_}; }`).join(", ");n.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = { ${c} };`);return}e.push(`import * as ${p} from ${JSON.stringify(i)};`),n.push(`if (!globalThis.__stxModules[${h}]) globalThis.__stxModules[${h}] = ${p};`)}),[...e,"globalThis.__stxModules = globalThis.__stxModules || {};",...n].join(`
3
- `)}async function ym(d,g={}){if(d.length===0)return null;let l=process.cwd(),e=k(d,l,g.names),n;try{let{bundleClientScript:f}=await import("./chunk-2vqamyay.js"),c=()=>f(e,R.join(l,".stx-module-registry.ts"),{projectRoot:l,minify:g.minify,externalizeUserModules:!1,collectInputs:g.collectInputs,throwOnFailure:!0});try{n=await c()}catch(m){if(!g.names)throw m;e=k(d,l,void 0),n=await c()}}catch(f){let{formatBuildFailure:c}=await import("./chunk-5astk182.js"),m=c(f);console.warn(`[stx] could not build the page module registry (#1957): ${m}`);let _=`[stx] the page module registry did not build, so ${d.join(", ")} cannot load (#1957): ${m}`;return`;console.error(${JSON.stringify(_)});`}let{transformAutoImports:o,generateAutoImportDestructuring:s}=await import("./chunk-q4yq72wh.js"),i=o(n),p=s(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-0ht6exrv.js");n=h(i.code);let r=JSON.stringify(new Bun.CryptoHasher("md5").update(e).digest("hex").slice(0,12)),a=Z(n);return[a?";await (async function() {":";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${r}]) { ${a?"await __stxBundles["+r+"];":""} return; }`,a?`var __resolveBundle, __rejectBundle;
3
+ `)}async function ym(d,g={}){if(d.length===0)return null;let l=process.cwd(),e=k(d,l,g.names),n;try{let{bundleClientScript:f}=await import("./chunk-c05zj2m9.js"),c=()=>f(e,R.join(l,".stx-module-registry.ts"),{projectRoot:l,minify:g.minify,externalizeUserModules:!1,collectInputs:g.collectInputs,throwOnFailure:!0});try{n=await c()}catch(m){if(!g.names)throw m;e=k(d,l,void 0),n=await c()}}catch(f){let{formatBuildFailure:c}=await import("./chunk-5astk182.js"),m=c(f);console.warn(`[stx] could not build the page module registry (#1957): ${m}`);let _=`[stx] the page module registry did not build, so ${d.join(", ")} cannot load (#1957): ${m}`;return`;console.error(${JSON.stringify(_)});`}let{transformAutoImports:o,generateAutoImportDestructuring:s}=await import("./chunk-xf2jf63c.js"),i=o(n),p=s(i.stxImports,i.browserImports),{transformStoreImports:h}=await import("./chunk-0ht6exrv.js");n=h(i.code);let r=JSON.stringify(new Bun.CryptoHasher("md5").update(e).digest("hex").slice(0,12)),a=Z(n);return[a?";await (async function() {":";(function() {"," var __stxBundles = globalThis.__stxModuleBundles || (globalThis.__stxModuleBundles = {});",` if (__stxBundles[${r}]) { ${a?"await __stxBundles["+r+"];":""} return; }`,a?`var __resolveBundle, __rejectBundle;
4
4
  __stxBundles[${r}]=new Promise(function(resolve,reject){__resolveBundle=resolve;__rejectBundle=reject;});
5
5
  __stxBundles[${r}].catch(function(){});
6
6
  try {`:`__stxBundles[${r}] = true;`,p,n,a?`__resolveBundle();
7
7
  } catch(error) { delete __stxBundles[${r}]; __rejectBundle(error); throw error; }`:"","})();"].join(`
8
8
  `)}var j=/^import(?:[ \t]*(\{[^}]*\})[ \t]*from|[ \t]*\*[ \t]*as[ \t]+([\w$]+)[ \t]+from)?[ \t]*["']\.\/(chunk-[\w-]+)\.js["'][ \t]*;?[ \t]*$/gm,O=/^export\s*\{([^}]*)\}\s*;?[ \t]*$/gm,I=new Set(["__preload","__chunks"]),N=/^("[^"]*"|[\w$]+)(?:\s+as\s+("[^"]*"|[\w$]+))?$/;function P(d){let g=[],l=[],e=!0,o=d.replace(/^var __chunkGraphs;[\s\S]*?^var __chunks = [\s\S]*?^\};[ \t]*\n?/m,"").replace(/^__chunks\(import\.meta\.url,[^\n]*\);[ \t]*\n?/gm,"").replace(j,(h,r,a,f)=>{let c=`__stxChunkExports${g.length}`;if(g.push(f),l.push(`var ${c} = __stxChunk(${JSON.stringify(f)});`),a)l.push(`var ${a} = ${c};`);else if(r)for(let m of r.slice(1,-1).split(",")){let _=m.trim();if(!_)continue;let w=N.exec(_);if(!w){e=!1;continue}if(I.has(w[1]))continue;let M=w[1].startsWith('"')?JSON.parse(w[1]):w[1],t=w[2]??w[1];if(t.startsWith('"')){e=!1;continue}l.push(`var ${t} = ${c}[${JSON.stringify(M)}];`)}return""});if(!e)throw Error("an import it does not read");let s=[];o=o.replace(/\(\s*__preload\([^)]*\)\s*,\s*import\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)\s*\)|\bimport\(\s*["']\.\/(chunk-[\w-]+)\.js["']\s*\)/g,(h,r,a)=>{let f=r??a;return s.push(f),`Promise.resolve().then(function () { return __stxChunk(${JSON.stringify(f)}); })`});let i=[];o=o.replace(O,(h,r)=>{for(let a of r.split(",")){let f=a.trim();if(!f)continue;let c=N.exec(f);if(!c||c[1].startsWith('"')){e=!1;continue}if(I.has(c[1]))continue;let m=c[2]??c[1];i.push([c[1],m.startsWith('"')?JSON.parse(m):m])}return""});let p=[/\bimport\.meta\b/,/\b__chunks\b/,/\b__preload\b/,/^\s*export\s+(?:default\b|const\b|let\b|var\b|function\b|class\b|async\b|\*|\{)/m,/\bfrom\s*["']\.\/chunk-/,/^\s*import\s*["']\.\/chunk-/m].find((h)=>h.test(o));if(!e||p)throw Error(`${p?`${p.source} is left in it`:"an export it does not read"}`);return{reads:l.join(`
9
9
  `),chunks:g,lazy:s,body:o,exports:i}}function tu(d){if(/\bexport\s+(?:let|var)\b/.test(d))return!0;if(d.length/Math.max(1,d.split(`
10
- `).length)>200)return!1;for(let g of d.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let l of g[1].split(",")){let e=l.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(e))continue;let n=e.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${n}(?![\\w$])`,"g").test(d))continue;let s=new RegExp(`(?<![\\w$.])${n}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${n}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${n}\\s*=`,"g");if((d.match(s)?.length??0)>(d.match(i)?.length??0))return!0}return!1}async function To(d,g={}){let l=d.filter((n)=>n.ids.length>0);if(l.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let e=process.cwd();try{let{bundleClientEntriesSplit:n}=await import("./chunk-2vqamyay.js"),o=[],s=await n(new Map(l.map((t)=>[t.name,k(t.ids,e,t.names)])),{projectRoot:e,filePath:R.join(e,".stx-module-registry.ts"),collectInputs:o});g.collectInputs?.push(...o);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-q4yq72wh.js"),{transformStoreImports:h}=await import("./chunk-0ht6exrv.js"),r=new Map;for(let[t,u]of[...s.chunks,...s.entries])try{r.set(t,P(u))}catch(x){throw Error(`cannot read ${t}: ${x instanceof Error?x.message:String(x)}`)}for(let[t,u]of[...s.chunks,...s.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of o)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&tu(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let a=new Set,f=new Set,c=(t)=>{if(f.has(t))return;if(a.has(t))throw Error(`the chunks import each other (${t})`);a.add(t);for(let u of r.get(t)?.chunks??[]){if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);c(u)}for(let u of r.get(t)?.lazy??[])if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);a.delete(t),f.add(t)};for(let t of r.keys())c(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of s.chunks.keys()){let u=r.get(t),{prelude:x,body:v}=m(u),b=u.exports.map(([S,y])=>`get ${JSON.stringify(y)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
10
+ `).length)>200)return!1;for(let g of d.matchAll(/\bexport\s*\{([^}]*)\}(?!\s*from\b)/g))for(let l of g[1].split(",")){let e=l.trim().split(/\s+as\s+/)[0].trim();if(!/^[A-Za-z_$][\w$]*$/.test(e))continue;let n=e.replace(/[$]/g,"\\$&");if(!new RegExp(`(?<![\\w$.])(?:let|var)\\s+${n}(?![\\w$])`,"g").test(d))continue;let s=new RegExp(`(?<![\\w$.])${n}\\s*(?:=(?![=>])|[-+*/%&|^]=|\\*\\*=|<<=|>>>?=|&&=|\\|\\|=|\\?\\?=|\\+\\+|--)|(?:\\+\\+|--)\\s*${n}(?![\\w$])`,"g"),i=new RegExp(`(?<![\\w$.])(?:let|var|const)\\s+${n}\\s*=`,"g");if((d.match(s)?.length??0)>(d.match(i)?.length??0))return!0}return!1}async function To(d,g={}){let l=d.filter((n)=>n.ids.length>0);if(l.length===0)return{chunks:new Map,routes:new Map,reads:new Map};let e=process.cwd();try{let{bundleClientEntriesSplit:n}=await import("./chunk-c05zj2m9.js"),o=[],s=await n(new Map(l.map((t)=>[t.name,k(t.ids,e,t.names)])),{projectRoot:e,filePath:R.join(e,".stx-module-registry.ts"),collectInputs:o});g.collectInputs?.push(...o);let{transformAutoImports:i,generateAutoImportDestructuring:p}=await import("./chunk-xf2jf63c.js"),{transformStoreImports:h}=await import("./chunk-0ht6exrv.js"),r=new Map;for(let[t,u]of[...s.chunks,...s.entries])try{r.set(t,P(u))}catch(x){throw Error(`cannot read ${t}: ${x instanceof Error?x.message:String(x)}`)}for(let[t,u]of[...s.chunks,...s.entries])if(/\b__esm\(/.test(u))throw Error(`${t} initialises a module lazily`);for(let t of o)if(/\.(?:[cm]?[jt]sx?)$/.test(t)&&tu(await Bun.file(t).text()))throw Error(`${t} exports a binding that changes after it is read`);let a=new Set,f=new Set,c=(t)=>{if(f.has(t))return;if(a.has(t))throw Error(`the chunks import each other (${t})`);a.add(t);for(let u of r.get(t)?.chunks??[]){if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);c(u)}for(let u of r.get(t)?.lazy??[])if(!r.has(u))throw Error(`${t} imports ${u}, which was not built`);a.delete(t),f.add(t)};for(let t of r.keys())c(t);let m=(t)=>{let u=i(t.body);return{prelude:p(u.stxImports,u.browserImports),body:h(u.code)}},_=new Map;for(let t of s.chunks.keys()){let u=r.get(t),{prelude:x,body:v}=m(u),b=u.exports.map(([S,y])=>`get ${JSON.stringify(y)}() { return ${S}; }`).join(", ");_.set(t,`function (__stxChunk) {
11
11
  ${x}
12
12
  ${u.reads}
13
13
  ${v}
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Em}from"./chunk-pgqennwt.js";import"./chunk-sn1qtgmc.js";import"./chunk-kxh9rqdm.js";import"./chunk-ntvgvvrh.js";import"./chunk-77nn1ckz.js";import"./chunk-yar3c574.js";import"./chunk-hg31hs5d.js";import"./chunk-5hksy9tt.js";import"./chunk-5mrt1enm.js";import"./chunk-vw7crz0z.js";import"./chunk-150cz8qq.js";import"./chunk-0b57fgpn.js";import"./chunk-p80nnmha.js";import"./chunk-q3we5jsk.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{Em as startProductionServer};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ie,zi,Hi,Lg,Xt,xl,jg,Sl,$y,Ke,Pn,Ge}from"./chunk-9m45t60c.js";import"./chunk-472w7t7p.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import{Bl,t}from"./chunk-68r2zs20.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{Ie as BROWSER_CORE_IMPORTS,Lg as STX_AUTO_IMPORTS,zi as extractAndStripCssImports,Ke as extractBridgeData,Bl as findInterpolationEnd,Sl as generateAutoImportDestructuring,$y as generateBrowserAutoImportDestructuring,Pn as generateServerDataBridge,Xt as injectBrowserCoreAutoImports,Ge as processClientScript,jg as referencesName,Hi as renderVendorStyleTags,t as stripCommentsAndLiterals,xl as transformAutoImports};
2
+ import{Ie,zi,Hi,Lg,Xt,xl,jg,Sl,$y,Ke,Pn,Ge}from"./chunk-p80nnmha.js";import"./chunk-q3we5jsk.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import{Bl,t}from"./chunk-68r2zs20.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{Ie as BROWSER_CORE_IMPORTS,Lg as STX_AUTO_IMPORTS,zi as extractAndStripCssImports,Ke as extractBridgeData,Bl as findInterpolationEnd,Sl as generateAutoImportDestructuring,$y as generateBrowserAutoImportDestructuring,Pn as generateServerDataBridge,Xt as injectBrowserCoreAutoImports,Ge as processClientScript,jg as referencesName,Hi as renderVendorStyleTags,t as stripCommentsAndLiterals,xl as transformAutoImports};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{As,pg,ci,fg}from"./chunk-8v2hsn4d.js";import"./chunk-5jrpzepc.js";import"./chunk-8rgy17fj.js";import"./chunk-e0bwzxfd.js";import"./chunk-vbmvft7g.js";import"./chunk-40fpt0r6.js";import"./chunk-rapr0m13.js";import"./chunk-5mrt1enm.js";import"./chunk-vw7crz0z.js";import"./chunk-150cz8qq.js";import"./chunk-0b57fgpn.js";import{Wt}from"./chunk-9m45t60c.js";import"./chunk-472w7t7p.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{fg as declareBareLoopHead,Wt as parseLoopBinding,pg as processLoops,ci as processLoopsAsync,As as reportDeferredLoopWarnings};
2
+ import{As,pg,ci,fg}from"./chunk-5qkd77vw.js";import"./chunk-5jrpzepc.js";import"./chunk-kmby9q2c.js";import"./chunk-yar3c574.js";import"./chunk-vbmvft7g.js";import"./chunk-hg31hs5d.js";import"./chunk-5hksy9tt.js";import"./chunk-5mrt1enm.js";import"./chunk-vw7crz0z.js";import"./chunk-150cz8qq.js";import"./chunk-0b57fgpn.js";import{Wt}from"./chunk-p80nnmha.js";import"./chunk-q3we5jsk.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{fg as declareBareLoopHead,Wt as parseLoopBinding,pg as processLoops,ci as processLoopsAsync,As as reportDeferredLoopWarnings};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{zo,zh,Hh}from"./chunk-7tjfca0a.js";import"./chunk-at70apjf.js";import"./chunk-ntvgvvrh.js";import"./chunk-qs0zk04y.js";import"./chunk-kmby9q2c.js";import"./chunk-yar3c574.js";import"./chunk-vbmvft7g.js";import"./chunk-65g78sge.js";import"./chunk-hg31hs5d.js";import"./chunk-5hksy9tt.js";import"./chunk-5mrt1enm.js";import"./chunk-vw7crz0z.js";import"./chunk-150cz8qq.js";import"./chunk-0b57fgpn.js";import"./chunk-p80nnmha.js";import"./chunk-q3we5jsk.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{Hh as clearComposableCache,zh as getComposableScript,zo as listComposableModules};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{Rr}from"./chunk-0b57fgpn.js";import{Ur}from"./chunk-945zygwa.js";import{a}from"./chunk-40fpt0r6.js";import{W,lt}from"./chunk-a7bqrjm5.js";import{jc}from"./chunk-67pq803s.js";import{L,c}from"./chunk-p92272k0.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function kr(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 g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function re(e,r={}){return new Rr(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=re(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function Re(e){return e.includes("data-stx-runtime")}function Dc(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 p(e,r){let t=kr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
2
+ import{Rr}from"./chunk-0b57fgpn.js";import{Ur}from"./chunk-945zygwa.js";import{a}from"./chunk-hg31hs5d.js";import{W,lt}from"./chunk-a7bqrjm5.js";import{jc}from"./chunk-67pq803s.js";import{L,c}from"./chunk-p92272k0.js";var x=/<style\b[^>]*>/iy,R=/<\/style>/gi,b=/<script\b[^>]*>/iy,S=/<template(?=[\s>/])[^>]*>/iy,w=/<\/template\s*>/iy;function kr(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 g=e.indexOf("-->",n+4);r=g===-1?e.length:g+3;continue}x.lastIndex=n;let u=x.exec(e);if(u){R.lastIndex=n+u[0].length;let g=R.exec(e);r=g===null?e.length:g.index+8;continue}S.lastIndex=n;let o=S.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}w.lastIndex=n;let d=w.exec(e);if(d){if(t>0)t--;r=n+d[0].length;continue}if(b.lastIndex=n,b.test(e))return t>0?s:n;r=n+1}return-1}function re(e,r={}){return new Rr(e,r).routes}import y from"path";var T=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let d=await a();t||=d?.pagesDir||"pages",s||=d?.root||"."}catch{t||="pages",s||="."}let n=y.isAbsolute(t)?t:y.join(s,t),u=T.get(n);if(u)return u;let o=[];try{o=re(".",{pagesDir:n,emit:!1}).map((d)=>d.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function E(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return E(JSON.stringify(e))}function Re(e){return e.includes("data-stx-runtime")}function Dc(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 p(e,r){let t=kr(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=Ur(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let o=L(e);return e.slice(0,o)+r+`
5
5
  `+e.slice(o)}if(W(e))return lt(e,(o)=>`${o}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function _r(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-0f2d61b3.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-0f2d61b3.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Lc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${jc()}</script>`,t=c(e);if(t===-1)return`${e}
7
+ ${e}`}async function _r(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-pms1q3c6.js"),{url:u}=await n("runtime",r.debug===!0);return p(e,`<script data-stx-runtime src="${u}"></script>`)}if(r.buildMode==="compile")return p(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-pms1q3c6.js"),s=await t(r.debug);return p(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function O(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Lc(e){if(e.includes("data-stx-tooltip-runtime")||!O(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${jc()}</script>`,t=c(e);if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function Ae(e,r){if(!e.includes("</body>"))return e;if(M(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.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-0f2d61b3.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
9
+ ${e.slice(t)}`}var C=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function M(e){return C.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function Ae(e,r){if(!e.includes("</body>"))return e;if(M(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.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:_}=await import("./chunk-pms1q3c6.js");n=`<script data-stx-owned-routes src="${_(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(f)};
10
10
  `)}"></script>
11
11
  `}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
12
- `}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-0f2d61b3.js"),d=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 u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
12
+ `}let{getCachedRouterScript:u,getServeClientAsset:o}=await import("./chunk-pms1q3c6.js"),d=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 u()}</script>`,g=c(e);return e.slice(0,g)+s+n+d+`
13
13
  </body>`+e.slice(g+7)}
14
14
  export{kr,re,Re,Dc,_r,Lc,Ae};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Vl,Ul}from"./chunk-hdfhaddy.js";import{J,Or,Ys,Zs,$i,Ai,Qs,Oe,qe,ke,se,Dr,Lr,he,oe,F,mt,jr,Ni,zr,Ye,s,g,Y,Nn}from"./chunk-9m45t60c.js";import{m,M,yt,p}from"./chunk-945zygwa.js";import{r}from"./chunk-9vafweyd.js";import{ge}from"./chunk-5jrpzepc.js";import{xr}from"./chunk-eb5v9npc.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-68r2zs20.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import sn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var _e=Symbol("stx.image-worker.unavailable");function on(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ie=0,vt=[];async function an(){if(Ie<on()){Ie++;return}await new Promise((e)=>vt.push(e)),Ie++}function cn(){Ie--,vt.shift()?.()}var ln="@stacksjs/stx/builtins/image-warmup-worker";function un(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&sn.existsSync(bt(n)))return bt(n)}catch{}return xr(ln,e)}var xt=!1;function ue(e){if(!xt)xt=!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 _e}function Pe(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Pe(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=un();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await an();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(y){a(ue(`could not start ${o}: ${Pe(y)}`));return}let u=!1,f=!1,v=(y)=>{if(f)return;f=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){v(()=>a(y.value));return}let h=Error(y.error?.message??"image worker failed");if(y.error?.name)h.name=y.error.name;if(y.error?.stack)h.stack=y.error.stack;v(()=>c(h))}),l.on("error",(y)=>{v(()=>u?c(y instanceof Error?y:Error(Pe(y)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Pe(y)}`)))}),l.on("exit",(y)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${y} before it was ready`)))})})}finally{cn()}}var fn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dn=[320,640,960,1280,1920],ve="/_stx/images",gn=`stx:${ve}:alpha-1`,pn=`stx:${ve}:opaque-1`,mn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function hn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ee!==void 0)return Ee;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=mn.map((i)=>{let n;try{n=e?hn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ee}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function yn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function bn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function Pt(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await Pt(e,c));continue}if(!a.isFile()||!fn.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:yn(n.relativePath),input:n.absolutePath,name:bn(n.relativePath),...xn(n.absolutePath)?{options:{storage:i}}:{}}))}function xn(e){return Ue(e)==="possible"}function vn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function wn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,y)=>v.width-y.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(vn(v.data))n.add(l)}catch{n.add(l)}}));return n}function $n(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.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 n}async function Sn(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return V.join(e,"undecodable.json")}function Cn(e){try{let i=K.readFileSync(He(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Rn(e,i){try{K.mkdirSync(V.dirname(He(e)),{recursive:!0}),K.writeFileSync(He(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function oi(e){let i=It(e);return i?we().catalog.get(i):void 0}function ii(e){let i=It(e);return i?we().transparent.has(i):!1}function ai(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function ly(e){let i=oi(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ai(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ii(e)?void 0:i.placeholder?.dataUrl}}function $s(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function uy(e,i,n={}){if(!e||!K.existsSync(e))return $s(),{count:0,fingerprint:""};if(n.offThread){let d=await We("delivery",{publicDir:e,outputDir:i});if(d!==_e)return An(d.state),d.result}let o=await Pt(e);if(o.length===0)return $s(),{count:0,fingerprint:""};let a=Cn(i),c=o.filter((d)=>{let x=a[d.relativePath];if(!x)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==x.mtimeMs||k.size!==x.size});if(c.length===0)return $s(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${gn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${pn}:${wt()}`),baseUrl:ve,widths:dn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,y;try{y=await f({...u,entries:Rt(c,l)})}catch(d){if(v=await Sn(c),v.length===c.length)throw d;let x=new Set(v.map((A)=>A.relativePath)),k=!1;for(let A of c){if(x.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)Rn(i,a);if(v.length===0)return $s(),{count:0,fingerprint:""};y=await f({...u,entries:Rt(v,l)})}let h=await wn(y.entries),C=$n(y.entries,h),S=we();S.catalog=new Map(Object.entries(y.entries)),S.transparent=h;let b=h.size===0&&C.length===0?y.fingerprint:At("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...h].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=$i(e,o);if(a!==void 0)return a;for(let c of Ai(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Pn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||Pn.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${Nn(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${Nn(c,Xe(String(a)))}"`)}return n}function In(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=In(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",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Dr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,y)),f.push(...ie(e,y)),`<a ${f.join(" ")}>${i}</a>`}};var _n=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return _n.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Ne(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=En[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function On(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);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(i)c.set("w",String(i));if(n)c.set("h",String(n));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(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Bn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Tn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=oi(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),v=H(e,"srcset"),y=H(e,"densities"),h=H(e,"format"),C=ii(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),x=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Ne(e,"lazy",!0),z=Ne(e,"preload",!1),B=Ne(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!h,P=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=v||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Je(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,h),U=Je(f);else if(!T&&y){let Z=y.split(/\s+/).map((I)=>Number.parseFloat(I.replace("x","")));T=On(o,Z,P,d,h)}else if(f)U=Je(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(P&&_)D.push(`aspect-ratio:${P}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let I=Tn(P||16,_||9,b);D.push(`background-image:url(${I})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,P,_,d,h),X=[];if(X.push(`src="${r(Dr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Ce=L||(B||z?"eager":G?"lazy":"");if(Ce)X.push(`loading="${r(Ce)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),x)X.push(`class="${r(x)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Dr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let xe=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",I=Bn(te)+(Z?`;${Z}`:"");X.push(`onload="${r(I)}"`),xe.add("onload")}X.push(...re(e,xe)),X.push(...ie(e,xe));let le=`<img ${X.join(" ")} />`,Q="";if(z){let I=h==="webp"?"image/webp":h==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${I?` type="${I}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
2
+ import{Vl,Ul}from"./chunk-hdfhaddy.js";import{J,Or,Ys,Zs,$i,Ai,Qs,Oe,qe,ke,se,Dr,Lr,he,oe,F,mt,jr,Ni,zr,Ye,s,g,Y,Nn}from"./chunk-p80nnmha.js";import{m,M,yt,p}from"./chunk-945zygwa.js";import{r}from"./chunk-77nn1ckz.js";import{ge}from"./chunk-5jrpzepc.js";import{xr}from"./chunk-eb5v9npc.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-68r2zs20.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import sn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var _e=Symbol("stx.image-worker.unavailable");function on(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ie=0,vt=[];async function an(){if(Ie<on()){Ie++;return}await new Promise((e)=>vt.push(e)),Ie++}function cn(){Ie--,vt.shift()?.()}var ln="@stacksjs/stx/builtins/image-warmup-worker";function un(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&sn.existsSync(bt(n)))return bt(n)}catch{}return xr(ln,e)}var xt=!1;function ue(e){if(!xt)xt=!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 _e}function Pe(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Pe(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=un();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await an();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(y){a(ue(`could not start ${o}: ${Pe(y)}`));return}let u=!1,f=!1,v=(y)=>{if(f)return;f=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){v(()=>a(y.value));return}let h=Error(y.error?.message??"image worker failed");if(y.error?.name)h.name=y.error.name;if(y.error?.stack)h.stack=y.error.stack;v(()=>c(h))}),l.on("error",(y)=>{v(()=>u?c(y instanceof Error?y:Error(Pe(y)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Pe(y)}`)))}),l.on("exit",(y)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${y} before it was ready`)))})})}finally{cn()}}var fn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dn=[320,640,960,1280,1920],ve="/_stx/images",gn=`stx:${ve}:alpha-1`,pn=`stx:${ve}:opaque-1`,mn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function hn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ee!==void 0)return Ee;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=mn.map((i)=>{let n;try{n=e?hn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ee}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function yn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function bn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function Pt(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await Pt(e,c));continue}if(!a.isFile()||!fn.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:yn(n.relativePath),input:n.absolutePath,name:bn(n.relativePath),...xn(n.absolutePath)?{options:{storage:i}}:{}}))}function xn(e){return Ue(e)==="possible"}function vn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function wn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,y)=>v.width-y.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(vn(v.data))n.add(l)}catch{n.add(l)}}));return n}function $n(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.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 n}async function Sn(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return V.join(e,"undecodable.json")}function Cn(e){try{let i=K.readFileSync(He(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Rn(e,i){try{K.mkdirSync(V.dirname(He(e)),{recursive:!0}),K.writeFileSync(He(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function oi(e){let i=It(e);return i?we().catalog.get(i):void 0}function ii(e){let i=It(e);return i?we().transparent.has(i):!1}function ai(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function ly(e){let i=oi(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ai(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ii(e)?void 0:i.placeholder?.dataUrl}}function $s(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function uy(e,i,n={}){if(!e||!K.existsSync(e))return $s(),{count:0,fingerprint:""};if(n.offThread){let d=await We("delivery",{publicDir:e,outputDir:i});if(d!==_e)return An(d.state),d.result}let o=await Pt(e);if(o.length===0)return $s(),{count:0,fingerprint:""};let a=Cn(i),c=o.filter((d)=>{let x=a[d.relativePath];if(!x)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==x.mtimeMs||k.size!==x.size});if(c.length===0)return $s(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${gn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${pn}:${wt()}`),baseUrl:ve,widths:dn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,y;try{y=await f({...u,entries:Rt(c,l)})}catch(d){if(v=await Sn(c),v.length===c.length)throw d;let x=new Set(v.map((A)=>A.relativePath)),k=!1;for(let A of c){if(x.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)Rn(i,a);if(v.length===0)return $s(),{count:0,fingerprint:""};y=await f({...u,entries:Rt(v,l)})}let h=await wn(y.entries),C=$n(y.entries,h),S=we();S.catalog=new Map(Object.entries(y.entries)),S.transparent=h;let b=h.size===0&&C.length===0?y.fingerprint:At("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...h].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=$i(e,o);if(a!==void 0)return a;for(let c of Ai(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Pn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||Pn.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${Nn(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${Nn(c,Xe(String(a)))}"`)}return n}function In(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=In(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",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Dr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,y)),f.push(...ie(e,y)),`<a ${f.join(" ")}>${i}</a>`}};var _n=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return _n.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Ne(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=En[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function On(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);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(i)c.set("w",String(i));if(n)c.set("h",String(n));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(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Bn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Tn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=oi(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),v=H(e,"srcset"),y=H(e,"densities"),h=H(e,"format"),C=ii(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),x=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Ne(e,"lazy",!0),z=Ne(e,"preload",!1),B=Ne(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!h,P=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=v||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Je(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,h),U=Je(f);else if(!T&&y){let Z=y.split(/\s+/).map((I)=>Number.parseFloat(I.replace("x","")));T=On(o,Z,P,d,h)}else if(f)U=Je(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(P&&_)D.push(`aspect-ratio:${P}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let I=Tn(P||16,_||9,b);D.push(`background-image:url(${I})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,P,_,d,h),X=[];if(X.push(`src="${r(Dr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Ce=L||(B||z?"eager":G?"lazy":"");if(Ce)X.push(`loading="${r(Ce)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),x)X.push(`class="${r(x)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Dr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let xe=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",I=Bn(te)+(Z?`;${Z}`:"");X.push(`onload="${r(I)}"`),xe.add("onload")}X.push(...re(e,xe)),X.push(...ie(e,xe));let le=`<img ${X.join(" ")} />`,Q="";if(z){let I=h==="webp"?"image/webp":h==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${I?` type="${I}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
3
3
  `}if(q){let Z=[];if(a)for(let I of ai(a))Z.push(`<source type="image/${I.format}" srcset="${r(I.srcset)}"${U?` sizes="${r(U)}"`:""} />`);if(!a&&(h==="avif"||h==="auto")){let I=$e(o,P,_,d,"avif"),O=T?Qe(o,Ke,d,"avif"):`${I}`;Z.push(`<source type="image/avif" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}if(!a&&(h==="webp"||h==="auto")){let I=$e(o,P,_,d,"webp"),O=T?Qe(o,Ke,d,"webp"):`${I}`;Z.push(`<source type="image/webp" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}return`${Q}<picture>
4
4
  ${Z.join(`
5
5
  `)}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{P}from"./chunk-9m45t60c.js";import{xe}from"./chunk-50wjk5ap.js";function g(e,t){let r={};for(let n of e)r[n]=xe(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=xe(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Va(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=xe(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Du=Va;class nr{rules=[];defaultValue="";addRule(e){let t=new nr;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new nr;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new nr;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var uh=new nr;function Lu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
2
+ import{P}from"./chunk-p80nnmha.js";import{xe}from"./chunk-50wjk5ap.js";function g(e,t){let r={};for(let n of e)r[n]=xe(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=xe(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function Va(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=xe(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Du=Va;class nr{rules=[];defaultValue="";addRule(e){let t=new nr;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new nr;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new nr;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var uh=new nr;function Lu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
3
3
  `)}catch{return""}})}function ju(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
4
4
  `)}catch{return""}})}function Bu(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function dh(e,t,r){let n=e;return n=Lu(n,t,r),n=ju(n,t,r),n=Bu(n,t,r),n}export{Va,Du,nr,uh,Lu,ju,Bu,dh};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{q,wg,bi,Hc,a,j,xy,Sy}from"./chunk-40fpt0r6.js";import"./chunk-rapr0m13.js";import"./chunk-5mrt1enm.js";import"./chunk-vw7crz0z.js";import"./chunk-150cz8qq.js";import"./chunk-0b57fgpn.js";import"./chunk-9m45t60c.js";import"./chunk-472w7t7p.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{j as config,q as defaultConfig,xy as defineStxConfig,bi as discoverConfig,a as loadStxConfig,Hc as resolveInstalledPackage,wg as resolveStxDirectories,Sy as validateConfig};
2
+ import{q,wg,bi,Hc,a,j,xy,Sy}from"./chunk-hg31hs5d.js";import"./chunk-5hksy9tt.js";import"./chunk-5mrt1enm.js";import"./chunk-vw7crz0z.js";import"./chunk-150cz8qq.js";import"./chunk-0b57fgpn.js";import"./chunk-p80nnmha.js";import"./chunk-q3we5jsk.js";import"./chunk-esm0pnpz.js";import"./chunk-945zygwa.js";import"./chunk-7b3dqeyr.js";import"./chunk-5g5khx0m.js";import"./chunk-0jdz31q1.js";import"./chunk-hdfhaddy.js";export{j as config,q as defaultConfig,xy as defineStxConfig,bi as discoverConfig,a as loadStxConfig,Hc as resolveInstalledPackage,wg as resolveStxDirectories,Sy as validateConfig};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{oi,ii,ai,ly,$s,uy}from"./chunk-eka2e4cm.js";export{$s as clearImageDeliveryCatalog,ly as deliveredImage,ai as efficientDeliverySources,oi as getImageDelivery,ii as isTransparentImage,uy as prepareImageDelivery};
2
+ import{oi,ii,ai,ly,$s,uy}from"./chunk-ybpxtaft.js";export{$s as clearImageDeliveryCatalog,ly as deliveredImage,ai as efficientDeliverySources,oi as getImageDelivery,ii as isTransparentImage,uy as prepareImageDelivery};