@stacksjs/stx 0.2.605 → 0.2.606

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 (238) hide show
  1. package/dist/{chunk-38mt83wa.js → chunk-06wv8qwy.js} +6 -6
  2. package/dist/chunk-0d6b3eeb.js +2 -0
  3. package/dist/{chunk-9cgga2aw.js → chunk-0v89nfz1.js} +2 -2
  4. package/dist/chunk-1e28n9q2.js +2 -0
  5. package/dist/chunk-1fdrhfc0.js +2 -0
  6. package/dist/{chunk-htcptqtn.js → chunk-1jxdkp8x.js} +6 -6
  7. package/dist/chunk-1veeefpn.js +2 -0
  8. package/dist/{chunk-6eg9a3mt.js → chunk-20k77e2a.js} +4 -4
  9. package/dist/chunk-2r4an7bh.js +2 -0
  10. package/dist/chunk-304vaxnk.js +2 -0
  11. package/dist/chunk-327bt8zb.js +2 -0
  12. package/dist/chunk-36n8yz6t.js +2 -0
  13. package/dist/{chunk-813wwkap.js → chunk-3cnwstra.js} +2 -2
  14. package/dist/chunk-3gm6013p.js +2 -0
  15. package/dist/chunk-3ttnn4t3.js +2 -0
  16. package/dist/chunk-3yttgk0s.js +2 -0
  17. package/dist/chunk-4ck2xc8m.js +2 -0
  18. package/dist/{chunk-jg8w43n0.js → chunk-4dfqgmgs.js} +39 -39
  19. package/dist/chunk-4jasfhh6.js +2 -0
  20. package/dist/{chunk-axz1x4r9.js → chunk-4tj0ap61.js} +5 -5
  21. package/dist/{chunk-9nt3q23a.js → chunk-53y4z4p2.js} +3 -3
  22. package/dist/{chunk-j1dmkt29.js → chunk-5e182xqt.js} +1 -1
  23. package/dist/{chunk-67m2prah.js → chunk-5s47qfp6.js} +2 -2
  24. package/dist/{chunk-gbe53zv3.js → chunk-5taenpfg.js} +1 -1
  25. package/dist/chunk-605c6zks.js +2 -0
  26. package/dist/chunk-61d0gr5b.js +2 -0
  27. package/dist/{chunk-1944jgb2.js → chunk-67tpacz0.js} +1 -1
  28. package/dist/{chunk-9h1ytsgm.js → chunk-6by8dtan.js} +2 -2
  29. package/dist/{chunk-k71e38fk.js → chunk-6xsm53pz.js} +4 -4
  30. package/dist/{chunk-tc3ne706.js → chunk-7095f0hb.js} +9 -9
  31. package/dist/chunk-7renf4zp.js +2 -0
  32. package/dist/{chunk-9wtb959p.js → chunk-81qmj3sd.js} +7 -7
  33. package/dist/chunk-8t3c2myr.js +2 -0
  34. package/dist/chunk-8x2ejkcc.js +2 -0
  35. package/dist/chunk-915s0may.js +2 -0
  36. package/dist/chunk-93na8hh0.js +2 -0
  37. package/dist/{chunk-kty4k2jq.js → chunk-9734nkc8.js} +3 -3
  38. package/dist/chunk-9fpnnfr3.js +2 -0
  39. package/dist/{chunk-fkh9zshs.js → chunk-9zwdpa7p.js} +5 -5
  40. package/dist/chunk-ajd5w5c4.js +2 -0
  41. package/dist/{chunk-tt1p6zt8.js → chunk-azpkje69.js} +4 -4
  42. package/dist/chunk-b4tbqz8r.js +2 -0
  43. package/dist/chunk-be2kmw0p.js +2 -0
  44. package/dist/{chunk-48s1nprc.js → chunk-bhf9yt2w.js} +2 -2
  45. package/dist/chunk-bkjre6xk.js +127 -0
  46. package/dist/chunk-bnpb6ez9.js +2 -0
  47. package/dist/{chunk-jtq8e3b0.js → chunk-bsy8v1xj.js} +2 -2
  48. package/dist/chunk-c0h9cxew.js +2 -0
  49. package/dist/{chunk-zrw1zf54.js → chunk-cfpenvc7.js} +3 -3
  50. package/dist/chunk-cw76y2p5.js +2 -0
  51. package/dist/chunk-d0kes50w.js +2 -0
  52. package/dist/{chunk-4st1qw62.js → chunk-dmdhbwmn.js} +3 -3
  53. package/dist/{chunk-t19th11m.js → chunk-dnqq1ze0.js} +3 -3
  54. package/dist/chunk-dzbkgsv8.js +4 -0
  55. package/dist/chunk-dzekcand.js +2 -0
  56. package/dist/{chunk-bfbmdjh4.js → chunk-efy3038a.js} +2 -2
  57. package/dist/chunk-en388k3h.js +2 -0
  58. package/dist/chunk-ewkza45r.js +2 -0
  59. package/dist/chunk-fcgf8d5k.js +2 -0
  60. package/dist/chunk-fese2cf6.js +2 -0
  61. package/dist/{chunk-f49nnf8v.js → chunk-fwp1en28.js} +6 -6
  62. package/dist/{chunk-9x4r15mv.js → chunk-ghdyqt98.js} +2 -2
  63. package/dist/chunk-gk7mmc2e.js +2 -0
  64. package/dist/chunk-gw2dvp35.js +2 -0
  65. package/dist/chunk-h9drxwva.js +2 -0
  66. package/dist/chunk-hrr7k1qc.js +2 -0
  67. package/dist/{chunk-navkh35g.js → chunk-htf3z9et.js} +3 -3
  68. package/dist/chunk-j04brkj0.js +2 -0
  69. package/dist/chunk-jbvwg4gs.js +2 -0
  70. package/dist/{chunk-wkxzzdzs.js → chunk-jpxekhdh.js} +3 -3
  71. package/dist/chunk-jshj69dy.js +2 -0
  72. package/dist/{chunk-y09g63k0.js → chunk-jsktg3ab.js} +5 -5
  73. package/dist/{chunk-zvs13kgh.js → chunk-k3f4044e.js} +2 -2
  74. package/dist/chunk-k7spjpr0.js +2 -0
  75. package/dist/chunk-kgvm5ytn.js +2 -0
  76. package/dist/chunk-km9a5gp4.js +2 -0
  77. package/dist/{chunk-4h58as2c.js → chunk-kxjd6e2h.js} +2 -2
  78. package/dist/{chunk-nb0ytx70.js → chunk-m95zjk91.js} +2 -2
  79. package/dist/{chunk-h7atbtds.js → chunk-m9h7pmkh.js} +5 -5
  80. package/dist/chunk-mfery7a4.js +2 -0
  81. package/dist/chunk-mn7a5b55.js +3 -0
  82. package/dist/{chunk-h8a8y1wh.js → chunk-mtxs4fya.js} +2 -2
  83. package/dist/{chunk-8s7zbhdd.js → chunk-mvwcf4xy.js} +4 -4
  84. package/dist/chunk-myqhdz1w.js +2 -0
  85. package/dist/chunk-n35yc890.js +3 -0
  86. package/dist/chunk-n882b1fy.js +2 -0
  87. package/dist/chunk-p8sv5fqs.js +2 -0
  88. package/dist/chunk-pndhb1nk.js +2 -0
  89. package/dist/chunk-pt7e0be5.js +2 -0
  90. package/dist/chunk-q40ahbjs.js +2 -0
  91. package/dist/{chunk-gzpxvca7.js → chunk-qh07a85k.js} +3 -3
  92. package/dist/chunk-qjxxhdv7.js +2 -0
  93. package/dist/chunk-qygr4pv8.js +2 -0
  94. package/dist/{chunk-18ws9heh.js → chunk-r4h8fg1x.js} +1 -1
  95. package/dist/chunk-r4wqh5fd.js +2845 -0
  96. package/dist/{chunk-tnafnb23.js → chunk-r69jfs59.js} +1 -1
  97. package/dist/{chunk-afnj003j.js → chunk-rg7wvcqw.js} +2 -2
  98. package/dist/{chunk-82bttwqm.js → chunk-rmv35cx0.js} +2 -2
  99. package/dist/chunk-rp93n4z7.js +3 -0
  100. package/dist/chunk-rrw2jg26.js +2 -0
  101. package/dist/{chunk-v3dnfv5g.js → chunk-s45envb5.js} +5 -5
  102. package/dist/{chunk-tds3d65g.js → chunk-s4pjf2pc.js} +2 -2
  103. package/dist/{chunk-b3c1gggs.js → chunk-sswjv8p9.js} +2 -2
  104. package/dist/{chunk-bsy10tz6.js → chunk-t9t66sz4.js} +6 -6
  105. package/dist/{chunk-pb7vste8.js → chunk-tbsjg23k.js} +4 -4
  106. package/dist/{chunk-q6h6yjg4.js → chunk-tcd2zez3.js} +2 -2
  107. package/dist/{chunk-f17rcvdb.js → chunk-td30jg06.js} +2 -2
  108. package/dist/{chunk-qf39z0hg.js → chunk-td5100fz.js} +7 -7
  109. package/dist/{chunk-rc7wmbnz.js → chunk-tyb481p0.js} +1 -1
  110. package/dist/{chunk-a8n6mt7s.js → chunk-tydv84gj.js} +2 -2
  111. package/dist/{chunk-hsy9rhct.js → chunk-vehtypx0.js} +2 -2
  112. package/dist/{chunk-x7epxhsz.js → chunk-vhajhs44.js} +5 -5
  113. package/dist/{chunk-279b1228.js → chunk-vm2d4hap.js} +3 -3
  114. package/dist/{chunk-y3wdf7v7.js → chunk-vntpfbwy.js} +1 -1
  115. package/dist/{chunk-25zpd110.js → chunk-vp3fzjsc.js} +2 -2
  116. package/dist/{chunk-btbdp4fg.js → chunk-vvfpb3k3.js} +5 -5
  117. package/dist/{chunk-q1cvef6b.js → chunk-vw62fjpv.js} +3 -3
  118. package/dist/{chunk-hrv206vt.js → chunk-w67rrd1f.js} +10 -10
  119. package/dist/{chunk-shnsvsg4.js → chunk-w8g2ppnr.js} +2 -2
  120. package/dist/chunk-wjhhb6dn.js +2 -0
  121. package/dist/chunk-wm8w2721.js +2 -0
  122. package/dist/{chunk-g6ew2drc.js → chunk-wy53pys4.js} +5 -5
  123. package/dist/{chunk-v8ze2q95.js → chunk-wzjf33es.js} +2 -2
  124. package/dist/{chunk-gh181dnr.js → chunk-x8q5przn.js} +10 -10
  125. package/dist/{chunk-vn6h03nq.js → chunk-xjxc4q3w.js} +27 -27
  126. package/dist/chunk-y2wr7c9e.js +2 -0
  127. package/dist/{chunk-kx52xt96.js → chunk-y54fz9rk.js} +2 -2
  128. package/dist/{chunk-sqq6kpve.js → chunk-y6gj9jq8.js} +6 -6
  129. package/dist/chunk-y8jjmwa9.js +2 -0
  130. package/dist/{chunk-dnnc0m92.js → chunk-y9a9cvke.js} +13 -13
  131. package/dist/{chunk-y0qjpcc8.js → chunk-yzj55rfs.js} +3 -3
  132. package/dist/{chunk-hz11wmx9.js → chunk-z8fhtym2.js} +2 -2
  133. package/dist/chunk-z8mdsjzw.js +2 -0
  134. package/dist/chunk-zg87pybq.js +2 -0
  135. package/dist/chunk-zs3ezqy3.js +2 -0
  136. package/dist/{chunk-h5cgm4hy.js → chunk-zs3tmd12.js} +2 -2
  137. package/dist/cli.js +20 -20
  138. package/dist/component-renderer.js +62 -9
  139. package/dist/craft-entry.js +2 -2
  140. package/dist/craft.js +2 -2
  141. package/dist/expressions.js +7 -1
  142. package/dist/native/accessibility.d.ts +12 -0
  143. package/dist/native/accessibility.js +19 -0
  144. package/dist/native/compiler/headwind-to-style.js +23 -29
  145. package/dist/native/compiler/html-to-ir.js +17 -7
  146. package/dist/native/compiler/inline-style.d.ts +7 -0
  147. package/dist/native/compiler/inline-style.js +8 -1
  148. package/dist/native/compiler/ir.d.ts +3 -1
  149. package/dist/native/compiler/render-screen.js +1 -1
  150. package/dist/native/components/primitives.d.ts +16 -14
  151. package/dist/native/components/primitives.js +1 -0
  152. package/dist/native/index.d.ts +1 -0
  153. package/dist/native/primitives/Link.stx +5 -0
  154. package/dist/native/prop-names.js +6 -0
  155. package/dist/native/runtime/binding-tree.js +2 -1
  156. package/dist/native/runtime/browser-renderer.js +63 -4
  157. package/dist/native/runtime/craft-bridge.js +8 -2
  158. package/dist/native/runtime/craft.d.ts +4 -0
  159. package/dist/native/runtime/native-host.js +20 -14
  160. package/dist/native/runtime/overlay-presenter.d.ts +2 -0
  161. package/dist/native/runtime/overlay-presenter.js +10 -5
  162. package/dist/native/runtime/view-operations.d.ts +1 -1
  163. package/dist/native/runtime/view-operations.js +5 -1
  164. package/dist/pwa.js +3 -3
  165. package/dist/slot-scopes.d.ts +7 -0
  166. package/dist/slot-scopes.js +19 -0
  167. package/dist/slots.js +23 -7
  168. package/dist/ssg.js +12 -12
  169. package/dist/stx-virtual-ts.js +6 -5
  170. package/dist/utils.d.ts +1 -1
  171. package/dist/utils.js +1 -1
  172. package/package.json +5 -5
  173. package/dist/chunk-04gt67sv.js +0 -2
  174. package/dist/chunk-0hpw65yr.js +0 -2
  175. package/dist/chunk-0jsg0z9j.js +0 -127
  176. package/dist/chunk-122y2fkw.js +0 -3
  177. package/dist/chunk-138zjhwa.js +0 -2
  178. package/dist/chunk-1548a62z.js +0 -2
  179. package/dist/chunk-214w9gst.js +0 -2
  180. package/dist/chunk-2c7ysn9s.js +0 -2
  181. package/dist/chunk-2h99p36p.js +0 -2
  182. package/dist/chunk-2qt63502.js +0 -2
  183. package/dist/chunk-2rzcy4yg.js +0 -2
  184. package/dist/chunk-2wb1w0p6.js +0 -2
  185. package/dist/chunk-3q312svf.js +0 -2
  186. package/dist/chunk-5ajbkx0a.js +0 -2
  187. package/dist/chunk-6djvj6hg.js +0 -2
  188. package/dist/chunk-6kmqb08x.js +0 -2
  189. package/dist/chunk-7dkwf9h5.js +0 -2
  190. package/dist/chunk-8992smwz.js +0 -2
  191. package/dist/chunk-9j6hk72q.js +0 -2
  192. package/dist/chunk-9nct3gsy.js +0 -2
  193. package/dist/chunk-a2pd13yw.js +0 -2
  194. package/dist/chunk-acm2tym9.js +0 -2
  195. package/dist/chunk-atqnvmea.js +0 -2845
  196. package/dist/chunk-ax5t83f4.js +0 -2
  197. package/dist/chunk-bc8rzjnh.js +0 -2
  198. package/dist/chunk-bvczk7xr.js +0 -2
  199. package/dist/chunk-c88e6w5r.js +0 -2
  200. package/dist/chunk-ce2d0hz9.js +0 -2
  201. package/dist/chunk-cg3vfr6b.js +0 -2
  202. package/dist/chunk-d81h4mxd.js +0 -2
  203. package/dist/chunk-dgtxj56t.js +0 -3
  204. package/dist/chunk-ej1erz2c.js +0 -2
  205. package/dist/chunk-eqa0wdv9.js +0 -4
  206. package/dist/chunk-erb1bc49.js +0 -2
  207. package/dist/chunk-esj49jvz.js +0 -2
  208. package/dist/chunk-ffykng6w.js +0 -2
  209. package/dist/chunk-fwt5fh5w.js +0 -2
  210. package/dist/chunk-gqm3w433.js +0 -2
  211. package/dist/chunk-hhwnd24n.js +0 -2
  212. package/dist/chunk-hjh1a3ga.js +0 -2
  213. package/dist/chunk-hq4mtcp0.js +0 -2
  214. package/dist/chunk-jhswy523.js +0 -2
  215. package/dist/chunk-jyqanvwp.js +0 -2
  216. package/dist/chunk-k229zdjh.js +0 -2
  217. package/dist/chunk-khdvzjzd.js +0 -2
  218. package/dist/chunk-knngjd2r.js +0 -2
  219. package/dist/chunk-makn68zy.js +0 -2
  220. package/dist/chunk-mnwf9yde.js +0 -2
  221. package/dist/chunk-n06xznty.js +0 -2
  222. package/dist/chunk-n633zv27.js +0 -3
  223. package/dist/chunk-nzpthbe1.js +0 -2
  224. package/dist/chunk-p973efbe.js +0 -2
  225. package/dist/chunk-pyj4ashw.js +0 -2
  226. package/dist/chunk-qhxf7pxh.js +0 -2
  227. package/dist/chunk-qjmqp5z7.js +0 -2
  228. package/dist/chunk-qq59xzwc.js +0 -2
  229. package/dist/chunk-r0e743c3.js +0 -2
  230. package/dist/chunk-shzesarq.js +0 -2
  231. package/dist/chunk-tcddr6dx.js +0 -2
  232. package/dist/chunk-v4gepwh9.js +0 -2
  233. package/dist/chunk-wn2gzwmv.js +0 -2
  234. package/dist/chunk-wr6gw263.js +0 -2
  235. package/dist/chunk-xfe2nzxd.js +0 -2
  236. package/dist/chunk-xjwgzp6s.js +0 -2
  237. package/dist/chunk-y6909jm7.js +0 -2
  238. package/dist/chunk-zfrpjaxw.js +0 -2
@@ -0,0 +1,2845 @@
1
+ // @bun
2
+ import{Ln,y,Ji,Vt,eo,Yi,Zi,Qi,ea}from"./chunk-sswjv8p9.js";import{O}from"./chunk-bsy8v1xj.js";import{t,Y,Sr,i,oe,Ys,I,zt,Dn,Zs,l,p,Xi,D,Ae,at,c,Cr}from"./chunk-06wv8qwy.js";import{Bn,Fn,Rr,Ie}from"./chunk-azpkje69.js";import{S,Gs,ot,Ks,Vi,Tn,$n,Ui,Re,Wi,Rn,qi,Ft,Xs,Gi,An,In,wr,be,Js,ve,xr}from"./chunk-x8q5przn.js";import{Vs,Us,Ws,qs,hr,yr}from"./chunk-td5100fz.js";import{Fi,Fs,fr,gr}from"./chunk-6xsm53pz.js";import{he,Bt,mr,Hs,C,rt}from"./chunk-bhf9yt2w.js";import{En}from"./chunk-3cnwstra.js";import{oo}from"./chunk-rmv35cx0.js";import{Oi,Di,Mi,Li}from"./chunk-dnqq1ze0.js";import{nt}from"./chunk-vp3fzjsc.js";import{s,Te}from"./chunk-20k77e2a.js";import{jt,Hi,Cn,a,_n}from"./chunk-n35yc890.js";import{d}from"./chunk-yn2d8x8m.js";import{E,N,Nn,Qs}from"./chunk-k3f4044e.js";import{Ar}from"./chunk-5s47qfp6.js";import Yr from"path";import Po from"fs";var zh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ec(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return zh.has(v.toLowerCase())}var Lu=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),Bu={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Wh=new Set(["ctrl","alt","shift","meta"]),Fu={left:0,middle:1,right:2};function zu(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Wh.has(R))_.systemKeys.push(R);else if(R in Fu)_.mouse=R;else if(R in Bu||/^[a-z]$/.test(R))_.keys.push(Bu[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Vu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,W,F]=B,U=B.index,H=U+z.length,q=`__stx_evt_${_}${R++}`,Q=[],ie=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Z;while((Z=ie.exec(F))!==null){let[,le,ce]=Z,de=le.split("."),ue=de[0];if(!Lu.has(ue))continue;Q.push({attribute:`@${le}`,event:ue,handler:ce,modifiers:zu(de.slice(1)),elementId:q})}let ae=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Z=ae.exec(F))!==null){let[,le,ce]=Z,de=le.split("."),ue=de[0];if(!Lu.has(ue))continue;Q.push({attribute:`@${le}`,event:ue,handler:ce,modifiers:zu(de.slice(1)),elementId:q})}if(Q.length>0)k.push({originalTag:z,elementId:q,events:Q,startIndex:U,endIndex:H})}return k}function Fh(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Fu[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Vh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function tc(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Uh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Fh(v),T=Vh(tc(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(ec(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",W=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
3
+ (function() {
4
+ var $el = document.getElementById('${k}');
5
+ if (!$el) return;
6
+ // Run mounted handler immediately (DOM is ready)
7
+ var scope = $el.closest('[data-stx-scope]');
8
+ if (scope && scope.__stx_execute) {
9
+ scope.__stx_execute('${W}', null, $el);
10
+ }
11
+ else {
12
+ __stx_runHandler('${W}', null, $el);
13
+ }
14
+ })();`;if(v.event==="unmounted")return`
15
+ (function() {
16
+ var $el = document.getElementById('${k}');
17
+ if (!$el) return;
18
+ // Set up MutationObserver to detect removal
19
+ var observer = new MutationObserver(function(mutations) {
20
+ for (var m of mutations) {
21
+ for (var node of m.removedNodes) {
22
+ if (node === $el || (node.contains && node.contains($el))) {
23
+ observer.disconnect();
24
+ var scope = $el.closest('[data-stx-scope]');
25
+ if (scope && scope.__stx_execute) {
26
+ scope.__stx_execute('${W}', null, $el);
27
+ }
28
+ else {
29
+ __stx_runHandler('${W}', null, $el);
30
+ }
31
+ return;
32
+ }
33
+ }
34
+ }
35
+ });
36
+ observer.observe(document.body, { childList: true, subtree: true });
37
+ // Store observer for cleanup
38
+ $el.__stx_unmount_observer = observer;
39
+ })();`;return`
40
+ (function() {
41
+ var $el = document.getElementById('${k}');
42
+ if (!$el) return;
43
+ // eslint-disable-next-line pickier/no-unused-vars
44
+ $el.addEventListener('${v.event}', function($event) {
45
+ ${R?R+";":""}
46
+ // Find the closest reactive scope and execute within its context
47
+ var scope = $el.closest('[data-stx-scope]');
48
+ if (scope && scope.__stx_execute) {
49
+ scope.__stx_execute('${W}', $event, $el);
50
+ }
51
+ else {
52
+ // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
+ __stx_runHandler('${W}', $event, $el);
54
+ }
55
+ }${z});
56
+ })();`}function nc(v){if(v.length===0)return"";return`
57
+ <script data-stx-events>
58
+ (function() {
59
+ 'use strict';
60
+
61
+ // Utility functions
62
+ function __stx_debounce(fn, delay) {
63
+ var timeout;
64
+ return function() {
65
+ var args = arguments;
66
+ var ctx = this;
67
+ clearTimeout(timeout);
68
+ timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
69
+ };
70
+ }
71
+
72
+ function __stx_throttle(fn, delay) {
73
+ var last = 0;
74
+ return function() {
75
+ var now = Date.now();
76
+ if (now - last >= delay) {
77
+ last = now;
78
+ fn.apply(this, arguments);
79
+ }
80
+ };
81
+ }
82
+
83
+ // Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
84
+ // so the surrounding script element can never contain raw markup, including
85
+ // its own closing tag; we decode it to JS only in memory here, then run it
86
+ // with $event/$el in scope.
87
+ //
88
+ // This comment must not spell that closing tag out. It used to, as an
89
+ // example, and a browser ends the script element at the FIRST one it sees \u2014
90
+ // so everything below this line, __stx_runHandler included, was emitted as
91
+ // page text and no listener was ever bound. The comment about escaping was
92
+ // the thing that needed escaping.
93
+ function __stx_runHandler(h, $event, $el) {
94
+ var code = h
95
+ .replace(/&lt;/g, '<')
96
+ .replace(/&gt;/g, '>')
97
+ .replace(/&quot;/g, '"')
98
+ .replace(/&#39;/g, "'")
99
+ .replace(/&#x27;/g, "'")
100
+ .replace(/&amp;/g, '&');
101
+ try {
102
+ // eslint-disable-next-line no-new-func
103
+ (new Function('$event', '$el', code)).call($el, $event, $el);
104
+ }
105
+ catch (e) {
106
+ if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
107
+ }
108
+ }
109
+
110
+ // Event listeners
111
+ ${v.map(Uh).join(`
112
+ `)}
113
+ })();
114
+ </script>`}function Hh(v,_=""){let k=Vu(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let B=k.length-1;B>=0;B--){let z=k[B],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let F=W.match(/id=["']([^"']+)["']/);if(F)for(let U of z.events)U.elementId=F[1]}for(let F of z.events){let U=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(q,"")}R=R.slice(0,z.startIndex)+W+R.slice(z.endIndex),T.push(...z.events)}return{template:R,bindings:T}}function Wu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function Uu(v,_,k){if(Yi(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:W,bindings:F}=Hh(v,Wu(_)),U=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...U,...F],W}let R=Vu(v,Wu(_));if(R.length===0)return v;let T=v;for(let W=R.length-1;W>=0;W--){let F=R[W],U=F.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${F.elementId}"`);else{let H=U.match(/id=["']([^"']+)["']/);if(H)for(let q of F.events)q.elementId=H[1]}for(let H of F.events){let q=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Q=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),ie=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");U=U.replace(Q,""),U=U.replace(ie,"")}T=T.slice(0,F.startIndex)+U+T.slice(F.endIndex)}let B=nc(R.flatMap((W)=>W.events)),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
115
+ `+T.slice(z);else T+=B;return T}function Hu(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function Ki(v,_){let k=s(v),{depths:R,balanced:T}=Te(k),B=(W)=>!T||R[W]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let W of k.matchAll(z)){let F=(W.index??0)+W[0].length-W[1].length;if(B(F))return!0}for(let W of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(W.index??0)&&Hu(W[1],!0).has(_))return!0;for(let W of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(W.index??0)&&Hu(W[1],!1).has(_))return!0;return!1}var qu="",Fo,_r=/^[A-Za-z_$][\w$]*$/,qh=new Set(["if","for","while","switch","with"]),Gu=["(","[","{"],xd=[")","]","}"],Kh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Xh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function rc(v){if(Fo&&v===qu)return Fo;let{code:_,tokens:k}=Xh(v),R=new Map,T=[];for(let Z=0;Z<k.length;Z++){let ae=k[Z].text;if(["(","[","{"].includes(ae))T.push(Z);else if([")","]","}"].includes(ae)){let le=T.at(-1);if(le!==void 0&&["()","[]","{}"].includes(k[le].text+ae))T.pop(),R.set(le,Z),R.set(Z,le)}}function B(Z,ae){let le=[],ce=Z;for(let de=Z;de<ae;de++){if(["(","[","{"].includes(k[de].text)&&(R.get(de)??ae)<ae){de=R.get(de);continue}if(k[de].text===",")le.push([ce,de]),ce=de+1}return le.push([ce,ae]),le}let z=[];function W(Z,ae,le,ce=!1){if(k[Z]?.text==="...")Z++;if(Z>=ae)return;let de=k[Z].text;if(_r.test(de)){if(le.add(de),le===H)z.push({name:de,token:Z,functionScoped:ce});return}if(de!=="{"&&de!=="[")return;let ue=R.get(Z);if(ue===void 0||ue>=ae)return;for(let[$e,we]of B(Z+1,ue)){let ye=$e;if(de==="{")for(let Pe=$e;Pe<we;Pe++){if(k[Pe].text===":"){ye=Pe+1;break}if(k[Pe].text==="=")break;if(["(","[","{"].includes(k[Pe].text)&&R.has(Pe))Pe=R.get(Pe)}W(ye,we,le,ce)}}function F(Z,ae){let le=new Set;for(let[ce,de]of B(Z,ae))W(ce,de,le);return le}function U(Z){let ae=Z;for(;ae<k.length;ae++){let le=k[ae].text;if(["(","[","{"].includes(le)&&R.has(ae)){ae=R.get(ae);continue}if([",",";",")","]","}"].includes(le))break}return k[Math.max(Z,ae-1)]?.end??_.length}let H=new Set,q=[];for(let Z=0;Z<k.length;Z++)if(k[Z].text==="=>"){let ae=Z-1,le=ae,ce;if(k[ae]?.text===")"&&R.has(ae))le=R.get(ae),ce=F(le+1,ae);else if(k[ae]&&_r.test(k[ae].text))ce=new Set([k[ae].text]);else continue;let de=Z+1,ue=k[de]?.text==="{"&&R.has(de)?k[R.get(de)].end:U(de);q.push({start:k[le].start,end:ue,bodyStart:k[de]?.start??ue,functionBody:!0,names:ce})}else if(k[Z].text==="("&&R.has(Z)){let ae=k[Z-1]?.text;if(!ae||qh.has(ae)||!_r.test(ae)&&ae!=="*"&&ae!=="]")continue;let le=R.get(Z),ce=le+1;if(k[ce]?.text===":"){ce++;while(ce<k.length&&!["{","=>",";","="].includes(k[ce].text))ce++}if(k[ce]?.text!=="{"||!R.has(ce))continue;q.push({start:k[Z].start,end:k[R.get(ce)].end,bodyStart:k[ce].start,functionBody:ae!=="catch",names:F(Z+1,le)})}function Q(Z){let ae=Z;for(;ae<k.length;ae++){let le=k[ae].text;if(Gu.includes(le)&&R.has(ae)){ae=R.get(ae);continue}if(le===";"||xd.includes(le))break;let ce=k[ae-1];if(ae>Z&&Kh.has(le)&&ce.text!==".")break;if(ae>Z&&/[\n\r]/.test(_.slice(ce.end,k[ae].start))&&(/^[\w$]+$/.test(ce.text)||xd.includes(ce.text)||['"',"'","`"].includes(ce.text))&&_r.test(le)&&!["in","of","instanceof"].includes(le))break}return ae}let ie=[];for(let Z=0;Z<k.length;Z++){if(k[Z].text!=="for")continue;let ae=k[Z+1]?.text==="await"?Z+2:Z+1;if(k[ae]?.text!=="("||!R.has(ae))continue;let le=R.get(ae),ce=le+1,de=k[ce]?.text==="{"&&R.has(ce)?R.get(ce):Q(ce),ue=k[de]?.text===";"||k[de]?.text==="}"?k[de].end:k[Math.max(ce,de-1)]?.end??_.length;ie.push({headStart:ae,headEnd:le,start:k[ae].start,end:ue})}for(let Z=0;Z<k.length;Z++){let ae=k[Z].text,le=k[Z-1]?.text;if(le==="."||k[Z+1]?.text===":")continue;if(le==="as"||le==="<")continue;if(ae==="const"||ae==="let"||ae==="var"){let ce=Q(Z+1),de=Z+1,ue=!1,$e=!1,we=0;for(let ye=Z+1;ye<=ce;ye++){let Pe=k[ye]?.text;if(ye<ce&&Gu.includes(Pe)&&R.has(ye)&&R.get(ye)<ce){ye=R.get(ye);continue}if(ye<ce&&Pe===":"&&!$e)ue=!0;else if(ye<ce&&Pe==="="&&we===0)ue=!1,$e=!0;else if(ye<ce&&ue&&Pe==="<")we++;else if(ye<ce&&ue&&Pe===">"&&we>0)we--;else if(ye===ce||Pe===","&&we===0)W(de,ye,H,ae==="var"),de=ye+1,ue=!1,$e=!1}}else if(ae==="function"||ae==="class"){let ce=Z+1;if(k[ce]?.text==="*")ce++;if(k[ce]&&_r.test(k[ce].text)&&k[ce].text!=="extends")H.add(k[ce].text),z.push({name:k[ce].text,token:ce})}else if(ae==="import"){let ce=Z+1;if(k[ce]?.text==="*"&&k[ce+1]?.text==="as")ce+=2;let de=k[ce]?.text;if(de&&_r.test(de)&&de!=="type"&&k[ce+1]?.text!=="("&&k[ce+1]?.text!==".")H.add(de),z.push({name:de,token:ce,file:!0});let ue=k[ce]?.text==="{"?ce:k[ce+1]?.text===","&&k[ce+2]?.text==="{"?ce+2:-1;if(ue!==-1&&R.has(ue)){let $e=R.get(ue);for(let[we,ye]of B(ue+1,$e)){let Pe=ye-1;while(Pe>=we&&!_r.test(k[Pe].text))Pe--;if(Pe>=we&&k[Pe].text!=="type")z.push({name:k[Pe].text,token:Pe,file:!0})}}}}return qu=v,Fo={code:_,scopes:q,loops:ie,declarations:H,sites:z,tokens:k,pairs:R},Fo}function sc(v){let _=rc(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function Vo(v){return new Set(rc(v).declarations)}function At(v,_){let{scopes:k,loops:R,sites:T,tokens:B,pairs:z}=rc(v),W=Array.from({length:B.length},()=>-1),F=[];for(let ie=0;ie<B.length;ie++){W[ie]=F.length?F[F.length-1]:-1;let Z=B[ie].text;if(Z==="{"&&z.has(ie))F.push(ie);else if(Z==="}"&&F.length&&z.get(ie)===F[F.length-1])F.pop()}let U=new Set,H=new Map;for(let ie of T){if(!_.has(ie.name))continue;U.add(ie.token);let Z=ie.file?-1:W[ie.token],ae=Z===-1?[0,Number.POSITIVE_INFINITY]:[B[Z].start,B[z.get(Z)].end];if(ie.functionScoped){let ce=B[ie.token].start,de=k.filter((ue)=>ue.functionBody&&ce>=ue.bodyStart&&ce<ue.end).sort((ue,$e)=>ue.end-ue.bodyStart-($e.end-$e.bodyStart))[0];ae=de?[de.bodyStart,de.end]:[0,Number.POSITIVE_INFINITY]}else if(!ie.file){let ce=R.filter((de)=>ie.token>de.headStart&&ie.token<de.headEnd).sort((de,ue)=>de.headEnd-de.headStart-(ue.headEnd-ue.headStart))[0];if(ce)ae=[ce.start,ce.end]}let le=H.get(ie.name);if(le)le.push(ae);else H.set(ie.name,[ae])}let q=new Set;for(let ie=0;ie<B.length;ie++){if(B[ie].text!=="import"||B[ie-1]?.text===".")continue;let Z=ie+1;if(B[Z]?.text==="type")Z++;if(B[Z]&&_r.test(B[Z].text)&&B[Z+1]?.text===",")Z+=2;if(B[Z]?.text==="{"&&z.has(Z))for(let ae=Z+1;ae<z.get(Z);ae++)q.add(ae)}let Q=new Set;for(let ie=0;ie<B.length;ie++){let Z=B[ie].text;if(!_.has(Z)||Q.has(Z)||U.has(ie)||q.has(ie))continue;let ae=B[ie-1]?.text;if(ae==="#"||ae==="."&&B[ie-2]?.text!=="..")continue;if(B[ie+1]?.text===":"&&(ae==="{"||ae===","))continue;let le=B[ie].start;if(H.get(Z)?.some(([ce,de])=>le>=ce&&le<de))continue;if(k.some((ce)=>le>=ce.start&&le<ce.end&&ce.names.has(Z)))continue;Q.add(Z)}return Q}import Uo from"fs";import Jt from"path";function dn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var vd=new Map;function Ho(v,_=!0){let k=vd.get(v);if(_&&k)return k;let R=new Map,T=[Jt.join(v,"src"),Jt.join(v,"dist"),v];function B(z,W){if(W>6)return;let F;try{F=Uo.readdirSync(z,{withFileTypes:!0})}catch{return}for(let U of F){let H=Jt.join(z,U.name);if(U.isDirectory()){if(U.name==="node_modules"||U.name.startsWith("."))continue;B(H,W+1)}else if(U.isFile()&&U.name.endsWith(".stx")){let q=U.name.slice(0,-4);if(!R.has(q))R.set(q,H);let Q=q.toLowerCase();if(!R.has(Q))R.set(Q,H);let ie=dn(q);if(!R.has(ie))R.set(ie,H)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)vd.set(v,R);return R}function qo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=Jt.join(k,"node_modules",v);try{if(Uo.statSync(R).isDirectory())return R}catch{}let T=Jt.dirname(k);if(T===k)return null;k=T}}function Ko(v,_,k={}){return[Jt.resolve(Jt.dirname(_),`${v}.stx`),Jt.resolve(Jt.dirname(_),v),Jt.resolve(k.componentsDir||"components",`${v}.stx`),Jt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function wd(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=dn(_);return[_,k,R]}function ic(v,_){let[k,R,T]=wd(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*oc(v,_,k={},R){let T=wd(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Jt.resolve(Jt.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((F)=>`${F}.stx`))],z=k.projectRoot||process.cwd(),W=[...R?.__originalFilePath?[Jt.join(Jt.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Jt.join(Jt.dirname(_),"components"),Jt.resolve(z,"src/components"),Jt.resolve(z,"components"),...import.meta.dir?[Jt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(W)){for(let U of B)yield Jt.join(F,U);try{for(let U of Uo.readdirSync(F,{withFileTypes:!0}))if(U.isDirectory())for(let H of B)yield Jt.join(F,U.name,H)}catch{}}}function Sd(v,_,k={},R){let T=ic(v,R);if(T!==void 0)return T;for(let B of oc(v,_,k,R))try{if(Uo.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import Ih from"fs";import ut from"path";import{createHash as Zh}from"crypto";var Xo="__stx_component_client_factories";function Zo(v){let _=v[Xo];return _ instanceof Map?_:null}function _d(v){v[Xo]=new Map}function ac(v,_){let k=Zo(v);if(!k)return null;let R=Zh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function kd(v,_){let k=Zo(_);if(!k?.size)return v;let R=new Map;for(let[H,q]of k)if(q.instances===1)R.set(H,q.body);let T=[];if(R.size>0){let H=[...R.keys()].map((ie)=>JSON.stringify(ie).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),q=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),Q=q.exec(v);while(Q!==null){let ie=R.get(JSON.parse(Q[1]));if(ie!==void 0)T.push({start:Q.index,end:Q.index+Q[0].length,replacement:`(${ie})(${Q[2]});`});Q=q.exec(v)}}let B=[...k].filter(([,H])=>H.instances>1);if(B.length===0)return $d(v,T);let W=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
116
+ (function() {
117
+ const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
118
+ ${B.map(([H,q])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${q.body}; }
119
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(H)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
120
+ `)}
121
+ })();
122
+ </script>`,F=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),U=F<0?0:F;return T.push({start:U,end:U,replacement:`${W}
123
+ `}),$d(v,T)}function $d(v,_){if(_.length===0)return v;_.sort((B,z)=>B.start-z.start||B.end-z.end);let k=Array(_.length*2+1),R=0,T=0;for(let B of _)k[T++]=v.slice(R,B.start),k[T++]=B.replacement,R=B.end;return k[T]=v.slice(R),k.join("")}function Ed(v){let _=Zo(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function Cd(v,_){let k=Zo(v);if(!k)return[];let R=[];for(let[T,B]of k){let z=B.instances-(_.get(T)??0);if(z>0)R.push({body:B.body,count:z})}return R}function Rd(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)ac(v,k)}import Wd from"fs";var Ad=0,cc=new Map;function ci(){Ad=0,cc.clear()}function Go(v,_){let k=Ad++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return cc.set(R,{type:v,expression:_}),R}function li(){let v={};for(let[_,k]of cc)v[_]={type:k.type,expression:k.expression};return v}function ui(v,_){let k=v;for(let[R,T]of _)k=k.split(R).join(T);return k}function hs(v){return v.includes("<!--__STX_")}var Gh=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function Jh(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function Td(v){return v.replace(/\{{2,}/g,(_)=>Jh(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Gh,"&#64;")}function Id(v,_,k=!1){let R=v.slice(0,_),T=R.lastIndexOf("<"),B=R.lastIndexOf(">");if(T>=0&&B>T)return null;if(T<0&&!k)return null;let z=T>=0?R.slice(T+1):R;if(T>=0&&/^\s*[!/?]/.test(z))return/^\s*\/?\s*$/.test(z)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(z))return{kind:"tag-name"};let W=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(z);if(W)return{kind:"attribute",name:W[1],quote:'"',valuePrefix:W[2]};let F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(z);if(F)return{kind:"attribute",name:F[1],quote:"'",valuePrefix:F[2]};let U=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(z);if(U)return{kind:"attribute",name:U[1],quote:null,valuePrefix:U[2]};return T>=0||/^\s*[^<>]*$/.test(z)?{kind:"tag"}:null}class Yn extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var Pd="unsafe:";var Yh=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Qh=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ey=/^data:(?:text\/html|application\/xhtml\+xml)/,ty=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ny(v){return v.replace(ty,"").toLowerCase()}function lc(v){let _=v.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(_))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(_))return"fetched";return null}function Jo(v,_="navigable"){let k=ny(v);if(Yh.test(k))return!0;return _==="navigable"?Qh.test(k):ey.test(k)}function to(v,_="navigable"){return Jo(v,_)?"unsafe:"+v:v}function ry(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return lc(_[1])}function Dd(v,_,k=256){if(_<=k)return v.slice(0,_);let R=v.slice(_-k,_),T=R.search(/[\s"'`/]/);return T===-1?"":R.slice(T)}function Od(v,_,k=_){let R=ry(v);return R&&Jo(_,R)?"unsafe:"+k:k}var Yo=/<script\b[^>]*>/iy,pc=/<\/script\s*>/ig,Qo=/<style\b[^>]*>/iy,gc=/<\/style\s*>/ig;function Md(v,_,k,R){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;R.lastIndex=k.lastIndex;let B=R.exec(v);if(!B)return-1;return B.index+B[0].length}function V(v,_){return Md(v,_,Yo,pc)}function is(v,_){return Md(v,_,Qo,gc)}function qe(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Nd(v,_){if(v.startsWith("<!--",_)){let T=qe(v,_);return T===-1?v.length:T}if(Yo.lastIndex=_,Yo.exec(v)?.index===_){pc.lastIndex=Yo.lastIndex;let T=pc.exec(v);return T?T.index+T[0].length:v.length}if(Qo.lastIndex=_,Qo.exec(v)?.index===_){gc.lastIndex=Qo.lastIndex;let T=gc.exec(v);return T?T.index+T[0].length:v.length}return-1}function ee(v,_){let k=[],R=0,T=v.length,B=!1,z=null;while(R<T){let W=v[R];if(B){if(z){if(W===z)z=null}else if(W==='"'||W==="'")z=W;else if(W===">")B=!1;R++;continue}if(W!=="<"){let q=v.indexOf("<",R+1);if(q===-1)break;R=q;continue}let F=_(v,R);if(F>R){k.push({start:R,end:F,token:v.slice(R,F)}),R=F;continue}let U=Nd(v,R);if(U>R){R=U;continue}let H=v.charCodeAt(R+1);if(H>=65&&H<=90||H>=97&&H<=122)B=!0;R++}return k}function jd(v){let _=0,k=0,R=0,T=!1,B=null;while(R<v.length){if(T){let q=v[R];if(B){if(q===B)B=null}else if(q==='"'||q==="'")B=q;else if(q===">")T=!1;R++;continue}let z=v.indexOf("<",R),W=z===-1?v.length:z;while(R<W){let q=v[R++];if(q==="{")_++;else if(q==="}")k++;if(_>=2&&k>=2)return!0}if(z===-1)break;let F=Nd(v,z);if(F>z){R=F;continue}let U=v.charCodeAt(z+1),H=U===47?v.charCodeAt(z+2):U;if(H>=65&&H<=90||H>=97&&H<=122)T=!0;R=z+1}return!1}function Ld(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var sy=1024,iy=16777216,rs=new Map,uc=0;function oy(v,_){rs.set(v,_),uc+=v.length+_.output.length;for(let[k,R]of rs){if(uc<=iy)break;rs.delete(k),uc-=k.length+R.output.length}}function Vn(v,_,k,R){let T=R!==void 0&&v.length>=sy,B=T?`${R}\x00${v}`:"";if(T){let H=rs.get(B);if(H)return rs.delete(B),rs.set(B,H),{output:H.output,tokens:H.tokens.slice()}}let z=ee(v,_);if(z.length===0)return{output:v,tokens:[]};let W=z.map((H)=>H.token),F="",U=0;for(let H=0;H<z.length;H++){let q=z[H];F+=v.slice(U,q.start),F+=k(q.token,H),U=q.end}if(F+=v.slice(U),T)return oy(B,{output:F,tokens:W}),{output:F,tokens:W.slice()};return{output:F,tokens:W}}var ay=1024,cy=16777216,ss=new Map,dc=0;function ly(v,_){ss.set(v,_),dc+=v.length+_.output.length;for(let[k,R]of ss){if(dc<=cy)break;ss.delete(k),dc-=k.length+R.output.length}}function fc(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:os(R,k)}}function gn(v){let _=v.length>=ay;if(_){let T=ss.get(v);if(T)return ss.delete(v),ss.set(v,T),fc(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=Vn(v,V,(T,B)=>`\x00STX_SCRIPT_${B}\x00`);if(_)return ly(v,{output:k,scripts:R}),fc(v,k,R.slice());return fc(v,k,R)}function os(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function It(v){let _=v.indexOf(" as ");if(_!==-1){let B=v.slice(0,_).trim(),z=v.slice(_+4).trim();return B&&z?{arrayExpr:B,itemVar:z}:null}let k=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(v);if(!k)return null;let R=k[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),T=k[2].trim();return R&&T?{arrayExpr:T,itemVar:R}:null}function ta(v){let _=[],k=0,R="",T=0;for(let B=0;B<v.length;B++){let z=v[B];if(R){if(z==="\\")B++;else if(z===R)R="";continue}if(z==="'"||z==='"'||z==="`")R=z;else if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(T,B)),T=B+1}return _.push(v.slice(T)),_}function Bd(v,_){let k=0;for(let R=0;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===_&&k===0)return R}return-1}function zd(v){let _=0;for(let k=0;k<v.length;k++){let R=v[k];if(R==="("||R==="["||R==="{")_++;else if((R===")"||R==="]"||R==="}")&&--_===0)return k}return-1}function zr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=Bd(k,"=");if(R!==-1&&k[R+1]!==">")k=k.slice(0,R).trim();if(!k)return;if(k.startsWith("{")&&k.endsWith("}")){for(let T of ta(k.slice(1,-1))){let B=T.trim();if(!B)continue;if(B.startsWith("...")){zr(B,_);continue}let z=Bd(B,":");zr(z===-1?B:B.slice(z+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of ta(k.slice(1,-1)))zr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Wr(v){let _=v.trim(),k=[],R=0;for(let B=0;B<_.length;B++){let z=_[B];if(z==="("||z==="["||z==="{")R++;else if(z===")"||z==="]"||z==="}")R--;else if(R===0&&/\s/.test(z)){if(!/^\s+(?:in|of)\s/.exec(_.slice(B)))continue;let F=_.slice(0,B).trim();if(F.startsWith("(")&&zd(F)===F.length-1)F=F.slice(1,-1);for(let U of ta(F))zr(U,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let B=T[1].trim();if(B.startsWith("(")&&zd(B)===B.length-1)B=B.slice(1,-1);let z=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(B);if(z)zr(z[2],k),zr(z[1],k);else for(let W of ta(B))zr(W,k)}return k}function te(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let z=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let W of z.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(W))return!0;return!1}var na="__stx_client_loop_names";function kr(v){let _=v?.[na];return Array.isArray(_)?_:[]}function ra(v){if(!v.includes("#")&&!v.includes("v-slot:"))return[];let _=[],k=[],R=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let T of v.matchAll(R)){let B=T[0];if(/^<\/template\s*>$/i.test(B)){let z=k.pop();if(z)z.end=T.index}else if(/^<template\b/i.test(B)&&!/\/\s*>$/.test(B)){let W=[...B.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((H)=>/^(?:#[\w-]+|v-slot:[\w-]+)$/i.test(H[1])),F=(W?.[2]??W?.[3])?.trim(),U=F?{start:T.index+B.length,end:v.length,binding:F}:void 0;if(k.push(U),U)_.push(U)}}return _}var ro={},Fd=new Map;function uy(v){let _=Fd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Fd.set(v,_)}return _.lastIndex=0,_}var nr={uppercase:(v,_)=>v!==void 0&&v!==null?String(v).toUpperCase():"",lowercase:(v,_)=>v!==void 0&&v!==null?String(v).toLowerCase():"",capitalize:(v,_)=>{if(v===void 0||v===null)return"";let k=String(v);return k.charAt(0).toUpperCase()+k.slice(1)},number:(v,_,k=0)=>{if(v===void 0||v===null)return"";try{let R=Number(v);return Number.isNaN(R)?"":R.toFixed(Number.parseInt(String(k),10))}catch{return""}},fmt:(v,_,k="en-US")=>{if(v===void 0||v===null)return"";try{let R=Number(v);if(Number.isNaN(R))return String(v);return R.toLocaleString(k)}catch{return String(v)}},join:(v,_,k=",")=>{if(!Array.isArray(v))return"";return v.join(String(k))},escape:(v,_)=>{if(v===void 0||v===null)return"";return Ot(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,B=String(v).split("."),z=R;for(let F of B){if(z===void 0||z===null)break;z=z[F]}if(z===void 0||z===null)return T?v:"";let W=String(z);return Object.entries(k).forEach(([F,U])=>{W=W.replace(uy(F),String(U))}),W},t:(v,_,k={})=>nr.translate(v,_,k),truncate:(v,_,k=50,R="...")=>{if(v===void 0||v===null)return"";let T=String(v);if(T.length<=k)return T;if(k<=R.length)return R.substring(0,k);return T.substring(0,k-R.length)+R},date:(v,_,k="short",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=v instanceof Date?v:new Date(v);if(Number.isNaN(T.getTime()))return String(v);let B={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(k==="iso")return T.toISOString();return new Intl.DateTimeFormat(R,B[k]||B.short).format(T)}catch{return String(v)}},currency:(v,_,k="USD",R="en-US")=>{if(v===void 0||v===null)return"";try{let T=Number(v);if(Number.isNaN(T))return String(v);return new Intl.NumberFormat(R,{style:"currency",currency:k}).format(T)}catch{return String(v)}},pluralize:(v,_,k,R)=>{let T=Number(v);if(Number.isNaN(T))return k;let B=R||`${k}s`;return T===1?k:B},first:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[0];return String(v).charAt(0)},last:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return v.length===0?"":v[v.length-1];let k=String(v);return k.charAt(k.length-1)},length:(v,_)=>{if(v===void 0||v===null)return 0;if(Array.isArray(v)||typeof v==="string")return v.length;if(v instanceof Map||v instanceof Set)return v.size;if(typeof v==="object")return Object.keys(v).length;return 0},json:(v,_,k=!1)=>{if(v===void 0)return"undefined";if(v===null)return"null";try{return k?JSON.stringify(v,null,2):JSON.stringify(v)}catch{return String(v)}},default:(v,_,k="")=>v===void 0||v===null||v===""?k:v,reverse:(v,_)=>{if(v===void 0||v===null)return"";if(Array.isArray(v))return[...v].reverse();return String(v).split("").reverse().join("")},slice:(v,_,k=0,R)=>{if(v===void 0||v===null)return"";if(Array.isArray(v)||typeof v==="string")return v.slice(k,R);return v},replace:(v,_,k,R="")=>{if(v===void 0||v===null)return"";let T=k.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(v).replace(new RegExp(T,"g"),()=>R)},stripTags:(v,_)=>{if(v===void 0||v===null)return"";return String(v).replace(/<[^>]*>/g,"")},urlencode:(v,_)=>{if(v===void 0||v===null)return"";return encodeURIComponent(String(v))},abs:(v,_)=>{let k=Number(v);return Number.isNaN(k)?0:Math.abs(k)},round:(v,_,k=0)=>{let R=Number(v);if(Number.isNaN(R))return 0;let T=10**k;return Math.round(R*T)/T}};function bc(v,_){if(v in nr)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);ro[v]=_}function Xu(v){for(let[_,k]of Object.entries(v))bc(_,k)}function vc(){return{...nr,...ro}}function Ju(){for(let v of Object.keys(ro))delete ro[v]}function wc(v,_,k=2){let R=0,T=null;for(let B=_+k;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="{"){R++;continue}if(z==="}"){if(R>0){R--;continue}let W=0;while(v[B+W]==="}")W++;if(W>=k)return B}}return-1}function rr(v,_,k=2){let R="{".repeat(k);if(!v.includes(R))return v;let T="",B=0;for(;;){let z=v.indexOf(R,B);if(z===-1)break;let W=wc(v,z,k);if(W===-1)break;T+=v.slice(B,z)+_(v.slice(z,W+k),v.slice(z+k,W),z),B=W+k}return B===0?v:T+v.slice(B)}function b(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Ot(v){return Td(b(v))}function dy(v){return v.replace(/ /g,"&#32;").replace(/\t/g,"&#9;").replace(/\n/g,"&#10;").replace(/\r/g,"&#13;").replace(/\f/g,"&#12;").replace(/=/g,"&#61;").replace(/`/g,"&#96;")}function fy(v){return v.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(_,k)=>String.fromCodePoint(Number.parseInt(k,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function py(v,_){let k=fy(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new Yn(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let R=/url\(([^)]*)\)/g,T;while((T=R.exec(k))!==null){let B=T[1].replace(/^["']|["']$/g,""),z=B.startsWith("/")&&!B.startsWith("//")||B.startsWith("./")||B.startsWith("../")||B.startsWith("#"),W=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(B);if(!z&&!W)throw new Yn(_,"CSS URLs must be local paths or base64 raster images")}}function Xd(v,_,k,R=!1,T=0){let B=Id(v,_,R),z=Ot(k);if(!B)return z;if(B.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new Yn("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(B.kind==="tag"){let U=v.slice(_+T).trimStart(),H=k.trim();if(!U.startsWith("=")&&(H===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(H)))return H;throw new Yn("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let W=B.name.toLowerCase();if(/^on[a-z]/.test(W))throw new Yn(B.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(W==="srcdoc")z=Ot(z);if(W==="style")py(k,B.name);if(B.quote===null)z=dy(z);let F=lc(W);if(F&&B.valuePrefix.trim()===""&&Jo(k,F))return Pd+z;return Od(Dd(v,_),k,z)}function ke(v,_){let{scripts:k}=gn(v);for(let R of k){let T=R.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!T||/\bserver\b|\bsrc\s*=/.test(T[1]))continue;let B=T[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(B))return!0;if(Ln(B,_))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(v))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(v))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(v))return!0;return!1}function xc(v){let _=[],k=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let R=k.exec(v);R;R=k.exec(v)){let T=R[1].toLowerCase(),B=new Set(Wr(R[3]));if(B.size===0)continue;let z=R.index+R[0].length;if(R[0].endsWith("/>")){_.push({start:R.index,end:z,names:B});continue}let W=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");W.lastIndex=z;let F=1,U=v.length;for(let H=W.exec(v);H;H=W.exec(v)){if(H[2]==="/")continue;if(F+=H[1]==="/"?-1:1,F===0){U=H.index+H[0].length;break}}_.push({start:R.index,end:U,names:B})}return _}function Vd(v,_,k){let R=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let B of T.names)if(new RegExp(`(?<![.#\\w$])${B.replace(/\$/g,"\\$")}(?![\\w$])`).test(R))return!0}return!1}function Ud(v,_){let k=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],R=v.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),T="",B=!1,z=0;for(let U=0;U<R.length;U++){let H=R[U];if(!B&&H==="`"){B=!0,z=0;continue}if(B){if(H==="`"&&z===0){B=!1;continue}if(H==="$"&&R[U+1]==="{"){z++,U++,T+=" ";continue}if(H==="}"&&z>0){z--;continue}if(z>0){T+=H;continue}continue}T+=H}R=T;let W=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,F;while((F=W.exec(R))!==null){let U=F[1];if(!R.substring(0,F.index).trimEnd().endsWith(".")){if(!k.includes(U)&&!(U in _))return!1}}return!0}function gy(v,_){let k=_.__stx_serverDeclared;if(!k||k.size===0)return!1;let R=s(v);for(let T of k)if(new RegExp(`(?<![.#\\w$])${T}(?![\\w$])`).test(R))return!0;return!1}var Hd=new Set;function qd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Kd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!Hd.has(k))Hd.add(k),console.warn(`[stx] {{ ${v} }} in a <script> in ${_??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function ys(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>{try{let z=x(B,_);if(z===void 0)return qd(B)?Kd(B.trim(),k):T;return z===null?"":String(z)}catch{return T}}),R=rr(R,(T,B,z)=>{let W=B.trim();if(/^__[A-Z_]+__$/.test(W))return T;try{let F=x(B,_);if(F===void 0)return qd(W)?Kd(W,k):T;return JSON.stringify(F).replace(/</g,"\\u003c")}catch{return T}}),R}function Sc(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(R,T)=>{try{let B=x(T,_);if(B===void 0)return R;return B===null?"":String(B)}catch{return R}}),k=rr(k,(R,T,B)=>{let z=T.trim();if(/^__[A-Z_]+__$/.test(z))return R;try{let W=x(T,_);if(W===void 0)return R;if(W===null)return"";let F=String(W);return Xd(k,B,F,!0,R.length)}catch(W){if(W instanceof Yn)throw W;return R}}),k}function Yu(v,_,k={}){let{output:R,scripts:T}=gn(v),B=T.map((z)=>{let W=z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),F=z.match(/^<script\b[^>]*>/i),U=z.search(/<\/script\s*>$/i);if(!W||!F||U===-1)return z;let H=W[1],q=W[2];if(/\bdata-raw\b/.test(H))return z;if(k.skipServer&&/\bserver\b/.test(H))return z;let ie=`<script${Sc(H,_)}>`;if(/\bsrc\s*=/.test(H)||/\btype\s*=\s*["']application\/json["']/.test(H))return ie+q+z.slice(U);return ie+ys(q,_)+z.slice(U)});return os(R,B)}function X(v,_,k){let R=v,T=(Z,ae)=>{let le=is(Z,ae);if(le===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z.slice(ae,le))?-1:le},B=(Z,ae,le,ce)=>{let de=le.length,{output:ue,tokens:$e}=Vn(Z,ae,(we,ye)=>ce(de+ye));return le.push(...$e),ue},z=[];R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let W=[];R=B(R,V,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`);let F=_?.__stx_signals_gate===!0||ke(v),U=new Set(Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[]),H=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);R=rr(R,(Z,ae,le)=>{try{let ce=x(ae,_,!1,(de)=>mc(de,Z,k,v));return ce!==void 0&&ce!==null?String(ce):""}catch(ce){let de=ce instanceof Error?ce.message:String(ce);return g("Expression",`Error evaluating: {{{ ${ae.trim()}}}}: ${de}`,k,v,le,Z)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(Z,ae,le)=>{try{let ce=x(ae,_,!1,(de)=>mc(de,Z,k,v));if(ce===void 0&&_.__stx_buildMode==="compile")return Go("raw",ae.trim());return ce!==void 0&&ce!==null?String(ce):""}catch(ce){if(_.__stx_buildMode==="compile")return Go("raw",ae.trim());let de=ce instanceof Error?ce.message:String(ce);return g("Expression",`Error evaluating: {!! ${ae.trim()} !!}: ${de}`,k,v,le,Z)}}),R=B(R,V,W,(Z)=>`<!--__STX_SCRIPT_EXPR_${Z}__-->`),R=B(R,T,z,(Z)=>`<!--__STX_STYLE_${Z}__-->`);let q=F?xc(R):[],Q=ra(R).map((Z)=>({...Z,names:new Set(Wr(`${Z.binding} in __slot`))})),ie=new Set(kr(_));if(R=rr(R,(Z,ae,le)=>{let ce=ae.trim();if(Vd(Q,le,ce))return Z;if(te(ce,ie))return Z;if(q.length>0&&Vd(q,le,ce))return Z;if(H.has(ce))return Z;let de=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],ue=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,we=ce.match(ue)?.[1],ye=we&&((we in _)||de.includes(we)),Pe=Boolean(we&&U.has(we)),Oe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Me=ce.match(Oe),Ne=Me&&!de.includes(Me[1])&&!(Me[1]in _);if(/^__[A-Z_]+__$/.test(ce))return"";let Le;try{let De=x(ae,_,!1,(Ve)=>{Le=Ve});if(Pe)return Z;if(F&&!Ud(ce,_))return Z;if(Le)mc(Le,Z,k,v);if(_.__stx_buildMode==="compile"&&!F&&(De===void 0||gy(ce,_)))return Go("expr",ce);if(De===void 0||De===null)return"";let ze=String(De);return Xd(R,le,ze,!1,Z.length)}catch(De){if(De instanceof Yn)throw De;if(Pe)return Z;if(F&&!Ud(ce,_))return Z;if(Ne)return Z;let ze=De instanceof Error?De.message:String(De);return g("Expression",`Error evaluating: {{ ${ce} }}: ${ze}`,k,v,le,Z)}}),W.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Z,ae)=>W[Number(ae)]??Z);if(z.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Z,ae)=>z[Number(ae)]??Z);return R}function kc(v,_,k){if(!_.trim())return v;let R=v,T=_.trim();while(T.length>0){let B=T.match(/^(\w+)/);if(!B)break;let z=B[1];T=T.substring(z.length).trim();let W=ro[z]||nr[z];if(!W)throw Error(`Filter not found: ${z}. Available filters: ${Object.keys(vc()).join(", ")}`);let F=[];if(T.startsWith(":")){let U=T.match(/^:([^|\s]+)/);if(U){let H=U[1].trim();try{let q=Number(H);F=[Number.isNaN(q)?H:q]}catch{F=[H]}T=T.substring(U[0].length).trim()}}else if(T.startsWith("(")){let U=1,H=1;while(U>0&&H<T.length){if(T[H]==="(")U++;if(T[H]===")")U--;H++}if(U===0){let q=T.substring(1,H-1).trim();if(q)try{if(q.startsWith("{")&&q.endsWith("}"))F=[x(`(${q})`,k,!0)];else{let Q=[],ie="",Z=null,ae=0,le=0,ce=0,de=!1;for(let ue=0;ue<q.length;ue++){let $e=q[ue];if(de){ie+=$e,de=!1;continue}if($e==="\\"){ie+=$e,de=!0;continue}if(Z){if(ie+=$e,$e===Z)Z=null;continue}if($e==='"'||$e==="'"||$e==="`"){Z=$e,ie+=$e;continue}if($e==="(")ae++;else if($e===")")ae--;else if($e==="[")le++;else if($e==="]")le--;else if($e==="{")ce++;else if($e==="}")ce--;if($e===","&&ae===0&&le===0&&ce===0){Q.push(ie),ie="";continue}ie+=$e}if(ie)Q.push(ie);F=Q.map((ue)=>{let $e=ue.trim();return x($e,k,!0)})}}catch{F=[q]}T=T.substring(H).trim()}}try{R=W(R,k,...F)}catch(U){let H=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${z}': ${H}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function my(v){let _=!1,k="",R=0,T=0,B=0,z=!1;for(let W=0;W<v.length;W++){let F=v[W],U=v[W+1];if(_&&z){z=!1;continue}if(_&&F==="\\"){z=!0;continue}if(z=!1,(F==='"'||F==="'"||F==="`")&&!z){if(!_)_=!0,k=F;else if(F===k)_=!1,k="";continue}if(_&&k==="`"&&F==="$"&&U==="{"){let H=1;W+=2;while(W<v.length&&H>0){if(v[W]==="{")H++;else if(v[W]==="}")H--;if(H>0)W++}continue}if(_)continue;if(F==="(")R++;else if(F===")")R--;else if(F==="[")T++;else if(F==="]")T--;else if(F==="{")B++;else if(F==="}")B--;if(F==="|"&&R===0&&T===0&&B===0){if(U==="|"){W++;continue}if(U==="="){W++;continue}return W}}return-1}var no=new Set,hy=1000;function Zu(){no.clear()}function mc(v,_,k,R){if(!N())return;let T=`${k}\x00${v.expression}`;if(no.has(T))return;if(no.size>=hy)no.clear();no.add(T);let B=k,z=R;try{if(k&&Wd.existsSync(k))z=Wd.readFileSync(k,"utf8")}catch{}let W=z.indexOf(_);if(W>=0)B=`${k}:${z.slice(0,W).split(`
124
+ `).length}`;console.warn(`${B}: stx warning: ${_} rendered as an empty string. The safe evaluator rejected \`${v.expression}\` (${v.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function x(v,_,k=!1,R){try{let T=v.trim(),B=my(T);if(B>0){let W=T.substring(0,B).trim(),F=T.substring(B+1).trim(),U=x(W,_,!0,R);return kc(U,F,_)}let z=Dn(T);if(z!==null){R?.({expression:T,rule:z});return}try{let W=Object.keys(_),F=Object.values(_);return c(T,W)(...F)}catch{return l(T,_)}}catch(T){if(T instanceof ReferenceError){let B=/(\b\w+)\s+is not defined/.exec(T.message);if(B){let z=B[1],W=yy(z,Object.keys(_));if(W&&W!==z)T.message=`${T.message} \u2014 did you mean '${W}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function yy(v,_){let k=null;for(let T of _){if(T===v)continue;let B=xy(v,T);if(k===null||B<k.dist)k={key:T,dist:B}}if(!k)return null;let R=Math.max(v.length,k.key.length);if(k.dist<=2||k.dist/R<=0.35)return k.key;return null}function xy(v,_){if(v===_)return 0;if(v.length===0)return _.length;if(_.length===0)return v.length;let[k,R]=v.length<_.length?[v,_]:[_,v],T=Array(k.length+1),B=Array(k.length+1);for(let z=0;z<=k.length;z++)T[z]=z;for(let z=1;z<=R.length;z++){B[0]=z;for(let W=1;W<=k.length;W++){let F=k[W-1]===R[z-1]?0:1;B[W]=Math.min(B[W-1]+1,T[W]+1,T[W-1]+F)}for(let W=0;W<=k.length;W++)T[W]=B[W]}return T[k.length]}function Qu(v){if(!v)return"";return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import Jd from"fs";class M{cache=new Map;maxSize;options;sizes;bytes=0;constructor(v=100,_){this.maxSize=v,this.options=_??null,this.sizes=_?new Map:null}get byteSize(){return this.bytes}setMaxBytes(v){if(!this.options)return;this.options={...this.options,maxBytes:v};while(this.bytes>v&&this.cache.size>0){let _=this.cache.keys().next().value;if(_===void 0)break;this.delete(_)}}get(v){if(!this.cache.has(v))return;let _=this.cache.get(v);return this.cache.delete(v),this.cache.set(v,_),_}set(v,_){if(this.cache.has(v))this.delete(v);let k=this.options?this.options.sizeOf(_):0;if(this.options&&k>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+k>this.options.maxBytes)){let R=this.cache.keys().next().value;if(R===void 0)break;this.delete(R)}if(this.cache.set(v,_),this.sizes)this.sizes.set(v,k),this.bytes+=k}has(v){return this.cache.has(v)}delete(v){if(this.sizes){let _=this.sizes.get(v);if(_!==void 0)this.bytes-=_,this.sizes.delete(v)}return this.cache.delete(v)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var as=new Map,by=500;function Fr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!as.has(k)){if(as.size>=by){let R=as.keys().next().value;if(R)as.delete(R)}as.set(k,new RegExp(v,_))}return as.get(k)}class Zd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),R=this.pool.find((W)=>W.context.join(",")===k);if(R)return R.func;let T=this.fnCache,B=this.fnCacheMaxSize,z=(...W)=>(F)=>{try{let U=`${k}:${F}`,H=T.get(U);if(!H){if(T.size>=B){let q=T.keys().next().value;if(q)T.delete(q)}H=Function(..._,`
125
+ 'use strict';
126
+ try {
127
+ return ${F};
128
+ }
129
+ catch (e) {
130
+ if (e instanceof ReferenceError || e instanceof TypeError) {
131
+ return undefined;
132
+ }
133
+ throw e;
134
+ }
135
+ `),T.set(U,H)}return H(...W)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:z,context:_.slice()});return z}clear(){this.pool.length=0,this.fnCache.clear()}}var _$=new Zd;class Gd{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(v){this.enabled=v}isEnabled(){return this.enabled}setBudget(v,_){this.budgets.set(v,{warnThreshold:0.8,action:"warn",..._})}setBudgets(v){for(let[_,k]of Object.entries(v))this.setBudget(_,k)}removeBudget(v){this.budgets.delete(v)}getBudgets(){let v={};for(let[_,k]of this.budgets.entries())v[_]=k;return v}onViolation(v){this.violationHandlers.push(v)}offViolation(v){let _=this.violationHandlers.indexOf(v);if(_!==-1)this.violationHandlers.splice(_,1)}time(v,_){if(!this.enabled)return _();let k=performance.now(),R=_(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}async timeAsync(v,_){if(!this.enabled)return _();let k=performance.now(),R=await _(),T=performance.now()-k;return this.recordTime(v,T),this.checkBudget(v,T),R}checkBudget(v,_){let k=this.budgets.get(v);if(!k)return;let R=_/k.maxTime*100,T=k.warnThreshold!==void 0?_>=k.maxTime*k.warnThreshold&&_<k.maxTime:!1,B=_>=k.maxTime;if(!T&&!B)return;let z={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:R,timestamp:new Date,isWarning:T};this.violations.push(z);while(this.violations.length>this.maxViolations)this.violations.shift();for(let F of this.violationHandlers)try{F(z)}catch{}let W=T?`[Performance Warning] "${v}" took ${_.toFixed(2)}ms (${R.toFixed(1)}% of ${k.maxTime}ms budget)`:`[Performance Budget Exceeded] "${v}" took ${_.toFixed(2)}ms (exceeded ${k.maxTime}ms budget by ${(R-100).toFixed(1)}%)`;switch(k.action){case"log":console.log(W);break;case"warn":console.warn(W);break;case"error":console.error(W);break;case"throw":if(B)throw Error(W);else console.warn(W);break}}recordTime(v,_){let k=this.metrics.get(v);if(k)k.count++,k.totalTime+=_,k.maxTime=Math.max(k.maxTime,_),k.minTime=Math.min(k.minTime,_);else this.metrics.set(v,{count:1,totalTime:_,maxTime:_,minTime:_})}getStats(v){if(v){let k=this.metrics.get(v);if(!k)return{};let R=this.budgets.get(v);return{count:k.count,avgTime:k.totalTime/k.count,totalTime:k.totalTime,maxTime:k.maxTime,minTime:k.minTime,budget:R?.maxTime,budgetUtilization:R?k.totalTime/k.count/R.maxTime*100:void 0}}let _={};for(let[k,R]of this.metrics.entries()){let T=this.budgets.get(k);_[k]={count:R.count,avgTime:R.totalTime/R.count,totalTime:R.totalTime,maxTime:R.maxTime,minTime:R.minTime,budget:T?.maxTime,budgetUtilization:T?R.totalTime/R.count/T.maxTime*100:void 0}}return _}getViolations(v){if(v)return this.violations.filter((_)=>_.label===v);return[...this.violations]}getViolationStats(){let v={},_=0,k=0;for(let R of this.violations)if(v[R.label]=(v[R.label]||0)+1,R.isWarning)_++;else k++;return{total:this.violations.length,byLabel:v,warnings:_,errors:k}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var hc=null;function vy(){if(!hc)hc=new Gd;return hc}var G=new Proxy({},{get(v,_){return vy()[_]}});var Yd=[];function m(v){let _=new M(v);return Yd.push(_),_}function Qd(){for(let v of Yd)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function ef(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Jd.statSync(k).mtimeMs})}catch{}return _}function mn(v){for(let _ of v)try{if(Jd.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import zS from"fs";import ln from"path";import ao from"fs";import Ht from"path";import{hasLocalConfig as Ef}from"bunfig";import Un from"fs";import Vr from"path";import tl from"fs";import tf from"path";import{fileURLToPath as wy}from"url";var nl;function We(){if(nl)return nl;let v="unknown";try{v=String(JSON.parse(tl.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=tf.dirname(wy(import.meta.url)),k=0;for(let R of tl.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".ts"))k=Math.max(k,tl.statSync(tf.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return nl=v,v}var Cc=new Map,Ur=new Map;async function ed(v){let k;for(let R=0;R<3;R++)try{let B=(await Un.promises.stat(v)).mtime.getTime(),z=Ur.get(v);if(z&&z.mtime===B)return z.content;let W=await Bun.file(v).text(),U=(await Un.promises.stat(v)).mtime.getTime();if(U!==B)continue;return Ur.set(v,{content:W,mtime:U}),W}catch(T){k=T;break}throw Ur.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function td(v){Ur.delete(v)}function nd(v){for(let _ of Ur.keys())if(_.startsWith(v))Ur.delete(_)}var ia=null,Sy=null,rf=null;function rd(v){rf=v}async function _c(v=!1){let _=rf??await import("./chunk-jbvwg4gs.js");if(v)return _.generateSignalsRuntimeDev();if(ia===null)ia=_.generateSignalsRuntime();return ia}var oa=null;async function Ec(){if(oa===null){let{getRouterScript:v}=await import("./chunk-bnpb6ez9.js");oa=v()}return oa}var nf={};async function sd(v,_=!1){let k=v==="runtime"?await _c(_):await Ec(),R=v==="runtime"&&_?"runtime-debug":v,T=nf[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},nf[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var $y=500,_y=33554432,Qn=new Map,sa=0;function sf(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function od(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=Qn.get(_),R=k!==void 0;if(R)Qn.delete(_),sa-=k.length*2;Qn.set(_,v),sa+=v.length*2;while(Qn.size>1&&(Qn.size>$y||sa>_y)){let T=Qn.keys().next().value;sa-=Qn.get(T).length*2,Qn.delete(T)}if(!R)try{let T=sf(_);if(!Un.existsSync(T))Un.mkdirSync(Vr.dirname(T),{recursive:!0}),Un.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function di(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=Qn.get(v);if(_!==void 0)return _;try{return Un.readFileSync(sf(v),"utf8")}catch{return}}function id(){Ur.clear(),se(),Qd(),ia=null,Sy=null,oa=null}function of(v){let _={debug:v.debug===!0,middleware:(v.middleware??[]).map((k)=>({name:k.name,timing:k.timing,handler:String(k.handler)})),customDirectives:(v.customDirectives??[]).map((k)=>({name:k.name,hasEndTag:k.hasEndTag===!0,rawParams:k.rawParams===!0,handler:String(k.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(_)).digest("hex")}async function yn(v,_){try{if(!_.cachePath)return null;let k=Vr.resolve(_.cachePath),R=Vr.join(k,`${sr(v)}.html`),T=Vr.join(k,`${sr(v)}.meta.json`);if(!await r(R)||!await r(T))return null;let B=await Bun.file(T).text(),z=JSON.parse(B);if(z.cacheVersion!==_.cacheVersion)return null;if(z.engine!==We())return null;if(z.optionsSignature!==of(_))return null;if((await Un.promises.stat(v)).mtime.getTime()>z.mtime)return null;for(let F of z.dependencies)if(await r(F)){if((await Un.promises.stat(F)).mtime.getTime()>z.mtime)return null}else return null;return await Bun.file(R).text()}catch(k){return console.warn(`Cache error for ${v}:`,k),null}}async function bn(v,_,k,R){try{if(!R.cachePath)return;let T=Vr.resolve(R.cachePath);await Un.promises.mkdir(T,{recursive:!0});let B=Vr.join(T,`${sr(v)}.html`),z=Vr.join(T,`${sr(v)}.meta.json`),W=await Un.promises.stat(v);await Bun.write(B,_);let F={sourcePath:v,mtime:W.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:We(),optionsSignature:of(R),generatedAt:Date.now()};await Bun.write(z,JSON.stringify(F,null,2)),Cc.set(v,{output:_,mtime:W.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var ky=16;function sr(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,ky)}var Ge={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Ce(v){return`--stx-${v}`}function aa(v,_){let k=_.lastIndexOf("-");if(k===-1)return typeof v[_]==="string"?v[_]:void 0;let R=v[_.slice(0,k)];if(!R||typeof R!=="object")return;let T=R[_.slice(k+1)];return typeof T==="string"?T:void 0}var Ey=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function af(v,_){let k=_.trim();return aa(v,k)??(Ey.test(k)?k:void 0)}function cf(v={}){return[...Object.keys(v.roles??{}).filter((_)=>!Ge[_]).map((_)=>`roles.${_}`),...Object.keys(v.shapes??{}).filter((_)=>!ne[_]).map((_)=>`shapes.${_}`),...Object.keys(v.density??{}).filter((_)=>!pe[_]).map((_)=>`density.${_}`)]}function lf(v){let _={};for(let[k,R]of Object.entries(Ge)){let T=aa(v,R.light);if(T===void 0)continue;_[k]=`var(${Ce(k)}, ${T})`}return _}function uf(v,_={}){let k=[],R=[];for(let[T,B]of Object.entries(Ge)){let z=_[T],W=typeof z==="string"?z:z?.light,F=typeof z==="string"?z:z?.dark,U=W&&af(v,W)||aa(v,B.light),H=F&&af(v,F)||aa(v,B.dark);if(U===void 0)continue;if(k.push(` ${Ce(T)}: ${U};`),H!==void 0)R.push(` ${Ce(T)}: ${H};`)}if(k.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...k,"}",".dark {",...R,"}",""].join(`
136
+ `)}var ne={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function Dt(v){return`--stx-radius-${v}`}function df(){let v={};for(let[_,k]of Object.entries(ne))v[_]=`var(${Dt(_)}, ${k.value})`;return v}function ff(v={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(ne).map(([_,k])=>` ${Dt(_)}: ${v[_]??k.value};`),"}",""].join(`
137
+ `)}var pe={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},vn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},wn={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function _e(v){return`--stx-${v}`}function rl(v){let _=pe[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${_e(v)}, ${_.value})`}function pf(){let v={};for(let[_,k]of Object.entries(vn))v[_]=rl(k);return v}function gf(){let v={};for(let[_,{size:k,leading:R}]of Object.entries(wn))v[_]=[rl(k),{lineHeight:rl(R)}];return v}function mf(v={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(pe).map(([_,k])=>` ${_e(_)}: ${v[_]??k.value};`),"}",""].join(`
138
+ `)}function hf(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function sl(v,_){let k={...v};for(let[R,T]of Object.entries(_))k[R]=hf(T)&&hf(k[R])?sl(k[R],T):T;return k}function yf(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
139
+ `:k}function xf(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...B}=R,{extend:z,...W}=k,F=W.colors||{};W.colors={...F,...lf(F)};let U=W.borderRadius||{};W.borderRadius={...U,...df()};let H=W.spacing||{};W.spacing={...H,...pf()};let q=W.fontSize||{};W.fontSize={...q,...gf()};let Q=sl(W,B),ie=sl(z||{},T||{});if(Object.keys(ie).length>0)Q.extend=ie;let Z=[...v.safelist||[],..._.safelist||[]],ae={...v.shortcuts||{},..._.shortcuts||{}},le=[...v.preflights||[],..._.preflights||[]],{fonts:ce,...de}=v,{fonts:ue,roles:$e,shapes:we,density:ye,...Pe}=_,Oe={roles:$e,shapes:we,density:ye},Me=ue??ce;return{config:{...de,...Pe,theme:Q,safelist:Z,shortcuts:ae,...le.length>0?{preflights:le}:{},content:[],output:""},safelist:Z,shortcuts:ae,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:uf({...F,...Q.colors},$e)+ff(we)+mf(ye),unknownRoles:cf(Oe),...Me?{fonts:Me}:{}}}function bf(v,_=""){let k=`${v}${_}`,R=0;for(let T=0;T<k.length;T++){let B=k.charCodeAt(T);R=(R<<5)-R+B,R=R&R}return`stx-${Math.abs(R).toString(36)}`}function vf(v,_,k={}){let{prefix:R="",preserveHost:T=!0,scopeKeyframes:B=!0,scopeCustomProperties:z=!1}=k;if(!v.trim())return"";let W=il(v),F=[],U=new Map;if(B)for(let H of W){let q=H.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(q){let Q=q[1],ie=`${_}_${Q}`;U.set(Q,ie)}}for(let H of W){let q=wf(H,_,R,T,U,z);F.push(q)}return F.join(`
140
+
141
+ `)}function il(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),R=0,T="",B=!1,z="";for(let W=0;W<k.length;W++){let F=k[W];if(F==="@"&&R===0)B=!0;if(F==="{")R++;else if(F==="}"){if(R--,R===0){if(B){z+=F;let U=z.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,H,q,Q]=U;if(H==="keyframes")_.push({selector:`@keyframes ${q.trim()}`,declarations:Q.trim()});else if(H==="media"||H==="supports"||H==="container"){let ie=il(Q);_.push({selector:`@${H} ${q.trim()}`,declarations:ie.map((Z)=>`${Z.selector} { ${Z.declarations} }`).join(`
142
+ `)})}else _.push({selector:`@${H} ${q.trim()}`,declarations:Q.trim()})}z="",B=!1}else if(T.trim()){T+=F;let U=T.match(/([^{]+)\{([^}]*)\}/);if(U)_.push({selector:U[1].trim(),declarations:U[2].trim()});T=""}continue}}if(B)z+=F;else T+=F}return _}function wf(v,_,k,R,T,B){let{selector:z,declarations:W}=v;if(z.startsWith("@")){if(z.startsWith("@keyframes")){let H=z.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${W} }`}if(z.startsWith("@media")||z.startsWith("@supports")||z.startsWith("@container")){let q=il(`x { ${W} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((Q)=>wf(Q,_,k,R,T,B)).join(`
143
+ `);return`${z} {
144
+ ${q}
145
+ }`}return`${z} { ${W} }`}let F=Cy(z,_,k,R),U=W;for(let[H,q]of T)U=U.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)U=U.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${U} }`}function Cy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let U=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(U)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=Ry(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function Ry(v,_){let k=0,R=v.length;for(let F=0;F<v.length;F++){let U=v[F];if(U==="["||U==="(")k++;else if(U==="]"||U===")")k--;else if(k===0&&(U===" "||U===">"||U==="+"||U==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let U=T[F];if(U==="["||U==="(")W++;else if(U==="]"||U===")")W--;else if(k===0&&W===0&&U===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var _f=String.raw`(?<![\w-])scoped(?![\w-])`,ol=/<style\s+([^>]*)>/gi,Sf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,kf=new RegExp(_f,"i"),Ay=new RegExp(_f,"gi"),al=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Ty(v){ol.lastIndex=0;let _=ol.exec(v);while(_!==null){if(kf.test(_[1]))return!0;_=ol.exec(v)}return!1}function cl(v){let _=new Set,k=[];al.lastIndex=0;let R=al.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=al.exec(v)}return k}function so(v){let _=cl(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function ca(v,_){if(!Ty(v))return{html:v,hasScoped:!1};let k=bf(_),R=`data-v-${k}`,T=v,B=!1;if(Sf.lastIndex=0,T=T.replace(Sf,(z,W,F)=>{if(!kf.test(W))return z;B=!0;let U=Iy(F,R),H=W.replace(Ay,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${U}</style>`}),!B)return{html:v,hasScoped:!1};return T=Dy(T,R),{html:T,hasScoped:!0}}function Iy(v,_){return vf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Py=(v)=>`\x00stx-scope-mask-${v}\x00`,$f=/\u0000stx-scope-mask-(\d+)\u0000/g;function Dy(v,_){let k=Vn(v,(T,B)=>{let z=V(T,B);return z>B?z:is(T,B)},(T,B)=>Py(B)),R=Oy(k.output,_);return $f.lastIndex=0,R.replace($f,(T,B)=>k.tokens[Number(B)])}function Oy(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var Hn=null,la="";function Cf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;la=`${_}@${Math.trunc(ao.statSync(_).mtimeMs)}`}catch{la=v}}var ul=!1,Hr=null,io="",cs=!1,If=256,Er=new Map,qn=new Map,ua=null,Pf=null,da=new Map,Rf=new Set;function fa(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function ll(v,_){if(Er.has(v))Er.delete(v);else if(Er.size>=If)Er.delete(Er.keys().next().value);Er.set(v,_)}function My(v){let _=fa(v);if(qn.has(_))qn.delete(_);else if(qn.size>=If)qn.delete(qn.keys().next().value);return qn.set(_,v),_}function ad(v){let _=qn.get(v);if(_===void 0)return;return qn.delete(v),qn.set(v,_),_}async function Ny(v,_=ua){if(!_)return null;try{let k=Bun.file(Ht.join(_,`cw-${fa(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function jy(v,_,k=ua){if(!k)return;try{if(!ao.existsSync(k))ao.mkdirSync(k,{recursive:!0});await Bun.write(Ht.join(k,`cw-${fa(v)}.css`),_)}catch{}}async function Af(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Ly=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],By=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function zy(){let v=[],_=process.cwd();while(_!==Ht.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Ly)v.push(Ht.join(_,k,...R));_=Ht.dirname(_)}return v}function Wy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ht.join(_,"Code","Tools","ts-css"),_&&Ht.join(_,"Code","Tools","crosswind"),_&&Ht.join(_,"repos","stacks-org","ts-css"),_&&Ht.join(_,"repos","stacks-org","crosswind"),Ht.join(process.cwd(),"..","ts-css"),Ht.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Ht.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Ht.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ht.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function pi(){if(ul)return Hn;ul=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await Af(B);if(z){if(Cf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ht.dirname(Ht.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Ht.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Hn=B,Hn}let _=await v(zy());if(_)return Hn=_,Hn;let k=By;for(let T of k){let B=await Af(T);if(B){Hn=B;try{Cf(import.meta.resolve(T))}catch{la=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Hn}}let R=await v(Wy());if(R)return Hn=R,Hn;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function cd(){dl.clear(),Hn=null,ul=!1,Hr=null,io="",Er.clear(),qn.clear(),Pf=null,da.clear()}var Tf=!1;async function fi(v){try{let _=Ef({name:"css",cwd:v})?"css":Ef({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Tf)Tf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Ht.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function Tc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-3ttnn4t3.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Ht.isAbsolute(R.css)?R.css:Ht.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Ht.isAbsolute(R.css.config)?R.css.config:Ht.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await fi(v)}function $c(v){try{let _=new WeakSet;return fa(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Nt(v){if(cs)return io;cs=!0;try{let _=await pi();if(!_||!_.build)return cs=!1,"";if(!Hr)Hr=await fi(v);if(!Hr)return cs=!1,"";let k=_.defaultConfig?.theme||{},R=Hr.theme||{},T={..._.defaultConfig,...Hr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(io=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=Ht.isAbsolute(T.output)?T.output:Ht.join(v,T.output),U=Ht.dirname(F);if(!ao.existsSync(U))ao.mkdirSync(U,{recursive:!0});await Bun.write(F,z.css)}return cs=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),cs=!1,io}}async function xn(v){Hr=null,await Nt(v)}function ld(){return io}function Rc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var dl=m(64);async function Ac(v,_){let k=()=>da.get(_?Ht.resolve(_):process.cwd())?.fingerprint??null,R=dl.get(h(v,_,k()));if(R!==void 0)return R;let T=await Fy(v,_);if(T)dl.set(h(v,_,k()),T);return T}function*Df(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=di(R);if(T)yield T}}function ud(v){return[...Df(v)].join(`
146
+ `)}async function Fy(v,_){try{let k=await pi();if(!k)return"";let R=new Set;for(let Oe of Df(v)){let Me=typeof k.extractClasses==="function"?k.extractClasses(Oe):Rc(Oe);for(let Ne of Me)R.add(Ne)}if(R.size===0)return"";let T=_?Ht.resolve(_):process.cwd(),B=a(T,"cache");if(!ua)ua=B;let z=da.get(T);if(!z){let Oe=await Tc(T);z={config:Oe,fingerprint:$c(Oe)},da.set(T,z),Pf=z.fingerprint}let W=[...R].sort().join(" "),F=`${la}::${z.fingerprint||"default"}::${W}`,U=Er.get(F);if(U!==void 0)return ll(F,U),U;let H=await Ny(F,B);if(H!==null)return ll(F,H),H;let q=k.defaultConfig||k.config,Q=z.config||{},ie=xf(q,Q),{safelist:Z,includePreflight:ae,minify:le,tokenCSS:ce}=ie;if(ie.unknownRoles.length>0&&!Rf.has(T))Rf.add(T),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${ie.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let de=ie.config,ue=new k.CSSGenerator(de),$e=de.shortcuts||Q.shortcuts||{},we=Object.keys($e).filter((Oe)=>R.has(Oe)||Z.includes(Oe));for(let Oe of Z)if(!$e[Oe])ue.generate(Oe);for(let Oe of R)if(!$e[Oe])ue.generate(Oe);let ye="";if(we.length>0){let Oe=new k.CSSGenerator(de);for(let Me of we)Oe.generate(Me);if(ye=Oe.toCSS(!1,le),ye&&!ye.endsWith(`
147
+ `))ye+=`
148
+ `}let Pe=ye+ue.toCSS(ae,le);return Pe=yf(k.CSSGenerator,ie)+ce+Pe,ll(F,Pe),jy(F,Pe,B),Pe}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await Ac(v,_);if(!T)return R?so(v):v;let B=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${My(T)}.css">`:`<style data-css="generated">
149
+ ${T}
150
+ </style>`;if(R)return Vy(v,B);let z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(z.test(v)){let W=!1;return v.replace(z,()=>{if(W)return"";return W=!0,B})}if(v.includes("</head>"))return v.replace("</head>",`${B}
151
+ </head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
152
+ ${B}`);return B+v}function Vy(v,_){let k=cl(v).map((F)=>({...F,replacement:""})),R=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g,T=R.exec(v);if(T!==null){let F=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:F?_:""}),F=!1,T=R.exec(v)}else{let F=v.indexOf("</head>");if(F!==-1)k.push({start:F,end:F,replacement:`${_}
153
+ `});else{let U=v.match(/<body([^>]*)>/);if(U?.index!==void 0)k.push({start:U.index,end:U.index+U[0].length,replacement:`${U[0]}
154
+ ${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((F,U)=>F.start-U.start||F.end-U.end);for(let F=1;F<k.length;F++)if(k[F].start<k[F-1].end)return Uy(so(v),_);let B=Array(k.length*2+1),z=0,W=0;for(let F of k)B[W++]=v.slice(z,F.start),B[W++]=F.replacement,z=F.end;return B[W]=v.slice(z),B.join("")}function Uy(v,_){let k=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(k.test(v)){let R=!1;return v.replace(k,()=>{if(R)return"";return R=!0,_})}if(v.includes("</head>"))return v.replace("</head>",`${_}
155
+ </head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
156
+ ${_}`);return _+v}var fl=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Of=/<body\b([^>]*)>/gi;function Kn(v){let _=0,k,R=fl.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Of.lastIndex=_,k=Of.exec(v);if(!k)return null;let T=k.index,B=-1,z=null;for(let F=0;F<fl.length;F++){let U=fl[F],H=R[F];if(H===void 0||H!==null&&H.index<_)U.open.lastIndex=_,H=U.open.exec(v),R[F]=H;if(!H)continue;if(H.index<T&&(B===-1||H.index<B))B=H.index,z=U.close}if(B===-1||!z)return{index:T,tag:k[0],attrs:k[1]??""};z.lastIndex=B;let W=z.exec(v);if(!W)return null;_=W.index+W[0].length}return null}function ls(v,_){let k=Kn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var Mf=/<style\b[^>]*>/iy,Nf=/<\/style>/gi,jf=/<script\b[^>]*>/iy,Lf=/<template(?=[\s>/])[^>]*>/iy,Bf=/<\/template\s*>/iy;function co(v){let _=0,k=0,R=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let F=v.indexOf("-->",T+4);_=F===-1?v.length:F+3;continue}Mf.lastIndex=T;let B=Mf.exec(v);if(B){Nf.lastIndex=T+B[0].length;let F=Nf.exec(v);_=F===null?v.length:F.index+8;continue}Lf.lastIndex=T;let z=Lf.exec(v);if(z){if(k===0)R=T;k++,_=T+z[0].length;continue}Bf.lastIndex=T;let W=Bf.exec(v);if(W){if(k>0)k--;_=T+W[0].length;continue}if(jf.lastIndex=T,jf.test(v))return k>0?R:T;_=T+1}return-1}function zf(){return`
157
+ // STX Lifecycle Runtime
158
+ (function() {
159
+ if (typeof window === 'undefined') return;
160
+
161
+ const instances = new Map();
162
+ let currentInstance = null;
163
+ let idCounter = 0;
164
+
165
+ function generateId() {
166
+ return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
167
+ }
168
+
169
+ function createInstance(element) {
170
+ const instance = {
171
+ id: generateId(),
172
+ element: element,
173
+ mountHooks: [],
174
+ destroyHooks: [],
175
+ updateHooks: [],
176
+ refs: new Map(),
177
+ watchers: [],
178
+ isMounted: false
179
+ };
180
+ instances.set(instance.id, instance);
181
+ return instance;
182
+ }
183
+
184
+ window.STX = window.STX || {};
185
+
186
+ // Lifecycle hooks
187
+ window.STX.onMount = function(hook) {
188
+ if (currentInstance) currentInstance.mountHooks.push(hook);
189
+ };
190
+
191
+ window.STX.onDestroy = function(hook) {
192
+ if (currentInstance) currentInstance.destroyHooks.push(hook);
193
+ };
194
+
195
+ window.STX.onUpdate = function(hook) {
196
+ if (currentInstance) currentInstance.updateHooks.push(hook);
197
+ };
198
+
199
+ // Aliases
200
+ window.STX.onMounted = window.STX.onMount;
201
+ window.STX.onUnmounted = window.STX.onDestroy;
202
+ window.STX.onUpdated = window.STX.onUpdate;
203
+
204
+ // Refs
205
+ window.STX.ref = function(initialValue) {
206
+ const r = { value: initialValue || null };
207
+ Object.defineProperty(r, 'current', {
208
+ get: function() { return this.value; }
209
+ });
210
+ if (currentInstance) {
211
+ currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
212
+ }
213
+ return r;
214
+ };
215
+
216
+ // Watch
217
+ window.STX.watch = function(source, callback, options) {
218
+ options = options || {};
219
+ let oldValue;
220
+ let cleanup;
221
+ let isActive = true;
222
+
223
+ function run() {
224
+ if (!isActive) return;
225
+ const newValue = source();
226
+ if (oldValue !== newValue || options.immediate) {
227
+ if (cleanup) cleanup();
228
+ cleanup = callback(newValue, oldValue);
229
+ oldValue = newValue;
230
+ }
231
+ }
232
+
233
+ if (options.immediate) {
234
+ run();
235
+ }
236
+ else {
237
+ oldValue = source();
238
+ }
239
+
240
+ const intervalId = setInterval(run, 16);
241
+
242
+ function stop() {
243
+ isActive = false;
244
+ clearInterval(intervalId);
245
+ if (cleanup) cleanup();
246
+ }
247
+
248
+ if (currentInstance) {
249
+ currentInstance.watchers.push({ stop: stop });
250
+ currentInstance.destroyHooks.push(stop);
251
+ }
252
+
253
+ return stop;
254
+ };
255
+
256
+ // Computed
257
+ window.STX.computed = function(getter) {
258
+ let cached;
259
+ let dirty = true;
260
+ return {
261
+ get value() {
262
+ if (dirty) {
263
+ cached = getter();
264
+ dirty = false;
265
+ queueMicrotask(function() { dirty = true; });
266
+ }
267
+ return cached;
268
+ }
269
+ };
270
+ };
271
+
272
+ // Component management
273
+ window.STX.setupComponent = function(element, setup) {
274
+ const instance = createInstance(element);
275
+ currentInstance = instance;
276
+ try {
277
+ setup();
278
+ }
279
+ finally {
280
+ currentInstance = null;
281
+ }
282
+ return instance;
283
+ };
284
+
285
+ window.STX.mountComponent = function(instance) {
286
+ if (instance.isMounted) return;
287
+ instance.isMounted = true;
288
+ instance.mountHooks.forEach(function(hook) {
289
+ try {
290
+ const cleanup = hook();
291
+ if (typeof cleanup === 'function') {
292
+ instance.destroyHooks.push(cleanup);
293
+ }
294
+ else if (cleanup && typeof cleanup.then === 'function') {
295
+ cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
296
+ }
297
+ }
298
+ catch (e) {
299
+ console.error('[stx] onMount error:', e);
300
+ }
301
+ });
302
+ };
303
+
304
+ window.STX.destroyComponent = function(instance) {
305
+ if (!instance.isMounted) return;
306
+ instance.watchers.forEach(function(w) { w.stop(); });
307
+ instance.destroyHooks.forEach(function(hook) {
308
+ try { hook(); }
309
+ catch (e) { console.error('[stx] onDestroy error:', e); }
310
+ });
311
+ instance.refs.forEach(function(ref) { ref.value = null; });
312
+ instance.isMounted = false;
313
+ instances.delete(instance.id);
314
+ };
315
+
316
+ // ==========================================================================
317
+ // Vue-Style Refs System - No document.** required!
318
+ // ==========================================================================
319
+
320
+ // Internal: Query for ref elements without exposing document API
321
+ function queryRef(name, root) {
322
+ return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
323
+ }
324
+
325
+ function queryAllRefs(root) {
326
+ return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
327
+ }
328
+
329
+ // Auto-bind refs from ref attributes (Vue-style)
330
+ window.STX.bindRefs = function(root, refs) {
331
+ if (!root) return;
332
+ queryAllRefs(root).forEach(function(el) {
333
+ var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
334
+ if (refs[refName]) {
335
+ refs[refName].value = el;
336
+ }
337
+ });
338
+ };
339
+
340
+ // Vue-style useRefs() - returns object with all refs as direct elements
341
+ // Usage: const { input, button, container } = STX.useRefs()
342
+ window.STX.useRefs = function(root) {
343
+ var refs = {};
344
+ queryAllRefs(root).forEach(function(el) {
345
+ var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
346
+ if (refName) {
347
+ refs[refName] = el;
348
+ }
349
+ });
350
+ return refs;
351
+ };
352
+
353
+ // Get a single ref by name - Vue's useTemplateRef equivalent
354
+ // Usage: const input = STX.useRef('input')
355
+ window.STX.useRef = function(name, root) {
356
+ return queryRef(name, root);
357
+ };
358
+
359
+ // Two-way binding helper for form elements
360
+ // Usage: STX.model(inputEl, state, 'username')
361
+ window.STX.model = function(el, state, key) {
362
+ if (!el || !state) return;
363
+
364
+ var isCheckbox = el.type === 'checkbox';
365
+ var isRadio = el.type === 'radio';
366
+ var isSelect = el.tagName === 'SELECT';
367
+
368
+ // Set initial value
369
+ if (isCheckbox) {
370
+ el.checked = !!state[key];
371
+ }
372
+ else if (isRadio) {
373
+ el.checked = el.value === state[key];
374
+ }
375
+ else {
376
+ el.value = state[key] || '';
377
+ }
378
+
379
+ // Listen for changes
380
+ var eventType = isCheckbox || isRadio ? 'change' : 'input';
381
+ el.addEventListener(eventType, function() {
382
+ if (isCheckbox) {
383
+ state[key] = el.checked;
384
+ }
385
+ else if (isRadio) {
386
+ if (el.checked) state[key] = el.value;
387
+ }
388
+ else {
389
+ state[key] = el.value;
390
+ }
391
+ });
392
+
393
+ // Return cleanup function
394
+ return function() {
395
+ el.removeEventListener(eventType, arguments.callee);
396
+ };
397
+ };
398
+
399
+ // Batch event binding helper - cleaner than manual addEventListener
400
+ // Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
401
+ window.STX.on = function(el, event, handler) {
402
+ if (!el) return function() {};
403
+ el.addEventListener(event, handler);
404
+ return function() { el.removeEventListener(event, handler); };
405
+ };
406
+
407
+ // Bind multiple events at once
408
+ // Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
409
+ window.STX.events = function(el, eventMap) {
410
+ if (!el) return function() {};
411
+ var cleanups = [];
412
+ Object.keys(eventMap).forEach(function(event) {
413
+ el.addEventListener(event, eventMap[event]);
414
+ cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
415
+ });
416
+ return function() { cleanups.forEach(function(c) { c(); }); };
417
+ };
418
+
419
+ // ==========================================================================
420
+ // DOM Helpers - Eliminate document.* usage
421
+ // ==========================================================================
422
+
423
+ // Global keyboard event listener
424
+ // Usage: STX.onKey('Escape', () => closeModal())
425
+ window.STX.onKey = function(key, handler, options) {
426
+ var listener = function(e) {
427
+ if (e.key === key) {
428
+ handler(e);
429
+ }
430
+ };
431
+ document.addEventListener('keydown', listener, options);
432
+ return function() { document.removeEventListener('keydown', listener, options); };
433
+ };
434
+
435
+ // Create element helper
436
+ // Usage: STX.el('div', { class: 'foo' }, 'text content')
437
+ window.STX.el = function(tag, attrs, content) {
438
+ var el = document.createElement(tag);
439
+ if (attrs) {
440
+ Object.keys(attrs).forEach(function(key) {
441
+ if (key === 'class') {
442
+ el.className = attrs[key];
443
+ }
444
+ else if (key.startsWith('on')) {
445
+ el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
446
+ }
447
+ else {
448
+ el.setAttribute(key, attrs[key]);
449
+ }
450
+ });
451
+ }
452
+ if (content) {
453
+ if (typeof content === 'string') {
454
+ el.textContent = content;
455
+ }
456
+ else if (Array.isArray(content)) {
457
+ content.forEach(function(child) { el.appendChild(child); });
458
+ }
459
+ else {
460
+ el.appendChild(content);
461
+ }
462
+ }
463
+ return el;
464
+ };
465
+
466
+ // Get currently focused element
467
+ // Usage: const focused = STX.activeElement()
468
+ window.STX.activeElement = function() {
469
+ return document.activeElement;
470
+ };
471
+
472
+ // Escape HTML helper
473
+ // Usage: const safe = STX.escapeHtml(userInput)
474
+ window.STX.escapeHtml = function(text) {
475
+ var div = document.createElement('div');
476
+ div.textContent = text;
477
+ return div.innerHTML;
478
+ };
479
+
480
+ // MutationObserver for automatic lifecycle management
481
+ const observer = new MutationObserver(function(mutations) {
482
+ mutations.forEach(function(mutation) {
483
+ // Handle removed nodes
484
+ mutation.removedNodes.forEach(function(node) {
485
+ if (node.nodeType === 1 && node.__stx_instance__) {
486
+ window.STX.destroyComponent(node.__stx_instance__);
487
+ }
488
+ });
489
+ });
490
+ });
491
+
492
+ // Start observing when DOM is ready
493
+ if (document.readyState === 'loading') {
494
+ document.addEventListener('DOMContentLoaded', function() {
495
+ observer.observe(document.body, { childList: true, subtree: true });
496
+ });
497
+ }
498
+ else {
499
+ observer.observe(document.body, { childList: true, subtree: true });
500
+ }
501
+
502
+ console.log('[stx] Lifecycle runtime initialized');
503
+ })();
504
+ `}function pl(v){return Symbol(v)}var a_=pl("theme"),c_=pl("router"),l_=pl("i18n");import*as Ff from"crypto";function Wf(v){let _=/\$(\w+)\./g,k=[],R;while((R=_.exec(v))!==null)if(!k.includes(R[1]))k.push(R[1]);return k}function Hy(){return`stx-${Ff.randomBytes(4).toString("hex")}`}function qy(v){return/\$\w+\./.test(v)}function Ky(v){if(!v.includes("{{")||!/\$\w+\./.test(v))return{html:v,bindings:[],stores:new Set};let _=[],k=new Set,R=/<(\w+)([^>]*?)(\s*\/?>)/g,T=v;return T=T.replace(R,(B,z,W,F)=>{if(["script","style","template"].includes(z.toLowerCase()))return B;let U=[],H=!1,q=W,Q=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ie=[...W.matchAll(Q)];for(let le of ie){let ce=le[0],de=le[1],ue=le[2];if(qy(ue)){H=!0;let $e=ue.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if($e){let we=$e[1];if(U.push({attr:de,expr:we,fullMatch:ce,originalAttr:de}),Wf(we).forEach((Pe)=>k.add(Pe)),de==="text")q=q.replace(ce,"");else if(de==="class")q=q.replace(ce,'class=""');else if(de==="disabled"||de==="hidden")q=q.replace(ce,"");else q=q.replace(ce,`${de}=""`)}}}if(!H)return B;let Z=q.match(/\bid\s*=\s*"([^"]+)"/),ae;if(Z)ae=Z[1];else ae=Hy(),q=` id="${ae}"${q}`;for(let le of U)_.push({elementId:ae,attribute:le.attr,expression:le.expr,stores:Wf(le.expr)});return`<${z}${q}${F}`}),{html:T,bindings:_,stores:k}}function Xy(v,_){if(v.length===0)return"";let k=Array.from(_),R=`
505
+ <script>
506
+ (function() {
507
+ 'use strict';
508
+
509
+ // Wait for stores to be available
510
+ function initBindings() {
511
+ var stores = window.VoideStores;
512
+ if (!stores) {
513
+ setTimeout(initBindings, 10);
514
+ return;
515
+ }
516
+
517
+ // Store references for expressions
518
+ // eslint-disable-next-line pickier/no-unused-vars
519
+ var $state = {};
520
+ `;for(let T of k)R+=` $state.${T} = stores.${T} ? stores.${T}.get() : {};
521
+ `;R+=`
522
+ // Binding update functions
523
+ function updateBindings() {
524
+ `;for(let T of v){let{elementId:B,attribute:z,expression:W}=T,F=W.replace(/\$(\w+)\./g,"$state.$1.");if(z==="text")R+=` (function() {
525
+ var el = document.getElementById('${B}');
526
+ if (el) {
527
+ try {
528
+ el.textContent = ${F};
529
+ }
530
+ catch (e) { console.error('Binding error:', e); }
531
+ }
532
+ })();
533
+ `;else if(z==="html")R+=` (function() {
534
+ var el = document.getElementById('${B}');
535
+ if (el) {
536
+ try {
537
+ el.innerHTML = ${F};
538
+ }
539
+ catch (e) { console.error('Binding error:', e); }
540
+ }
541
+ })();
542
+ `;else if(z==="class")R+=` (function() {
543
+ var el = document.getElementById('${B}');
544
+ if (el) {
545
+ try {
546
+ var value = ${F};
547
+ if (typeof value === 'string') {
548
+ // Dynamic class string - merge with existing static classes
549
+ // eslint-disable-next-line pickier/no-unused-vars
550
+ var staticClasses = el.getAttribute('data-static-class') || el.className;
551
+ if (!el.hasAttribute('data-static-class')) {
552
+ el.setAttribute('data-static-class', el.className);
553
+ }
554
+ el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
555
+ }
556
+ else if (typeof value === 'object') {
557
+ // Object syntax: { 'class-name': condition }
558
+ for (var cls in value) {
559
+ if (value[cls]) {
560
+ el.classList.add(cls);
561
+ }
562
+ else {
563
+ el.classList.remove(cls);
564
+ }
565
+ }
566
+ }
567
+ }
568
+ catch (e) { console.error('Binding error:', e); }
569
+ }
570
+ })();
571
+ `;else if(z==="show")R+=` (function() {
572
+ var el = document.getElementById('${B}');
573
+ if (el) {
574
+ try {
575
+ el.style.display = (${F}) ? '' : 'none';
576
+ }
577
+ catch (e) { console.error('Binding error:', e); }
578
+ }
579
+ })();
580
+ `;else if(z==="if")R+=` (function() {
581
+ var el = document.getElementById('${B}');
582
+ if (el) {
583
+ try {
584
+ el.style.visibility = (${F}) ? 'visible' : 'hidden';
585
+ }
586
+ catch (e) { console.error('Binding error:', e); }
587
+ }
588
+ })();
589
+ `;else R+=` (function() {
590
+ var el = document.getElementById('${B}');
591
+ if (el) {
592
+ try {
593
+ var value = ${F};
594
+ if (value === false || value === null || value === undefined) {
595
+ el.removeAttribute('${z}');
596
+ }
597
+ else if (value === true) {
598
+ el.setAttribute('${z}', '');
599
+ }
600
+ else {
601
+ el.setAttribute('${z}', value);
602
+ }
603
+ }
604
+ catch (e) { console.error('Binding error:', e); }
605
+ }
606
+ })();
607
+ `}R+=` }
608
+
609
+ // Subscribe to stores and update on changes. Capture the disposers so
610
+ // SPA fragment swaps can tear down old bindings before the next page's
611
+ // runtime takes over \u2014 without this, every navigation between pages
612
+ // using reactive-bindings stacked another subscription on every store,
613
+ // walking detached DOM forever. See stacksjs/stx#1709.
614
+ var _disposers = [];
615
+ `;for(let T of k)R+=` if (stores.${T}) {
616
+ var _unsub_${T} = stores.${T}.subscribe(function(state) {
617
+ $state.${T} = state;
618
+ updateBindings();
619
+ });
620
+ // store.subscribe() may return the disposer (preferred) or void; both
621
+ // are tolerated here.
622
+ if (typeof _unsub_${T} === 'function') _disposers.push(_unsub_${T});
623
+ }
624
+ `;return R+=`
625
+ // Initial update
626
+ updateBindings();
627
+
628
+ // Register this runtime's cleanup so SPA navigation can run it before
629
+ // swapping pages. The router (and any code) can call
630
+ // window.__stxCleanupBindings() to dispose subscriptions; we also wire
631
+ // 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
632
+ function _cleanup() {
633
+ for (var i = 0; i < _disposers.length; i++) {
634
+ try { _disposers[i](); } catch (e) { /* swallow */ }
635
+ }
636
+ _disposers.length = 0;
637
+ }
638
+ if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
639
+ window.__stxBindingsCleanups.push(_cleanup);
640
+ if (!window.__stxCleanupBindings) {
641
+ window.__stxCleanupBindings = function() {
642
+ var fns = window.__stxBindingsCleanups || [];
643
+ for (var i = 0; i < fns.length; i++) {
644
+ try { fns[i](); } catch (e) { /* swallow */ }
645
+ }
646
+ window.__stxBindingsCleanups = [];
647
+ };
648
+ window.addEventListener('popstate', window.__stxCleanupBindings);
649
+ window.addEventListener('beforeunload', window.__stxCleanupBindings);
650
+ }
651
+ }
652
+
653
+ // Start when DOM is ready
654
+ if (document.readyState === 'loading') {
655
+ document.addEventListener('DOMContentLoaded', initBindings);
656
+ }
657
+ else {
658
+ initBindings();
659
+ }
660
+ })();
661
+ </script>
662
+ `,R}function Vf(v){let{html:_,bindings:k,stores:R}=Ky(v);if(k.length===0)return v;let T=Xy(k,R),B=_.lastIndexOf("</body>");if(B!==-1)return _.slice(0,B)+T+_.slice(B);return _+T}function Zy(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return Gy(_);case"google-analytics":return Jy(_);case"plausible":return Yy(_);case"self-hosted":return Qy(_);case"custom":return ex(_);default:return""}}function Gy(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",R=_.defer!==!1?" defer":"",T=[`data-site="${pn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${pn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
663
+ <!-- Fathom Analytics -->
664
+ <script src="${pn(k)}" ${T.join(" ")}${R}></script>
665
+ `}function Jy(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=pn(_.measurementId),R=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
666
+ <!-- Google Analytics -->
667
+ <script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
668
+ <script>
669
+ window.dataLayer = window.dataLayer || [];
670
+ function gtag(){dataLayer.push(arguments);}
671
+ gtag('js', new Date());
672
+ gtag('config', '${k}');
673
+ ${R}
674
+ </script>
675
+ `}function Yy(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",R=[`data-domain="${pn(_.domain)}"`],T=k,B=[];if(_.trackLocalhost)B.push("local");if(_.hashMode)B.push("hash");if(B.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${B.join(".")}.js`;return`
676
+ <!-- Plausible Analytics -->
677
+ <script defer data-domain="${pn(_.domain)}" src="${pn(T)}"></script>
678
+ `}function Qy(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=pn(_.siteId),R=pn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",B=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",z=_.trackOutboundLinks?`
679
+ d.addEventListener('click',function(e){
680
+ var a=e.target.closest('a');
681
+ if(a&&a.hostname!==location.hostname){
682
+ t('outbound',{url:a.href});
683
+ }
684
+ });`:"";return`
685
+ <!-- Self-Hosted Analytics -->
686
+ <script data-site="${k}" data-api="${R}" defer>
687
+ (function(){
688
+ 'use strict';
689
+ var d=document,w=window,n=navigator,s=d.currentScript;
690
+ var site=s.dataset.site,api=s.dataset.api;
691
+ ${T}
692
+ var q=[],sid=Math.random().toString(36).slice(2);
693
+ function t(e,p){
694
+ var x=new XMLHttpRequest();
695
+ x.open('POST',api+'/collect',true);
696
+ x.setRequestHeader('Content-Type','application/json');
697
+ x.send(JSON.stringify({
698
+ s:site,sid:sid,e:e,p:p||{},
699
+ u:location.href,r:d.referrer,t:d.title,
700
+ sw:screen.width,sh:screen.height
701
+ }));
702
+ }
703
+ function pv(){t('pageview');}
704
+ ${B}
705
+ ${z}
706
+ if(d.readyState==='complete')pv();
707
+ else w.addEventListener('load',pv);
708
+ w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
709
+ })();
710
+ </script>
711
+ `}function ex(v){let _=v.custom;if(!_)return"";if(_.inlineScript)return`
712
+ <!-- Custom Analytics -->
713
+ <script>
714
+ ${_.inlineScript}
715
+ </script>
716
+ `;if(!_.scriptUrl)return"";let k=[];if(_.scriptId)k.push(`id="${pn(_.scriptId)}"`);if(_.attributes)for(let[T,B]of Object.entries(_.attributes))k.push(`${pn(T)}="${pn(B)}"`);return`
717
+ <!-- Custom Analytics -->
718
+ <script${k.length>0?` ${k.join(" ")}`:""} src="${pn(_.scriptUrl)}" defer></script>
719
+ `}function Uf(v,_){let k=Zy(_);if(!k)return v;if(!v.includes("</head>")){let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}return v.replace("</head>",`${k}</head>`)}function pn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var tx={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Hf(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...tx,..._};return`
720
+ <!-- stx Heatmap - Privacy-Compliant Tracking -->
721
+ <script>
722
+ (function() {
723
+ 'use strict';
724
+
725
+ // Configuration
726
+ var config = ${JSON.stringify({trackMouse:k.trackMouse,trackClicks:k.trackClicks,trackScroll:k.trackScroll,samplingRate:k.samplingRate,honorDnt:k.honorDnt,endpoint:k.endpoint,batchSize:k.batchSize,maxDataPoints:k.maxDataPoints,sessionTimeout:k.sessionTimeout,persistData:k.persistData,storagePrefix:k.storagePrefix,captureAttributes:k.captureAttributes,ignoreSelectors:k.ignoreSelectors,zones:k.zones,debugOverlay:k.debugOverlay,minViewportWidth:k.minViewportWidth,maxViewportWidth:k.maxViewportWidth})};
727
+
728
+ // Check Do Not Track
729
+ if (config.honorDnt && navigator.doNotTrack === '1') {
730
+ return;
731
+ }
732
+
733
+ // Check viewport constraints
734
+ var vw = window.innerWidth;
735
+ if (config.minViewportWidth && vw < config.minViewportWidth) return;
736
+ if (config.maxViewportWidth && vw > config.maxViewportWidth) return;
737
+
738
+ // Session management (anonymous, no cookies)
739
+ var session = {
740
+ sid: Math.random().toString(36).slice(2) + Date.now().toString(36),
741
+ page: location.pathname,
742
+ vw: window.innerWidth,
743
+ vh: window.innerHeight,
744
+ points: [],
745
+ started: Date.now(),
746
+ lastActivity: Date.now()
747
+ };
748
+
749
+ // Throttle helper
750
+ var lastMove = 0;
751
+ function throttle(fn, wait) {
752
+ return function() {
753
+ var now = Date.now();
754
+ if (now - lastMove >= wait) {
755
+ lastMove = now;
756
+ fn.apply(this, arguments);
757
+ }
758
+ };
759
+ }
760
+
761
+ // Get relative coordinates (percentage)
762
+ function getRelativeCoords(e) {
763
+ return {
764
+ x: Math.round((e.clientX / window.innerWidth) * 10000) / 100,
765
+ y: Math.round((e.clientY / window.innerHeight) * 10000) / 100
766
+ };
767
+ }
768
+
769
+ // Check if element should be ignored
770
+ function shouldIgnore(el) {
771
+ if (!el || !config.ignoreSelectors) return false;
772
+ for (var i = 0; i < config.ignoreSelectors.length; i++) {
773
+ if (el.matches && el.matches(config.ignoreSelectors[i])) return true;
774
+ if (el.closest && el.closest(config.ignoreSelectors[i])) return true;
775
+ }
776
+ return false;
777
+ }
778
+
779
+ // Get element selector (simplified, no IDs to preserve privacy)
780
+ function getSelector(el) {
781
+ if (!el || !el.tagName) return null;
782
+ var tag = el.tagName.toLowerCase();
783
+ var classes = el.className && typeof el.className === 'string'
784
+ ? '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.')
785
+ : '';
786
+ return tag + classes;
787
+ }
788
+
789
+ // Find zone for element
790
+ function findZone(el) {
791
+ if (!config.zones || !el) return null;
792
+ for (var i = 0; i < config.zones.length; i++) {
793
+ var zone = config.zones[i];
794
+ if (el.closest && el.closest(zone.selector)) {
795
+ return zone.id;
796
+ }
797
+ }
798
+ return null;
799
+ }
800
+
801
+ // Capture custom attributes
802
+ function captureAttributes(el) {
803
+ if (!config.captureAttributes || !el) return null;
804
+ var attrs = {};
805
+ var hasAttrs = false;
806
+ for (var i = 0; i < config.captureAttributes.length; i++) {
807
+ var attr = config.captureAttributes[i];
808
+ var value = el.getAttribute && el.getAttribute(attr);
809
+ if (value) {
810
+ attrs[attr] = value;
811
+ hasAttrs = true;
812
+ }
813
+ }
814
+ return hasAttrs ? attrs : null;
815
+ }
816
+
817
+ // Add data point
818
+ function addPoint(point) {
819
+ session.lastActivity = Date.now();
820
+ if (session.points.length >= config.maxDataPoints) {
821
+ session.points.shift();
822
+ }
823
+ session.points.push(point);
824
+
825
+ // Send batch if threshold reached
826
+ if (config.endpoint && session.points.length >= config.batchSize) {
827
+ sendData();
828
+ }
829
+ }
830
+
831
+ // Send data to endpoint
832
+ function sendData() {
833
+ if (!config.endpoint || session.points.length === 0) return;
834
+
835
+ var data = {
836
+ sid: session.sid,
837
+ page: session.page,
838
+ vw: session.vw,
839
+ vh: session.vh,
840
+ points: session.points.splice(0, config.batchSize)
841
+ };
842
+
843
+ // Use sendBeacon for reliability
844
+ if (navigator.sendBeacon) {
845
+ navigator.sendBeacon(config.endpoint, JSON.stringify(data));
846
+ }
847
+ else {
848
+ var xhr = new XMLHttpRequest();
849
+ xhr.open('POST', config.endpoint, true);
850
+ xhr.setRequestHeader('Content-Type', 'application/json');
851
+ xhr.send(JSON.stringify(data));
852
+ }
853
+ }
854
+
855
+ // Mouse move handler
856
+ if (config.trackMouse) {
857
+ document.addEventListener('mousemove', throttle(function(e) {
858
+ if (shouldIgnore(e.target)) return;
859
+ var coords = getRelativeCoords(e);
860
+ addPoint({
861
+ x: coords.x,
862
+ y: coords.y,
863
+ type: 'move',
864
+ t: Date.now(),
865
+ zone: findZone(e.target)
866
+ });
867
+ }, config.samplingRate), { passive: true });
868
+ }
869
+
870
+ // Click handler
871
+ if (config.trackClicks) {
872
+ document.addEventListener('click', function(e) {
873
+ if (shouldIgnore(e.target)) return;
874
+ var coords = getRelativeCoords(e);
875
+ var point = {
876
+ x: coords.x,
877
+ y: coords.y,
878
+ type: 'click',
879
+ t: Date.now(),
880
+ el: getSelector(e.target),
881
+ zone: findZone(e.target)
882
+ };
883
+ var attrs = captureAttributes(e.target);
884
+ if (attrs) point.attrs = attrs;
885
+ addPoint(point);
886
+ }, { passive: true });
887
+ }
888
+
889
+ // Scroll handler
890
+ if (config.trackScroll) {
891
+ var lastScrollDepth = 0;
892
+ document.addEventListener('scroll', throttle(function() {
893
+ var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
894
+ var scrollHeight = document.documentElement.scrollHeight - window.innerHeight;
895
+ var depth = scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;
896
+
897
+ // Only track significant scroll changes (every 10%)
898
+ if (Math.abs(depth - lastScrollDepth) >= 10) {
899
+ lastScrollDepth = depth;
900
+ addPoint({
901
+ x: 50,
902
+ y: depth,
903
+ type: 'scroll',
904
+ t: Date.now(),
905
+ depth: depth
906
+ });
907
+ }
908
+ }, config.samplingRate * 2), { passive: true });
909
+ }
910
+
911
+ // Send remaining data on page unload
912
+ window.addEventListener('beforeunload', sendData);
913
+ window.addEventListener('visibilitychange', function() {
914
+ if (document.visibilityState === 'hidden') {
915
+ sendData();
916
+ }
917
+ });
918
+
919
+ // Persist data to localStorage if enabled
920
+ if (config.persistData) {
921
+ var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
922
+
923
+ // Load existing data
924
+ try {
925
+ var stored = localStorage.getItem(storageKey);
926
+ if (stored) {
927
+ var parsed = JSON.parse(stored);
928
+ if (Date.now() - parsed.lastActivity < config.sessionTimeout * 60000) {
929
+ session.points = parsed.points || [];
930
+ }
931
+ }
932
+ }
933
+ catch (e) {}
934
+
935
+ // Save periodically
936
+ setInterval(function() {
937
+ try {
938
+ localStorage.setItem(storageKey, JSON.stringify({
939
+ points: session.points,
940
+ lastActivity: session.lastActivity
941
+ }));
942
+ }
943
+ catch (e) {}
944
+ }, 5000);
945
+ }
946
+
947
+ // Debug overlay
948
+ if (config.debugOverlay) {
949
+ var overlay = document.createElement('div');
950
+ overlay.id = 'stx-heatmap-overlay';
951
+ overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:999999;';
952
+ document.body.appendChild(overlay);
953
+
954
+ var canvas = document.createElement('canvas');
955
+ canvas.width = window.innerWidth;
956
+ canvas.height = window.innerHeight;
957
+ canvas.style.cssText = 'width:100%;height:100%;';
958
+ overlay.appendChild(canvas);
959
+ var ctx = canvas.getContext('2d');
960
+
961
+ function renderOverlay() {
962
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
963
+ session.points.forEach(function(p) {
964
+ var x = (p.x / 100) * canvas.width;
965
+ var y = (p.y / 100) * canvas.height;
966
+ ctx.beginPath();
967
+ ctx.arc(x, y, p.type === 'click' ? 8 : 3, 0, Math.PI * 2);
968
+ ctx.fillStyle = p.type === 'click' ? 'rgba(255,0,0,0.5)' : 'rgba(0,0,255,0.2)';
969
+ ctx.fill();
970
+ });
971
+ requestAnimationFrame(renderOverlay);
972
+ }
973
+ renderOverlay();
974
+
975
+ window.addEventListener('resize', function() {
976
+ canvas.width = window.innerWidth;
977
+ canvas.height = window.innerHeight;
978
+ });
979
+ }
980
+
981
+ // Expose API for manual tracking and data export
982
+ window.stxHeatmap = {
983
+ // Get current session data
984
+ getData: function() {
985
+ return {
986
+ sid: session.sid,
987
+ page: session.page,
988
+ vw: session.vw,
989
+ vh: session.vh,
990
+ points: session.points.slice(),
991
+ started: session.started,
992
+ lastActivity: session.lastActivity
993
+ };
994
+ },
995
+ // Export data as JSON
996
+ exportJSON: function() {
997
+ return JSON.stringify(this.getData(), null, 2);
998
+ },
999
+ // Export data as CSV
1000
+ exportCSV: function() {
1001
+ var data = this.getData();
1002
+ var lines = ['x,y,type,timestamp,element,zone,depth'];
1003
+ data.points.forEach(function(p) {
1004
+ lines.push([p.x, p.y, p.type, p.t, p.el || '', p.zone || '', p.depth || ''].join(','));
1005
+ });
1006
+ return lines.join('\\n');
1007
+ },
1008
+ // Manual data send
1009
+ flush: function() {
1010
+ sendData();
1011
+ },
1012
+ // Clear data
1013
+ clear: function() {
1014
+ session.points = [];
1015
+ if (config.persistData) {
1016
+ var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
1017
+ try { localStorage.removeItem(storageKey); }
1018
+ catch (e) {}
1019
+ }
1020
+ },
1021
+ // Add custom event
1022
+ track: function(type, data) {
1023
+ addPoint({
1024
+ x: data && data.x || 0,
1025
+ y: data && data.y || 0,
1026
+ type: type,
1027
+ t: Date.now(),
1028
+ attrs: data
1029
+ });
1030
+ },
1031
+ // Generate heatmap visualization
1032
+ visualize: function(options) {
1033
+ options = options || {};
1034
+ var data = this.getData();
1035
+ var width = options.width || data.vw;
1036
+ var height = options.height || data.vh;
1037
+ var radius = options.radius || 20;
1038
+ var blur = options.blur || 15;
1039
+ var maxOpacity = options.maxOpacity || 0.6;
1040
+
1041
+ var canvas = document.createElement('canvas');
1042
+ canvas.width = width;
1043
+ canvas.height = height;
1044
+ var ctx = canvas.getContext('2d');
1045
+
1046
+ // Create heat points
1047
+ data.points.forEach(function(p) {
1048
+ var x = (p.x / 100) * width;
1049
+ var y = (p.y / 100) * height;
1050
+ var intensity = p.type === 'click' ? 1 : 0.3;
1051
+
1052
+ var gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
1053
+ gradient.addColorStop(0, 'rgba(255,0,0,' + intensity + ')');
1054
+ gradient.addColorStop(1, 'rgba(255,0,0,0)');
1055
+ ctx.fillStyle = gradient;
1056
+ ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
1057
+ });
1058
+
1059
+ // Apply blur
1060
+ ctx.filter = 'blur(' + blur + 'px)';
1061
+ ctx.drawImage(canvas, 0, 0);
1062
+ ctx.filter = 'none';
1063
+
1064
+ // Colorize
1065
+ var imageData = ctx.getImageData(0, 0, width, height);
1066
+ var pixels = imageData.data;
1067
+ for (var i = 0; i < pixels.length; i += 4) {
1068
+ var alpha = pixels[i + 3];
1069
+ if (alpha > 0) {
1070
+ var ratio = alpha / 255;
1071
+ // Gradient: blue -> cyan -> green -> yellow -> red
1072
+ if (ratio < 0.25) {
1073
+ pixels[i] = 0;
1074
+ pixels[i + 1] = Math.round(ratio * 4 * 255);
1075
+ pixels[i + 2] = 255;
1076
+ }
1077
+ else if (ratio < 0.5) {
1078
+ pixels[i] = 0;
1079
+ pixels[i + 1] = 255;
1080
+ pixels[i + 2] = Math.round((1 - (ratio - 0.25) * 4) * 255);
1081
+ }
1082
+ else if (ratio < 0.75) {
1083
+ pixels[i] = Math.round((ratio - 0.5) * 4 * 255);
1084
+ pixels[i + 1] = 255;
1085
+ pixels[i + 2] = 0;
1086
+ }
1087
+ else {
1088
+ pixels[i] = 255;
1089
+ pixels[i + 1] = Math.round((1 - (ratio - 0.75) * 4) * 255);
1090
+ pixels[i + 2] = 0;
1091
+ }
1092
+ pixels[i + 3] = Math.round(alpha * maxOpacity);
1093
+ }
1094
+ }
1095
+ ctx.putImageData(imageData, 0, 0);
1096
+
1097
+ return canvas;
1098
+ }
1099
+ };
1100
+ })();
1101
+ </script>
1102
+ `}function qf(v,_){let k=Hf(_);if(!k)return v;let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}var Kf={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(v,_,k,R)=>{let T=k.__stx_config||{};if(_.length>0){let B=nx(_.join(" "));T.heatmap={...T.heatmap,...B,enabled:!0}}return Hf(T)}};function nx(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let R of k){let[T,B]=R.split("="),z=B?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=z;break;case"samplingRate":_.samplingRate=Number.parseInt(z,10);break;case"batchSize":_.batchSize=Number.parseInt(z,10);break;case"trackMouse":_.trackMouse=z==="true";break;case"trackClicks":_.trackClicks=z==="true";break;case"trackScroll":_.trackScroll=z==="true";break;case"honorDnt":_.honorDnt=z==="true";break;case"debugOverlay":_.debugOverlay=z==="true";break}}return _}var er={duration:300,delay:0,ease:"ease",direction:"both"};function rx(v,_={}){let{duration:k,delay:R,ease:T,direction:B,custom:z}={...er,..._};if(v==="custom"&&z)return z;switch(v){case"fade":return`${B==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1103
+ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1104
+ @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${B==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1105
+ @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
1106
+ @keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${B==="in"?"transform: scale(0.95); opacity: 0; animation: scaleIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="out"?"transform: scale(1); opacity: 1; animation: scaleOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: scale(1); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1107
+ @keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
1108
+ @keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${B==="in"?"transform: perspective(400px) rotateX(-90deg); opacity: 0; animation: flipIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="out"?"transform: perspective(400px) rotateX(0); opacity: 1; animation: flipOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: perspective(400px) rotateX(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1109
+ @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1110
+ @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${B==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":B==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1111
+ @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1112
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function sx(){return`
1113
+ <script data-stx-scoped data-stx-run="once">
1114
+ // Motion preferences handling
1115
+ (function() {
1116
+ const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
1117
+
1118
+ if (prefersReducedMotion) {
1119
+ // Apply reduced motion settings
1120
+ document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
1121
+ document.documentElement.setAttribute('data-reduced-motion', 'true');
1122
+ }
1123
+ else {
1124
+ document.documentElement.setAttribute('data-reduced-motion', 'false');
1125
+ }
1126
+
1127
+ // Listen for changes in preference
1128
+ window.matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', (e) => {
1129
+ if (e.matches) {
1130
+ document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
1131
+ document.documentElement.setAttribute('data-reduced-motion', 'true');
1132
+ }
1133
+ else {
1134
+ document.documentElement.style.setProperty('--stx-transition-duration', '');
1135
+ document.documentElement.setAttribute('data-reduced-motion', 'false');
1136
+ }
1137
+ });
1138
+ })();
1139
+ </script>
1140
+ `}function ix(v){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((k)=>k.test(v))}function ox(v=0.1,_="0px"){return`
1141
+ <script data-stx-scoped data-stx-run="always">
1142
+ // Intersection Observer for scroll animations
1143
+ (function() {
1144
+ const initObserver = () => {
1145
+ if (!('IntersectionObserver' in window)) {
1146
+ // For browsers that don't support IntersectionObserver, show all elements immediately
1147
+ const elements = document.querySelectorAll('.stx-observe');
1148
+ elements.forEach(el => el.classList.remove('stx-out'));
1149
+ return;
1150
+ }
1151
+
1152
+ // Create the observer
1153
+ const options = {
1154
+ root: null, // Use viewport
1155
+ rootMargin: '${_}',
1156
+ threshold: ${v}
1157
+ };
1158
+
1159
+ const observer = new IntersectionObserver((entries) => {
1160
+ entries.forEach(entry => {
1161
+ if (entry.isIntersecting) {
1162
+ entry.target.classList.remove('stx-out');
1163
+ // Stop observing after animation is triggered
1164
+ observer.unobserve(entry.target);
1165
+ }
1166
+ });
1167
+ }, options);
1168
+
1169
+ // Start observing elements
1170
+ const elements = document.querySelectorAll('.stx-observe');
1171
+ elements.forEach(el => observer.observe(el));
1172
+ };
1173
+
1174
+ // Initialize observer when DOM is ready
1175
+ if (document.readyState === 'loading') {
1176
+ document.addEventListener('DOMContentLoaded', initObserver);
1177
+ }
1178
+ else {
1179
+ initObserver();
1180
+ }
1181
+ })();
1182
+ </script>
1183
+ `}function ax(){return`
1184
+ <style id="stx-animation-base">
1185
+ :root {
1186
+ --stx-transition-duration: 300ms;
1187
+ --stx-transition-delay: 0ms;
1188
+ --stx-transition-ease: ease;
1189
+ }
1190
+
1191
+ @media (prefers-reduced-motion: reduce) {
1192
+ :root {
1193
+ --stx-transition-duration: 0ms;
1194
+ }
1195
+ }
1196
+
1197
+ [data-animate="false"] * {
1198
+ --stx-transition-duration: 0ms !important;
1199
+ animation-duration: 0ms !important;
1200
+ transition-duration: 0ms !important;
1201
+ }
1202
+
1203
+ /* Base transition classes */
1204
+ .stx-transition {
1205
+ transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1206
+ transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1207
+ backface-visibility: hidden; /* Improve animation performance */
1208
+ transform-style: preserve-3d; /* Better 3D transforms */
1209
+ }
1210
+
1211
+ /* Fade animations */
1212
+ .stx-fade {
1213
+ transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1214
+ }
1215
+
1216
+ .stx-fade.stx-out {
1217
+ opacity: 0 !important;
1218
+ }
1219
+
1220
+ /* Scale animations */
1221
+ .stx-scale {
1222
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1223
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1224
+ }
1225
+
1226
+ .stx-scale.stx-out {
1227
+ transform: scale(0.85) !important;
1228
+ opacity: 0 !important;
1229
+ }
1230
+
1231
+ /* Flip animations */
1232
+ .stx-flip {
1233
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1234
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1235
+ perspective: 600px;
1236
+ }
1237
+
1238
+ .stx-flip.stx-out {
1239
+ transform: perspective(600px) rotateX(-90deg) !important;
1240
+ opacity: 0 !important;
1241
+ }
1242
+
1243
+ /* Rotate animations */
1244
+ .stx-rotate {
1245
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1246
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1247
+ }
1248
+
1249
+ .stx-rotate.stx-out {
1250
+ transform: rotate(-90deg) !important;
1251
+ opacity: 0 !important;
1252
+ }
1253
+
1254
+ /* Direction-based animations */
1255
+ .stx-from-left, .stx-from-right, .stx-from-top, .stx-from-bottom {
1256
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1257
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1258
+ }
1259
+
1260
+ .stx-from-left.stx-out {
1261
+ transform: translateX(-30px) !important;
1262
+ opacity: 0 !important;
1263
+ }
1264
+
1265
+ .stx-from-right.stx-out {
1266
+ transform: translateX(30px) !important;
1267
+ opacity: 0 !important;
1268
+ }
1269
+
1270
+ .stx-from-top.stx-out {
1271
+ transform: translateY(-30px) !important;
1272
+ opacity: 0 !important;
1273
+ }
1274
+
1275
+ .stx-from-bottom.stx-out {
1276
+ transform: translateY(30px) !important;
1277
+ opacity: 0 !important;
1278
+ }
1279
+
1280
+ /* Generic slide animations */
1281
+ .stx-slide {
1282
+ transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1283
+ opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1284
+ }
1285
+
1286
+ .stx-slide.stx-out {
1287
+ transform: translateY(30px) !important;
1288
+ opacity: 0 !important;
1289
+ }
1290
+
1291
+ /* Scroll animation observer class */
1292
+ .stx-observe {
1293
+ will-change: opacity, transform;
1294
+ transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1295
+ transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1296
+ }
1297
+ </style>
1298
+ `}function cx(v,_,k={}){let{staggerDelay:R=50,sequence:T=!1}=k;return`
1299
+ <script data-stx-scoped data-stx-run="always">
1300
+ // Animation Group: ${v}
1301
+ (function() {
1302
+ const elements = ${JSON.stringify(_)};
1303
+ const staggerDelay = ${R};
1304
+ const sequence = ${T};
1305
+
1306
+ function animateGroup() {
1307
+ elements.forEach((selector, index) => {
1308
+ const element = document.querySelector(selector);
1309
+ if (!element) return;
1310
+
1311
+ const delay = sequence ? index * staggerDelay : 0;
1312
+ element.style.setProperty('--stx-transition-delay', delay + 'ms');
1313
+
1314
+ // For elements using animation keyframes
1315
+ element.style.animationDelay = delay + 'ms';
1316
+
1317
+ // If the element is initially hidden, show it
1318
+ if (element.classList.contains('stx-out')) {
1319
+ setTimeout(() => {
1320
+ element.classList.remove('stx-out');
1321
+ }, 10); // Small delay to ensure styles are applied
1322
+ }
1323
+ });
1324
+ }
1325
+
1326
+ // Run when DOM is fully loaded
1327
+ if (document.readyState === 'loading') {
1328
+ document.addEventListener('DOMContentLoaded', animateGroup);
1329
+ }
1330
+ else {
1331
+ animateGroup();
1332
+ }
1333
+ })();
1334
+ </script>
1335
+ `}var Xf={name:"transition",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||er.duration:er.duration,z=_.length>2?_[2]||er.ease:er.ease,W=_.length>3?Number.parseInt(_[3],10)||er.delay:er.delay,F=_.length>4?_[4]||er.direction:er.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,H=rx(T,{duration:B,delay:W,ease:z,direction:F}),q="stx-transition",Q="";if(T==="fade")Q="stx-fade";else if(T==="slide")Q="stx-slide";else if(T==="scale")Q="stx-scale";else if(T==="flip")Q="stx-flip";else if(T==="rotate")Q="stx-rotate";return`<div id="${U}" class="${q} ${Q} ${F==="out"?"stx-out":""}"
1336
+ style="--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${W}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Zf={name:"scrollAnimate",handler:(v,_,k,R)=>{if(_.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${v}`;let T=_[0],B=_.length>1?Number.parseInt(_[1],10)||300:300,z=_.length>2?_[2]||"ease":"ease",W=_.length>3?Number.parseFloat(_[3])||0.2:0.2,F=_.length>4?Number.parseInt(_[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,H=`--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${F}ms; will-change: opacity, transform;`,q="stx-transition stx-observe stx-out";if(T==="fade")q+=" stx-fade";else if(T==="slide-up"||T==="slide")q+=" stx-from-bottom";else if(T==="slide-down")q+=" stx-from-top";else if(T==="slide-left")q+=" stx-from-right";else if(T==="slide-right")q+=" stx-from-left";else if(T==="scale")q+=" stx-scale";else if(T.includes("-"))q+=` stx-${T}`;else q+=` stx-${T}`;return`<div id="${U}" class="${q}" style="${H}" data-threshold="${W}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Gf={name:"animationGroup",handler:(v,_,k,R)=>{if(_.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${v}`;let T=_[0],B=_.slice(1).map((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),z=k.staggerDelay||50,W=k.sequence||!0,F=cx(T,B,{staggerDelay:z,sequence:W});return`${v}
1337
+ ${F}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Jf={name:"motion",handler:(v,_,k,R)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,B=sx();return`<div data-animate="${T?"auto":"true"}">${v}</div>${B}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function Yf(v,_,k,R){let T=v;if(R.animation?.enabled===!1)return T;let B=k.includes("test")&&k.includes("animation");if(!ix(T)&&!B)return T;if(!T.includes('<style id="stx-animation-base">')){let W=ax();T=T.replace("</head>",`${W}
1338
+ </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let F=ox(),U=T.lastIndexOf("</body>");if(U!==-1)T=T.slice(0,U)+F+`
1339
+ `+T.slice(U)}}return T}function Ke(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function Qf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var lx=100,ux=599,ml="__stxResponseStatus",lo="__stxResponseHeaders";function pa(v){return typeof v==="number"&&Number.isInteger(v)&&v>=lx&&v<=ux}function Mt(v){for(let _ of v.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let k=_[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!k)continue;let R=Number(k[1]);if(pa(R))return R}return}function gl(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!pa(k))return!1;return v[ml]=k,!0}function dx(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[lo]={...v[lo],[R]:String(k)}}function Xe(v){let _=v?.[ml];return pa(_)?_:void 0}function Je(v){let _=v?.[lo];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function gi(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Xe(v);if(k!==void 0)_[ml]=k;let R=Je(v);if(R)_[lo]={..._[lo],...R}}function or(v){return{setResponseStatus:(_)=>{gl(v,_)},notFound:(_=404)=>{let k=pa(_)&&_>=400?_:404;gl(v,k)},setResponseHeader:(_,k)=>{dx(v,_,k)}}}function ep(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,B=T==="compile",z="",W=0,F=/@status\s*\(/g,U;while((U=F.exec(v))!==null){let H=fx(v,U.index+U[0].length-1);if(H<0)break;let q=v.slice(U.index+U[0].length,H).trim(),Q=/^\d+$/.test(q)?Number(q):l(q,_),ie=R?` in ${R}`:"";if(B)console.warn(`[stx] @status(${q})${ie} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${q}) from <script server> instead \u2014 that runs per request.`);else if(!gl(_,Q))console.warn(`[stx] @status(${q})${ie} is not an HTTP status (100-599) \u2014 ignoring it.`);z+=v.slice(W,U.index),W=H+1+(v.slice(H+1).match(/^[^\S\n]*\n?/)?.[0].length??0),F.lastIndex=W}return W===0?v:z+v.slice(W)}function fx(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}var px=0,gx=0;function tp(v,_){let k=v.match(new RegExp(`${_}\\s*=\\s*"([^"]*)"`,"i"));if(k)return k[1];let R=v.match(new RegExp(`${_}\\s*=\\s*'([^']*)'`,"i"));if(R)return R[1];return null}function mx(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,R;while((R=k.exec(v))!==null){let[T,B,z]=R,W=R.index,F=tp(z,"x-data");if(!F)continue;let U=`__stx_scope_${px++}`,H=tp(z,"x-init"),q=hx(v,B,W+T.length),Q=v.slice(W,q.endIndex),ie=yx(Q);_.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:F,initExpr:H,bindings:[],refs:ie})}return _}function hx(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s|>)`,"gi"),z=new RegExp(`</${_}>`,"gi"),W=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T,W.lastIndex=T;let F=B.exec(v),U=z.exec(v),H=W.exec(v);if(H&&H.index<(F?.index??1/0)){T=H.index+H[0].length;continue}if(!U)return{endIndex:v.length};if(F&&F.index<U.index)R++,T=F.index+F[0].length;else{if(R--,R===0)return{endIndex:U.index+U[0].length};T=U.index+U[0].length}}return{endIndex:v.length}}function yx(v){let _=new Map,k=v.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),R=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,T;while((T=R.exec(k))!==null){let[,B,z]=T,W=xx(B);_.set(z,W)}return _}function xx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${gx++}`}function bx(){return`
1340
+ // STX Reactive Runtime - x-cloak and transition CSS
1341
+ (function() {
1342
+ var style = document.createElement('style');
1343
+ style.textContent = [
1344
+ '[x-cloak] { display: none !important; }',
1345
+ // Default transition classes
1346
+ '.stx-enter { opacity: 0; transform: scale(0.95); }',
1347
+ '.stx-enter-start { opacity: 0; transform: scale(0.95); }',
1348
+ '.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
1349
+ '.stx-enter-to { opacity: 1; transform: scale(1); }',
1350
+ '.stx-leave { opacity: 1; transform: scale(1); }',
1351
+ '.stx-leave-start { opacity: 1; transform: scale(1); }',
1352
+ '.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
1353
+ '.stx-leave-to { opacity: 0; transform: scale(0.95); }'
1354
+ ].join('\\n');
1355
+ document.head.appendChild(style);
1356
+ })();
1357
+
1358
+ // STX Reactive Runtime
1359
+ /* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
1360
+ window.__stx_reactive = (function() {
1361
+ 'use strict';
1362
+
1363
+ // Deep reactive proxy that triggers onChange for any mutation
1364
+ function reactive(obj, onChange) {
1365
+ if (!obj || typeof obj !== 'object') return obj;
1366
+ return new Proxy(obj, {
1367
+ get(target, prop) {
1368
+ const value = target[prop];
1369
+ if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
1370
+ return reactive(value, onChange);
1371
+ }
1372
+ return value;
1373
+ },
1374
+ set(target, prop, value) {
1375
+ target[prop] = value;
1376
+ onChange(prop, value);
1377
+ return true;
1378
+ }
1379
+ });
1380
+ }
1381
+
1382
+ // Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
1383
+ // then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
1384
+ function initScope(scopeEl, initialState, bindings, refs, initExpr) {
1385
+ // Parse initial state (may contain methods including async init())
1386
+ var state;
1387
+ try {
1388
+ state = new Function('return (' + initialState + ')')();
1389
+ } catch (e) {
1390
+ console.error('[stx-reactive] Invalid x-data:', initialState, e);
1391
+ return;
1392
+ }
1393
+
1394
+ // Build $refs object
1395
+ var $refs = {};
1396
+ for (var name in refs) {
1397
+ if (Object.prototype.hasOwnProperty.call(refs, name)) {
1398
+ (function(refName, refId) {
1399
+ Object.defineProperty($refs, refName, {
1400
+ get: function() { return document.getElementById(refId); }
1401
+ });
1402
+ })(name, refs[name]);
1403
+ }
1404
+ }
1405
+
1406
+ // Extract init method from state if present (Alpine.js convention)
1407
+ var initMethod = state.init;
1408
+ if (typeof initMethod === 'function') {
1409
+ delete state.init;
1410
+ }
1411
+
1412
+ // Make state reactive \u2014 mutations trigger re-render via signals
1413
+ var scopeId = scopeEl.getAttribute('data-stx-scope');
1414
+ var stx = window.stx;
1415
+
1416
+ // Create signals for each state property so the signals runtime can track dependencies
1417
+ var signalState = {};
1418
+ var rawState = {};
1419
+ var derivedState = {};
1420
+ var accessors = {};
1421
+ // A getter must NOT be read here. Reading one calls it, and the old loop did
1422
+ // exactly that: the returned value is not a function, so it was wrapped as a
1423
+ // plain state() -- a snapshot of the answer at construction time, frozen
1424
+ // forever while plain properties beside it updated (#2053). A getter is a
1425
+ // derived value, so it is registered as one below, once ctxProxy exists for
1426
+ // it to read through.
1427
+ var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
1428
+ for (var key in state) {
1429
+ if (Object.prototype.hasOwnProperty.call(state, key)) {
1430
+ var descriptor = ownDescriptors[key];
1431
+ if (descriptor && typeof descriptor.get === 'function') {
1432
+ accessors[key] = descriptor;
1433
+ continue;
1434
+ }
1435
+ if (typeof state[key] === 'function') {
1436
+ // Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
1437
+ signalState[key] = state[key];
1438
+ } else {
1439
+ // Data properties \u2014 wrap in signals for reactivity
1440
+ signalState[key] = stx.state(state[key]);
1441
+ rawState[key] = true;
1442
+ }
1443
+ }
1444
+ }
1445
+
1446
+ // Create a proxy context that auto-unwraps signals and writes back through them.
1447
+ // Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
1448
+ var ctx = {};
1449
+ var ctxProxy = new Proxy(ctx, {
1450
+ get: function(target, prop) {
1451
+ if (prop === '$refs') return $refs;
1452
+ if (prop === '$el') return scopeEl;
1453
+ if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
1454
+ var s = signalState[prop];
1455
+ if (!s) return undefined;
1456
+ if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
1457
+ return s.value; // unwrap signal
1458
+ }
1459
+ if (typeof s === 'function' && !rawState[prop]) {
1460
+ return s.bind(ctxProxy); // bind methods to proxy
1461
+ }
1462
+ return s;
1463
+ },
1464
+ set: function(target, prop, value) {
1465
+ var accessor = derivedState[prop];
1466
+ if (accessor) {
1467
+ // A getter/setter pair writes through its setter. A getter alone has
1468
+ // nowhere to put the value: a derived has no .value setter, so the
1469
+ // assignment would be a silent no-op, which is the same class of
1470
+ // failure as the stale read this replaces.
1471
+ if (typeof accessor.set === 'function') {
1472
+ accessor.set.call(ctxProxy, value);
1473
+ return true;
1474
+ }
1475
+ console.warn('[stx-reactive] cannot assign to ' + String(prop) + ': it is a getter in x-data, so its value comes from what it reads. Give it a setter, or make it a plain property.');
1476
+ return true;
1477
+ }
1478
+ var s = signalState[prop];
1479
+ if (rawState[prop] && s && typeof s === 'function') {
1480
+ s.value = value; // write through signal \u2014 triggers effects
1481
+ } else {
1482
+ signalState[prop] = value;
1483
+ }
1484
+ return true;
1485
+ },
1486
+ has: function(target, prop) {
1487
+ return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
1488
+ },
1489
+ ownKeys: function() {
1490
+ return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
1491
+ },
1492
+ getOwnPropertyDescriptor: function(target, prop) {
1493
+ if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
1494
+ return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
1495
+ }
1496
+ return undefined;
1497
+ }
1498
+ });
1499
+
1500
+ // Now that ctxProxy exists, a getter becomes a derived that reads through it,
1501
+ // so it tracks whatever it touches and recomputes when that changes. derived()
1502
+ // is lazy, so nothing is evaluated until a binding actually reads it.
1503
+ //
1504
+ // Marked rawState as well: that is what makes the proxy unwrap it and what
1505
+ // exposes the signal itself to the runtime below, which is where dependency
1506
+ // tracking comes from. A getter needs both, exactly like a data property.
1507
+ for (var accessorKey in accessors) {
1508
+ if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
1509
+ (function(name, descriptor) {
1510
+ signalState[name] = stx.derived(function() {
1511
+ return descriptor.get.call(ctxProxy);
1512
+ });
1513
+ rawState[name] = true;
1514
+ derivedState[name] = descriptor;
1515
+ })(accessorKey, accessors[accessorKey]);
1516
+ }
1517
+ }
1518
+
1519
+ // Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
1520
+ // We need to provide getter/setter descriptors so signals track properly.
1521
+ var scopeVars = {};
1522
+ for (var k in signalState) {
1523
+ if (Object.prototype.hasOwnProperty.call(signalState, k)) {
1524
+ if (rawState[k]) {
1525
+ // Data: expose the signal directly so expressions trigger dependency tracking
1526
+ scopeVars[k] = signalState[k];
1527
+ } else {
1528
+ // Method: bind to ctxProxy so 'this' works
1529
+ scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
1530
+ }
1531
+ }
1532
+ }
1533
+ scopeVars.$refs = $refs;
1534
+ scopeVars.$el = scopeEl;
1535
+ scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
1536
+
1537
+ // Register scope \u2014 merge with any existing vars from partial signal scripts
1538
+ if (!stx._scopes) stx._scopes = {};
1539
+ stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
1540
+
1541
+ // Store on element for findElementScope
1542
+ scopeEl.__stx_scope = scopeVars;
1543
+
1544
+ // Run init() if present (supports async)
1545
+ function runInit() {
1546
+ var maybePromise;
1547
+ if (initMethod) {
1548
+ maybePromise = initMethod.call(ctxProxy);
1549
+ }
1550
+ if (initExpr) {
1551
+ try {
1552
+ var keys = Object.keys(scopeVars);
1553
+ var vals = keys.map(function(k) { return scopeVars[k]; });
1554
+ var fn = new Function(keys.join(','), initExpr);
1555
+ var result = fn.apply(ctxProxy, vals);
1556
+ if (result && typeof result.then === 'function') maybePromise = result;
1557
+ } catch (e) {
1558
+ console.warn('[stx-reactive] init expression error:', e);
1559
+ }
1560
+ }
1561
+ // If init is async, signal updates will trigger effects automatically
1562
+ // when init() resolves and sets this.prop = value (writes through signal)
1563
+ if (maybePromise && typeof maybePromise.then === 'function') {
1564
+ maybePromise.catch(function(e) {
1565
+ console.error('[stx-reactive] async init() error:', e);
1566
+ });
1567
+ }
1568
+ }
1569
+
1570
+ // Run init before the signals runtime processes this scope
1571
+ runInit();
1572
+
1573
+ // Expose for debugging
1574
+ scopeEl.__stx_state = ctxProxy;
1575
+ scopeEl.__stx_execute = function(stmt, $event, $el) {
1576
+ try {
1577
+ // Run the statement with the reactive proxy as the lexical scope.
1578
+ // Wrapping in a with-block on the proxy makes bare reads/writes go
1579
+ // through it (so foo = bar triggers signal.set()) instead of treating
1580
+ // each state key as a local function parameter \u2014 bare assignments
1581
+ // would otherwise just rebind the local and never reach the signal.
1582
+ var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
1583
+ fn.call(ctxProxy, $event, $el);
1584
+ } catch (e) {
1585
+ console.warn('[stx-reactive] execute error:', e);
1586
+ }
1587
+ };
1588
+ }
1589
+
1590
+ return { initScope: initScope, reactive: reactive };
1591
+ })();
1592
+ `}function np(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(W,F)=>{try{let U=x(F,_,!0);if(U===void 0)return W;return String(U)}catch{return W}}),R="",T=0,B=null;while(T<k.length){let W=k[T];if(B&&W==="\\"){R+=W+(k[T+1]??""),T+=2;continue}if(W==="{"&&k[T+1]==="{"){let F=k.indexOf("}}",T+2);if(F!==-1){let U=k.slice(T,F+2);R+=z(k.slice(T+2,F),U,B),T=F+2;continue}}if(B){if(W===B)B=null}else if(W==="'"||W==='"'||W==="`")B=W;R+=W,T++}return R;function z(W,F,U){let H;try{H=x(W,_,!0)}catch{return F}if(H===void 0)return F;if(U){let q=String(H).replace(/\\/g,"\\\\").replace(new RegExp(U==="`"?"`":U,"g"),`\\${U}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return U==="`"?q.replace(/\$\{/g,"\\${"):q}if(typeof H==="string"){let q=H.trim();if(q.startsWith("{")&&q.endsWith("}")||q.startsWith("[")&&q.endsWith("]"))try{return JSON.parse(q),q}catch{}}return JSON.stringify(H)}}function vx(v,_){if(v.length===0)return"";let k=v.map((R)=>{let T=JSON.stringify(Object.fromEntries(R.refs)),B=np(R.stateExpr,_),z=R.initExpr?np(R.initExpr,_):null,W=JSON.stringify(B),F=z?JSON.stringify(z):"null";return`
1593
+ (function() {
1594
+ var scopeEl = document.querySelector('${R.selector}');
1595
+ if (!scopeEl) return;
1596
+ var refs = ${T};
1597
+ __stx_reactive.initScope(scopeEl, ${W}, [], refs, ${F});
1598
+ })();`}).join(`
1599
+ `);return`
1600
+ <script data-stx-scoped data-stx-reactive data-stx-run="always">
1601
+ ${bx()}
1602
+ ${k}
1603
+ </script>`}function rp(v,_,k){if(!Sx(v))return v;let R=mx(v);if(R.length===0)return v;let T=wx(v,R),B=vx(R,_),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
1604
+ `+T.slice(z);else T+=B;return T}function wx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let W=_[k++];if(!W)return T;let F=/data-stx-scope="([^"]*)"/.exec(z);if(F)return W.id=F[1],W.selector=`[data-stx-scope="${W.id}"]`,T;return`<${B} data-stx-scope="${W.id}"${z}>`});return R=R.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),R=R.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),R=R.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),R=R.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),R}function Sx(v){return/x-data\s*=\s*["']/.test(v)}import ob from"fs";import Rl from"path";import{createHighlighter as ab}from"ts-syntax-highlighter";import ds from"fs";import on from"path";import{loadConfigWithResult as eb}from"bunfig";async function $x(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Ie();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var sp={name:"stxRouter",handler:$x,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Tr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ip(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function tr(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let R=k[1],T=v.slice(k[0].length),B={};for(let z of R.split(`
1605
+ `)){let W=z.trim();if(!W||W.startsWith("#"))continue;let F=W.indexOf(":");if(F===-1)continue;let U=W.slice(0,F).trim(),H=W.slice(F+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}B[U]=H}return{data:B,content:T.trim()}}function Ue(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,B=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,q,Q)=>{let ie=B.length,Z=q?` class="language-${Tr(q)}"`:"";return B.push(`<pre><code${Z}>${Tr(Q.trim())}</code></pre>`),`\x00CODEBLOCK${ie}\x00`}),T=T.replace(/`([^`]*)`/g,(H,q)=>`<code>${Tr(q)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,q,Q)=>`<img src="${ip(Q)?Tr(Q):""}" alt="${Tr(q)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,q,Q)=>`<a href="${ip(Q)?Tr(Q):""}">${q}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
1606
+ `),T=T.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),T=T.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),T=T.replace(/<\/ul>\n<ul>/g,""),T=T.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),T=T.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),T=T.replace(/<\/ol>\n<ol>/g,""),T=T.replace(/<li data-ul>/g,"<li>"),T=T.replace(/<li data-ol>/g,"<li>"),k)T=T.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(H,q,Q)=>{let Z=`<tr>${q.split("|").map((le)=>le.trim()).filter(Boolean).map((le)=>`<th>${Tr(le)}</th>`).join("")}</tr>`,ae=Q.trim().split(`
1607
+ `).map((le)=>`<tr>${le.split("|").map((de)=>de.trim()).filter(Boolean).map((de)=>`<td>${Tr(de)}</td>`).join("")}</tr>`).join(`
1608
+ `);return`<table>
1609
+ <thead>
1610
+ ${Z}
1611
+ </thead>
1612
+ <tbody>
1613
+ ${ae}
1614
+ </tbody>
1615
+ </table>`});if(k)T=T.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),T=T.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let z=T.split(`
1616
+ `),W=[],F=!1,U=[];for(let H of z){let q=H.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(q)||/^\0CODEBLOCK\d+\0$/.test(q)||q===""){if(F&&U.length>0)W.push(`<p>${U.join(R?`<br />
1617
+ `:`
1618
+ `)}</p>`),U=[],F=!1;W.push(H)}else F=!0,U.push(q)}if(F&&U.length>0)W.push(`<p>${U.join(R?`<br />
1619
+ `:`
1620
+ `)}</p>`);if(T=W.join(`
1621
+ `),R)T=T.replace(/\n/g,`<br />
1622
+ `);for(let H=0;H<B.length;H++)T=T.replace(`\x00CODEBLOCK${H}\x00`,B[H]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}async function op(v,_,k=""){let R=v,T=[],B=/@markdown(?:\([^)]*\))?/g,z;while((z=B.exec(v))!==null){let W=z.index,F=z[0].match(/@markdown\(([^)]*)\)/),U=F?F[1]:"",H=W+z[0].length,q=1,Q=H,ie=-1;while(q>0&&Q<v.length){let le=v.indexOf("@markdown",Q),ce=v.indexOf("@endmarkdown",Q);if(ce===-1)break;if(le!==-1&&le<ce&&le!==W){let de=v[le+9];if(de==="("||de===`
1623
+ `||de==="\r"||de===" "||de===void 0)q++;Q=le+9}else{if(q--,q===0){ie=ce;break}Q=ce+12}}if(ie===-1)continue;let Z=v.slice(H,ie),ae=v.slice(W,ie+12);T.push({fullMatch:ae,options:U,content:Z,index:W}),B.lastIndex=ie+12}for(let{fullMatch:W,options:F,content:U,index:H}of T)try{let q={};if(F)F.split(",").forEach((Z)=>{let ae=Z.trim();if(ae)q[ae]=!0});let Q={gfm:q.gfm??!0,breaks:q.breaks??!1},ie=Ue(U.trim(),Q);R=R.split(W).join(ie)}catch(q){let Q=q instanceof Error?q.message:String(q),ie=g("Markdown Directive",`Error processing markdown: ${Q}`,k,v,H,W);R=R.split(W).join(ie)}return R}async function ap(v,_,k,R){let T={gfm:!0,breaks:!1};return _.forEach((B)=>{let z=B.trim().replace(/['"]/g,"");if(z==="breaks")T.breaks=!0;if(z==="no-gfm")T.gfm=!1}),Ue(v.trim(),T)}var us=[320,480,640,768,1024,1280,1536,1920,2560],_x=[1,1.5,2,3],uo=["avif","webp","jpeg"],kx={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function hl(v,_=us,k={},R){return _.sort((T,B)=>T-B).map((T)=>`${fo(v,{...k,w:T,fm:R})} ${T}w`).join(", ")}function cp(v,_,k=_x,R={},T){return k.sort((B,z)=>B-z).map((B)=>{let z=Math.round(_*B);return`${fo(v,{...R,w:z,dpr:B,fm:T})} ${B}x`}).join(", ")}function yl(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let R=Object.entries(v).map(([T,B])=>{let z=/^\d+$/.test(T)?`${T}px`:T;return{bp:z,size:B,numericBp:Number.parseInt(z)||0}}).sort((T,B)=>T.numericBp-B.numericBp).map(({bp:T,size:B})=>`(max-width: ${T}) ${B}`);return R.push(_),R.join(", ")}function fo(v,_={}){let k=Object.entries(_).filter(([,B])=>B!==void 0&&B!==null).map(([B,z])=>{if(Array.isArray(z))return[B,z.join(",")];return[B,String(z)]});if(k.length===0)return v;let R=k.map(([B,z])=>`${B}=${encodeURIComponent(z)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${R}`}function xl(v){return kx[v]||"application/octet-stream"}var Ex={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},vl=`
1624
+ .stx-img-placeholder {
1625
+ position: relative;
1626
+ overflow: hidden;
1627
+ background-size: cover;
1628
+ background-position: center;
1629
+ background-repeat: no-repeat;
1630
+ }
1631
+
1632
+ .stx-img-placeholder img {
1633
+ opacity: 0;
1634
+ transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
1635
+ }
1636
+
1637
+ .stx-img-placeholder.stx-img-loaded img {
1638
+ opacity: 1;
1639
+ }
1640
+
1641
+ .stx-img-blur {
1642
+ filter: blur(20px);
1643
+ transform: scale(1.1);
1644
+ transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
1645
+ transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
1646
+ }
1647
+
1648
+ .stx-img-loaded .stx-img-blur {
1649
+ filter: blur(0);
1650
+ transform: scale(1);
1651
+ }
1652
+ `.trim();async function Cx(){try{return await import("ts-images")}catch{return null}}async function Rx(v,_={}){let k={...Ex,..._},R=await Cx();if(R)try{return await Ax(v,k,R)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return Tx(v,k)}async function Ax(v,_,k){let{generatePlaceholder:R,generateThumbHash:T}=k,z={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[_.strategy]||"blur";if(_.strategy==="thumbhash")return{dataURL:(await T(v)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let W=await R(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:z,base64Encode:!0});return{dataURL:W.dataURL,width:W.width,height:W.height,aspectRatio:W.aspectRatio,originalWidth:W.originalWidth,originalHeight:W.originalHeight,strategy:_.strategy,dominantColor:W.dominantColor,css:W.css}}function Tx(v,_){let k=_.width||20,R=_.height||k,T="#e5e7eb",B=`<svg xmlns="http://www.w3.org/2000/svg" width="${k}" height="${R}" viewBox="0 0 ${k} ${R}"><rect fill="#e5e7eb" width="${k}" height="${R}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(B)}`,width:k,height:R,aspectRatio:k/R,originalWidth:0,originalHeight:0,strategy:_.strategy,dominantColor:"#e5e7eb"}}function lp(v,_,k={}){let R=k.transitionDuration||300,T=k.easing||"ease-out";return`
1653
+ #${v} {
1654
+ --stx-img-transition-duration: ${R}ms;
1655
+ --stx-img-transition-easing: ${T};
1656
+ background-image: url('${_.dataURL}');
1657
+ background-size: cover;
1658
+ background-position: center;
1659
+ }
1660
+
1661
+ #${v} img {
1662
+ opacity: 0;
1663
+ transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
1664
+ }
1665
+
1666
+ #${v}.stx-img-loaded img {
1667
+ opacity: 1;
1668
+ }
1669
+ `.trim()}var bl=new Map;async function up(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(bl.has(k))return bl.get(k);let R=await Rx(v,_);return bl.set(k,R),R}async function Ix(){try{return await import("./chunk-0d6b3eeb.js")}catch(v){if(!dp)console.warn("[stx-media] Image processor not available, some features disabled:",v),dp=!0;return null}}var dp=!1,wl=80,ma="async",ha="lazy",fp=!1;async function ga(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return Mx(R,k)}if(k.processedResult?.processed)return _l(v,k.processedResult,_);if(k.responsiveVariants)return mp(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:W,sizes:F,widths:U=us,dpr:H,formats:q=uo,quality:Q=wl,params:ie={},placeholder:Z="none",placeholderOptions:ae={},lazy:le=!0,priority:ce=!1,loading:de=ce?"eager":ha,decoding:ue=ma,fetchpriority:$e,objectFit:we,objectPosition:ye,crossorigin:Pe,referrerpolicy:Oe}=v,{class:Me,style:Ne,id:Le}=v,De=v.data||{},{isDev:ze=!1,baseUrl:Ve=""}=_;if(ze&&!_.optimize)return Ox(v);let Be,je,st=Le||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(Z!=="none"&&!ce)try{Be=await up(T,{strategy:Z,...ae}),je=lp(st,Be,ae)}catch{}let ht=H!==void 0&&z!==void 0,yt;if(ht)yt=Dx(v,st,Be,_);else yt=await Px(v,st,Be,_);let vt;if(ce){let kt=q.includes("webp")?"webp":q[0],xt=hl(T,U,{...ie,q:Q},kt),ct=typeof F==="object"?yl(F):F||"100vw";vt=`<link rel="preload" as="image" imagesrcset="${xt}" imagesizes="${ct}" />`}let dt=[];if(!fp&&Z!=="none")dt.push(vl),fp=!0;if(je)dt.push(je);let wt=le?gp(st):void 0;return{html:yt,preloadLink:vt,css:dt.length>0?dt.join(`
1670
+ `):void 0,script:wt}}async function Px(v,_,k,R){let{src:T,alt:B,width:z,height:W,sizes:F,widths:U=us,formats:H=uo,quality:q=wl,params:Q={},lazy:ie=!0,priority:Z=!1,loading:ae=Z?"eager":ha,decoding:le=ma,fetchpriority:ce,objectFit:de,objectPosition:ue,crossorigin:$e,referrerpolicy:we}=v,{class:ye,style:Pe}=v,Oe=v.data||{},Me=typeof F==="object"?yl(F):F||"100vw",Ne=[];for(let ze of H){let Ve=hl(T,U,{...Q,q},ze),Be=xl(ze);if(ie&&!Z)Ne.push(` <source type="${Be}" data-srcset="${Ve}" data-sizes="${Me}" />`);else Ne.push(` <source type="${Be}" srcset="${Ve}" sizes="${Me}" />`)}let Le=Sl({src:fo(T,{...Q,q}),alt:B,width:z,height:W,loading:Z?void 0:ae,decoding:le,fetchpriority:Z?"high":ce,objectFit:de,objectPosition:ue,crossorigin:$e,referrerpolicy:we,className:pp(ye,k),style:$l(Pe,de,ue,k),lazy:ie&&!Z,data:Oe}),De;if(k){let ze=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;De=`<div id="${_}" class="stx-img-placeholder" style="${ze}">
1671
+ <picture>
1672
+ ${Ne.join(`
1673
+ `)}
1674
+ <img ${Le} />
1675
+ </picture>
1676
+ </div>`}else De=`<picture${_?` id="${_}"`:""}>
1677
+ ${Ne.join(`
1678
+ `)}
1679
+ <img ${Le} />
1680
+ </picture>`;return De}function Dx(v,_,k,R){let{src:T,alt:B,width:z,height:W,dpr:F=[1,2,3],quality:U=wl,params:H={},lazy:q=!0,priority:Q=!1,loading:ie=Q?"eager":ha,decoding:Z=ma,fetchpriority:ae,objectFit:le,objectPosition:ce,crossorigin:de,referrerpolicy:ue}=v,{class:$e,style:we}=v,ye=v.data||{},Pe=typeof z==="number"?z:Number.parseInt(String(z),10),Oe=cp(T,Pe,F,{...H,q:U}),Me=Sl({src:fo(T,{...H,w:Pe,q:U}),alt:B,width:z,height:W,loading:Q?void 0:ie,decoding:Z,fetchpriority:Q?"high":ae,objectFit:le,objectPosition:ce,crossorigin:de,referrerpolicy:ue,className:pp($e,k),style:$l(we,le,ce,k),lazy:q&&!Q,data:ye}),Ne=q&&!Q?`data-srcset="${Oe}"`:`srcset="${Oe}"`;if(k){let Le=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Le}">
1681
+ <img ${Me} ${Ne} />
1682
+ </div>`}return`<img ${_?`id="${_}" `:""}${Me} ${Ne} />`}function Ox(v){let{src:_,alt:k,width:R,height:T,loading:B=ha,decoding:z=ma,fetchpriority:W,objectFit:F,objectPosition:U,crossorigin:H,referrerpolicy:q,priority:Q=!1}=v,{class:ie,style:Z,id:ae}=v,le=v.data||{};return{html:`<img ${Sl({src:_,alt:k,width:R,height:T,loading:Q?"eager":B,decoding:z,fetchpriority:Q?"high":W,objectFit:F,objectPosition:U,crossorigin:H,referrerpolicy:q,className:ie,style:$l(Z,F,U),id:ae,data:le})} />`}}function Sl(v){let _=[];if(v.lazy)_.push(`data-src="${zn(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${zn(v.src)}"`);if(_.push(`alt="${zn(v.alt)}"`),v.width)_.push(`width="${v.width}"`);if(v.height)_.push(`height="${v.height}"`);if(v.loading)_.push(`loading="${v.loading}"`);if(v.decoding)_.push(`decoding="${v.decoding}"`);if(v.fetchpriority)_.push(`fetchpriority="${v.fetchpriority}"`);if(v.crossorigin)_.push(`crossorigin="${v.crossorigin}"`);if(v.referrerpolicy)_.push(`referrerpolicy="${v.referrerpolicy}"`);if(v.className)_.push(`class="${zn(v.className)}"`);if(v.style)_.push(`style="${zn(v.style)}"`);if(v.id)_.push(`id="${zn(v.id)}"`);if(v.data)for(let[k,R]of Object.entries(v.data))_.push(`data-${k}="${zn(R)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function pp(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function $l(v,_,k,R){let T=[];if(_)T.push(`object-fit: ${_}`);if(k)T.push(`object-position: ${k}`);if(R)T.push("opacity: 0; transition: opacity 300ms ease-out");if(v)T.push(v);return T.join("; ")}function zn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gp(v){return`
1683
+ (function() {
1684
+ const container = document.getElementById('${v}');
1685
+ if (!container) return;
1686
+
1687
+ const img = container.querySelector('img[data-stx-lazy]') || container;
1688
+ if (!img.dataset.src && !img.dataset.srcset) return;
1689
+
1690
+ const observer = new IntersectionObserver((entries) => {
1691
+ entries.forEach(entry => {
1692
+ if (entry.isIntersecting) {
1693
+ // Load image
1694
+ if (img.dataset.src) img.src = img.dataset.src;
1695
+ if (img.dataset.srcset) img.srcset = img.dataset.srcset;
1696
+
1697
+ // Load sources
1698
+ const sources = container.querySelectorAll('source[data-srcset]');
1699
+ sources.forEach(source => {
1700
+ if (source.dataset.srcset) source.srcset = source.dataset.srcset;
1701
+ if (source.dataset.sizes) source.sizes = source.dataset.sizes;
1702
+ });
1703
+
1704
+ // Handle load completion
1705
+ img.onload = () => {
1706
+ img.style.opacity = '1';
1707
+ if (container.classList.contains('stx-img-placeholder')) {
1708
+ container.classList.add('stx-img-loaded');
1709
+ }
1710
+ };
1711
+
1712
+ observer.disconnect();
1713
+ }
1714
+ });
1715
+ }, { rootMargin: '50px' });
1716
+
1717
+ observer.observe(container);
1718
+ })();
1719
+ `.trim()}async function Mx(v,_){let k=await Ix();if(!k)return ga({...v,process:!1},_);let R=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let B=await k.generateResponsiveVariants(v.src,v,R);if(B)return mp(v,B,_)}else{let B=await k.processImage(v.src,v,R);if(B.processed)return _l(v,B,_)}return ga({...v,process:!1},_)}async function _l(v,_,k){let{alt:R,width:T,height:B,lazy:z=!0,priority:W=!1,objectFit:F,objectPosition:U,crossorigin:H,referrerpolicy:q}=v,{class:Q,style:ie}=v,Z=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,ae=v.data||{},le=_.variants||[],ce=le.find((je)=>je.format==="jpeg")||le.find((je)=>je.format==="webp")||le[0],de=ce?.url||v.src,ue=le.filter((je)=>je.format===(ce?.format||"jpeg")).map((je)=>`${je.url} ${je.width}w`).join(", "),$e=new Map;for(let je of le){if(!$e.has(je.format))$e.set(je.format,[]);$e.get(je.format).push(je)}let we=[],ye=["avif","webp","jpeg","png"];for(let je of ye){let st=$e.get(je);if(st&&st.length>0){let ht=st.map((vt)=>`${vt.url} ${vt.width}w`).join(", "),yt=xl(je);if(z&&!W)we.push(` <source type="${yt}" data-srcset="${ht}" />`);else we.push(` <source type="${yt}" srcset="${ht}" />`)}}let Pe=[];if(z&&!W){if(Pe.push(`data-src="${zn(de)}"`),Pe.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),ue)Pe.push(`data-srcset="${ue}"`)}else if(Pe.push(`src="${zn(de)}"`),ue)Pe.push(`srcset="${ue}"`);Pe.push(`alt="${zn(R)}"`);let Oe=T||_.originalWidth,Me=B||_.originalHeight;if(Oe)Pe.push(`width="${Oe}"`);if(Me)Pe.push(`height="${Me}"`);if(!W)Pe.push(`loading="${z?"lazy":"eager"}"`);if(Pe.push('decoding="async"'),W)Pe.push('fetchpriority="high"');if(H)Pe.push(`crossorigin="${H}"`);if(q)Pe.push(`referrerpolicy="${q}"`);let Ne=[];if(F)Ne.push(`object-fit: ${F}`);if(U)Ne.push(`object-position: ${U}`);if(_.placeholder&&z)Ne.push("opacity: 0; transition: opacity 300ms ease-out");if(ie)Ne.push(ie);if(Ne.length>0)Pe.push(`style="${Ne.join("; ")}"`);let Le=[];if(Q)Le.push(Q);if(_.placeholder)Le.push("stx-img-blur");if(Le.length>0)Pe.push(`class="${Le.join(" ")}"`);if(z&&!W)Pe.push("data-stx-lazy");for(let[je,st]of Object.entries(ae))Pe.push(`data-${je}="${zn(st)}"`);let De;if(_.placeholder||_.dominantColor&&v.useDominantColor){let je=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;De=`<div id="${Z}" class="stx-img-placeholder" style="${je}">
1720
+ <picture>
1721
+ ${we.join(`
1722
+ `)}
1723
+ <img ${Pe.join(" ")} />
1724
+ </picture>
1725
+ </div>`}else De=`<picture${Z?` id="${Z}"`:""}>
1726
+ ${we.join(`
1727
+ `)}
1728
+ <img ${Pe.join(" ")} />
1729
+ </picture>`;let ze=[];if(_.placeholder)ze.push(vl);let Ve=z?gp(Z):void 0,Be;if(W&&ue)Be=`<link rel="preload" as="image" imagesrcset="${ue}" />`;return{html:De,preloadLink:Be,css:ze.length>0?ze.join(`
1730
+ `):void 0,script:Ve}}async function mp(v,_,k){let R={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,B]of Object.entries(_.byFormat))if(B)R.variants.push(...B);return _l(v,R,k)}function Nx(){return nt({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,R)=>{let{src:T,alt:B,options:z}=jx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let W={src:T,alt:B||"",widths:z.widths||us,formats:z.formats||uo,quality:z.quality,sizes:z.sizes,dpr:z.dpr,params:z.params,placeholder:z.placeholder,placeholderOptions:z.placeholderOptions,lazy:z.lazy!==!1,priority:z.priority||!1,loading:z.loading,decoding:z.decoding,fetchpriority:z.fetchpriority,objectFit:z.objectFit,objectPosition:z.objectPosition,class:z.class,style:z.style,id:z.id,width:z.width,height:z.height},F=k.__isDev||!1,U=await ga(W,{isDev:F}),H=U.html;if(U.preloadLink)H=U.preloadLink+`
1731
+ `+H;if(U.css)H+=`
1732
+ <style>${U.css}</style>`;if(U.script)H+=`
1733
+ <script>${U.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function jx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Lx(R),B=kl(T[0],k)||"",z=kl(T[1],k)||"",W={};if(T[2]){let F=kl(T[2],k);if(typeof F==="object"&&F!==null)W=F;else if(typeof T[2]==="string")try{W=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:W}}function Lx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],U=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&U!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function kl(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var hp=Nx();async function xp(){try{return await import("./chunk-h9drxwva.js")}catch(v){if(!yp)console.warn("[stx-media] Video processor not available, some features disabled:",v),yp=!0;return null}}var yp=!1,bp=!0,vp="metadata",Bx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ya(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Ux(R,k)}if(k.processedResult?.processed)return Sp(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await Hx(R,k);let{src:B,sources:z=[],poster:W,posterPlaceholder:F,controls:U=bp,autoplay:H=!1,muted:q=!1,loop:Q=!1,preload:ie=vp,playsinline:Z=!0,lazy:ae=!0,player:le="native",type:ce,width:de,height:ue,crossorigin:$e,disablePictureInPicture:we=!1,disableRemotePlayback:ye=!1}=v,Pe=T||W,{class:Oe,style:Me}=v,Ne=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(le==="ts-video")return Wx(v,_);if(ce&&ce!=="video")return zx(B||"",ce,v);let Le=z.length>0?z:B?[{src:B,type:wp(B)}]:[],De=[`id="${Ne}"`];if(U)De.push("controls");if(H)De.push("autoplay");if(q)De.push("muted");if(Q)De.push("loop");if(Z)De.push("playsinline");if(we)De.push("disablepictureinpicture");if(ye)De.push("disableremoteplayback");if($e)De.push(`crossorigin="${$e}"`);if(ae){if(De.push(`data-preload="${ie}"`),De.push('preload="none"'),Pe)De.push(`data-poster="${sn(Pe)}"`);De.push("data-stx-lazy")}else if(De.push(`preload="${ie}"`),Pe)De.push(`poster="${sn(Pe)}"`);if(de)De.push(`width="${de}"`);if(ue)De.push(`height="${ue}"`);if(Oe)De.push(`class="${sn(Oe)}"`);if(Me)De.push(`style="${sn(Me)}"`);let ze=Le.map((je)=>` <source ${ae?`data-src="${sn(je.src)}"`:`src="${sn(je.src)}"`} type="${je.type}"${je.media?` media="${je.media}"`:""} />`).join(`
1734
+ `),Ve=`<video ${De.join(" ")}>
1735
+ ${ze}
1736
+ Your browser does not support the video tag.
1737
+ </video>`,Be;if(ae)Be=`
1738
+ (function() {
1739
+ var video = document.getElementById('${Ne}');
1740
+ if (!video) return;
1741
+
1742
+ var observer = new IntersectionObserver(function(entries) {
1743
+ entries.forEach(function(entry) {
1744
+ if (entry.isIntersecting) {
1745
+ // Load poster
1746
+ if (video.dataset.poster) {
1747
+ video.poster = video.dataset.poster;
1748
+ delete video.dataset.poster;
1749
+ }
1750
+
1751
+ // Load sources
1752
+ var sources = video.querySelectorAll('source[data-src]');
1753
+ sources.forEach(function(source) {
1754
+ source.src = source.dataset.src;
1755
+ delete source.dataset.src;
1756
+ });
1757
+
1758
+ // Set preload
1759
+ if (video.dataset.preload) {
1760
+ video.preload = video.dataset.preload;
1761
+ delete video.dataset.preload;
1762
+ }
1763
+
1764
+ video.load();
1765
+ observer.disconnect();
1766
+ }
1767
+ });
1768
+ }, { rootMargin: '50px' });
1769
+
1770
+ observer.observe(video);
1771
+ })();
1772
+ `.trim();return{html:Ve,script:Be}}function zx(v,_,k){let{width:R=640,height:T=360}=k,{class:B,style:z}=k,W=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,F,U=null;switch(_){case"youtube":U=Fx(v),F=U?`https://www.youtube-nocookie.com/embed/${U}`:v;break;case"vimeo":U=Vx(v),F=U?`https://player.vimeo.com/video/${U}`:v;break;case"dailymotion":U=v.split("/").pop()||"",F=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=v.split("/").pop()||"",F=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:F=v}let H=[`id="${W}"`,`src="${sn(F)}"`,`width="${R}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(B)H.push(`class="${sn(B)}"`);if(z)H.push(`style="${sn(z)}"`);if(k.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1773
+ <iframe ${H.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1774
+ </div>`}}function Wx(v,_={}){let{src:k,sources:R=[],poster:T,controls:B=!0,autoplay:z=!1,muted:W=!1,loop:F=!1,preload:U="metadata",playsinline:H=!0,lazy:q=!0,width:Q,height:ie}=v,{class:Z,style:ae}=v,le=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ce={src:R.length>0?R:k,autoplay:z,loop:F,muted:W,playsinline:H,preload:U,poster:T,controls:B,title:v.title},de=["position: relative",Q?`width: ${typeof Q==="number"?Q+"px":Q}`:"width: 100%",ie?`height: ${typeof ie==="number"?ie+"px":ie}`:"",ae||""].filter(Boolean).join("; "),ue=`
1775
+ <div
1776
+ id="${le}"
1777
+ class="ts-video-player${Z?" "+sn(Z):""}"
1778
+ style="${de}"
1779
+ data-ts-video-player
1780
+ data-config='${JSON.stringify(ce)}'
1781
+ ${q?"data-lazy":""}
1782
+ >
1783
+ <div class="ts-video-player__container">
1784
+ ${T?`
1785
+ <div class="ts-video-player__placeholder" style="background-image: url('${sn(T)}');">
1786
+ <button class="ts-video-player__play-button" aria-label="Play video">
1787
+ <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
1788
+ <path d="M8 5v14l11-7z"/>
1789
+ </svg>
1790
+ </button>
1791
+ </div>
1792
+ `:""}
1793
+ </div>
1794
+ </div>
1795
+ `.trim(),$e=`
1796
+ (function() {
1797
+ var container = document.getElementById('${le}');
1798
+ if (!container) return;
1799
+
1800
+ var config = JSON.parse(container.dataset.config || '{}');
1801
+ var isLazy = container.hasAttribute('data-lazy');
1802
+
1803
+ function loadPlayer() {
1804
+ if (typeof TSVideoPlayer !== 'undefined') {
1805
+ initPlayer();
1806
+ return;
1807
+ }
1808
+
1809
+ // Load ts-video-player from CDN
1810
+ var script = document.createElement('script');
1811
+ script.src = '${Bx}';
1812
+ script.onload = initPlayer;
1813
+ script.onerror = function() {
1814
+ console.error('[stx] Failed to load ts-video-player');
1815
+ fallbackToNative();
1816
+ };
1817
+ document.head.appendChild(script);
1818
+ }
1819
+
1820
+ function initPlayer() {
1821
+ var player = TSVideoPlayer.createPlayer(container, config);
1822
+ if (config.src) {
1823
+ player.setSrc(config.src);
1824
+ }
1825
+ container.__tsVideoPlayer = player;
1826
+
1827
+ // Remove placeholder
1828
+ var placeholder = container.querySelector('.ts-video-player__placeholder');
1829
+ if (placeholder) {
1830
+ placeholder.style.display = 'none';
1831
+ }
1832
+ }
1833
+
1834
+ function fallbackToNative() {
1835
+ // Fallback to native video element
1836
+ var video = document.createElement('video');
1837
+ video.controls = config.controls !== false;
1838
+ video.autoplay = config.autoplay;
1839
+ video.muted = config.muted;
1840
+ video.loop = config.loop;
1841
+ video.playsInline = config.playsinline;
1842
+ video.preload = config.preload || 'metadata';
1843
+ if (config.poster) video.poster = config.poster;
1844
+ if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
1845
+ video.style.width = '100%';
1846
+ video.style.height = '100%';
1847
+
1848
+ var containerEl = container.querySelector('.ts-video-player__container');
1849
+ if (containerEl) {
1850
+ containerEl.innerHTML = '';
1851
+ containerEl.appendChild(video);
1852
+ }
1853
+ }
1854
+
1855
+ if (isLazy) {
1856
+ var observer = new IntersectionObserver(function(entries) {
1857
+ entries.forEach(function(entry) {
1858
+ if (entry.isIntersecting) {
1859
+ loadPlayer();
1860
+ observer.disconnect();
1861
+ }
1862
+ });
1863
+ }, { rootMargin: '50px' });
1864
+ observer.observe(container);
1865
+ }
1866
+ else {
1867
+ if (document.readyState === 'loading') {
1868
+ document.addEventListener('DOMContentLoaded', loadPlayer);
1869
+ }
1870
+ else {
1871
+ loadPlayer();
1872
+ }
1873
+ }
1874
+
1875
+ // Handle play button click
1876
+ var playButton = container.querySelector('.ts-video-player__play-button');
1877
+ if (playButton) {
1878
+ playButton.addEventListener('click', function() {
1879
+ loadPlayer();
1880
+ var check = setInterval(function() {
1881
+ if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
1882
+ container.__tsVideoPlayer.play();
1883
+ clearInterval(check);
1884
+ }
1885
+ }, 100);
1886
+ });
1887
+ }
1888
+ })();
1889
+ `.trim(),we=`
1890
+ .ts-video-player {
1891
+ position: relative;
1892
+ background: #000;
1893
+ }
1894
+
1895
+ .ts-video-player__container {
1896
+ position: relative;
1897
+ width: 100%;
1898
+ padding-bottom: 56.25%;
1899
+ }
1900
+
1901
+ .ts-video-player__container > * {
1902
+ position: absolute;
1903
+ top: 0;
1904
+ left: 0;
1905
+ width: 100%;
1906
+ height: 100%;
1907
+ }
1908
+
1909
+ .ts-video-player__placeholder {
1910
+ display: flex;
1911
+ align-items: center;
1912
+ justify-content: center;
1913
+ background-color: #1a1a1a;
1914
+ background-size: cover;
1915
+ background-position: center;
1916
+ cursor: pointer;
1917
+ }
1918
+
1919
+ .ts-video-player__play-button {
1920
+ display: flex;
1921
+ align-items: center;
1922
+ justify-content: center;
1923
+ width: 80px;
1924
+ height: 80px;
1925
+ background: rgba(0, 0, 0, 0.7);
1926
+ border: none;
1927
+ border-radius: 50%;
1928
+ color: white;
1929
+ cursor: pointer;
1930
+ transition: transform 0.2s, background 0.2s;
1931
+ }
1932
+
1933
+ .ts-video-player__play-button:hover {
1934
+ transform: scale(1.1);
1935
+ background: rgba(0, 0, 0, 0.9);
1936
+ }
1937
+
1938
+ .ts-video-player__play-button svg {
1939
+ margin-left: 4px;
1940
+ }
1941
+ `.trim();return{html:ue,script:$e,css:we}}function wp(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Fx(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let R=v.match(k);if(R)return R[1]}return null}function Vx(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function sn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Ux(v,_){let k=await xp();if(!k)return ya({...v,process:!1},_);let R=_.tsVideosConfig,T=await k.processVideo(v.src,v,R,v.onProcessProgress);if(T.processed)return Sp(v,T,_);return ya({...v,process:!1},_)}async function Hx(v,_){let k=await xp();if(!k||!v.src)return;let R=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,R,T.outputDir,T.baseUrl||"/videos"))?.url}function Sp(v,_,k){let{controls:R=bp,autoplay:T=!1,muted:B=!1,loop:z=!1,preload:W=vp,playsinline:F=!0,lazy:U=!0,width:H,height:q,crossorigin:Q,disablePictureInPicture:ie=!1,disableRemotePlayback:Z=!1}=v,{class:ae,style:le}=v,ce=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,de=v.src,ue=wp(de);if(_.transcoded)de=_.transcoded.url,ue="video/mp4";let $e=_.streaming?.hls||_.streaming?.dash;if($e){if(_.streaming?.hls)de=_.streaming.hls.manifestUrl,ue="application/x-mpegURL";else if(_.streaming?.dash)de=_.streaming.dash.manifestUrl,ue="application/dash+xml"}let we=_.poster?.url||v.poster,ye=[`id="${ce}"`];if(R)ye.push("controls");if(T)ye.push("autoplay");if(B)ye.push("muted");if(z)ye.push("loop");if(F)ye.push("playsinline");if(ie)ye.push("disablepictureinpicture");if(Z)ye.push("disableremoteplayback");if(Q)ye.push(`crossorigin="${Q}"`);if(U){if(ye.push(`data-preload="${W}"`),ye.push('preload="none"'),we)ye.push(`data-poster="${sn(we)}"`);ye.push("data-stx-lazy")}else if(ye.push(`preload="${W}"`),we)ye.push(`poster="${sn(we)}"`);let Pe=H||_.metadata?.width,Oe=q||_.metadata?.height;if(Pe)ye.push(`width="${Pe}"`);if(Oe)ye.push(`height="${Oe}"`);if(ae)ye.push(`class="${sn(ae)}"`);if(le)ye.push(`style="${sn(le)}"`);let Ne=` <source ${U?`data-src="${sn(de)}"`:`src="${sn(de)}"`} type="${ue}" />`,Le=`<video ${ye.join(" ")}>
1942
+ ${Ne}
1943
+ Your browser does not support the video tag.
1944
+ </video>`;if(_.spriteSheet)Le=`<div class="stx-video-wrapper" data-sprite-sheet="${sn(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
1945
+ ${Le}
1946
+ </div>`;let De;if(U)De=`
1947
+ (function() {
1948
+ var video = document.getElementById('${ce}');
1949
+ if (!video) return;
1950
+
1951
+ var observer = new IntersectionObserver(function(entries) {
1952
+ entries.forEach(function(entry) {
1953
+ if (entry.isIntersecting) {
1954
+ // Load poster
1955
+ if (video.dataset.poster) {
1956
+ video.poster = video.dataset.poster;
1957
+ delete video.dataset.poster;
1958
+ }
1959
+
1960
+ // Load sources
1961
+ var sources = video.querySelectorAll('source[data-src]');
1962
+ sources.forEach(function(source) {
1963
+ source.src = source.dataset.src;
1964
+ delete source.dataset.src;
1965
+ });
1966
+
1967
+ // Set preload
1968
+ if (video.dataset.preload) {
1969
+ video.preload = video.dataset.preload;
1970
+ delete video.dataset.preload;
1971
+ }
1972
+
1973
+ video.load();
1974
+ observer.disconnect();
1975
+ }
1976
+ });
1977
+ }, { rootMargin: '50px' });
1978
+
1979
+ observer.observe(video);
1980
+ })();
1981
+ `.trim();let ze;if($e)ze=`
1982
+ .stx-video-wrapper {
1983
+ position: relative;
1984
+ width: 100%;
1985
+ }
1986
+ .stx-video-wrapper video {
1987
+ width: 100%;
1988
+ height: auto;
1989
+ }
1990
+ `.trim();return{html:Le,script:De,css:ze}}function $p(){return nt({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(v,_,k,R)=>{let{src:T,options:B}=qx(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let z={src:T,poster:B.poster,controls:B.controls!==!1,autoplay:B.autoplay||!1,muted:B.muted||!1,loop:B.loop||!1,preload:B.preload||"metadata",playsinline:B.playsinline!==!1,lazy:B.lazy!==!1,player:B.player||"native",type:B.type,width:B.width,height:B.height,class:B.class,style:B.style,id:B.id,crossorigin:B.crossorigin,disablePictureInPicture:B.disablePictureInPicture,disableRemotePlayback:B.disableRemotePlayback,title:B.title,quality:B.quality,platform:B.platform,process:B.process,generatePoster:B.generatePoster,streaming:B.streaming,transcode:B.transcode,spriteSheet:B.spriteSheet,waveform:B.waveform},F={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},U=await ya(z,F),H=U.html;if(U.css)H+=`
1991
+ <style>${U.css}</style>`;if(U.script)H+=`
1992
+ <script>${U.script}</script>`;return H},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function qx(v,_,k){if(_.src)return{src:String(_.src),options:_.options||{}};let R=v.trim();if(R.startsWith("@video(")||R.startsWith("("))R=R.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Kx(R),B=_p(T[0],k)||"",z={};if(T[1]){let W=_p(T[1],k);if(typeof W==="object"&&W!==null)z=W;else if(typeof T[1]==="string")try{z=JSON.parse(T[1])}catch{}}return{src:B,options:z}}function Kx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],U=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&U!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function _p(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var El=$p();import Xx from"fs";import Pn from"path";async function pr(v,_){if(!v.webComponents?.enabled)return[];let k=v.webComponents.components||[],R=[];if(k.length>0){if(v.debug)console.log(`Building ${k.length} web components...`);for(let T of k)try{let B=await Zx(T,v,_);if(B)R.push(B)}catch(B){if(console.error(`Error building web component ${T.name}:`,B),v.debug)throw B}}return R}async function Zx(v,_,k){let{name:R,file:T,tag:B,extends:z}=v;if(!R||!T||!B)return console.error("Invalid web component configuration, missing required fields:",v),null;let W=null;if(Pn.isAbsolute(T)&&await r(T))W=T;else if(_.componentsDir){let ae=Pn.join(_.componentsDir,T);if(await r(ae))W=ae}if(!W)W=await dr(T,process.cwd(),_,k);if(!W)return console.error(`Web component source file not found: ${T}`),null;let F=await Bun.file(W).text();k.add(W);let H=(v.outputFormat||"js")==="ts",q=H?Jx({name:R,tag:B,baseElement:z,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):Gx({name:R,tag:B,baseElement:z,source:F,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),Q=_.webComponents?.outputDir||"dist/web-components";await Xx.promises.mkdir(Q,{recursive:!0});let ie=H?"ts":"js",Z=Pn.join(Q,`${B}.${ie}`);if(await Bun.write(Z,q),_.debug)console.log(`Built web component ${R} -> ${Z}`);return Z}function Gx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:W,attributes:F=[]}=v,U=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)U=U.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),U=U.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),U=U.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),U=U.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let H="";if(W)H=`<link rel="stylesheet" href="${W}">`;return`/**
1993
+ * ${_} Web Component
1994
+ * Auto-generated from stx component
1995
+ */
1996
+ class ${_.replace(/\W/g,"")} extends ${R} {
1997
+ constructor() {
1998
+ super()
1999
+ this._initialized = false
2000
+ ${B?"":"this._slotContent = []"}
2001
+ ${B?'this.attachShadow({ mode: "open" })':""}
2002
+ }
2003
+
2004
+ ${z?`
2005
+ _createTemplate() {
2006
+ const template = document.createElement('template')
2007
+ template.innerHTML = \`${H}${U}\`
2008
+ ${B?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
2009
+ this._processSlots()
2010
+ }
2011
+ `:`
2012
+ _render() {
2013
+ ${B?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${H}${U}\`
2014
+ this._processSlots()
2015
+ }
2016
+ `}
2017
+
2018
+ _processSlots() {
2019
+ ${B?`// Shadow DOM handles slot assignment automatically
2020
+ // Listen for slot changes if needed
2021
+ const slots = this.shadowRoot.querySelectorAll('slot')
2022
+ slots.forEach(slot => {
2023
+ slot.addEventListener('slotchange', (e) => {
2024
+ const assignedNodes = slot.assignedNodes()
2025
+ this.dispatchEvent(new CustomEvent('slot-changed', {
2026
+ detail: { slotName: slot.name || 'default', assignedNodes }
2027
+ }))
2028
+ })
2029
+ })`:`// Manual slot processing for non-shadow DOM mode
2030
+ const slots = this.querySelectorAll('[data-slot]')
2031
+
2032
+ // Process named slots
2033
+ slots.forEach(slotEl => {
2034
+ const slotName = slotEl.getAttribute('data-slot')
2035
+ const slottedContent = this._slotContent.filter(
2036
+ node => node.nodeType === Node.ELEMENT_NODE && node.getAttribute('slot') === slotName
2037
+ )
2038
+ if (slottedContent.length > 0) {
2039
+ slotEl.innerHTML = ''
2040
+ slottedContent.forEach(content => slotEl.appendChild(content))
2041
+ }
2042
+ })
2043
+
2044
+ // Process default slot
2045
+ const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]')
2046
+ if (defaultSlot) {
2047
+ const unslottedContent = this._slotContent.filter(
2048
+ node => node.nodeType !== Node.ELEMENT_NODE || !node.hasAttribute('slot')
2049
+ )
2050
+ if (unslottedContent.length > 0) {
2051
+ defaultSlot.innerHTML = ''
2052
+ unslottedContent.forEach(content => defaultSlot.appendChild(content))
2053
+ }
2054
+ }`}
2055
+ }
2056
+
2057
+ ${F.length>0?`
2058
+ static get observedAttributes() {
2059
+ return [${F.map((q)=>`'${q}'`).join(", ")}]
2060
+ }
2061
+
2062
+ attributeChangedCallback(name, oldValue, newValue) {
2063
+ if (oldValue !== newValue) {
2064
+ this[name] = newValue
2065
+ ${z?"":"if (this._initialized) this._render()"}
2066
+ }
2067
+ }
2068
+ `:""}
2069
+
2070
+ connectedCallback() {
2071
+ if (this._initialized) return
2072
+ ${B?"":"this._slotContent = Array.from(this.childNodes)"}
2073
+ this._initialized = true
2074
+ ${z?"this._createTemplate()":"this._render()"}
2075
+ }
2076
+
2077
+ disconnectedCallback() {
2078
+ // Component removed from the DOM
2079
+ }
2080
+ }
2081
+
2082
+ // Register the web component
2083
+ customElements.define('${k}', ${_.replace(/\W/g,"")})
2084
+ `}function Jx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:W,attributes:F=[],attributeTypes:U={}}=v,H=_.replace(/\W/g,""),q=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)q=q.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),q=q.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),q=q.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),q=q.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");q=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let Q=W?`<link rel="stylesheet" href="${W}">`:"",ie=(we)=>{switch(U[we]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},Z=(we)=>we.replace(/-([a-z])/g,(ye,Pe)=>Pe.toUpperCase()),ae=F.map((we)=>` private _${Z(we)}: ${ie(we)} | null = null;`).join(`
2085
+ `),le=F.map((we)=>{let ye=ie(we),Pe=Z(we);return`
2086
+ get ${Pe}(): ${ye} | null {
2087
+ return this._${Pe};
2088
+ }
2089
+
2090
+ set ${Pe}(value: ${ye} | null) {
2091
+ this._${Pe} = value;
2092
+ if (value !== null) {
2093
+ this.setAttribute('${we}', String(value));
2094
+ }
2095
+ else {
2096
+ this.removeAttribute('${we}');
2097
+ }
2098
+ }`}).join(`
2099
+ `),ce=F.length>0?`/**
2100
+ * Props interface for ${_}
2101
+ */
2102
+ export interface ${H}Props {
2103
+ ${F.map((we)=>{let ye=ie(we);return` ${Z(we)}?: ${ye};`}).join(`
2104
+ `)}
2105
+ }
2106
+ `:"",de=F.length>0?`
2107
+ static get observedAttributes(): string[] {
2108
+ return [${F.map((we)=>`'${we}'`).join(", ")}];
2109
+ }
2110
+
2111
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
2112
+ if (oldValue !== newValue) {
2113
+ const camelCase = name.replace(/-([a-z])/g, (_: string, letter: string) => letter.toUpperCase());
2114
+ (this as unknown as Record<string, unknown>)[\`_\${camelCase}\`] = this._parseAttributeValue(name, newValue);
2115
+ ${z?"":"if (this._initialized) this._render();"}
2116
+ }
2117
+ }
2118
+
2119
+ private _parseAttributeValue(name: string, value: string | null): unknown {
2120
+ if (value === null) return null;
2121
+ const typeMap: Record<string, string> = ${JSON.stringify(U)};
2122
+ const type = typeMap[name] || 'string';
2123
+ switch (type) {
2124
+ case 'number': return Number(value);
2125
+ case 'boolean': return value !== 'false' && value !== '0';
2126
+ case 'object': try { return JSON.parse(value); }
2127
+ catch { return value; }
2128
+ default: return value;
2129
+ }
2130
+ }
2131
+ `:"",ue=z?`
2132
+ private _createTemplate(): void {
2133
+ const template = document.createElement('template');
2134
+ template.innerHTML = \`${Q}${q}\`;
2135
+ ${B?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
2136
+ this._processSlots();
2137
+ }`:`
2138
+ private _render(): void {
2139
+ ${B?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${Q}${q}\`;
2140
+ this._processSlots();
2141
+ }`;return`/**
2142
+ * ${_} Web Component
2143
+ * Auto-generated from stx component (TypeScript)
2144
+ *
2145
+ * @example
2146
+ * \`\`\`html
2147
+ * <${k}></${k}>
2148
+ * \`\`\`
2149
+ */
2150
+
2151
+ /**
2152
+ * Detail type for slot-changed event
2153
+ */
2154
+ interface SlotChangeDetail {
2155
+ slotName: string;
2156
+ assignedNodes: Node[];
2157
+ }
2158
+
2159
+ ${ce}
2160
+ /**
2161
+ * ${_} custom element class
2162
+ * @customElement ${k}
2163
+ */
2164
+ export class ${H} extends ${R} {
2165
+ ${ae}
2166
+ private _initialized = false;
2167
+ ${B?"":"private _slotContent: Node[] = [];"}
2168
+
2169
+ constructor() {
2170
+ super();
2171
+ ${B?'this.attachShadow({ mode: "open" });':""}
2172
+ }
2173
+ ${ue}
2174
+ ${B?`
2175
+ private _processSlots(): void {
2176
+ const slots = this.shadowRoot!.querySelectorAll('slot');
2177
+ slots.forEach((slot) => {
2178
+ slot.addEventListener('slotchange', () => {
2179
+ const assignedNodes = (slot as HTMLSlotElement).assignedNodes();
2180
+ this.dispatchEvent(new CustomEvent<SlotChangeDetail>('slot-changed', {
2181
+ detail: { slotName: slot.getAttribute('name') || 'default', assignedNodes }
2182
+ }));
2183
+ });
2184
+ });
2185
+ }`:`
2186
+ private _processSlots(): void {
2187
+ const slots = this.querySelectorAll('[data-slot]');
2188
+ slots.forEach((slotEl) => {
2189
+ const slotName = slotEl.getAttribute('data-slot');
2190
+ if (slotName) {
2191
+ const slottedContent = this._slotContent.filter(
2192
+ node => node.nodeType === Node.ELEMENT_NODE && (node as Element).getAttribute('slot') === slotName
2193
+ );
2194
+ if (slottedContent.length > 0) {
2195
+ slotEl.innerHTML = '';
2196
+ slottedContent.forEach(content => slotEl.appendChild(content));
2197
+ }
2198
+ }
2199
+ });
2200
+ const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]');
2201
+ if (defaultSlot) {
2202
+ const unslottedContent = this._slotContent.filter(
2203
+ node => node.nodeType !== Node.ELEMENT_NODE || !(node as Element).hasAttribute('slot')
2204
+ );
2205
+ if (unslottedContent.length > 0) {
2206
+ defaultSlot.innerHTML = '';
2207
+ unslottedContent.forEach(content => defaultSlot.appendChild(content));
2208
+ }
2209
+ }
2210
+ }`}
2211
+ ${de}
2212
+ ${le}
2213
+
2214
+ connectedCallback(): void {
2215
+ if (this._initialized) return;
2216
+ ${B?"":"this._slotContent = Array.from(this.childNodes);"}
2217
+ this._initialized = true;
2218
+ ${z?"this._createTemplate();":"this._render();"}
2219
+ }
2220
+
2221
+ disconnectedCallback(): void {
2222
+ // Component removed from the DOM
2223
+ }
2224
+
2225
+ adoptedCallback(): void {
2226
+ // Component moved to a new document
2227
+ }
2228
+ }
2229
+
2230
+ // Type augmentation for HTMLElementTagNameMap
2231
+ declare global {
2232
+ interface HTMLElementTagNameMap {
2233
+ '${k}': ${H};
2234
+ }
2235
+ }
2236
+
2237
+ // Register the web component
2238
+ customElements.define('${k}', ${H});
2239
+ `}function Yx(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),R=k?k[1].trim():"",T=_,B=[],z=!0;if(R){let q=R.match(/export\s+default\s+({[\s\S]*})/);if(q)try{let Q=q[1],ie=Q.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(ie)T=ie[1];let Z=Q.match(/props\s*:\s*\[([\s\S]*?)\]/);if(Z)B=Z[1].split(",").map((le)=>le.trim().replace(/['"`]/g,"")).filter((le)=>le.length>0);let ae=Q.match(/shadowDOM\s*:\s*(true|false)/);if(ae)z=ae[1]==="true"}catch{}}let W=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),F=W?W[1].trim():"",U=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),H=U?U[1].trim():"";return{tag:T,props:B,template:F,styles:H,script:R,shadowDOM:z}}function Qx(v){let{tag:_,props:k,template:R,styles:T,shadowDOM:B}=v,z=_.split("-").map((q)=>q.charAt(0).toUpperCase()+q.slice(1)).join(""),W=R.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),F=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=k.map((q)=>`'${q}'`).join(", "),H=k.map((q)=>`
2240
+ get ${q}() {
2241
+ return this.getAttribute('${q}') || '';
2242
+ }
2243
+ set ${q}(value) {
2244
+ if (value) {
2245
+ this.setAttribute('${q}', value);
2246
+ }
2247
+ else {
2248
+ this.removeAttribute('${q}');
2249
+ }
2250
+ }`).join(`
2251
+ `);return`/**
2252
+ * ${z} Web Component
2253
+ * Auto-generated from SFC
2254
+ */
2255
+ class ${z} extends HTMLElement {
2256
+ constructor() {
2257
+ super();
2258
+ ${B?"this.attachShadow({ mode: 'open' });":""}
2259
+ this._render();
2260
+ }
2261
+
2262
+ static get observedAttributes() {
2263
+ return [${U}];
2264
+ }
2265
+
2266
+ attributeChangedCallback(name, oldValue, newValue) {
2267
+ if (oldValue !== newValue) {
2268
+ this._render();
2269
+ }
2270
+ }
2271
+ ${H}
2272
+
2273
+ _render() {
2274
+ const template = \`${F?`<style>${F}</style>`:""}${W}\`;
2275
+
2276
+ // Interpolate {{ prop }} with attribute values
2277
+ const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
2278
+ return this.getAttribute(prop) || '';
2279
+ });
2280
+
2281
+ ${B?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
2282
+ }
2283
+
2284
+ connectedCallback() {
2285
+ this._render();
2286
+ }
2287
+ }
2288
+
2289
+ customElements.define('${_}', ${z});
2290
+ `}async function kp(v,_,k,R){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),z=(k.__stx_options||{}).componentsDir||"components",W=Pn.isAbsolute(z)?[Pn.join(z,`${T}.stx`),Pn.join(Pn.dirname(R),`${T}.stx`)]:[Pn.join(Pn.dirname(R),z,`${T}.stx`),Pn.join(process.cwd(),z,`${T}.stx`),Pn.join(Pn.dirname(R),`${T}.stx`)],F=null;for(let q of W)if(await r(q)){F=await Bun.file(q).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let U=Yx(F,T);return`<script type="module">
2291
+ ${Qx(U)}
2292
+ </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:jt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:ap,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:kp,hasEndTag:!1,description:"Include a web component in the template"},Mi,Li,hr,yr,Xf,Gf,Jf,Zf,sp,Kf,hp,El,...Ar],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function tb(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=on.join(T,"resources","views"),z=on.join(T,"resources","layouts");if(ds.existsSync(B)&&ds.existsSync(z))return{root:"resources",pagesDir:"views"};let W=on.join(T,"resources","views","pages");if(ds.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var Ep=new Set,ba=["partialsDir","componentsDir","layoutsDir"],Cl=new WeakMap;function nb(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function el(v,_){let k=!v.root,R=tb(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!Ep.has(T))Ep.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Cl.has(v)){let T={};for(let B of ba){let z=v[B];if(typeof z==="string"&&z)T[B]=z}Cl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ba){let z=v[B];if(typeof z!=="string"||!z)continue;if(on.isAbsolute(z)||nb(z,T))continue;v[B]=on.join(T,z)}}for(let T of ba){let B=v[T];if(typeof B!=="string"||!B||on.isAbsolute(B))continue;v[T]=on.resolve(_,B)}return v}function rb(v,_){let k=Cl.get(v);for(let R of ba){let T=v[R];if(typeof T!=="string"||!T)continue;let B=on.isAbsolute(T)?T:on.join(_,T);if(ds.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function sb(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function ib(v){if(Hi(v.stateDir),v.stateDir=Cn(),v.cachePath=_n(v.cachePath),v.build)v.build.cacheDir=_n(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=_n(v.media.cache.directory);if(v.story)v.story.outDir=_n(v.story.outDir)}var Ir=null,qr=new Map,xa=new Map,po=null;async function js(v,_=eb){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?on.resolve(v):process.cwd(),k=xa.get(_);if(k&&k.signature!==fr(k.graph)){let B=qr.get(_);if(qr.delete(_),xa.delete(_),!v)Ir=null,po=null;let{clearComponentCache:z}=await import("./chunk-pndhb1nk.js"),{partialsCache:W}=await import("./chunk-ajd5w5c4.js");if(z(),W.clear(),B&&k.configSignature===gr(k.graph)){let F=B.then(async(U)=>{let H={...k.graph};await Fs(H,_),xa.set(_,{graph:H,signature:fr(H),configSignature:gr(H)});let q={...U,_layerGraph:H};if(!v)Ir=q;return q});return qr.set(_,F),F}}if(!v){if(Ir)return Ir;if(po)return po}let R=qr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((Q)=>ds.existsSync(on.join(_,`stx.config${Q}`))),W=B.some((Q)=>ds.existsSync(on.join(_,"config",`ui${Q}`))),F;if(z&&W){let Q=await js({name:"ui",cwd:on.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});F=(await js({name:"stx",alias:"ui",cwd:_,defaultConfig:Q.config,errorPolicy:"throw",verbose:!1})).config}else F=(await js({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(F.extends!==void 0||k){let Q=await Fi(_,A);F=Q.config,xa.set(_,{graph:Q.graph,signature:fr(Q.graph),configSignature:gr(Q.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Q}=await import("./chunk-fcgf8d5k.js");Q(F.runtimeConfig,{});let{generateRuntimeConfigTypes:ie}=await import("./chunk-cw76y2p5.js");await ie(_,F.runtimeConfig)}sb(F),ib(F),el(F,_),rb(F,_);let U=[],H=new Set((F.plugins??[]).map((Q)=>typeof Q==="string"?Q:Q[0]));for(let Q of F.componentPackages??["@stacksjs/components"]){let ie=`${Q}/stx-plugin`;if(H.has(ie)||H.has(Q))continue;try{d.resolve(ie,{paths:[_]}),U.push(ie)}catch{}}let q=[...F.plugins??[],...U];if(q.length>0){let{pluginManager:Q}=await import("./chunk-zg87pybq.js"),ie=[],Z=[];for(let ae of q){let le=typeof ae==="string"?ae:ae[0],ce=typeof ae==="string"?{}:ae[1]||{};try{let de,ue;try{let we=d.resolve(le,{paths:[_]});de=await import(we),ue=on.dirname(we)}catch{let we=on.resolve(_,le);de=await import(we),ue=on.dirname(we)}let $e=de.default||de;if(!Q.has($e.name))await Q.register($e,F);if($e.components){let we=Array.isArray($e.components)?$e.components:[$e.components];for(let ye of we)ie.push(on.resolve(ue,ye))}if($e.pages){let we=on.resolve(ue,$e.pages),ye=ce.path||"/";Z.push({dir:we,prefix:ye})}if($e.setup){let we={addDirective:(ye)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(ye)},addRoute:(ye,Pe)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[ye]=Pe},addMiddleware:(ye)=>{F.middleware=F.middleware||[],F.middleware.push(ye)},pluginDir:ue,config:F};await $e.setup(ce,we)}process.stderr.write(`[stx] Plugin loaded: ${$e.name||le}
2293
+ `)}catch(de){console.warn(`[stx] Failed to load plugin ${le}:`,de.message)}}F._pluginComponentDirs=ie,F._pluginPageDirs=Z}return F})();if(qr.set(_,T),T.catch(()=>{if(qr.get(_)===T)qr.delete(_)}),!v)po=T,T.then((B)=>{Ir=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Ir&&_ in Ir)return Ir[_];if(!po)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function yd(v){return v}function bd(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${B}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var Al=new Map;async function me(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await ob.promises.stat(v)).mtime.getTime();if(_.cache&&Al.has(v)){let q=Al.get(v);if(q.updatedAt>=R)return{content:q.content,data:q.data}}let T=await Bun.file(v).text(),{data:B,content:z}=tr(T),W=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=Ue(z,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)U=await cb(U,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:U,data:B||{}};if(_.cache)Al.set(v,{...H,updatedAt:R});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var va=null;async function cb(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!va)try{va=await ab({theme:_||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),v}let T=async(W,F,U,H)=>{let q=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Q=U||(k?"text":"");if(!Q)return W;try{if(!va.getSupportedLanguages().includes(Q))return W;return(await va.highlight(q,Q,{theme:_})).html}catch(ie){console.error(`Error highlighting code block with language ${U}:`,ie)}return W},B=v,z=v.matchAll(R);for(let W of z){let[F,U,H,q]=W,Q=await T(F,U,H,q);B=B.replace(F,Q)}return B}async function Cp(v,_,k="",R={}){return await lb(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,W,F,U)=>{try{let H=W;if(!Rl.isAbsolute(W))H=Rl.resolve(Rl.dirname(k),W);let q={};if(F)try{try{q=JSON.parse(F)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let de=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let ue of de){let $e=ue.indexOf(":");if($e>0){let we=ue.substring(0,$e).trim(),ye=ue.substring($e+1).trim(),Pe=ye.startsWith('"')&&ye.endsWith('"'),Oe=ye.startsWith("'")&&ye.endsWith("'");if(Pe||Oe)ye=ye.substring(1,ye.length-1);q[we]=ye}}}}catch(ce){if(R.debug)console.error("Error parsing context in @markdown-file directive:",ce)}let{content:Q,data:ie}=await me(H,R),Z={..._,...ie,...q},ae=Q,le=/\{\{([^}]+)\}\}/g;return ae=ae.replace(le,(ce,de)=>{let ue=de.trim();return Z[ue]!==void 0?String(Z[ue]):ce}),ae}catch(H){let q=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${q}`,k,v,U,z)}})}async function lb(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let W=T[0],F=T.index,U=T;R.push(k(...U).then((H)=>({match:W,replacement:H,index:F})))}let B=await Promise.all(R);B.sort((W,F)=>F.index-W.index);let z=v;for(let{match:W,replacement:F}of B)z=z.replace(W,()=>F);return z}function Pr(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Dr(v,_){let k=ub(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function ub(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function db(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Kr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),W=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,W.lastIndex=B;let F=z.exec(v),U=W.exec(v),H=F?F.index:1/0,q=U?U.index:1/0;if(H<q)T++,B=H+F[0].length;else if(q<1/0){if(T--,T===0)return q;B=q+U[0].length}else break}return-1}function Rp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=Dr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"if","endif",B);if(z===-1)return null;let W=v.slice(B,z),F=[],U=0,H="if",q=T.expression,Q=0,ie=0;while(U<W.length){let Z=W.indexOf("@",U);if(Z===-1)break;U=Z;let ae=W.substring(Z);if(db(W,Z)){U++;continue}if(/^@if\s*\(/.test(ae)){ie++,U++;continue}if(/^@endif(?![a-z])/.test(ae)){ie--,U+=6;continue}if(ie===0){let le=ae.match(/^@elseif\s*/);if(le){F.push({type:H,condition:q,content:W.substring(Q,U),start:B+Q,end:B+U});let ce=U+le[0].length,de=Dr(W,ce);if(!de){U++;continue}H="elseif",q=de.expression,U=de.endPos,Q=U;continue}else if(/^@else(?![a-z])/.test(ae)){F.push({type:H,condition:q,content:W.substring(Q,U),start:B+Q,end:B+U}),H="else",q=void 0,U+=5,Q=U;continue}}U++}return F.push({type:H,condition:q,content:W.slice(Q),start:B+Q,end:B+W.length}),{fullMatch:v.slice(_,z+6),branches:F,start:_,end:z+6}}function go(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=Rp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function wa(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((ae)=>B.index>ae.start&&B.index<ae.end)){B=T.exec(v);continue}let W=B.index,F=W+B[0].length-1,U=S(v,"(",")",F);if(U===-1){B=T.exec(v);continue}let H=v.slice(F+1,U),q=U+1,Q=Kr(v,_,k,q);if(Q===-1){B=T.exec(v);continue}let ie=v.slice(q,Q),Z=Q+`@${k}`.length;R.push({fullMatch:v.slice(W,Z),name:_,params:H,content:ie,start:W,end:Z}),T.lastIndex=Z,B=T.exec(v)}return R}function Tl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=Dr(v,R);if(!T)return null;let B=T.endPos,z=Kr(v,"switch","endswitch",B);if(z===-1)return null;let W=v.slice(B,z),F=[],U=0,H=null,q=0;while(U<W.length){let Q=W.slice(U),ie=Q.match(/^@switch\s*\(/),Z=Q.match(/^@endswitch(?![a-z])/);if(ie){if(q++,H)H.content+=ie[0];U+=ie[0].length;continue}if(Z){if(q--,H)H.content+=Z[0];U+=Z[0].length;continue}if(q>0){if(H)H.content+=W[U];U++;continue}let ae=Q.match(/^@case\s*/),le=Q.match(/^@default(?![a-z])/),ce=Q.match(/^@break(?![a-z])/);if(ae&&Q.startsWith("@case")){if(H)F.push(H);let de=U+ae[0].length,ue=Dr(W,de);if(!ue){U++;continue}H={type:"case",value:ue.expression,content:""},U=ue.endPos}else if(le&&Q.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},U+=le[0].length}else if(ce&&Q.startsWith("@break"))U+=ce[0].length;else{if(H)H.content+=W[U];U++}}if(H)F.push(H);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:F,start:_,end:z+10}}function mb(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=Tl(R,z);if(!W)break;try{let F;if(p(W.expression))F=c(W.expression,Object.keys(_))(...Object.values(_));else F=l(W.expression,_);let U="",H=!1;for(let q of W.cases)if(q.type==="default"){if(!H)U=q.content.trim()}else try{let Q;if(q.value&&p(q.value))Q=c(q.value,Object.keys(_))(...Object.values(_));else if(q.value)Q=l(q.value,_);if(F===Q){U=q.content.trim(),H=!0;break}}catch{continue}R=R.substring(0,z)+U+R.substring(W.end),T=!0}catch(F){let U=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${U}`,t.EVALUATION_ERROR);R=R.substring(0,z)+H+R.substring(W.end);break}}return R}function hb(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function yb(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function br(v,_,k){let{masked:R,scripts:T}=hb(v);return yb(xb(R,_,k),T)}function xb(v,_,k){let R=v;R=mb(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=Dr(R,W+7);if(!F)break;let U=F.endPos,H=Kr(R,"unless","endunless",U);if(H===-1){console.warn(`[stx] @unless directive at position ${W} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let q=R.slice(U,H),Q=F.expression,ie=-1;{let ae=0,le=/@(?:if|unless)\s*\(/g,ce=/@(?:endif|endunless)(?![a-z])/g,de=/@else(?![a-z])/g,ue=[],$e;while(($e=le.exec(q))!==null)ue.push({pos:$e.index,type:"open"});while(($e=ce.exec(q))!==null)ue.push({pos:$e.index,type:"close"});while(($e=de.exec(q))!==null)ue.push({pos:$e.index,type:"else"});ue.sort((we,ye)=>we.pos-ye.pos);for(let we of ue)if(we.type==="open")ae++;else if(we.type==="close")ae--;else if(we.type==="else"&&ae===0){ie=we.pos;break}}let Z;if(ie!==-1){let ae=q.slice(0,ie),le=q.slice(ie+5);Z=`@if (${Q})${le}@else ${ae}@endif`}else Z=`@if (!(${Q}))${q}@endif`;R=R.substring(0,W)+Z+R.substring(H+10),B=!0}}R=Pl(R,_,k),R=Dl(R,_,k),R=Il(R,_);let T=()=>{let B=go(R);if(B.length===0)return!1;let z=Array(B.length);for(let U=B.length-1;U>=0;U--){let H=B[U];try{let q="",Q=!1;for(let ie of H.branches){if(Q)break;if(ie.type==="else")q=ie.content,Q=!0;else try{if(ie.condition?Xi(ie.condition,_):!1)q=ie.content,Q=!0}catch(Z){q=i(ie.type==="if"?"If":"Elseif",`Error in @${ie.type}(${ie.condition}): ${Z instanceof Error?Z.message:String(Z)}`,t.EVALUATION_ERROR),Q=!0}}z[U]=q}catch(q){let Q=q instanceof Error?q.message:String(q);z[U]=i("If",`Error processing @if block: ${Q}`,t.EVALUATION_ERROR)}}let W=Array(B.length*2+1),F=0;for(let U=0;U<B.length;U++){let H=B[U];W[U*2]=R.slice(F,H.start),W[U*2+1]=z[U],F=H.end}return W[B.length*2]=R.slice(F),R=W.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function Ap(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function Il(v,_){let k=v;function R(W,F,U,H){let q=1,Q=H,ie=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Z=new RegExp(`@${U}(?![a-z])`,"g");while(Q<W.length&&q>0){ie.lastIndex=Q,Z.lastIndex=Q;let ae=ie.exec(W),le=Z.exec(W),ce=ae?ae.index:1/0,de=le?le.index:1/0;if(ce<de)q++,Q=ce+ae[0].length;else if(de<1/0){if(q--,q===0)return de;Q=de+le[0].length}else break}return-1}function T(W,F,U){let H=0,q=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${U}(?![a-z])`,"g"),ie=/@else(?![a-z])/g,Z=[],ae;while((ae=q.exec(W))!==null)Z.push({pos:ae.index,type:"open"});while((ae=Q.exec(W))!==null)Z.push({pos:ae.index,type:"close"});while((ae=ie.exec(W))!==null)Z.push({pos:ae.index,type:"else"});Z.sort((le,ce)=>le.pos-ce.pos);for(let le of Z)if(le.type==="open")H++;else if(le.type==="close")H--;else if(le.type==="else"&&H===0)return le.pos;return-1}{let W=!0;while(W){W=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let U=F.index,H,q,Q=k.slice(U+5),ie=Ap(Q);if(ie)H=ie.value,q=U+5+ie.consumed;else q=U+5;let Z=R(k,"auth","endauth",q);if(Z===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let ae=k.slice(q,Z),le=T(ae,"auth","endauth"),ce;if(!_.auth)ce=!1;else ce=H?Pr(`auth?.check && auth?.user?.[${H}]`,_):Pr("auth?.check",_);let de;if(le!==-1){let ue=ae.slice(0,le),$e=ae.slice(le+5);de=ce?ue:$e}else de=ce?ae:"";k=k.substring(0,U)+de+k.substring(Z+8),W=!0}}{let W=!0;while(W){W=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let U=F.index,H,q,Q=k.slice(U+6),ie=Ap(Q);if(ie)H=ie.value,q=U+6+ie.consumed;else q=U+6;let Z=R(k,"guest","endguest",q);if(Z===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let ae=k.slice(q,Z),le=T(ae,"guest","endguest"),ce;if(!_.auth)ce=!0;else ce=H?Pr(`!auth?.check || !auth?.user?.[${H}]`,_):Pr("!auth?.check",_);let de;if(le!==-1){let ue=ae.slice(0,le),$e=ae.slice(le+5);de=ce?ue:$e}else de=ce?ae:"";k=k.substring(0,U)+de+k.substring(Z+9),W=!0}}function B(W,F,U){if(_.userCan&&typeof _.userCan[W]==="boolean")return _.userCan[W];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[W];if(F)H.push(F);if(U){let q=Pr(U,_);H.push(q)}return _.permissions.check(...H)}catch{return!1}return!1}function z(W){let F=W.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let W of["can","cannot"]){let F=`end${W}`,U=W==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let q=k.match(new RegExp(`@${W}\\s*\\(`));if(!q||q.index===void 0)break;let Q=q.index,ie=k.slice(Q+`@${W}`.length),Z=z(ie);if(!Z)break;let ae=Q+`@${W}`.length+Z.paramsEnd,le=R(k,W,F,ae);if(le===-1){console.warn(`[stx] @${W} directive at position ${Q} has no matching @${F} \u2014 the block was skipped.`);break}let ce=k.slice(ae,le),de=[],ue=0,$e=new RegExp(`@${W}\\s*\\(`,"g"),we=new RegExp(`@${F}(?![a-z])`,"g"),ye=new RegExp(`@${U}\\s*\\(`,"g"),Pe=/@else(?![a-z])/g,Oe=[],Me;while((Me=$e.exec(ce))!==null)Oe.push({pos:Me.index,type:"open"});while((Me=we.exec(ce))!==null)Oe.push({pos:Me.index,type:"close"});while((Me=ye.exec(ce))!==null)Oe.push({pos:Me.index,type:"elseDirective"});while((Me=Pe.exec(ce))!==null)Oe.push({pos:Me.index,type:"else"});Oe.sort((Be,je)=>Be.pos-je.pos);for(let Be of Oe){if(Be.type==="open"){ue++;continue}if(Be.type==="close"){ue--;continue}if(ue===0)de.push(Be)}let Ne=[],Le=0;for(let Be=0;Be<de.length;Be++){let je=de[Be];if(Ne.push({content:ce.slice(Le,je.pos),ability:void 0}),je.type==="elseDirective"){let st=ce.slice(je.pos+`@${U}`.length),ht=z(st);if(ht){Ne[Ne.length-1]={content:ce.slice(Le,je.pos)},Le=je.pos+`@${U}`.length+ht.paramsEnd,Ne.push({content:"",ability:ht.ability,type:ht.type,id:ht.id}),Ne.pop();let yt=de[Be+1],vt=yt?yt.pos:ce.length;Ne.push({content:ce.slice(Le,vt),ability:ht.ability,type:ht.type,id:ht.id}),Le=vt}}else Le=je.pos+5}if(Le<ce.length){let Be=Ne[Ne.length-1];if(de.length>0&&de[de.length-1].type==="else")Ne.push({content:ce.slice(Le),isFinalElse:!0});else if(Ne.length===0)Ne.push({content:ce.slice(Le)})}let De=B(Z.ability,Z.type,Z.id),ze=W==="can"?De:!De,Ve="";if(ze)Ve=Ne[0]?.content||"";else{let Be=!1;for(let je=1;je<Ne.length;je++){let st=Ne[je];if(st.isFinalElse){Ve=st.content,Be=!0;break}if(st.ability){let ht=B(st.ability,st.type,st.id);if(W==="can"?ht:!ht){Ve=st.content,Be=!0;break}}}if(!Be&&Ne.length>0){let je=Ne[Ne.length-1];if(je.isFinalElse)Ve=je.content}}k=k.substring(0,Q)+Ve+k.substring(le+`@${F}`.length),H=!0}}return k}function Pl(v,_,k){let R=v;function T(B,z,W,F,U){let H=!0;while(H){H=!1;let q=new RegExp(`@${z}\\s*\\(`),Q=B.match(q);if(!Q||Q.index===void 0)break;let ie=Q.index,Z=Dr(B,ie+`@${z}`.length);if(!Z)break;let ae=Z.endPos,le=Kr(B,z,W,ae);if(le===-1){console.warn(`[stx] @${z} directive at position ${ie} has no matching @${W} \u2014 the block was skipped.`);break}let ce=B.slice(ae,le),de=Z.expression,ue=-1,$e=0,we=0;while(we<ce.length){let ye=ce.indexOf("@",we);if(ye===-1)break;let Pe=ce.substring(ye);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Pe)){$e++,we=ye+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Pe)){$e--,we=ye+1;continue}if($e===0&&/^@else(?![a-z])/.test(Pe)){ue=ye;break}we=ye+1}try{let ye=F(de.trim()),Pe;if(ue!==-1){let Oe=ce.slice(0,ue),Me=ce.slice(ue+5);Pe=ye?Oe:Me}else Pe=ye?ce:"";B=B.substring(0,ie)+Pe+B.substring(le+`@${W}`.length),H=!0}catch(ye){let Pe=ye instanceof Error?ye.message:String(ye),Oe=i(U,`Error processing @${z} directive: ${Pe}`,t.EVALUATION_ERROR);B=B.substring(0,ie)+Oe+B.substring(le+`@${W}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=Pr(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=Pr(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function Dl(v,_,k){let R=v,T="development";function B(z,W,F,U){let H=new RegExp(`@${W}(?![a-z])`,"g"),q=new RegExp(`@${F}(?![a-z])`,"g"),Q=new RegExp(`^@${W}(?![a-z])`),ie=new RegExp(`^@${F}(?![a-z])`),Z=z,ae=!0;while(ae){ae=!1,H.lastIndex=0;let le=H.exec(Z);if(!le)break;let ce=le.index,de=ce+le[0].length;if(W==="env"){let De=Z.substring(de).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!De)break;de+=De[0].length,U=T===De[2]}let ue=1,$e=de,we=-1;while(ue>0&&$e<Z.length){H.lastIndex=$e,q.lastIndex=$e;let De=H.exec(Z),ze=q.exec(Z),Ve=De?De.index:1/0,Be=ze?ze.index:1/0;if(Ve<Be)ue++,$e=Ve+De[0].length;else if(Be<1/0){if(ue--,ue===0){we=Be;break}$e=Be+ze[0].length}else break}if(we===-1){console.warn(`[stx] @${W} directive at position ${ce} has no matching @${F} \u2014 the block was skipped.`);break}let ye=Z.substring(de,we),Pe=-1,Oe=0,Me=0;while(Me<ye.length){let De=ye.indexOf("@",Me);if(De===-1)break;let ze=ye.substring(De);if(Q.test(ze)){Oe++,Me=De+1;continue}if(ie.test(ze)){Oe--,Me=De+1;continue}if(Oe===0&&/^@else(?![a-z])/.test(ze)){Pe=De;break}Me=De+1}let Ne;if(Pe!==-1){let De=ye.slice(0,Pe),ze=ye.slice(Pe+5);Ne=U?De:ze}else Ne=U?ye:"";let Le=`@${F}`.length;Z=Z.substring(0,ce)+Ne+Z.substring(we+Le),ae=!0}return Z}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var Tp=new WeakMap;function Ip(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Sa(v,_){if(!v)return _?.nonceGenerator?.()??Ip();let k=Tp.get(v);if(!k)k=_?.nonceGenerator?.()??Ip(),Tp.set(v,k);return k}function bb(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function Pp(v,_){return`<meta http-equiv="Content-Security-Policy" content="${bb(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Dp(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let R=_.useNonce?Sa(k,_):void 0,T=Pp(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
2294
+ ${T}`)}function Op(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function Mp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?Sa(_,B):void 0;return Pp(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return Sa(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=Sa(_,B);return T}import vb from"crypto";var wb=40,Np="_token",Ol=null;function Sb(v=wb){let _=vb.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Ol=_,_}function $b(){if(!Ol)Sb();return Ol}function _b(v=Np){let _=$b();return`<input type="hidden" name="${v}" value="${_}">`}function jp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>_b(R||Np))}async function Lp(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await kb(T,B,_,k,R);else T=await Eb(T,B,_,k,R)}return T}async function kb(v,_,k,R,T){let{name:B,handler:z}=_,W=`@${B}`,F=`@end${B}`,U=v,H=Fr(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),q=[],Q=H.exec(U);while(Q!==null){let[ie,Z="",ae=""]=Q,le=Q.index||0;try{let ce=Z?Bp(_,Z):[],de=ae.trim(),ue=await z(de,ce,k,R);q.push({original:ie,processed:ue,startIndex:le})}catch(ce){let de=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);q.push({original:ie,processed:i("CustomDirective",`Error in @${B}${Z?`(${Z})`:""}: ${de}`,t.EVALUATION_ERROR),startIndex:le})}Q=H.exec(U)}for(let ie=q.length-1;ie>=0;ie--){let{original:Z,processed:ae}=q[ie];U=U.replace(Z,ae)}return U}async function Eb(v,_,k,R,T){let{name:B,handler:z}=_,W=v,F=[],U=[];if(_.rawParams){for(let Q of Gs(W,Fr(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(Q.end!==-1)U.push({fullMatch:Q.call,paramString:Q.args,startIndex:Q.start})}else{let Q=Fr(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Q.lastIndex=0;let ie=Q.exec(W);while(ie!==null)U.push({fullMatch:ie[0],paramString:ie[1]??"",startIndex:ie.index||0}),ie=Q.exec(W)}for(let{fullMatch:Q,paramString:ie,startIndex:Z}of U)try{let ae=Bp(_,ie),le=await z("",ae,k,R);F.push({original:Q,processed:le,startIndex:Z})}catch(ae){let le=ae instanceof Error?ae.message:String(ae);if(T.debug)console.error(`Error processing custom directive @${B}:`,ae);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}(${ie}): ${le}`,t.EVALUATION_ERROR),startIndex:Z})}let H=Fr(`@${B}(?!\\w)(?!\\s*\\()`,"g"),q=H.exec(W);while(q!==null){let[Q]=q,ie=q.index||0;try{let Z=await z("",[],k,R);F.push({original:Q,processed:Z,startIndex:ie})}catch(Z){let ae=Z instanceof Error?Z.message:String(Z);if(T.debug)console.error(`Error processing custom directive @${B}:`,Z);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}: ${ae}`,t.EVALUATION_ERROR),startIndex:ie})}q=H.exec(W)}for(let Q=F.length-1;Q>=0;Q--){let{original:ie,processed:Z}=F[Q];W=W.replace(ie,Z)}return W}function Bp(v,_){return v.rawParams?ot(_):Cb(_)}function Cb(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var zp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Wp=/^[A-Za-z_$][\w$]*$/,Rb=new Set(["light","dark","system"]);function Xr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Ab(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Xr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Xr(R.key,"colorMode.key"),Xr(R.attribute,"colorMode.attribute"),Xr(R.default,"colorMode.default"),!Wp.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!zp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Rb.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Xr(k.key,"appearance.key"),Xr(k.attribute,"appearance.attribute"),Xr(k.default,"appearance.default"),!Wp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!zp.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((B)=>typeof B!=="string"||B.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function Tb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Ib(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Tb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Pb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Fp(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Pb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=k.slice(B+1,z).trim(),F=l(`(${W})`,_),U=Ib(Ab(F));k=k.slice(0,T.index)+U+k.slice(z+1),R.lastIndex=T.index+U.length}return k}import Db from"crypto";function nn(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Up={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function $a(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function On(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function fs(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${nn(_)}"`}function Ml(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${nn(`${On(v)}-error`)}"`;return R}function Ob(){return Db.randomUUID()}function _a(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=Ob();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${nn(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${nn(B)}">`;return R}),k}function Hp(v,_,k=Up){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,W,F,U="")=>{let H=B||z||"POST",q=W||F||"",Q=Or(U),ie=H.toUpperCase(),Z=["GET","POST"].includes(ie)?ie:"POST",ae=`<form method="${nn(Z)}" action="${nn(q)}"${Q?` ${Q}`:""}>`;if(ae+=`
2295
+ ${_a("@csrf",_)}`,!["GET","POST"].includes(ie))ae+=`
2296
+ ${_a(`@method('${ie}')`,_)}`;return ae}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,W,F,U="")=>{let H=B||z||"",q=W||F||"",Q=Or(U),ie=mo(H,_),Z=ie!==void 0&&ie!==null?ie:q||"",ae=Q.match(/type=['"]([^'"]+)['"]/i),le=ae?ae[1]:"text",ce=ho(H,_),de=Q.match(/class=['"]([^'"]+)['"]/i),ue=$a(de?de[1]:"",k.input,ce,k.inputError),$e=Q.replace(/class=['"][^'"]+['"]/i,"");return $e=$e.replace(/type=['"][^'"]+['"]/i,""),`<input type="${nn(le)}" name="${nn(H)}"${fs(Q,On(H))} value="${nn(Z)}" class="${ue}"${Ml(H,ce,Q)}${$e?` ${$e}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",W="")=>{let F=Or(z),U=mo(B,_)||W.trim(),H=ho(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=$a(q?q[1]:"",k.input,H,k.inputError),ie=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${nn(B)}"${fs(F,On(B))} class="${Q}"${Ml(B,H,F)}${ie?` ${ie}`:""}>${nn(U)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",W)=>{let F=Or(z),U=mo(B,_),H=ho(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=$a(q?q[1]:"",k.input,H,k.inputError),ie=F.replace(/class=['"][^'"]+['"]/i,""),Z=W;if(U!==void 0)Z=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(ae,le,ce)=>{if((Array.isArray(U)?U.some((ue)=>String(ue)===ce):String(U)===ce)&&!le.includes("selected"))return le.replace(/(<option)/,"$1 selected");return ae});return`<select name="${nn(B)}"${fs(F,On(B))} class="${Q}"${Ml(B,H,F)}${ie?` ${ie}`:""}>${Z}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=z===void 0?"1":z,U=z===void 0?On(B):`${On(B)}-${On(F)}`,H=Or(W),q=mo(B,_),Q=q!==void 0&&(Array.isArray(q)?q.some((le)=>String(le)===F):q===!0||String(q)===F),ie=H.match(/class=['"]([^'"]+)['"]/i),Z=ie?ie[1]:k.checkInput,ae=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${nn(B)}"${fs(H,U)} value="${nn(F)}" class="${Z}"${Q?" checked":""}${ae?` ${ae}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=Or(W),U=mo(B,_),H=U!==void 0&&U===z,q=F.match(/class=['"]([^'"]+)['"]/i),Q=q?q[1]:k.checkInput,ie=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${nn(B)}"${fs(F,`${On(B)}-${On(z)}`)} value="${nn(z)}" class="${Q}"${H?" checked":""}${ie?` ${ie}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let W=Or(z),F=W.match(/accept=['"]([^'"]+)['"]/i),U=F?F[1]:"",H=W.includes("multiple"),q=ho(B,_),Q=W.match(/class=['"]([^'"]+)['"]/i),ie=$a(Q?Q[1]:"",k.input,q,k.inputError),Z=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),ae=[`<input type="file" name="${nn(B)}"${fs(W,On(B))}`,`class="${ie}"`];if(U)ae.push(`accept="${nn(U)}"`);if(H)ae.push("multiple");if(Z)ae.push(Z);return`${ae.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",W)=>{let F=Or(z),U=F.match(/class=['"]([^'"]+)['"]/i),H=U?U[1]:k.label,q=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${nn(On(B))}" class="${H}"${q?` ${q}`:""}>${W}</label>`}),R}function qp(v,_,k=Up){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(ho(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(W,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Vp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Vp(T,_)}let U=F.trim();if(p(U)){let H=l(U,_);return H!==void 0?String(H):U}return U}catch{return F}});return`<div id="${nn(`${On(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function ho(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Vp(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function mo(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function Or(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var yo=/<\/?template\b[^>]*>/gi,Mb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Nb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Mb.test(_)}function re(v){yo.lastIndex=0;let _;while((_=yo.exec(v))!==null){if(_[0].startsWith("</")||Nb(_[0]))continue;let k=_.index,R=yo.lastIndex,T=1,B;while((B=yo.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:yo.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import Zt from"path";import{existsSync as ow}from"fs";class Kp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=ic(v,R);if(T!==void 0)return T;for(let B of oc(v,_,k,R))if(await r(B))return B;return null}}var Bs=new Kp;function qt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Mr="\x00stx-boolean-attribute";function Nl(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var jb=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function jl(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||jb.has(_)}function Nr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(qt(B));continue}if(T===Mr){k.push(qt(B));continue}k.push(`${qt(B)}="${qt(Nl(String(T)))}"`)}return k}function jr(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(qt(B));continue}if(typeof T==="object")continue;k.push(`${qt(B)}="${qt(Nl(String(T)))}"`)}return k}function zs(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Lb(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var Ll={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Lb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",W=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(R.reactive)F.push(`:href="${zs(R.value)}"`);else F.push(`href="${zs(to(R.value,"navigable"))}"`);if(T)F.push(`class="${zs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${zs(B)}"`),F.push(`data-stx-exact-active-class="${zs(z)}"`),W)F.push("data-stx-prefetch");let U=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(U)F.push(`data-stx-active-match="${zs(U)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...Nr(v,H)),F.push(...jr(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as og}from"crypto";import fn from"fs";import an from"path";import{decode as qb,generateThumbHash as Kb}from"ts-images";import{createImageDeliveryCatalog as Qp}from"ts-images/delivery";import Bl from"fs";function ka(v,_,k){let R=Buffer.alloc(k),T=Bl.readSync(v,R,0,k,_);return R.subarray(0,T)}function zl(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function Wl(v){let _;try{_=Bl.openSync(v,"r");let k=ka(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=ka(_,T,8);if(z.length<8)return"unknown";let W=z.toString("latin1",4,8);if(W==="tRNS")return"possible";if(W==="IDAT"||W==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(zl(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)Bl.closeSync(_)}}import Bb from"fs";import Ea from"os";import{join as Xp}from"path";import{fileURLToPath as Zp}from"url";import{Worker as Gp}from"worker_threads";var Ra=Symbol("stx.image-worker.unavailable");function zb(v=typeof Ea.availableParallelism==="function"?Ea.availableParallelism():Ea.cpus().length){return Math.max(1,Math.min(2,v-1))}var Ca=0,Yp=[];async function Wb(){if(Ca<zb()){Ca++;return}await new Promise((v)=>Yp.push(v)),Ca++}function Fb(){Ca--,Yp.shift()?.()}var Vb="@stacksjs/stx/builtins/image-warmup-worker";function Ub(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Bb.existsSync(Zp(k)))return Zp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Vb,v):void 0;return k&&Hb(k)?k:void 0}catch{return}}function Hb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Xp(_.BUN_INSTALL||Xp(Ea.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Jp=!1;function xo(v){if(!Jp)Jp=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ra}function Fl(v){return v instanceof Error?v.message:String(v)}async function Vl(v,_){if(typeof Gp!=="function")return xo("node:worker_threads has no Worker in this runtime");let k=Ub();if(!k)return xo("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Wb();try{return await new Promise((R,T)=>{let B;try{B=new Gp(k)}catch(U){R(xo(`could not start ${k}: ${Fl(U)}`));return}let z=!1,W=!1,F=(U)=>{if(W)return;W=!0,U(),B.terminate()};B.on("message",(U)=>{if(U.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(U.type==="result"){F(()=>R(U.value));return}let H=Error(U.error?.message??"image worker failed");if(U.error?.name)H.name=U.error.name;if(U.error?.stack)H.stack=U.error.stack;F(()=>T(H))}),B.on("error",(U)=>{F(()=>z?T(U instanceof Error?U:Error(Fl(U)||"image worker crashed")):R(xo(`the worker failed before it was ready: ${Fl(U)}`)))}),B.on("exit",(U)=>{F(()=>z?T(Error("image worker exited before it finished")):R(xo(`the worker exited with code ${U} before it was ready`)))})})}finally{Fb()}}var Xb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Zb=[320,640,960,1280,1920],bo="/_stx/images",Gb=`stx:${bo}:alpha-1`,Jb=`stx:${bo}:opaque-1`,Yb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Aa;function Qb(v,_){let k=an.dirname(Bun.resolveSync(v,_));while(k!==an.dirname(k)){let R=an.join(k,"package.json");if(fn.existsSync(R)){let T=JSON.parse(fn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=an.dirname(k)}return}function eg(){if(Aa!==void 0)return Aa;let v;try{v=an.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Aa=Yb.map((_)=>{let k;try{k=v?Qb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),Aa}var tg=Symbol.for("stx.image-delivery");function vo(){let v=globalThis;return v[tg]??={catalog:new Map,transparent:new Set},v[tg]}var ng=new Set;function ev(v){return`/${v.split(an.sep).map(encodeURIComponent).join("/")}`}function tv(v){let _=an.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=og("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function rg(v,_=`stx:${bo}`){let k=(R)=>`${bo}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=an.join(v,R);try{let B=await fn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=an.join(v,R);await fn.promises.mkdir(an.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await fn.promises.writeFile(z,T),await fn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function ag(v,_=v){let k=await fn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=an.join(_,T.name);if(T.isDirectory()){R.push(...await ag(v,B));continue}if(!T.isFile()||!Xb.has(an.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:an.relative(v,B)})}return R}function sg(v,_){return v.map((k)=>({key:ev(k.relativePath),input:k.absolutePath,name:tv(k.relativePath),...nv(k.absolutePath)?{options:{storage:_}}:{}}))}function nv(v){return Wl(v)==="possible"}function rv(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function sv(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let W=z.variants.filter((F)=>F.format==="png").sort((F,U)=>F.width-U.width)[0];try{let F=await qb(new Uint8Array(await fn.promises.readFile(W?.path??z.fallback.path)));if(rv(F.data))k.add(B)}catch{k.add(B)}}));return k}function iv(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((W)=>W.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((W)=>{let F;try{return F=fn.openSync(W.path,"r"),!zl(ka(F,0,32))}catch{return!0}finally{if(F!==void 0)fn.closeSync(F)}}))continue;if(T.variants=T.variants.filter((W)=>W.format!=="webp"),delete T.sources.webp,k.push(R),!ng.has(R))ng.add(R),console.warn(`[stx-images] ${R} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function ov(v){let _=[],k=8;for(let R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await Kb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Ul(v){return an.join(v,"undecodable.json")}function av(v){try{let _=fn.readFileSync(Ul(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function cv(v,_){try{fn.mkdirSync(an.dirname(Ul(v)),{recursive:!0}),fn.writeFileSync(Ul(v),JSON.stringify(_))}catch{}}function ig(v){try{let _=fn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function cg(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function bs(v){let _=cg(v);return _?vo().catalog.get(_):void 0}function vs(v){let _=cg(v);return _?vo().transparent.has(_):!1}function ws(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function dd(v){let _=bs(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:ws(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:vs(v)?void 0:_.placeholder?.dataUrl}}function ir(){let v=vo();v.catalog=new Map,v.transparent=new Set}function lv(v){let _=vo();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function pd(v,_,k={}){if(!v||!fn.existsSync(v))return ir(),{count:0,fingerprint:""};if(k.offThread){let Z=await Vl("delivery",{publicDir:v,outputDir:_});if(Z!==Ra)return lv(Z.state),Z.result}let R=await ag(v);if(R.length===0)return ir(),{count:0,fingerprint:""};let T=av(_),B=R.filter((Z)=>{let ae=T[Z.relativePath];if(!ae)return!0;let le=ig(Z.absolutePath);return!le||le.mtimeMs!==ae.mtimeMs||le.size!==ae.size});if(B.length===0)return ir(),{count:0,fingerprint:""};let z=rg(an.join(_,"_stx","images"),`${Gb}:${eg()}`),W={outDir:an.join(_,"_stx","images"),storage:rg(an.join(_,"_stx","images"),`${Jb}:${eg()}`),baseUrl:bo,widths:Zb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=B,U;try{U=await Qp({...W,entries:sg(B,z)})}catch(Z){if(F=await ov(B),F.length===B.length)throw Z;let ae=new Set(F.map((ce)=>ce.relativePath)),le=!1;for(let ce of B){if(ae.has(ce.relativePath))continue;let de=ig(ce.absolutePath);if(!de)continue;T[ce.relativePath]=de,le=!0}if(le)cv(_,T);if(F.length===0)return ir(),{count:0,fingerprint:""};U=await Qp({...W,entries:sg(F,z)})}let H=await sv(U.entries),q=iv(U.entries,H),Q=vo();Q.catalog=new Map(Object.entries(U.entries)),Q.transparent=H;let ie=H.size===0&&q.length===0?U.fingerprint:og("sha256").update(U.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:q.sort()})).digest("hex");return{count:F.length,fingerprint:ie}}var uv=new Map;function Hl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return uv.get(_)}var dv={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},ql=[320,640,768,1024,1280,1536,1920];function en(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function tn(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Ta(v,_,k=!1){let R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Kl(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=dv[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let W=Number.parseInt(T);if(!Number.isNaN(W))k.push(`(max-width: ${W}px) ${B}`)}}else k.push(R);return k.join(", ")}function Xl(v,_,k,R){return _.map((T)=>`${wo(v,T,void 0,k,R)} ${T}w`).join(", ")}function fv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${wo(v,z,void 0,R,T)} ${B}x`}).join(", ")}function wo(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function pv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function gv(v,_,k="#e5e7eb"){let R=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(R)}`}var Zl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=tn(v,"src")||"",T=bs(R),B=tn(v,"alt")||"",z=tn(v,"width")||(T?String(T.source.width):void 0),W=tn(v,"height")||(T?String(T.source.height):void 0),F=tn(v,"sizes"),U=tn(v,"srcset"),H=tn(v,"densities"),q=tn(v,"format"),Q=vs(R)||Hl(R)?.transparent===!0,ie=tn(v,"placeholder")||(T&&!Q?"thumbhash":void 0),Z=tn(v,"placeholderColor")||"#e5e7eb",ae=tn(v,"provider"),le=tn(v,"class")||tn(v,"className")||"",ce=tn(v,"style")||"",de=tn(v,"objectFit")||tn(v,"fit"),ue=tn(v,"objectPosition")||tn(v,"position"),$e=tn(v,"quality"),we=Ta(v,"lazy",!0),ye=Ta(v,"preload",!1),Pe=Ta(v,"priority",!1),Oe=tn(v,"loading"),Me=tn(v,"decoding")||"async",Ne=!!T||Ta(v,"picture",!1)||!!q,Le=z?Number.parseInt(z):void 0,De=W?Number.parseInt(W):void 0,ze=U||"",Ve="";if(T)ze=T.sources[T.fallback.format]||"",Ve=F?Kl(F):"100vw";else if(!ze&&F&&ae&&ae!=="local"&&ae!=="static")ze=Xl(R,ql,ae,q),Ve=Kl(F);else if(!ze&&H){let xt=H.split(/\s+/).map((ct)=>Number.parseFloat(ct.replace("x","")));ze=fv(R,xt,Le,ae,q)}else if(F)Ve=Kl(F);let Be=[];if(ce)Be.push(ce);if(de)Be.push(`object-fit:${de}`);if(ue)Be.push(`object-position:${ue}`);if(Le&&De)Be.push(`aspect-ratio:${Le}/${De}`);let je=[],st=ie==="blur"||ie==="color"||ie==="thumbhash";if(st&&!Q){let xt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:Z}:Hl(R);if(xt&&ie==="color")Be.push(`background-color:${xt.color}`),je.push("backgroundColor");else if(xt)Be.push(`background-color:${xt.color}`),Be.push(`background-image:url(${xt.dataUrl})`),Be.push("background-size:cover"),Be.push("background-repeat:no-repeat"),je.push("backgroundColor","backgroundImage");else{let ct=gv(Le||16,De||9,Z);Be.push(`background-image:url(${ct})`),Be.push("background-size:cover"),Be.push("background-repeat:no-repeat"),je.push("backgroundImage")}}else if(!st&&ie&&ie!=="empty"&&ie!=="none")Be.push(`background-image:url(${en(ie)})`),Be.push("background-size:cover"),Be.push("background-repeat:no-repeat"),je.push("backgroundImage");let ht=T?.fallback.url||wo(R,Le,De,ae,q),yt=[];if(yt.push(`src="${en(to(ht,"fetched"))}"`),yt.push(`alt="${en(B)}"`),z)yt.push(`width="${en(z)}"`);if(W)yt.push(`height="${en(W)}"`);let vt=Oe||(Pe||ye?"eager":we?"lazy":"");if(vt)yt.push(`loading="${en(vt)}"`);if(Pe)yt.push('fetchpriority="high"');if(yt.push(`decoding="${en(Me)}"`),le)yt.push(`class="${en(le)}"`);if(Be.length>0)yt.push(`style="${en(Be.join(";"))}"`);if(ze)yt.push(`srcset="${en(to(ze,"fetched"))}"`);if(Ve)yt.push(`sizes="${en(Ve)}"`);let dt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(je.length>0){let xt=typeof v.static.onload==="string"?v.static.onload:"",ct=pv(je)+(xt?`;${xt}`:"");yt.push(`onload="${en(ct)}"`),dt.add("onload")}yt.push(...Nr(v,dt)),yt.push(...jr(v,dt));let wt=`<img ${yt.join(" ")} />`,kt="";if(ye){let ct=q==="webp"?"image/webp":q==="avif"?"image/avif":"";kt=`<link rel="preload" as="image" href="${en(ht)}"${ct?` type="${ct}"`:""}${ze?` imagesrcset="${en(ze)}"`:""}${Ve?` imagesizes="${en(Ve)}"`:""} />
2297
+ `}if(Ne){let xt=[];if(T)for(let ct of ws(T))xt.push(`<source type="image/${ct.format}" srcset="${en(ct.srcset)}"${Ve?` sizes="${en(Ve)}"`:""} />`);if(!T&&(q==="avif"||q==="auto")){let ct=wo(R,Le,De,ae,"avif"),St=ze?Xl(R,ql,ae,"avif"):`${ct}`;xt.push(`<source type="image/avif" srcset="${en(St)}"${Ve?` sizes="${en(Ve)}"`:""} />`)}if(!T&&(q==="webp"||q==="auto")){let ct=wo(R,Le,De,ae,"webp"),St=ze?Xl(R,ql,ae,"webp"):`${ct}`;xt.push(`<source type="image/webp" srcset="${en(St)}"${Ve?` sizes="${en(Ve)}"`:""} />`)}return`${kt}<picture>
2298
+ ${xt.join(`
2299
+ `)}
2300
+ ${wt}
2301
+ </picture>`}return`${kt}${wt}`}};var lg="/images/safe-image-default.svg";function So(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ei(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var mv=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${lg}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Gl={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let R=ei(v,"src")||"",T=ei(v,"alt")||"",B=ei(v,"fallback")||lg,z=ei(v,"class")||ei(v,"className")||"",W=ei(v,"fallbackClassName")||"",F=[];if(F.push(`src="${So(R)}"`),F.push(`alt="${So(T)}"`),z)F.push(`class="${So(z)}"`);if(F.push(`data-fallback="${So(B)}"`),W)F.push(`data-fallback-class="${So(W)}"`);F.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);F.push(...Nr(v,U)),F.push(...jr(v,U));let H=`<img ${F.join(" ")} />`,q=k.context;if(!q.__safeImageHandlerEmitted)return q.__safeImageHandlerEmitted=!0,`${mv}${H}`;return H}};function Jl(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function $o(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Ia(v,_,k){let R=$o(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var Yl={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let R=Jl($o(v,"color")||"#6366f1"),T=Jl($o(v,"initialColor")||$o(v,"initial-color")||""),B=Jl($o(v,"height")||"3px"),z=Ia(v,"duration",2000),W=Ia(v,"throttle",200),F=Ia(v,"zIndex",999999)||Ia(v,"z-index",999999),U=T?`linear-gradient(to right, ${T}, ${R})`:R;return`
2302
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${B};background:${U};z-index:${F};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
2303
+ <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
2304
+ </div>
2305
+ <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
2306
+ <script>
2307
+ (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${W})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
2308
+ </script>`}};function dg(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function hv(v,_,k){let R=dg(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var ug={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},Ql={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let R=qt(dg(v,"position")||"top-right"),T=hv(v,"max",5),B=ug[R]||ug["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${R}" data-stx-toast-max="${T}" style="position:fixed;${B};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
2309
+ <style>
2310
+ @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
2311
+ @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
2312
+ @keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
2313
+ @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
2314
+ @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
2315
+ @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
2316
+ </style>`}};function Pa(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var fg={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},eu={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let R=Pa(v,"id");if(!R)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=qt(R),B=Pa(v,"size")||"md",z=Pa(v,"closeOnBackdrop")!=="false",W=Pa(v,"closeOnEscape")!=="false",F=fg[B]||fg.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${z}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
2317
+ <div class="stx-modal-panel" style="${F};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
2318
+ <div style="padding:1.5rem">${_}</div>
2319
+ </div>
2320
+ </div>
2321
+ <style>
2322
+ @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
2323
+ .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
2324
+ .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
2325
+ </style>`}};function ti(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var pg={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},tu={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let R=ti(v,"id");if(!R)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=qt(R),B=ti(v,"side")||"right",z=ti(v,"size")||"md",W=ti(v,"closeOnBackdrop")!=="false",F=ti(v,"closeOnEscape")!=="false",U=ti(v,"overlay")!=="false",H=pg[z]||pg.md,q=B==="left",Q=q?"left:0":"right:0",ie=q?"translateX(-100%)":"translateX(100%)",Z=q?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${T}" class="stx-drawer-backdrop" data-stx-drawer="${T}" data-close-backdrop="${W}" data-close-escape="${F}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
2326
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${Q};width:${H};max-width:100vw;transform:${ie};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
2327
+ <div style="padding:1.5rem">${_}</div>
2328
+ </div>
2329
+ </div>
2330
+ <style>
2331
+ @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
2332
+ .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
2333
+ .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
2334
+ </style>`}};import{existsSync as yv,readFileSync as xv}from"fs";var Da=new Map,gg=new Set;function bv(v){if(gg.has(v))return;gg.add(v),console.warn(`[stx] icon collection "${v}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${v}\`.`)}function vv(v){let _=process.cwd();for(let k of[`${_}/node_modules/@iconify-json/${v}/icons.json`,`${_}/pantry/@iconify-json/${v}/icons.json`,`${_}/node_modules/@iconify/json/json/${v}.json`,`${_}/pantry/@iconify/json/json/${v}.json`])if(yv(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return d.resolve(k)}catch{}return null}function wv(v){if(Da.has(v))return Da.get(v);let _=vv(v);if(!_)return bv(v),null;try{let k=JSON.parse(xv(_,"utf8"));return Da.set(v,k.icons),k.icons}catch{return null}}function ni(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);if(v.static[_]!==void 0)return String(v.static[_]);if(v.clientReactive[_]!==void 0)return v.clientReactive[_];return}var nu={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=ni(v,"name")??ni(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",B=R;if(R.includes(":")){let de=R.split(":");T=de[0],B=de[1]}let z=qt(ni(v,"size")||"24"),W=qt(ni(v,"color")||"currentColor"),F=qt(ni(v,"class")||""),U=qt(ni(v,"style")||""),H=Da.get(T)??wv(T);if(!H)return`<!-- Icon: collection "${T}" not loaded -->`;let q=H[B];if(!q)return`<!-- Icon: "${B}" not found in ${T} -->`;let Q=q.width||24,ie=q.height||24,Z=`0 0 ${Q} ${ie}`,ae=q.body;if(W!=="currentColor")ae=ae.replace(/currentColor/g,W);let le=F?` class="${F}"`:"",ce=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${z}" height="${z}" viewBox="${Z}" fill="none"${le}${ce}>${ae}</svg>`}};function ru(){return`
2335
+ (function(){
2336
+ var tip=null,hideTimer=null,currentEl=null;
2337
+
2338
+ function createTip(){
2339
+ tip=document.createElement("div");
2340
+ tip.id="stx-tooltip";
2341
+ tip.style.cssText="position:absolute;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;z-index:999999;pointer-events:none;opacity:0;transition:opacity .15s ease;white-space:pre-wrap;word-wrap:break-word;box-shadow:0 2px 8px rgba(0,0,0,.25)";
2342
+ var arrow=document.createElement("div");
2343
+ arrow.className="stx-tip-arrow";
2344
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
2345
+ tip.appendChild(arrow);
2346
+ var text=document.createElement("span");
2347
+ text.className="stx-tip-text";
2348
+ tip.appendChild(text);
2349
+ document.body.appendChild(tip);
2350
+ }
2351
+
2352
+ function position(el){
2353
+ var pos=el.getAttribute("x-tooltip-position")||"top";
2354
+ var r=el.getBoundingClientRect();
2355
+ var sy=window.scrollY,sx=window.scrollX;
2356
+ tip.style.display="block";
2357
+ tip.style.opacity="0";
2358
+ // Force layout so we can measure
2359
+ var tw=tip.offsetWidth,th=tip.offsetHeight;
2360
+ var arrow=tip.querySelector(".stx-tip-arrow");
2361
+ var left,top;
2362
+
2363
+ if(pos==="top"){
2364
+ left=r.left+r.width/2-tw/2+sx;
2365
+ top=r.top-th-8+sy;
2366
+ if(top-sy<0){pos="bottom";}
2367
+ }
2368
+ if(pos==="bottom"){
2369
+ left=r.left+r.width/2-tw/2+sx;
2370
+ top=r.bottom+8+sy;
2371
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
2372
+ }
2373
+ if(pos==="left"){
2374
+ left=r.left-tw-8+sx;
2375
+ top=r.top+r.height/2-th/2+sy;
2376
+ if(left-sx<0){pos="right";}
2377
+ }
2378
+ if(pos==="right"){
2379
+ left=r.right+8+sx;
2380
+ top=r.top+r.height/2-th/2+sy;
2381
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
2382
+ }
2383
+
2384
+ // Set arrow for top/left after potential flips
2385
+ if(pos==="top"){
2386
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
2387
+ }
2388
+ if(pos==="left"){
2389
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
2390
+ }
2391
+
2392
+ // Clamp horizontal
2393
+ if(left<sx+4) left=sx+4;
2394
+ if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
2395
+
2396
+ tip.style.left=left+"px";
2397
+ tip.style.top=top+"px";
2398
+ tip.style.opacity="1";
2399
+ }
2400
+
2401
+ function showTip(el){
2402
+ if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
2403
+ if(!tip) createTip();
2404
+ var text=el.getAttribute("x-tooltip");
2405
+ if(!text) return;
2406
+ tip.querySelector(".stx-tip-text").textContent=text;
2407
+ currentEl=el;
2408
+ position(el);
2409
+ }
2410
+
2411
+ function hideTip(){
2412
+ if(!tip) return;
2413
+ tip.style.opacity="0";
2414
+ hideTimer=setTimeout(function(){
2415
+ if(tip) tip.style.display="none";
2416
+ currentEl=null;
2417
+ },150);
2418
+ }
2419
+
2420
+ document.addEventListener("mouseover",function(e){
2421
+ var el=e.target.closest("[x-tooltip]");
2422
+ if(el) showTip(el);
2423
+ });
2424
+ document.addEventListener("mouseout",function(e){
2425
+ var el=e.target.closest("[x-tooltip]");
2426
+ if(el&&el===currentEl) hideTip();
2427
+ });
2428
+ document.addEventListener("focusin",function(e){
2429
+ var el=e.target.closest("[x-tooltip]");
2430
+ if(el) showTip(el);
2431
+ });
2432
+ document.addEventListener("focusout",function(e){
2433
+ var el=e.target.closest("[x-tooltip]");
2434
+ if(el) hideTip();
2435
+ });
2436
+ })();
2437
+ `}function mg(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}function hg(v,_){let k=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${_}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),R=v.match(k);if(!R)return{region:null,rest:v};return{region:R[2],rest:v.replace(R[0],"")}}var su={name:"Suspense",aliases:["suspense"],render(v,_,k){let R=hg(_,"fallback"),T=R.rest,B=hg(T,"error"),z=B.rest,W=R.region??mg(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',F=B.region??mg(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${W}</div><div data-stx-suspense-error hidden>${F}</div><div data-stx-suspense-content hidden>${z}</div></div>`}};function Oa(v,..._){for(let k of _){if(v.serverDynamic[k]!==void 0)return String(v.serverDynamic[k]);let R=v.static[k];if(typeof R==="string")return R}return}var iu={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let R=(Oa(v,"name")||"v").replace(/["'<>]/g,""),T=(Oa(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",B=Oa(v,"class"),z=Oa(v,"id"),W=[`data-stx-transition-group="${R}"`,B?`class="${B}"`:"",z?`id="${z}"`:""].filter(Boolean).join(" ");return`<${T} ${W}>${_}</${T}>`}};function yg(v=Bs){v.registerBuiltin(Ll),v.registerBuiltin(Zl),v.registerBuiltin(Gl),v.registerBuiltin(Yl),v.registerBuiltin(Ql),v.registerBuiltin(eu),v.registerBuiltin(tu),v.registerBuiltin(nu),v.registerBuiltin(su),v.registerBuiltin(iu)}var xg=new Map;function Sv(v){let _=xg.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),xg.set(v.source,_);return _}var bg=new WeakMap;function vg(v){let _=bg.get(v);if(!_)_=new Set([...v].map((R)=>R.toLowerCase())),bg.set(v,_);let k=_;return(R)=>!/[a-z]/.test(R)&&k.has(R.toLowerCase())}function $v(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function wg(v,_,k){let R=[],T=0,B=typeof k==="function"?k:k?(z)=>k.has(z.toLowerCase()):void 0;while(T<v.length){let z=v.indexOf("<",T);if(z===-1)break;let W=Sv(_);W.lastIndex=z+1;let F=W.exec(v);if(!F){T=z+1;continue}let U=F[1];if(B&&B(U)){let le=z+1+U.length;while(le<v.length&&v[le]!==">")le++;T=le+1;continue}let H=z+1+U.length,q=null,Q=H,ie=-1,Z=!1;while(H<v.length){let le=v[H];if(q){if(le==="\\"&&H+1<v.length){H+=2;continue}if(le===q)q=null;H++;continue}if(le==='"'||le==="'"){q=le,H++;continue}if(le==="/"&&H+1<v.length&&v[H+1]===">"){ie=H+2,Z=!0;break}if(le===">"){ie=H+1;break}H++}if(ie===-1){T=z+1;continue}let ae=v.slice(Q,Z?ie-2:ie-1).trim();if(Z)R.push({fullMatch:v.slice(z,ie),tagName:U,attributes:ae,content:"",startIndex:z,endIndex:ie,isSelfClosing:!0}),T=ie;else{let le=`<${U}`,ce=`</${U}>`,de=1,ue=ie,$e=-1;while(de>0&&ue<v.length){let Pe=v.indexOf(le,ue),Oe=v.indexOf(ce,ue);if(Oe===-1)break;if(Pe!==-1&&Pe<Oe){let Me=v[Pe+le.length];if(Me===" "||Me===">"||Me==="/"||Me===`
2438
+ `||Me==="\t"){let Ne=$v(v,Pe+le.length);if(v[Ne-1]!=="/")de++;ue=Ne+1}else ue=Pe+le.length}else{if(de--,de===0){$e=Oe;break}ue=Oe+ce.length}}if($e===-1){T=ie;continue}let we=v.slice(ie,$e),ye=$e+ce.length;R.push({fullMatch:v.slice(z,ye),tagName:U,attributes:ae,content:we,startIndex:z,endIndex:ye,isSelfClosing:!1}),T=ye}}return R}function ou(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Sg(v,_){try{let k=Buffer.from(v,"base64").toString("utf8");return JSON.parse(k)}catch{}try{let k=v.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(k)}catch(k){if(_?.debug)console.error("Error decoding __stx_ prop:",k);return v}}function au(v,_){let k=0,R="",T=_;while(T<v.length){let B=v[T];if(R){if(B==="\\")T++;else if(B===R)R=""}else if(B==='"'||B==="'"||B==="`")R=B;else if(B==="{")k++;else if(B==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function $g(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(au(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var _v=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),kv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Ev(v){return cu(v).map((_)=>[_.start,_.end])}function cu(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,R;while((R=k.exec(v))!==null){let T=R[2]||"",B=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!B)continue;let z=Wr(B[1]??B[2]??B[3]??""),W=R.index,F=W+R[0].length,U=R[1].toLowerCase();if(R[0].endsWith("/>")||kv.has(U)){_.push({start:W,end:F,names:z});continue}let H=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${H}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=F;let Q=1,ie=F,Z;while((Z=q.exec(v))!==null)if(Z[0].startsWith("</")){if(Q--,Q===0){ie=Z.index+Z[0].length;break}}else if(!Z[0].endsWith("/>"))Q++;_.push({start:W,end:ie,names:z})}return _}function _g(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>_g(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function kg(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,R=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],B;while((B=R.exec(v))!==null)T.push([B.index,B.index+B[0].length]);T.push(...Ev(v));let z=new Set(kr(_));function W(Q){return T.some(([ie,Z])=>Q>=ie&&Q<Z)}let F=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,U=[],H=new Map,q=256;while((B=F.exec(k))!==null){if(W(B.index))continue;let Q=B[0],ie=B[2];if(!ie||!ie.includes(":"))continue;let Z=/(?:^|\s)data-native(?:\s|=|$)/i.test(ie.replace(/"[^"]*"|'[^']*'/g,"")),ae=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,le,ce=ie,de=!1;while((le=ae.exec(ie))!==null){let ue=le[1],$e=le[2];if(Qi(ue))continue;if(te($e,z))continue;if($e.includes("()")&&!$e.includes(".get(")||$e.includes("$store")||$e.includes("$ref"))continue;try{let we=Object.keys(_),ye=Object.values(_),Pe=$e.match(/^([a-zA-Z_$][\w$]*)/);if(Pe&&!we.includes(Pe[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Pe[1]))continue;let Oe=JSON.stringify([we,$e]),Me=H.get(Oe);if(!Me){if(Me=Function(...we,`return (${$e})`),H.size>=q)H.clear();H.set(Oe,Me)}let Ne=Me(...ye);if(ue==="class"){let Le=_g(Ne);if(Le){let De=ce.match(/\sclass="([^"]*)"/);if(De)ce=ce.replace(De[0],` class="${De[1]} ${Le}"`);else ce=ce.replace(le[0],` class="${Le}"`)}else ce=ce.replace(le[0],"");de=!0;continue}if(_v.has(ue)){if(Ne)ce=ce.replace(le[0],` ${ue}`);else ce=ce.replace(le[0],"");de=!0;continue}if(Ne===null||Ne===void 0||Ne===!1)ce=ce.replace(le[0],"");else{let De=(Z&&typeof Ne==="object"?JSON.stringify(Ne):String(Ne)).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");ce=ce.replace(le[0],` ${ue}="${De}"`)}de=!0}catch{continue}}if(de){let ue=B[3]?" /":"",we=`<${B[1]}${ce}${ue}>`;U.push({start:B.index,end:B.index+Q.length,replacement:we})}}if(U.length>0){let Q=Array(U.length*2+1),ie=0;for(let Z=0;Z<U.length;Z++){let{start:ae,end:le,replacement:ce}=U[Z];Q[Z*2]=k.slice(ie,ae),Q[Z*2+1]=ce,ie=le}Q[U.length*2]=k.slice(ie),k=Q.join("")}return k}var K=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];import Lg from"path";import uu from"fs";import ko from"path";function Eg(v,_,k,R){let T=0;for(let B=_;B<v.length;B++)if(v[B]===k)T++;else if(v[B]===R&&!(R===">"&&v[B-1]==="=")){if(--T===0)return B}return-1}function Cv(v){let _=s(v),k=0,R=0,T=[];for(let B=0;B<_.length;B++)if("([{".includes(_[B]))k++;else if(")]}".includes(_[B]))k--;else if(_[B]===","&&k===0)T.push(v.slice(R,B).trim()),R=B+1;return T.push(v.slice(R).trim()),T}function lu(v,_){let k=s(v),R=new RegExp(`\\b(?:${_.map((T)=>T.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let T of k.matchAll(R)){let B=T.index+T[0].length,z="";if(k[B]==="<"){let F=Eg(k,B,"<",">");if(F<0)continue;z=v.slice(B+1,F),B=F+1;while(/\s/.test(k[B]||"")&&B<k.length)B++}if(k[B]!=="(")continue;let W=Eg(k,B,"(",")");if(W>=0)return{type:z,args:Cv(v.slice(B+1,W))}}return null}var Cg=`
2439
+ type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
2440
+ type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
2441
+ type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
2442
+ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
2443
+ type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
2444
+ type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
2445
+ type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
2446
+ `;function Rg(v,_){let k=[],R={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),B=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(Q,ie,Z,ae,le)=>{if(T.slice(le,le+6)!=="import")return Q;if(ae.endsWith(".stx"))return"";let ce=`${_}Import${k.length}`;if(k.push(`import * as ${ce} from ${JSON.stringify(ae)};`),ie.startsWith("*"))return`import ${ie.replace(/^\*\s+as\s+/,"")} = ${ce};`;if(!ie.startsWith("{"))return`import ${ie} = ${ce}.default;`;return ie.slice(1,-1).split(",").map((de)=>{let[ue,$e=ue]=de.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!ue)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(ae)&&ue in R)R[ue].push($e);return`import ${$e} = ${ce}.${ue};`}).join(`
2447
+ `)}),z=lu(v,R.defineProps),W=lu(v,R.defineEmits),F=lu(v,R.withDefaults);if(!z&&!W)return{declarations:"",props:null,events:null};let U=[],H=null,q=null;if(z){U.push(`const __options = (${z.args[0]||"{}"}) as const;`),U.push(`const __defaults = (${F?.args[1]||"{}"});`);let Q=z.type||"__StxOptions<typeof __options>";U.push(`export type __StxProps = __StxDefaults<${Q}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),H=`${_}.__StxProps`}if(W)U.push(`const __events = (${W.args[0]||"[]"}) as const;`),U.push(`export type __StxEvents = ${W.type||"Record<(typeof __events)[number], any[]>"};`),q=`${_}.__StxEvents`;return{declarations:`${k.join(`
2448
+ `)}
2449
+ namespace ${_} {
2450
+ ${B}
2451
+ ${U.join(`
2452
+ `)}
2453
+ }`,props:H,events:q}}var _o=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function Sn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[..._o].some((_)=>_.toLowerCase()===v.toLowerCase());return _o.has(v)||/[A-Z]/.test(v)}function*Rv(v){let _=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,k;while(k=_.exec(v)){let R=_.lastIndex,T=[];while(R<v.length){while(/\s/.test(v[R]||""))R++;if(v[R]===">"||v.slice(R,R+2)==="/>"){R+=v[R]===">"?1:2;break}let B=/^[^\s=/>]+/.exec(v.slice(R))?.[0];if(!B){R++;continue}let z=R;R+=B.length;while(/\s/.test(v[R]||""))R++;if(v[R]!=="="){T.push({name:B,value:!0,offset:z,braced:!1});continue}R++;while(/\s/.test(v[R]||""))R++;let W=v[R],F=W==="{",U=W==='"'||W==="'";if(U||F)R++;let H=R;if(F){let q=s(v.slice(R)),Q=1,ie=0;for(;ie<q.length;ie++){if(q[ie]==="{")Q++;if(q[ie]==="}"&&--Q===0)break}R+=ie}else if(U)while(R<v.length&&v[R]!==W)R++;else while(R<v.length&&!/[\s/>]/.test(v[R]))R++;if(T.push({name:B,value:v.slice(H,R),offset:H,braced:F}),U||F)R++}_.lastIndex=R,yield{name:k[1],offset:k.index,attributes:T}}}function Ag(v,_,k){let R=[],T=[Cg,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],B=new Map,z=new Map,W=new Map,F=k.scriptCode(v,k.filePath),U=s(F);for(let Z of F.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(U.slice(Z.index,Z.index+6)!=="import")continue;let ae=Z[2],le=ko.isAbsolute(ae)||ae.startsWith(".")?ko.resolve(ko.dirname(k.filePath),ae):qo(ae,ko.dirname(k.filePath));if(!le)continue;let ce=le.endsWith(".stx")?le:uu.existsSync(`${le}.stx`)?`${le}.stx`:void 0,de=ce?null:Ho(le,!1),ue=Z[1].startsWith("{")?Z[1].slice(1,-1).split(","):[Z[1]];for(let $e of ue){let[we,ye=we]=$e.trim().split(/\s+as\s+/),Pe=ce||de?.get(we)||de?.get(we.toLowerCase());if(Pe)W.set(ye,Pe),W.set(ye.toLowerCase(),Pe),W.set(ye.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Pe)}}for(let Z of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let ae of Z[1].matchAll(/['"]([^'"]+)['"]/g)){let le=Ko(ae[1],k.filePath,k).find((ce)=>uu.statSync(ce,{throwIfNoEntry:!1})?.isFile());if(le)W.set(ko.basename(ae[1]).replace(/\.stx$/,""),le)}let H={__importedComponents:W},q=new Map,Q=(Z,ae,le)=>{let ce=v.slice(0,Z);return{code:ae,offset:Z,attribute:le,anchor:!0,kind:"directive",line:ce.split(`
2454
+ `).length,column:Z-ce.lastIndexOf(`
2455
+ `)}},ie=(Z,ae,le)=>R.push({expression:Z,statement:{text:ae+Z.code+le,prefixLength:ae.length}});for(let Z of Rv(_)){if(Sn(Z.name)||Z.name==="component")continue;let ae=Sd(Z.name,k.filePath,k,H);if(!ae)continue;let le=q.get(ae);if(!le){let de;try{de=k.readComponent?k.readComponent(ae):uu.readFileSync(ae,"utf8")}catch{continue}if(de===void 0)continue;z.set(ae,de),le=Rg(k.scriptCode(de,ae),`__StxComponent${q.size}`),q.set(ae,le),T.push(le.declarations)}let ce=[];for(let de of Z.attributes){let{name:ue,offset:$e}=de,we=de.value===!0?"true":de.value;if(ue.startsWith("@")||ue.startsWith("v-on:")){if(le.events&&de.value!==!0)B.set($e,`__StxEvent<${le.events}, ${JSON.stringify(ue.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let ye=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(ue);if(ue.startsWith("v-")&&!ue.startsWith("v-bind:")&&!ye)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(ue))continue;let Pe=(ye?ye[1]||"modelValue":ue.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Ne,Le)=>Le.toUpperCase());if(ce.push(Pe),!le.props)continue;let Me=ue.startsWith(":")||ue.startsWith("v-bind:")||!!ye||de.braced?we:de.value!==!0?JSON.stringify(we):"true";ie(Q($e,Me,ue),";void ((",`) satisfies __StxProp<${le.props}, ${JSON.stringify(Pe)}>);`)}if(le.props){let de=[...new Set(ce)].map(($e)=>`${JSON.stringify($e)}: undefined as any`).join(", "),ue=Q(Z.offset,`<${Z.name}>`);R.push({expression:ue,statement:{text:`;void ({ ${de} } satisfies ${le.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:q.size?T.join(`
2456
+ `):"",checks:R,events:B,dependencies:z}}var Tg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Av(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function Ye(v){let _=[],k=Av(v);Tg.lastIndex=0;let R;while((R=Tg.exec(k))!==null){let T=(R[1]||"").trim(),B=(R[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=(R[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=R.index+B,F=R.index+R[0].length-z,U=v.slice(W,F);if(/\bsrc\s*=/.test(T))continue;let H=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(H&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(H[1]))continue;let q=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",Q=Eo(v,W);_.push({kind:q,code:U,startLine:Q,startColumn:Co(v,W),offset:W,attrs:T})}return _}function Eo(v,_){let k=1;for(let R=0;R<_&&R<v.length;R++)if(v.charCodeAt(R)===10)k++;return k}function Co(v,_){let k=v.lastIndexOf(`
2457
+ `,_-1)+1;return _-k+1}function Ma(v){let _=v.split(""),k=(T,B)=>{for(let z=T;z<B&&z<_.length;z++)if(_[z]!==`
2458
+ `)_[z]=" "},R=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let T of R){T.lastIndex=0;let B;while((B=T.exec(v))!==null)k(B.index,B.index+B[0].length)}return _.join("")}function Tv(v){let _=0,k="";for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k="";continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{"){_++;continue}if(T===")"||T==="]"||T==="}"){_--;continue}if(T==="|"&&_===0){if(v[R+1]==="|"){R++;continue}if(v[R-1]==="|")continue;return v.slice(0,R)}}return v}var Bg=new Set([":for","x-for","v-for"]),Na=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,du="__stx_interpolated",Ig="__StxElement",zg="__StxTemplateValue",Iv=`type ${zg}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Pg(v){return v.replace(/\{\{[\s\S]*?\}\}/g,du).replace(/\{!![\s\S]*?!!\}/g,du)}function xs(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
2459
+ `).length-1,R=_.length-k;return`0${" ".repeat(Math.max(0,R-1))}${`
2460
+ `.repeat(k)}`})}var Pv=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Dv=new RegExp(String.raw`^[ \t]*@(?:${Pv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Ss(v){return v.replace(Dv,(_)=>_.replace(/[^\n]/g," "))}var Dg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Pc(v){let _=Ma(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let W=T[2]??T[4]??"",F=T[2]!==void 0?2:3,U=Tv(W);if(!U.trim())continue;let H=T.index+F+(U.length-U.trimStart().length);k.push({code:U.trim(),line:Eo(_,H),column:Co(_,H),offset:H,kind:"interpolation"})}let B=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=B.exec(_))!==null){let z=T.index+T[0].length-1,W=0,F=z;for(;F<_.length;F++){let Q=_[F];if(Q==="(")W++;else if(Q===")"){if(W--,W===0)break}}if(W!==0)continue;let U=_.slice(z+1,F),H=U.trim();if(B.lastIndex=F+1,!H)continue;let q=z+1+(U.length-U.trimStart().length);k.push({code:H,line:Eo(_,q),column:Co(_,q),offset:T.index,kind:"condition"})}Na.lastIndex=0;while((T=Na.exec(_))!==null){let z=T[1],W=T[3]??"",F=z.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Dg.has(F)||Dg.has(z))continue;if(!W.trim())continue;let U=T.index+T[0].indexOf(T[2],T[0].indexOf(z)+z.length)+1;if(Bg.has(F)){let q=W.match(/\s+(?:in|of)\s+/);if(!q||q.index===void 0)continue;let Q=W.slice(q.index+q[0].length),ie=q.index+q[0].length+(Q.length-Q.trimStart().length);k.push({code:Pg(Q.trim()),line:Eo(_,U+ie),column:Co(_,U+ie),offset:U+ie,kind:"directive",attribute:F});continue}let H=W.length-W.trimStart().length;k.push({code:Pg(W.trim()),line:Eo(_,U+H),column:Co(_,U+H),offset:U+H,kind:"directive",attribute:F})}return k.sort((z,W)=>z.line-W.line||z.column-W.column),k}var Ov=2000;function Mv(v,_){let k=0,R=Math.min(v.length,_+Ov);for(let T=_;T<R;T++){let B=v[T];if(B==="(")k++;else if(B===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function Nv(v){let _=new Map,k=(W,F)=>{let U=W.split(/[,[\]{}()\s]+/).filter(Boolean);for(let H of U){let q=H.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(q))continue;let Q=U.length===1?F:void 0,ie=_.get(q);if(!ie)_.set(q,{name:q,iterable:Q});else if(ie.iterable!==Q)ie.iterable=void 0}},R=/^\$?[A-Z_$][\w$]*$/i,T=(W)=>{let F=W.trim();return R.test(F)?F:void 0};for(let W of v.matchAll(/@for(?:each|else)\s*\(/g)){let F=Mv(v,W.index+W[0].length-1);if(F===null)continue;let U=It(F);if(!U)continue;k(U.itemVar.replace(/=>/g," "),T(U.arrayExpr))}for(let W of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(W[1],W[2]==="of"?T(W[3]):void 0);for(let W of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(W[1]);let B=Ma(v);Na.lastIndex=0;let z;while((z=Na.exec(B))!==null){let W=z[1].replace(/\..*$/,"");if(!Bg.has(W))continue;let F=z[3].match(/\s+(?:in|of)\s+/);if(!F||F.index===void 0)continue;k(z[3].slice(0,F.index),T(z[3].slice(F.index+F[0].length)))}for(let W of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let F of W[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(F[1]);return[..._.values()].sort((W,F)=>W.name.localeCompare(F.name))}function fe(v){let _=new Set;for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))_.add(k[1]);for(let k of v.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let R of k[1].split(",")){let T=R.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(T))_.add(T)}return[..._].sort()}var fu=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],jv={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function mi(v=new Set){return[...fu.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(jv).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
2461
+ `)}function hi(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Wg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,R=!1,T=new Set,B=s(v);while((k=_.exec(B))!==null){R=!0;for(let z of Lv(k[1])){let W=z.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(W))T.add(W)}}return R?[...T]:null}function Lv(v){let _=[],k=0,R="";for(let T of v){if(T===","&&k===0){_.push(R),R="";continue}if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;R+=T}return _.push(R),_.filter((T)=>T.trim().length>0)}function Bv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],R=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
2462
+ `).map(()=>"").join(`
2463
+ `)));return{imports:k.join(`
2464
+ `),body:R}}function Fg(v){let _=s(v),k=Array(_.length),R=0;for(let W=0;W<_.length;W++){let F=_[W];if(F==="}"||F===")"||F==="]")R=Math.max(0,R-1);if(k[W]=R,F==="{"||F==="("||F==="[")R++}let T=[],B=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,z;while((z=B.exec(_))!==null){if(k[z.index]!==0)continue;let W=z[1],F=z[2],U;if(W==="interface"){let H=_.indexOf("{",z.index);if(H===-1)continue;let q=0;U=-1;for(let Q=H;Q<_.length;Q++)if(_[Q]==="{")q++;else if(_[Q]==="}"&&--q===0){U=Q+1;break}if(U===-1)continue}else{let H=0;U=_.length;for(let q=_.indexOf("=",z.index)+1;q<_.length;q++){let Q=_[q];if(Q==="{"||Q==="["||Q==="("||Q==="<")H++;else if(Q==="}"||Q==="]"||Q===")"||Q===">")H--;else if(H<=0&&(Q===";"||Q===`
2465
+ `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,q-40),q)))){U=Q===";"?q+1:q;break}}}T.push({name:F,text:v.slice(z.index,U).replace(/^[ \t]*export[ \t]+/,"")}),B.lastIndex=U}return T}function zv(v){return new Set(Fg(v).map((_)=>_.name))}function yi(v,_=""){let k=Wg(v),R=zv(_),T=Fg(v).filter((U)=>!R.has(U.name)).map((U)=>U.text);if(!k){let U=fe(v).filter((H)=>!Ki(_,H));if(U.length===0&&T.length===0)return"";return["",`// ${Wv}`,...T,...U.map((H)=>`declare var ${H}: any`)].join(`
2466
+ `)}if(k.length===0)return T.length>0?["",`// ${Og}`,...T].join(`
2467
+ `):"";let{imports:B,body:z}=Bv(v),W=z.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),F=["",`// ${Og}`];if(B)F.push(B);return F.push(...T),F.push(`async function ${Mg}() {`,W,` return { ${k.join(", ")} }`,"}",`type ${Ng} = Awaited<ReturnType<typeof ${Mg}>>`,...k.map((U)=>`declare var ${U}: ${Ng}[${JSON.stringify(U)}]`)),F.join(`
2468
+ `)}function pu(v){let k=s(v).split(""),R=0;for(let T=0;T<k.length;T++){let B=k[T];if(B==="{"||B==="("||B==="["){R++;continue}if(B==="}"||B===")"||B==="]"){R=Math.max(0,R-1);continue}if(R>0&&B!==`
2469
+ `)k[T]=" "}return fe(k.join(""))}function bi(v,_){if(Wg(v)!==null)return[];let k=pu(v),R=At(_,new Set(k)),T=new Set(y);return k.filter((B)=>{if(T.has(B))return!1;if(Ki(_,B))return!1;return R.has(B)})}var Og="stx: types for the declared client payload (#1868)",Wv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Mg="__stxServerScope",Ng="__StxClientPayload";var jg=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Fv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Vv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:B,balanced:z}=Te(T);if(!z)continue;let W=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let F of T.matchAll(W)){let U=F.index??0;if(B[U+F[1].length]!==0)continue;let H=F[2],q=U+F[0].length-F[3].length,Q=R.slice(q,U+F[0].length).trim().replace(/;$/,"").trim(),ie=F[3],Z=k.test(ie)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ie)&&!/[,+\-*/%&|?:=]$/.test(Q)&&Te(ie).balanced;_.set(H,_.has(H)||!Z?null:Q)}}return new Map([..._].filter((R)=>R[1]!==null))}function Vg(v,_,k=0,R=new Set){if(_.size===0||k>=5)return v;let T=s(v),B="",z=0;for(let W of T.matchAll(/[A-Za-z_$][\w$]*/g)){let F=W.index??0,U=W[0],H=_.get(U);if(!H||R.has(U))continue;let q=T.slice(0,F).trimEnd(),Q=T.slice(F+U.length).trimStart();if(q.endsWith(".")||/^:(?!:)/.test(Q)&&/[{,]$/.test(q))continue;if(F>0&&/[\w$]/.test(T[F-1]))continue;B+=`${v.slice(z,F)}(${Vg(H,_,k+1,new Set([...R,U]))})`,z=F+U.length}return B+v.slice(z)}function Uv(v,_){let k=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,R=[],T;while((T=k.exec(v))!==null){if(T.index>_)break;let B=T[1];if(T.index===_){if(B==="elseif"){let W=R[R.length-1];if(W?.current)W.seen.push(W.current);if(W)W.current=null}break}if(B==="endif"||B==="endunless"){R.pop();continue}let z="";if(T[2]==="("){let W=0,F=T.index+T[0].length-1,U=F+1;for(;F<v.length;F++){let H=v[F];if(H==="(")W++;else if(H===")"){if(W--,W===0)break}}z=v.slice(U,F).trim(),k.lastIndex=F+1}if(B==="if")R.push({seen:[],current:z});else if(B==="unless")R.push({seen:[],current:`!(${z})`});else if(B==="elseif"||B==="else"){let W=R[R.length-1];if(!W)continue;if(W.current)W.seen.push(W.current);W.current=B==="elseif"?z:null}}return R.flatMap((B)=>[...B.seen.map((z)=>`!(${z})`),...B.current?[B.current]:[]]).filter(Boolean)}function Hv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Fv.test(_))return null;let R=";(($event: any): void => { ";return{text:`${R}${_} });`,prefixLength:R.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var qv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function ar(v,_){if(!_)return v;return v.replace(qv,(k,R,T,B)=>{let z=Lg.resolve(_,B).replace(/\\/g,"/");return`${R}${T}${z}${T}`})}function ks(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function Kv(v){let _=new Set,k=s(v);for(let R of k.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let T=R[1],B=/\{([^}]*)\}/.exec(T);for(let U of B?.[1].split(",")??[]){let H=U.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(H&&/^[A-Z_$][\w$]*$/i.test(H))_.add(H)}let z=T.replace(/\{[^}]*\}/,""),W=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(z);if(W)_.add(W[1]);let F=/^\s*([A-Z_$][\w$]*)/i.exec(z);if(F&&F[1]!=="type")_.add(F[1])}return[..._].sort()}function vi(v,_={}){let k=Ye(v),R=v.split(`
2470
+ `),T=Array.from({length:R.length},()=>""),B=new Map,z=_.filePath&&_.templateExpressions!==!1?Ag(v,Ma(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(q,Q)=>Ye(q).map((ie)=>ar(ie.code,Lg.dirname(Q))).join(`
2471
+ `)}):void 0,W=new Set,F=[];for(let q of k){let Q=Ss(xs(q.code)),ie=ar(Q,_.originDir??"").split(`
2472
+ `);ie.forEach((Z,ae)=>{let le=q.startLine-1+ae;if(le<T.length)T[le]=ae===0?ks(q)+Z:Z,W.add(le)}),F.push(q.startLine-1+ie.length-1)}for(let q of F){let Q=T[q]?.trim()===""?q:q+1;if(Q<T.length&&T[Q].trim()===""&&(Q===q||!W.has(Q)))T[Q]=";"}let U=(q,Q)=>{for(let[ie,Z]of q.split(`
2473
+ `).entries())if(T.push(Z),Q)B.set(T.length,ie===0?Q:{...Q,line:Q.line+ie,column:1,prefixLength:0})};if(_.globals!==!1){U("");let q=new Set([...k.flatMap((ae)=>fe(ae.code)),...k.flatMap((ae)=>Kv(ae.code))]),Q=(ae)=>{if(!q.has(ae))U(`declare var ${ae}: any`)};if(_.runtimeGlobals!==!1){if(!q.has("window"))U("declare var window: any");for(let ae of y)Q(ae)}let ie=[...new Set([...fu,...K,...jg])].filter((ae)=>_.runtimeGlobals!==!1||!y.includes(ae));if(_.contextScope==="global"){U("declare global {");for(let ae of ie)U(` var ${ae}: any`);U("}")}else{for(let ae of fu)Q(ae);for(let ae of K)Q(ae);for(let ae of jg)Q(ae)}U(`declare var ${du}: any`);let Z=new Set(k.flatMap((ae)=>fe(ae.code)));U(`type ${Ig}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let ae of Nv(v)){if(Z.has(ae.name))continue;let le=ae.iterable&&Z.has(ae.iterable)?`${Ig}<typeof ${ae.iterable}>`:"any";U(`declare var ${ae.name}: ${le}`)}}if(_.templateExpressions!==!1){if(z?.declarations)for(let Q of z.declarations.split(`
2474
+ `))U(Q);let q=Pc(v).map((Q)=>{let ie=z?.events.get(Q.offset??-1);if(ie){Q.anchor=!0;let Z=Q.code.trim(),ae=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Z),le=ae?`void ((${ae[2]}) satisfies __StxAssignedValue<typeof ${ae[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Z)?`${Z} satisfies (($event: ${ie}) => unknown)`:Z,ce=`;(($event: ${ie}): void => { `;return{expression:Q,statement:{text:`${ce}${le} });`,prefixLength:ce.length}}}return{expression:Q,statement:Hv(Q)}}).filter((Q)=>Q.statement!==null);if(q.push(...z?.checks||[]),q.length>0){let Q=Ma(v),ie=ra(Q),Z=Vv(k.map((de)=>de.code)),le=[...new Set(k.flatMap((de)=>fe(de.code)))].filter((de)=>/^[A-Z_$][\w$]*$/i.test(de)),ce=0;if(le.length>0){U(Iv);for(let de of le)U(`type __StxT_${de} = ${zg}<typeof ${de}>`);U(`;((${le.map((de)=>`${de}: __StxT_${de}`).join(", ")}) => {`),ce=1}for(let{expression:de,statement:ue}of q){let $e=" ".repeat(ce),we=de.offset===void 0?[]:ie.filter((Le)=>de.offset>=Le.start&&de.offset<Le.end),ye=we.map((Le)=>`;((${Le.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Pe=" });".repeat(we.length),Oe=de.offset===void 0?[]:Uv(Q,de.offset),Me=Oe.length>0?`${Oe.map((Le)=>`if (${Vg(Le,Z)}) `).join("")}{ `:"",Ne=Oe.length>0?" }":"";U($e+ye+Me+ue.text+Ne+Pe,{line:de.line,column:de.column,expression:de,prefixLength:ue.prefixLength+$e.length+ye.length+Me.length,guardPrefixLength:$e.length+ye.length+Me.length})}if(ce>0)U("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return U("export {}"),{text:T.join(`
2475
+ `),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:H}}function wi(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function xi(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Ug from"fs";import Hg from"path";var qg=!1;function Xv(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),W=(q)=>{if(z.size===0)return!1;let Q=s(q),ie=Q.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(ie&&z.has(ie))return!0;for(let Z of z){let ae=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${ae}\\s*\\(`).test(Q))return!0}return!1},F=new Set(ea),U=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(Q,ie)=>ie.toUpperCase())},H=(q,Q)=>{let ie=U(q);if(B.static[ie]=Q,ie!==q)B.staticNames[ie]=q};for(let[q,Q]of Object.entries(v)){let ie=q.startsWith("x-")&&!F.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(ie.startsWith("@")){B.events[ie]=Q;continue}if(ie.startsWith("__stx_")){let Z=U(ie.slice(6));B.serverDynamic[Z]=Sg(Q,k);continue}if(ie.startsWith(":")){let Z=U(ie.slice(1)),ae=Q===Mr?Z:Q;if(Z==="if"||Z==="for"||Z==="show"){B.clientReactive[Z]=ae;continue}if(R){B.clientReactive[Z]=ae;continue}if(te(ae,T)){B.clientReactive[Z]=ae;continue}if(W(ae)){B.clientReactive[Z]=ae;continue}try{if(!p(ae)){if(k.debug)console.error(`Unsafe expression in :${Z} binding: ${ae}`);B.clientReactive[Z]=ae;continue}let le=Object.keys(_),ce=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),de=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Ae(ae).some((ye)=>!ce.has(ye)&&!le.includes(ye)&&(!(ye in globalThis)||de.has(ye)))){B.clientReactive[Z]=ae;continue}let we=c(ae,le)(...Object.values(_));if(B.serverDynamic[Z]=we,Z!==ie.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[Z]=ie.slice(1)}catch{B.clientReactive[Z]=ae}continue}if(typeof Q==="string"&&Q.includes("{{")&&Q.includes("}}")){let Z=Zv(Q,T);if(Z!==null){B.clientReactive[U(ie)]=Z;continue}let ae=Q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ae)try{let le=ae[1];if(p(le)){let de=c(le,Object.keys(_))(...Object.values(_));H(ie,de!=null?String(de):"")}else{if(k.debug)console.error(`Unsafe expression in ${ie}: ${le}`);H(ie,Q)}}catch(le){if(k.debug)console.error(`Error evaluating expression for ${ie}:`,le);H(ie,Q)}else{let le=Q,ce=/\{\{\s*([\s\S]+?)\s*\}\}/g,de;while((de=ce.exec(Q))!==null)try{let ue=de[1];if(!p(ue)){if(k.debug)console.error(`Unsafe expression in ${ie}: ${ue}`);continue}let we=c(ue,Object.keys(_))(...Object.values(_));le=le.replace(de[0],String(we??""))}catch(ue){if(k.debug)console.error(`Error evaluating expression in ${ie}:`,ue)}H(ie,le)}continue}H(ie,Q===Mr?"true":ou(Q))}return B}function Zv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((W)=>te(W[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let W of R)B+=v.slice(z,W.index).replace(/[`\\$]/g,(F)=>`\\${F}`),B+=`\${${W[1]}}`,z=W.index+W[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(W)=>`\\${W}`),`\`${B}\``}var Gv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Jv(v,_,k){if(!v.includes("@"))return v;if(!Gv.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return br(v,_,k)}catch{return v}}function ri(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let W=v[k];if(W==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(W===z){k++;break}B+=W,k++}}else if(v[k]==="{"){B=au(v,k),k+=B.length;let z=$g(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=Mr}return _}function Kg(v){return Object.entries(v).map(([_,k])=>k===Mr?_:`${_}="${Yv(k)}"`).join(" ")}function Yv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(Bs.isBuiltin(T))_.add(T)}return[..._].sort()}async function Ic(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=Hg.dirname(k),W=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let q of v.matchAll(F)){let[Q,ie,Z]=q,ae=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,le=Z,ce,de=[];while((ce=ae.exec(Z))!==null){let[ue,$e,we,ye]=ce,Pe=null,Oe=null;if(ye.startsWith(".")||ye.startsWith("/")){let Le=Hg.resolve(z,ye);if(Le.endsWith(".stx"))Oe=Le;else{let De=`${Le}.stx`;try{if(Ug.statSync(De).isFile())Oe=De}catch{try{if(Ug.statSync(Le).isDirectory())Pe=Le}catch{}}}}else Pe=qo(ye,z);if(!Pe&&!Oe)continue;let Me=!1,Ne=(Le,De)=>{B.set(Le,De),B.set(Le.toLowerCase(),De);let ze=Le.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(ze,De),T.add(De)};if(we&&Oe)Ne(we,Oe),Me=!0;else if($e){let Le=$e.slice(1,-1).split(",").map((ze)=>ze.trim()).filter(Boolean).map((ze)=>{let Ve=ze.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ve)return{source:Ve[1],local:Ve[2]};return{source:ze,local:ze}}),De=Pe?Ho(Pe):null;for(let{source:ze,local:Ve}of Le){let Be=null;if(Oe)Be=Oe;else if(De)Be=De.get(ze)??De.get(ze.toLowerCase())??De.get(ze.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Be)Ne(Ve,Be),Me=!0}}if(Me)de.push({start:ce.index,end:ce.index+ue.length})}if(de.length===0)continue;for(let ue=de.length-1;ue>=0;ue--)le=le.slice(0,de[ue].start)+le.slice(de[ue].end);W.push({start:q.index,end:q.index+Q.length,value:`<script${ie}>${le}</script>`})}if(W.length===0)return v;let U=[],H=0;for(let q of W)U.push(v.slice(H,q.start),q.value),H=q.end;return U.push(v.slice(H)),U.join("")}async function ew(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=W.exec(B))!==null){let[U,H]=F,q=H.split(",").map((Q)=>Q.trim().replace(/^['"]|['"]$/g,"")).filter((Q)=>Q.length>0);for(let Q of q){let ie=Q.split("/"),ae=ie[ie.length-1].replace(/\.stx$/,""),le=ae.includes("-")?ae.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""):ae.charAt(0).toUpperCase()+ae.slice(1),ce=null,de=Ko(Q,k,R);for(let ue of de)try{if(await Bun.file(ue).exists()){ce=ue;break}}catch{}if(ce){z.set(le,ce),z.set(ae,ce),z.set(ae.toLowerCase(),ce);let ue=le.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(ue,ce),T.add(ce),R.debug)console.log(`Imported component: ${le} -> ${ce}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${Q}`)}B=B.replace(U,""),W.lastIndex=0}return B}async function tw(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=/@component\s*\(/g,U;while((U=F.exec(B))!==null){let H=U.index,q=H+U[0].length-1,Q=1,ie=q+1;while(ie<B.length&&Q>0){if(B[ie]==="(")Q++;else if(B[ie]===")"){if(Q--,Q===0)break}ie++}if(Q!==0)break;let Z=B.substring(q+1,ie),ae=ie+1,le=Z.match(/^\s*['"]([^'"]+)['"]/);if(!le){F.lastIndex=0;continue}let ce=le[1],de,ue=Z.slice(le[0].length),$e=ue.match(/^\s*,\s*/);if($e)de=ue.slice($e[0].length).trim();let we={};if(de)try{we=D(de,_)}catch(Le){let De=Le instanceof Error?Le.message:String(Le);B=B.replace(B.substring(H,ae),`[Error parsing component props: ${De}]`);continue}let ye="",Pe=ae,Me=B.substring(ae).match(/^([\s\S]*?)@endcomponent/);if(Me)ye=Me[1].trim(),Pe=ae+Me[0].length;let Ne=await tt(ce,we,ye,z,_,k,R,W,T);B=B.substring(0,H)+Ne+B.substring(Pe),F.lastIndex=0}return B}async function nw(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=iw(B);if(F.size>0){let ae=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...ae,...F])]}let U=gn(B);B=U.output;let H=kr(_);return B=await Z(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await Z(B,/[A-Z][a-zA-Z0-9]*/,!0,vg(_o)),B=await Z(B,/[a-z][a-z0-9]*/,!1,_o),B=U.restore(B),B;async function Z(ae,le,ce,de){if(!ae)return ae;let ue=ae,$e=wg(ue,le,de),we=cu(ue),ye=new Map;for(let Me=$e.length-1;Me>=0;Me--){let Ne=$e[Me],Le=ce?dn(Ne.tagName):Ne.tagName,De=ri(Jv(Ne.attributes,_,k)),ze=we.filter(({start:kt,end:xt})=>Ne.startIndex>=kt&&Ne.startIndex<xt),Ve=ze.length>0,Be=new Set(H);for(let kt of ze)for(let xt of kt.names)Be.add(xt);let je=Xv(De,_,R,Ve,Be);if(typeof je.clientReactive.for==="string")for(let kt of Wr(je.clientReactive.for))Be.add(kt);let st=Bs.getBuiltin(Ne.tagName),ht=st?await ur(Ne.tagName,z,_,k,R):!1;if(st&&!ht){let kt={context:_,filePath:k,options:R,dependencies:T},xt=st.render(je,Ne.content,kt);if(Object.keys(je.events).length>0){let ct=Kg(je.events);xt=xt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ct}`)}if(Object.keys(je.clientReactive).length>0)xt=Xg(xt,je.clientReactive);ye.set(Me,xt);continue}if(!ce&&Ne.tagName.includes("-")&&!await ur(Le,z,_,k,R))continue;let yt={};for(let[kt,xt]of Object.entries(je.static))yt[kt]=xt;for(let[kt,xt]of Object.entries(je.serverDynamic))yt[kt]=xt;let vt={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(je.clientReactive),events:Object.keys(je.events)},wt=await tt(Le,yt,U.restore(Ne.content),z,_,k,R,W,T,[...Be],vt,Ne.tagName);if(wt=rw(wt,je,vt.declaredProps,vt.consumedProps,R._nativeHostAttrs),R._nativeHostAttrs){let kt=vt.reactiveProps.filter((St)=>!vt.consumedProps.has(St)&&!["if","for","show","key","ref"].includes(St)).map(dn),xt=gu(wt,!0);if(kt.length&&xt){if(!Object.hasOwn(ri(wt.slice(xt.insertPos,xt.tagEnd)),"data-stx-native-host-root"))wt=wt.slice(0,xt.insertPos)+' data-stx-native-host-root="true"'+wt.slice(xt.insertPos);let St=Ro(wt);wt=wt.slice(0,St.insertPos)+` data-stx-native-forward="${kt.join(" ")}"`+wt.slice(St.insertPos)}let ct=gu(wt,!0);if(ct){let St=ri(wt.slice(ct.insertPos,ct.tagEnd)),mt=Ro(wt),Kt=ri(wt.slice(mt.insertPos,mt.tagEnd));if(Object.hasOwn(St,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))wt=wt.slice(0,mt.insertPos)+" data-stx-native-host-owner"+wt.slice(mt.insertPos)}}if(Object.keys(je.events).length>0){let kt=Ro(wt);if(kt){let xt=Kg(je.events),ct=Object.keys(je.events).map((St)=>St.replace(/^@/,"").split(".")[0]).join(" ");wt=wt.substring(0,kt.insertPos)+` data-stx-parent-events="${ct}" ${xt}`+wt.substring(kt.insertPos)}}if(Object.keys(je.clientReactive).length>0)wt=Xg(wt,je.clientReactive);ye.set(Me,wt)}if(ye.size===0)return ue;let Pe="",Oe=0;for(let Me=0;Me<$e.length;Me++){let Ne=ye.get(Me);if(Ne===void 0)continue;Pe+=ue.slice(Oe,$e[Me].startIndex),Pe+=Ne,Oe=$e[Me].endIndex}return Pe+=ue.slice(Oe),Pe}}function Xg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),B=T.filter(([H])=>!R.has(H)).map(([H])=>dn(H)).join(" "),z=v,W=T.length>0?Ro(z):null;if(W){let H=T.map(([Q,ie])=>`:${dn(Q)}="${ie.replace(/"/g,"&quot;")}"`).join(" "),q=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,W.insertPos)+`${q} ${H}`+z.substring(W.insertPos)}let F=_.if;if(F)z=`<template :if="${F.replace(/"/g,"&quot;")}">${z}</template>`;let U=_.for;if(U)z=`<template :for="${U.replace(/"/g,"&quot;")}">${z}</template>`;return z}function rw(v,_,k=new Set,R=new Set,T=!1){let B=gu(v,T);if(!B)return v;let z=v.slice(B.insertPos,B.tagEnd),W=_.serverDynamic.class??_.static.class;if(T&&typeof W==="string"&&W&&!R.has("class")){let Z=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,ae=Z.test(z)?z.replace(Z,(le,ce,de,ue,$e)=>`${ce}class="${qt(`${ou(de??ue??$e)} ${W}`)}"`):` class="${qt(W)}"${z}`;v=v.slice(0,B.insertPos)+ae+v.slice(B.tagEnd),B.tagEnd+=ae.length-z.length,z=ae}let F=T||/\bdata-native(?:\s|=)/i.test(z),U=F?R:k,H=new Set(Object.keys(ri(z))),q=new Set(["class","className"]);for(let Z of Object.keys(_.static)){let ae=_.staticNames[Z]??Z;if(H.has(ae)||U.has(Z)||!F&&!jl(ae))q.add(Z)}for(let Z of Object.keys(_.serverDynamic)){let ae=_.serverDynamicNames?.[Z]??Z;if(H.has(ae)||U.has(Z)||!F&&!jl(ae))q.add(Z)}let Q=[];if(F){for(let[Z,ae]of Object.entries(_.static)){if(q.has(Z)||ae!==!0&&ae!==Mr)continue;q.add(Z),Q.push(`${qt(_.staticNames?.[Z]??Z)}="true"`)}for(let[Z,ae]of Object.entries(_.serverDynamic)){if(q.has(Z)||ae!==!0)continue;q.add(Z),Q.push(`${qt(_.serverDynamicNames?.[Z]??Z)}="true"`)}}let ie=[...Nr(_,q),...jr(_,q),...Q];if(F){for(let[Z,ae]of Object.entries(_.serverDynamic)){if(q.has(Z)||ae!==!1)continue;let le=_.serverDynamicNames?.[Z]??Z;ie.push(`${qt(le)}="false"`)}for(let[Z,ae]of Object.entries(_.serverDynamic)){if(q.has(Z)||ae===null||typeof ae!=="object")continue;let le=JSON.stringify(ae);if(le!==void 0){let ce=_.serverDynamicNames?.[Z]??Z;ie.push(`${qt(ce)}="${qt(le)}"`)}}}if(ie.length===0)return v;return`${v.slice(0,B.insertPos)} ${ie.join(" ")}${v.slice(B.insertPos)}`}function Ro(v){let _=Zg(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:mu(v,k.index+1+k[1].length)};return null}function gu(v,_=!1){let k=Ro(v);if(!k)return null;let R=v.slice(k.insertPos,k.tagEnd),T=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(R)?Zg(v,k.tagEnd+1):k;return T&&_?sw(v,T)??T:T}function sw(v,_){if(!v.includes("data-stx-native-host-root"))return null;let k=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),R=v.lastIndexOf("<",_.insertPos),T=0,B;while(R>=0&&R<v.length){if(v.startsWith("<!--",R)){let H=v.indexOf("-->",R+4);if(H<0)return null;R=v.indexOf("<",H+3);continue}let z=/^<(\/?)([a-z][\w-]*)\b/i.exec(v.slice(R));if(!z){R=v.indexOf("<",R+1);continue}let W=z[2].toLowerCase(),F=R+z[0].length,U=mu(v,F);if(z[1]){if(T--,B!==void 0&&T<B)B=void 0;if(T<=0)return null}else if(W==="script"||W==="style"){let H=new RegExp(`</${W}\\s*>`,"gi");if(H.lastIndex=U+1,!H.exec(v))return null;R=v.indexOf("<",H.lastIndex);continue}else{let H=ri(v.slice(F,U)),q=T>0&&(Object.hasOwn(H,"data-stx-component-wrapper")||Object.hasOwn(H,"data-stx-native-host-owner"));if(B===void 0&&!q&&Object.hasOwn(H,"data-stx-native-host-root"))return{insertPos:F,tagEnd:U};if(!k.has(W)&&v[U-1]!=="/"){if(T++,B===void 0&&q)B=T}else if(T===0)return null}R=v.indexOf("<",U+1)}return null}function Zg(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let W=v.indexOf("-->",k+4);if(W===-1)return null;k=W+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let W=`</${B[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(W,k+B[0].length);if(F===-1)return null;k=F+W.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:mu(v,k+1+z[1].length)}}return null}function mu(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function iw(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of pu(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function Cs(v,_,k,R,T){if(!qg)yg(Bs),qg=!0;let B=await Ic(v,_,k,R,T);B=await ew(B,_,k,R,T),B=await tw(B,_,k,R,T);let z=[];for(let W=0;W<3;W++){let F=z.length,U=Vn(B,qe,(q,Q)=>`\x00STX_COMPONENT_COMMENT_${F+Q}\x00`,`STX_COMPONENT_COMMENT:${F}`);z.push(...U.tokens);let H=B;if(B=await nw(U.output,_,k,R,T),B===H)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,F)=>z[Number(F)]??"");if(R.debug){let W=Qv(B);if(W.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${W.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function hu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function aw(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,W=z+B[0].length-1,F=1,U=W+1;while(U<R.length&&F>0){if(R[U]==="(")F++;else if(R[U]===")")F--;U++}if(F!==0)break;let H=R.substring(W+1,U-1),q=`${k}(${H})`;R=R.substring(0,z)+q+R.substring(U),T.lastIndex=z+q.length,B=T.exec(R)}return R}function cw(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Qg(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,W=(q)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===q){B++;return}B++}},F=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let q=1;while(B<z&&q>0)if(_[B]==="{")q++,B++;else if(_[B]==="}")q--,B++;else if(_[B]==="'"||_[B]==='"')W(_[B]);else if(_[B]==="`")F();else B++;continue}B++}},U=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
2476
+ `)B++;return!0}if(_[B]==="/"&&_[B+1]==="*"){B+=2;while(B<z-1&&!(_[B]==="*"&&_[B+1]==="/"))B++;return B+=2,!0}return!1},H=()=>{if(T!==0)return;let q=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let Z=q[2];if(!R.has(Z))k.push(Z),R.add(Z);return}let Q=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let Z=Q[1];if(!R.has(Z))k.push(Z),R.add(Z);return}let ie=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Z=ie[1];if(!R.has(Z))k.push(Z),R.add(Z)}};while(B<z){if(U())continue;if(_[B]==="'"||_[B]==='"'){W(_[B]);continue}if(_[B]==="`"){F();continue}if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))H();B++}return k.join(", ")}function lw(v,_=""){let k=Qg(v).split(",").map((R)=>R.trim()).filter(Boolean);return`
2477
+ (function() {
2478
+ ${Vt("var",k)}
2479
+ var __destroyHooks = [];
2480
+ var __origOnDestroy = onDestroy;
2481
+ onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
2482
+
2483
+ ${v}
2484
+ ${_}})();
2485
+ `}function uw(v,_){let T=Qg(v).split(",").map((B)=>B.trim()).filter(Boolean).map((B)=>` try { __scopeRegistration[${JSON.stringify(B)}] = ${B}; } catch (e) { /* not actually top-level */ }`).join(`
2486
+ `);return`
2487
+ // Register scope variables for STX runtime
2488
+ if (!window.stx._scopes) window.stx._scopes = {};
2489
+ var __scopeRegistration = window.stx._scopes['${_}'] || { __destroyCallbacks: __destroyHooks };
2490
+ ${T}
2491
+ // #1767: when the bundler renamed a component const that collided with an
2492
+ // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
2493
+ // renamed declaration so it resolves to the component's value, not the
2494
+ // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
2495
+ try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
2496
+ window.stx._scopes['${_}'] = __scopeRegistration;
2497
+ `}function dw(v,_){return v.replace(/<script data-stx-scoped data-stx-run="always" data-stx-owner="([^"]*)"/g,(k,R)=>R===_?k:'<script data-stx-scoped data-stx-run="always"')}function Gg(v,_){let k=uw(v,_);return fw(lw(v,k),_)}function fw(v,_){let k=`
2498
+ (function() {
2499
+ var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
2500
+ var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
2501
+ if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
2502
+ if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
2503
+ if (!window.stx._scopes) window.stx._scopes = {};
2504
+ window.stx._scopes['${_}'] = {};
2505
+ }
2506
+ try {`,R=`
2507
+ } finally {
2508
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2509
+ }
2510
+ })();`;return k+v+`
2511
+ } finally {
2512
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2513
+ }
2514
+ })();`}function pw(v,_){if(Kn(v)){let T=Kn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:ls(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],W=k[2],F=k[3];return{html:`${z}${W} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var gw=0;function Jg(v,_){let k=Zt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++gw}`}var yu=new Set,xu=new Set;function gd(){yu.clear(),xu.clear()}var mw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Uc(v){let _=(W)=>W.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let W=z[1]==="/",F=z[2],U=z[3]==="/"||mw.has(F.toLowerCase());if(W){T=Math.max(0,T-1);continue}if(T===0)R.push(F);if(!U)T++}return R}function Yg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var Ee=new M(500),Ri=new Set;function md(){Ri.clear()}function hw(v){if(v.__onceStore instanceof Set)return v.__onceStore;return Ri}async function Ps(v,_,k,R,T,B=new Set){let z=R.partialsDir||Zt.join(Zt.dirname(k),"partials");if(z&&!Zt.isAbsolute(z))z=Zt.resolve(process.cwd(),z);let W=aw(v,"@partial","@include"),F=hw(_);W=W.replace(/@once([\s\S]*?)@endonce/g,(ae,le,ce)=>{let de=le.trim(),ue=`${k}:${de}`;if(F.has(ue))return"";return F.add(ue),le});{let ae=/@includeIf\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")")ue--;$e++}if(ue!==0)break;let we=W.substring(de+1,$e-1),ye=we.match(/^\s*['"]([^'"]+)['"]/);if(!ye){ae.lastIndex=$e;continue}let Pe=ye[1],Oe=U(Pe,z,k),Me="";if(Oe&&await Bun.file(Oe).exists())T.add(Oe),Me=`@include(${we})`;W=W.substring(0,ce)+Me+W.substring($e),ae.lastIndex=0}}for(let[ae,le]of[["@includeWhen",!1],["@includeUnless",!0]]){let ce=new RegExp(`${ae.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),de;while((de=ce.exec(W))!==null){let ue=de.index,$e=ue+de[0].length-1,we=1,ye=$e+1;while(ye<W.length&&we>0){if(W[ye]==="(")we++;else if(W[ye]===")")we--;ye++}if(we!==0)break;let Pe=W.substring($e+1,ye-1),Oe=hu(Pe,0);if(Oe===-1){ce.lastIndex=ye;continue}let Me=Pe.substring(0,Oe).trim(),Ne=Pe.substring(Oe+1).trim(),Le=Ne.match(/^\s*['"]([^'"]+)['"]/);if(!Le){ce.lastIndex=ye;continue}let De=Le[1],ze=Ne.substring(Le[0].length),Ve,Be=hu(ze,0);if(Be!==-1)Ve=ze.substring(Be+1).trim();try{let je=`Boolean(${Me})`,st;if(p(je)){let vt=c(je,Object.keys(_));st=Boolean(vt(...Object.values(_)))}else st=Boolean(l(je,_));let ht=le?!st:st,yt="";if(ht){let vt=U(De,z,k);if(vt&&await Bun.file(vt).exists())T.add(vt);yt=`@include('${De}'${Ve?`, ${Ve}`:""})`}W=W.substring(0,ue)+yt+W.substring(ye),ce.lastIndex=0}catch(je){let st=je instanceof Error?je.message:String(je),ht=g("Include",`Error evaluating ${ae} condition: ${st}`,k,v,ue);W=W.substring(0,ue)+ht+W.substring(ye),ce.lastIndex=0}}}{let ae=/@each\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")"){if(ue--,ue===0)break}$e++}if(ue!==0)break;let we=W.substring(de+1,$e),ye=W.substring(ce,$e+1),Pe=we.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Pe){ae.lastIndex=0,W=W.replace(ye,"");continue}let[,Oe,Me,Ne,Le]=Pe;try{let De,ze=Me.trim();if(p(ze))De=c(ze,Object.keys(_))(...Object.values(_));else De=l(ze,_);let Ve="";if(Array.isArray(De)&&De.length>0)for(let Be of De){let je={..._,[Ne]:Be},st=await Q(Oe,je,v,ce);Ve+=st}else if(Le)Ve=await Q(Le,{},v,ce);W=W.substring(0,ce)+Ve+W.substring($e+1),ae.lastIndex=0}catch(De){let ze=De instanceof Error?De.message:String(De);W=W.substring(0,ce)+g("Each",`Error in @each: ${ze}`,k,v,ce)+W.substring($e+1),ae.lastIndex=0}}}{let ae=/@includeFirst\s*\(/g,le;while((le=ae.exec(W))!==null){let ce=le.index,de=ce+le[0].length-1,ue=1,$e=de+1;while($e<W.length&&ue>0){if(W[$e]==="(")ue++;else if(W[$e]===")"){if(ue--,ue===0)break}$e++}if(ue!==0)break;let we=W.substring(de+1,$e),ye=W.substring(ce,$e+1),Pe=we.match(/^\s*(\[[^\]]+\])/);if(!Pe){ae.lastIndex=0,W=W.replace(ye,"");continue}let Oe=Pe[1],Me=we.slice(Pe[0].length),Ne,Le=Me.match(/^\s*,\s*\{/);if(Le){Me=Me.slice(Le[0].length-1);let Ve=1,Be=1;while(Be<Me.length&&Ve>0){if(Me[Be]==="{")Ve++;else if(Me[Be]==="}"){if(Ve--,Ve===0)break}Be++}Ne=Me.substring(0,Be+1),Me=Me.slice(Be+1)}let De,ze=Me.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(ze)De=ze[1];try{let Ve=JSON.parse(Oe.replace(/'/g,'"')),Be={};if(Ne)try{Be=D(Ne,_)}catch(st){let ht=st instanceof Error?st.message:String(st);if(R.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ht}`,k,v,ce,ye);W=W.replace(ye,()=>yt)}else W=W.replace(ye,()=>De||"");continue}let je=!1;for(let st of Ve){let ht=U(st,z,k);if(!ht)continue;if(await r(ht)){let yt=await Q(st,Be,v,ce);W=W.replace(ye,()=>yt),je=!0;break}}if(!je)if(De!==void 0)W=W.replace(ye,()=>De);else if(R.debug){let st=g("Include",`None of the includeFirst paths exist: ${Oe}`,k,v,ce,ye);W=W.replace(ye,()=>st)}else W=W.replace(ye,"")}catch(Ve){let Be=Ve instanceof Error?Ve.message:String(Ve),je=g("Include",`Error processing @includeFirst: ${Be}`,k,v,ce,ye);W=W.replace(ye,()=>je)}ae.lastIndex=0}}function U(ae,le,ce){try{let de=ae;if(!ae.endsWith(".stx"))de=`${ae}.stx`;let ue=Zt.resolve(le),$e=Zt.resolve(Zt.dirname(ce)),we;if(!de.startsWith("./")&&!de.startsWith("../")){for(let Le of R._layerPartialDirs??[]){let De=Zt.resolve(Le,de);if(De.startsWith(`${Zt.resolve(Le)}${Zt.sep}`)&&ow(De))return De}we=Zt.resolve(le,de)}else we=Zt.resolve($e,de);let ye=Zt.normalize(we),Pe=ye.startsWith(ue+Zt.sep)||ye===ue,Oe=ye.startsWith($e+Zt.sep)||ye===$e,Me=!1,Ne=Zt.dirname($e);if(ye.startsWith(Ne+Zt.sep)){if(!Zt.relative(Ne,ye).split(Zt.sep).some((Ve)=>Ve.startsWith(".")&&Ve!=="."&&Ve!==".."))Me=!0}if(!Pe&&!Oe&&!Me)return console.error(`Security: Path traversal attempt blocked for include path: ${ae}`),console.error(` Resolved to: ${ye}`),console.error(` Allowed dirs: ${ue}, ${$e}`),null;return ye}catch(de){return console.error(`Error resolving path ${ae}: ${de}`),null}}let H=Zt.resolve(k);B.add(H);function q(ae,le,ce,de){return R.onIncludeError?.({includePath:ae,templatePath:k,message:le,partialsDir:z}),g("Include",le,k,ce,de)}async function Q(ae,le={},ce,de){let ue=U(ae,z,k);if(!ue)return q(ae,`Could not resolve path for include: ${ae}`,ce,de);let $e=Zt.resolve(ue);if(B.has($e)){let we=[...B,$e].map((ye)=>Zt.basename(ye)).join(" -> ");return q(ae,`Circular include detected: ${we}`,ce,de)}try{T.add(ue);let we;if(!we)try{we=await Bun.file(ue).text()}catch(ct){let St=ct instanceof Error?ct.message:String(ct);return q(ae,`Error loading include file ${ae}: ${St}`,ce,de)}if(we)we=we.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(we&&we.includes("@stream")){let{processStreamDirectives:ct}=await import("./chunk-d0kes50w.js");we=ct(we,_)}if(we&&(R.debug||!E()&&!Nn()))try{let{warnUnbalancedTags:ct}=await import("./chunk-ewkza45r.js");ct(we,ue)}catch{}try{let{processESImports:ct}=await import("./chunk-k7spjpr0.js");we=await ct(we,_,ue,R,T)}catch(ct){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${ue}:`,ct instanceof Error?ct.message:ct)}let ye=we,Pe=re(ye);if(Pe)ye=Pe.content.trim();let Me=we.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ne="";if(Me)Ne=`<style${Me[1]}>${Me[2]}</style>`;let Le=[];ye=ye.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(ct,St,mt)=>{if(!Yg(St))return"";return Le.push({attrs:St,body:mt}),`__STX_DATA_BLOCK_${Le.length-1}__`}),ye=ye.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let De={..._};De.__stx_signals_gate=ke(we,ue);for(let[ct,St]of Object.entries(le))De[ct]=St;let ze=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ve=[...we.matchAll(ze)].sort((ct,St)=>{let mt=(ct[1]||"").includes("server"),Kt=(St[1]||"").includes("server");return Number(Kt)-Number(mt)}),Be="",je=null,st=!1,ht=!1;for(let ct of Ve){let St=ct[1]||"",mt=ct[2]||"";if(Yg(St))continue;let Kt=St.includes("server"),Wn=Qe(St);if(!Kt&&mt.trim()){let{interpolateScriptExpressions:ft}=await import("./chunk-3gm6013p.js");mt=ft(mt,De,ae)}let Mn="";try{let{extractAndStripCssImports:ft,renderVendorStyleTags:$t}=await import("./chunk-fese2cf6.js"),Wt=ft(mt,{filePath:ue,projectRoot:process.cwd()});mt=Wt.code,Mn=$t(Wt.styles)}catch(ft){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${ue}:`,ft instanceof Error?ft.message:ft)}if(Wn&&mt.trim())mt=et(mt);if(!Kt){try{let{injectBrowserCoreAutoImports:$t}=await import("./chunk-fese2cf6.js");mt=$t(mt).code;let{hasUserImports:Wt,bundleClientScript:Gt}=await import("./chunk-8x2ejkcc.js");if(Wt(mt))mt=await Gt(mt,ue,{projectRoot:process.cwd()})}catch($t){if(R.debug)console.warn(`[stx] bundler skipped for ${ue}:`,$t instanceof Error?$t.message:$t)}let{stripStxRuntimeImports:ft}=await import("./chunk-en388k3h.js");mt=ft(mt)}let bt=cw(mt);if(!Kt){let{extractBridgeData:ft,generateServerDataBridge:$t}=await import("./chunk-fese2cf6.js"),Wt=$t(mt,ft(De));if(Wt)mt=`${Wt}
2515
+ ${mt}`}if(bt&&!Kt){st=!0,je=Jg(ue,_);let ft=O(mt),$t=Gg(ft,je);Be+=`${Mn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${je}">${$t}</script>
2516
+ `;continue}if(Kt)try{let{extractVariables:ft}=await import("./chunk-915s0may.js");await ft(mt,De,ue)}catch(ft){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${ue}:`,ft)}if(!Kt&&!bt){let ft=St.replace(/\bclient\b/i,"").trim();je=Jg(ue,_);let $t=O(mt),Wt=Gg($t,je);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Wt))ht=!0;Be+=`${Mn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${je}"${ft?` ${ft}`:""}>${Wt}</script>
2517
+ `}}if(Le.length>0){let{interpolateScriptExpressions:ct}=await import("./chunk-3gm6013p.js");ye=ye.replace(/__STX_DATA_BLOCK_(\d+)__/g,(St,mt)=>{let Kt=Le[Number(mt)];return`<script${Kt.attrs}>${ct(Kt.body,De,ae)}</script>`})}if(je){let ct=pw(ye,je);if(ye=ct.html,ct.mergedIntoExisting){let mt=je,Kt=ct.mergedIntoExisting;Be=Be.split(`'${mt}'`).join(`'${Kt}'`).split(`"${mt}"`).join(`"${Kt}"`),je=Kt}else if(!ct.stamped&&st&&!yu.has(ue))yu.add(ue),console.warn(`[stx] ${Zt.relative(process.cwd(),ue)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(ct.stamped&&ct.root!=="body"&&(st||ht)&&!xu.has(ue)){let mt=Uc(ye);if(mt.length>1)xu.add(ue),console.warn(`[stx] ${Zt.relative(process.cwd(),ue)} declares ${st?"signals":"bindings"} and has ${mt.length} top-level elements (${mt.map((Kt)=>`<${Kt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let St=ct.stamped&&ct.root!==null&&Sn(ct.root);Be=dw(Be,St?je:null)}if(ye.includes("@include")||ye.includes("@partial"))ye=await Ps(ye,De,ue,R,T,B);let{processLoops:yt,reportDeferredLoopWarnings:vt}=await import("./chunk-y2wr7c9e.js"),dt=yt(ye,De,ue,void 0,!0);dt=br(dt,De,ue),dt=vt(dt);let{processMetaDirectives:wt,processSeoDirective:kt,processStructuredData:xt}=await import("./chunk-jshj69dy.js");if(dt=wt(dt,De,ue,R),dt=xt(dt,De,ue),dt=kt(dt,De,ue,R),dt=X(dt,De,ue),Ne)dt+=`
2518
+ `+Ne;if(Be)dt+=`
2519
+ `+Be;return dt}catch(we){let ye=we instanceof Error?we.message:String(we);return q(ae,`Error processing include ${ae}: ${ye}`,ce,de)}}let ie=/@include\s*\(/g,Z;while((Z=ie.exec(W))!==null){let ae=Z.index,le=ae+Z[0].length-1,ce=1,de=le+1;while(de<W.length&&ce>0){if(W[de]==="(")ce++;else if(W[de]===")")ce--;de++}if(ce!==0)break;let ue=W.substring(ae,de),$e=W.substring(le+1,de-1),we=$e.match(/^\s*['"]([^'"]+)['"]/);if(!we){ie.lastIndex=de;continue}let ye=we[1],Pe,Oe=$e.substring(we[0].length),Me=hu(Oe,0);if(Me!==-1)Pe=Oe.substring(Me+1).trim();let Ne={};if(Pe)try{Ne=D(Pe,_)}catch(De){let ze=De instanceof Error?De.message:String(De);W=W.replace(ue,g("Include",`Error parsing include variables for ${ye}: ${ze}`,k,v,ae)),ie.lastIndex=0;continue}let Le=await Q(ye,Ne,v,ae);W=W.substring(0,ae)+Le+W.substring(de),ie.lastIndex=0}return W}function Is(v,_){let k=v;function R(T,B,z,W){let F=T,U=!0;while(U){U=!1;let H=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),q=F.match(H);if(!q||q.index===void 0)break;let Q=q.index,ie=q[1],Z=Q+q[0].length,ae=new RegExp(`@${B}\\(`),le=new RegExp(`@${z}(?![a-z])`),ce=1,de=Z,ue=-1;while(ce>0&&de<F.length){let we=F.slice(de),ye=we.match(ae),Pe=we.match(le),Oe=ye?de+ye.index:1/0,Me=Pe?de+Pe.index:1/0;if(Oe<Me)ce++,de=Oe+(ye[0].length||1);else if(Me<1/0){if(ce--,ce===0){ue=Me;break}de=Me+z.length+1}else break}if(ue===-1)break;let $e=F.slice(Z,ue);if(!_[ie])_[ie]=[];if(W)_[ie].unshift($e);else _[ie].push($e);F=F.substring(0,Q)+F.substring(ue+`@${z}`.length),U=!0}return F}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function Os(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
2520
+ `)})}import*as bu from"path";async function em(v,_,k=""){if(bu.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return nm(v,_,k,"@js","@endjs")}async function tm(v,_,k=""){if(bu.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return nm(v,_,k,"@ts","@endts")}async function nm(v,_,k,R,T){let B=v,z=Fr(`${R}([\\s\\S]*?)${T}`,"g"),W=[],F;while((F=z.exec(v))!==null)W.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:U,content:H,index:q}of W)try{let Q={..._,global:_},ie=Object.keys(Q),Z=Object.values(Q),ae=H.trim();if(R==="@ts")ae=ae.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let ce=(ae.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((ye)=>ye.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),de=ce.length>0?`return { ${ce.join(", ")} };`:"return {};",ue=`
2521
+ ${ae}
2522
+ ${de}
2523
+ `,we=Function(...ie,ue)(...Z);if(we&&typeof we==="object")Object.assign(_,we);B=B.replace(U,"")}catch(Q){console.error(`Error executing ${R} code block in ${k}:`,Q);let ie=Q instanceof Error?Q.message:String(Q),Z=g(`${R} Directive`,`Error executing code: ${ie}`,k,v,q,U);console.error(Z),B=B.replace(U,"")}return B}var yw=1000,xw=!1;function bw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,W=B.index+B[0].indexOf("("),F=S(v,"(",")",W);if(F===-1)continue;let U=v.slice(z,F).trim();if(!U)continue;if(!Object.keys(_).some((Q)=>new RegExp(`(?:^|[^\\w$.])${Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(U)))continue;let q;try{let Q=D(U,_);if(!Q||typeof Q!=="object")continue;q=JSON.stringify(Q)}catch{continue}R+=v.slice(T,z)+q,T=F,k.lastIndex=F}return T===0?v:R+v.slice(T)}function vw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,W=z+T[0].length-1,F=1,U=W+1;while(U<R.length&&F>0){if(R[U]==="(")F++;else if(R[U]===")"){if(F--,F===0)break}U++}if(F!==0)continue;let H=R.substring(W+1,U),q=U+1,Q=H.match(/^\s*['"]([^'"]+)['"]/);if(!Q)continue;let ie=Q[1],Z=H.slice(Q[0].length),ae=Z.match(/^\s*,\s*/);if(!ae)continue;let le=Z.slice(ae[0].length).trim();if(!le)continue;try{let ce=D(le,_),de=JSON.stringify(ce),ue=`@component('${ie}', ${de})`;B.push({start:z,end:q,replacement:ue})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:U}=B[z];R=R.substring(0,W)+U+R.substring(F)}return R}function ja(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,W=z+B[0].length-1,F=1,U=W+1,H=null,q=!1;while(U<R.length&&F>0){let Z=R[U];if(q){q=!1,U++;continue}if(Z==="\\"&&H){q=!0,U++;continue}if(H){if(Z===H)H=null;U++;continue}if(Z==='"'||Z==="'"||Z==="`"){H=Z,U++;continue}if(Z==="(")F++;else if(Z===")"){if(F--,F===0)break}U++}if(F!==0)break;let Q=R.substring(W+1,U),ie=k(Q);R=R.substring(0,z)+ie+R.substring(U+1)}return R}function ww(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),W=Object.values(_);Zs(B);let U=c(B,z)(...W),H=JSON.stringify(U);if(H===void 0){if(!Ae(B).some((ie)=>!(ie in _)))return"";return R}let q=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${q}"`}catch(z){return R}}),k}var La="<!--__STX_BREAK__-->",Ba="<!--__STX_CONTINUE__-->";function Sw(v,_){let k=v;return k=ja(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?La:""}catch{return""}}),k=ja(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?Ba:""}catch{return""}}),k}function $w(v){let _=v;return _=_.replace(/@break(?!\()/g,La),_=_.replace(/@continue(?!\()/g,Ba),_}function rm(v){let _=v.includes(La),k=_?v.substring(0,v.indexOf(La)):v;return{hasBreak:_,content:k}}function sm(v){let _=v.includes(Ba),k=_?v.substring(0,v.indexOf(Ba)):v;return{hasContinue:_,content:k}}function om(v){let _=v;return _=ja(_,"@break",(k)=>{let R=k.trim();if(!Cr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=ja(_,"@continue",(k)=>{let R=k.trim();if(!Cr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function _w(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((H,q)=>H.pos-q.pos);let W=[],F=0;for(let H of R)F+=H.delta,W.push({pos:H.pos,depth:F});function U(H){let q=0,Q=W.length-1,ie=0;while(q<=Q){let Z=q+Q>>1;if(W[Z].pos<=H)ie=W[Z].depth,q=Z+1;else Q=Z-1}return ie}while((k=_.exec(v))!==null){if(U(k.index)>0)continue;let H=k.index,q=k.index+k[0].length-1,Q=1,ie=q+1,Z=-1;while(ie<v.length&&Q>0){if(v[ie]==="(")Q++;else if(v[ie]===")"){if(Q--,Q===0){Z=ie;break}}ie++}if(Z===-1)continue;let ae=v.substring(q+1,Z),le=It(ae);if(!le)continue;let{arrayExpr:ce,itemVar:de}=le,ue=Z+1,$e=1,we=ue,ye=/@forelse\s*\(/g,Pe=/@endforelse/g,Oe=-1;while($e>0&&we<v.length){ye.lastIndex=we,Pe.lastIndex=we;let Ve=ye.exec(v),Be=Pe.exec(v);if(!Be)break;if(Ve&&Ve.index<Be.index)$e++,we=Ve.index+Ve[0].length;else{if($e--,$e===0){Oe=Be.index;break}we=Be.index+11}}if(Oe===-1)continue;let Me=v.substring(ue,Oe),Ne=Oe+11,Le=-1,De=0,ze=0;while(ze<Me.length){let Ve=Me.indexOf("@",ze);if(Ve===-1)break;let Be=Me.substring(Ve);if(/^@forelse\s*\(/.test(Be))De++,ze=Ve+1;else if(Be.startsWith("@endforelse"))De--,ze=Ve+11;else if(De===0&&Be.startsWith("@empty")){if(Me.length<=Ve+6||!/[a-z]/i.test(Me[Ve+6])){Le=Ve;break}ze=Ve+1}else ze=Ve+1}if(Le===-1)continue;return{start:H,end:Ne,arrayExpr:ce,itemVar:de,foreachContent:Me.substring(0,Le),emptyContent:Me.substring(Le+6)}}return null}function im(v,_){let k=v;while(!0){let R=_w(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:W,foreachContent:F,emptyContent:U}=R;try{let H;if(p(z))H=c(z,Object.keys(_))(...Object.values(_));else H=l(z,_);let q;if(!Array.isArray(H)||H.length===0)q=U;else q=`@foreach (${z} as ${W})${F}@endforeach`;k=k.substring(0,T)+q+k.substring(B)}catch(H){let q=H instanceof Error?H.message:String(H),Q=i("Forelse",`Error in @forelse(${z} as ${W}): ${q}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Q+k.substring(B)}}return k}var am="<!--stx:foreach-not-iterable:",kw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ew(v,_){return`${am}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Cw(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} 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 As(v){if(!v.includes(am))return v;return v.replace(kw,(_,k,R)=>(Cw(decodeURIComponent(k),decodeURIComponent(R)),""))}function $i(v,_,k,R,T=!1){let B=v;B=im(B,_);function z(U){let H=/@foreach\s*\(/g,q;while((q=H.exec(U))!==null){let Q=q.index,ie=q.index+q[0].length-1,Z=1,ae=ie+1,le=-1;while(ae<U.length&&Z>0){if(U[ae]==="(")Z++;else if(U[ae]===")"){if(Z--,Z===0){le=ae;break}}ae++}if(le===-1)continue;let ce=U.substring(ie+1,le),de=It(ce);if(!de)continue;let ue=Q,{arrayExpr:$e,itemVar:we}=de,ye=le+1,Pe=1,Oe=ye,Me=/@foreach\s*\(/g,Ne=/@endforeach/g;while(Pe>0&&Oe<U.length){Me.lastIndex=Oe,Ne.lastIndex=Oe;let Le=Me.exec(U),De=Ne.exec(U);if(!De)break;if(Le&&Le.index<De.index)Pe++,Oe=Le.index+Le[0].length;else{if(Pe--,Pe===0){let ze=U.substring(ye,De.index),Ve=De.index+11;return{start:ue,end:Ve,arrayExpr:$e,itemVar:we,content:ze}}Oe=De.index+11}}}return null}function W(U,H){let q=U;while(!0){let Q=z(q);if(!Q)break;let{start:ie,end:Z,arrayExpr:ae,itemVar:le,content:ce}=Q;try{let de=ae.trim(),ue;if(p(de))ue=c(de,Object.keys(H))(...Object.values(H));else ue=l(de,H);let $e=!1;if(!Array.isArray(ue))if(ue instanceof Map)ue=Array.from(ue),$e=!0;else if(ue instanceof Set)ue=Array.from(ue);else if(typeof ue==="string")ue=Array.from(ue);else if(ue&&typeof ue==="object"&&!(ue instanceof Date)&&!(ue instanceof RegExp))ue=Object.entries(ue),$e=!0;else{let De=Ew(de,k)+i("Foreach",`Error in @foreach: ${de} is not iterable`,t.TYPE_ERROR);q=q.substring(0,ie)+De+q.substring(Z);continue}let we=R?.loops?.useAltLoopVariable??xw,ye=le.trim(),Pe=null,Oe,Me=!1;if(ye.includes("=>")){let De=ye.split("=>").map((ze)=>ze.trim());if(De.length===2&&De[0]&&De[1])Pe=De[0],Oe=De[1];else Oe=ye}else if(!ye.startsWith("[")&&!ye.startsWith("{")&&ye.includes(",")){let De=ye.split(",").map((ze)=>ze.trim());if(De.length===2&&De[0]&&De[1])Oe=De[0],Pe=De[1],Me=!0;else Oe=ye}else Oe=ye;let Ne="",Le=ue;for(let De=0;De<Le.length;De++){let ze=Le[De],Ve={index:De,iteration:De+1,first:De===0,last:De===Le.length-1,count:Le.length},Be={...H,loop:Ve,$loop:Ve};if(Oe.startsWith("[")&&Oe.endsWith("]")){let yt=Oe.slice(1,-1).split(",").map((vt)=>vt.trim());if(Array.isArray(ze))yt.forEach((vt,dt)=>{if(vt)Be[vt]=ze[dt]});else Be[Oe]=ze}else if(Oe.startsWith("{")&&Oe.endsWith("}")){let yt=Oe.slice(1,-1).split(",").map((vt)=>vt.trim()).filter(Boolean);if(ze!==null&&typeof ze==="object")yt.forEach((vt)=>{let dt=vt.indexOf(":"),wt=(dt===-1?vt:vt.slice(0,dt)).trim(),kt=dt===-1?wt:vt.slice(dt+1).trim();if(wt&&kt)Be[kt]=ze[wt]});else Be[Oe]=ze}else Be[Oe]=ze;if(Pe)if(!Me&&$e&&Array.isArray(ze)&&ze.length===2)Be[Pe]=ze[0],Be[Oe]=ze[1];else Be[Pe]=De;let je=Sw(ce,Be),st=sm(je);if(st.hasContinue){Ne+=st.content;continue}let ht=rm(je);if(ht.hasBreak){Ne+=ht.content;break}if(je=im(je,Be),je=W(je,Be),je=br(je,Be,k),je=$w(je),ht=rm(je),ht.hasBreak){Ne+=ht.content;break}if(st=sm(je),st.hasContinue){Ne+=st.content;continue}je=X(je,Be,k),je=ww(je,Be),je=vw(je,Be),je=bw(je,Be),Ne+=je}q=q.substring(0,ie)+Ne+q.substring(Z)}catch(de){let ue=i("Foreach",`Error in @foreach(${ae.trim()} as ${le.trim()}): ${de instanceof Error?de.message:String(de)}`,t.EVALUATION_ERROR);q=q.substring(0,ie)+ue+q.substring(Z)}}return q}B=W(B,_),B=lm(B,_,k,R);let F=R?.loops?.maxWhileIterations??yw;return B=Tw(B,_,F),T?B:As(B)}function Vc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function cm(v){return Cr(v)}function lm(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=W+z[0].length-1,U=S(T,"(",")",F);if(U===-1)break;let H=Vc(T.slice(F+1,U)),q=U+1,Q=wa(T.slice(W),"for","endfor");if(Q.length===0)break;let ie=Q[0].content,Z=W+Q[0].end;if(!cm(H)){let ae=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,W)+ae+T.substring(Z),B=!0;continue}try{let ae=Rw(H),le=/@(?:for|foreach|if|unless)\s*\(/.test(ie);if(ae.length>0&&le){let ye=Aw({forExpr:H,content:ie,iterVarNames:ae,context:_,filePath:k,options:R});T=T.substring(0,W)+ye+T.substring(Z),B=!0;continue}let ce=Object.keys(_),de=Object.values(_),ue=ie.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(ye,Pe)=>`\${${Pe}}`);ue=om(ue);let we=Function(...ce,`
2524
+ let result = '';
2525
+ for (${H}) {
2526
+ result += \`${ue}\`;
2527
+ }
2528
+ return result;
2529
+ `)(...de);T=T.substring(0,W)+we+T.substring(Z),B=!0}catch(ae){let le=i("For",`Error in @for(${H}): ${ae instanceof Error?ae.message:String(ae)}`,t.EVALUATION_ERROR);T=T.substring(0,W)+le+T.substring(Z),B=!0}}return T}function Rw(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let B=k[1];return B.slice(1,-1).split(",").map((W)=>{let F=W.trim();if(!F)return"";let U=F.indexOf(":");if(U>=0&&B.startsWith("{")){let Q=F.slice(U+1).trim(),ie=Q.indexOf("=");return(ie>=0?Q.slice(0,ie):Q).trim()}let H=F.indexOf("="),q=(H>=0?F.slice(0,H):F).trim();return/^[A-Za-z_$][\w$]*$/.test(q)?q:""}).filter(Boolean)}let R=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(R)return[R[1]];let T=_.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(T)return[T[1]];return[]}function Aw(v){let{forExpr:_,content:k,iterVarNames:R,context:T,filePath:B,options:z}=v,W=Object.keys(T),F=Object.values(T),U=Function(...W,"__pushIter",`
2530
+ for (${_}) {
2531
+ __pushIter([${R.join(", ")}])
2532
+ }
2533
+ `),H=[];U(...F,(ie)=>{H.push(ie)});let q=B??"inline.stx",Q="";for(let ie of H){let Z={...T};R.forEach((le,ce)=>{Z[le]=ie[ce]});let ae=lm(k,Z,B,z);ae=br(ae,Z,q),ae=X(ae,Z,q),Q+=ae}return Q}function Tw(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@while\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=z+B[0].length-1,F=S(R,"(",")",W);if(F===-1)break;let U=R.slice(W+1,F),H=wa(R.slice(z),"while","endwhile");if(H.length===0)break;let q=H[0].content,Q=z+H[0].end;if(!cm(U)){let ie=i("While",`Unsafe expression in @while: ${U}`,t.UNSAFE_EXPRESSION);R=R.substring(0,z)+ie+R.substring(Q),T=!0;continue}try{let ie=Object.keys(_),Z=Object.values(_),ae=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(de,ue)=>`\${${ue}}`);ae=om(ae);let ce=Function(...ie,`
2534
+ let result = '';
2535
+ let maxIterations = ${k}; // Configurable safety limit
2536
+ let counter = 0;
2537
+ while (${U} && counter < maxIterations) {
2538
+ counter++;
2539
+ result += \`${ae}\`;
2540
+ }
2541
+ if (counter > maxIterations) {
2542
+ result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2543
+ }
2544
+ return result;
2545
+ `)(...Z);R=R.substring(0,z)+ce+R.substring(Q),T=!0}catch(ie){let Z=i("While",`Error in @while(${U}): ${ie instanceof Error?ie.message:String(ie)}`,t.EVALUATION_ERROR);R=R.substring(0,z)+Z+R.substring(Q),T=!0}}return R}function Iw(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function um(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,R,T,B)=>Iw(R,B||"_method"))}async function dm(v,_,k,R,T){if(!R.middleware||R.middleware.length===0)return v;let B=v,z=R.middleware.filter((W)=>W.timing===T);if(z.length===0)return B;for(let W of z){if(!W.name||typeof W.handler!=="function"){if(R.debug)console.warn("Invalid middleware:",W);continue}try{let F=await W.handler(B,_,k,R);if(typeof F==="string")B=F;else if(R.debug)console.warn(`Middleware ${W.name} did not return a string`)}catch(F){if(R.debug)console.error(`Error in middleware ${W.name}:`,F);if(R.debug){let U=g("Middleware",`Error in middleware '${W.name}': ${F instanceof Error?F.message:String(F)}`,k,v);B=B.replace(/<body[^>]*>/,`$&
2546
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(U)}</div>
2547
+ `)}}}return B}async function fm(v,_,k,R){return dm(v,_,k,R,"before")}async function pm(v,_,k,R){return dm(v,_,k,R,"after")}function gm(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,R,T,B)=>{try{let z=T?D(T,{}):{};return Fn(R,z,B==="true")}catch(z){return console.error(`Error processing @route directive: ${z}`),"#route-error"}})}var Ao={patterns:[],exact:{}};async function mm(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Ao.exact[v])for(let R of Ao.exact[v])await Promise.resolve(R(_,v));if(Ao.exact[k])for(let R of Ao.exact[k])await Promise.resolve(R(_,v));for(let{pattern:R,callback:T}of Ao.patterns)if(R.test(v)||R.test(k))await Promise.resolve(T(_,v))}var Pw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Dw=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function Gr(v,_){let k=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;k.lastIndex=_;let R=k.exec(v);if(!R)return null;let T=/\/\s*>$/.test(R[0])||R[1]===R[1].toLowerCase()&&Pw.has(R[1]),B=T?R[2].replace(/\/\s*$/,""):R[2];return{full:R[0],tag:R[1],attrs:B,selfClosing:T,start:R.index,end:R.index+R[0].length}}function Ow(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),z=new RegExp(`</${_}\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T;let W=B.exec(v),F=z.exec(v);if(!F)return-1;if(W&&W.index<F.index)R++,T=W.index+W[0].length;else{if(R--,R===0)return F.index+F[0].length;T=F.index+F[0].length}}return-1}function Zr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Ow(v,_.tag,_.end);if(k===-1)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};return{outerStart:_.start,outerEnd:k,innerHTML:v.slice(_.end,k-`</${_.tag}>`.length)}}function hm(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function To(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return R?R[1]:null}function Lr(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return v.replace(new RegExp(`\\s*${k}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${k}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${k}(?=\\s|$|>|/)`,"g"),"")}function si(v,_,k){let R=_.selfClosing?" /":"",T=`<${_.tag}${k}${R}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function Mw(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Nw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-for");if(T===null){k=R.end;continue}let B=T.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!B){k=R.end;continue}let z=B[1].trim(),W=B[2].trim(),F;if(z.includes(",")){let le=z.split(",").map((ue)=>ue.trim()),ce=le[0],de=le[1];F=`${W} as ${de} => ${ce}`}else F=`${W} as ${z}`;let U=Lr(R.attrs,"v-for"),H=Lr(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),q=Zr(_,R),Q=_.slice(q.outerStart,q.outerEnd),ie=si(Q,{...R,start:0,end:R.end-R.start},H),Z=`@foreach(${F})
2548
+ `,ae=`${Z}${ie}
2549
+ @endforeach`;_=_.slice(0,q.outerStart)+ae+_.slice(q.outerEnd),k=q.outerStart+Z.length}return _}function jw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-if");if(T===null){k=R.end;continue}let B=[],z=Zr(_,R),W=Lr(R.attrs,"v-if"),F=si(_.slice(z.outerStart,z.outerEnd),{...R,start:0,end:R.end-R.start},W);B.push({type:"if",expr:T,outerStart:z.outerStart,outerEnd:z.outerEnd,element:F,parsedTag:R});let U=z.outerEnd,H=!0;while(H){let ae=_.slice(U).match(/^\s*/),le=ae?ae[0].length:0,ce=Gr(_,U+le);if(!ce){H=!1;break}let de=To(ce.attrs,"v-else-if"),ue=hm(ce.attrs,"v-else");if(de!==null){let $e=Zr(_,ce),we=Lr(ce.attrs,"v-else-if"),ye=si(_.slice($e.outerStart,$e.outerEnd),{...ce,start:0,end:ce.end-ce.start},we);B.push({type:"else-if",expr:de,outerStart:U,outerEnd:$e.outerEnd,element:ye,parsedTag:ce}),U=$e.outerEnd}else if(ue){let $e=Zr(_,ce),we=Lr(ce.attrs,"v-else"),ye=si(_.slice($e.outerStart,$e.outerEnd),{...ce,start:0,end:ce.end-ce.start},we);B.push({type:"else",outerStart:U,outerEnd:$e.outerEnd,element:ye,parsedTag:ce}),H=!1}else H=!1}let q=[];for(let ae of B)if(ae.type==="if")q.push(`@if(${ae.expr})
2550
+ ${ae.element}`);else if(ae.type==="else-if")q.push(`@elseif(${ae.expr})
2551
+ ${ae.element}`);else q.push(`@else
2552
+ ${ae.element}`);q.push("@endif");let Q=q.join(`
2553
+ `),ie=B[0].outerStart,Z=B[B.length-1].outerEnd;_=_.slice(0,ie)+Q+_.slice(Z),k=ie+Q.length}return _}function Lw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Bw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=Dw.has(R.tag),B=R.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(W,F,U)=>{let H=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(F);if(!H||!U||!/^["']/.test(U))return W;let q=H[1]||"modelValue",Q=H[2];if(T&&!H[1])return`@model${Q}=${U}`;let ie=U[0],Z=U.slice(1,-1),ae=`:${q}=${U} @update:${q}=${ie}${Z} = $event${ie}`;if(Q){let le=H[1]?`${q}Modifiers`:"modelModifiers",ce=Q.slice(1).split(".").map((de)=>`${de}: true`).join(", ");ae+=` :${le}="{ ${ce} }"`}return ae});if(B===R.attrs){k=R.end;continue}let z=si(R.full,{...R,start:0,end:R.full.length},B);_=_.slice(0,R.start)+z+_.slice(R.end),k=R.start+z.length}return _}function zw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Ww(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Fw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-html");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Zr(_,R),z=Lr(R.attrs,"v-html"),W=R.selfClosing?" /":"",F=`<${R.tag}${z}${W}>{!! ${T} !!}</${R.tag}>`;_=_.slice(0,B.outerStart)+F+_.slice(B.outerEnd),k=B.outerStart+F.length}return _}function Vw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;let T=To(R.attrs,"v-text");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Zr(_,R),z=Lr(R.attrs,"v-text"),W=R.selfClosing?" /":"",F=`<${R.tag}${z}${W}>{{ ${T} }}</${R.tag}>`;_=_.slice(0,B.outerStart)+F+_.slice(B.outerEnd),k=B.outerStart+F.length}return _}function Uw(v){return v.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function Hw(v){let _=v,k=0;while(k<_.length){let R=Gr(_,k);if(!R)break;if(!hm(R.attrs,"v-once")){k=R.end;continue}let T=Lr(R.attrs,"v-once"),B=Zr(_,R),z=_.slice(B.outerStart,B.outerEnd),F=`@once
2554
+ ${si(z,{...R,start:0,end:R.end-R.start},T)}
2555
+ @endonce`;_=_.slice(0,B.outerStart)+F+_.slice(B.outerEnd),k=B.outerStart+F.length}return _}function qw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Kw(v){return v.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function ym(v){if(!Mw(v))return v;let _=v;return _=Nw(_),_=jw(_),_=Hw(_),_=zw(_),_=Ww(_),_=Bw(_),_=Lw(_),_=Kw(_),_=Fw(_),_=Vw(_),_=Uw(_),_=qw(_),_}function za(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var vu=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),Xw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function xm(v,_){let k=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v),R=k?k[1]:v,T=l(R,_);if(T&&typeof T==="string")return T;let B=R.trim();return vu.has(B)?B:null}function bm(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function vm(v,_,k){let R=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=R?`<${v} ${R}>`:`<${v}>`;if(Xw.has(v))return R?`<${v} ${R}>`:`<${v}>`;return`${T}${k}</${v}>`}async function wm(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,W=[],F;while((F=z.exec(B))!==null)W.push({full:F[0],expr:F[1],attrs:F[2],slotContent:F[3],index:F.index});for(let U=W.length-1;U>=0;U--){let H=W[U];try{let q=xm(H.expr,_);if(!q||typeof q!=="string"){let de=`<!-- dynamic component: could not resolve "${za(bm(H.expr))}" -->`;B=B.slice(0,H.index)+de+B.slice(H.index+H.full.length);continue}if(vu.has(q)){let de=vm(q,H.attrs,H.slotContent);B=B.slice(0,H.index)+de+B.slice(H.index+H.full.length);continue}let Q=H.attrs.trim(),ie={},Z=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,ae;while((ae=Z.exec(Q))!==null){let de=ae[1]||ae[2],ue=ae[3];if(ae[1])try{ie[de]=l(ue,_)}catch{ie[de]=ue}else ie[de]=ue}let le=R.componentsDir||"components",ce=await tt(q,ie,H.slotContent,le,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+ce+B.slice(H.index+H.full.length)}catch(q){let Q=q instanceof Error?q.message:String(q),ie=`<!-- dynamic component error: ${za(Q)} -->`;B=B.slice(0,H.index)+ie+B.slice(H.index+H.full.length)}}return B=await Zw(B,_,k,R,T),B}async function Zw(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,W=[],F;while((F=z.exec(B))!==null)W.push({full:F[0],expr:F[1],attrs:F[2],index:F.index});for(let U=W.length-1;U>=0;U--){let H=W[U];try{let q=xm(H.expr,_);if(!q||typeof q!=="string"){let Z=`<!-- dynamic component: could not resolve "${za(bm(H.expr))}" -->`;B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length);continue}if(vu.has(q)){let Z=vm(q,H.attrs,"");B=B.slice(0,H.index)+Z+B.slice(H.index+H.full.length);continue}let Q=R.componentsDir||"components",ie=await tt(q,{},"",Q,_,k,R,new Set,T??new Set);B=B.slice(0,H.index)+ie+B.slice(H.index+H.full.length)}catch(q){let Q=q instanceof Error?q.message:String(q),ie=`<!-- dynamic component error: ${za(Q)} -->`;B=B.slice(0,H.index)+ie+B.slice(H.index+H.full.length)}}return B}var Ai="X-STX-Build",wu=Symbol.for("stx.buildId");function Ds(){let v=globalThis;if(!v[wu])v[wu]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[wu]}function Sm(v,_=Ds()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
2556
+ <meta name="stx-build" content="${_}">`}function Gw(v){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let _=navigator.serviceWorker,k=window;if(k.stxOffline)return;let R=null,T=!1,B=[],z={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>R,onUpdateReady(H){if(z.updateReady)try{H()}catch{}else B.push(H);return()=>{let q=B.indexOf(H);if(q!==-1)B.splice(q,1)}},applyUpdate(){let H=R&&R.waiting;if(!H)return!1;return T=!0,H.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=z;let W=(H)=>{if(!H.waiting||!_.controller||z.updateReady)return;z.updateReady=!0;let q=B.splice(0);for(let Q of q)try{Q()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(H)=>{let q=H.data||{};if(q.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:q.url,kind:q.kind,fragment:!!q.fragment}}))}catch{}if(q.type==="stx:reachability"){if(k.stxOffline.reachable=q.reachable!==!1,Number(q.at)>0)k.stxOffline.reachedAt=Number(q.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:q.reachable!==!1,at:Number(q.at)||0}}))}catch{}}}),_.addEventListener("controllerchange",()=>{if(T)T=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&R&&R.waiting)R.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let F=()=>{_.register(v,{scope:"/"}).then((H)=>{R=H;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(H.waiting)W(H),H.waiting.postMessage({type:"stx:activate-update",reason:"load"});H.addEventListener("updatefound",()=>{let q=H.installing;if(!q)return;q.addEventListener("statechange",()=>{if(q.state==="installed")W(H)})})}).catch(()=>{})},U=()=>{let H=(q)=>{setTimeout(q,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>H(F));else H(F)};if(!_.controller)if(document.readyState==="complete")U();else addEventListener("load",U);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",U);else U()}function Jw(){let v=`(${Gw.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var $m=`<script data-stx-offline>${Jw()}</script>`;import{AsyncLocalStorage as Yw}from"async_hooks";var _m=new Yw;function kn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function km(v,_){return _m.run(kn(v),_)}async function Em(v,_){let k=_m.getStore();if(!k)throw Error("useServerData must run inside a <script server> render");if(typeof v!=="string"||!v.trim())throw TypeError("useServerData requires a non-empty string key");let R=k.pending.get(v);if(R)return R;let T=Promise.resolve().then(_).then((B)=>{let z=JSON.stringify(B,(F,U)=>{if(U===void 0||typeof U==="function"||typeof U==="symbol"||typeof U==="bigint"||typeof U==="number"&&!Number.isFinite(U))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(U&&typeof U==="object"&&!Array.isArray(U)&&Object.getPrototypeOf(U)!==Object.prototype&&Object.getPrototypeOf(U)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return U}),W=JSON.parse(z);return k.values.set(v,W),W}).catch((B)=>{throw k.pending.delete(v),B});return k.pending.set(v,T),T}function lr(v){let _=v.__stx_server_data;if(!_?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(_.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}var Qw=/<\/(script)/gi;function oi(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(Qw,"<\\/$1")}import Cm from"path";function L(v,_={}){return new Bn(v,_).routes}var Rm=new Map;async function Am(v,_){let k=v,R=_;if(!k||!R)try{let W=await o();k||=W?.pagesDir||"pages",R||=W?.root||"."}catch{k||="pages",R||="."}let T=Cm.isAbsolute(k)?k:Cm.join(R,k),B=Rm.get(T);if(B)return B;let z=[];try{z=L(".",{pagesDir:T,emit:!1}).map((W)=>W.regex.source).filter(Boolean)}catch{z=[]}return Rm.set(T,z),z}function tS(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tm(v){return tS(JSON.stringify(v))}function ge(v){return v.includes("data-stx-runtime")}function Im(v){let _=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let k=_.exec(v);k!==null;k=_.exec(v)){let R=v.slice(Math.max(0,k.index-80),k.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(R))continue;return!0}return!1}function Su(v,_){let k=co(v),R=v.search(/<!doctype\b/i);if(k!==-1&&(R===-1||k>R))return v.slice(0,k)+_+`
2557
+ `+v.slice(k);let T=Tn(v);if(T!==null)return`${v.slice(0,T)}
2558
+ ${_}${v.slice(T)}`;if(v.includes("</head>")){let z=v.indexOf("</head>");return v.slice(0,z)+_+`
2559
+ `+v.slice(z)}if(Kn(v))return ls(v,(z)=>`${z}
2560
+ ${_}`);return`${_}
2561
+ ${v}`}async function Wa(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-93na8hh0.js"),{url:B}=await T("runtime",_.debug===!0);return Su(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return Su(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-93na8hh0.js"),R=await k(_.debug);return Su(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function nS(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Pm(v){if(v.includes("data-stx-tooltip-runtime")||!nS(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${ru()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2562
+ ${_}`;return`${v.slice(0,k)}${_}
2563
+ ${v.slice(k)}`}var rS=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function sS(v){return rS.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function J(v,_){if(!v.includes("</body>"))return v;if(sS(v))return v;let k=_?.router,R="";{let F={};if(k){if(k.container)F.container=k.container;if(k.interceptAllLinks!==void 0)F.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)F.progress=k.progress;if(k.viewTransitions!==void 0)F.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)F.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)F.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)F.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)F.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)F.prefetch=k.prefetch;if(k.cache!==void 0)F.cache=k.cache;if(k.progressColor!==void 0)F.progressColor=k.progressColor;if(k.progressHeight!==void 0)F.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)F.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)F.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)F.keepOpening=k.keepOpening}try{let U=await Am(_?.pagesDir,_?.root);if(U.length>0)F.ownedRoutes=U}catch{}if(Object.keys(F).length>0)R=`<script>window.__stxRouterConfig=${Tm(F)};</script>
2564
+ `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-93na8hh0.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,W=v.lastIndexOf("</body>");return v.slice(0,W)+R+z+`
2565
+ </body>`+v.slice(W+7)}var Dm=Symbol.for("stx.lazy-module-promises");function iS(){let v=globalThis;return v[Dm]??=new Map,v[Dm]}function _t(v,_){let k=iS(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let B=_();return k.set(R,B),B.catch(()=>{if(k.get(R)===B)k.delete(R)}),B}var $u=`(?:"[^"]*"|'[^']*'|[^>"'])*`,zm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,oS=65536,aS=4,Va=new Map;function fd(){Va.clear()}function cS(v){let _=[];for(let k of ee(v,V)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let B=R[0].length,z=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(B,z),start:k.start,end:k.end}))}return _}function Oc(v,_={}){let k=v.length>=oS,R=k?Va.get(v):void 0;if(R===void 0){if(R=cS(v),k)Ld(Va,aS),Va.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let B=[];for(let z of R)if(T.lastIndex=0,!T.test(z.attrs))B.push(z);return B}function _s(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),B=k[2].trim(),{itemVar:z,indexVar:W}=Om(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:W}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),B=R[2].trim(),{itemVar:z,indexVar:W}=Om(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:W}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Om(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let R=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(R)return{itemVar:R[1],indexVar:R[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let B=_.match(/^(\w+)$/);if(B)return{itemVar:B[1],indexVar:null};return{itemVar:null,indexVar:null}}function Es(v,_){return Zi(v,_)}function lS(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,R;while((R=_.exec(v))!==null){let T=R[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Wm(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,R=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let B=T[1],z;while((z=R.exec(B))!==null)_.add(z[1])}return _}function uS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${$u})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=ee(v,(B,z)=>{_.lastIndex=z;let W=_.exec(B);if(!W||W.index!==z||!k.test(W[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let W=z[2].match(k),F=_s(W?.[1]??W?.[2]??""),U=[F.itemVar,F.indexVar].filter(Boolean);if(U.length===0)continue;let H=z[1],Q=/\/\s*>$/.test(B.token)||Ua.has(H.toLowerCase())?B.end:ku(v,B.start,H,B.end);if(Q!==-1)T.push({start:B.start,end:Q,vars:new Set(U)})}return T}var Mm=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function dS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Nm(v,_,k,R){if(!v)return!1;let T=dS(v),B=!1,z=!1,W=!1,F=/([a-zA-Z_$][\w$]*)/g,U;while((U=F.exec(T))!==null){let ie=U[1];if(T.slice(0,U.index).trimEnd().endsWith("."))continue;if(Mm.has(ie))continue;if(_.has(ie)||R?.has(ie))B=!0;else if(k&&ie in k)z=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=H.exec(T))!==null){let ie=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if(Mm.has(ie)||k&&ie in k)continue;W=!0}return(B||W)&&!z}function Fa(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),B=T.match(zm);if(B&&fS(B[3],B[1])){let[,z,W,F]=B;return`<${z}${W}${R}>${F}</${z}>`}return`<template${R}>${T}</template>`}function fS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),R=0,T;while((T=k.exec(v))!==null)if(T[1]){if(R--,R<0)return!1}else R++;return!0}function Si(v,_){let k=Wm(v);function R(T){let B=T,z=uS(T),W=(q)=>{let Q=new Set;for(let ie of z)if(q>ie.start&&q<ie.end)for(let Z of ie.vars)Q.add(Z);return Q},F=/@if\s*\(/g,U,H=[];while((U=F.exec(B))!==null){let q=U.index,Q=q+U[0].length,ie=1,Z=Q;while(Z<B.length&&ie>0){if(B[Z]==="(")ie++;else if(B[Z]===")")ie--;Z++}if(ie!==0)continue;let ae=B.substring(Q,Z-1).trim(),le=Z,ce=1,de=le,ue=/@(if\s*\(|endif)/g;ue.lastIndex=le;let $e;while(($e=ue.exec(B))!==null)if($e[1].startsWith("if"))ce++;else if($e[1]==="endif"){if(ce--,ce===0){de=$e.index+$e[0].length;break}}if(ce!==0)continue;let we=B.substring(le,de-6).trim(),ye;if(lS(we)){let Pe=go(B.substring(q,de));if(Pe.length===0)continue;let Oe=Pe[0].branches.filter((De)=>De.type!=="else"),Me=W(q);if(!(Oe.length>0&&Oe.every((De)=>Nm(De.condition,k,_,Me))))continue;ye=Pe[0].branches.map((De)=>{let ze=R(De.content);if(De.type==="elseif")return Fa(ze,"@else-if",De.condition??"");if(De.type==="else")return Fa(ze,"@else");return Fa(ze,"@if",De.condition??"")}).join(`
2566
+ `)}else{if(!Nm(ae,k,_,W(q)))continue;ye=Fa(R(we),"@if",ae)}H.push({start:q,end:de,replacement:ye}),F.lastIndex=de}for(let q=H.length-1;q>=0;q--){let{start:Q,end:ie,replacement:Z}=H[q];B=B.substring(0,Q)+Z+B.substring(ie)}return B}return R(v)}function pS(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let R=_.match(/^"((?:\\.|[^"\\])*)"$/);if(R)return R[1].length>0;return}var Ua=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jm=/<(script|style)\b/iy,gS=/<\/script/gi,mS=/<\/style/gi;function ku(v,_,k,R){if(Ua.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,W=R;while(W<B){let F=v.indexOf("<",W);if(F===-1)return-1;if(W=F,v.startsWith("<!--",W)){let Q=v.indexOf("-->",W+4);if(Q===-1)return-1;W=Q+3;continue}jm.lastIndex=W;let U=jm.exec(v);if(U){let Q=v.indexOf(">",W);if(Q===-1)return-1;if(v[Q-1]==="/"){W=Q+1;continue}let ie=U[1].toLowerCase()==="script"?gS:mS;ie.lastIndex=W;let Z=ie.exec(v);if(Z===null)return-1;let ae=v.indexOf(">",Z.index);if(ae===-1)return-1;W=ae+1;continue}if(v[W+1]==="/"){let Q=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(W,W+64));if(!Q){W++;continue}if(Q[1].toLowerCase()===T){if(z--,W+=Q[0].length,z===0)return W;continue}W+=Q[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(W,W+64));if(!H){W++;continue}let q=v.indexOf(">",W);if(q===-1)return-1;if(H[1].toLowerCase()===T){let Q=v.slice(W,q+1);if(!(/\/\s*>$/.test(Q)||Ua.has(T)))z++}W=q+1}return-1}var hS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function yS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let z=v.indexOf("-->",k+4);if(z===-1)return!1;k=z+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let B=v.slice(k,T+1);return hS.test(B)}function ki(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,R;while((R=k.exec(v))!==null)_.push([R.index,R.index+R[0].length]);let T=(q)=>_.some(([Q,ie])=>q>=Q&&q<ie),B=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,z=[],W;while((W=B.exec(v))!==null){if(T(W.index))continue;let[q,Q,ie,Z,ae,le,ce]=W,de=pS(ae);if(de===void 0)continue;let ue=W.index,$e=ue+q.length,Pe=!!ce||/\/\s*>$/.test(q)||Ua.has(Q.toLowerCase())?$e:ku(v,ue,Q,$e);if(Pe===-1)continue;if((Z===":if"||Z==="x-if"||Z==="@if")&&yS(v,Pe)){B.lastIndex=$e;continue}if(de===!0){let Me=`<${Q}${ie}${le}${ce}>`;z.push({start:ue,end:$e,replacement:Me});continue}z.push({start:ue,end:Pe,replacement:""}),B.lastIndex=Pe}if(z.length===0)return v;z.sort((q,Q)=>q.start-Q.start);let F=[],U=-1;for(let q of z){if(q.start<U)continue;F.push(q),U=q.end}let H=v;for(let q=F.length-1;q>=0;q--){let{start:Q,end:ie,replacement:Z}=F[q];H=H.substring(0,Q)+Z+H.substring(ie)}return H}var Lm=[":for","@for","x-for"];function Ts(v,_){if(!_||Object.keys(_).length===0)return v;if(!Lm.some((W)=>v.includes(`${W}=`)))return v;let k=Wm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let W of _.__stx_client_signal_names)if(typeof W==="string")k.add(W)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[W,F,U]=z,H=z.index,q=H+W.length,Q=Lm.map((ye)=>({attr:ye,m:new RegExp(`\\s${ye}="([^"]*)"`).exec(U)})).find((ye)=>ye.m!==null);if(!Q||!Q.m)continue;let ie=_s(Q.m[1]);if(!ie.iterable||!ie.itemVar)continue;let Z=ie.iterable.trim().split(/[.[(]/)[0].trim();if(!Z||k.has(Z)||!(Z in _))continue;let ae=ku(R,H,F,q);if(ae===-1)continue;let le=U.replace(new RegExp(`\\s${Q.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ce=R.slice(q,ae-`</${F}>`.length),de={..._,[ie.itemVar]:void 0};if(ie.indexVar)de[ie.indexVar]=void 0;let ue=Ts(ce,de),$e=ie.indexVar?`${ie.iterable} as ${ie.indexVar} => ${ie.itemVar}`:`${ie.iterable} as ${ie.itemVar}`,we=F.toLowerCase()==="template"?ue:`<${F}${le}>${ue}</${F}>`;T.push({start:H,end:ae,replacement:`@foreach(${$e})${we}@endforeach`}),B.lastIndex=ae}for(let W=T.length-1;W>=0;W--){let{start:F,end:U,replacement:H}=T[W];R=R.slice(0,F)+H+R.slice(U)}return R}function $s(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let W=T[1],F=T.index,U=F+T[0].length,H=1,q=U;while(q<k.length&&H>0){if(k[q]==="(")H++;else if(k[q]===")")H--;q++}if(H!==0)continue;let Q=k.substring(U,q-1).trim(),ie=q,Z=_s(Q),ae=W==="for"?"@endfor":"@endforeach",le=1,ce=ie,de=W==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${W}\\s*\\(|end${W})`,"g");de.lastIndex=ie;let ue;while((ue=de.exec(k))!==null)if(ue[1].startsWith(W))le++;else if(le--,le===0){ce=ue.index+ue[0].length;break}if(le!==0)continue;let $e=()=>{let Ne=[Z.itemVar,Z.indexVar].filter(Boolean);if(Ne.length)z.push({start:F,end:ce,vars:Ne})};if(Z.iterable){let Ne=Z.iterable.trim();if(Ne.startsWith("[")||Ne.startsWith("{")||Ne.startsWith("'")||Ne.startsWith('"')||Ne.startsWith("`")||/^-?\d/.test(Ne)){$e();continue}let Le=Ne.split(/[.[(]/)[0].trim(),De=_?Le in _:!1,ze=z.some((Ve)=>F>Ve.start&&F<Ve.end&&Ve.vars.includes(Le));if(Le&&(De||ze)){$e();continue}}if(Z.style==="as")Q=Z.indexVar?`(${Z.itemVar}, ${Z.indexVar}) in ${Z.iterable}`:`${Z.itemVar} in ${Z.iterable}`;let we=k.substring(ie,ce-ae.length).trim(),ye=_?{..._}:{};if(Z.itemVar)delete ye[Z.itemVar];if(Z.indexVar)delete ye[Z.indexVar];let Pe=$s(we,ye),Oe=Pe.match(zm),Me;if(Oe){let[,Ne,Le,De]=Oe;Me=`<${Ne}${Le} @for="${Q}">${De}</${Ne}>`}else Me=`<template @for="${Q}">${Pe}</template>`;B.push({start:F,end:ce,replacement:Me}),R.lastIndex=ce}for(let W=B.length-1;W>=0;W--){let{start:F,end:U,replacement:H}=B[W];k=k.substring(0,F)+H+k.substring(U)}return k}function xS(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(H)=>{let q=R+1;while(q<B){let Q=v[q];if(Q==="\\"){q+=2;continue}if(Q===H)return q+1;q++}return B},W=()=>{let H=R+2;while(H<B&&v[H]!==`
2567
+ `)H++;return H},F=()=>{let H=R+2;while(H<B-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return B},U=(H)=>{let q=H,Q=0;while(q<B){let ie=v[q];if(ie==="/"&&v[q+1]==="/"){let Z=q+2;while(Z<B&&v[Z]!==`
2568
+ `)Z++;q=Z;continue}if(ie==="/"&&v[q+1]==="*"){let Z=q+2;while(Z<B-1&&!(v[Z]==="*"&&v[Z+1]==="/"))Z++;q=Z+2;continue}if(ie==='"'||ie==="'"||ie==="`"){let Z=q+1;while(Z<B){if(v[Z]==="\\"){Z+=2;continue}if(v[Z]===ie){Z++;break}Z++}q=Z;continue}if(ie==="("||ie==="["||ie==="{"){Q++,q++;continue}if(ie===")"||ie==="]"||ie==="}"){Q--,q++;continue}if(ie===";"&&Q===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let ie=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ie){let Z=ie[2],ae=U(R+ie[0].length);if(_.has(Z)){k.push(`/* stx: deduped const ${Z} */`),R=ae;continue}_.add(Z),k.push(v.slice(R,ae)),R=ae;continue}}}k.push(H),R++}return k.join("")}var bS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function _u(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function vS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!_u(T,T+_.length,k))return!0;R=T+_.length}return!1}function wS(v,_){if(vS(v,"<body",_)){let T=new RegExp(`<body(${$u})>`,"g"),B;while((B=T.exec(v))!==null)if(!_u(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${$u})>`,"gi"),R;while((R=k.exec(v))!==null){if(_u(R.index,R.index+R[0].length,_))continue;if(bS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function SS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,W=!1,F=(U)=>{if(k!==null&&!W&&k>=z&&k<=U)T.push(v.slice(z,k),B,v.slice(k,U)),W=!0;else T.push(v.slice(z,U))};for(let U of _){if(U.start<z)continue;F(U.start),z=U.end}return F(v.length),T.join("")}async function cr(v,_,k,R={}){let T=Oc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,z=[],{hasUserImports:W,bundleClientScript:F}=await _t("stx/client-script-bundler",()=>import("./chunk-8x2ejkcc.js"));for(let ue of T){let $e=ue.body;if(Qe(ue.attrs))$e=et($e);if(R.forceClientSetup||B.test($e)){z.push({content:$e,start:ue.start,end:ue.end});continue}if(!W($e))continue;try{let we=await F(Pt($e).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(we))z.push({content:$e,start:ue.start,end:ue.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let U=`${_??""}\x00${z.map((ue)=>ue.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(U).toString(36).slice(0,10)}`,q=[];for(let ue=0;ue<z.length;ue++){let $e=z[ue].bundled??Pt(z[ue].content).code;if(!z[ue].bundled&&W($e))$e=await F($e,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});$e=Ze($e);let we=O($e);q.push(`// \u2500\u2500 merged signal script #${ue+1} \u2500\u2500
2569
+ ${we}`)}let Q=q.join(`
2570
+
2571
+ `);Q=xS(Q);let ie=Dc(Q),Z=ie.split(",").map((ue)=>ue.trim()).filter(Boolean),ae=hn(Q,k),le=`
2572
+ <script data-stx-scoped>
2573
+ function ${H}() {
2574
+ ${Vt("const",Z)}
2575
+ ${oi(`${ae}${Q}`)}
2576
+ return { ${ie} };
2577
+ }
2578
+ window.__stx_latestSetup=${H};
2579
+ if(window.stx)window.stx._latestSetup=${H};
2580
+ </script>`,ce=wS(v,z);return{output:SS(v,z,ce,H),setupCode:le}}function Dc(v){let _=s(v),k=[],R=new Set,T=0,B=0,z=_.length,W=()=>{if(T!==0)return;let F=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(F){let ie=F[2];if(!R.has(ie))k.push(ie),R.add(ie);return}let U=_.slice(B).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((ie)=>{let Z=ie.trim();if(!Z)return;let ae=Z.indexOf(":"),ce=(ae>=0?Z.slice(ae+1).trim():Z).split(/[\s=]/)[0];if(ce&&!R.has(ce))k.push(ce),R.add(ce)});return}let H=_.slice(B).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((ie)=>{let Z=ie.trim().replace(/^\.\.\./,"");if(!Z)return;let ae=Z.split(/[\s=]/)[0];if(ae&&!R.has(ae))k.push(ae),R.add(ae)});return}let q=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let ie=q[1];if(!R.has(ie))k.push(ie),R.add(ie);return}let Q=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let ie=Q[1];if(!R.has(ie))k.push(ie),R.add(ie)}};while(B<z){if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))W();B++}return k.join(", ")}async function Ci(v,_,k,R){if(!Es(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:B,setupCode:z}=await cr(T,k,R);if(T=B,!z){let W=Kn(T);if(W&&!/data-stx/.test(W.attrs)&&!/data-stx-auto/.test(W.attrs)){let F=W.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,W.index)+F+T.slice(W.index+W.tag.length)}}if(T=await Wa(T,_),z){let W=_i(T,/<\/head>/i),F=W===-1?_i(T,/<body[^>]*>/i):-1;if(W!==-1)T=`${T.slice(0,W)}${z}
2581
+ ${T.slice(W)}`;else if(F!==-1){let U=/<body[^>]*>/i.exec(T.slice(F))[0],H=F+U.length;T=`${T.slice(0,H)}
2582
+ ${z}${T.slice(H)}`}else T=`${T}
2583
+ ${z}`}return T}function _i(v,_){let k=/<(script|style)\b[\s\S]*?<\/\1>/gi,R=[],T;while((T=k.exec(v))!==null)R.push([T.index,T.index+T[0].length]);let B=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),z=0;while(z<v.length){let W=B.exec(v.slice(z));if(!W)return-1;let F=z+W.index;if(!R.some(([H,q])=>F>=H&&F<q))return F;z=F+Math.max(W[0].length,1)}return-1}var Bm="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Nc(v){let _=[];for(let k of v.split(",")){let R=k.trim();if(!R||R.startsWith("type "))continue;let T=R.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T&&T[1]!==T[2])_.push(`${T[2]} = ${T[1]}`)}if(_.length===0)return Bm;return`var ${_.join(", ")}; ${Bm}`}var $S=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function Ze(v){return v.replace($S,(_,k)=>Nc(k))}import Ni from"path";import _S from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[R,T]of Object.entries(_S.env)){if(!R.startsWith(v)||T===void 0)continue;_[`import.meta.env.${R}`]=JSON.stringify(T),k[R]=T}return _["import.meta.env"]=JSON.stringify(k),_}function Fm(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function Vm(v,_,k){try{let R;if(v.startsWith("/")){let T=_;for(let B=0;B<5;B++){let z=Ni.join(T,v);if(await Bun.file(z).exists())return z;T=Ni.dirname(T)}R=Ni.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))R=Ni.resolve(_,v);else R=Ni.resolve(_,v);if(await Bun.file(R).exists())return R;return null}catch{return null}}var Um=Symbol.for("stx.inline-assets.import-meta");function kS(v,_){if(!v.includes("import.meta"))return;let k=Error(`[stx] ${_} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
2584
+ `+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw k[Um]=!0,k}async function Hm(v,_,k){let R=v,T=Ni.dirname(_),B=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,z;while((z=B.exec(R))!==null){let[U,H,q,Q]=z;if(Fm(q))continue;let ie=await Vm(q,T,_);if(ie)try{let Z=await Bun.file(ie).text();if(k.add(ie),q.endsWith(".ts")||q.endsWith(".tsx")){let le=await Bun.build({entrypoints:[ie],target:"browser",minify:!0,define:w()});if(le.outputs.length>0)Z=await le.outputs[0].text(),kS(Z,q)}let ae=`<script>
2585
+ // Source: ${q}
2586
+ ${Z}
2587
+ </script>`;R=R.replace(U,ae),B.lastIndex=0}catch(Z){if(Z?.[Um])throw Z}}let W=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,F;while((F=W.exec(R))!==null){let[U,H,q,Q]=F,ie=H+Q;if(Fm(q))continue;if(/rel=["']stylesheet["']/.test(ie)||q.endsWith(".css")){let ae=await Vm(q,T,_);if(ae)try{let le=await Bun.file(ae).text();k.add(ae);let ce=`<style>
2588
+ /* Source: ${q} */
2589
+ ${le}
2590
+ </style>`;R=R.replace(U,ce),W.lastIndex=0}catch(le){}}}return R}function Ns(v,_){let k=v,R=/@json\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index,z=B+T[0].length-1,W=1,F=z+1,U=null,H=!1;while(F<k.length&&W>0){let ue=k[F];if(H){H=!1,F++;continue}if(ue==="\\"&&U){H=!0,F++;continue}if(U){if(ue===U)U=null;F++;continue}if(ue==='"'||ue==="'"||ue==="`"){U=ue,F++;continue}if(ue==="(")W++;else if(ue===")"){if(W--,W===0)break}F++}if(W!==0)break;let q=k.substring(z+1,F).trim(),Q=k.substring(B,F+1),ie=-1,Z=0,ae=null,le=!1;for(let ue=0;ue<q.length;ue++){let $e=q[ue];if(le){le=!1;continue}if($e==="\\"&&ae){le=!0;continue}if(ae){if($e===ae)ae=null;continue}if($e==='"'||$e==="'"||$e==="`"){ae=$e;continue}if($e==="("||$e==="["||$e==="{")Z++;else if($e===")"||$e==="]"||$e==="}")Z--;if($e===","&&Z===0){ie=ue;break}}let ce=ie>=0?q.substring(0,ie).trim():q,de=ie>=0?q.substring(ie+1).trim():void 0;try{let ue=ce.trim(),$e;if(p(ue))$e=c(ue,Object.keys(_))(...Object.values(_));else $e=void 0;let we;if(de==="true")we=JSON.stringify($e,null,2);else we=JSON.stringify($e);let ye=we.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,B)+ye+k.substring(F+1),R.lastIndex=B+ye.length}catch(ue){I.log(ue instanceof Error?ue:Error(String(ue)),{directive:"@json"},"error"),R.lastIndex=B+Q.length}}return k}function Ms(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Zm(v){let _=v,k=/@memo\s*\(/g,R,T=[];while((R=k.exec(_))!==null){let B=R.index,z=B+R[0].length,W=1,F=z;while(F<_.length&&W>0){if(_[F]==="(")W++;else if(_[F]===")")W--;F++}if(W!==0)continue;let U=_.slice(z,F-1).trim(),H=F,q=_.slice(H),Q=q.indexOf("@endmemo");if(Q===-1)continue;let ie=q.slice(0,Q),Z=H+Q+8,ae=ie.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),le=ae?ae[0].length:0,ce=ie.slice(le),de=ie.match(/(\s*)$/),ue=de?de[0].length:0,$e=ce.slice(0,ce.length-ue),we=$e.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ye;if(we){let[Pe,Oe,Me="",Ne]=we,Le=`<${Oe}${Me} data-stx-memo="${U}"${Ne}>`;ye=ie.slice(0,le)+Le+$e.slice(Pe.length)+ie.slice(le+$e.length)}else ye=`${ie.slice(0,le)}<div data-stx-memo="${U}">${$e}</div>${ie.slice(le+$e.length)}`;T.push({start:B,end:Z,replacement:ye}),k.lastIndex=Z}for(let B=T.length-1;B>=0;B--){let z=T[B];_=_.slice(0,z.start)+z.replacement+_.slice(z.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Eu(v){let _=v.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return _=_.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),_}function Gm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,R=ee(v,(F,U)=>{k.lastIndex=U;let H=k.exec(F);if(!H||/^(?:script|style)$/i.test(H[1]))return-1;return k.lastIndex}),T=[],B=0,z=0,W=[];for(let{start:F,end:U,token:H}of R){let q=/^<\/?([\w-]+)/.exec(H)[1].toLowerCase();if(H.startsWith("</")){let ie;while(ie=T.pop()){if(ie.scoped)B--;if(ie.name===q)break}continue}let Q=/\sdata-stx-scope\s*=/.test(H);if(!B&&!Q&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(H)&&!/\sdata-stx-ref-caller\s*=/.test(H))W.push(v.slice(z,F),H.replace(/\s*\/?>$/,(ie)=>` data-stx-ref-caller="${_}"${ie}`)),z=U;if(!Jm.has(q)&&!/\/>$/.test(H)){if(T.push({name:q,scoped:Q}),Q)B++}}return W.push(v.slice(z)),W.join("")}var Jm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ym=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,qm=/<\/?\s*([a-z][\w-]*)/iy,ES=/\s/;function CS(v,_){let k=_-1;while(k>=0&&ES.test(v[k]))k--;return k>=0&&v[k]==="/"}function RS(v,_){let k=!1,R=!1;for(let T=_;T<v.length;T++){let B=v[T];if(k){if(B==="'")k=!1}else if(R){if(B==='"')R=!1}else if(B==="'")k=!0;else if(B==='"')R=!0;else if(B===">")return T}return-1}function AS(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,R=_,T=!1,B=!1,z=!1;while(R<v.length){let W=v.indexOf("<",R),F=W===-1?v.length:W;if(F>R){if(k===0)while(R<F){let q=v.indexOf(B?"}":"{",R);if(q===-1||q>=F){if(B)z=!1;else T=!1;break}if(q>R)if(B)z=!1;else T=!1;if(B){if(z)return!0;z=!0}else if(T)B=!0,z=!1;else T=!0;R=q+1}R=F;continue}if(v.startsWith("<!--",R)){let q=v.indexOf("-->",R);R=q===-1?v.length:q+3;continue}let U=RS(v,R);if(U===-1)break;qm.lastIndex=R;let H=qm.exec(v)?.[1]?.toLowerCase()??"";if(v[R+1]==="/"){if(k===0)break;k--}else if(!CS(v,U)&&!Jm.has(H))k++;R=U+1}return!1}var Km=m(256);function Qm(v){if(v.length<1024)return Xm(v);let _=h(v),k=Km.get(_);if(k!==void 0)return k;let R=Xm(v);return Km.set(_,R),R}function Xm(v){if(v.length>=32768&&!jd(v))return v;let k=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index,W=z+B[0].length,F=!1,U=!1,H=-1;while(W<v.length){let Q=v[W];if(F){if(Q==="'")F=!1}else if(U){if(Q==='"')U=!1}else if(Q==="'")F=!0;else if(Q==='"')U=!0;else if(Q===">"){H=W;break}W++}if(H===-1)continue;let q=v.slice(z,H+1);if(Ym.test(q))continue;if(q.includes("x-cloak"))continue;if(AS(v,H+1))R+=v.slice(T,H)+" x-cloak>",T=H+1}return R+=v.slice(T),R}var TS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,IS=/<\/script>/gi,PS=/<\/style>/gi;function eh(v){let _=/<[a-z][\w-]*/gi,k="",R=0,T;while((T=_.exec(v))!==null){let B=T.index,z=T[0].slice(1).toLowerCase();if(z==="script"||z==="style"){let Z=z==="script"?IS:PS;Z.lastIndex=B;let ae=Z.exec(v);if(ae!==null)_.lastIndex=ae.index+ae[0].length;continue}let W=B+T[0].length,F=!1,U=!1,H=-1;while(W<v.length){let Z=v[W];if(F){if(Z==="'")F=!1}else if(U){if(Z==='"')U=!1}else if(Z==="'")F=!0;else if(Z==='"')U=!0;else if(Z===">"){H=W;break}W++}if(H===-1)continue;let q=v.slice(B+T[0].length,H);if(Ym.test(q))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(q))continue;if(!TS.test(q))continue;let Q=v[H-1]==="/",ie=Q?H-1:H;k+=`${v.slice(R,ie)} x-cloak${Q?" ":""}`,R=ie}return k+=v.slice(R),k}var Cu=m(256),DS=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],th=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function OS(v){let _=Array.from(v,(T)=>T===`
2591
+ `?`
2592
+ `:" "),k=0,R="";while(k<v.length){let T=v[k],B=v[k+1];if(R){if(T==="\\"){k+=2;continue}if(T===R)R="";k++;continue}if(T==='"'||T==="'"||T==="`"){R=T,k++;continue}if(T==="/"&&B==="/"){while(k<v.length&&v[k]!==`
2593
+ `)_[k]=v[k],k++;continue}if(T==="/"&&B==="*"){let z=v.indexOf("*/",k+2),W=z===-1?v.length:z+2;for(;k<W;k++)_[k]=v[k];continue}if(T==="{"&&B==="{"&&v.slice(k,k+4)==="{{--"){let z=v.indexOf("--}}",k+4),W=z===-1?v.length:z+4;for(;k<W;k++)_[k]=v[k];continue}k++}return _.join("")}function MS(v){let _=new Map,k=OS(v).split(`
2594
+ `),R=v.split(`
2595
+ `);return k.forEach((T,B)=>{th.lastIndex=0;for(let z of T.matchAll(th)){let W=z[1]==="-next-line",F=(R[B]??"").slice(0,z.index).trim(),U=W||F===""?B+2:B+1,q=(z[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),Q=q.filter((Z)=>/\w/.test(Z));if(q.length>0&&Q.length===0)continue;let ie=_.get(U);if(ie&&ie.size===0)continue;if(Q.length===0){_.set(U,new Set);continue}if(ie)Q.forEach((Z)=>ie.add(Z));else _.set(U,new Set(Q))}}),_}function NS(v,_,k){let R=v.get(_);if(!R)return!1;if(R.size===0)return!0;return[...R].some((T)=>k.includes(T))}function Ls(v,_,k,R){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let B=h(v,_,R,JSON.stringify(T)),z=Cu.get(B);if(z!==void 0){if(z&&T.failOnViolation)throw Error(z);return}let W=T.allowPatterns??[],F=MS(v),U=[],H=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(Z)=>Z.replace(/[^\n]/g," ")));for(let{pattern:Z,message:ae,suggestion:le}of DS){if(W.some((de)=>/\w/.test(de)&&ae.includes(de)))continue;Z.lastIndex=0;let ce=H.match(Z);if(ce&&ce.length>0){let de=H.split(`
2596
+ `),ue=v.split(`
2597
+ `),$e=[];if(de.forEach((Oe,Me)=>{if(Z.lastIndex=0,Z.test(Oe)&&!NS(F,Me+1,ae))$e.push(Me+1)}),$e.length===0&&de.some((Oe)=>(Z.lastIndex=0,Z.test(Oe))))continue;let we=$e.length>0?` (script line${$e.length>1?"s":""} ${$e.join(", ")})`:"",ye=$e.slice(0,3).map((Oe)=>` ${Oe} | ${(ue[Oe-1]??"").trim().slice(0,100)}`).join(`
2598
+ `),Pe=ye?`
2599
+ ${ye}`:"";U.push(` \u2717 ${ae}${we}
2600
+ \u2192 ${le}${Pe}`)}}if(U.length===0){Cu.set(B,"");return}let q=(Z)=>{let ae=`${process.cwd()}/`;return Z.startsWith(ae)?Z.slice(ae.length):Z},ie=`[STX] DOM API violation in ${R&&R!==_?`${q(R)} (composed into ${q(_)})`:q(_)}:
2601
+ ${U.join(`
2602
+ `)}
2603
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Cu.set(B,ie),T.failOnViolation)throw Error(ie);else console.warn(ie)}import Ru from"path";var jS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,LS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function BS(v,_){if(!_||!v.includes("/"))return v;let k=Ru.dirname(_);return v.replace(jS,(R,T,B,z)=>{let W=Ru.resolve(k,z);return`${T}${B}${W.split(Ru.sep).join("/")}${B}`})}function nh(v,_){if(!_||!v.includes("<script"))return v;return v.replace(LS,(k,R,T,B)=>`${R}${BS(T,_)}${B}`)}var Jr="<!--PARENT_CONTENT_PLACEHOLDER-->";function rh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function uh(v,_){let k=v.length,R=_,T=!0,B=[],z=(W)=>W+9<=k&&v[W]==="<"&&v[W+1]==="/"&&(v[W+2]==="s"||v[W+2]==="S")&&(v[W+3]==="c"||v[W+3]==="C")&&(v[W+4]==="r"||v[W+4]==="R")&&(v[W+5]==="i"||v[W+5]==="I")&&(v[W+6]==="p"||v[W+6]==="P")&&(v[W+7]==="t"||v[W+7]==="T")&&(v[W+8]===">"||/\s/.test(v[W+8]));while(R<k){let W=v[R];if(z(R))return R;if(W==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
2604
+ `,R+2),R===-1)return-1;R+=1,T=!0;continue}if(W==="/"&&v[R+1]==="*"){let F=v.indexOf("*/",R+2);if(F===-1)return-1;R=F+2,T=!0;continue}if(W==="/"&&T){let F=R+1,U=!1;while(F<k){let H=v[F];if(H==="\\"){F+=2;continue}if(H==="[")U=!0;else if(H==="]")U=!1;else if(H==="/"&&!U){F++;break}else if(H===`
2605
+ `){F=-1;break}F++}if(F===-1){R++,T=!1;continue}while(F<k&&/[a-z]/.test(v[F]))F++;R=F,T=!1;continue}if(W==="'"||W==='"'){let F=W;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===F){R++;break}if(v[R]===`
2606
+ `)break;R++}T=!1;continue}if(W==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(W==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))T=!1;else T=!0;R++}return-1}function dh(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var WS=4096;async function sh(v,_,k){if(k.buildMode!=="serve"||_.length<WS)return null;let{registerServeModuleBundle:R}=await import("./chunk-93na8hh0.js");return`<script ${v} src="${R(_)}"></script>`}async function ih(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await _t("stx/client-module-registry",()=>import("./chunk-5taenpfg.js")),B=[],z=await T(R(...v),{minify:Qs(_.buildMode),collectInputs:B});for(let W of B)k?.add(W);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:W}=await import("./chunk-93na8hh0.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${W(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function FS(v,_=""){let k=dh(v,"data-stx-runtime");if(!k)return v;let R=co(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
2607
+ `+v.slice(R,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),B=v.slice(0,k.start)+v.slice(k.end),z=co(B);if(z===-1)return T+_+`
2608
+ `+B;return B.slice(0,z)+T+_+`
2609
+ `+B.slice(z)}function VS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=ke(v,k);let B=!_.__stxProcessingDepth;kn(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await En(_,k,R.runtimeConfig);if(B)_d(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ks(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Nn())&&k&&k.endsWith(".stx"))oo(v,k);try{return await G.timeAsync("template-processing",async()=>{let z=await US(v,_,k,R,T);if(B)z=Eu(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let W=be(R.app?.head,{known:In,source:"app.head"}),U=(_.__stx_runtime_head||null)??Js(),H=(_.__stx_head_raw||"").trim(),q,Q=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Q)q=Q[1].trim(),H=H.replace(Q[0],"").trim();let ie=_.__sections?.title,Z=U.title||q||ie,ae=!U.title&&(!!q||!!ie),le=U.meta||[],ce=new Set(le.map((Pe)=>Re(Pe)).filter(Boolean)),de={...W,...Z&&{title:Z},meta:[...(W.meta||[]).filter((Pe)=>!ce.has(Re(Pe))),...le],link:[...W.link||[],...U.link||[]],script:[...W.script||[],...U.script||[]],headRaw:[W.headRaw,H].filter(Boolean).join(`
2610
+ `),...U.htmlAttrs&&{htmlAttrs:Wi(W.htmlAttrs,U.htmlAttrs)},...U.bodyAttrs&&{bodyAttrs:{...W.bodyAttrs||{},...U.bodyAttrs}}},ue=Xs(z);if(z=An(z,de,{...ae&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},ue),ue)z=Gi(z,W),z=Rn(z,de.htmlAttrs);let $e=z.match(/<!-- stx-layout: ([^ ]+) -->/);if($e&&z.includes("<head")){let Pe=$e[1],Oe=Rr(Pe);z=z.replace(/<head\b[^>]*>/i,(Me)=>`${Me}
2611
+ <meta name="stx-layout" content="${rh(Pe)}">
2612
+ <meta name="stx-layout-group" content="${rh(Oe)}">`)}let we=z.match(/function (__stx_setup_\w+)\(/),ye=we?Kn(z):null;if(we&&ye&&!/\bdata-stx=/.test(ye.tag)){z=ls(z,(Oe,Me)=>`<body${Me} data-stx="${we[1]}">`);let Pe=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${we[1]}"`,"i");z=z.replace(Pe,"$1")}}if(B){let W=_.__stx_head_injections??Ks(),F=qi(z);if(F!==null)W.beforeClose.push(F);let U=Sm(z);if(U!==null)W.afterOpen.push(U);if(R.offline?.enabled&&!z.includes("data-stx-offline"))W.beforeClose.push($m);z=Vi(z,W);let H=R.app?.colorMode;if(H)z=$n(z,H)}if(B)if(dh(z,"data-stx-runtime")){let F=null,U=null,H=null,q=null,Q=null;try{let{getStoreScript:Z}=await _t("stx/store-loader",()=>import("./chunk-1e28n9q2.js")),ae=R.storesDir,le=await Z(ae);if(le)H=`<script data-stx-stores>${le}</script>`,U=await sh("data-stx-stores",le,R)??H}catch{}F=await ih([z,H],R,T);try{let{getFrameworkComposableScript:Z}=await _t("stx/framework-composables",()=>import("./chunk-tyb481p0.js"));Q=await Z(z)}catch{}try{let{getComposableScript:Z}=await _t("stx/composable-loader",()=>import("./chunk-kgvm5ytn.js")),ae=R.composablesDir,le=[F,H,Q].filter((de)=>de!==null),ce=await Z(R._layerComposableDirs??ae,z,le);if(ce)q=await sh('data-stx-scoped data-stx-run="always" data-stx-composables',ce,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ce}</script>`}catch{}let ie=[F,U,q,Q].filter((Z)=>Z!==null).map((Z)=>`
2613
+ ${Z}`).join("");z=FS(z,ie)}else{let F=await ih([z],R,T);if(F){let U=z.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(U!==-1)z=z.slice(0,U)+F+`
2614
+ `+z.slice(U)}}if(B)z=Ui(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=so(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=VS(z),B&&_.__stx_runtime_config)z=rt(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let W=lr(_);if(W){let F=/<head\b[^>]*>/i.exec(z),U=F?F.index+F[0].length:0;z=z.slice(0,U)+W+z.slice(U)}}return z})}catch(z){if(z instanceof Sr)throw z;let W=z instanceof Error?z.message:String(z),F=new Y(`Template processing failed: ${W}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(I.log(F,{filePath:k,context:_}),zt.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),R.debug)throw F;return Ys.createFallbackContent("Template Processing",F)}}async function US(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!ln.isAbsolute(R.partialsDir)?ln.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!ln.isAbsolute(R.componentsDir)?ln.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!ln.isAbsolute(R.layoutsDir)?ln.resolve(B,R.layoutsDir):R.layoutsDir},W=z,F=v;await KS(k,_),qS(_,W),F=await oe(()=>fm(F,_,k,W),F,(we)=>{I.log(we,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${we.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Vn(F,qe,(we,ye)=>`\x00STX_HTML_COMMENT_${ye}\x00`);F=U.output;let H=U.tokens,q=(we)=>H.length===0?we:we.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(ye,Pe)=>H[Number(Pe)]??""),Q="\x00STX_ESCAPED_AT\x00",ie="\x00STX_ESC_MUSTACHE_OPEN\x00",Z="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,Q),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(we,ye)=>`${ie}${ye}${Z}`),F=ym(F),F=await Hm(F,k,T);let ae={};F=Is(F,ae);let le={..._.__sections||{}},ce="",de=Qf(Ke(v)),ue=/@nolayout\b/.test(F)||de===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let $e=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e)ce=$e[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof de==="string"){if(ce=de,!/@section\s*\(/.test(F))F=`@section('content')
2615
+ ${F.trim()}
2616
+ @endsection`}if(!ce&&!ue&&W.defaultLayout){let we=Ft(F),ye=/@section\s*\(/.test(F);if(!we||ye){let Pe="",Oe=ln.dirname(k),Me=W.layoutsDir?ln.dirname(W.layoutsDir):process.cwd();for(let Ne=0;Ne<20;Ne++){let Le=ln.join(Oe,"_layout.stx");if(await r(Le)){Pe=Le;break}let De=ln.dirname(Oe);if(De===Oe||De.length<Me.length)break;Oe=De}if(Pe)ce=Pe;else if(W.layoutsDir){let Ne=ln.isAbsolute(W.layoutsDir)?W.layoutsDir:ln.resolve(process.cwd(),W.layoutsDir),Le=ln.join(Ne,`${W.defaultLayout}.stx`);if(await r(Le))ce=Le}if(ce&&!ye)F=`@section('content')
2617
+ ${F.trim()}
2618
+ @endsection`}}if(ce&&F.includes("<script")){let we=gn(F),ye=we.scripts.map((Pe)=>oh(Pe,k)??Pe);F=os(we.output,ye)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(we,ye,Pe)=>(le[ye]=Pe,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(we,ye,Pe)=>{if(/^(['"]).*\1$/.test(Pe.trim()))return we;try{let Oe=l(Pe.trim(),_);if(Oe===void 0)return we;return le[ye]=String(Oe??""),""}catch{return we}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(we,ye,Pe)=>{if(Pe.includes("@parent"))le[ye]=Pe.replace("@parent",Jr);else le[ye]=Pe.trim();return""}),_.__sections=le,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(we,ye,Pe)=>le[ye]||Pe||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>le.content||"");if(F=Os(F,ae),ce){let we=[],ye=gn(F),Pe=Vn(ye.output,is,(Oe,Me)=>`\x00STX_ORPHAN_STYLE_${Me}\x00`);if(F=Pe.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Oe,Me,Ne)=>{let Le=Me==="SCRIPT"?oh(ye.scripts[Number(Ne)],k):Pe.tokens[Number(Ne)];if(Le)we.push(Le);return""}),we.length>0){let Oe=we.join(`
2619
+ `);le.content=le.content?`${le.content}
2620
+ ${Oe}`:Oe,_.__sections=le}}if(ce)try{let we;if(ln.isAbsolute(ce))we=ce,T.add(ce);else we=await oe(()=>dr(ce,k,z,T),null,()=>{throw new Y(`Failed to resolve layout path: ${ce}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!we){let Le=(Ve)=>{if(!Ve)return[];try{let Be=ln.isAbsolute(Ve)?Ve:ln.resolve(process.cwd(),Ve);return zS.readdirSync(Be).filter((je)=>je.endsWith(".stx")).map((je)=>je.replace(/\.stx$/,""))}catch{return[]}},De=[...Le(z.layoutsDir),...Le(z.fallbackLayoutsDir)].filter((Ve,Be,je)=>je.indexOf(Ve)===Be).sort(),ze=`Layout not found: ${ce} (referenced from ${k})`+(De.length>0?`. Available layouts: ${De.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(I.log(Error(ze),{layoutPath:ce,filePath:k,available:De},"error"),console.error(`[stx] ${ze}`),z.debug)throw new Y(ze,k);return F}let ye=await oe(()=>Bun.file(we).text(),"",()=>{throw new Y(`Failed to read layout file: ${we}`,k,void 0,void 0,"Layout content could not be loaded")});ye=nh(ye,we);let Pe=ye.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Pe){if(z.debug)console.log(`Found nested layout: ${Pe[1]} in ${we}`);let Le={},De=ye.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Be,je,st)=>(Le[je]=st.trim(),""));for(let[Be,je]of Object.entries(Le))if(le[Be]&&le[Be].includes(Jr)){let st=le[Be].indexOf(Jr);le[Be]=le[Be].slice(0,st)+je+le[Be].slice(st+Jr.length)}else if(!le[Be])le[Be]=je;let ze={..._,__sections:le},Ve=`@layout('${Pe[1]}')${De}`;return await n(Ve,ze,we,z,T)}let Oe=ye.replace(/\{\{--[\s\S]*?--\}\}/g,""),Me=Is(Oe,ae),Ne={};return Me=Me.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Le,De,ze)=>(Ne[De]=ze.trim(),`@slot('${De}')`)),Me=Me.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Le,De,ze)=>{if(le[De]){let Ve=le[De];if(Ve.includes(Jr)){let Be=Ne[De]||"",je=Ve.indexOf(Jr);Ve=Ve.slice(0,je)+Be+Ve.slice(je+Jr.length)}return Ve}return ze||""}),Me=HS(Me,le),Me=Me.replace(/\{\{\s*slot\s*\}\}/g,()=>le.content||""),Me=Os(Me,ae),_.__originalFilePath=k,F=await lh(Me,_,we,z,T),F=`<!-- stx-layout: ${ce} -->
2621
+ ${F}`,q(F)}catch(we){return I.log(we instanceof Error?we:Error(String(we)),{layoutPath:ce,filePath:k},"error"),`[Error processing layout: ${we instanceof Error?we.message:String(we)}]`}return q(await lh(F,_,k,z,T))}function HS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function qS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function KS(v,_){await oe(()=>mm(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Au="data-stx-source";function oh(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Au))return v;return`<script ${Au}="${encodeURIComponent(_)}"${v.slice(7)}`}function XS(v){let _=new RegExp(`${Au}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function ah(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ch(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${ah(v)}</span><span style="display:block;margin-top:4px">${ah(k)}</span></div>`}async function ZS(v,_,k,R){let{scanScriptTags:T}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js")),B=[],z=!E()&&!Nn();for(let F of T(v)){let U=F.attrs;if(!/\bserver\b/.test(U))continue;let H=F.start+F.fullMatch.indexOf(">")+1,q=uh(v,H);if(q===-1)continue;let Q=v.slice(H,q);if(!Q.trim())continue;let ie=XS(U)??k,Z={index:F.start,length:q+9-F.start};try{let{extractVariables:ae}=await _t("stx/variable-extractor",()=>import("./chunk-915s0may.js"));await ae(Q,_,ie,{preserveExisting:!0,onFailure:(le)=>{if(le.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:ie,kind:le.kind,message:le.message}),!z)return;B.push({...Z,markup:ch(ie,le.kind,le.message)})}})}catch(ae){let le=ae instanceof Error?ae:Error(String(ae));if(I.log(le,{filePath:ie,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ie}: ${le.message}`),z)B.push({...Z,markup:ch(ie,"unknown",le.message)})}}if(B.length===0)return v;let W=v;for(let F of B.sort((U,H)=>H.index-U.index))W=W.slice(0,F.index)+F.markup+W.slice(F.index+F.length);return W}async function GS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await _t("stx/expressions",()=>import("./chunk-3gm6013p.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function lh(v,_,k,R,T){let B=v,z=R;if(B=await ZS(B,_,k,R),B=await GS(B,_,k),B=await em(B,_,k),B=await tm(B,_,k),B=await Lp(B,_,k,z),ke(B))B=Si(B,_),B=$s(B,_),B=Ts(B,_);B=ki(B);let{processStreamDirectives:W}=await _t("stx/streaming",()=>import("./chunk-d0kes50w.js"));B=W(B,_),B=$i(B,_,k,z,!0),B=await wm(B,_,k,z,T),B=await Cs(B,_,k,z,T),B=Yf(B,_,k,z);let{processDeferDirectives:F}=await _t("stx/defer",()=>import("./chunk-rrw2jg26.js"));B=F(B,_,k);let{processTeleportDirectives:U}=await _t("stx/teleport",()=>import("./chunk-2r4an7bh.js"));B=U(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await _t("stx/transitions",()=>import("./chunk-gw2dvp35.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:Q,stripRenderFailedMarkers:ie}=await _t("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=Q(B,_,k),B=ie(B);let{processSuspenseDirectives:Z}=await _t("stx/suspense",()=>import("./chunk-q40ahbjs.js"));B=Z(B,_,k);let{processAsyncDirectives:ae}=await _t("stx/async-components",()=>import("./chunk-3yttgk0s.js"));B=ae(B,_,k);let{processKeepAliveDirectives:le}=await _t("stx/keep-alive",()=>import("./chunk-myqhdz1w.js"));B=le(B,_,k);let{processVirtualListDirectives:ce,processVirtualGridDirectives:de,processInfiniteListDirectives:ue}=await _t("stx/virtual-scrolling",()=>import("./chunk-wm8w2721.js"));B=ce(B,_,k),B=de(B,_,k),B=ue(B,_,k);let{processPartialHydrationDirectives:$e,processStaticDirectives:we}=await _t("stx/partial-hydration",()=>import("./chunk-wjhhb6dn.js"));B=$e(B,_,k),B=we(B);let{processComputedDirectives:ye,processWatchDirectives:Pe}=await _t("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=ye(B,_,k),B=Pe(B,_,k);let{processFormValidationDirectives:Oe}=await _t("stx/forms-validation",()=>import("./chunk-qjxxhdv7.js"));B=Oe(B,_,k);let{processHeadDirective:Me,processTitleDirective:Ne,processMetaDirective:Le,resetHead:De}=await _t("stx/head",()=>import("./chunk-z8mdsjzw.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)De();let ze=Me(B);if(B=ze.content,ze.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${ze.headContent}
2622
+ `;if(B=Ne(B,_),B=Le(B,_,k),B=gm(B),B=Il(B,_),B=jp(B),B=um(B),B=await Ps(B,_,k,z,T),B=await Cs(B,_,k,z,T),_.__stxProcessingDepth===1)B=kd(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=Eu(B),B=br(B,_,k),B=As(B),B=ep(B,_,{filePath:k,buildMode:z.buildMode}),B=Pl(B,_),B=Dl(B,_),B=_a(B,_),B=Hp(B,_),B=qp(B,_),B=await Cp(B,_,k,z),B=await op(B,_,k),B=await Oi(B,_,k,z),B=Di(B,_,k,z),B=Vs(B,_,k,z),B=Us(B,_,k),B=Ws(B,_,k,z),B=Mp(B,_,k,z),B=Ns(B,_),B=Ms(B),B=Zm(B),!z.skipEventDirectives)B=Uu(B,_,k);if(B=rp(B,_,k),z.debug){let bt=/\bx-data\s*=/.test(B),ft=Es(v);if(bt&&ft)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2623
+ Both work on the same page, but they manage separate scopes.
2624
+ Prefer signals (state/derived/effect) for new components.`)}B=kg(B,_),B=await X(B,_,k),B=Qm(B),B=eh(B),B=Vf(B);let{processXElementDirectives:Ve}=await _t("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Ve(B);let Be=_.__originalFilePath||k,je=xe(_);if(B=await Ci(B,z,Be,je),B=Fp(B,_),B=await pm(B,_,k,z),z.media?.image?.autoSiblings){let bt=z.publicDir||"public",{rewriteImagesWithSiblings:ft}=await _t("stx/image-optimization/auto-sibling",()=>import("./chunk-36n8yz6t.js"));B=await ft(B,{publicDir:bt})}if(z.seo?.enabled)B=qs(B,_,z);let st=(bt,ft,$t=!0)=>{if(!ft)return bt;let Wt=ft.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Gt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(bt),Yt=Gt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Gt[0]):null;if(Wt&&Gt&&Yt){if($t){let un=Gt.index+Yt.index;bt=bt.slice(0,un)+Wt[0]+bt.slice(un+Yt[0].length)}if(ft=ft.replace(Wt[0],"").trim(),!ft)return bt}if(/<\/head>/i.test(bt))return bt.replace(/<\/head>/i,`${ft}
2625
+ </head>`);if(/<head\b[^>]*>/i.test(bt))return bt.replace(/(<head\b[^>]*>)/i,`$1
2626
+ ${ft}`);if(/<html\b[^>]*>/i.test(bt))return bt.replace(/(<html\b[^>]*>)/i,`$1
2627
+ <head>
2628
+ ${ft}
2629
+ </head>`);return bt},{renderHead:ht,getHead:yt}=await _t("stx/head",()=>import("./chunk-z8mdsjzw.js")),dt=_.__stx_runtime_head??yt();if(dt.title||dt.meta?.length||dt.link?.length){let bt=ht(dt);if(bt)B=st(B,bt)}if(ze.headContent)B=st(B,ze.headContent,!dt.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=Dp(B,z.csp,_);if(z.analytics?.enabled)B=Uf(B,z);if(z.heatmap?.enabled)B=qf(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:bt}=await _t("stx/pwa/inject",()=>import("./chunk-b4tbqz8r.js"));B=bt(B,z)}let wt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),kt=/\bSTX\.\w+/.test(B),xt=/window\.STX\s*=/.test(B);if(wt&&kt&&!xt){let ft=`<script data-stx-scoped data-stx-run="once">
2630
+ ${zf()}
2631
+ </script>`;if(B.includes("</head>")){let $t=B.indexOf("</head>"),Gt=B.slice(0,$t).indexOf("<script");if(Gt!==-1){let Yt=B.slice(0,Gt),un=B.slice(Gt);B=Yt+ft+`
2632
+ `+un}else B=B.replace("</head>",`${ft}
2633
+ </head>`)}else if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1>
2634
+ ${ft}`);else B=ft+`
2635
+ `+B}{let{scanScriptTags:bt}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js")),ft=[];for(let $t of bt(B)){if(!/\bserver\b/i.test($t.attrs))continue;let Wt=$t.start+$t.fullMatch.indexOf(">")+1,Gt=uh(B,Wt);if(Gt===-1)continue;let Yt=Gt+9;while(Yt<B.length&&/\s/.test(B[Yt]))Yt++;ft.push({start:$t.start,end:Yt})}if(ft.length>0){let $t=Array(ft.length+1),Wt=0;for(let Gt=0;Gt<ft.length;Gt++){let{start:Yt,end:un}=ft[Gt];$t[Gt]=B.slice(Wt,Yt),Wt=un}$t[ft.length]=B.slice(Wt),B=$t.join("")}}let ct=ca(B,k);if(ct.hasScoped)B=ct.html;let St=_.__stx_event_bindings||[],mt=!1,Kt=[],Wn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Mn}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js"));for(let bt of Mn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Kt.push({match:bt.fullMatch,attrs:bt.attrs,content:bt.body});for(let{match:bt,attrs:ft,content:$t}of Kt){mt=!0;let Wt=$t;Ls($t,k,R.strict,_.__originalFilePath);let Gt=await Se($t,{eventBindings:St,attrs:ft,hasColonDirectives:Wn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Qs(R.buildMode),serverData:je});B=B.replace(bt,()=>Gt)}if(mt)_.__stx_event_bindings=[];if(!mt&&_.__stxProcessingDepth===1){let bt=_.__stx_event_bindings||[];if(bt.length>0){let ft=nc(bt);if(ft){let $t=B.lastIndexOf("</body>");B=$t===-1?B+ft:B.slice(0,$t)+ft+`
2636
+ `+B.slice($t)}_.__stx_event_bindings=[]}}if(!ge(B)&&Im(B))B=await Wa(B,z);if(B=Pm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=Op(B,_.cspNonce);return B}var JS=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],YS=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],QS=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function Wc(v){let _=[],k=[];return e0(v,_),t0(v,_,k),n0(v,k),r0(v,_),{valid:_.length===0,errors:_,warnings:k}}function e0(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function t0(v,_,k){for(let R of JS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,W=(v.match(B)||[]).length;if(R.altClose){let F=new RegExp(R.altClose,"g");W+=(v.match(F)||[]).length}if(z>W)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${W} closing`,suggestion:`Add ${z-W} missing ${R.close} tag(s)`});else if(W>z)k.push({type:"directive",message:`Extra ${R.close} found: ${W-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function n0(v,_){for(let k of YS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function r0(v,_){for(let k of QS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function qc(v,_){let k=v.slice(0,_).split(`
2637
+ `);return{line:k.length,column:k[k.length-1].length+1}}function Gc(v,_,k){let R=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))R.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(k.length===0)R.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)R.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)R.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return R}function Kc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Xc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let R of _){let T=R[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import Xn from"path";import ji from"process";var Lt=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var fh=new Set(Lt),s0=new Set(["props","$props","defineProps"]),i0=new Set(["stx","@stacksjs/stx"]),ph=m(128),gh=m(64);function o0(v){let _=[],k=0,R=v.split(`
2638
+ `);for(let T of R){let B=k,z=null,W=!1;for(let F=0;F<T.length;F++){let U=T[F];if(W){W=!1;continue}if(U==="\\"){W=!0;continue}if(z){if(U===z)z=null;continue}if(U==="'"||U==='"'||U==="`"){z=U;continue}if(U==="/"&&F+1<T.length&&T[F+1]==="/")break;if(U==="{")k++;else if(U==="}")k--}if(B===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let U=T.match(/(?:const|let|var)\s+(\w+)/);if(U)_.push(U[1])}else{let U=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let q=U[1].slice(1,-1).split(",").map((Q)=>{let ie=Q.split(":");return(ie.length>1?ie[1]:ie[0]).trim()}).filter((Q)=>/^\w+$/.test(Q));_.push(...q)}}}}return[...new Set(_)]}function Mc(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(R){if(!R.includes(":"))return R;let T=[],B="",z=0,W=0,F=null;for(let U=0;U<R.length;U++){let H=R[U];if(F){if(B+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,B+=H;continue}if(H==="<")z++;else if(H===">"&&z>0)z--;else if(H==="(")W++;else if(H===")")W--;if(H===","&&z===0&&W===0){T.push(B),B="";continue}B+=H}if(B)T.push(B);return T.map((U)=>{let H=U.trim(),q=H.startsWith("..."),Q=q?H.slice(3):H,ie=-1,Z=0;for(let we=0;we<Q.length;we++)if(Q[we]==="<")Z++;else if(Q[we]===">")Z--;else if(Q[we]===":"&&Z===0){ie=we;break}if(ie===-1)return U;let le=Q.substring(0,ie).trim().replace(/\?$/,""),ce=Q.substring(ie+1),de=-1,ue=0;for(let we=0;we<ce.length;we++)if(ce[we]==="<")ue++;else if(ce[we]===">")ue--;else if(ce[we]==="="&&ue===0){de=we;break}let $e=q?"...":"";if(de!==-1)return`${$e}${le} = ${ce.substring(de+1).trim()}`;return`${$e}${le}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(R,T,B)=>{if(!B.includes(":"))return R;return`${T}(${k(B)})`});{let R=/\b(function\s+\w*\s*)\(/g,T,B=[];while((T=R.exec(_))!==null){let z=T.index+T[0].length-1,W=1,F=z+1,U=0,H=null;while(F<_.length&&W>0){let ie=_[F];if(H){if(ie===H)H=null;F++;continue}if(ie==='"'||ie==="'"||ie==="`"){H=ie,F++;continue}if(ie==="<")U++;else if(ie===">"&&U>0)U--;else if(U===0){if(ie==="(")W++;else if(ie===")")W--}if(W>0)F++}if(W!==0)continue;let q=_.substring(z+1,F);if(!q.includes(":"))continue;let Q=k(q);B.push({start:z+1,end:F,replacement:Q})}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:U}=B[z];_=_.substring(0,W)+U+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(R,T)=>{if(!T.includes(":"))return R;if(T.includes("{")||T.includes("}"))return R;return`(${T.split(",").map((z)=>{let[W,...F]=z.split("="),U=W.split(":")[0].trim();if(F.length>0)return`${U} = ${F.join("=").trim()}`;return U}).join(", ")}) =>`}),_=_.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
2639
+
2640
+ `),_}function Lc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function jc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function Bc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function Fc(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var mh=new Set;async function u(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=ph.get(B);if(z===void 0){try{let Fe=j({loader:"ts",target:"browser",define:T}),He=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");He=He.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),z=Fe.transformSync(He)}catch{z=Mc(v)}ph.set(B,z)}let W={exports:{}},F=W.exports,U=ji.cwd(),H={},q=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Fe)=>Fe[1]).filter((Fe)=>!Fe.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Fe)),Q=new Map;for(let Fe of q)try{if(Fe.startsWith(".")){H[Fe]=await import(Xn.resolve(Xn.dirname(k),Fe));continue}let He=Xn.resolve(U,"node_modules",Fe),pt=Xn.join(He,"package.json"),Ct=JSON.parse(d("fs").readFileSync(pt,"utf8")),Ut=Ct.main||"index.js";if(Ct.exports){let rn=typeof Ct.exports==="string"?Ct.exports:Ct.exports["."];if(typeof rn==="string")Ut=rn;else if(rn?.bun)Ut=rn.bun;else if(rn?.import)Ut=rn.import;else if(rn?.default)Ut=rn.default}H[Fe]=await import(Xn.resolve(He,Ut))}catch(He){if(Fe.startsWith("."))Q.set(Fe,He instanceof Error?He.message:String(He))}let ie=(Fe)=>{if(H[Fe])return H[Fe];let He=Q.get(Fe);if(He!==void 0)throw Error(`Cannot require '${Fe}' from ${k}: ${He}`);return d(Fe)},Z=_.props||{},ae=(Fe)=>{if(!Fe)return Z;let He={};for(let[pt,Ct]of Object.entries(Fe)){let Ut=Z[pt];if(Ut!==void 0)He[pt]=Ut;else if(typeof Ct==="function")He[pt]=Ct();else He[pt]=Ct}return He};for(let[Fe,He]of Object.entries(Z))Object.defineProperty(ae,Fe,{value:He,enumerable:!0,configurable:!0,writable:!0});let le=(Fe,He=!1)=>{if(Fe===void 0||Fe===null)return He;if(typeof Fe==="string"){let pt=Fe.trim().toLowerCase();if(pt===""||pt==="true"||pt==="1"||pt==="on"||pt==="yes")return!0;if(pt==="false"||pt==="0"||pt==="off"||pt==="no")return!1;return!0}return Boolean(Fe)},ce=(Fe,He=0)=>{if(Fe===void 0||Fe===null)return He;if(typeof Fe==="string"){let Ct=Fe.trim();if(Ct==="")return He;let Ut=Number(Ct);return Number.isFinite(Ut)?Ut:He}let pt=Number(Fe);return Number.isFinite(pt)?pt:He};for(let Fe of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(Z,Fe))continue;try{Object.defineProperty(ae,Fe,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let de=(Fe)=>{if(!Fe)return Z;let He={...Z};for(let[pt,Ct]of Object.entries(Fe)){let Ut=Ct&&typeof Ct==="object"&&!Array.isArray(Ct)?Ct:{type:Ct};if(He[pt]===void 0&&Ut.default!==void 0)He[pt]=typeof Ut.default==="function"?Ut.default():Ut.default}return He},ue=()=>_.slots||{},$e=(Fe,He)=>{let pt={...Fe};for(let[Ct,Ut]of Object.entries(He))if(pt[Ct]===void 0)if(typeof Ut==="function")pt[Ct]=Ut();else pt[Ct]=Ut;return pt},we=(Fe)=>{let He=()=>Fe;return He.set=(pt)=>{},He.update=(pt)=>{},He},ye=(Fe)=>{let He,pt=!1;return()=>{if(!pt)try{He=Fe(),pt=!0}catch{He=void 0}return He}},Pe=(Fe)=>{},Oe=(Fe)=>Fe(),Me=(Fe)=>{},Ne=(Fe)=>{},Le=or(_);function De(Fe){let He=Fe||{};if(He.title!==void 0||He.description!==void 0)st({title:He.title,description:He.description})}function ze(Fe){if(!Fe||typeof Fe!=="object")return;let He=_.__stxClientPayload??{};Object.assign(He,Fe),_.__stxClientPayload=He}let Ve=()=>{let Fe=_.__stxServeContext,He=_.__stxServeSearch??Fe?.search??"",pt=Fe?.path??"",Ct=Object.fromEntries(new URLSearchParams(He)),Ut=_.query,rn=Object.keys(Ct).length>0?Ct:Ut??{},Qr=He||(Object.keys(rn).length>0?`?${new URLSearchParams(rn).toString()}`:"");return{params:_.params??{},query:rn,path:pt,name:"",fullPath:pt+Qr,hash:"",matched:[]}},Be=()=>({push:(Fe)=>{},replace:(Fe)=>{},back:()=>{},forward:()=>{},go:(Fe)=>{}}),je=(Fe)=>{let He=_.__stx_runtime_head||{};_.__stx_runtime_head=ve(He,be(Fe||{},{known:wr,source:"useHead()"}))},st=(Fe)=>{je(xr(Fe||{}))},ht=(Fe)=>({value:Fe}),yt=(Fe)=>Fe,vt=(Fe)=>({value:typeof Fe==="function"?Fe():Fe}),dt=(Fe,He)=>{},wt=(Fe)=>{},kt=(Fe)=>{},xt=(Fe)=>Fe?Fe():Promise.resolve(),ct=(Fe)=>(He,...pt)=>{},St=(Fe)=>{},mt=(Fe,He)=>{},Kt=(Fe,He)=>He,Wn=()=>({value:"light"}),Mn=()=>we(!1),bt=(Fe)=>we(!1),ft=()=>we(!1),$t=()=>bt("(prefers-color-scheme: dark)"),Wt=()=>bt("(prefers-color-scheme: light)"),Gt=()=>bt("(prefers-reduced-motion: reduce)"),Yt=()=>bt("(prefers-contrast: more)"),un={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Xa=new Proxy(un,{get(Fe,He){if(He in Fe)return Fe[He];return},set(Fe,He,pt){return Fe[He]=pt,!0}}),Zn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Za=console;try{let Fe=Rs(z,k),He=new Set(Object.keys(Z)),pt=Object.keys(_).filter((it)=>!He.has(it)&&!s0.has(it)&&at(it)),Ct=pt.map((it)=>_[it]);if(!pt.includes("__stxServeContext"))pt.push("__stxServeContext"),Ct.push(void 0);if(!He.has("cookies")){let it=_.cookies??_.__stxServeContext?.cookies??{},Xt=pt.indexOf("cookies");if(Xt<0)pt.push("cookies"),Ct.push(it);else Ct[Xt]=it}let Ut=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),rn=[],Qr=[];for(let[it,Xt]of Object.entries(Z)){if(!at(it))continue;if(Ut.has(it))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${it}\\b`).test(Fe))continue;rn.push(it),Qr.push(Xt)}let Do=o0(Fe).map((it)=>`module.exports.${it} = typeof ${it} !== 'undefined' ? ${it} : module.exports.${it};`).join(`
2641
+ `),Oo=_.params??{},Mo=[],vr=[];for(let it=0;it<pt.length;it++){if(pt[it]==="params")continue;Mo.push(pt[it]),vr.push(Ct[it])}let es=[...Lt,...rn,...Mo],Gn=`return (async () => {
2642
+ ${Fe}
2643
+ ${Do}
2644
+ return module.exports
2645
+ })()`,cn=h(Gn,es.join("\x00")),lt=gh.get(cn);if(!lt)lt=Function(...es,Gn),gh.set(cn,lt);let gt=_.__stx_options?.runtimeConfig;if(gt||/\buse(?:Server)?RuntimeConfig\b/.test(z))await En(_,k,gt);let Et=await he(_.__stx_runtime_config??Bt()??C(),()=>km(_,()=>lt(W,F,ie,Z,ae,le,ce,de,$e,ze,Em,Hs,mr,we,ye,Pe,Oe,Me,Ne,De,Ve,Be,je,st,Le.setResponseStatus,Le.setResponseHeader,Le.notFound,ht,yt,vt,dt,wt,kt,xt,ct,St,ue,mt,Kt,Wn,Mn,bt,ft,$t,Wt,Gt,Yt,Xa,Zn,Za,un.confirm,un.alert,un.fetch,Oo,...Qr,...vr)));if(R.preserveExisting){for(let[it,Xt]of Object.entries(Et))if(!(it in _)||_[it]===void 0)_[it]=Xt}else Object.assign(_,Et);for(let[it,Xt]of Object.entries(Z))if(!(it in _))_[it]=Xt}catch(Fe){if(_.__stx_strict_hydration)throw Fe;let He=Lc(Fe instanceof Error?Fe.message:String(Fe));if(jc(He))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${He}`),R.onFailure?.({kind:"module-resolution",message:He,error:Fe});else if(Bc(Fe))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${He}`),R.onFailure?.({kind:"syntax",message:He,error:Fe});else if(Fc(He))console.warn(`[stx] server <script> in ${k??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${He}`),R.onFailure?.({kind:"missing-binding",message:He,error:Fe});else{let pt=`${k??"<unknown>"}\x00${He}`;if(ji.env.STX_DEBUG||!mh.has(pt))mh.add(pt),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${He}`);R.onFailure?.({kind:"unknown",message:He,error:Fe})}try{await f0(z,_,k)}catch(pt){if(ji.env.STX_DEBUG){let Ct=pt instanceof Error?pt.message:String(pt);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${Ct}`)}}}}function zc(v){let _=0,k=null,R=!1,T=!1;for(let B=0;B<v.length;B++){let z=v[B];if(k){if(z===k){if(k=null,R||_===0)T=!0}continue}if(z==="'"||z==='"'||z==="`"){k=z;continue}if(z==="{")_++;else if(z==="}")_--;else if(v.startsWith("from",B)&&_===0)R=!0}return k===null&&_===0&&T}var a0=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Rs(v,_){let k=_?Xn.dirname(_):ji.cwd(),R=ji.cwd(),T=v.split(`
2646
+ `),B=[],z=0;while(z<T.length){let W=T[z].trim();if(W.startsWith("interface ")||W.startsWith("export interface ")||W.startsWith("type ")||W.startsWith("export type ")){if(W.includes("{")&&!W.includes("}")){let F=0;for(;z<T.length;z++){for(let U of T[z])if(U==="{")F++;else if(U==="}")F--;if(F<=0)break}}z++;continue}if(W.startsWith("definePageMeta(")){let F=0,U=!1,H=z;for(let ie=z;ie<T.length&&!U;ie++){let Z=null,ae=!1,le=T[ie];for(let ce=0;ce<le.length;ce++){let de=le[ce];if(ae){ae=!1;continue}if(de==="\\"){ae=!0;continue}if(Z){if(de===Z)Z=null;continue}if(de==='"'||de==="'"||de==="`"){Z=de;continue}if(de==="(")F++;else if(de===")"){if(F--,F===0){z=ie+1,U=!0;break}}}}if(!U)z=T.length;let q=T.slice(H,z).join(`
2647
+ `),Q=[];for(let ie of["title","description"]){let Z=new RegExp(`\\b${ie}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(q);if(Z)Q.push(`${ie}: ${JSON.stringify(Z[2])}`)}if(Q.length>0)B.push(`useSeoMeta({ ${Q.join(", ")} });`);continue}if(W.startsWith("import ")||W==="import"||W.startsWith("import{")||/^import['"]/.test(W)){let F=W,U=0;while(!zc(F)&&z+U+1<T.length)U++,F=`${F} ${T[z+U].trim()}`;z+=U;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),q=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Q=F.match(/^import\s*['"](.+?)['"]/),ie=F,Z=(ae)=>{if(ae.startsWith("."))return Xn.resolve(k,ae);if(ae.startsWith("~/")||ae.startsWith("@/"))return Xn.resolve(R,ae.slice(2));try{return Bun.resolveSync(ae,k)}catch{return ae}};if(H){let[,ae,le]=H,ce=Z(le);B.push(`const ${ae} = (await import('${ce}')).default`),B.push(`module.exports.${ae} = ${ae};`)}else if(q){let[,ae,le]=q,ce=Z(le),de=[],ue=[],$e=i0.has(le);for(let we of ae.split(",")){let ye=we.trim();if(!ye)continue;let Pe=ye.split(/\s+as\s+/);if(Pe.length===2){let[Oe,Me]=[Pe[0].trim(),Pe[1].trim()];if($e&&fh.has(Oe)){B.push(`const ${Me} = ${Oe};`);continue}de.push(`${Oe}: ${Me}`),ue.push(Me)}else{if($e&&fh.has(ye))continue;de.push(ye),ue.push(ye)}}if(de.length>0)B.push(`const { ${de.join(", ")} } = await import('${ce}')`);for(let we of ue)B.push(`module.exports.${we} = ${we};`)}else if(Q){let ae=Z(Q[1]);B.push(`await import('${ae}')`)}else B.push(ie);z++;continue}if(a0.test(W))B.push(T[z]),z++;else if(W.startsWith("export const ")||W.startsWith("export let ")||W.startsWith("export var ")){let F=yh(T,z),{type:U,name:H,value:q}=F;B.push(`${U} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("export function ")||W.startsWith("export async function ")){let F=Tu(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("const ")||W.startsWith("let ")||W.startsWith("var ")){let F=yh(T,z),{type:U,name:H,value:q}=F;B.push(`${U} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("function ")||W.startsWith("async function ")){let F=Tu(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("export default function ")||W.startsWith("export default async function ")){let F=T[z].replace(/^(\s*)export\s+default\s+/,"$1"),U=[...T];U[z]=F;let H=Tu(U,z);if(B.push(H.functionCode),H.name)B.push(`module.exports.default = ${H.name};`);z=H.nextIndex}else if(W.startsWith("export default ")){let F=W.replace(/^export\s+default\s+/,"").replace(/;$/,"");B.push(`module.exports.default = ${F};`),z++}else if(W.startsWith("class ")||W.startsWith("export class ")){let F=W.match(/(?:export\s+)?class\s+(\w+)/);if(F){let U=F[1],H=T[z].replace(/^export\s+/,""),q=0,Q=z;for(;Q<T.length;Q++){let ie=T[Q];for(let Z of ie)if(Z==="{")q++;else if(Z==="}")q--;if(Q>z)H+=`
2648
+ `+ie;if(q<=0&&Q>=z)break}B.push(H),B.push(`module.exports.${U} = ${U};`),z=Q+1}else B.push(W),z++}else if(W.includes("module.exports"))B.push(W),z++;else if(W.trim()&&!W.startsWith("//"))B.push(W),z++;else z++}return c0(B.join(`
2649
+ `),k,R)}function c0(v,_,k){let R=v.length,T="",B=0,z=null,W=!1,F=!1,U=0;while(B<R){let H=v[B],q=v[B+1];if(W){if(T+=H,H===`
2650
+ `)W=!1;B++;continue}if(F){if(T+=H,H==="*"&&q==="/"){T+=q,B+=2,F=!1;continue}B++;continue}if(!z&&H==="/"&&q==="/"){W=!0,T+=H,B++;continue}if(!z&&H==="/"&&q==="*"){F=!0,T+=H,B++;continue}if(z){if(T+=H,H==="\\"){T+=q,B+=2;continue}if(H===z&&z!=="`"){z=null,B++;continue}if(z==="`"){if(H==="$"&&q==="{"){U++,T+=q,B+=2;continue}if(H==="`"){z=null,B++;continue}}B++;continue}if(U>0){if(H==="{")U++;else if(H==="}")U--}if(H==='"'||H==="'"||H==="`"){z=H,T+=H,B++;continue}if(H==="a"&&v.startsWith("await",B)){let Q=l0(v,B);if(Q){let{quote:ie,path:Z,end:ae}=Q;if(Z.startsWith(".")||Z.startsWith("~/")||Z.startsWith("@/")){let le=Z.startsWith(".")?Xn.resolve(_,Z):Xn.resolve(k,Z.slice(2));T+=`await import(${ie}${le}${ie})`,B=ae;continue}}}T+=H,B++}return T}function l0(v,_){let k=_+5;if(k>=v.length)return null;if(!/\s/.test(v[k]))return null;while(k<v.length&&/\s/.test(v[k]))k++;if(!v.startsWith("import",k))return null;k+=6;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return null;k++;while(k<v.length&&/\s/.test(v[k]))k++;let R=v[k];if(R!=="'"&&R!=='"')return null;k++;let T=k;while(k<v.length&&v[k]!==R)if(v[k]==="\\")k+=2;else k++;if(k>=v.length)return null;let B=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:R,path:B,end:k+1}}function wh(v,_){let k=v[_];if(k!=="{"&&k!=="[")return null;let T=S(v,k,k==="{"?"}":"]",_);if(T===-1)return null;return{pattern:v.slice(_,T+1),endPos:T+1}}function Sh(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let R=0,T=0,B="";while(R<k.length){let z=k[R];if(z==="{"||z==="["){let W=T===0?wh(k,R):null;if(W){_.push(...Sh(W.pattern)),R=W.endPos,B="";continue}T++}else if(z==="}"||z==="]")T--;if(T>0){R++;continue}if(z===","){if(B.trim())_.push(B.trim());B="",R++;continue}if(z===":"){B="",R++;continue}if(z==="="){if(B.trim())_.push(B.trim());B="",R++;while(R<k.length&&k[R]!==","&&T===0){if(k[R]==="{"||k[R]==="[")T++;else if(k[R]==="}"||k[R]==="]")T--;R++}continue}if(/[\w$]/.test(z))B+=z;R++}if(B.trim())_.push(B.trim());return _}function Hc(v){let _=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(v);if(!_)return null;let k=_[0].length,R=(T)=>T===" "||T==="\t";while(k<v.length&&R(v[k]))k++;if(v[k]===":"){let T=0,B=null;k++;for(;k<v.length;k++){let z=v[k];if(B){if(z==="\\"){k++;continue}if(z===B)B=null;continue}if(z==="'"||z==='"'||z==="`"){B=z;continue}if(z==="("||z==="["||z==="{"||z==="<"){T++;continue}if(z===")"||z==="]"||z==="}"||z===">"){T--;continue}if(z==="="&&T<=0){let W=v[k+1],F=v[k-1];if(W!=="="&&W!==">"&&F!=="="&&F!=="!"&&F!=="<"&&F!==">")break}}if(v[k]!=="=")return null}while(k<v.length&&R(v[k]))k++;if(v[k]!=="=")return null;return{type:_[1],name:_[2],value:v.slice(k+1).trim()}}function hh(v,_,k,R){let T=null,B=!1;for(let z of v){if(B){B=!1;continue}if(z==="\\"){B=!0;continue}if(T){if(z===T)T=null;continue}if(z==="'"||z==='"'||z==="`"){T=z;continue}if(z===_)R++;else if(z===k)R--}return R}function yh(v,_){let k=v[_].trim(),R=Hc(k),T=R?[k,R.type,R.name,R.value]:null;if(!T){let H=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(H){let q=k.slice(H[0].length),Q=_;if(q.startsWith("{")||q.startsWith("[")){let Z=q[0],ae=Z==="{"?"}":"]",le=hh(q,Z,ae,0),ce=q;for(let de=_+1;de<v.length&&le>0;de++)ce+=` ${v[de].trim()}`,Q=de,le=hh(v[de],Z,ae,le);if(le>0)ce=q,Q=_;q=ce}let ie=wh(q,0);if(ie){let Z=H[1],ae=ie.pattern,le=q.slice(ie.endPos).trim();if(le.startsWith("=")){let ce=le.slice(1).trim(),de=ce,ue=Math.max(Q,_);if(xh(ce)){let Pe=bh(v,ue,ce);de=Pe.value,ue=Pe.nextIndex}else ue=ue+1;de=de.trim().replace(/;$/,"");let $e=Sh(ae),we=`__stx_src_${_}`,ye=$e.map((Pe)=>`module.exports.${Pe} = ${Pe};`).join(`
2651
+ `);return{type:Z,name:we,value:`${de}; ${Z} ${ae} = ${we};
2652
+ ${ye}`,nextIndex:ue}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,B,z,W]=T,F=W,U=_;if(xh(W)){let H=bh(v,_,W);F=H.value,U=H.nextIndex}else U=_+1;while(U<v.length){let H=v[U].trim();if(H.startsWith(".")||H.startsWith("?."))F+=`
2653
+ ${v[U]}`,U++;else break}return F=F.trim().replace(/;$/,""),{type:B,name:z,value:F,nextIndex:U}}function Tu(v,_){let k=v[_].trim(),R=k.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!R)throw Error(`Failed to parse function declaration: ${k}`);let[,T]=R,B=k.replace(/^export\s+/,""),z=_;if(u0(k)){let W=d0(v,_,B);B=W.functionCode,z=W.nextIndex}else z=_+1;return{name:T,functionCode:B,nextIndex:z}}function xh(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!$h(_)}function $h(v){let _={paren:0,bracket:0,brace:0},k=null,R=0;for(let T=0;T<v.length;T++){let B=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((B==='"'||B==="'")&&!k){k=B;continue}if(B===k&&k!=="`"){k=null;continue}if(B==="`"&&!k){k="`";continue}if(B==="`"&&k==="`"&&R===0){k=null;continue}if(k==="`"&&B==="$"&&v[T+1]==="{"){R++,T++;continue}if(R>0&&B==="{"){R++;continue}if(R>0&&B==="}"){R--;continue}if(k)continue;if(B==="(")_.paren++;else if(B===")")_.paren--;else if(B==="[")_.bracket++;else if(B==="]")_.bracket--;else if(B==="{")_.brace++;else if(B==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function _h(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function u0(v){let _=_h(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function bh(v,_,k){let R=k,T=_+1;while(T<v.length&&!$h(R)){let B=v[T];R+=`
2654
+ ${B}`,T++}while(T<v.length){let B=v[T].trim();if(B.startsWith(".")||B.startsWith("?."))R+=`
2655
+ ${v[T]}`,T++;else break}return{value:R,nextIndex:T}}function d0(v,_,k){let R=k,T=_+1;while(T<v.length){let B=_h(R);if(B!==-1){if(S(R,"{","}",B)!==-1)break}let z=v[T];R+=`
2656
+ ${z}`,T++}return{functionCode:R,nextIndex:T}}function vh(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let R={..._,process:Object.freeze({env:{...ji.env}})},T=Object.keys(R).filter(at),B=T.map((z)=>R[z]);try{return Function(...T,`'use strict'; return (${v});`)(...B)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...B)}catch{return}}}async function f0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let B of R){let[,,z,W]=B;try{let F=W.trim().replace(/;$/,""),U=vh(F,_);if(U!==void 0)_[z]=U}catch(F){console.warn(`Failed to parse export ${z} in fallback:`,F)}}let T=v.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let B of T){let[,,z,W]=B;if(!(z in _))try{let F=W.trim().replace(/;$/,""),U=vh(F,_);if(U!==void 0)_[z]=U}catch{}}}function Ei(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",R=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:R}}function Ti(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Io=new M(500),qa=new M(1000),Pu=new M(2000),Du=new M(500),Ph=33554432,Ou=Ph;function p0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Ou)return;Ou=_,Ka.setMaxBytes(_)}var Ka=new M(2000,{maxBytes:Ph,sizeOf:(v)=>v.output.length});function g0(v){let _=new WeakSet;try{let k=(R)=>{if(R===void 0)return{__stxType:"undefined"};if(typeof R==="bigint")return{__stxType:"bigint",value:R.toString()};if(typeof R==="function"||typeof R==="symbol")throw TypeError("Non-serializable component input");if(R===null||typeof R!=="object")return R;if(_.has(R))throw TypeError("Circular component input");_.add(R);try{if(R instanceof Date)return{__stxType:"date",value:R.toISOString()};if(Array.isArray(R))return R.map(k);let T=Object.getPrototypeOf(R);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let B={};for(let z of Object.keys(R).sort())B[z]=k(R[z]);return B}finally{_.delete(R)}};return JSON.stringify(k(v))}catch{return null}}function m0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function kh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Jc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Qe(v){return!Jc(v)}var Ha=new Map;function j(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Ha.get(_);if(k)return k;if(Ha.size>=16)Ha.clear();let R=new Bun.Transpiler(v);return Ha.set(_,R),R}var Eh=new WeakMap,h0=256;function et(v){try{let _=j({loader:"ts",target:"browser",define:w()}),k=Eh.get(_);if(!k)k=new Map,Eh.set(_,k);let R=k.get(v);if(R!==void 0)return R;let T=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");T=T.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let B=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`});let z=_.transformSync(T);for(let W=0;W<B.length;W++)z=z.replace(`"__STX_EXPR_${W}__"`,B[W]),z=z.replace(`'__STX_EXPR_${W}__'`,B[W]);if(k.size>=h0){let W=k.keys().next();if(!W.done)k.delete(W.value)}return k.set(v,z),z}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function y0(v){let _=[],k=new Set,R=0,T=0,B=v.length,z=(H)=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},W=()=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<B&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')z(v[T]);else if(v[T]==="`")W();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<B&&v[T]!==`
2657
+ `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},U=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let Z=H[2].split(",").map((ae)=>{let le=ae.trim().split(":");return le[le.length-1].trim()});for(let ae of Z)if(ae&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(ae)&&!k.has(ae))_.push(ae),k.add(ae);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let Z=q[2];if(!k.has(Z))_.push(Z),k.add(Z);return}let Q=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let Z=Q[1];if(!k.has(Z))_.push(Z),k.add(Z);return}let ie=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ie){let Z=ie[1];if(!k.has(Z))_.push(Z),k.add(Z)}};while(T<B){if(F())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){W();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))U();T++}return _}function x0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function b0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function v0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let F=v[R];if(F==="}")B++;else if(F==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let W=v.slice(z+1,T);for(let F of x0(W)){let U=F.trim();if(!U||U.startsWith("..."))continue;let H=b0(U);if(H===-1)continue;let q=U.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(q))continue;if(_[q]!==void 0)continue;let Q=U.slice(H+1).trim();if(!Q)continue;try{let ie=Object.keys(_).filter(at),Z=Function(...ie,`"use strict"; return (${Q});`);_[q]=Z(...ie.map((ae)=>_[ae]))}catch{}}}catch{}}var w0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Yc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let R=k[2].toLowerCase();if(!w0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=ee(v,(U,H)=>(T.lastIndex=H,T.exec(U)?.index===H?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,W=!1;for(let U of B){if(z+=U.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(U.end).trim())return null;W=!0;break}}if(!W)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function ur(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(we)=>we.split("-").map((ye)=>ye.charAt(0).toUpperCase()+ye.slice(1)).join(""),W=k.__importedComponents;if(W){for(let we of[B,B.toLowerCase(),z(B),dn(B)])if(W.has(we))return!0}let F=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${dn(B)}.stx`])],U=typeof T.root==="string"?ut.resolve(T.root):void 0,H=U??ut.dirname(R),q=[],Q=(we)=>{if(we&&!q.includes(we))q.push(we)},ie=k.__originalFilePath;if(ie)Q(ut.join(ut.dirname(ie),"components"));Q(_),Q(T._rootComponentsDir),Q(ut.join(ut.dirname(R),"components")),Q(T.componentsDir);let Z=T._targetComponentFallbackNames?.some((we)=>we.toLowerCase()===B.toLowerCase());if(!Z)for(let we of T._targetComponentDirs??[])Q(we);if(U)Q(ut.resolve(U,"resources/views/components")),Q(ut.resolve(U,"resources/components")),Q(ut.resolve(U,"src/components")),Q(ut.resolve(U,"components"));for(let we of T._layerComponentDirs??[])Q(we);let ae=T._pluginComponentDirs;if(Array.isArray(ae))for(let we of ae)Q(typeof we==="string"?we:null);if(Q(T.fallbackComponentsDir),Z)for(let we of T._targetComponentDirs??[])Q(we);if(B.startsWith("./")||B.startsWith("../"))return r(ut.resolve(ut.dirname(R),`${B}.stx`));let le=Ch(ut.resolve(import.meta.dir,"components")),ce=q.map((we)=>ut.isAbsolute(we)?we:ut.resolve(H,we)),de=`${F.join("\x00")}\x00\x00${ce.join("\x00")}`,ue=Pu.get(de);if(ue!==void 0)return ue;let $e=!1;e:for(let we of ce){if(Ch(we)===le)continue;for(let ye of F)if(await r(ut.join(we,ye))){$e=!0;break e}}return Pu.set(de,$e),$e}function Ch(v){let _=Du.get(v);if(_!==void 0)return _;let k=v;try{k=Ih.realpathSync(v)}catch{}return Du.set(v,k),k}function Zc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function Pi(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function S0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let W=String(z);if(/<\/style/i.test(W))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return W};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var Rh=new Set;function Ah(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&Rh.has(T))return;Rh.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",W=k.length>0?`
2658
+ searched:
2659
+ ${k.map((F)=>` - ${F}`).join(`
2660
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${W}`)}function Th(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Qc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function tt(v,_,k,R,T,B,z,W=new Set,F,U=kr(T),H,q=v){let{extractVariables:Q}=await _t("stx/variable-extractor",()=>import("./chunk-915s0may.js")),ie=W??new Set;if(ie.has(v))return`[Circular component reference: ${v}]`;let Z=new Set(ie);Z.add(v);let ae=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let le=ae&&ae!=="load"&&Zc(ae)?ae:"";try{let ce=(lt)=>lt.split("-").map((gt)=>gt.charAt(0).toUpperCase()+gt.slice(1)).join(""),de=q.endsWith(".stx")?q.slice(0,-4):q,ue=null,$e=T.__importedComponents;if($e){let lt=[de,de.toLowerCase(),ce(de),dn(de)];for(let gt of lt)if($e.has(gt)){ue=$e.get(gt);break}}let we=[];if(!ue){let lt=[`${de}.stx`,`${ce(de)}.stx`,`${dn(de)}.stx`],gt=[...new Set(lt)],Et=T.__originalFilePath,it=[];if(it.push(...z._layerComponentDirs??[]),Et){let Tt=ut.join(ut.dirname(Et),"components");it.push(Tt)}if(R)it.push(R);let Xt=z._rootComponentsDir;if(typeof Xt==="string"&&!it.includes(Xt))it.push(Xt);let Qt=ut.join(ut.dirname(B),"components");if(!it.includes(Qt))it.push(Qt);if(z.componentsDir&&z.componentsDir!==R&&!it.includes(z.componentsDir))it.push(z.componentsDir);let $r=z._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(de),Br=(H?.events??[]).map((Tt)=>Tt.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),ts=!Br.includes("valuechange")&&(Object.hasOwn(_,"checked")||H?.reactiveProps?.includes("checked")||Br.includes("change")),No=z._targetComponentFallbackNames?.some((Tt)=>Tt.toLowerCase()===de.toLowerCase())&&(!$r||ts);for(let Tt of No?[]:z._targetComponentDirs??[])if(Tt&&!it.includes(Tt))it.push(Tt);let jn=typeof z.root==="string"?ut.resolve(z.root):void 0,jo=jn??ut.dirname(B),Jn=[];if(jn)Jn.push(ut.resolve(jn,"resources/views/components")),Jn.push(ut.resolve(jn,"resources/components")),Jn.push(ut.resolve(jn,"src/components")),Jn.push(ut.resolve(jn,"components"));Jn.push(ut.resolve(import.meta.dir,"components"));for(let Tt of Jn)if(!it.includes(Tt))it.push(Tt);let Bi=z._pluginComponentDirs;if(Array.isArray(Bi)){for(let Tt of Bi)if(typeof Tt==="string"&&!it.includes(Tt))it.push(Tt)}if(z.fallbackComponentsDir&&!it.includes(z.fallbackComponentsDir))it.push(z.fallbackComponentsDir);if(No){for(let Tt of z._targetComponentDirs??[])if(Tt&&!it.includes(Tt))it.push(Tt)}let zi=[...new Set(it.map((Tt)=>{if(!Tt)return Tt;return ut.isAbsolute(Tt)?Tt:ut.resolve(jo,Tt)}))];it.length=0,it.push(...zi);let ns=`${de}\x00${B}\x00${zi.join("\x00")}`,Ja=qa.get(ns);if(Ja)if(await r(Ja))ue=Ja;else qa.delete(ns);if(!ue&&(de.startsWith("./")||de.startsWith("../")))ue=ut.resolve(ut.dirname(B),`${de}.stx`),we.push(ue);else if(!ue)for(let Tt of it){if(!Tt)continue;for(let Lo of gt){let Bo=ut.join(Tt,Lo);if(we.push(Bo),await r(Bo)){ue=Bo;break}}if(ue)break;if(!ue)try{let Lo=await import("fs");if(!Lo.statSync(Tt,{throwIfNoEntry:!1})?.isDirectory())continue;let Lh=8,Ya=[{path:Tt,depth:0}];while(Ya.length>0&&!ue){let zo=Ya.pop();if(zo.depth>=Lh)continue;let Nu;try{Nu=Lo.readdirSync(zo.path,{withFileTypes:!0})}catch{continue}for(let Wo of Nu){if(!Wo.isDirectory())continue;if(Wo.name==="node_modules"||Wo.name.startsWith("."))continue;let ju=ut.join(zo.path,Wo.name);for(let Bh of gt){let Qa=ut.join(ju,Bh);if(we.push(Qa),await r(Qa)){ue=Qa;break}}if(ue)break;Ya.push({path:ju,depth:zo.depth+1})}}}catch{}if(ue)break}if(ue)qa.set(ns,ue)}if(!ue||!await r(ue))return Ah(v,B,we),Th(v);F.add(ue);let ye;if(Io.has(ue))ye=Io.get(ue);else try{ye=await Bun.file(ue).text(),Io.set(ue,ye)}catch(lt){let gt=lt instanceof Error?lt.message:String(lt);return Ah(v,B,[ue],gt),Th(v)}if(H)for(let lt of new Set([...Object.keys(_),...H.reactiveProps??[]])){let gt=lt.toLowerCase();if(gt.startsWith("aria-")||gt.startsWith("data-"))continue;let Et=lt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Et}\\b`).test(ye))H.declaredProps.add(lt);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Et}\\b|\\[\\s*['"]${Et}['"]\\s*\\])`).test(ye)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Et}['"]`).test(ye))H.consumedProps?.add(lt)}let Pe=new Set(["__originalFilePath","__importedComponents",Xo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Oe={};for(let[lt,gt]of Object.entries(T))if(!lt.startsWith("__")||Pe.has(lt))Oe[lt]=gt;let Me=U.length>0?{[na]:[...U]}:{},Ne=k;if(k.includes("@include")){let{processIncludes:lt}=await _t("stx/includes",()=>import("./chunk-ajd5w5c4.js"));Ne=await lt(k,T,B,z,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ne)){let{processComponents:lt}=await _t("stx/component-renderer",()=>import("./chunk-k7spjpr0.js"));Ne=await lt(Ne,{...T,__processedComponents:ie,...Me},B,z,F)}let Le=[];if(Pi(Ne)){let{processExpressions:lt}=await _t("stx/expressions",()=>import("./chunk-3gm6013p.js")),gt=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Me}:U.length>0?{...T,...Me}:T;Ne=lt(Ne,gt,B);for(let Et of Ne.matchAll(/\{\{([\s\S]*?)\}\}/g))Le.push(Et[1].trim())}let De=gn(Ne),ze=[],Ve=De.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(lt,gt)=>{let Et=De.scripts[Number(gt)]||"",it=Et.match(/^<script\b([^>]*)>/i)?.[1]||"",Xt=it.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qt=!Xt||["module","text/javascript","application/javascript"].includes(Xt),$r=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${it}`);if(!/\bserver\b/i.test(it)&&Qt&&!$r)return ze.push(Et),"";return Et}),{extractSlotContent:Be}=await _t("stx/slots",()=>import("./chunk-1veeefpn.js")),je=Be(Ve),st={};if(je.defaultSlot?.trim())st.default=je.defaultSlot;for(let[lt,gt]of je.namedSlots)st[lt]=gt.content;let ht=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},vt=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ht.n}_${ht.key}`,dt={...Oe,$uid:vt,..._,props:_,slot:Ve,$slots:st,__processedComponents:Z,__sections:{},__stx_signals_gate:ke(ye)||Pi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Le]};v0(ye,dt);let wt=ye,kt=re(wt);if(kt)wt=kt.content.trim();let xt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,ct=[...ye.matchAll(xt)],St=[],mt=null,Kt=ct.some((lt)=>/\bserver\b/.test(lt[1]||"")&&/\bcache\b/.test(lt[1]||"")),Wn=null,Mn=null,bt=null,ft=0,$t=null;if(p0(z),Kt&&Ou>0){let lt=g0({props:_,slot:Ne,slotContext:k.trim()?m0(Oe):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...U].sort(),layers:z._layerGraph?.layers.map((gt)=>gt.configFile),uid:vt});if(lt!==null){Wn=`${ue}\x00${h(ye)}\x00${lt}`;let gt=Ka.get(Wn);if(gt){for(let Et of gt.dependencies)F.add(Et);if(Rd(T,gt.clientFactories),ht.n+=gt.uidsConsumed,gt.preservedClientExpressions.length>0){let Et=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let it of gt.preservedClientExpressions)Et.add(it);T.__stx_preserved_client_expressions=[...Et]}return gt.output}Mn=new Set(F),bt=Ed(T),ft=ht.n,$t=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Wt=new Set;for(let lt of ct){let gt=lt[1]||"",Et=lt[2]||"",it=gt.includes("server");if(Qe(gt)&&Et.trim())Et=et(Et);if(it&&Et){for(let Qt of fe(Et))Wt.add(Qt);try{await Q(Et,dt,ue,{onFailure:(Qt)=>{if(Qt.kind!=="unknown")mt=Qt.kind}})}catch(Qt){}}if(!it){let Qt=Et.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),$r=Qt.includes("{{")&&Qt.includes("}}"),Br=Qt.includes("{!!")&&Qt.includes("!!}");if($r||Br)Qt=ys(Qt,dt,ue);let ts=gt.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");St.push(`<script${ts}>${Qt}</script>`)}}let Yt=gn(ye).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),un=Yt?Yt[1]:"",Xa=Yt?Yt[2]:"",Zn="",Za=un&&/\bscoped\b/i.test(un);if(Yt)Zn=`<style${un}>${S0(Xa,dt,ue)}</style>`;let Fe=wt;if(Fe=Fe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Yt)Fe=Fe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let lt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,gt=[];if(Fe=Fe.replace(lt,(Et,it)=>{let Xt=it.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Xt)gt.push(`<style${Xt[1]}>${Xt[2]}</style>`);return""}),Fe=Fe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),gt.length>0)Zn=`${Zn}${gt.join(`
2661
+ `)}`}if(k&&Fe.includes("{{ text || slot }}"))Fe=Fe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:He}=await _t("stx/slots",()=>import("./chunk-1veeefpn.js")),{defaultSlot:pt,namedSlots:Ct}=je,Ut=St.some((lt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(lt)),rn=(lt)=>Ut?Gm(lt,vt):lt,Qr=new Map([...Ct].map(([lt,gt])=>[lt,{...gt,content:rn(gt.content)}]));Fe=await He(Fe,rn(pt),Qr,dt);let Ga=Qc(St),Do=(Array.isArray(dt.__stx_client_signal_names)?dt.__stx_client_signal_names:[]).filter((lt)=>!Wt.has(lt));if(Ga.length>0||Do.length>0)dt.__stx_client_signal_names=[...new Set([...Do,...Ga])];else delete dt.__stx_client_signal_names;let Oo=U.filter((lt)=>!Wt.has(lt)&&!(lt in _));if(Oo.length>0)dt[na]=Oo;let Mo={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:ut.dirname(ue),skipSignalsRuntime:!0,skipEventDirectives:z._nativeHostAttrs===!0||Ut||St.length===0,defaultLayout:void 0};dt.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let vr=await n(Fe,dt,ue,Mo,F),es=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let lt of vr.matchAll(/\{\{([\s\S]*?)\}\}/g))es.add(lt[1].trim());if(es.size>0)T.__stx_preserved_client_expressions=[...es];let Gn=vt,cn=vr;if(Ut){let lt="";if(Object.keys(_).length>0)try{lt=` data-stx-props="${kh(JSON.stringify(_))}"`}catch{}let gt=le?` stx-hydrate="${kh(le)}"`:"",Et=` data-stx-scope="${Gn}"${lt}${gt}`,it=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(vr),Xt=it?"span":"div";cn=Yc(vr,Et)??`<${Xt}${Et} data-stx-component-wrapper${it?' style="display:contents"':""}>${vr}</${Xt}>`;let Qt=await Promise.all(St.map(async($r)=>{let Br=$r.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Br)return $r;let[,ts,No]=Br,jn=await k0(No,ue,z.buildMode==="compile"),jo=hn(jn.clientCode,xe(dt)),{vendorStyleTags:Jn}=jn,Bi=jo?`function(__scopeId) {
2662
+ ${jo}
2663
+ return (${jn.factoryBody})(__scopeId);
2664
+ }`:jn.factoryBody,zi=le?null:ac(T,Bi),ns=zi?`window.__stxComponentFactories[${JSON.stringify(zi)}](${JSON.stringify(Gn)});`:`(${Bi})(${JSON.stringify(Gn)});`;if(le)return`${Jn}<script type="stx/island" data-stx-island="${Gn}" data-stx-scoped data-stx-owner="${Gn}"${ts}>${ns}</script>`;return`${Jn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Gn}"${ts}>${ns}</script>`}));if(cn=cn+`
2665
+ `+Qt.join(`
2666
+ `),Zn)cn+=`
2667
+ `+Zn}else{if(Zn)cn+=`
2668
+ `+Zn;if(St.length>0){let lt=dt.__stx_event_bindings||[],gt=xe(dt),Et=await Promise.all(St.map(async(it)=>{let Xt=it.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Xt)return it;return await Se(Xt[1],{eventBindings:lt,templateContent:cn,filePath:ue,projectRoot:process.cwd(),serverData:gt,instanceId:vt})}));cn+=`
2669
+ `+Et.join(`
2670
+ `),dt.__stx_event_bindings=[]}}if(Za){let lt=ca(cn,ue);if(lt.hasScoped)cn=lt.html}if(Wn&&Mn){let lt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Ka.set(Wn,{output:cn,dependencies:[...F].filter((gt)=>!Mn.has(gt)),clientFactories:bt?Cd(T,bt):[],uidsConsumed:ht.n-ft,preservedClientExpressions:$t?lt.filter((gt)=>!$t.has(gt)):[]})}if(mt)cn=`<!--stx-render-failed:${mt}-->${cn}`;return ze.length>0?`${cn}
2671
+ ${ze.join(`
2672
+ `)}`:cn}catch(ce){return`[Error processing component: ${ce instanceof Error?ce.message:String(ce)}]`}finally{ie.delete(v)}}async function r(v){return Bun.file(v).exists()}function Mu(v,_){let k=ut.resolve(_),R=ut.resolve(v),T=k.endsWith(ut.sep)?k:k+ut.sep;if(R===k||R.startsWith(T))return R;return null}async function $0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,B=ut.join(v,T);for(let z of B.endsWith(".stx")?[B]:[B,`${B}.stx`])if(await r(z)){if(R)console.log(`Found layout in ${v}: ${z}`);return k?.add(z),z}return null}async function dr(v,_,k,R){let T=await _0(v,_,k,R);if(T===null)return null;let B=Mu(T,process.cwd());if(B)return B;let z=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((W)=>typeof W==="string"&&W.length>0);for(let W of z){let F=ut.isAbsolute(W)?W:ut.resolve(process.cwd(),W);if(Mu(T,F))return ut.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function _0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=ut.dirname(_),B=process.cwd();if(v.startsWith("/")){let Q=ut.join(B,v),ie=Mu(Q,B);if(!ie)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${ie}`);if(await r(ie)&&R)R.add(ie);return ie}let z=ut.join(T,v);if(await r(z)){if(k.debug)console.log(`Found direct path: ${z}`);if(R)R.add(z);return z}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let Q of[".stx",".tsx",".jsx"]){let ie=`${z}${Q}`;if(await r(ie)){if(k.debug)console.log(`Found direct path with extension: ${ie}`);if(R)R.add(ie);return ie}}let W=[];if(W.push(...k._layerLayoutDirs??[]),k.layoutsDir)W.push(ut.isAbsolute(k.layoutsDir)?k.layoutsDir:ut.resolve(process.cwd(),k.layoutsDir));let F=ut.resolve(T),U=process.cwd();for(let Q=0;Q<10;Q++){let ie=ut.join(F,"layouts"),Z=!1;try{Z=Ih.statSync(ie,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(Z){W.push(ie);break}let ae=ut.dirname(F);if(ae===F||ae.length<U.length)break;F=ae}for(let Q of W){let ie=await $0(Q,v,R,k.debug);if(ie)return ie}if(k.fallbackLayoutsDir){let Q=ut.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:ut.resolve(process.cwd(),k.fallbackLayoutsDir),ie=v.startsWith("layouts/")?v.slice(8):v,Z=[ut.join(Q,ie)];if(!v.endsWith(".stx"))Z.push(`${Z[0]}.stx`);for(let ae of Z)if(await r(ae)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${ae}`);if(R)R.add(ae);return ae}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let Q=v.split("layouts/"),ie=ut.join(k.partialsDir||T,"layouts",Q[1]);if(await r(ie)){if(k.debug)console.log(`Found in layouts path: ${ie}`);if(R)R.add(ie);return ie}if(!ie.endsWith(".stx")){let Z=`${ie}.stx`;if(await r(Z)){if(k.debug)console.log(`Found in layouts path with extension: ${Z}`);if(R)R.add(Z);return Z}}}if(k.partialsDir){let Q=ut.join(k.partialsDir,"layouts");if(await r(Q)){let ie=ut.join(Q,v);if(await r(ie)){if(k.debug)console.log(`Found in partials layouts dir: ${ie}`);if(R)R.add(ie);return ie}if(!v.endsWith(".stx")){let Z=`${ie}.stx`;if(await r(Z)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${Z}`);if(R)R.add(Z);return Z}}}}let H=k.partialsDir||ut.join(process.cwd(),"views"),q=ut.join(H,v);if(await r(q)){if(k.debug)console.log(`Found in views path: ${q}`);if(R)R.add(q);return q}if(!v.endsWith(".stx")){let Q=`${q}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in views path with extension: ${Q}`);if(R)R.add(Q);return Q}}if(T.includes("temp")){let Q=ut.join(ut.dirname(T),"layouts",v);if(await r(Q)){if(k.debug)console.log(`Found in temp layouts dir: ${Q}`);if(R)R.add(Q);return Q}if(!v.endsWith(".stx")){let ie=`${Q}.stx`;if(await r(ie)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ie}`);if(R)R.add(ie);return ie}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function Ii(v,_,k){let R=0,T="",B="";try{if(typeof _==="number"&&_>=0){let z=v.split(`
2673
+ `),W=0;for(let F=0;F<z.length;F++)if(W+=z[F].length+1,W>=_){R=F+1,T=z[F].trim();let U=Math.max(0,F-2),H=Math.min(z.length,F+3);B=z.slice(U,H).map((q,Q)=>{let ie=U+Q+1;return`${ie===R?"> ":" "}${ie}: ${q}`}).join(`
2674
+ `);break}}else if(k){let z=v.indexOf(k);if(z>=0)return Ii(v,z)}}catch{}return{lineNumber:R,lineContent:T,context:B}}var Rt={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function g(v,_,k,R,T,B){let{lineNumber:z,context:W}=Ii(R,T,B),F=k.split("/").pop(),U=0;if(typeof T==="number"&&T>=0&&R){let q=R.lastIndexOf(`
2675
+ `,Math.max(0,T-1));U=T-(q+1)+1}let H="";if(z>0)H+=`
2676
+ ${k}:${z}${U>0?`:${U}`:""}: ${v.toLowerCase()} error: ${_}
2677
+ `;if(H+=`
2678
+ ${Rt.bold}${Rt.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Rt.reset}
2679
+ `,H+=`${Rt.bold}${Rt.red}\u2502${Rt.reset} ${Rt.bold}${Rt.bgRed} ERROR ${Rt.reset} ${Rt.red}${v} Error${Rt.reset}${" ".repeat(Math.max(0,43-v.length))}${Rt.bold}${Rt.red}\u2502${Rt.reset}
2680
+ `,H+=`${Rt.bold}${Rt.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Rt.reset}
2681
+ `,H+=`
2682
+ ${Rt.cyan}${Rt.bold}File:${Rt.reset} ${Rt.dim}${F}${Rt.reset}`,z>0)H+=` ${Rt.gray}(line ${z}${U>0?`, col ${U}`:""})${Rt.reset}`;if(H+=`
2683
+ ${Rt.yellow}${Rt.bold}Message:${Rt.reset} ${_}
2684
+ `,W)H+=`
2685
+ ${Rt.blue}${Rt.bold}Context:${Rt.reset}
2686
+ ${Rt.dim}${W}${Rt.reset}
2687
+ `;return H}function se(){Io.clear(),qa.clear(),Pu.clear(),Du.clear(),Ka.clear()}function hd(){return{size:Io.size,maxSize:500}}var Iu=m(128);async function k0(v,_,k){let R=h(v,_,k),T=Iu.get(R);if(T){if(mn(T.deps))return T;Iu.delete(R)}let B=ps(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,W=gs(B.styles);z=Pt(z).code;let{hasUserImports:F,bundleClientScript:U}=await _t("stx/client-script-bundler",()=>import("./chunk-8x2ejkcc.js")),H=[],q=!1;if(F(z)){let ce=z;z=await U(ce,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ce}let{stripStxRuntimeImports:Q}=await _t("stx/signal-processing",()=>import("./chunk-en388k3h.js"));z=Q(z);let ie=O(z),Z=y0(ie),ae=`function(__scopeId) {
2688
+ ${Vt("const",[...Ji,...Z],ie)}
2689
+ const __scope = window.stx._scopes = window.stx._scopes || {};
2690
+ const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
2691
+ __scopeVars.$refs = __scopeVars.$refs || {};
2692
+ const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
2693
+ const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
2694
+ // A clone the runtime is setting up may not be in the document yet (rows
2695
+ // a loop builds inside a closed :if), where a lookup cannot see it, so the
2696
+ // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
2697
+ const __setupRoot = window.__STX_SETUP_ROOT__;
2698
+ const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
2699
+ window.__STX_CURRENT_ELEMENT__ = __componentElement;
2700
+ let __componentProps = __componentElement && __componentElement.__stx_props;
2701
+ if (!__componentProps && __componentElement) {
2702
+ try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
2703
+ catch { __componentProps = {}; }
2704
+ }
2705
+ window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
2706
+
2707
+ // Scope-specific lifecycle callbacks. The queues drain as they run; the
2708
+ // hook lists keep what setup registered, because a component behind an :if
2709
+ // unmounts at each hide and mounts again at each show (signals.ts,
2710
+ // suspendSubtreeScopes).
2711
+ if (__scopeVars.__suspended && !__scopeVars.__mounted) {
2712
+ // Set up again after an :if hid it -- a <template :if> clones the
2713
+ // component afresh on every show, and the clone's script runs. This run's
2714
+ // hooks close over this run's state, so they replace the ones the hide
2715
+ // kept for a re-show rather than queueing beside them.
2716
+ __scopeVars.__mountCallbacks = [];
2717
+ __scopeVars.__destroyCallbacks = [];
2718
+ __scopeVars.__mountHooks = [];
2719
+ __scopeVars.__destroyHooks = [];
2720
+ }
2721
+ __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
2722
+ __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
2723
+ __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
2724
+ __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
2725
+ let __registeringSetupHooks = true;
2726
+ const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
2727
+ const onDestroy = (fn) => {
2728
+ __scopeVars.__destroyCallbacks.push(fn);
2729
+ // A teardown registered inside onMount belongs to this mount alone.
2730
+ // Replaying it AND registering the next mount's teardown doubles cleanup.
2731
+ if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
2732
+ };
2733
+
2734
+ try {
2735
+ ${ie}
2736
+
2737
+ // Register all defined signals and functions in this scope
2738
+ const __localVars = {};
2739
+ try {
2740
+ ${Z.map((ce)=>`if (typeof ${ce} !== 'undefined') __localVars['${ce}'] = ${ce};`).join(`
2741
+ `)}
2742
+ }
2743
+ catch (e) {}
2744
+ Object.assign(__scopeVars, __localVars);
2745
+ }
2746
+ finally {
2747
+ __registeringSetupHooks = false;
2748
+ window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
2749
+ window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
2750
+ }
2751
+ }`,le={vendorStyleTags:W,factoryBody:ae,clientCode:ie,deps:ef([...H,...B.styles.map((ce)=>ce.resolvedPath)])};if(!q&&B.unresolved.length===0)Iu.set(R,le);return le}var E0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function C0(v){if(v.startsWith(".")||v.startsWith("/"))return null;if(v.startsWith("@")){let k=v.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!k)return null;return{pkg:k[1],subpath:k[2]||""}}let _=v.match(/^([^/]+)(\/.*)?$/);if(!_)return null;return{pkg:_[1],subpath:_[2]||""}}function R0(v,_){let k=_;while(!0){let R=Yr.join(k,"node_modules",v,"package.json");if(Po.existsSync(R))return Yr.dirname(R);let T=Yr.dirname(k);if(T===k)return null;k=T}}function A0(v,_){if(!v||typeof v!=="object")return null;let k=(T)=>{if(typeof T==="string")return T;if(T&&typeof T==="object"){if(typeof T.import==="string")return T.import;if(typeof T.default==="string")return T.default;if(typeof T.import==="object")return k(T.import);if(typeof T.default==="object")return k(T.default)}return null};if(Object.prototype.hasOwnProperty.call(v,_))return k(v[_]);let R=null;for(let T of Object.keys(v)){let B=T.indexOf("*");if(B===-1)continue;let z=T.slice(0,B),W=T.slice(B+1);if(!_.startsWith(z)||!_.endsWith(W))continue;if(_.length<z.length+W.length)continue;if(!R||z.length>R.prefix.length)R={pattern:T,prefix:z,suffix:W}}if(R){let T=_.slice(R.prefix.length,_.length-R.suffix.length),B=k(v[R.pattern]);if(B)return B.replace("*",T)}return null}function T0(v,_){let k=C0(v);if(!k||!k.subpath)return null;let R=R0(k.pkg,_);if(!R)return null;let T;try{T=JSON.parse(Po.readFileSync(Yr.join(R,"package.json"),"utf8"))}catch{return null}let B=`.${k.subpath}`,z=A0(T.exports,B);if(!z)return null;let W=Yr.resolve(R,z);return Po.existsSync(W)?W:null}function ps(v,_){let k=_.filePath?Yr.dirname(_.filePath):_.projectRoot||process.cwd(),R=_.projectRoot||process.cwd(),T=new Set,B=[],z=[];return{code:v.replace(E0,(F,U)=>{let H;try{if(U.startsWith("./")||U.startsWith("../")||U.startsWith("/")){if(H=U.startsWith("/")?U:Yr.resolve(k,U),!Po.existsSync(H))throw Error(`file not found: ${H}`)}else{let q=null;try{q=Bun.resolveSync(U,R)}catch{q=T0(U,R)}if(!q)throw Error(`could not resolve ${U} (Bun.resolveSync + exports fallback both failed)`);H=q}}catch(q){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(U)} (from ${_.filePath||"<unknown>"}): ${q?.message||q}`),z.push(U),""}if(T.has(H))return"";T.add(H);try{let q=Po.readFileSync(H,"utf8");B.push({source:U,resolvedPath:H,contents:q})}catch(q){console.warn(`[stx:vendor-css] could not read ${H}: ${q?.message||q}`),z.push(U)}return""}),styles:B,unresolved:z}}function I0(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gs(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${I0(_.source)}" data-stx-layer="vendor">
2752
+ @layer vendor {
2753
+ ${_.contents}
2754
+ }
2755
+ </style>`).join(`
2756
+ `)}
2757
+ `}var yc=y,Dh=m(256);function Pt(v){let _=h(v),k=Dh.get(_);if(!k)k=P0(v),Dh.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function P0(v){let _=s(v),k=new Set;for(let W of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let F of W[1].split(",")){let U=F.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(U)k.add(U)}let R=Vo(_),T=K.filter((W)=>{if(k.has(W)||R.has(W))return!1;return ms(_,W,!0)}),B=jh(_).filter((W)=>!k.has(W)&&!R.has(W));if(T.length===0&&B.length===0)return{code:v,imports:T,models:B};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",B.length>0?"import '@stacksjs/browser'":"",B.length>0?`const { ${B.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2758
+ `)}
2759
+ ${v}`,imports:T,models:B}}var D0=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function jh(v){let _=new Set,k=sc(v),R=Vo(v),T=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let B of k.code.matchAll(T)){let z=B[1];if(D0.has(z)||R.has(z)||z.length<3)continue;if(k.shadows(z,B.index??0))continue;_.add(z)}return Array.from(_)}function O0(v){return Vo(v)}var Oh=m(128);function ii(v){let _=h(v),k=Oh.get(_);if(!k)k=M0(v),Oh.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function M0(v){let _=new Set,k=new Set,R=v;R=R.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let T=new Set,B=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,z;while((z=B.exec(v))!==null){let q=z[1],Q=z[2];if(z[0].includes("import type"))continue;let ie=[];for(let ae of q.split(",")){let le=ae.trim();if(!le||le.startsWith("type "))continue;let ce=le.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!ce)continue;let de=ce[1],ue=ce[2]||de;if(T.add(de),T.add(ue),Q==="stx"||Q==="@stacksjs/stx")_.add(de);else k.add(de);if(ue!==de)ie.push(`${ue} = ${de}`)}let Z=ie.length>0?`var ${ie.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";R=R.replace(z[0],Z)}let W=O0(R);for(let q of yc){if(T.has(q)||W.has(q))continue;if(ms(R,q,!0))_.add(q)}let F=s(R),U=new Set;for(let q of R.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let Q of q[1].split(",")){let ie=Q.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let Z of ie){let ae=Z.trim();if(ae)U.add(ae)}}for(let q of K){if(T.has(q)||W.has(q)||U.has(q))continue;if(ms(F,q))k.add(q)}let H=jh(F);for(let q of H)if(!T.has(q)&&!W.has(q))k.add(q);return{code:R,stxImports:Array.from(_),browserImports:Array.from(k)}}function ms(v,_,k=!1){let R=sc(v);v=R.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let B of v.matchAll(T)){let z=B.index??0;if(R.shadows(_,z))continue;let W=z+_.length,F=z-1;while(F>=0&&/\s/.test(v[F]))F--;if(v[F]==="."&&v.slice(Math.max(0,F-2),F+1)!=="...")continue;let U=W;while(U<v.length&&/\s/.test(v[U]))U++;if(v[U]===":"&&v[U+1]!==":"&&(v[F]==="{"||v[F]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(W)))continue;if(N0(v,W))continue;return!0}return!1}function N0(v,_){let k=_;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;if(v[k]!=="(")return!1;let R=0;for(;k<v.length;k++){let T=v[k];if(T==="(")R++;else if(T===")"){if(R--,R===0)break}}if(R!==0)return!1;k++;while(k<v.length&&(v[k]===" "||v[k]==="\t"))k++;return v[k]==="{"}function ai(v,_){let k=[];if(v.length>0)k.push(` var { ${v.join(", ")} } = window.stx || window;`);if(_.length>0)k.push(` var { ${_.join(", ")} } = window.StacksBrowser || {};`);if(k.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2760
+ ${k.join(`
2761
+ `)}
2762
+ ${j0(v,_)}`;return""}function Ku(v,_=[]){let{browserImports:k}=ii(v),R=new Set(_);return ai([],k.filter((T)=>!R.has(T)))}function j0(v,_){let k=[...v.map((R)=>`['${R}', typeof ${R}, 'stx']`),..._.map((R)=>`['${R}', typeof ${R}, '@stacksjs/browser']`)];if(k.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2763
+ [${k.join(", ")}].forEach(function (e) {
2764
+ if (e[1] !== 'undefined') return;
2765
+ console.error(
2766
+ '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
2767
+ + 'but the client runtime does not provide it. Either it is not exported to the browser, '
2768
+ + 'or it should be imported from a relative path so the bundler includes it.'
2769
+ );
2770
+ });
2771
+ `}function xe(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let R={};for(let T in _){let B=_[T];if(typeof B==="function")continue;R[T]=B}return R.__stxDeclaredPayload=!0,R}let k={};for(let R in v){if(R.startsWith("__")||R.startsWith("$"))continue;let T=v[R];if(typeof T==="function")continue;k[R]=T}return k}var L0=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Mh=new Set;function B0(v,_){let k=L0.test(v),R=_.length>32768;if(!k&&!R)return;if(Mh.has(v))return;if(Mh.add(v),k)console.warn(`[stx] server\u2192client bridge is publishing "${v}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(R)console.warn(`[stx] server\u2192client bridge is publishing ${(_.length/1024).toFixed(1)}KB under "${v}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function hn(v,_){if(!_)return"";let k=At(v,new Set(Object.keys(_))),R=_.__stxDeclaredPayload===!0,T=[],B=Object.entries(_).sort(([z],[W])=>z<W?-1:z>W?1:0);for(let[z,W]of B){if(!/^[A-Za-z_$][\w$]*$/.test(z))continue;if(z.startsWith("__")||z.startsWith("$"))continue;if(!R&&!k.has(z))continue;if(Ki(v,z)){if(R)console.warn(`[stx] defineClientPayload declares "${z}", but this client block also declares "${z}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${z}" from defineClientPayload.`);continue}let F;try{F=JSON.stringify(W)}catch{continue}if(F===void 0)continue;B0(z,F),T.push(` var ${z} = ${F.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2772
+ ${T.join(`
2773
+ `)}
2774
+ `}var z0={left:0,middle:1,right:2};function W0(v){let _=[];if(v.self)_.push("if ($event.target !== $el) return");for(let k of v.systemKeys)_.push(`if (!$event.${k}Key) return`);if(v.keys.length>0){let k=v.keys.map((R)=>`$event.key === '${R}'`).join(" || ");_.push(`if (!(${k})) return`)}if(v.mouse!==null){let k=z0[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function F0(v,_){let{elementId:k,event:R,modifiers:T}=v,B=tc(v.handler),z=W0(T),W=[];if(T.once)W.push("once: true");if(T.capture)W.push("capture: true");if(ec(R,T))W.push("passive: true");let F=W.length>0?`, { ${W.join(", ")} }`:"",U="";if(z)U+=`${z}; `;let H=B.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),q=`var $emit = function(name, detail) {
2775
+ $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2776
+ };`;function Q(ie){if(/\$emit\s*\(/.test(ie))return`${q}
2777
+ ${ie}`;return`var scope = $el.closest('[data-stx-scope]');
2778
+ if (scope && scope.__stx_execute) {
2779
+ scope.__stx_execute('${H}', $event, $el);
2780
+ }
2781
+ else {
2782
+ ${ie}
2783
+ }`}if(T.debounce!==null)return` ;(function() {
2784
+ // eslint-disable-next-line pickier/no-unused-vars
2785
+ var $el = document.getElementById('${k}')
2786
+ if (!$el) return
2787
+ var __timer
2788
+ $el.addEventListener('${R}', function($event) {
2789
+ ${z?z+"; ":""}clearTimeout(__timer)
2790
+ __timer = setTimeout(function() { ${Q(B)} }, ${T.debounce})
2791
+ }${F})
2792
+ })()`;if(T.throttle!==null)return` ;(function() {
2793
+ // eslint-disable-next-line pickier/no-unused-vars
2794
+ var $el = document.getElementById('${k}')
2795
+ if (!$el) return
2796
+ var __last = 0
2797
+ $el.addEventListener('${R}', function($event) {
2798
+ ${z?z+"; ":""}var __now = Date.now()
2799
+ if (__now - __last >= ${T.throttle}) {
2800
+ __last = __now
2801
+ ${Q(B)}
2802
+ }
2803
+ }${F})
2804
+ })()`;if(/\$emit\s*\(/.test(B))return` var $el = document.getElementById('${k}')
2805
+ if ($el) $el.addEventListener('${R}', function($event) {
2806
+ ${U}${q}
2807
+ ${B}
2808
+ }${F})`;return` var $el = document.getElementById('${k}')
2809
+ if ($el) $el.addEventListener('${R}', function($event) {
2810
+ ${U}var scope = $el.closest('[data-stx-scope]');
2811
+ if (scope && scope.__stx_execute) {
2812
+ scope.__stx_execute('${H}', $event, $el);
2813
+ }
2814
+ else {
2815
+ ${B}
2816
+ }
2817
+ }${F})`}function V0(v){if(v.length===0)return"";return`
2818
+ // STX: auto-generated event bindings
2819
+ ${v.map((k,R)=>F0(k,R)).join(`
2820
+ `)}`}function Nh(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let W=R[z];if(W==="'"||W==='"'||W==="`"){let F=W;if(z++,F==="`"){let U=0;while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]==="`"&&U===0){z++;break}if(R[z]==="$"&&R[z+1]==="{"){U++,z+=2;continue}if(R[z]==="}"&&U>0){U--,z++;continue}z++}}else while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]===F){z++;break}z++}continue}if(W==="/"&&R[z+1]==="/"){while(z<B&&R[z]!==`
2821
+ `)z++;continue}if(W==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(W==="{"){T++,z++;continue}if(W==="}"){T--,z++;continue}if(T===0){let F=R.slice(z),U=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let Q=U[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=U[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((Q)=>{let ie=Q.trim(),Z=ie.indexOf(":"),ae=Z>=0?ie.slice(Z+1).trim().split(/[\s=]/)[0]:ie.split(/[\s=]/)[0];if(ae&&!ae.startsWith("_")&&!k.has(ae))_.push(ae),k.add(ae)}),z+=H[0].length;continue}let q=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let Q=q[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=q[0].length;continue}}z++}return _}var U0=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function H0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(Q){let ie;while((ie=k.exec(Q))!==null){let Z=ie[0];if(!U0.has(Z))_.add(Z)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=W.exec(v))!==null)R(B[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=F.exec(v))!==null)R(B[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=U.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function Se(v,_={}){let k=v,R="",T=!1,B=[],z=ps(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let W=gs(z.styles),F=Pt(k);k=F.code,B=[...F.imports,...F.models];let{hasUserImports:U,bundleClientScript:H}=await _t("stx/client-script-bundler",()=>import("./chunk-8x2ejkcc.js"));if(U(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let ue=ii(k);k=ue.code,R=ai(ue.stxImports,ue.browserImports.filter(($e)=>!B.includes($e)))}if(R=`${hn(k,_.serverData)}${R}`,k=O(k),!T&&Qe(_.attrs||""))k=et(k);let q=V0(_.eventBindings||[]),Q=(_.attrs||"").trim(),ie=/\btype\s*=\s*["']module["']/i.test(Q),Z=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ie){let ue=Q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),$e=`type="module" data-stx-scoped${Z}${ue?` ${ue}`:""}`;return`${W}<script ${$e}>
2822
+ ${oi(`${R}${k}
2823
+ ${q}`)}
2824
+ </script>`}let ae=eo(v),le=/function __stx_setup_/.test(k),ce=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function de(ue){let $e=ue.length>0?`
2825
+ return { ${ue.join(", ")} };`:"",we=JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`);return`${W}<script data-stx-scoped data-stx-run="always"${Z}>
2826
+ window.stx.mount(function() {
2827
+ 'use strict';
2828
+ try {
2829
+ ${oi(`${R}${k}
2830
+ ${q}${$e}`)}
2831
+ } catch (error) {
2832
+ console.error(${we}, error);
2833
+ return {};
2834
+ }
2835
+ })</script>`}if(!ce&&!le){if(ae)return de(Nh(v));if(_.templateContent){let ue=Nh(v);if(ue.length>0){let $e=H0(_.templateContent);if(ue.some((ye)=>$e.has(ye)))return de(ue)}}}return`${W}<script data-stx-scoped data-stx-run="always"${Z}>
2836
+ ;(function() {
2837
+ 'use strict';
2838
+ try {
2839
+ ${oi(`${R}${k}
2840
+ ${q}`)}
2841
+ } catch (error) {
2842
+ console.error(${JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`)}, error);
2843
+ }
2844
+ })()</script>`}
2845
+ export{tr,Ue,At,M,G,m,h,mn,K,w,We,ps,gs,yc,Pt,ii,ms,ai,Ku,xe,hn,Se,ci,li,ui,hs,V,qe,ee,It,te,nr,bc,Xu,vc,Ju,wc,rr,b,Ot,ke,xc,ys,Sc,Yu,X,kc,Zu,x,Qu,Cc,ed,td,nd,rd,_c,Ec,sd,od,di,id,yn,bn,sr,Ge,Ce,ne,Dt,pe,vn,wn,_e,e,ad,pi,cd,fi,Tc,$c,Nt,xn,ld,Rc,Ac,ud,f,Ke,Mt,Xe,Je,gi,or,re,bs,vs,ws,dd,ir,pd,Sn,Ye,xs,Ss,Pc,fe,mi,hi,yi,bi,ar,ks,vi,wi,xi,Ic,Cs,L,ge,J,fd,Oc,_s,Es,Si,ki,Ts,$s,cr,Dc,Ci,_i,Nc,Ze,kn,lr,Lt,Mc,Lc,jc,Bc,Fc,u,zc,Rs,Hc,Ei,Ti,As,$i,Vc,gd,Uc,Ee,Ri,md,Ps,Is,Os,Ai,Ds,Ns,Ms,Ls,n,Wc,qc,Gc,Kc,Xc,Jc,Qe,j,et,Yc,ur,Zc,Pi,Qc,tt,r,dr,Ii,g,se,hd,pr,A,el,js,o,P,yd,bd,me};