@stacksjs/stx 0.2.873 → 0.2.875

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 (244) hide show
  1. package/dist/chunk-003ph86a.js +2 -0
  2. package/dist/chunk-027meh1k.js +2 -0
  3. package/dist/chunk-0bc3mwqd.js +2 -0
  4. package/dist/{chunk-gbtbfg7e.js → chunk-0g2mg8cw.js} +3 -3
  5. package/dist/chunk-0gv2mmr0.js +2 -0
  6. package/dist/{chunk-e631k202.js → chunk-0h6r7nvn.js} +38 -38
  7. package/dist/chunk-0j8zre1m.js +2 -0
  8. package/dist/{chunk-rb71xcfw.js → chunk-0qwbhv3f.js} +9 -9
  9. package/dist/{chunk-6mkn81pd.js → chunk-0sa9gqmc.js} +7 -7
  10. package/dist/chunk-1gfg6qmr.js +2 -0
  11. package/dist/{chunk-6ftee542.js → chunk-1q5w3xav.js} +2 -2
  12. package/dist/chunk-1tqp2s13.js +2 -0
  13. package/dist/chunk-1y7kfp5d.js +2 -0
  14. package/dist/chunk-1ztp5vkh.js +3 -0
  15. package/dist/chunk-24e4dapm.js +2 -0
  16. package/dist/{chunk-zktbzwkv.js → chunk-2qb9kp21.js} +3 -3
  17. package/dist/{chunk-01mwbg1r.js → chunk-2zaatnnh.js} +4 -4
  18. package/dist/chunk-32wvc376.js +2 -0
  19. package/dist/{chunk-h3j2zvms.js → chunk-3f9wctns.js} +2 -2
  20. package/dist/{chunk-v4xes880.js → chunk-3mz9bdf7.js} +3 -3
  21. package/dist/chunk-3te2y9qf.js +2 -0
  22. package/dist/{chunk-farh4p7f.js → chunk-3w7gacva.js} +2 -2
  23. package/dist/chunk-447jc6zc.js +2 -0
  24. package/dist/{chunk-s584xnzx.js → chunk-4517hny7.js} +2 -2
  25. package/dist/chunk-45rzd16g.js +1609 -0
  26. package/dist/{chunk-2drcj9wn.js → chunk-4m11kcxz.js} +8 -8
  27. package/dist/chunk-51ymssz5.js +2 -0
  28. package/dist/{chunk-xpzt4wwb.js → chunk-644ckv6e.js} +10 -10
  29. package/dist/{chunk-xr1yrdxy.js → chunk-6az66mrc.js} +14 -14
  30. package/dist/chunk-6dz5za5z.js +2 -0
  31. package/dist/{chunk-f30bpj7a.js → chunk-6ezt9kbe.js} +11 -11
  32. package/dist/chunk-6grkdknk.js +2 -0
  33. package/dist/chunk-6q9a5bph.js +2 -0
  34. package/dist/chunk-6rqef7wp.js +2 -0
  35. package/dist/{chunk-w3d7pwzg.js → chunk-6ykfy7eh.js} +2 -2
  36. package/dist/{chunk-vvddndcm.js → chunk-72p5annm.js} +4 -4
  37. package/dist/chunk-74x6j229.js +4 -0
  38. package/dist/{chunk-n3jw3xpj.js → chunk-75v0yxeh.js} +2 -2
  39. package/dist/chunk-7j11vgm1.js +3 -0
  40. package/dist/chunk-7ngfcdv9.js +2 -0
  41. package/dist/chunk-7njy024g.js +2 -0
  42. package/dist/{chunk-0489wcvq.js → chunk-88xayf21.js} +9 -9
  43. package/dist/{chunk-wa4w5bcn.js → chunk-95hbmv7k.js} +7 -7
  44. package/dist/{chunk-nack2xs5.js → chunk-976kgb3r.js} +5 -5
  45. package/dist/{chunk-mxdapaz2.js → chunk-9anqwafq.js} +3 -3
  46. package/dist/chunk-9e3ggwk7.js +2 -0
  47. package/dist/chunk-9mz2n39m.js +2 -0
  48. package/dist/chunk-a262spx7.js +2 -0
  49. package/dist/{chunk-j7q17ws8.js → chunk-a5yb8w7s.js} +3 -3
  50. package/dist/chunk-a8wn0snv.js +2 -0
  51. package/dist/{chunk-55zq2ha8.js → chunk-ae8q4gze.js} +5 -5
  52. package/dist/{chunk-hq0zqaqc.js → chunk-af6m1s2b.js} +1 -1
  53. package/dist/{chunk-hev4t4d5.js → chunk-afxfkb60.js} +6 -6
  54. package/dist/{chunk-aed45njs.js → chunk-az5rh7fs.js} +2 -2
  55. package/dist/chunk-b1tcym2x.js +2 -0
  56. package/dist/{chunk-j1efsjsb.js → chunk-b4d4tjvx.js} +5 -5
  57. package/dist/{chunk-hq4d1me0.js → chunk-b61dq7pz.js} +1 -1
  58. package/dist/{chunk-j89p53vx.js → chunk-bdh73gxd.js} +2 -2
  59. package/dist/{chunk-4068rmzv.js → chunk-bjjfr7qt.js} +2 -2
  60. package/dist/chunk-bs7g6jtt.js +2 -0
  61. package/dist/chunk-bspj1rf1.js +2 -0
  62. package/dist/chunk-bx3hpsxn.js +2 -0
  63. package/dist/chunk-byq488g4.js +2 -0
  64. package/dist/chunk-c8pzj57b.js +2 -0
  65. package/dist/{chunk-eq3mqbcn.js → chunk-cmh0bfkb.js} +5 -5
  66. package/dist/{chunk-7j0qkye5.js → chunk-d3q0cg47.js} +2 -2
  67. package/dist/{chunk-b666d8m6.js → chunk-d6gqh2wv.js} +1 -1
  68. package/dist/{chunk-vvxcebpn.js → chunk-dbvsa5ya.js} +2 -2
  69. package/dist/{chunk-b53rzbrh.js → chunk-dw0ttj6p.js} +2 -2
  70. package/dist/chunk-e2b2f502.js +2 -0
  71. package/dist/chunk-ec6mrad6.js +2 -0
  72. package/dist/chunk-eh2gec79.js +2 -0
  73. package/dist/{chunk-8hhhmscy.js → chunk-eknm4jrm.js} +2 -2
  74. package/dist/chunk-em31p5pb.js +2 -0
  75. package/dist/chunk-eqfsw6x4.js +2 -0
  76. package/dist/{chunk-4nb7egk0.js → chunk-esjr9qhe.js} +2 -2
  77. package/dist/chunk-ey1vwfpc.js +24 -0
  78. package/dist/{chunk-wk2rge05.js → chunk-f4vgagjb.js} +3 -3
  79. package/dist/chunk-fa57bncd.js +2 -0
  80. package/dist/{chunk-qjey0jk6.js → chunk-fdjx4vs3.js} +2 -2
  81. package/dist/chunk-fk79jbzn.js +2 -0
  82. package/dist/{chunk-8xjj7wjf.js → chunk-fnjm3xbf.js} +6 -6
  83. package/dist/{chunk-zfrzdje6.js → chunk-ft6em3wm.js} +6 -6
  84. package/dist/{chunk-w4a3fqf4.js → chunk-fy6ts0n4.js} +2 -2
  85. package/dist/{chunk-ct90b523.js → chunk-g33ycxe3.js} +5 -5
  86. package/dist/{chunk-scsmp2e5.js → chunk-g7qpnmbm.js} +14 -14
  87. package/dist/chunk-g97krv0d.js +2 -0
  88. package/dist/chunk-gn16yq49.js +2 -0
  89. package/dist/{chunk-qcxrcypb.js → chunk-gqtb53s8.js} +2 -2
  90. package/dist/chunk-gvs61tqn.js +2 -0
  91. package/dist/chunk-h2928108.js +2 -0
  92. package/dist/chunk-hd5bny2c.js +2 -0
  93. package/dist/chunk-j1ytbd6r.js +1184 -0
  94. package/dist/chunk-jm7qa3v3.js +2 -0
  95. package/dist/chunk-jmjgj3nh.js +2 -0
  96. package/dist/chunk-jqtpzzz4.js +12 -0
  97. package/dist/{chunk-hmdkf6c6.js → chunk-jqxerj6k.js} +2 -2
  98. package/dist/{chunk-3z1mmar2.js → chunk-jt5tzddc.js} +2 -2
  99. package/dist/{chunk-q50x1gfd.js → chunk-k1ew643q.js} +2 -2
  100. package/dist/chunk-kq8mffgf.js +2 -0
  101. package/dist/chunk-kx06jzdw.js +2 -0
  102. package/dist/{chunk-ysfeg3cn.js → chunk-kywe0f1v.js} +2 -2
  103. package/dist/{chunk-60yppcbb.js → chunk-kzc2tqzr.js} +2 -2
  104. package/dist/{chunk-9zrvh3pz.js → chunk-mce3g2wb.js} +2 -2
  105. package/dist/{chunk-bbq79tap.js → chunk-mw0rb1sf.js} +4 -4
  106. package/dist/chunk-n344ss97.js +2 -0
  107. package/dist/chunk-n5pvdrkb.js +2 -0
  108. package/dist/chunk-ne8q191s.js +2 -0
  109. package/dist/{chunk-e7s109j6.js → chunk-nnp6rf4c.js} +1 -1
  110. package/dist/chunk-np8wgbsa.js +3 -0
  111. package/dist/{chunk-tyvm49be.js → chunk-nv4c25zj.js} +3 -3
  112. package/dist/{chunk-tny8mz6q.js → chunk-p4e8myzj.js} +6 -6
  113. package/dist/{chunk-dhbpbjt3.js → chunk-p5m1z6e1.js} +6 -6
  114. package/dist/{chunk-18a3vdnq.js → chunk-pk714ynv.js} +4 -4
  115. package/dist/{chunk-csymxc5a.js → chunk-pp99rmjm.js} +15 -15
  116. package/dist/chunk-pqmjeea6.js +2 -0
  117. package/dist/chunk-q0k2gmva.js +2 -0
  118. package/dist/{chunk-e5xfbcp7.js → chunk-q7zc78az.js} +6 -6
  119. package/dist/chunk-qggwr60r.js +2 -0
  120. package/dist/chunk-qm3v4qb7.js +2 -0
  121. package/dist/{chunk-40h07m5w.js → chunk-qnwd5bz4.js} +1 -1
  122. package/dist/chunk-qrn1nza9.js +2 -0
  123. package/dist/chunk-qty0t69x.js +2 -0
  124. package/dist/{chunk-696cdgkg.js → chunk-qvrew79n.js} +1 -1
  125. package/dist/{chunk-tnp2ta5q.js → chunk-r09kz9bf.js} +2 -2
  126. package/dist/{chunk-q1wxgw5s.js → chunk-r2bxjna3.js} +2 -2
  127. package/dist/chunk-rzadf7vx.js +20 -0
  128. package/dist/{chunk-6vgr5g6d.js → chunk-rzd9hyhv.js} +2 -2
  129. package/dist/{chunk-8tk8yf91.js → chunk-s7fhpkvf.js} +6 -6
  130. package/dist/{chunk-ew5cey88.js → chunk-saqzk45g.js} +1 -1
  131. package/dist/{chunk-srgnevws.js → chunk-stn7p7f1.js} +2 -2
  132. package/dist/{chunk-xvj6yf0q.js → chunk-t4g3ka8c.js} +6 -6
  133. package/dist/chunk-ts37jw3s.js +2 -0
  134. package/dist/{chunk-cqhwzd9y.js → chunk-v0tdg16k.js} +5 -5
  135. package/dist/{chunk-j7f3h982.js → chunk-vmssv78v.js} +3 -3
  136. package/dist/{chunk-ymdw4fhd.js → chunk-vnrbjbrw.js} +2 -2
  137. package/dist/{chunk-gynvaceg.js → chunk-vznf808n.js} +5 -5
  138. package/dist/chunk-wkb7dhp7.js +2 -0
  139. package/dist/{chunk-m131znxe.js → chunk-wm029dh0.js} +13 -13
  140. package/dist/{chunk-hhbt8grm.js → chunk-wp0qpa50.js} +4 -4
  141. package/dist/chunk-wxyqp6g9.js +2 -0
  142. package/dist/{chunk-01c16zw4.js → chunk-wzvdr4ta.js} +2 -2
  143. package/dist/{chunk-e2t7mk29.js → chunk-x2ftkaz3.js} +2 -2
  144. package/dist/chunk-x76qvq1n.js +2 -0
  145. package/dist/{chunk-v37zmez0.js → chunk-xmws1gaf.js} +2 -2
  146. package/dist/{chunk-a8164hnf.js → chunk-xtaq95em.js} +1 -1
  147. package/dist/{chunk-5a0d3048.js → chunk-y2e2zm6y.js} +3 -3
  148. package/dist/chunk-y4hn1qh0.js +2 -0
  149. package/dist/{chunk-pywz8q4k.js → chunk-y75bds1g.js} +31 -31
  150. package/dist/chunk-yc8ggeh2.js +2 -0
  151. package/dist/{chunk-r0v2chpn.js → chunk-ydppkb8y.js} +2 -2
  152. package/dist/chunk-ydy0tfar.js +2 -0
  153. package/dist/chunk-yfed67yc.js +2 -0
  154. package/dist/{chunk-7ayvybdy.js → chunk-ysfgabpf.js} +3 -3
  155. package/dist/{chunk-fd1bpv35.js → chunk-yxdhz4ps.js} +2 -2
  156. package/dist/{chunk-rw5492e2.js → chunk-zc8a2erc.js} +4 -4
  157. package/dist/{chunk-7cvbz4eq.js → chunk-zn6n075d.js} +3 -3
  158. package/dist/cli.js +22 -22
  159. package/dist/component-library.d.ts +31 -1
  160. package/dist/component-library.js +74 -54
  161. package/dist/craft-entry.js +2 -2
  162. package/dist/craft.js +2 -2
  163. package/dist/inherited-context.d.ts +14 -0
  164. package/dist/inherited-context.js +102 -0
  165. package/dist/native-component-context.d.ts +10 -0
  166. package/dist/native-component-context.js +94 -0
  167. package/dist/pwa.js +3 -3
  168. package/dist/ssg.js +12 -12
  169. package/dist/stx-virtual-ts.d.ts +14 -2
  170. package/dist/stx-virtual-ts.js +64 -34
  171. package/dist/typecheck.d.ts +5 -2
  172. package/dist/typecheck.js +29 -19
  173. package/package.json +5 -5
  174. package/dist/chunk-0g80km93.js +0 -2
  175. package/dist/chunk-1mzfynpk.js +0 -2
  176. package/dist/chunk-26s2jxvn.js +0 -2
  177. package/dist/chunk-2asyyky3.js +0 -2
  178. package/dist/chunk-36e94whg.js +0 -3
  179. package/dist/chunk-3t91wwbe.js +0 -2
  180. package/dist/chunk-46pxmpeb.js +0 -3
  181. package/dist/chunk-4es07dwb.js +0 -2
  182. package/dist/chunk-4pr29yrx.js +0 -2
  183. package/dist/chunk-4v70bs2q.js +0 -2
  184. package/dist/chunk-5nj2k8zf.js +0 -2
  185. package/dist/chunk-60ezkjcz.js +0 -2
  186. package/dist/chunk-6pczzq5f.js +0 -2
  187. package/dist/chunk-73k579v7.js +0 -2
  188. package/dist/chunk-7wqevtks.js +0 -2
  189. package/dist/chunk-85m8nyk6.js +0 -2
  190. package/dist/chunk-8q8xkw02.js +0 -2
  191. package/dist/chunk-9fyw1xkh.js +0 -3
  192. package/dist/chunk-9kghtf20.js +0 -2
  193. package/dist/chunk-are96jcb.js +0 -2
  194. package/dist/chunk-asrzmw7w.js +0 -2
  195. package/dist/chunk-ba91r7q9.js +0 -2
  196. package/dist/chunk-cvgbtmxp.js +0 -2
  197. package/dist/chunk-d0h18m2r.js +0 -2
  198. package/dist/chunk-d3mmnzwy.js +0 -2
  199. package/dist/chunk-d8zhtwnw.js +0 -2
  200. package/dist/chunk-d9f7zb5p.js +0 -2
  201. package/dist/chunk-df49nnj9.js +0 -2
  202. package/dist/chunk-dhjet15m.js +0 -2
  203. package/dist/chunk-djdganvr.js +0 -2
  204. package/dist/chunk-dy1brym3.js +0 -2
  205. package/dist/chunk-eczy00w6.js +0 -2
  206. package/dist/chunk-ek5mv2h8.js +0 -2
  207. package/dist/chunk-eprhhrzc.js +0 -712
  208. package/dist/chunk-f52b9hjv.js +0 -2
  209. package/dist/chunk-fbqk2w2k.js +0 -4
  210. package/dist/chunk-gc4bgven.js +0 -2
  211. package/dist/chunk-gvz0kqkz.js +0 -2
  212. package/dist/chunk-h2qgqjkn.js +0 -2
  213. package/dist/chunk-h8rpk597.js +0 -2
  214. package/dist/chunk-hcaedzck.js +0 -2
  215. package/dist/chunk-hmsjjw34.js +0 -2
  216. package/dist/chunk-j4zrq17p.js +0 -2
  217. package/dist/chunk-jq0zvr43.js +0 -2
  218. package/dist/chunk-k0ph8zr7.js +0 -2
  219. package/dist/chunk-kp12tsn0.js +0 -2
  220. package/dist/chunk-m9cperj4.js +0 -2
  221. package/dist/chunk-me7cxs0e.js +0 -2
  222. package/dist/chunk-meqsd5bt.js +0 -2
  223. package/dist/chunk-n0d4vbcv.js +0 -2051
  224. package/dist/chunk-natvnazg.js +0 -2
  225. package/dist/chunk-nxqsdt89.js +0 -20
  226. package/dist/chunk-p2kqsb5k.js +0 -2
  227. package/dist/chunk-p71c1wrw.js +0 -2
  228. package/dist/chunk-qhczf1wf.js +0 -20
  229. package/dist/chunk-rqa92xm4.js +0 -2
  230. package/dist/chunk-s92j8k4z.js +0 -2
  231. package/dist/chunk-sb8qv9wy.js +0 -2
  232. package/dist/chunk-ts1jwj54.js +0 -2
  233. package/dist/chunk-vk98r75z.js +0 -2
  234. package/dist/chunk-vmq773pb.js +0 -2
  235. package/dist/chunk-w8qr5414.js +0 -2
  236. package/dist/chunk-xjxcwrqs.js +0 -2
  237. package/dist/chunk-y0a8hex3.js +0 -2
  238. package/dist/chunk-y2ctxchq.js +0 -2
  239. package/dist/chunk-ytzzth34.js +0 -2
  240. package/dist/chunk-yxpjj003.js +0 -2
  241. package/dist/chunk-z347p6cg.js +0 -2
  242. package/dist/chunk-z3afnkan.js +0 -2
  243. package/dist/chunk-z6c4c951.js +0 -2
  244. package/dist/chunk-z9xe3xkg.js +0 -12
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{An}from"./chunk-csymxc5a.js";import{L,J,w,Bt,Ft,Pr,h,gl,$i,G,I}from"./chunk-eprhhrzc.js";import{an}from"./chunk-696cdgkg.js";import{n}from"./chunk-36e94whg.js";import{Q}from"./chunk-9fyw1xkh.js";import{D,c}from"./chunk-fd1bpv35.js";var K=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Y(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)s.push({start:r.index,end:r.index+r[0].length});return s}function N(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function Z(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},r=s,i=r.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),r=r.slice(i[0].length);while(r.length>0){let o=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];r=r.slice(o[0].length);continue}let l=r.match(/^#([\w-]+)/);if(l){e.id=l[1],r=r.slice(l[0].length);continue}let a=r.match(/^\.([\w-]+)/);if(a){e.className=a[1],r=r.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function tt(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=Z(s);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,i=Y(t),o;while((o=r.exec(t))!==null){if(N(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||K.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!tt(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,x;while((x=f.exec(t))!==null){if(N(x.index,i))continue;let y=x[1]==="/";if(!y&&(x[2]||"").trimEnd().endsWith("/"))continue;if(d+=y?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:x.index,tagName:l}}return null}return null}var wt="private, no-store";function en(t){return t.replace(/&#(\d+);/g,(s,e)=>F(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>F(Number.parseInt(e,16),s)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function F(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Ae(t){return t.headers.get("X-STX-Router")==="true"}function et(t,s){if(!t)return s;return t.split(",").some((r)=>r.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function H(t){return{Vary:et(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return w(s,(r,i)=>(e.lastIndex=i,e.exec(r)?e.lastIndex:-1)).map(({token:r})=>r)}function V(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let r of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=r[1].toLowerCase();if(!(i in s))s[i]=r[2]??r[3]??r[4]??""}return s}function Ln(t){let s=[];for(let e of B(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let r=V(e);if(/^<meta\b/i.test(e)){let i=r.property?"property":"name",o=en(r[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${n(o)}" content="${E(r.content??"")}">`)}else{let i=en(r.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&r.hreflang)s.push(`<link rel="${i}" href="${E(r.href??"")}"${i==="alternate"?` hreflang="${E(r.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
3
- `}var nt=["media","crossorigin","integrity"];function jn(t){let s=[];for(let e of B(t)){if(!/^<link\b/i.test(e))continue;let r=V(e);if(en(r.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!r.href||"data-css"in r||"disabled"in r)continue;let i=nt.filter((o)=>(o in r)).map((o)=>` ${o}="${E(r[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(r.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
4
- `:""}import T from"path";var rt="stx-page-head:",st=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function it(){let t=Q()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-hcaedzck.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${r()}</script>`}catch{_[t]=""}return _[t]}async function wa(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let r=T.resolve(t,s);if(await Bun.file(r).exists())return r;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function So(t,s){try{let e=await Bun.file(t).text(),r=e,i=L(e);if(i)r=i.content.trim();let o=an(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=r;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:x,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-p71c1wrw.js"),k=await b(),m={__filename:t,__dirname:T.dirname(t)};for(let p of l){let A=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!p.includes("client")&&!p.includes('type="module"'))await y(A[1],m,t)}let S=await x(f,m,t,{...R,...k,...s},new Set),C=S.indexOf(d);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,C),afterSlot:S.substring(C+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Qr(t,s,e){let r,i="",o=s.match(st);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)r=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||r||"stx App",a=it(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{Pn}from"./chunk-pp99rmjm.js";import{L,J,w,Bt,Ft,Ir,h,yl,Oi,X,I}from"./chunk-j1ytbd6r.js";import{an}from"./chunk-qvrew79n.js";import{r}from"./chunk-7j11vgm1.js";import{Z}from"./chunk-1ztp5vkh.js";import{D,c}from"./chunk-yxdhz4ps.js";var K=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Y(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=e.exec(t))!==null)s.push({start:n.index,end:n.index+n[0].length});return s}function N(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function Q(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},n=s,i=n.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),n=n.slice(i[0].length);while(n.length>0){let o=n.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];n=n.slice(o[0].length);continue}let l=n.match(/^#([\w-]+)/);if(l){e.id=l[1],n=n.slice(l[0].length);continue}let a=n.match(/^\.([\w-]+)/);if(a){e.className=a[1],n=n.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function tt(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function P(t,s="main"){let e=Q(s);if(!e)return null;let n=/<([a-z][\w-]*)\b([^>]*)>/gi,i=Y(t),o;while((o=n.exec(t))!==null){if(N(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||K.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!tt(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,x;while((x=f.exec(t))!==null){if(N(x.index,i))continue;let y=x[1]==="/";if(!y&&(x[2]||"").trimEnd().endsWith("/"))continue;if(d+=y?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:x.index,tagName:l}}return null}return null}var wt="private, no-store";function en(t){return t.replace(/&#(\d+);/g,(s,e)=>F(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>F(Number.parseInt(e,16),s)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function F(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Ie(t){return t.headers.get("X-STX-Router")==="true"}function et(t,s){if(!t)return s;return t.split(",").some((n)=>n.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function H(t){return{Vary:et(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return w(s,(n,i)=>(e.lastIndex=i,e.exec(n)?e.lastIndex:-1)).map(({token:n})=>n)}function V(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let n of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=n[1].toLowerCase();if(!(i in s))s[i]=n[2]??n[3]??n[4]??""}return s}function jn(t){let s=[];for(let e of B(t)){if(/^<title\b/i.test(e)){s.push(`<title>${E(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let n=V(e);if(/^<meta\b/i.test(e)){let i=n.property?"property":"name",o=en(n[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${r(o)}" content="${E(n.content??"")}">`)}else{let i=en(n.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&n.hreflang)s.push(`<link rel="${i}" href="${E(n.href??"")}"${i==="alternate"?` hreflang="${E(n.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
3
+ `}var nt=["media","crossorigin","integrity"];function Bn(t){let s=[];for(let e of B(t)){if(!/^<link\b/i.test(e))continue;let n=V(e);if(en(n.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!n.href||"data-css"in n||"disabled"in n)continue;let i=nt.filter((o)=>(o in n)).map((o)=>` ${o}="${E(n[o])}"`).join("");s.push(`<link rel="stylesheet" href="${E(n.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
4
+ `:""}import T from"path";var rt="stx-page-head:",st=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function it(){let t=Z()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-027meh1k.js"),n=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${n()}</script>`}catch{_[t]=""}return _[t]}async function Sa(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let n=T.resolve(t,s);if(await Bun.file(n).exists())return n;return null}let e=T.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Eo(t,s){try{let e=await Bun.file(t).text(),n=e,i=L(e);if(i)n=i.content.trim();let o=an(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=n;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:x,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-eqfsw6x4.js"),k=await b(),m={__filename:t,__dirname:T.dirname(t)};for(let p of l){let A=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!p.includes("client")&&!p.includes('type="module"'))await y(A[1],m,t)}let S=await x(f,m,t,{...R,...k,...s},new Set),C=S.indexOf(d);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,C),afterSlot:S.substring(C+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function es(t,s,e){let n,i="",o=s.match(st);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)n=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||n||"stx App",a=it(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
5
5
  <html lang="en">
6
6
  <head>
7
7
  <meta charset="UTF-8">
@@ -20,14 +20,14 @@ ${t.shellScripts.filter((f)=>!f.includes("server")).join(`
20
20
  ${u}
21
21
  ${a}
22
22
  </body>
23
- </html>`}function Je(t,s={}){let e=t.trim();if(!An(e))return t;let r=[],i=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(i){let u=i[1],g=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=g.exec(u))!==null)r.push(f[0]);let d=u.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(d)r.push(d[0]);let x=u.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(x)r.push(x[0])}if(s.preserveHead&&i){let u=[],g=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=g.exec(i[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;u.push(f[0])}if(u.length>0)r.unshift(`<!--${rt}${Buffer.from(u.join(`
24
- `),"utf8").toString("base64")}-->`)}let o=e.match(/<body\b[^>]*>/i),l=c(e);if(o&&l!==-1){let u=o.index+o[0].length,g=e.slice(u,l).trim();if(r.length>0)return r.join(`
23
+ </html>`}function Ye(t,s={}){let e=t.trim();if(!Pn(e))return t;let n=[],i=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(i){let u=i[1],g=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=g.exec(u))!==null)n.push(f[0]);let d=u.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(d)n.push(d[0]);let x=u.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(x)n.push(x[0])}if(s.preserveHead&&i){let u=[],g=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=g.exec(i[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;u.push(f[0])}if(u.length>0)n.unshift(`<!--${rt}${Buffer.from(u.join(`
24
+ `),"utf8").toString("base64")}-->`)}let o=e.match(/<body\b[^>]*>/i),l=c(e);if(o&&l!==-1){let u=o.index+o[0].length,g=e.slice(u,l).trim();if(n.length>0)return n.join(`
25
25
  `)+`
26
- `+g;return g}let a=e;if(a=a.replace(/<!DOCTYPE\b[^>]*>/i,""),a=a.replace(/<html\b[^>]*>/i,""),a=a.replace(/<\/html\s*>/i,""),i)a=a.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,r.join(`
27
- `));return a=a.replace(/<body\b[^>]*>/i,""),a=a.replace(/<\/body\s*>/i,""),a.trim()}var q=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function U(t,s,e,r){if(!q.test(s))return!1;let i=s.slice(0,s.indexOf(">")+1),o=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!o)return!0;let l=`data-stx-scope="${o}"`;for(let a=t.indexOf(l);a!==-1;a=t.indexOf(l,a+l.length))if(a>=e&&a<r)return!1;return!0}function va(t){return Ae(t)}function ot(t,s){let e=[],r=new Set;for(let i of w(t,J)){if(i.start>=s.start&&i.start<s.end)continue;let o=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",l=new Map;for(let g of o.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))l.set(g[1].toLowerCase(),g[2]??g[3]??g[4]??"");let a=l.get("src")?.trim(),u=l.get("type")?.trim().toLowerCase();if(!a||l.has("server")||u&&!["module","text/javascript","application/javascript"].includes(u))continue;if(l.has("data-stx-runtime")||l.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(a))continue;if(U(t,i.token,s.start,s.end)||r.has(i.token))continue;r.add(i.token),e.push(i.token)}return e}function Ye(t,s="main"){return!!P(t.trim(),s)}function Pe(t,s="main",e=!1){let r=t.trim(),i=[],o=[],l=r.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(l){let S=l[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,p;while((p=C.exec(S))!==null)i.push(p[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((p=A.exec(S))!==null){if(q.test(p[0])||p[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(p[0]))continue;o.push(p[0])}}let a=P(r,s);if(!a)return(e?Ln(t)+jn(t):"")+Je(t);let u=ot(r,a),g=new Set(u),{tagName:f,start:d,end:x}=a,y=r.slice(d,x).trim(),R=[],b=r.match(/<body\b[^>]*>/i),k=c(r);if(b&&b.index!==void 0&&k!==-1){let C=[[b.index+b[0].length,a.openIndex],[x+`</${f}>`.length,k]],p=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,j]of C){if(A>=j)continue;let X=r.slice(A,j),v;p.lastIndex=0;while((v=p.exec(X))!==null){if(U(r,v[0],d,x))continue;R.push(v[0])}}}let m=[];if(e)m.push(Ln(t)+jn(t));if(i.length>0)m.push(i.join(`
26
+ `+g;return g}let a=e;if(a=a.replace(/<!DOCTYPE\b[^>]*>/i,""),a=a.replace(/<html\b[^>]*>/i,""),a=a.replace(/<\/html\s*>/i,""),i)a=a.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,n.join(`
27
+ `));return a=a.replace(/<body\b[^>]*>/i,""),a=a.replace(/<\/body\s*>/i,""),a.trim()}var q=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function U(t,s,e,n){if(!q.test(s))return!1;let i=s.slice(0,s.indexOf(">")+1),o=/\sdata-stx-owner="([^"]+)"/i.exec(i)?.[1];if(!o)return!0;let l=`data-stx-scope="${o}"`;for(let a=t.indexOf(l);a!==-1;a=t.indexOf(l,a+l.length))if(a>=e&&a<n)return!1;return!0}function ka(t){return Ie(t)}function ot(t,s){let e=[],n=new Set;for(let i of w(t,J)){if(i.start>=s.start&&i.start<s.end)continue;let o=i.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",l=new Map;for(let g of o.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))l.set(g[1].toLowerCase(),g[2]??g[3]??g[4]??"");let a=l.get("src")?.trim(),u=l.get("type")?.trim().toLowerCase();if(!a||l.has("server")||u&&!["module","text/javascript","application/javascript"].includes(u))continue;if(l.has("data-stx-runtime")||l.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(a))continue;if(U(t,i.token,s.start,s.end)||n.has(i.token))continue;n.add(i.token),e.push(i.token)}return e}function Ze(t,s="main"){return!!P(t.trim(),s)}function Oe(t,s="main",e=!1){let n=t.trim(),i=[],o=[],l=n.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(l){let S=l[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,p;while((p=C.exec(S))!==null)i.push(p[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((p=A.exec(S))!==null){if(q.test(p[0])||p[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(p[0]))continue;o.push(p[0])}}let a=P(n,s);if(!a)return(e?jn(t)+Bn(t):"")+Ye(t);let u=ot(n,a),g=new Set(u),{tagName:f,start:d,end:x}=a,y=n.slice(d,x).trim(),R=[],b=n.match(/<body\b[^>]*>/i),k=c(n);if(b&&b.index!==void 0&&k!==-1){let C=[[b.index+b[0].length,a.openIndex],[x+`</${f}>`.length,k]],p=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,j]of C){if(A>=j)continue;let W=n.slice(A,j),v;p.lastIndex=0;while((v=p.exec(W))!==null){if(U(n,v[0],d,x))continue;R.push(v[0])}}}let m=[];if(e)m.push(jn(t)+Bn(t));if(i.length>0)m.push(i.join(`
28
28
  `));if(u.length>0)m.push(u.join(`
29
29
  `));if(o.length>0)m.push(o.filter((S)=>!g.has(S)).join(`
30
30
  `));if(R.length>0)m.push(R.filter((S)=>!g.has(S)).join(`
31
31
  `));return m.push(y),m.join(`
32
- `)}import O from"fs";import z from"path";function xa(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Sa(t,s){let e=z.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function ka(t){let s=z.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function at(t){let s=t.headers.get("content-type")||"",e={},r=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")r(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())r(i,o);return e}return e}function ko(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function W(t,s={}){let e=s.request,r=s.method??e?.method;if(!e||!ko(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await at(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=ct(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function ct(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){s.push(M(e,r));continue}if(r&&typeof r==="object"){let i=r;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function _a(t,s=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)r.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")r.set(i,o);return new Response(null,{status:303,headers:r})}async function Bn(t,s={}){let{html:e,context:r,redirect:i,cookies:o}=await lt(t,s),l=Bt(r),a=Ft(r);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-9kghtf20.js"),g=u(r),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-h8rpk597.js"),{defaultConfig:x}=await import("./chunk-natvnazg.js"),y=r.streamBoundaries||{},R={...x,autoShell:!1},b=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof y[m]==="function"?await y[m]():void 0;return d(f[m],{...r,$boundary:S},t.sourceFile,R,new Set)}})),k=new Set(b.map((m)=>m.id));g=[...(g||[]).filter((m)=>!k.has(m.id)),...b]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function lt(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!$i(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await h(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let r=await W(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=Pr(e);if(!u)return a;let g=D(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!$i(t.html))return{html:i(t.html),context:e,cookies:r.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=I(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?G(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(gl(t.html,o)),context:e,cookies:r.cookies}}
33
- export{wt,en,Ae,H,Ln,jn,wa,So,Qr,Je,va,Ye,Pe,xa,Sa,ka,ko,_a,Bn};
32
+ `)}import O from"fs";import z from"path";function _a(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Ca(t,s){let e=z.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function Ea(t){let s=z.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),n=JSON.parse(e);if(n.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${n.version}`),null;return n}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let n=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)n+=`; Max-Age=${e.maxAge}`;if(e.expires)n+=`; Expires=${e.expires.toUTCString()}`;if(e.path)n+=`; Path=${e.path}`;if(e.domain)n+=`; Domain=${e.domain}`;if(e.secure)n+="; Secure";if(e.httpOnly)n+="; HttpOnly";if(e.sameSite)n+=`; SameSite=${e.sameSite}`;return n}async function at(t){let s=t.headers.get("content-type")||"",e={},n=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")n(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())n(i,o);return e}return e}function To(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function G(t,s={}){let e=s.request,n=s.method??e?.method;if(!e||!To(n))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await at(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=ct(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function ct(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,n]of Object.entries(t)){if(!e)continue;if(typeof n==="string"){s.push(M(e,n));continue}if(n&&typeof n==="object"){let i=n;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function Ta(t,s=[],e){let n=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)n.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")n.set(i,o);return new Response(null,{status:303,headers:n})}async function Fn(t,s={}){let{html:e,context:n,redirect:i,cookies:o}=await lt(t,s),l=Bt(n),a=Ft(n);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-24e4dapm.js"),g=u(n),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-hd5bny2c.js"),{defaultConfig:x}=await import("./chunk-eh2gec79.js"),y=n.streamBoundaries||{},R={...x,autoShell:!1},b=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof y[m]==="function"?await y[m]():void 0;return d(f[m],{...n,$boundary:S},t.sourceFile,R,new Set)}})),k=new Set(b.map((m)=>m.id));g=[...(g||[]).filter((m)=>!k.has(m.id)),...b]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function lt(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!Oi(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await h(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let n=await G(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=Ir(e);if(!u)return a;let g=D(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(n.redirect)return{html:t.html,context:e,redirect:n.redirect,cookies:n.cookies};if(!Oi(t.html))return{html:i(t.html),context:e,cookies:n.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=I(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?X(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(yl(t.html,o)),context:e,cookies:n.cookies}}
33
+ export{wt,en,Ie,H,jn,Bn,Sa,Eo,es,Ye,ka,Ze,Oe,_a,Ca,Ea,To,Ta,Fn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,u,Wt,qt,Kt,Ke,dt,F,no,jr,Xe}from"./chunk-csymxc5a.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>F(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function ii(e,r,n,g){if(!e.includes("@meta"))return e;let i=Wt(e,O,(a,o)=>{let s=jr(qt(a),r);if(s.kind==="tag")return N(s.tag);if(s.kind==="empty")return"";return F("Meta",o,s.message,n,s.code)},_("Meta",n));return i=Wt(i,I,(a,o)=>{let s=Kt(a,r);if(!s.ok)return F("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!dt(s.value))return F("MetaTag",o,`expected an object such as { name, content }, got ${Ke(s.value)}`,n,t.TYPE_ERROR);let l=s.value;if(!l.name&&!l.property&&!l.httpEquiv)return F("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(l.content===void 0||l.content===null||l.content===""||l.content===!1)return"";let p="<meta";if(l.name)p+=` name="${c(l.name)}"`;if(l.property)p+=` property="${c(l.property)}"`;if(l.httpEquiv)p+=` http-equiv="${c(l.httpEquiv)}"`;return p+=` content="${c(l.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(dt(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(dt))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function ai(e,r,n){if(!e.includes("@structuredData"))return e;return Wt(e,C,(g,i)=>{let a=Kt(g,r);if(!a.ok)return F("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=b(a.value);if(!o)return F("StructuredData",i,`expected an object or an array of objects, got ${Ke(a.value)}`,n,t.TYPE_ERROR);try{return E(o)}catch(s){let l=s instanceof Error?s.message:String(s);return F("StructuredData",i,`the data cannot be written as JSON: ${l}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function ci(e,r,n,g){if(!e.includes("@seo"))return e;return Wt(e,k,(i,a)=>{if(!i.trim())return F("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Kt(i,r);if(!o.ok)return F("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!dt(o.value))return F("SEO",a,`expected an object such as { title, description }, got ${Ke(o.value)}`,n,t.TYPE_ERROR);try{return L(o.value,a,n)}catch(s){let l=s instanceof Error?s.message:String(s);return F("SEO",a,`Error processing @seo directive: ${l}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(dt(i))return i;no(n,`${r} must be an object, got ${Ke(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((s)=>!j.has(s));if(g.length>0){let s=g.map((l)=>A[l]?`${l} (use ${A[l]})`:l).join(", ");no(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${c(e.title)}</title>
2
+ import{t,u,Wt,qt,Kt,Ge,dt,F,oo,Br,Xe}from"./chunk-pp99rmjm.js";var O=/(?<![\w$@])@meta\s*\(/g,I=/(?<![\w$@])@metaTag\s*\(/g,C=/(?<![\w$@])@structuredData\s*\(/g,k=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>F(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function N(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function ui(e,r,n,g){if(!e.includes("@meta"))return e;let i=Wt(e,O,(a,o)=>{let s=Br(qt(a),r);if(s.kind==="tag")return N(s.tag);if(s.kind==="empty")return"";return F("Meta",o,s.message,n,s.code)},_("Meta",n));return i=Wt(i,I,(a,o)=>{let s=Kt(a,r);if(!s.ok)return F("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!dt(s.value))return F("MetaTag",o,`expected an object such as { name, content }, got ${Ge(s.value)}`,n,t.TYPE_ERROR);let l=s.value;if(!l.name&&!l.property&&!l.httpEquiv)return F("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(l.content===void 0||l.content===null||l.content===""||l.content===!1)return"";let p="<meta";if(l.name)p+=` name="${c(l.name)}"`;if(l.property)p+=` property="${c(l.property)}"`;if(l.httpEquiv)p+=` http-equiv="${c(l.httpEquiv)}"`;return p+=` content="${c(l.content)}">`,p},_("MetaTag",n)),i}function b(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(dt(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(dt))return e.map(r);return null}function E(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function di(e,r,n){if(!e.includes("@structuredData"))return e;return Wt(e,C,(g,i)=>{let a=Kt(g,r);if(!a.ok)return F("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=b(a.value);if(!o)return F("StructuredData",i,`expected an object or an array of objects, got ${Ge(a.value)}`,n,t.TYPE_ERROR);try{return E(o)}catch(s){let l=s instanceof Error?s.message:String(s);return F("StructuredData",i,`the data cannot be written as JSON: ${l}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var j=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),A={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function pi(e,r,n,g){if(!e.includes("@seo"))return e;return Wt(e,k,(i,a)=>{if(!i.trim())return F("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Kt(i,r);if(!o.ok)return F("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!dt(o.value))return F("SEO",a,`expected an object such as { title, description }, got ${Ge(o.value)}`,n,t.TYPE_ERROR);try{return L(o.value,a,n)}catch(s){let l=s instanceof Error?s.message:String(s);return F("SEO",a,`Error processing @seo directive: ${l}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function R(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(dt(i))return i;oo(n,`${r} must be an object, got ${Ge(i)}; its tags were left out`,g);return}function L(e,r,n){let g=Object.keys(e).filter((s)=>!j.has(s));if(g.length>0){let s=g.map((l)=>A[l]?`${l} (use ${A[l]})`:l).join(", ");oo(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${c(e.title)}</title>
3
3
  `,i+=`<meta name="title" content="${c(e.title)}">
4
4
  `;if(e.description)i+=`<meta name="description" content="${c(e.description)}">
5
5
  `;if(e.keywords){let s=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${c(s)}">
@@ -25,7 +25,7 @@ import{t,u,Wt,qt,Kt,Ke,dt,F,no,jr,Xe}from"./chunk-csymxc5a.js";var O=/(?<![\w$@]
25
25
  `}if(o.site)i+=`<meta name="twitter:site" content="${c(o.site)}">
26
26
  `;if(o.creator)i+=`<meta name="twitter:creator" content="${c(o.creator)}">
27
27
  `}if(e.structuredData!==void 0&&e.structuredData!==null){let s=b(e.structuredData);if(s)i+=`${E(s)}
28
- `;else no(r,`structuredData must be an object or an array of objects, got ${Ke(e.structuredData)}; it was left out`,n)}return i.trim()}function li(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let a=e.includes("<title>")||e.includes("</title>"),o=q(e),s=M(o),l=G(o),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(s)p=s;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(l)m=l;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=a?"":`
28
+ `;else oo(r,`structuredData must be an object or an array of objects, got ${Ge(e.structuredData)}; it was left out`,n)}return i.trim()}function fi(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let a=e.includes("<title>")||e.includes("</title>"),o=q(e),s=M(o),l=G(o),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(s)p=s;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(l)m=l;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=a?"":`
29
29
  <meta name="title" content="${c(p)}">`,D=V(o)?"":`
30
30
  <meta name="description" content="${c(m)}">`,y=`
31
31
  <!-- stx SEO Tags -->${f}${D}
@@ -43,7 +43,7 @@ import{t,u,Wt,qt,Kt,Ke,dt,F,no,jr,Xe}from"./chunk-csymxc5a.js";var O=/(?<![\w$@]
43
43
  ${y}
44
44
  `),h;return h.replace(/<head[^>]*>/,`$&
45
45
  ${y}
46
- `)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function M(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function V(e){return x(e).length>0}function G(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function c(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Ps={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=jr(r,n??{});if(i.kind==="error")return F("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Xe(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Is={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return u("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return u("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let a=i instanceof Error?i.message:String(i);return u("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function cy(){return[Ps,Is]}function ly(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,l=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??i,h=` <url>
46
+ `)}function q(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function v(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function M(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?v(r[1].trim()):""}function x(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function V(e){return x(e).length>0}function G(e){for(let r of x(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return v(g)}return""}function c(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Is={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Br(r,n??{});if(i.kind==="error")return F("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Xe(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Os={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return u("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return u("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return E(i)}catch(i){let a=i instanceof Error?i.message:String(i);return u("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function dy(){return[Is,Os]}function py(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,l=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??i,h=` <url>
47
47
  <loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
48
48
  <xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(s(w.href))}"/>`;if(f)h+=`
49
49
  <lastmod>${f}</lastmod>`;return h+=`
@@ -53,13 +53,13 @@ ${y}
53
53
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
54
54
  ${l.join(`
55
55
  `)}
56
- </urlset>`}function uy(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
56
+ </urlset>`}function fy(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
57
57
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
58
58
  ${e.map((a)=>{let o=a.startsWith("http")?a:`${n}${a.startsWith("/")?"":"/"}${a}`;return` <sitemap>
59
59
  <loc>${T(o)}</loc>
60
60
  <lastmod>${g}</lastmod>
61
61
  </sitemap>`}).join(`
62
62
  `)}
63
- </sitemapindex>`}async function dy(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,l)=>s.loc.localeCompare(l.loc)),i}function Os(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
- `).trim()}function py(e){return Os({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
- export{ii,ai,ci,li,Ps,Is,cy,ly,uy,dy,Os,py};
63
+ </sitemapindex>`}async function gy(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,l)=>s.loc.localeCompare(l.loc)),i}function Ns(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
+ `).trim()}function my(e){return Ns({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
+ export{ui,di,pi,fi,Is,Os,dy,py,fy,gy,Ns,my};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Wl,dm}from"./chunk-xmws1gaf.js";export{Wl as captureScreenshot,dm as captureScreenshots};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as $m}from"ts-broadcasting";import{Broadcast as Rm,BroadcastServer as Am}from"ts-broadcasting";var e=null,u=[];function vm(){return e}async function xm(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function Sm(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function km(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();Ql(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function Ql(n,t,r){if(!i())return;s.send(n,t,r)}function _m(n,t,r){if(!i())return;s.toUser(n,t,r)}function Cm(n,t,r){if(!i())return;s.toUsers(n,t,r)}function Em(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function Tm(n,t,r){if(!i())return;s.presence(n,t,r)}
3
- export{vm,xm,Sm,km,Ql,_m,Cm,Em,Tm,$m,Rm,Am};
2
+ import{Broadcast as s,BroadcastServer as h}from"ts-broadcasting";import{channel as Pm}from"ts-broadcasting";import{Broadcast as Im,BroadcastServer as Om}from"ts-broadcasting";var e=null,u=[];function km(){return e}async function _m(n){if(e)return e;let t=n.driver??"bun",r=n.host??"0.0.0.0",c=n.port??6001,l=n.scheme??"ws",a={verbose:n.verbose??!1,driver:t,default:t,connections:{[t]:{driver:t,host:r,port:c,scheme:l}}};return e=new h(a),s.setServer(e),await e.start(),e}async function Cm(){for(let n of u)clearInterval(n);if(u.length=0,!e)return;await e.stop(),e=null}async function Em(n){let t=await import(n),r=t.default??t;if(typeof r!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof r}`);let c=0;return r({channel(a,o){if(c++,o.authorize&&e)e.channels.channel(a,o.authorize);if(o.interval&&o.data){let d=o.event??`${a}.updated`,p=o.data,v=setInterval(async()=>{try{let g=await p();nu(a,d,g)}catch{}},o.interval);u.push(v)}}}),c}var f=!1;function i(){if(e)return!0;if(!f)f=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function nu(n,t,r){if(!i())return;s.send(n,t,r)}function Tm(n,t,r){if(!i())return;s.toUser(n,t,r)}function $m(n,t,r){if(!i())return;s.toUsers(n,t,r)}function Rm(n,t,r){if(!i())return;s.send(`private-${n}`,t,r)}function Am(n,t,r){if(!i())return;s.presence(n,t,r)}
3
+ export{km,_m,Cm,Em,nu,Tm,$m,Rm,Am,Pm,Im,Om};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$e,Ai,Pi,Cg,zt,ul,Eg,dl,hy,He,_n,Ve}from"./chunk-j1ytbd6r.js";import{bl,n}from"./chunk-jqtpzzz4.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{$e as BROWSER_CORE_IMPORTS,Cg as STX_AUTO_IMPORTS,Ai as extractAndStripCssImports,He as extractBridgeData,bl as findInterpolationEnd,dl as generateAutoImportDestructuring,hy as generateBrowserAutoImportDestructuring,_n as generateServerDataBridge,zt as injectBrowserCoreAutoImports,Ve as processClientScript,Eg as referencesName,Pi as renderVendorStyleTags,n as stripCommentsAndLiterals,ul as transformAutoImports};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{fm}from"./chunk-fy6ts0n4.js";import"./chunk-6az66mrc.js";import"./chunk-a5yb8w7s.js";import"./chunk-r09kz9bf.js";import"./chunk-zc8a2erc.js";import"./chunk-0sa9gqmc.js";import"./chunk-wp0qpa50.js";import"./chunk-j1ytbd6r.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{fm as buildApp};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ function A(){let{NODE_ENV:n}=process.env;return n==="production"}function Z(){let{STX_DEBUG:n}=process.env;return!A()||n==="true"}function In(){let{NODE_ENV:n}=process.env;return n==="test"}function Ui(n,t){return t??(n==="compile"||A())}function On(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
3
+ export{A,Z,In,Ui,On};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{eh,Oa,Tu,th,nh,rh,sh,oh,$u,Ru,ih,ah,ch,lh}from"./chunk-fnjm3xbf.js";import"./chunk-0h6r7nvn.js";import"./chunk-644ckv6e.js";import"./chunk-6ezt9kbe.js";import"./chunk-r2bxjna3.js";import"./chunk-88xayf21.js";import"./chunk-7j11vgm1.js";import"./chunk-2qb9kp21.js";import"./chunk-dbvsa5ya.js";import"./chunk-4m11kcxz.js";import"./chunk-95hbmv7k.js";import"./chunk-xtaq95em.js";import"./chunk-dw0ttj6p.js";import"./chunk-6az66mrc.js";import"./chunk-a5yb8w7s.js";import"./chunk-r09kz9bf.js";import"./chunk-zc8a2erc.js";import"./chunk-0sa9gqmc.js";import"./chunk-wp0qpa50.js";import"./chunk-j1ytbd6r.js";import"./chunk-6ykfy7eh.js";import"./chunk-kzc2tqzr.js";import"./chunk-pp99rmjm.js";import"./chunk-3w7gacva.js";import"./chunk-fdjx4vs3.js";export{Tu as SUSPENSE_RESOLVER_RUNTIME,Oa as buildSuspenseResolveScript,oh as createStreamRenderer,rh as extractStreamBoundaries,lh as generateHydrationRuntime,Ru as islandDirective,ah as processSectionDirectives,nh as processStreamDirectives,ih as registerStreamingDirectives,th as renderStreamingPage,eh as streamTemplate,sh as streamTemplateSimple,ch as streamToResponse,$u as streamingSuspenseDirective};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{E,Oi,eo,d,m,O,ut,p,to,t,u,k}from"./chunk-csymxc5a.js";import{Ce,jt,ne,j,Cn,se,R}from"./chunk-eprhhrzc.js";import{fr}from"./chunk-2drcj9wn.js";import{de}from"./chunk-vvxcebpn.js";import{Cs}from"./chunk-a8164hnf.js";var he=1000,me=!1;function xe(n,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(n))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=k(n,"(",")",b);if(x===-1)continue;let f=n.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=O(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=n.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?n:e+n.slice(o)}function be(n,r){let i=/@component\s*\(/g,e=n,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),w=g.match(/^\s*,\s*/);if(!w)continue;let S=g.slice(w[0].length).trim();if(!S)continue;try{let F=O(S,r),B=JSON.stringify(F),v=`@component('${y}', ${B})`;s.push({start:l,end:h,replacement:v})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function ie(n,r,i){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(n,r){let i=n;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(j(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);Oi(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!ut(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function ae(n,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(n);s;s=i.exec(n)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?n.indexOf("!!}",i.lastIndex):Ce(n,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(n.slice(l));if(x){let f=l+x[0].length-1,c=k(n,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${n.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=n.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+n.slice(o)}function ue(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Cn(n,(o,s,l)=>(i+=ce(r(n.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ce(r(n.slice(e)))}function fe(n,r,i,e){return se(n,r,i==null?"":String(i),!1,e)}function ce(n){let r=n;return r=ie(r,"@break",(i)=>{let e=i.trim();if(!to(e))return"";return`\`; if (${e}) { break; } result += \``}),r=ie(r,"@continue",(i)=>{let e=i.trim();if(!to(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function Ee(n){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(n))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(n))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(n))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<n.length&&a>0){if(n[y]==="(")a++;else if(n[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let w=n.substring(h+1,g),S=jt(w);if(!S)continue;let{arrayExpr:F,itemVar:B}=S,v=g+1,A=1,T=v,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&T<n.length){K.lastIndex=T,L.lastIndex=T;let P=K.exec(n),_=L.exec(n);if(!_)break;if(P&&P.index<_.index)A++,T=P.index+P[0].length;else{if(A--,A===0){V=_.index;break}T=_.index+11}}if(V===-1)continue;let I=n.substring(v,V),Z=V+11,z=-1,D=0,N=0;while(N<I.length){let P=I.indexOf("@",N);if(P===-1)break;let _=I.substring(P);if(/^@forelse\s*\(/.test(_))D++,N=P+1;else if(_.startsWith("@endforelse"))D--,N=P+11;else if(D===0&&_.startsWith("@empty")){if(I.length<=P+6||!/[a-z]/i.test(I[P+6])){z=P;break}N=P+1}else N=P+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:F,itemVar:B,foreachContent:I.substring(0,z),emptyContent:I.substring(z+6)}}return null}function le(n,r){let i=n;while(!0){let e=Ee(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,t.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var ge="<!--stx:foreach-not-iterable:",_e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function $e(n,r){return`${ge}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function Re(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ws(n){if(!n.includes(ge))return n;return n.replace(_e,(r,i,e)=>(Re(decodeURIComponent(i),decodeURIComponent(e)),""))}function Jf(n,r,i,e,o=!1){let s=te(n,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function Ko(n,r,i,e,o=!1){let s=te(n,r,i,e,o),l=s.next();while(!l.done)await E(),l=s.next();return l.value}function*te(n,r,i,e,o=!1){let s=n,l=new Set(r.__stx_client_signal_names||[]);for(let c of fr(n))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=le(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,w=1,S=g+1,F=-1;while(S<c.length&&w>0){if(c[S]==="(")w++;else if(c[S]===")"){if(w--,w===0){F=S;break}}S++}if(F===-1)continue;let B=c.substring(g+1,F),v=jt(B);if(!v)continue;let A=y,{arrayExpr:T,itemVar:K}=v,L=F+1,V=1,I=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&I<c.length){Z.lastIndex=I,z.lastIndex=I;let D=Z.exec(c),N=z.exec(c);if(!N)break;if(D&&D.index<N.index)V++,I=D.index+D[0].length;else{if(V--,V===0){let P=c.substring(L,N.index),_=N.index+11;return{start:A,end:_,arrayExpr:T,itemVar:K,content:P}}I=N.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:w,arrayExpr:S,itemVar:F,content:B}=y;try{let v=S.trim(),A;if(m(v))A=p(v,Object.keys(h))(...Object.values(h));else A=d(v,h);let T=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),T=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),T=!0;else{let _=$e(v,i)+u("Foreach",`Error in @foreach: ${v} is not iterable`,t.TYPE_ERROR);a=a.substring(0,g)+_+a.substring(w);continue}let K=e?.loops?.useAltLoopVariable??me,L=F.trim(),V=null,I,Z=!1;if(L.includes("=>")){let _=L.split("=>").map((W)=>W.trim());if(_.length===2&&_[0]&&_[1])V=_[0],I=_[1];else I=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let _=L.split(",").map((W)=>W.trim());if(_.length===2&&_[0]&&_[1])I=_[0],V=_[1],Z=!0;else I=L}else I=L;let z="",D=new Set(ne(`${S} as ${F}`)),N=A,P=h[eo]??new WeakMap;for(let _=0;_<N.length;_++){if(_%16===0)yield;let W=N[_],re={index:_,iteration:_+1,first:_===0,last:_===N.length-1,count:N.length},M={...h,loop:re,$loop:re,[eo]:P};if(Array.isArray(h.__stx_client_signal_names))M.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(I.startsWith("[")&&I.endsWith("]")){let H=I.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)M[U]=W[X]});else M[I]=W}else if(I.startsWith("{")&&I.endsWith("}")){let H=I.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),oe=X===-1?Y:U.slice(X+1).trim();if(Y&&oe)M[oe]=W[Y]});else M[I]=W}else M[I]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)M[V]=W[0],M[I]=W[1];else M[V]=_;let C=le(B,M);C=yield*te(C,M,i,e,!0),C=de(C,M,i),C=ae(C,M);let J=C.indexOf(Q),G=C.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)C=C.slice(0,q);if(C=R(C,M,i),C=ye(C,M),C=be(C,M),C=xe(C,M),z+=C,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(w)}catch(v){let A=u("Foreach",`Error in @foreach(${S.trim()} as ${F.trim()}): ${v instanceof Error?v.message:String(v)}`,t.EVALUATION_ERROR);a=a.substring(0,g)+A+a.substring(w)}}return a}s=yield*x(s,r),s=Ae(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=ke(s,r,f),o?s:ws(s)}function Yf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function pe(n){return to(n)}function Ae(n,r,i,e){let o=n,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=k(o,"(",")",x);if(f===-1)break;let c=Yf(o.slice(x+1,f)),h=f+1,a=Cs(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let w=u("For",`Unsafe expression in @for: ${c}`,t.UNSAFE_EXPRESSION);o=o.substring(0,b)+w+o.substring(g),s=!0;continue}try{let w=we(c),S=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(w.length>0&&S){let K=Oe({forExpr:c,content:y,iterVarNames:w,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let F=Object.keys(r),B=Object.values(r),v=ue(y),T=Function(...F,"__stxRenderLoopValue",`
2
+ import{E,ji,ro,d,m,O,ut,p,so,t,u,k}from"./chunk-pp99rmjm.js";import{Te,jt,te,j,En,re,R}from"./chunk-j1ytbd6r.js";import{gr}from"./chunk-4m11kcxz.js";import{de}from"./chunk-dbvsa5ya.js";import{Es}from"./chunk-xtaq95em.js";var he=1000,me=!1;function xe(n,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(n))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=k(n,"(",")",b);if(x===-1)continue;let f=n.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=O(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=n.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?n:e+n.slice(o)}function be(n,r){let i=/@component\s*\(/g,e=n,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),w=g.match(/^\s*,\s*/);if(!w)continue;let S=g.slice(w[0].length).trim();if(!S)continue;try{let F=O(S,r),B=JSON.stringify(F),v=`@component('${y}', ${B})`;s.push({start:l,end:h,replacement:v})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function ie(n,r,i){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(n,r){let i=n;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(j(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);ji(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!ut(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function ae(n,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(n);s;s=i.exec(n)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?n.indexOf("!!}",i.lastIndex):Te(n,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(n.slice(l));if(x){let f=l+x[0].length-1,c=k(n,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${n.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=n.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+n.slice(o)}function ue(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return En(n,(o,s,l)=>(i+=ce(r(n.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ce(r(n.slice(e)))}function fe(n,r,i,e){return re(n,r,i==null?"":String(i),!1,e)}function ce(n){let r=n;return r=ie(r,"@break",(i)=>{let e=i.trim();if(!so(e))return"";return`\`; if (${e}) { break; } result += \``}),r=ie(r,"@continue",(i)=>{let e=i.trim();if(!so(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function Ee(n){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(n))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(n))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(n))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<n.length&&a>0){if(n[y]==="(")a++;else if(n[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let w=n.substring(h+1,g),S=jt(w);if(!S)continue;let{arrayExpr:F,itemVar:B}=S,v=g+1,A=1,T=v,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&T<n.length){K.lastIndex=T,L.lastIndex=T;let P=K.exec(n),_=L.exec(n);if(!_)break;if(P&&P.index<_.index)A++,T=P.index+P[0].length;else{if(A--,A===0){V=_.index;break}T=_.index+11}}if(V===-1)continue;let I=n.substring(v,V),Z=V+11,z=-1,D=0,N=0;while(N<I.length){let P=I.indexOf("@",N);if(P===-1)break;let _=I.substring(P);if(/^@forelse\s*\(/.test(_))D++,N=P+1;else if(_.startsWith("@endforelse"))D--,N=P+11;else if(D===0&&_.startsWith("@empty")){if(I.length<=P+6||!/[a-z]/i.test(I[P+6])){z=P;break}N=P+1}else N=P+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:F,itemVar:B,foreachContent:I.substring(0,z),emptyContent:I.substring(z+6)}}return null}function le(n,r){let i=n;while(!0){let e=Ee(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,t.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var ge="<!--stx:foreach-not-iterable:",_e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function $e(n,r){return`${ge}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function Re(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function vs(n){if(!n.includes(ge))return n;return n.replace(_e,(r,i,e)=>(Re(decodeURIComponent(i),decodeURIComponent(e)),""))}function Qf(n,r,i,e,o=!1){let s=ne(n,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function Yo(n,r,i,e,o=!1){let s=ne(n,r,i,e,o),l=s.next();while(!l.done)await E(),l=s.next();return l.value}function*ne(n,r,i,e,o=!1){let s=n,l=new Set(r.__stx_client_signal_names||[]);for(let c of gr(n))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=le(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,w=1,S=g+1,F=-1;while(S<c.length&&w>0){if(c[S]==="(")w++;else if(c[S]===")"){if(w--,w===0){F=S;break}}S++}if(F===-1)continue;let B=c.substring(g+1,F),v=jt(B);if(!v)continue;let A=y,{arrayExpr:T,itemVar:K}=v,L=F+1,V=1,I=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&I<c.length){Z.lastIndex=I,z.lastIndex=I;let D=Z.exec(c),N=z.exec(c);if(!N)break;if(D&&D.index<N.index)V++,I=D.index+D[0].length;else{if(V--,V===0){let P=c.substring(L,N.index),_=N.index+11;return{start:A,end:_,arrayExpr:T,itemVar:K,content:P}}I=N.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:w,arrayExpr:S,itemVar:F,content:B}=y;try{let v=S.trim(),A;if(m(v))A=p(v,Object.keys(h))(...Object.values(h));else A=d(v,h);let T=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),T=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),T=!0;else{let _=$e(v,i)+u("Foreach",`Error in @foreach: ${v} is not iterable`,t.TYPE_ERROR);a=a.substring(0,g)+_+a.substring(w);continue}let K=e?.loops?.useAltLoopVariable??me,L=F.trim(),V=null,I,Z=!1;if(L.includes("=>")){let _=L.split("=>").map((W)=>W.trim());if(_.length===2&&_[0]&&_[1])V=_[0],I=_[1];else I=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let _=L.split(",").map((W)=>W.trim());if(_.length===2&&_[0]&&_[1])I=_[0],V=_[1],Z=!0;else I=L}else I=L;let z="",D=new Set(te(`${S} as ${F}`)),N=A,P=h[ro]??new WeakMap;for(let _=0;_<N.length;_++){if(_%16===0)yield;let W=N[_],se={index:_,iteration:_+1,first:_===0,last:_===N.length-1,count:N.length},M={...h,loop:se,$loop:se,[ro]:P};if(Array.isArray(h.__stx_client_signal_names))M.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(I.startsWith("[")&&I.endsWith("]")){let H=I.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)M[U]=W[X]});else M[I]=W}else if(I.startsWith("{")&&I.endsWith("}")){let H=I.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),oe=X===-1?Y:U.slice(X+1).trim();if(Y&&oe)M[oe]=W[Y]});else M[I]=W}else M[I]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)M[V]=W[0],M[I]=W[1];else M[V]=_;let C=le(B,M);C=yield*ne(C,M,i,e,!0),C=de(C,M,i),C=ae(C,M);let J=C.indexOf(Q),G=C.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)C=C.slice(0,q);if(C=R(C,M,i),C=ye(C,M),C=be(C,M),C=xe(C,M),z+=C,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(w)}catch(v){let A=u("Foreach",`Error in @foreach(${S.trim()} as ${F.trim()}): ${v instanceof Error?v.message:String(v)}`,t.EVALUATION_ERROR);a=a.substring(0,g)+A+a.substring(w)}}return a}s=yield*x(s,r),s=Ae(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=ke(s,r,f),o?s:vs(s)}function eg(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function pe(n){return so(n)}function Ae(n,r,i,e){let o=n,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=k(o,"(",")",x);if(f===-1)break;let c=eg(o.slice(x+1,f)),h=f+1,a=Es(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let w=u("For",`Unsafe expression in @for: ${c}`,t.UNSAFE_EXPRESSION);o=o.substring(0,b)+w+o.substring(g),s=!0;continue}try{let w=we(c),S=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(w.length>0&&S){let K=Oe({forExpr:c,content:y,iterVarNames:w,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let F=Object.keys(r),B=Object.values(r),v=ue(y),T=Function(...F,"__stxRenderLoopValue",`
3
3
  let result = '';
4
4
  for (${c}) {
5
5
  result += \`${v}\`;
@@ -9,7 +9,7 @@ import{E,Oi,eo,d,m,O,ut,p,to,t,u,k}from"./chunk-csymxc5a.js";import{Ce,jt,ne,j,C
9
9
  for (${r}) {
10
10
  if (!__renderIteration([${e.join(", ")}])) break;
11
11
  }
12
- `)(...x,(a)=>{let y={...o};e.forEach((B,v)=>{y[B]=a[v]});let g=Jf(i,y,f,l,!0);g=de(g,y,f),g=ae(g,y);let w=g.indexOf(Q),S=g.indexOf(ee),F=w<0?S:S<0?w:Math.min(w,S);if(F>=0)g=g.slice(0,F);return c+=R(g,y,f),F<0||F!==w}),c}function ke(n,r,i){let e=n,o=!0;while(o){o=!1;let s=e.match(/@while\s*\(/);if(!s||s.index===void 0)break;let l=s.index,b=l+s[0].length-1,x=k(e,"(",")",b);if(x===-1)break;let f=e.slice(b+1,x),c=Cs(e.slice(l),"while","endwhile");if(c.length===0)break;let h=c[0].content,a=l+c[0].end;if(!pe(f)){let y=u("While",`Unsafe expression in @while: ${f}`,t.UNSAFE_EXPRESSION);e=e.substring(0,l)+y+e.substring(a),o=!0;continue}try{let y=Object.keys(r),g=Object.values(r),w=ue(h),F=Function(...y,"__stxRenderLoopValue",`
12
+ `)(...x,(a)=>{let y={...o};e.forEach((B,v)=>{y[B]=a[v]});let g=Qf(i,y,f,l,!0);g=de(g,y,f),g=ae(g,y);let w=g.indexOf(Q),S=g.indexOf(ee),F=w<0?S:S<0?w:Math.min(w,S);if(F>=0)g=g.slice(0,F);return c+=R(g,y,f),F<0||F!==w}),c}function ke(n,r,i){let e=n,o=!0;while(o){o=!1;let s=e.match(/@while\s*\(/);if(!s||s.index===void 0)break;let l=s.index,b=l+s[0].length-1,x=k(e,"(",")",b);if(x===-1)break;let f=e.slice(b+1,x),c=Es(e.slice(l),"while","endwhile");if(c.length===0)break;let h=c[0].content,a=l+c[0].end;if(!pe(f)){let y=u("While",`Unsafe expression in @while: ${f}`,t.UNSAFE_EXPRESSION);e=e.substring(0,l)+y+e.substring(a),o=!0;continue}try{let y=Object.keys(r),g=Object.values(r),w=ue(h),F=Function(...y,"__stxRenderLoopValue",`
13
13
  let result = '';
14
14
  let maxIterations = ${i}; // Configurable safety limit
15
15
  let counter = 0;
@@ -22,4 +22,4 @@ import{E,Oi,eo,d,m,O,ut,p,to,t,u,k}from"./chunk-csymxc5a.js";import{Ce,jt,ne,j,C
22
22
  }
23
23
  return result;
24
24
  `)(...g,(B,v,A)=>fe(h,B,v,A));e=e.substring(0,l)+F+e.substring(a),o=!0}catch(y){let g=u("While",`Error in @while(${f}): ${y instanceof Error?y.message:String(y)}`,t.EVALUATION_ERROR);e=e.substring(0,l)+g+e.substring(a),o=!0}}return e}
25
- export{ws,Jf,Ko,Yf};
25
+ export{vs,Qf,Yo,eg};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function Dm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
2
+ var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function jm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
3
3
  <div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
4
4
  <div class="stx-async-loading" data-async-loading="${e}">
5
5
  ${c}
@@ -226,7 +226,7 @@ catch (error) {
226
226
  loadComponent();
227
227
  })();
228
228
  </script>
229
- `}function Mm(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Lm(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function jm(){return`
229
+ `}function Bm(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Fm(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function zm(){return`
230
230
  /* STX Async Component Styles */
231
231
  .stx-async-component {
232
232
  position: relative;
@@ -300,7 +300,7 @@ catch (error) {
300
300
  background-size: 200% 100%;
301
301
  }
302
302
  }
303
- `}function Bm(){return`
303
+ `}function Hm(){return`
304
304
  // STX Async Component Runtime
305
305
  (function() {
306
306
  if (typeof window === 'undefined') return;
@@ -355,4 +355,4 @@ catch (error) {
355
355
  console.log('[stx] Async component runtime initialized');
356
356
  })();
357
357
  `}
358
- export{Dm,Mm,Lm,jm,Bm};
358
+ export{jm,Bm,Fm,zm,Hm};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ke,Rn,to,Li,B,Ht}from"./chunk-kzc2tqzr.js";export{Rn as currentRuntimeConfig,Ht as injectRuntimeConfig,B as resolveRuntimeConfig,Li as useRuntimeConfig,to as useServerRuntimeConfig,Ke as withRuntimeConfig};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{qe,B,Ht}from"./chunk-60yppcbb.js";import{P}from"./chunk-csymxc5a.js";import{wt,Ae,H,Ye,Pe,ka,ko,_a,Bn}from"./chunk-rb71xcfw.js";import{$t,ye,ot}from"./chunk-hhbt8grm.js";import{Bo}from"./chunk-eq3mqbcn.js";import{Fn}from"./chunk-3z1mmar2.js";import{ke}from"./chunk-wa4w5bcn.js";import Z from"fs";import T from"path";var{serve:ae}=globalThis.Bun;import V from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){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 se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,F=new Map,z=0;function oe(t,e){if(e.length>J/8)return;F.set(t,e),z+=e.length;for(let[a,r]of F){if(z<=J)break;F.delete(a),z-=r.length}}async function Dn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=F.get(g);if(!l)l=r==="br"?await Y(V.brotliCompress)(i,{params:{[V.constants.BROTLI_PARAM_QUALITY]:h,[V.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(V.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(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 Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new P(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,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",H(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ae(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 a();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",H(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 i();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):i()}}var ie={".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 dm(t={}){let e=T.resolve(t.outputDir||".output"),a=t.port??3000,r=ka(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 i=Fn(r.routeRules),f=new G,h=Bo(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?B(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),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Ht(c.html,m);v.set(n.pattern,c),x.set(n.pattern,ot(c.html)),M.set(n.pattern,ke(c.html));let X=T.join(e,n.fragmentPath);if(Ye(c.html,r.routerContainer||"main")&&await Bun.file(X).exists()){let A=await Bun.file(X).text();N.set(n.pattern,m?Ht(A,m):A)}}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:c}=ye(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Dn(n,await qe(m??B(),async()=>{let c=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?.[c])return t.apiRoutes[c](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}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=ie[R]||"application/octet-stream",_=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ae(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,L)=>{q[R]=o[L+1]});break}}if(!C){let p=$t(c)?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=i(c),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=N.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{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}:{},...H(),...k.cache?{}:{"Cache-Control":wt}}})}}let d=ko(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.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",...H(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Bn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return _a(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-9kghtf20.js"),j=new Headers({...H(),...D,"Cache-Control":"private, no-store"});for(let O of _??[])j.append("Set-Cookie",O);if(A&&!d&&Ye(o,r.routerContainer||"main")){let O=ot(o);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",ke(o)?"true":"false"),j.set("X-STX-Layout",O.layout),j.set("X-STX-Layout-Group",O.group)}return U(S(A&&!d&&Ye(o,r.routerContainer||"main")?Pe(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...H(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",H(w.get("Vary")).Vary),A&&!d&&Ye(o,r.routerContainer||"main")){let S=ot(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",ke(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Pe(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),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{Dn,dm};
2
+ import{Ke,B,Ht}from"./chunk-kzc2tqzr.js";import{P}from"./chunk-pp99rmjm.js";import{wt,Ie,H,Ze,Oe,Ea,To,Ta,Fn}from"./chunk-0qwbhv3f.js";import{$t,be,it}from"./chunk-wp0qpa50.js";import{Vo}from"./chunk-cmh0bfkb.js";import{zn}from"./chunk-jt5tzddc.js";import{Ce}from"./chunk-95hbmv7k.js";import Z from"fs";import T from"path";var{serve:ae}=globalThis.Bun;import V from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){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 se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,F=new Map,z=0;function oe(t,e){if(e.length>J/8)return;F.set(t,e),z+=e.length;for(let[a,r]of F){if(z<=J)break;F.delete(a),z-=r.length}}async function Mn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=F.get(g);if(!l)l=r==="br"?await Y(V.brotliCompress)(i,{params:{[V.constants.BROTLI_PARAM_QUALITY]:h,[V.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(V.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(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 Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new P(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,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",H(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Ie(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 a();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",H(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 i();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):i()}}var ie={".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 gm(t={}){let e=T.resolve(t.outputDir||".output"),a=t.port??3000,r=Ea(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=zn(r.routeRules),f=new G,h=Vo(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?B(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),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Ht(c.html,m);v.set(n.pattern,c),x.set(n.pattern,it(c.html)),M.set(n.pattern,Ce(c.html));let X=T.join(e,n.fragmentPath);if(Ze(c.html,r.routerContainer||"main")&&await Bun.file(X).exists()){let A=await Bun.file(X).text();N.set(n.pattern,m?Ht(A,m):A)}}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:c}=be(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return Mn(n,await Ke(m??B(),async()=>{let c=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?.[c])return t.apiRoutes[c](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}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=ie[R]||"application/octet-stream",_=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Ie(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,L)=>{q[R]=o[L+1]});break}}if(!C){let p=$t(c)?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=i(c),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=N.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{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}:{},...H(),...k.cache?{}:{"Cache-Control":wt}}})}}let d=To(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.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",...H(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Fn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Ta(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-24e4dapm.js"),j=new Headers({...H(),...D,"Cache-Control":"private, no-store"});for(let O of _??[])j.append("Set-Cookie",O);if(A&&!d&&Ze(o,r.routerContainer||"main")){let O=it(o);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",Ce(o)?"true":"false"),j.set("X-STX-Layout",O.layout),j.set("X-STX-Layout-Group",O.group)}return U(S(A&&!d&&Ze(o,r.routerContainer||"main")?Oe(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...H(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",H(w.get("Vary")).Vary),A&&!d&&Ze(o,r.routerContainer||"main")){let S=it(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",Ce(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(Oe(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),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{Mn,gm};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function lc(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function uc(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
2
+ import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function pc(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function fc(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
3
3
  `);return t.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...e.map((n)=>` '${n}': true`)," }","}","","export {}",""),t.join(`
4
- `)}function dc(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
5
- export{lc,uc,dc};
4
+ `)}function gc(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
5
+ export{pc,fc,gc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{km,_m,Cm,Em,nu,Tm,$m,Rm,Am,Pm,Im,Om}from"./chunk-1q5w3xav.js";export{Im as Broadcast,Om as BroadcastServer,nu as broadcast,Am as broadcastPresence,Rm as broadcastPrivate,Pm as channel,km as getBroadcastServer,Em as loadChannels,_m as startBroadcasting,Cm as stopBroadcasting,Tm as toUser,$m as toUsers};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
2
  function N(s){let o=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;s=s.replace(o,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3
3
  `);let n=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return s=s.replace(n,(e,t)=>`const { ${t.split(",").map((r)=>r.trim()).filter(Boolean).join(", ")} } = window.__composables
4
- `),s}function On(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
- export{N,On};
4
+ `),s}function Nn(s){return s.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}
5
+ export{N,Nn};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{cu}from"./chunk-kywe0f1v.js";export{cu as rewriteImagesWithSiblings};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{le}from"./chunk-q50x1gfd.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function Ca(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":le(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function eu(e){return async(t)=>await Ca(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-eczy00w6.js")}
3
- export{Ca,eu};
2
+ import{le}from"./chunk-k1ew643q.js";import R from"fs";import g from"path";import C from"crypto";var S=new Set(["webp","avif","jpeg","png"]),T=new Set(["cover","contain","fill","inside","outside"]),q=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),k=4096,D=80,U="cover";async function $a(e,t){let r=t.routePath??"/_stx/img",h=new URL(e.url);if(h.pathname!==r)return null;let a=A(h,t);if(!a.ok)return new Response(a.error,{status:a.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:n,srcUrl:d,width:l,height:i,format:s,quality:u,fit:c}=a,m;try{m=R.statSync(n)}catch{return new Response(`Source image not found: ${d}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!m.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let w=t.cacheDir??".stx/cache/img";await R.promises.mkdir(w,{recursive:!0});let b=`${n}:${m.mtimeMs}:${m.size}`,I=`${l}x${i}:${s}:${u}:${c}`,f=C.createHash("sha256").update(`${b}|${I}`).digest("hex").slice(0,16),o=g.join(w,`${f}.${s}`),p={"Content-Type":le(s),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${f}"`,"X-Stx-Image-Cache":"HIT"};if(e.headers.get("if-none-match")===`"${f}"`)return new Response(null,{status:304,headers:p});let v=Bun.file(o);if(await v.exists())return new Response(v,{headers:p});try{let x=Buffer.from(await Bun.file(n).arrayBuffer()),{resizeAndConvert:P}=await L(),F=await P(x,{width:l,height:i,format:s,quality:u,fit:c});return await Bun.write(o,F),p["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(F),{headers:p})}catch(x){let P=x.message;return new Response(`Image processing failed: ${P}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function ru(e){return async(t)=>await $a(t,e)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}function A(e,t){let r=e.searchParams.get("src");if(!r)return{ok:!1,error:"Missing required param: src",status:400};if(!r.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(r.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let h=g.extname(r).toLowerCase();if(!q.has(h))return{ok:!1,error:`Unsupported source extension: ${h}`,status:400};let a=g.resolve(t.publicDir),n=g.resolve(a,r.slice(1));if(!n.startsWith(`${a}${g.sep}`)&&n!==a)return{ok:!1,error:"src is outside publicDir",status:400};let d=t.maxWidth??k,l=t.maxHeight??k,i=e.searchParams.get("w"),s=e.searchParams.get("h"),u=i?Number.parseInt(i,10):0,c=s?Number.parseInt(s,10):0;if(i&&(!Number.isFinite(u)||u<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(s&&(!Number.isFinite(c)||c<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!i&&!s)return{ok:!1,error:"At least one of w or h is required",status:400};let m=Math.min(u||d,d),w=Math.min(c||l,l),b=e.searchParams.get("f")||"webp";if(!S.has(b))return{ok:!1,error:`Invalid f (must be one of: ${[...S].join(", ")})`,status:400};let I=b,f=e.searchParams.get("q"),o=f?Number.parseInt(f,10):t.defaultQuality??D;if(!Number.isFinite(o)||o<1||o>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let y=e.searchParams.get("fit")||t.defaultFit||U;if(!T.has(y))return{ok:!1,error:`Invalid fit (must be one of: ${[...T].join(", ")})`,status:400};return{ok:!0,srcFsPath:n,srcUrl:r,width:m,height:w,format:I,quality:o,fit:y}}async function L(){return await import("./chunk-qm3v4qb7.js")}
3
+ export{$a,ru};