@stacksjs/stx 0.2.673 → 0.2.674

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 (212) hide show
  1. package/dist/chunk-0jwdcqj8.js +2 -0
  2. package/dist/chunk-0mwdq478.js +2 -0
  3. package/dist/{chunk-npa7gze7.js → chunk-0nfqgv4n.js} +2 -2
  4. package/dist/chunk-1y6egkty.js +2 -0
  5. package/dist/{chunk-1sr6c0nk.js → chunk-25zmy8q6.js} +2 -2
  6. package/dist/chunk-2881tcqt.js +2 -0
  7. package/dist/chunk-2a775q7x.js +2 -0
  8. package/dist/chunk-2asdbd5e.js +2 -0
  9. package/dist/chunk-34yj93hh.js +2 -0
  10. package/dist/{chunk-30nes8ne.js → chunk-35ezh7de.js} +2 -2
  11. package/dist/{chunk-9tdnfztv.js → chunk-40tswfe7.js} +8 -8
  12. package/dist/chunk-41de209e.js +2 -0
  13. package/dist/{chunk-jst1fbdm.js → chunk-4b9s7wgy.js} +2 -2
  14. package/dist/{chunk-vhs13kbf.js → chunk-4bgjrrvz.js} +1 -1
  15. package/dist/{chunk-365vg0eg.js → chunk-4s8zacxg.js} +4 -4
  16. package/dist/chunk-4w6baw62.js +3 -0
  17. package/dist/{chunk-fbtv2k1p.js → chunk-506mv7hb.js} +2 -2
  18. package/dist/{chunk-fzqj1mjz.js → chunk-5qtthtg3.js} +7 -7
  19. package/dist/chunk-5s1ay9mv.js +2 -0
  20. package/dist/{chunk-wns8g6k9.js → chunk-5vt48yce.js} +6 -6
  21. package/dist/{chunk-qv6axke4.js → chunk-5zhp87wv.js} +2 -2
  22. package/dist/{chunk-hvf2e7pr.js → chunk-6s7tvmqp.js} +1 -1
  23. package/dist/{chunk-ecqrkyg8.js → chunk-6sjtyd0k.js} +4 -4
  24. package/dist/{chunk-a3d0g4mr.js → chunk-7adznted.js} +2 -2
  25. package/dist/chunk-7j1zgrnf.js +42 -0
  26. package/dist/chunk-7kznee1g.js +2 -0
  27. package/dist/{chunk-qjtpxsyx.js → chunk-7mvz972c.js} +3 -3
  28. package/dist/chunk-80zgyaqe.js +2 -0
  29. package/dist/chunk-84tqb1rn.js +2 -0
  30. package/dist/chunk-8azm7nha.js +2 -0
  31. package/dist/chunk-902qnyg0.js +2 -0
  32. package/dist/{chunk-3y41efsf.js → chunk-9dtbvjpp.js} +8 -8
  33. package/dist/chunk-9n6jwcpb.js +2 -0
  34. package/dist/{chunk-yfvm7q6t.js → chunk-a4p18ybc.js} +3 -3
  35. package/dist/chunk-a6y8td0d.js +2 -0
  36. package/dist/chunk-a7kt1ts4.js +2 -0
  37. package/dist/chunk-a81y8g40.js +2 -0
  38. package/dist/{chunk-jg5zt20a.js → chunk-aet1pgw7.js} +36 -36
  39. package/dist/chunk-aft1zc84.js +2 -0
  40. package/dist/{chunk-04kg16qs.js → chunk-am2w363p.js} +4 -4
  41. package/dist/{chunk-ym41ybz2.js → chunk-asezs2n3.js} +6 -6
  42. package/dist/{chunk-jefe0rgt.js → chunk-bawq4fqy.js} +4 -4
  43. package/dist/chunk-bdp2r0v4.js +2 -0
  44. package/dist/{chunk-m6q3f5rf.js → chunk-bkkpq8dx.js} +9 -9
  45. package/dist/chunk-brtvm8mb.js +2 -0
  46. package/dist/{chunk-2dp7hyv7.js → chunk-bsajk82t.js} +14 -14
  47. package/dist/chunk-bvzr9zqt.js +2 -0
  48. package/dist/{chunk-hzv2qj0t.js → chunk-cbjabv1w.js} +4 -4
  49. package/dist/chunk-cbvgtf3m.js +2 -0
  50. package/dist/chunk-cfydbaeq.js +2 -0
  51. package/dist/{chunk-t2pzy3x1.js → chunk-ck2e3e47.js} +3 -3
  52. package/dist/{chunk-wpmrz872.js → chunk-d09q93yf.js} +2 -2
  53. package/dist/{chunk-rcsgt4wy.js → chunk-d1a86qx8.js} +1 -1
  54. package/dist/{chunk-xqp4hstk.js → chunk-dgc1a3yt.js} +6 -6
  55. package/dist/chunk-dq8c3h4n.js +2 -0
  56. package/dist/chunk-e36pne7n.js +2 -0
  57. package/dist/chunk-e62qfexp.js +2 -0
  58. package/dist/chunk-eq5jzaj5.js +2 -0
  59. package/dist/{chunk-t0zh1dn9.js → chunk-f9zyf9n6.js} +65 -65
  60. package/dist/{chunk-dgb4z4kw.js → chunk-faakv1p6.js} +2 -2
  61. package/dist/{chunk-ynz7bzc6.js → chunk-fb7t1nn9.js} +3 -3
  62. package/dist/{chunk-ptcj11b4.js → chunk-fbmth6xv.js} +10 -10
  63. package/dist/{chunk-7met6yva.js → chunk-fd49fahd.js} +5 -5
  64. package/dist/chunk-fr39emcz.js +2 -0
  65. package/dist/chunk-fsq13amm.js +2 -0
  66. package/dist/chunk-fw413k9q.js +3 -0
  67. package/dist/chunk-fxh12vqd.js +2 -0
  68. package/dist/chunk-gcc9fa33.js +2 -0
  69. package/dist/chunk-h6t2ney6.js +2 -0
  70. package/dist/{chunk-kgfgb971.js → chunk-ham5x7ts.js} +4 -4
  71. package/dist/{chunk-n38yb274.js → chunk-hb3edeq9.js} +6 -6
  72. package/dist/{chunk-fvtwec1r.js → chunk-hegfgw27.js} +1 -1
  73. package/dist/{chunk-p472crv1.js → chunk-hgry3mjd.js} +1 -1
  74. package/dist/{chunk-sfc2v7rt.js → chunk-hsmcbh0p.js} +7 -7
  75. package/dist/{chunk-mxbc2ahy.js → chunk-hz4x7h0n.js} +5 -5
  76. package/dist/{chunk-jxda11cg.js → chunk-j6m8xqh3.js} +2 -2
  77. package/dist/chunk-j8g5cvvm.js +2 -0
  78. package/dist/chunk-jzjpyyw2.js +2 -0
  79. package/dist/chunk-k1b8x73j.js +2 -0
  80. package/dist/{chunk-h4dkvnhd.js → chunk-kdebh22m.js} +7 -7
  81. package/dist/{chunk-xwhmh0w0.js → chunk-mwnhdsbp.js} +2 -2
  82. package/dist/{chunk-0f4csefs.js → chunk-nj343mw2.js} +5 -5
  83. package/dist/chunk-nw9bdk2n.js +2 -0
  84. package/dist/chunk-p4jkswz8.js +2 -0
  85. package/dist/chunk-p4r90vqf.js +2 -0
  86. package/dist/{chunk-bnn7pd62.js → chunk-p6qd7ad0.js} +2 -2
  87. package/dist/chunk-p8bgy5tt.js +2 -0
  88. package/dist/{chunk-aprhqxky.js → chunk-pb6erpj3.js} +5 -5
  89. package/dist/{chunk-r3e6x87d.js → chunk-pg2v1pb5.js} +3 -3
  90. package/dist/{chunk-zvygkwyf.js → chunk-pqqe2b6m.js} +4 -4
  91. package/dist/chunk-q6nwcav4.js +2 -0
  92. package/dist/chunk-qmqavdz2.js +2 -0
  93. package/dist/chunk-qpw72bty.js +2 -0
  94. package/dist/chunk-qwnh1kj6.js +2 -0
  95. package/dist/chunk-qy9m6qdn.js +2 -0
  96. package/dist/chunk-qychcdsm.js +2 -0
  97. package/dist/{chunk-7d4z944r.js → chunk-qz5b8ed4.js} +7 -7
  98. package/dist/{chunk-6ajahb2x.js → chunk-r7fdw2v5.js} +3 -3
  99. package/dist/{chunk-mmwedr93.js → chunk-rdr09efy.js} +5 -5
  100. package/dist/chunk-rj3w1ama.js +2 -0
  101. package/dist/{chunk-prf164ct.js → chunk-rr527jt6.js} +2 -2
  102. package/dist/{chunk-1fd7x7b8.js → chunk-rv39s5az.js} +4 -4
  103. package/dist/{chunk-yg267y85.js → chunk-rym0309c.js} +3 -3
  104. package/dist/{chunk-chzgfna2.js → chunk-s0vtjyyj.js} +1 -1
  105. package/dist/{chunk-vqc4h16r.js → chunk-s2wptfm1.js} +2 -2
  106. package/dist/chunk-sf0r963g.js +2 -0
  107. package/dist/{chunk-qmfycza5.js → chunk-sqn3y9qt.js} +2 -2
  108. package/dist/{chunk-hmyb701s.js → chunk-srq9fqq8.js} +10 -10
  109. package/dist/chunk-ss820yys.js +2 -0
  110. package/dist/{chunk-pn1ehs6a.js → chunk-szevd7d5.js} +2 -2
  111. package/dist/{chunk-wbzmr6a4.js → chunk-t0k16vqv.js} +2 -2
  112. package/dist/chunk-t4j9g2vh.js +2 -0
  113. package/dist/chunk-t79jfpv6.js +3 -0
  114. package/dist/{chunk-rcadtv3x.js → chunk-t9kxhe46.js} +1 -1
  115. package/dist/{chunk-zqtbtqbq.js → chunk-tddnb5bv.js} +2 -2
  116. package/dist/{chunk-hvzzhkhr.js → chunk-thceyzj6.js} +2 -2
  117. package/dist/{chunk-8yqfpkp4.js → chunk-trh7s6k3.js} +5 -5
  118. package/dist/{chunk-dq56166k.js → chunk-trz8z4j4.js} +18 -18
  119. package/dist/chunk-ttemwrbx.js +2 -0
  120. package/dist/{chunk-agqcqf3q.js → chunk-twqzn21x.js} +7 -7
  121. package/dist/chunk-v14rq8b4.js +3 -0
  122. package/dist/{chunk-b4pcw34n.js → chunk-v21bhhjb.js} +1 -1
  123. package/dist/{chunk-ka8befem.js → chunk-v6peecfp.js} +2 -2
  124. package/dist/{chunk-g8r0km7g.js → chunk-vayhx642.js} +2 -2
  125. package/dist/{chunk-1ptwdkvn.js → chunk-vdxg7e1y.js} +2 -2
  126. package/dist/chunk-vq513cxx.js +2 -0
  127. package/dist/chunk-vvq8xe3n.js +2 -0
  128. package/dist/{chunk-tre98h62.js → chunk-w3d98907.js} +2 -2
  129. package/dist/{chunk-0qqvmfrw.js → chunk-w7t2cfgy.js} +42 -42
  130. package/dist/chunk-w8t31bn9.js +2 -0
  131. package/dist/chunk-x1kz4d7j.js +2 -0
  132. package/dist/chunk-xcsyqwxf.js +25 -0
  133. package/dist/{chunk-9p6efb17.js → chunk-xghcsg3f.js} +1 -1
  134. package/dist/chunk-xn9jrjzh.js +2 -0
  135. package/dist/{chunk-nrvwejdw.js → chunk-y1pcdeg9.js} +5 -5
  136. package/dist/{chunk-7b3kr56x.js → chunk-yx3dpdwc.js} +3 -3
  137. package/dist/{chunk-5xvan09w.js → chunk-z22zy22p.js} +2 -2
  138. package/dist/chunk-z97bwx8m.js +2 -0
  139. package/dist/{chunk-120ze5ms.js → chunk-zmg1peyg.js} +3 -3
  140. package/dist/{chunk-pxdww4rb.js → chunk-zp79zkkd.js} +2 -2
  141. package/dist/cli.js +20 -20
  142. package/dist/craft-entry.js +2 -2
  143. package/dist/craft.js +2 -2
  144. package/dist/loops.js +12 -2
  145. package/dist/pwa.js +3 -3
  146. package/dist/signal-processing.d.ts +12 -0
  147. package/dist/signal-processing.js +1 -1
  148. package/dist/ssg.js +6 -6
  149. package/package.json +5 -5
  150. package/dist/chunk-028ee6q5.js +0 -2
  151. package/dist/chunk-02ymqwmj.js +0 -2
  152. package/dist/chunk-1pnp91wx.js +0 -2
  153. package/dist/chunk-1v60t3sb.js +0 -2
  154. package/dist/chunk-2f17h17f.js +0 -2
  155. package/dist/chunk-4c183zem.js +0 -2
  156. package/dist/chunk-4yt8tg4j.js +0 -2
  157. package/dist/chunk-52gp2xxk.js +0 -2
  158. package/dist/chunk-5zgrvj4b.js +0 -2
  159. package/dist/chunk-67kj14at.js +0 -2
  160. package/dist/chunk-6rzshbey.js +0 -2
  161. package/dist/chunk-6vzktvyw.js +0 -2
  162. package/dist/chunk-81q3sc0w.js +0 -2
  163. package/dist/chunk-864qtx7y.js +0 -2
  164. package/dist/chunk-89jbdtgw.js +0 -3
  165. package/dist/chunk-8d33aqs5.js +0 -2
  166. package/dist/chunk-8tdz8svp.js +0 -2
  167. package/dist/chunk-99bhc1h1.js +0 -42
  168. package/dist/chunk-9rrnyd5m.js +0 -2
  169. package/dist/chunk-9szxxgv5.js +0 -2
  170. package/dist/chunk-amkwmxs8.js +0 -2
  171. package/dist/chunk-b1hxtn08.js +0 -2
  172. package/dist/chunk-b4fd2dtk.js +0 -2
  173. package/dist/chunk-b4vk2m82.js +0 -2
  174. package/dist/chunk-b58tv8jc.js +0 -25
  175. package/dist/chunk-b6nzy1rg.js +0 -2
  176. package/dist/chunk-b823zxq6.js +0 -3
  177. package/dist/chunk-bdg0fydw.js +0 -2
  178. package/dist/chunk-dpvxe52r.js +0 -2
  179. package/dist/chunk-e1fetwbr.js +0 -2
  180. package/dist/chunk-e4vpr36s.js +0 -2
  181. package/dist/chunk-e6p0k6br.js +0 -2
  182. package/dist/chunk-f8agvh5v.js +0 -2
  183. package/dist/chunk-fcn71bq1.js +0 -2
  184. package/dist/chunk-g2jmwh7p.js +0 -2
  185. package/dist/chunk-g64z2e92.js +0 -2
  186. package/dist/chunk-gw7h5k3b.js +0 -2
  187. package/dist/chunk-j0v970k3.js +0 -2
  188. package/dist/chunk-jk41jwsc.js +0 -2
  189. package/dist/chunk-jr9wfthg.js +0 -2
  190. package/dist/chunk-k2pa44rf.js +0 -2
  191. package/dist/chunk-kq9y6gfy.js +0 -2
  192. package/dist/chunk-md2qhahg.js +0 -2
  193. package/dist/chunk-p38m3947.js +0 -2
  194. package/dist/chunk-qcjh3pp8.js +0 -2
  195. package/dist/chunk-qw441qys.js +0 -2
  196. package/dist/chunk-qxmyaajq.js +0 -2
  197. package/dist/chunk-qyjsne99.js +0 -2
  198. package/dist/chunk-rermy54w.js +0 -2
  199. package/dist/chunk-rwjf25ht.js +0 -2
  200. package/dist/chunk-rx0ep3v1.js +0 -2
  201. package/dist/chunk-sf0wsq74.js +0 -2
  202. package/dist/chunk-shpc1ttk.js +0 -2
  203. package/dist/chunk-sy0z64yz.js +0 -2
  204. package/dist/chunk-ta7bmfvg.js +0 -3
  205. package/dist/chunk-weqc0ssb.js +0 -2
  206. package/dist/chunk-wq712sw1.js +0 -2
  207. package/dist/chunk-xr69d4tk.js +0 -2
  208. package/dist/chunk-xz6dw6yw.js +0 -2
  209. package/dist/chunk-y8kdy3d2.js +0 -2
  210. package/dist/chunk-yscr04dv.js +0 -2
  211. package/dist/chunk-z8p6tk5z.js +0 -2
  212. package/dist/chunk-zhf01af3.js +0 -3
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function hd(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function yd(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function bd(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
2
+ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function u(e){let t=getComputedStyle(e),o=t.transitionDuration||"0s",n=t.animationDuration||"0s",s=(a)=>{let i=a.match(/^([\d.]+)(s|ms)?$/);if(!i)return 0;let r=parseFloat(i[1]);return(i[2]||"s")==="ms"?r:r*1000};return Math.max(s(o),s(n))}function v(e,t){return new Promise((o)=>{let n=t??u(e);if(n===0){o();return}let s=!1,a=()=>{if(s)return;s=!0,e.removeEventListener("transitionend",i),e.removeEventListener("animationend",i),o()},i=(r)=>{if(r.target===e)a()};e.addEventListener("transitionend",i),e.addEventListener("animationend",i),setTimeout(a,n+50)})}function f(e){e.offsetHeight}async function yd(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),f(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((a)=>{t.onEnter(e,a)});else await v(e,s);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function bd(e,t={}){let o=t.name||"stx",n=m(o,t),s=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),f(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((a)=>{t.onLeave(e,a)});else await v(e,s);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function vd(e,t={},o){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(s,a,i)=>{let r=p(a),l=r.name||"stx",c=r.duration||300,d=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
3
3
  <div
4
4
  class="stx-transition-wrapper"
5
5
  data-transition="${l}"
@@ -41,7 +41,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
41
41
  });
42
42
  })();
43
43
  </script>
44
- `})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function vd(){return`
44
+ `})}function p(e){let t={},o=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=o.exec(e))!==null){let s=n[1],a=n[2]||n[3]||n[4]||n[5];switch(s){case"name":t.name=a;break;case"duration":t.duration=parseInt(a,10);break;case"mode":t.mode=a;break;case"easing":t.easing=a;break}}return t}function wd(){return`
45
45
  /* STX Transition Presets */
46
46
 
47
47
  /* Fade */
@@ -228,7 +228,7 @@ function m(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:
228
228
  opacity: 1;
229
229
  max-height: 1000px;
230
230
  }
231
- `}function wd(){return`
231
+ `}function xd(){return`
232
232
  // STX Transition Runtime
233
233
  (function() {
234
234
  if (typeof window === 'undefined') return;
@@ -317,5 +317,5 @@ else {
317
317
 
318
318
  console.log('[stx] Transition runtime initialized');
319
319
  })();
320
- `}function xd(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
321
- export{hd,yd,bd,vd,wd,xd};
320
+ `}function Sd(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(o,n,s,a)=>{let i=s||"300",r=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${i}" data-stx-transition-condition="${a}" data-stx-transition-id="${r}"`})}
321
+ export{yd,bd,vd,wd,xd,Sd};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{qo,Mp,Lp,ic,Fe,lu,_s,jp,Bp,Fp,zp,Hp,Vp,Up,Wp,qp}from"./chunk-bsajk82t.js";export{Vp as applyHead,jp as definePageMeta,qo as getHead,Mp as getPageMeta,Fe as mergeHeadConfigs,Up as processHeadDirective,qp as processMetaDirective,Wp as processTitleDirective,Hp as renderBodyAttrs,Fp as renderHead,zp as renderHtmlAttrs,Lp as resetHead,_s as seoMetaToHeadConfig,ic as useHead,Bp as usePageTitle,lu as useSeoMeta,Bp as useTitle};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
2
  var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),b=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function w(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,r=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,t;while((t=p.exec(o))!==null){let e=t[1]==="/",n=t[2],a=t[3]==="/";if(f.has(n.toLowerCase()))continue;if(a)continue;if(e)r.set(n,(r.get(n)??0)+1);else{let g=s.get(n);if(g)g.count++;else{let d=o.slice(0,t.index).split(`
3
- `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function Zs(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
- export{Zs};
3
+ `).length;s.set(n,{count:1,firstLine:d})}}}let c=[];for(let e of new Set([...s.keys(),...r.keys()])){if(b.has(e.toLowerCase()))continue;let n=s.get(e)?.count??0,a=r.get(e)??0;if(n!==a)c.push({tag:e,opened:n,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return c}var u=new Set;function Qs(i,o){let s;try{s=w(i)}catch{return}if(s.length===0)return;let r=`${o}:${i.length}`;if(u.has(r))return;u.add(r);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:t,opened:c,closed:e,firstOpenLine:n}of s)if(c>e){let a=n?` (first opened at line ${n})`:"";console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 an unclosed <${t}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${t}> ${c} opened, ${e} closed \u2014 ${e-c} stray </${t}>.`)}
4
+ export{Qs};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{zn,Ee}from"./chunk-md2jn67b.js";import{L,y,rr,as,S}from"./chunk-t0zh1dn9.js";import{o,R}from"./chunk-hmyb701s.js";import{Js}from"./chunk-mxbc2ahy.js";import{Ze}from"./chunk-2zzc7006.js";import{c}from"./chunk-zhf01af3.js";import{i,et}from"./chunk-qjtpxsyx.js";import d from"path";import b from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Js(t,e,n)}var at=2;function ll(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function st(t,e){let n=t;for(let r of $t(e))if(r!==d.sep)n=n.split(r).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let r=e;try{r=b.realpathSync(e)}catch{}n=[...new Set([e,r])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=b.statSync(t),r=d.resolve(e),u=t.startsWith(`${r}${d.sep}`);return{path:u?d.relative(r,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(b.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let r=ct(n,e);try{let u=b.statSync(r);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(b.readFileSync(r)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function ul(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await b.promises.readdir(t)).filter((l)=>l.endsWith(".js")),r=ul();if(n.length<=r)return;let m=(await Promise.all(n.map(async(l)=>{try{return{name:l,at:(await b.promises.stat(d.join(t,l))).mtimeMs}}catch{return null}}))).filter((l)=>l!==null);m.sort((l,w)=>w.at-l.at);for(let l of m.slice(r)){let w=l.name.slice(0,-3);await b.promises.rm(d.join(t,`${w}.js`),{force:!0}),await b.promises.rm(d.join(t,`${w}.deps.json`),{force:!0})}C("pruned bundle cache to",r,"entries")}catch{}}function Ce(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function dl(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(dl())console.log("[stx:bundler]",...t)}var Y=[];function Qi(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Gt(){return Y.slice()}function Kt(){Y.length=0}var Z;function rp(t){Z=t}function ea(){if(Z)return Z;try{let t=R.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Xt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((l)=>l.test(u)))return C("detected user import:",u),!0}let r=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=r.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((l)=>l.test(u)))return C("detected side-effect import:",u),!0}return!1}var Fn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function pl(t,e){return d.relative(t,e).split(d.sep).join("/")}function fl(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,r,u,m)=>{let l=e.get(m);return l&&!m.startsWith(Fn)?`${r}${u}${l}${u}`:n})}function gl(t,e){let n=0,r=(m)=>{let l=`__stxMod${n++}`,w=JSON.stringify(m);return e.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),l},u=(m,l)=>{for(let w of m.split(",")){let F=w.trim();if(!F)continue;let j=F.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let p=j[1].startsWith('"')?JSON.parse(j[1]):j[1],s=j[2]??p;e.push(`var ${s} = ${l}[${JSON.stringify(p)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l,w)=>{let F=w.slice(Fn.length),j=r(F),p=l.trim(),s=p.match(/^([\w$]+)\s*(?:,\s*|$)/);if(s&&!p.startsWith("{")&&!p.startsWith("*"))e.push(`var ${s[1]} = ${j}.default;`),p=p.slice(s[0].length).trim();let a=p.match(/^\*\s*as\s+([\w$]+)$/);if(a)e.push(`var ${a[1]} = ${j};`);else if(p.startsWith("{"))u(p.replace(/^\{|\}$/g,""),j);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l)=>(r(l.slice(Fn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(b.existsSync(n)&&b.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function qs(t,e){let n=new Bun.CryptoHasher("md5");for(let[r,u]of[...t].sort(([m],[l])=>m<l?-1:m>l?1:0))n.update(`${r}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function Jt(){return K.getStore()?.key??""}function Bt(t,e,n,r,u,m=new Map,l,w){let F=(p,s,a)=>{if(X(s,t,l))return null;if(!u||p!==n||!vt.test(s))return null;try{if(!b.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}r.add(s);let h=`${Fn}${pl(process.cwd(),s)}`;return m.set(a,h),{path:h,external:!0}},j=(p,s)=>{let a=p===n?e:d.dirname(p),h=d.resolve(a,s);return it(h)??h};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^\//},(s)=>{let a=it(s.path);if(a){let h=F(s.importer,a,s.path);if(h)return h;if(a!==n)r.add(a);return{path:a}}return{path:s.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(s)=>{let a=j(s.importer,s.path),h=F(s.importer,a,s.path);if(h)return h;return r.add(a),{path:a}}),p.onResolve({filter:/^[@~]\//},(s)=>{let a=d.resolve(t,s.path.slice(2)),h=[a,`${a}.ts`,`${a}.tsx`,`${a}.js`,`${a}.mjs`,`${a}.jsx`,d.join(a,"index.ts"),d.join(a,"index.tsx"),d.join(a,"index.js"),d.join(a,"index.mjs")];for(let I of h)if(b.existsSync(I)&&b.statSync(I,{throwIfNoEntry:!1})?.isFile()){let E=F(s.importer,I,s.path);if(E)return E;return C(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",I),r.add(I),{path:I}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:a}}),u)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(s.importer!==n)return;let a=`${Fn}npm:${s.path}`;return m.set(s.path,a),{path:a,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(X(s.path,t,l))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let a=d.extname(s.path).toLowerCase(),h=a===".json"?"json":a===".tsx"?"tsx":a===".jsx"?"jsx":a===".ts"||a===".mts"||a===".cts"?"ts":"js";if(s.path!==n)r.add(s.path);let I=w?.get(s.path);if(I!==void 0)return{contents:I,loader:"js"};return{contents:b.readFileSync(s.path,"utf8"),loader:h}})}}}var H=new Map,z=y(64),ot=Symbol.for("stx.client-bundle-build-queue");function ml(t){let e=globalThis,r=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=r.then(()=>{return},()=>{return}),r}async function Yt(t,e,n={}){let r=n.projectRoot||process.cwd(),u=(await o(r)).serverApi,m=n.minify??!1,l=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,F=n.cacheDir||ll(r),j=K.getStore(),p=new Bun.CryptoHasher("md5");p.update(`${xt}\x00${Ze()}\x00${JSON.stringify(u??!1)}\x00${l?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${m?"minified":"readable"}\x00${j?.key??""}\x00${st(t,r)}\x00${st(e,r)}`);let s=p.digest("hex").slice(0,12),a=d.join(F,`${s}.js`),h=z.get(a);if(h){if(as(h.files)&&h.files.every((M)=>!X(M.path,r,u))){C("memo hit:",s);let M=h.files.map((A)=>A.path);return q(e,M),n.collectInputs?.push(...M),h.code}z.delete(a),C("memo invalidated by dep change:",s)}let I=d.join(F,`${s}.deps.json`),E=Bun.file(a);if(await E.exists()){let M=Bun.file(I),A=!1,O=null;if(await M.exists())try{let D=JSON.parse(await M.text());if(D.metadataVersion===at&&Array.isArray(D.files)&&bt(D.files,r))O=rr(D.files.map((g)=>ct(g,r))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,r,u))}catch{A=!1}if(A){if(C("cache hit:",s),O)q(e,O.map((T)=>T.path)),n.collectInputs?.push(...O.map((T)=>T.path));let D=await E.text(),g=new Date;if(b.promises.utimes(a,g,g).catch(()=>{}),O)z.set(a,{code:D,files:O});return D}C("cache invalidated by dep change:",s)}let P=H.get(s);if(P){let M=await P;if(n.collectInputs)n.collectInputs.push(...(z.get(a)?.files??[]).map((A)=>A.path));return M}let V=ml(()=>Et(t,e,{projectRoot:r,minify:m,cacheDir:F,hash:s,cachePath:a,depsPath:I,collectInputs:n.collectInputs,externalizeUserModules:l,serverApi:u,expose:w,throwOnFailure:n.throwOnFailure,substitutes:j?.modules}));H.set(s,V);try{return await V}finally{H.delete(s)}}var jt=0;function hl(t){return`${t}-${process.pid}-${++jt}`}async function Et(t,e,n){let{projectRoot:r,minify:u,cacheDir:m,hash:l,cachePath:w,depsPath:F,externalizeUserModules:j}=n,p=c(r,"bundle-tmp"),s=hl(l),a=d.join(p,`${s}.ts`),h=d.join(p,"out",s);b.mkdirSync(p,{recursive:!0}),b.mkdirSync(h,{recursive:!0});let I=d.dirname(e),E=new Set,P=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=i(t),{depths:A,balanced:O}=et(M),D=(B)=>!O||A[B]===0,g;while((g=P.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((B)=>{let f=_t(B);if(f)E.add(f)});else if(g[3])E.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;E.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!D(g.index))continue;let B=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(B&&Q.some((f)=>f.test(B)))continue;if(g[1])E.add(g[1]);if(g[2])E.add(g[2]);for(let f of(g[3]??"").split(",")){let v=f.trim();if(!v||/^type\s/.test(v))continue;let U=/\bas\s+(\w+)\s*$/.exec(v)?.[1]??/^\w+$/.exec(v)?.[0];if(U)E.add(U)}}for(let B of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of B[1].split(",")){let v=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(v)E.delete(v)}let ut=E.size>0?`
3
- export { ${[...E].join(", ")} }`:"";await Bun.write(a,t+ut),C("bundling:",l,"from:",d.basename(e));let tt=new Set,nt=new Map;try{let B=await Bun.build({entrypoints:[a],outdir:h,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[Bt(r,I,a,tt,j,nt,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...S()},root:r});if(!B.success){let _=B.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ")||`Unable to bundle ${d.basename(e)}`,k=zn(B.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",_),Qi(e||"",_,k),n.throwOnFailure||ea()==="error")throw Error(_);return t}let f="";for(let x of B.outputs){f=await x.text();break}let v=[];for(let x of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let _ of x[1].split(",")){let k=_.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){v.push([k[2],k[1]]);continue}let N=_.trim();if(/^[A-Za-z_$][\w$]*$/.test(N))v.push([N,N])}if(n.expose){let x=new Set(n.expose);for(let _=v.length-1;_>=0;_--)if(!x.has(v[_][0]))v.splice(_,1)}let U=[];f=gl(fl(f,nt),U);let dt=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${l}`,pt=new Set(L(t,!0).split(",").map((x)=>x.trim())),ft=v.map(([x,_])=>`get ${JSON.stringify(x)}() { return ${_} }${pt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${_}) { ${_} = __stxValue_${_} }`:""}`).join(", "),mt=v.map(([x])=>`var ${x} = undefined;`).join(`
2
+ import{zn,Ee}from"./chunk-md2jn67b.js";import{L,y,sr,cs,S}from"./chunk-f9zyf9n6.js";import{o,R}from"./chunk-srq9fqq8.js";import{Ys}from"./chunk-hz4x7h0n.js";import{Ze}from"./chunk-2zzc7006.js";import{c}from"./chunk-v14rq8b4.js";import{i,et}from"./chunk-7mvz972c.js";import d from"path";import b from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||Ys(t,e,n)}var at=2;function ul(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):c(t,"bundle-cache")}function st(t,e){let n=t;for(let r of $t(e))if(r!==d.sep)n=n.split(r).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let r=e;try{r=b.realpathSync(e)}catch{}n=[...new Set([e,r])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=b.statSync(t),r=d.resolve(e),u=t.startsWith(`${r}${d.sep}`);return{path:u?d.relative(r,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(b.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let r=ct(n,e);try{let u=b.statSync(r);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(b.readFileSync(r)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function dl(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await b.promises.readdir(t)).filter((l)=>l.endsWith(".js")),r=dl();if(n.length<=r)return;let m=(await Promise.all(n.map(async(l)=>{try{return{name:l,at:(await b.promises.stat(d.join(t,l))).mtimeMs}}catch{return null}}))).filter((l)=>l!==null);m.sort((l,w)=>w.at-l.at);for(let l of m.slice(r)){let w=l.name.slice(0,-3);await b.promises.rm(d.join(t,`${w}.js`),{force:!0}),await b.promises.rm(d.join(t,`${w}.deps.json`),{force:!0})}C("pruned bundle cache to",r,"entries")}catch{}}function Ce(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function pl(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function C(...t){if(pl())console.log("[stx:bundler]",...t)}var Y=[];function ea(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Gt(){return Y.slice()}function Kt(){Y.length=0}var Z;function sp(t){Z=t}function ta(){if(Z)return Z;try{let t=R.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function Xt(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((l)=>l.test(u)))return C("detected user import:",u),!0}let r=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=r.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((l)=>l.test(u)))return C("detected side-effect import:",u),!0}return!1}var Fn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function fl(t,e){return d.relative(t,e).split(d.sep).join("/")}function gl(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,r,u,m)=>{let l=e.get(m);return l&&!m.startsWith(Fn)?`${r}${u}${l}${u}`:n})}function ml(t,e){let n=0,r=(m)=>{let l=`__stxMod${n++}`,w=JSON.stringify(m);return e.push(`var ${l} = globalThis.__stxModules && globalThis.__stxModules[${w}];`,`if (${l} === undefined) throw new Error("[stx] module " + ${JSON.stringify(w)} + " is not registered on this page (#1957)");`),l},u=(m,l)=>{for(let w of m.split(",")){let F=w.trim();if(!F)continue;let j=F.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!j)continue;let p=j[1].startsWith('"')?JSON.parse(j[1]):j[1],s=j[2]??p;e.push(`var ${s} = ${l}[${JSON.stringify(p)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l,w)=>{let F=w.slice(Fn.length),j=r(F),p=l.trim(),s=p.match(/^([\w$]+)\s*(?:,\s*|$)/);if(s&&!p.startsWith("{")&&!p.startsWith("*"))e.push(`var ${s[1]} = ${j}.default;`),p=p.slice(s[0].length).trim();let a=p.match(/^\*\s*as\s+([\w$]+)$/);if(a)e.push(`var ${a[1]} = ${j};`);else if(p.startsWith("{"))u(p.replace(/^\{|\}$/g,""),j);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,l)=>(r(l.slice(Fn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(b.existsSync(n)&&b.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function Gs(t,e){let n=new Bun.CryptoHasher("md5");for(let[r,u]of[...t].sort(([m],[l])=>m<l?-1:m>l?1:0))n.update(`${r}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function Jt(){return K.getStore()?.key??""}function Bt(t,e,n,r,u,m=new Map,l,w){let F=(p,s,a)=>{if(X(s,t,l))return null;if(!u||p!==n||!vt.test(s))return null;try{if(!b.statSync(s,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}r.add(s);let h=`${Fn}${fl(process.cwd(),s)}`;return m.set(a,h),{path:h,external:!0}},j=(p,s)=>{let a=p===n?e:d.dirname(p),h=d.resolve(a,s);return it(h)??h};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(s)=>({path:s.path,external:!0})),p.onResolve({filter:/^\//},(s)=>{let a=it(s.path);if(a){let h=F(s.importer,a,s.path);if(h)return h;if(a!==n)r.add(a);return{path:a}}return{path:s.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(s)=>{let a=j(s.importer,s.path),h=F(s.importer,a,s.path);if(h)return h;return r.add(a),{path:a}}),p.onResolve({filter:/^[@~]\//},(s)=>{let a=d.resolve(t,s.path.slice(2)),h=[a,`${a}.ts`,`${a}.tsx`,`${a}.js`,`${a}.mjs`,`${a}.jsx`,d.join(a,"index.ts"),d.join(a,"index.tsx"),d.join(a,"index.js"),d.join(a,"index.mjs")];for(let I of h)if(b.existsSync(I)&&b.statSync(I,{throwIfNoEntry:!1})?.isFile()){let E=F(s.importer,I,s.path);if(E)return E;return C(`resolved ${s.path[0]}/ import:`,s.path,"\u2192",I),r.add(I),{path:I}}return console.warn(`[stx:bundler] could not resolve ${s.path[0]}/ import:`,s.path),{path:a}}),u)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(s)=>{if(s.importer!==n)return;let a=`${Fn}npm:${s.path}`;return m.set(s.path,a),{path:a,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(s)=>{if(X(s.path,t,l))throw Error(`Server-only API source cannot be imported by a client script: ${s.path}`);let a=d.extname(s.path).toLowerCase(),h=a===".json"?"json":a===".tsx"?"tsx":a===".jsx"?"jsx":a===".ts"||a===".mts"||a===".cts"?"ts":"js";if(s.path!==n)r.add(s.path);let I=w?.get(s.path);if(I!==void 0)return{contents:I,loader:"js"};return{contents:b.readFileSync(s.path,"utf8"),loader:h}})}}}var H=new Map,z=y(64),ot=Symbol.for("stx.client-bundle-build-queue");function hl(t){let e=globalThis,r=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=r.then(()=>{return},()=>{return}),r}async function Yt(t,e,n={}){let r=n.projectRoot||process.cwd(),u=(await o(r)).serverApi,m=n.minify??!1,l=n.externalizeUserModules??!0,w=n.expose?.length?[...new Set(n.expose)].sort():void 0,F=n.cacheDir||ul(r),j=K.getStore(),p=new Bun.CryptoHasher("md5");p.update(`${xt}\x00${Ze()}\x00${JSON.stringify(u??!1)}\x00${l?"registry":"inline"}\x00${w?w.join(","):"*"}\x00${m?"minified":"readable"}\x00${j?.key??""}\x00${st(t,r)}\x00${st(e,r)}`);let s=p.digest("hex").slice(0,12),a=d.join(F,`${s}.js`),h=z.get(a);if(h){if(cs(h.files)&&h.files.every((M)=>!X(M.path,r,u))){C("memo hit:",s);let M=h.files.map((A)=>A.path);return q(e,M),n.collectInputs?.push(...M),h.code}z.delete(a),C("memo invalidated by dep change:",s)}let I=d.join(F,`${s}.deps.json`),E=Bun.file(a);if(await E.exists()){let M=Bun.file(I),A=!1,O=null;if(await M.exists())try{let D=JSON.parse(await M.text());if(D.metadataVersion===at&&Array.isArray(D.files)&&bt(D.files,r))O=sr(D.files.map((g)=>ct(g,r))),A=O.length===D.files.length&&!O.some((g)=>X(g.path,r,u))}catch{A=!1}if(A){if(C("cache hit:",s),O)q(e,O.map((T)=>T.path)),n.collectInputs?.push(...O.map((T)=>T.path));let D=await E.text(),g=new Date;if(b.promises.utimes(a,g,g).catch(()=>{}),O)z.set(a,{code:D,files:O});return D}C("cache invalidated by dep change:",s)}let P=H.get(s);if(P){let M=await P;if(n.collectInputs)n.collectInputs.push(...(z.get(a)?.files??[]).map((A)=>A.path));return M}let V=hl(()=>Et(t,e,{projectRoot:r,minify:m,cacheDir:F,hash:s,cachePath:a,depsPath:I,collectInputs:n.collectInputs,externalizeUserModules:l,serverApi:u,expose:w,throwOnFailure:n.throwOnFailure,substitutes:j?.modules}));H.set(s,V);try{return await V}finally{H.delete(s)}}var jt=0;function yl(t){return`${t}-${process.pid}-${++jt}`}async function Et(t,e,n){let{projectRoot:r,minify:u,cacheDir:m,hash:l,cachePath:w,depsPath:F,externalizeUserModules:j}=n,p=c(r,"bundle-tmp"),s=yl(l),a=d.join(p,`${s}.ts`),h=d.join(p,"out",s);b.mkdirSync(p,{recursive:!0}),b.mkdirSync(h,{recursive:!0});let I=d.dirname(e),E=new Set,P=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=i(t),{depths:A,balanced:O}=et(M),D=(B)=>!O||A[B]===0,g;while((g=P.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;if(g[2])g[2].split(",").forEach((B)=>{let f=_t(B);if(f)E.add(f)});else if(g[3])E.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!D(g.index))continue;E.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!D(g.index))continue;let B=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(B&&Q.some((f)=>f.test(B)))continue;if(g[1])E.add(g[1]);if(g[2])E.add(g[2]);for(let f of(g[3]??"").split(",")){let v=f.trim();if(!v||/^type\s/.test(v))continue;let U=/\bas\s+(\w+)\s*$/.exec(v)?.[1]??/^\w+$/.exec(v)?.[0];if(U)E.add(U)}}for(let B of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of B[1].split(",")){let v=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(v)E.delete(v)}let ut=E.size>0?`
3
+ export { ${[...E].join(", ")} }`:"";await Bun.write(a,t+ut),C("bundling:",l,"from:",d.basename(e));let tt=new Set,nt=new Map;try{let B=await Bun.build({entrypoints:[a],outdir:h,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[Bt(r,I,a,tt,j,nt,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...S()},root:r});if(!B.success){let _=B.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ")||`Unable to bundle ${d.basename(e)}`,k=zn(B.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",_),ea(e||"",_,k),n.throwOnFailure||ta()==="error")throw Error(_);return t}let f="";for(let x of B.outputs){f=await x.text();break}let v=[];for(let x of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let _ of x[1].split(",")){let k=_.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k){v.push([k[2],k[1]]);continue}let N=_.trim();if(/^[A-Za-z_$][\w$]*$/.test(N))v.push([N,N])}if(n.expose){let x=new Set(n.expose);for(let _=v.length-1;_>=0;_--)if(!x.has(v[_][0]))v.splice(_,1)}let U=[];f=ml(gl(f,nt),U);let dt=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${l}`,pt=new Set(L(t,!0).split(",").map((x)=>x.trim())),ft=v.map(([x,_])=>`get ${JSON.stringify(x)}() { return ${_} }${pt.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${_}) { ${_} = __stxValue_${_} }`:""}`).join(", "),mt=v.map(([x])=>`var ${x} = undefined;`).join(`
4
4
  `),gt=v.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
5
5
  `);if(f=`${dt.join(`
6
6
  `)}
@@ -16,5 +16,5 @@ var __stxLiveBindings = typeof __stxLiveBindings === 'undefined' ? {} : __stxLiv
16
16
  Object.keys(${J}).forEach(function(name) {
17
17
  if (!Object.prototype.hasOwnProperty.call(__stxLiveBindings, name))
18
18
  Object.defineProperty(__stxLiveBindings, name, Object.getOwnPropertyDescriptor(${J}, name));
19
- });`.trim(),C("bundled:",l,"output:",f.length,"bytes"),E.size>0&&v.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${l}); serving the unbundled source and not caching this result`),t;b.mkdirSync(m,{recursive:!0}),await Bun.write(w,f);let W=rr(tt);return await Bun.write(F,JSON.stringify({metadataVersion:at,files:W.map((x)=>yt(x.path,r)).filter((x)=>x!==null)})),q(e,W.map((x)=>x.path)),n.collectInputs?.push(...W.map((x)=>x.path)),z.set(w,{code:f,files:W}),await St(m),f}catch(B){let f=zn(B,e||void 0),v=Ee(B,e||void 0);if(console.warn(`[stx:bundler] error: ${v}`),Qi(e||"",v,f),n.throwOnFailure||ea()==="error")throw B;return t}finally{try{b.rmSync(a,{force:!0}),b.rmSync(h,{recursive:!0,force:!0})}catch{}}}function _t(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let r=e.indexOf(":");if(r!==-1)e=e.slice(r+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
20
- export{ll,ul,Ce,dl,Qi,Gt,Kt,rp,ea,Xt,Fn,pl,fl,gl,qs,Jt,ml,Yt,hl};
19
+ });`.trim(),C("bundled:",l,"output:",f.length,"bytes"),E.size>0&&v.length===0)return console.warn(`[stx:bundler] dropped every binding for ${d.basename(e)} (${l}); serving the unbundled source and not caching this result`),t;b.mkdirSync(m,{recursive:!0}),await Bun.write(w,f);let W=sr(tt);return await Bun.write(F,JSON.stringify({metadataVersion:at,files:W.map((x)=>yt(x.path,r)).filter((x)=>x!==null)})),q(e,W.map((x)=>x.path)),n.collectInputs?.push(...W.map((x)=>x.path)),z.set(w,{code:f,files:W}),await St(m),f}catch(B){let f=zn(B,e||void 0),v=Ee(B,e||void 0);if(console.warn(`[stx:bundler] error: ${v}`),ea(e||"",v,f),n.throwOnFailure||ta()==="error")throw B;return t}finally{try{b.rmSync(a,{force:!0}),b.rmSync(h,{recursive:!0,force:!0})}catch{}}}function _t(t){let e=t.trim();if(!e)return null;let n=e.indexOf("=");if(n!==-1)e=e.slice(0,n).trim();let r=e.indexOf(":");if(r!==-1)e=e.slice(r+1).trim();if(e.startsWith("..."))e=e.slice(3).trim();return/^[A-Za-z_$][\w$]*$/.test(e)?e:null}
20
+ export{ul,dl,Ce,pl,ea,Gt,Kt,sp,ta,Xt,Fn,fl,gl,ml,Gs,Jt,hl,Yt,yl};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{E,t,a}from"./chunk-2dp7hyv7.js";import{K}from"./chunk-t0zh1dn9.js";import{fo}from"./chunk-a3d0g4mr.js";import C from"path";var S;async function J(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function G(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function Y(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],l=s.i18n?.cacheMaxAge??0;if(!G(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await J(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Z(e,i,n);if(l===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Z(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
- `),n=[{obj:s,indent:-1}];for(let r of i){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,p]=o,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return Y(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(s>=c&&s<=u)return l[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let l=e.slice(n+1,r);i+=ae(l,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,i+=l;else if(l==="}")n--,i+=l;else if(l===","&&n===0)s.push(i),i="";else i+=l}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),l=`=${n}`;if(r[l])return R(r[l],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),l=s;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return i?e:"";let c=String(l);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=ne(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(o))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function fa(e,s,i,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...P,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,l,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>E(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?K(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return a("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(o)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>E(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return K(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return a("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(l,...c)=>{let u=i(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function ga(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||p} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${l}${u}`}),n=new Map([...s.entries()].map(([r,l])=>[l,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,W=H>z;if(!B&&!W)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${o.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),f=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${o.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function ma(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,l=Array.isArray(e)?e:[e],c=await fo(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let p=await Ae(g,o);if(u.push(o),p.length>0)i[o]=p}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:i,scannedFiles:u}}var ha={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),l=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},ya={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
- export{fa,ga,ma,ha,ya};
2
+ import{E,t,a}from"./chunk-bsajk82t.js";import{J}from"./chunk-f9zyf9n6.js";import{go}from"./chunk-7adznted.js";import C from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function G(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function Y(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],l=s.i18n?.cacheMaxAge??0;if(!G(r,l))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),l=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Z(e,i,n);if(l===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let c=l;if(i.cache)v[e]={translations:c,loadedAt:Date.now(),locale:e};return c}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Z(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let l=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(l);if(s.format==="json")return JSON.parse(l);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
3
+ `),n=[{obj:s,indent:-1}];for(let r of i){let l=r.replace(/#.*$/,"").trimEnd();if(!l.trim())continue;let c=l.search(/\S/);if(c===-1)continue;while(n.length>1&&n[n.length-1].indent>=c)n.pop();let u=n[n.length-1].obj,o=l.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(o){let[,,g,p]=o,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:c});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return Y(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let c=Number.parseInt(r[1],10);if(s===c)return r[2];continue}let l=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(l){let c=Number.parseInt(l[1],10),u=l[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(l[2],10);if(s>=c&&s<=u)return l[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let l=e.slice(n+1,r);i+=ae(l,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let l=e[r];if(l==="{")n++,i+=l;else if(l==="}")n--,i+=l;else if(l===","&&n===0)s.push(i),i="";else i+=l}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),l=`=${n}`;if(r[l])return R(r[l],n,i);let c=ce(n);if(r[c])return R(r[c],n,i);if(r.other)return R(r.other,n,i);return String(n)}function R(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),l=s;for(let u of r){if(l===void 0||l===null)break;l=l[u]}if(l===void 0||l===null)return i?e:"";let c=String(l);if(be(c))return ie(c,n);if(c.includes("|")&&"count"in n){let u=Number(n.count),o=c.split("|");c=ne(o,u)}for(let[u,o]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");c=c.replace(new RegExp(`:${g}`,"g"),()=>String(o))}return c}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function ga(e,s,i,n){let r=e,l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,c={...P,...n.i18n},u=await re(c.locale,n);s.__translations=u,s.__locale=c.locale,s.__i18nConfig=c,r=await F(r,l,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>E(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,c.fallbackToKey,b);return y?J(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return a("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(o)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>E(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return J(r,w,O(f,u,c.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return a("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(l,...c)=>{let u=i(l,...c).then((o)=>({match:l,replacement:o}));return n.push(u),l}),(await Promise.all(n)).reduce((l,{match:c,replacement:u})=>l.replace(c,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function ma(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(c,u,o)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${o||p} -->`});let l=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(l,(c,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(c,u,o)=>`<span id="${`desc-${u}`}" class="sr-only">${o}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,l,c)=>{let u=s.get(c);if(!u)u=`stx-a11y-component-${s.size}`,s.set(c,u);return`<${l}${u}`}),n=new Map([...s.entries()].map(([r,l])=>[l,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(l,c,u)=>{let o=n.get(u);return o?`<${c}${o}`:l})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let l=/<button([^>]*)>\s*<\/button>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=l.exec(e)}let c=/<a\s+([^>]*)>\s*<\/a>/gi;r=c.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=c.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let o=/<h([1-6])[^>]*>/gi,g=[];r=o.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=o.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((o)=>{if(!o.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${o.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((o)=>{if(!(o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby")||o.textContent&&o.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${o.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((o)=>{let g=o.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),m=o.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${o.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let l=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),c=0;for(let o of l){let g=Number.parseInt(o.tagName.charAt(1));if(c>0&&g>c+1)n.push({type:"heading-skip",element:`<${o.outerHTML}>`,message:`Heading level skipped from h${c} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});c=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((o)=>{let g=o.textContent&&o.textContent.trim().length>0,p=o.hasAttribute("aria-label")||o.hasAttribute("aria-labelledby"),f=o.hasAttribute("title"),m=o.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${o.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((o)=>{if(V(o.getAttribute("role")))return;let g=o.querySelector("caption");if(!o.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!o.hasAttribute("aria-label")&&!o.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((o)=>{let g=o.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${o.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((o)=>{if(!o.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${o.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((o)=>{if(Number.parseInt(o.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${o.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((o)=>{if(!o.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${o.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((o)=>{if(!o.hasAttribute("title")&&!o.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function ha(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,l=Array.isArray(e)?e:[e],c=await go(l,{recursive:n,ignorePaths:r}),u=[];for(let o of c)try{let g=await Bun.file(o).text();if(o.endsWith("good-a11y.stx"))continue;let p=await Ae(g,o);if(u.push(o),p.length>0)i[o]=p}catch(g){console.error(`Error scanning ${o}:`,g)}return{results:i,scannedFiles:u}}var ya={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),l=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${l||u} -->${e}`},hasEndTag:!1},ba={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
4
+ export{ga,ma,ha,ya,ba};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-pxdww4rb.js";import"./chunk-ce6zddpf.js";import{y,b,S,G}from"./chunk-t0zh1dn9.js";import"./chunk-2dp7hyv7.js";import"./chunk-1sr6c0nk.js";import"./chunk-xwhmh0w0.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,w=y(64),x=new Set,O=0,R=new Set(h);function T(){l.clear(),w.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=b(n,O),r=w.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(x.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),w.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=G({loader:"ts",target:"browser",define:S()}),C=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-zp79zkkd.js";import"./chunk-ce6zddpf.js";import{y,b,S,X}from"./chunk-f9zyf9n6.js";import"./chunk-bsajk82t.js";import"./chunk-25zmy8q6.js";import"./chunk-mwnhdsbp.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,w=y(64),x=new Set,O=0,R=new Set(h);function T(){l.clear(),w.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=b(n,O),r=w.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(x.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),w.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=X({loader:"ts",target:"browser",define:S()}),C=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let v=r.filter((s)=>!d.has(s)&&!I(n,s));if(v.length>0)console.warn(`[stx] could not bundle ${v.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),k=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function Fs(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function _n(i={}){Fs(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
- export{Fs,_n};
2
+ function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function zs(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function _n(i={}){zs(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
+ export{zs,_n};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Dc,Mu}from"./chunk-tddnb5bv.js";export{Dc as captureScreenshot,Mu as captureScreenshots};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{B}from"./chunk-t0zh1dn9.js";import{je,A,Ot}from"./chunk-1sr6c0nk.js";import{ut,Se,O,ke,Ai,Bs,Pi,kn}from"./chunk-jefe0rgt.js";import{vt,ie,Je}from"./chunk-365vg0eg.js";import{Xs}from"./chunk-mxbc2ahy.js";import{_n}from"./chunk-vqc4h16r.js";import{ge}from"./chunk-agqcqf3q.js";import Z from"fs";import T from"path";var{serve:pe}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ce(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function xn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ce(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new B(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",O(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Se(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",O(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):a()}}var ue={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function $u(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=Ai(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=_n(r.routeRules),f=new G,h=Xs(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?A(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Ot(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Je(i.html)),M.set(n.pattern,ge(i.html));let X=T.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let P=await Bun.file(X).text();N.set(n.pattern,m?Ot(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=ie(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=pe({port:o,async fetch(n){return xn(n,await je(m??A(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),L=ue[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=Se(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!C){let p=vt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=a(i),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=N.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...O(),...k.cache?{}:{"Cache-Control":ut}}})}}let d=Bs(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...O(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await kn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Pi(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-9rrnyd5m.js"),j=new Headers({...O(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(P&&!d){let V=Je(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",ge(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(S(P&&!d?ke(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...O(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",O(w.get("Vary")).Vary),P&&!d){let S=Je(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",ge(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(ke(c,r.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(c,{status:I??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
- export{xn,$u};
2
+ import{B}from"./chunk-f9zyf9n6.js";import{je,A,Ot}from"./chunk-25zmy8q6.js";import{ut,Se,O,ke,Pi,Fs,Ii,kn}from"./chunk-bawq4fqy.js";import{vt,ce,Je}from"./chunk-4s8zacxg.js";import{Js}from"./chunk-hz4x7h0n.js";import{_n}from"./chunk-s2wptfm1.js";import{me}from"./chunk-twqzn21x.js";import Z from"fs";import T from"path";var{serve:pe}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function xn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new B(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",O(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Se(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",O(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):a()}}var ue={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Ru(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=Pi(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=_n(r.routeRules),f=new G,h=Js(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?A(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Ot(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Je(i.html)),M.set(n.pattern,me(i.html));let X=T.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let P=await Bun.file(X).text();N.set(n.pattern,m?Ot(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=ce(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=pe({port:o,async fetch(n){return xn(n,await je(m??A(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),L=ue[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=Se(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!C){let p=vt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=a(i),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=N.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...O(),...k.cache?{}:{"Cache-Control":ut}}})}}let d=Fs(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...O(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await kn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Ii(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-7kznee1g.js"),j=new Headers({...O(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(P&&!d){let V=Je(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",me(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(S(P&&!d?ke(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...O(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",O(w.get("Vary")).Vary),P&&!d){let S=Je(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",me(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(ke(c,r.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(c,{status:I??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
+ export{xn,Ru};