@stacksjs/stx 0.2.607 → 0.2.611

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 (229) hide show
  1. package/dist/chunk-02dcqhzy.js +2 -0
  2. package/dist/{chunk-vw62fjpv.js → chunk-0ff64x1p.js} +3 -3
  3. package/dist/chunk-0fgp13q4.js +2 -0
  4. package/dist/chunk-0gpjks6k.js +2 -0
  5. package/dist/chunk-1239cnda.js +2 -0
  6. package/dist/chunk-1qx531pp.js +2 -0
  7. package/dist/chunk-24tx4ysv.js +2 -0
  8. package/dist/{chunk-zs3ezqy3.js → chunk-2h8xmmtk.js} +1 -1
  9. package/dist/{chunk-6xsm53pz.js → chunk-2pgvbe5x.js} +4 -4
  10. package/dist/chunk-2pkx524z.js +2 -0
  11. package/dist/{chunk-0v89nfz1.js → chunk-2y0qy214.js} +2 -2
  12. package/dist/chunk-2y80c34h.js +2 -0
  13. package/dist/{chunk-tbsjg23k.js → chunk-2z56183d.js} +4 -4
  14. package/dist/{chunk-vntpfbwy.js → chunk-34x22hbs.js} +1 -1
  15. package/dist/{chunk-qh07a85k.js → chunk-39fqkzyb.js} +3 -3
  16. package/dist/{chunk-81qmj3sd.js → chunk-3d658f6n.js} +7 -7
  17. package/dist/{chunk-cp901m61.js → chunk-3v862v2c.js} +1 -1
  18. package/dist/{chunk-5s47qfp6.js → chunk-3wmt7ykt.js} +2 -2
  19. package/dist/chunk-4j3fmxeg.js +2 -0
  20. package/dist/{chunk-y54fz9rk.js → chunk-4rtxkqwh.js} +2 -2
  21. package/dist/chunk-5f330rrj.js +2 -0
  22. package/dist/{chunk-s4pjf2pc.js → chunk-5rtatjwq.js} +2 -2
  23. package/dist/{chunk-wzjf33es.js → chunk-5vnx8dmz.js} +2 -2
  24. package/dist/chunk-5ys7azpj.js +2 -0
  25. package/dist/chunk-64vnwrkw.js +2 -0
  26. package/dist/chunk-65jsp5fd.js +3 -0
  27. package/dist/{chunk-bsy8v1xj.js → chunk-66e4ga0z.js} +3 -3
  28. package/dist/{chunk-4tj0ap61.js → chunk-6yrjyrc2.js} +5 -5
  29. package/dist/{chunk-td5100fz.js → chunk-70n1t4ht.js} +7 -7
  30. package/dist/chunk-7446n6a3.js +2 -0
  31. package/dist/{chunk-y8h823cb.js → chunk-74j18qk0.js} +28 -28
  32. package/dist/chunk-76ebcf61.js +2 -0
  33. package/dist/chunk-7aa4qncj.js +2 -0
  34. package/dist/chunk-7awf2gqs.js +2 -0
  35. package/dist/{chunk-dxqwm8tr.js → chunk-7g47wdd9.js} +3 -3
  36. package/dist/{chunk-m9h7pmkh.js → chunk-8211vr9v.js} +5 -5
  37. package/dist/chunk-84f8tft8.js +2 -0
  38. package/dist/{chunk-yzj55rfs.js → chunk-8f616tym.js} +3 -3
  39. package/dist/chunk-8t8wf1w2.js +2 -0
  40. package/dist/chunk-961nvcxw.js +43 -0
  41. package/dist/{chunk-xjxc4q3w.js → chunk-999d4sns.js} +21 -21
  42. package/dist/{chunk-r4h8fg1x.js → chunk-9dx519z6.js} +1 -1
  43. package/dist/{chunk-dnqq1ze0.js → chunk-9kzdk4na.js} +3 -3
  44. package/dist/chunk-9mmy9m0y.js +2 -0
  45. package/dist/{chunk-bhf9yt2w.js → chunk-9n7ehv7w.js} +2 -2
  46. package/dist/{chunk-dmdhbwmn.js → chunk-9nh7vxk1.js} +3 -3
  47. package/dist/chunk-9vxdjpn5.js +2 -0
  48. package/dist/chunk-aw79nm5c.js +127 -0
  49. package/dist/chunk-brbybne9.js +2 -0
  50. package/dist/chunk-cg8hg6cs.js +3 -0
  51. package/dist/{chunk-azpkje69.js → chunk-cjrfazzb.js} +34 -10
  52. package/dist/chunk-cjvq46n8.js +3 -0
  53. package/dist/chunk-cwvazqab.js +2 -0
  54. package/dist/{chunk-67tpacz0.js → chunk-cwxkgbck.js} +1 -1
  55. package/dist/chunk-d17mhbz9.js +2850 -0
  56. package/dist/{chunk-vp3fzjsc.js → chunk-det49x62.js} +2 -2
  57. package/dist/{chunk-tydv84gj.js → chunk-dtt7k0bz.js} +2 -2
  58. package/dist/{chunk-ev6w9c69.js → chunk-e98jqwnf.js} +1 -1
  59. package/dist/{chunk-8fq6bvnw.js → chunk-eg5yfnrn.js} +33 -33
  60. package/dist/chunk-ekfmad19.js +2 -0
  61. package/dist/{chunk-ghdyqt98.js → chunk-ewsd3apq.js} +2 -2
  62. package/dist/chunk-exwjabr5.js +2 -0
  63. package/dist/chunk-f19bzr36.js +2 -0
  64. package/dist/{chunk-5e182xqt.js → chunk-f8tts10s.js} +1 -1
  65. package/dist/chunk-fa0aa98d.js +2 -0
  66. package/dist/chunk-fgrjv29d.js +18 -0
  67. package/dist/chunk-fjx1sbg2.js +2 -0
  68. package/dist/{chunk-sswjv8p9.js → chunk-g22q68ds.js} +2 -2
  69. package/dist/chunk-g24kapd5.js +2 -0
  70. package/dist/{chunk-g04y5wyn.js → chunk-gbk2dbt1.js} +4 -4
  71. package/dist/{chunk-rmv35cx0.js → chunk-gk4c8d1c.js} +2 -2
  72. package/dist/{chunk-aestp72s.js → chunk-gn75qghq.js} +1 -1
  73. package/dist/chunk-gvv4d0tp.js +2 -0
  74. package/dist/chunk-h3fr7c5y.js +2 -0
  75. package/dist/{chunk-g63ye3fe.js → chunk-h3tzc41t.js} +2 -2
  76. package/dist/{chunk-vehtypx0.js → chunk-h7y89m22.js} +2 -2
  77. package/dist/{chunk-1jxdkp8x.js → chunk-hj49vk9e.js} +6 -6
  78. package/dist/chunk-hjp38m0w.js +3 -0
  79. package/dist/chunk-hwt7pyqt.js +2 -0
  80. package/dist/{chunk-x8q5przn.js → chunk-hxzy2t7r.js} +11 -11
  81. package/dist/{chunk-tcd2zez3.js → chunk-j18z5nxq.js} +2 -2
  82. package/dist/chunk-jp1xjh1f.js +2 -0
  83. package/dist/chunk-jrccxnbt.js +2 -0
  84. package/dist/chunk-jv3rdes9.js +2 -0
  85. package/dist/chunk-k36ve5ct.js +2 -0
  86. package/dist/chunk-k5vytrbx.js +2 -0
  87. package/dist/chunk-k7vg01vv.js +2 -0
  88. package/dist/chunk-kayh4pcw.js +2 -0
  89. package/dist/chunk-myg6gz76.js +2 -0
  90. package/dist/{chunk-jpxekhdh.js → chunk-n05hxy7w.js} +3 -3
  91. package/dist/{chunk-t9t66sz4.js → chunk-n1qr6n92.js} +6 -6
  92. package/dist/{chunk-77kpsnf6.js → chunk-n4f3fzp5.js} +85 -85
  93. package/dist/chunk-n6tspwf9.js +2 -0
  94. package/dist/{chunk-z2xrwmjr.js → chunk-nd8yx3qq.js} +10 -10
  95. package/dist/chunk-nfdma5hp.js +2 -0
  96. package/dist/chunk-ng819bkf.js +2 -0
  97. package/dist/{chunk-kxjd6e2h.js → chunk-pc15w7bb.js} +2 -2
  98. package/dist/{chunk-z8fhtym2.js → chunk-pkgmyg4r.js} +2 -2
  99. package/dist/{chunk-53y4z4p2.js → chunk-pm1gnjs5.js} +3 -3
  100. package/dist/{chunk-6by8dtan.js → chunk-pmpqzqq8.js} +2 -2
  101. package/dist/chunk-pnyxqze0.js +2 -0
  102. package/dist/{chunk-cfpenvc7.js → chunk-pyqrj2wk.js} +3 -3
  103. package/dist/chunk-qa5c5x2n.js +2 -0
  104. package/dist/chunk-qqenm7pg.js +40 -0
  105. package/dist/{chunk-5j29466h.js → chunk-r4xnqag4.js} +2 -2
  106. package/dist/chunk-r8a96bbd.js +2 -0
  107. package/dist/{chunk-1dd4qefr.js → chunk-s5s1w8na.js} +2 -2
  108. package/dist/chunk-sakagfdq.js +2 -0
  109. package/dist/chunk-sj0bkdy8.js +2 -0
  110. package/dist/chunk-spkwmfbm.js +2 -0
  111. package/dist/chunk-swv69q75.js +4 -0
  112. package/dist/{chunk-ktvr45qg.js → chunk-t61vdbje.js} +6 -6
  113. package/dist/{chunk-tfjcs55e.js → chunk-tk50q4zs.js} +12 -12
  114. package/dist/chunk-v6xk1q66.js +2 -0
  115. package/dist/{chunk-60wedefh.js → chunk-vep8d57h.js} +1 -1
  116. package/dist/chunk-vfk3vn6j.js +2 -0
  117. package/dist/{chunk-bspryr4a.js → chunk-vyjwag3f.js} +9 -9
  118. package/dist/{chunk-w8g2ppnr.js → chunk-w0h27sf8.js} +2 -2
  119. package/dist/chunk-w1szscbz.js +2 -0
  120. package/dist/{chunk-20k77e2a.js → chunk-wa26bn4s.js} +4 -4
  121. package/dist/chunk-wb9rbwb1.js +2 -0
  122. package/dist/{chunk-td30jg06.js → chunk-wdy6y0fq.js} +2 -2
  123. package/dist/chunk-wkx2m2br.js +2 -0
  124. package/dist/{chunk-mvwcf4xy.js → chunk-wyndxr8w.js} +4 -4
  125. package/dist/chunk-x73w6v8m.js +2 -0
  126. package/dist/{chunk-79edpvb2.js → chunk-x8y7yqwh.js} +7 -7
  127. package/dist/{chunk-7095f0hb.js → chunk-xap2cbkd.js} +9 -9
  128. package/dist/{chunk-wqmm1qsz.js → chunk-xh98677z.js} +5 -5
  129. package/dist/chunk-yagzr2ry.js +2 -0
  130. package/dist/chunk-yda8t21j.js +2 -0
  131. package/dist/{chunk-efy3038a.js → chunk-ydz9j0d3.js} +2 -2
  132. package/dist/chunk-yydx0sfy.js +2 -0
  133. package/dist/{chunk-r69jfs59.js → chunk-z79gnz6z.js} +1 -1
  134. package/dist/{chunk-c65q0svd.js → chunk-z7ezxqmg.js} +5 -5
  135. package/dist/{chunk-k3f4044e.js → chunk-zatgmkx7.js} +2 -2
  136. package/dist/chunk-zg0z8qt6.js +2 -0
  137. package/dist/{chunk-0cb00ys2.js → chunk-znwnacwz.js} +5 -5
  138. package/dist/cli.js +46 -46
  139. package/dist/craft-entry.js +2 -2
  140. package/dist/craft.js +2 -2
  141. package/dist/expressions.d.ts +0 -23
  142. package/dist/expressions.js +14 -11
  143. package/dist/includes.js +6 -0
  144. package/dist/native/compiler/component-mapping.js +1 -0
  145. package/dist/native/compiler/headwind-to-style.js +17 -0
  146. package/dist/native/compiler/html-to-ir.js +1 -0
  147. package/dist/native/compiler/inline-style.js +2 -0
  148. package/dist/native/compiler/ir.d.ts +2 -0
  149. package/dist/native/components/primitives.d.ts +33 -9
  150. package/dist/native/components/primitives.js +1 -0
  151. package/dist/native/primitives/MapPolygon.stx +2 -0
  152. package/dist/native/prop-names.js +1 -3
  153. package/dist/native/runtime/craft-bridge.js +22 -1
  154. package/dist/native/runtime/craft.d.ts +10 -0
  155. package/dist/process.js +3 -2
  156. package/dist/pwa.js +3 -3
  157. package/dist/script-validation.js +4 -4
  158. package/dist/serve.js +5 -1
  159. package/dist/ssg.js +13 -13
  160. package/dist/utils.js +15 -2
  161. package/package.json +5 -5
  162. package/dist/chunk-06wv8qwy.js +0 -40
  163. package/dist/chunk-0d6b3eeb.js +0 -2
  164. package/dist/chunk-0mgth7cm.js +0 -2
  165. package/dist/chunk-1fdrhfc0.js +0 -2
  166. package/dist/chunk-2n59ahd9.js +0 -2
  167. package/dist/chunk-2pwjnydp.js +0 -2
  168. package/dist/chunk-2r4an7bh.js +0 -2
  169. package/dist/chunk-304vaxnk.js +0 -2
  170. package/dist/chunk-32hr3qq7.js +0 -2
  171. package/dist/chunk-36n8yz6t.js +0 -2
  172. package/dist/chunk-39pgf5z3.js +0 -2
  173. package/dist/chunk-3xwzd9wp.js +0 -2845
  174. package/dist/chunk-3yttgk0s.js +0 -2
  175. package/dist/chunk-4ck2xc8m.js +0 -2
  176. package/dist/chunk-4jasfhh6.js +0 -2
  177. package/dist/chunk-4szajb1z.js +0 -2
  178. package/dist/chunk-61ztfana.js +0 -127
  179. package/dist/chunk-7f63z4xx.js +0 -2
  180. package/dist/chunk-7renf4zp.js +0 -2
  181. package/dist/chunk-8bzx0r0x.js +0 -2
  182. package/dist/chunk-974dxazw.js +0 -2
  183. package/dist/chunk-9fpnnfr3.js +0 -2
  184. package/dist/chunk-9sgt7v77.js +0 -2
  185. package/dist/chunk-9zzhpp2a.js +0 -2
  186. package/dist/chunk-aan7601v.js +0 -2
  187. package/dist/chunk-b4tbqz8r.js +0 -2
  188. package/dist/chunk-bakxqwnz.js +0 -2
  189. package/dist/chunk-be2kmw0p.js +0 -2
  190. package/dist/chunk-bnpb6ez9.js +0 -2
  191. package/dist/chunk-c48mh4d6.js +0 -18
  192. package/dist/chunk-dzbkgsv8.js +0 -4
  193. package/dist/chunk-ewkza45r.js +0 -2
  194. package/dist/chunk-exd1h9sd.js +0 -2
  195. package/dist/chunk-fcgf8d5k.js +0 -2
  196. package/dist/chunk-gw2dvp35.js +0 -2
  197. package/dist/chunk-h9drxwva.js +0 -2
  198. package/dist/chunk-hrr7k1qc.js +0 -2
  199. package/dist/chunk-j04brkj0.js +0 -2
  200. package/dist/chunk-jbvwg4gs.js +0 -2
  201. package/dist/chunk-jshj69dy.js +0 -2
  202. package/dist/chunk-k4wkfhvz.js +0 -2
  203. package/dist/chunk-km9a5gp4.js +0 -2
  204. package/dist/chunk-m95zjk91.js +0 -3
  205. package/dist/chunk-mgj0ngyq.js +0 -2
  206. package/dist/chunk-n35yc890.js +0 -3
  207. package/dist/chunk-n39ezmxz.js +0 -2
  208. package/dist/chunk-n8eavnxf.js +0 -2
  209. package/dist/chunk-p8sv5fqs.js +0 -2
  210. package/dist/chunk-pghtgep5.js +0 -2
  211. package/dist/chunk-pt7e0be5.js +0 -2
  212. package/dist/chunk-q40ahbjs.js +0 -2
  213. package/dist/chunk-qjxxhdv7.js +0 -2
  214. package/dist/chunk-rp93n4z7.js +0 -3
  215. package/dist/chunk-rrw2jg26.js +0 -2
  216. package/dist/chunk-rxja040z.js +0 -2
  217. package/dist/chunk-sx0qbekt.js +0 -2
  218. package/dist/chunk-t83acmv2.js +0 -2
  219. package/dist/chunk-tc176d93.js +0 -2
  220. package/dist/chunk-wjhhb6dn.js +0 -2
  221. package/dist/chunk-wm8w2721.js +0 -2
  222. package/dist/chunk-wtax276j.js +0 -2
  223. package/dist/chunk-wy53pys4.js +0 -43
  224. package/dist/chunk-x49qdt4c.js +0 -2
  225. package/dist/chunk-y0zyzbjf.js +0 -2
  226. package/dist/chunk-yn2d8x8m.js +0 -3
  227. package/dist/chunk-z8mdsjzw.js +0 -2
  228. package/dist/chunk-zg87pybq.js +0 -2
  229. package/dist/chunk-zq345s76.js +0 -2
@@ -0,0 +1,2850 @@
1
+ // @bun
2
+ import{Bn,y,Yi,Wt,to,Zi,Qi,ea,ta}from"./chunk-g22q68ds.js";import{I}from"./chunk-66e4ga0z.js";import{t,U,W,i,ie,Zs,O,Vt,Mn,Qs,l,p,Ji,D,Pe,lt,c,_r}from"./chunk-qqenm7pg.js";import{zn,Hn,Ar,Oe}from"./chunk-cjrfazzb.js";import{S,Ks,at,Xs,Ui,Rn,An,Wi,Ae,qi,Pn,Gi,Ht,Js,Ki,In,Dn,Sr,ve,Ys,we,kr}from"./chunk-hxzy2t7r.js";import{Us,Ws,qs,Gs,br,vr}from"./chunk-70n1t4ht.js";import{zi,zs,mr,hr}from"./chunk-2pgvbe5x.js";import{ye,zt,yr,Vs,C,ot}from"./chunk-9n7ehv7w.js";import{$n}from"./chunk-s5s1w8na.js";import{io}from"./chunk-gk4c8d1c.js";import{Di,Ni,Li,ji}from"./chunk-9kzdk4na.js";import{st}from"./chunk-det49x62.js";import{s,$e}from"./chunk-wa26bn4s.js";import{Ft,Vi,En,a,Tn}from"./chunk-cjvq46n8.js";import{u}from"./chunk-cg8hg6cs.js";import{E,N,Ln,eo}from"./chunk-zatgmkx7.js";import{Pr}from"./chunk-3wmt7ykt.js";import es from"path";import Oo from"fs";var Wh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function tc(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Wh.has(v.toLowerCase())}var sd=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"]),id={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"},Fh=new Set(["ctrl","alt","shift","meta"]),cd={left:0,middle:1,right:2};function od(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(Fh.has(R))_.systemKeys.push(R);else if(R in cd)_.mouse=R;else if(R in id||/^[a-z]$/.test(R))_.keys.push(id[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 ld(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,F,H]=B,q=B.index,K=q+z.length,G=`__stx_evt_${_}${R++}`,ee=[],ae=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,Q;while((Q=ae.exec(H))!==null){let[,ue,le]=Q,pe=ue.split("."),de=pe[0];if(!sd.has(de))continue;ee.push({attribute:`@${ue}`,event:de,handler:le,modifiers:od(pe.slice(1)),elementId:G})}let ce=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((Q=ce.exec(H))!==null){let[,ue,le]=Q,pe=ue.split("."),de=pe[0];if(!sd.has(de))continue;ee.push({attribute:`@${ue}`,event:de,handler:le,modifiers:od(pe.slice(1)),elementId:G})}if(ee.length>0)k.push({originalTag:z,elementId:G,events:ee,startIndex:q,endIndex:K})}return k}function Vh(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=cd[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Uh(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function nc(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Hh(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Vh(v),T=Uh(nc(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(tc(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",F=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('${F}', null, $el);
10
+ }
11
+ else {
12
+ __stx_runHandler('${F}', 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('${F}', null, $el);
27
+ }
28
+ else {
29
+ __stx_runHandler('${F}', 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('${F}', $event, $el);
50
+ }
51
+ else {
52
+ // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
+ __stx_runHandler('${F}', $event, $el);
54
+ }
55
+ }${z});
56
+ })();`}function rc(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(Hh).join(`
112
+ `)}
113
+ })();
114
+ </script>`}function qh(v,_=""){let k=ld(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],F=z.originalTag;if(!F.includes(" id="))F=F.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let H=F.match(/id=["']([^"']+)["']/);if(H)for(let q of z.events)q.elementId=H[1]}for(let H of z.events){let q=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");F=F.replace(K,""),F=F.replace(G,"")}R=R.slice(0,z.startIndex)+F+R.slice(z.endIndex),T.push(...z.events)}return{template:R,bindings:T}}function ad(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function ud(v,_,k){if(Zi(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:F,bindings:H}=qh(v,ad(_)),q=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...q,...H],F}let R=ld(v,ad(_));if(R.length===0)return v;let T=v;for(let F=R.length-1;F>=0;F--){let H=R[F],q=H.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${H.elementId}"`);else{let K=q.match(/id=["']([^"']+)["']/);if(K)for(let G of H.events)G.elementId=K[1]}for(let K of H.events){let G=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ee=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),ae=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");q=q.replace(ee,""),q=q.replace(ae,"")}T=T.slice(0,H.startIndex)+q+T.slice(H.endIndex)}let B=rc(R.flatMap((F)=>F.events)),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
115
+ `+T.slice(z);else T+=B;return T}function dd(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 no(v,_){let k=s(v),{depths:R,balanced:T}=$e(k),B=(F)=>!T||R[F]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let F of k.matchAll(z)){let H=(F.index??0)+F[0].length-F[1].length;if(B(H))return!0}for(let F of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(F.index??0)&&dd(F[1],!0).has(_))return!0;for(let F of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(F.index??0)&&dd(F[1],!1).has(_))return!0;return!1}var fd="",Fo,Cr=/^[A-Za-z_$][\w$]*$/,Kh=new Set(["if","for","while","switch","with"]),pd=["(","[","{"],gd=[")","]","}"],Xh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Zh(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 sc(v){if(Fo&&v===fd)return Fo;let{code:_,tokens:k}=Zh(v),R=new Map,T=[];for(let Q=0;Q<k.length;Q++){let ce=k[Q].text;if(["(","[","{"].includes(ce))T.push(Q);else if([")","]","}"].includes(ce)){let ue=T.at(-1);if(ue!==void 0&&["()","[]","{}"].includes(k[ue].text+ce))T.pop(),R.set(ue,Q),R.set(Q,ue)}}function B(Q,ce){let ue=[],le=Q;for(let pe=Q;pe<ce;pe++){if(["(","[","{"].includes(k[pe].text)&&(R.get(pe)??ce)<ce){pe=R.get(pe);continue}if(k[pe].text===",")ue.push([le,pe]),le=pe+1}return ue.push([le,ce]),ue}let z=[];function F(Q,ce,ue,le=!1){if(k[Q]?.text==="...")Q++;if(Q>=ce)return;let pe=k[Q].text;if(Cr.test(pe)){if(ue.add(pe),ue===K)z.push({name:pe,token:Q,functionScoped:le});return}if(pe!=="{"&&pe!=="[")return;let de=R.get(Q);if(de===void 0||de>=ce)return;for(let[Re,be]of B(Q+1,de)){let xe=Re;if(pe==="{")for(let Ie=Re;Ie<be;Ie++){if(k[Ie].text===":"){xe=Ie+1;break}if(k[Ie].text==="=")break;if(["(","[","{"].includes(k[Ie].text)&&R.has(Ie))Ie=R.get(Ie)}F(xe,be,ue,le)}}function H(Q,ce){let ue=new Set;for(let[le,pe]of B(Q,ce))F(le,pe,ue);return ue}function q(Q){let ce=Q;for(;ce<k.length;ce++){let ue=k[ce].text;if(["(","[","{"].includes(ue)&&R.has(ce)){ce=R.get(ce);continue}if([",",";",")","]","}"].includes(ue))break}return k[Math.max(Q,ce-1)]?.end??_.length}let K=new Set,G=[];for(let Q=0;Q<k.length;Q++)if(k[Q].text==="=>"){let ce=Q-1,ue=ce,le;if(k[ce]?.text===")"&&R.has(ce))ue=R.get(ce),le=H(ue+1,ce);else if(k[ce]&&Cr.test(k[ce].text))le=new Set([k[ce].text]);else continue;let pe=Q+1,de=k[pe]?.text==="{"&&R.has(pe)?k[R.get(pe)].end:q(pe);G.push({start:k[ue].start,end:de,bodyStart:k[pe]?.start??de,functionBody:!0,names:le})}else if(k[Q].text==="("&&R.has(Q)){let ce=k[Q-1]?.text;if(!ce||Kh.has(ce)||!Cr.test(ce)&&ce!=="*"&&ce!=="]")continue;let ue=R.get(Q),le=ue+1;if(k[le]?.text===":"){le++;while(le<k.length&&!["{","=>",";","="].includes(k[le].text))le++}if(k[le]?.text!=="{"||!R.has(le))continue;G.push({start:k[Q].start,end:k[R.get(le)].end,bodyStart:k[le].start,functionBody:ce!=="catch",names:H(Q+1,ue)})}function ee(Q){let ce=Q;for(;ce<k.length;ce++){let ue=k[ce].text;if(pd.includes(ue)&&R.has(ce)){ce=R.get(ce);continue}if(ue===";"||gd.includes(ue))break;let le=k[ce-1];if(ce>Q&&Xh.has(ue)&&le.text!==".")break;if(ce>Q&&/[\n\r]/.test(_.slice(le.end,k[ce].start))&&(/^[\w$]+$/.test(le.text)||gd.includes(le.text)||['"',"'","`"].includes(le.text))&&Cr.test(ue)&&!["in","of","instanceof"].includes(ue))break}return ce}let ae=[];for(let Q=0;Q<k.length;Q++){if(k[Q].text!=="for")continue;let ce=k[Q+1]?.text==="await"?Q+2:Q+1;if(k[ce]?.text!=="("||!R.has(ce))continue;let ue=R.get(ce),le=ue+1,pe=k[le]?.text==="{"&&R.has(le)?R.get(le):ee(le),de=k[pe]?.text===";"||k[pe]?.text==="}"?k[pe].end:k[Math.max(le,pe-1)]?.end??_.length;ae.push({headStart:ce,headEnd:ue,start:k[ce].start,end:de})}for(let Q=0;Q<k.length;Q++){let ce=k[Q].text,ue=k[Q-1]?.text;if(ue==="."||k[Q+1]?.text===":")continue;if(ue==="as"||ue==="<")continue;if(ce==="const"||ce==="let"||ce==="var"){let le=ee(Q+1),pe=Q+1,de=!1,Re=!1,be=0;for(let xe=Q+1;xe<=le;xe++){let Ie=k[xe]?.text;if(xe<le&&pd.includes(Ie)&&R.has(xe)&&R.get(xe)<le){xe=R.get(xe);continue}if(xe<le&&Ie===":"&&!Re)de=!0;else if(xe<le&&Ie==="="&&be===0)de=!1,Re=!0;else if(xe<le&&de&&Ie==="<")be++;else if(xe<le&&de&&Ie===">"&&be>0)be--;else if(xe===le||Ie===","&&be===0)F(pe,xe,K,ce==="var"),pe=xe+1,de=!1,Re=!1}}else if(ce==="function"||ce==="class"){let le=Q+1;if(k[le]?.text==="*")le++;if(k[le]&&Cr.test(k[le].text)&&k[le].text!=="extends")K.add(k[le].text),z.push({name:k[le].text,token:le})}else if(ce==="import"){let le=Q+1;if(k[le]?.text==="*"&&k[le+1]?.text==="as")le+=2;let pe=k[le]?.text;if(pe&&Cr.test(pe)&&pe!=="type"&&k[le+1]?.text!=="("&&k[le+1]?.text!==".")K.add(pe),z.push({name:pe,token:le,file:!0});let de=k[le]?.text==="{"?le:k[le+1]?.text===","&&k[le+2]?.text==="{"?le+2:-1;if(de!==-1&&R.has(de)){let Re=R.get(de);for(let[be,xe]of B(de+1,Re)){let Ie=xe-1;while(Ie>=be&&!Cr.test(k[Ie].text))Ie--;if(Ie>=be&&k[Ie].text!=="type")z.push({name:k[Ie].text,token:Ie,file:!0})}}}}return fd=v,Fo={code:_,scopes:G,loops:ae,declarations:K,sites:z,tokens:k,pairs:R},Fo}function ic(v){let _=sc(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(sc(v).declarations)}function It(v,_){let{scopes:k,loops:R,sites:T,tokens:B,pairs:z}=sc(v),F=Array.from({length:B.length},()=>-1),H=[];for(let ae=0;ae<B.length;ae++){F[ae]=H.length?H[H.length-1]:-1;let Q=B[ae].text;if(Q==="{"&&z.has(ae))H.push(ae);else if(Q==="}"&&H.length&&z.get(ae)===H[H.length-1])H.pop()}let q=new Set,K=new Map;for(let ae of T){if(!_.has(ae.name))continue;q.add(ae.token);let Q=ae.file?-1:F[ae.token],ce=Q===-1?[0,Number.POSITIVE_INFINITY]:[B[Q].start,B[z.get(Q)].end];if(ae.functionScoped){let le=B[ae.token].start,pe=k.filter((de)=>de.functionBody&&le>=de.bodyStart&&le<de.end).sort((de,Re)=>de.end-de.bodyStart-(Re.end-Re.bodyStart))[0];ce=pe?[pe.bodyStart,pe.end]:[0,Number.POSITIVE_INFINITY]}else if(!ae.file){let le=R.filter((pe)=>ae.token>pe.headStart&&ae.token<pe.headEnd).sort((pe,de)=>pe.headEnd-pe.headStart-(de.headEnd-de.headStart))[0];if(le)ce=[le.start,le.end]}let ue=K.get(ae.name);if(ue)ue.push(ce);else K.set(ae.name,[ce])}let G=new Set;for(let ae=0;ae<B.length;ae++){if(B[ae].text!=="import"||B[ae-1]?.text===".")continue;let Q=ae+1;if(B[Q]?.text==="type")Q++;if(B[Q]&&Cr.test(B[Q].text)&&B[Q+1]?.text===",")Q+=2;if(B[Q]?.text==="{"&&z.has(Q))for(let ce=Q+1;ce<z.get(Q);ce++)G.add(ce)}let ee=new Set;for(let ae=0;ae<B.length;ae++){let Q=B[ae].text;if(!_.has(Q)||ee.has(Q)||q.has(ae)||G.has(ae))continue;let ce=B[ae-1]?.text;if(ce==="#"||ce==="."&&B[ae-2]?.text!=="..")continue;if(B[ae+1]?.text===":"&&(ce==="{"||ce===","))continue;let ue=B[ae].start;if(K.get(Q)?.some(([le,pe])=>ue>=le&&ue<pe))continue;if(k.some((le)=>ue>=le.start&&ue<le.end&&le.names.has(Q)))continue;ee.add(Q)}return ee}import Uo from"fs";import en from"path";function pn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var md=new Map;function Ho(v,_=!0){let k=md.get(v);if(_&&k)return k;let R=new Map,T=[en.join(v,"src"),en.join(v,"dist"),v];function B(z,F){if(F>6)return;let H;try{H=Uo.readdirSync(z,{withFileTypes:!0})}catch{return}for(let q of H){let K=en.join(z,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;B(K,F+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let G=q.name.slice(0,-4);if(!R.has(G))R.set(G,K);let ee=G.toLowerCase();if(!R.has(ee))R.set(ee,K);let ae=pn(G);if(!R.has(ae))R.set(ae,K)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)md.set(v,R);return R}function qo(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=en.join(k,"node_modules",v);try{if(Uo.statSync(R).isDirectory())return R}catch{}let T=en.dirname(k);if(T===k)return null;k=T}}function Ko(v,_,k={}){return[en.resolve(en.dirname(_),`${v}.stx`),en.resolve(en.dirname(_),v),en.resolve(k.componentsDir||"components",`${v}.stx`),en.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function hd(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=pn(_);return[_,k,R]}function oc(v,_){let[k,R,T]=hd(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*ac(v,_,k={},R){let T=hd(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield en.resolve(en.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((H)=>`${H}.stx`))],z=k.projectRoot||process.cwd(),F=[...R?.__originalFilePath?[en.join(en.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],en.join(en.dirname(_),"components"),en.resolve(z,"src/components"),en.resolve(z,"components"),...import.meta.dir?[en.resolve(import.meta.dir,"components")]:[]];for(let H of new Set(F)){for(let q of B)yield en.join(H,q);try{for(let q of Uo.readdirSync(H,{withFileTypes:!0}))if(q.isDirectory())for(let K of B)yield en.join(H,q.name,K)}catch{}}}function yd(v,_,k={},R){let T=oc(v,R);if(T!==void 0)return T;for(let B of ac(v,_,k,R))try{if(Uo.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import Ph from"fs";import ft from"path";import{createHash as Gh}from"crypto";var Xo="__stx_component_client_factories";function Zo(v){let _=v[Xo];return _ instanceof Map?_:null}function bd(v){v[Xo]=new Map}function cc(v,_){let k=Zo(v);if(!k)return null;let R=Gh("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 vd(v,_){let k=Zo(_);if(!k?.size)return v;let R=new Map;for(let[K,G]of k)if(G.instances===1)R.set(K,G.body);let T=[];if(R.size>0){let K=[...R.keys()].map((ae)=>JSON.stringify(ae).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${K})\\]\\(("[^"]+")\\);`,"g"),ee=G.exec(v);while(ee!==null){let ae=R.get(JSON.parse(ee[1]));if(ae!==void 0)T.push({start:ee.index,end:ee.index+ee[0].length,replacement:`(${ae})(${ee[2]});`});ee=G.exec(v)}}let B=[...k].filter(([,K])=>K.instances>1);if(B.length===0)return xd(v,T);let F=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
116
+ (function() {
117
+ const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
118
+ ${B.map(([K,G])=>` try { factories[${JSON.stringify(K)}] = factories[${JSON.stringify(K)}] || ${G.body}; }
119
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(K)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
120
+ `)}
121
+ })();
122
+ </script>`,H=v.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i),q=H<0?0:H;return T.push({start:q,end:q,replacement:`${F}
123
+ `}),xd(v,T)}function xd(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 wd(v){let _=Zo(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function Sd(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 $d(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)cc(v,k)}import Nd from"fs";var _d=0,lc=new Map;function li(){_d=0,lc.clear()}function Go(v,_){let k=_d++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return lc.set(R,{type:v,expression:_}),R}function di(){let v={};for(let[_,k]of lc)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 ys(v){return v.includes("<!--__STX_")}var Jh=/@(?=[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 Yh(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function kd(v){return v.replace(/\{{2,}/g,(_)=>Yh(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Jh,"&#64;")}function Ed(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 F=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(z);if(F)return{kind:"attribute",name:F[1],quote:'"',valuePrefix:F[2]};let H=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(z);if(H)return{kind:"attribute",name:H[1],quote:"'",valuePrefix:H[2]};let q=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(z);if(q)return{kind:"attribute",name:q[1],quote:null,valuePrefix:q[2]};return T>=0||/^\s*[^<>]*$/.test(z)?{kind:"tag"}:null}class er extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var Cd="unsafe:";var Qh=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ey=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ty=/^data:(?:text\/html|application\/xhtml\+xml)/,ny=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ry(v){return v.replace(ny,"").toLowerCase()}function uc(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=ry(v);if(Qh.test(k))return!0;return _==="navigable"?ey.test(k):ty.test(k)}function ro(v,_="navigable"){return Jo(v,_)?"unsafe:"+v:v}function sy(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return uc(_[1])}function Rd(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 Ad(v,_,k=_){let R=sy(v);return R&&Jo(_,R)?"unsafe:"+k:k}var Yo=/<script\b[^>]*>/iy,gc=/<\/script\s*>/ig,Qo=/<style\b[^>]*>/iy,mc=/<\/style\s*>/ig;function Td(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 Td(v,_,Yo,gc)}function cs(v,_){return Td(v,_,Qo,mc)}function Ge(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Id(v,_){if(v.startsWith("<!--",_)){let T=Ge(v,_);return T===-1?v.length:T}if(Yo.lastIndex=_,Yo.exec(v)?.index===_){gc.lastIndex=Yo.lastIndex;let T=gc.exec(v);return T?T.index+T[0].length:v.length}if(Qo.lastIndex=_,Qo.exec(v)?.index===_){mc.lastIndex=Qo.lastIndex;let T=mc.exec(v);return T?T.index+T[0].length:v.length}return-1}function te(v,_){let k=[],R=0,T=v.length,B=!1,z=null;while(R<T){let F=v[R];if(B){if(z){if(F===z)z=null}else if(F==='"'||F==="'")z=F;else if(F===">")B=!1;R++;continue}if(F!=="<"){let G=v.indexOf("<",R+1);if(G===-1)break;R=G;continue}let H=_(v,R);if(H>R){k.push({start:R,end:H,token:v.slice(R,H)}),R=H;continue}let q=Id(v,R);if(q>R){R=q;continue}let K=v.charCodeAt(R+1);if(K>=65&&K<=90||K>=97&&K<=122)B=!0;R++}return k}function Pd(v){let _=0,k=0,R=0,T=!1,B=null;while(R<v.length){if(T){let G=v[R];if(B){if(G===B)B=null}else if(G==='"'||G==="'")B=G;else if(G===">")T=!1;R++;continue}let z=v.indexOf("<",R),F=z===-1?v.length:z;while(R<F){let G=v[R++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(z===-1)break;let H=Id(v,z);if(H>z){R=H;continue}let q=v.charCodeAt(z+1),K=q===47?v.charCodeAt(z+2):q;if(K>=65&&K<=90||K>=97&&K<=122)T=!0;R=z+1}return!1}function Dd(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var iy=1024,oy=16777216,os=new Map,dc=0;function ay(v,_){os.set(v,_),dc+=v.length+_.output.length;for(let[k,R]of os){if(dc<=oy)break;os.delete(k),dc-=k.length+R.output.length}}function Un(v,_,k,R){let T=R!==void 0&&v.length>=iy,B=T?`${R}\x00${v}`:"";if(T){let K=os.get(B);if(K)return os.delete(B),os.set(B,K),{output:K.output,tokens:K.tokens.slice()}}let z=te(v,_);if(z.length===0)return{output:v,tokens:[]};let F=z.map((K)=>K.token),H="",q=0;for(let K=0;K<z.length;K++){let G=z[K];H+=v.slice(q,G.start),H+=k(G.token,K),q=G.end}if(H+=v.slice(q),T)return ay(B,{output:H,tokens:F}),{output:H,tokens:F.slice()};return{output:H,tokens:F}}var cy=1024,ly=16777216,as=new Map,fc=0;function uy(v,_){as.set(v,_),fc+=v.length+_.output.length;for(let[k,R]of as){if(fc<=ly)break;as.delete(k),fc-=k.length+R.output.length}}function pc(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:ls(R,k)}}function hn(v){let _=v.length>=cy;if(_){let T=as.get(v);if(T)return as.delete(v),as.set(v,T),pc(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=Un(v,V,(T,B)=>`\x00STX_SCRIPT_${B}\x00`);if(_)return uy(v,{output:k,scripts:R}),pc(v,k,R.slice());return pc(v,k,R)}function ls(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function Dt(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 na(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 Od(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 Md(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 Fr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=Od(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 na(k.slice(1,-1))){let B=T.trim();if(!B)continue;if(B.startsWith("...")){Fr(B,_);continue}let z=Od(B,":");Fr(z===-1?B:B.slice(z+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of na(k.slice(1,-1)))Fr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Vr(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 H=_.slice(0,B).trim();if(H.startsWith("(")&&Md(H)===H.length-1)H=H.slice(1,-1);for(let q of na(H))Fr(q,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("(")&&Md(B)===B.length-1)B=B.slice(1,-1);let z=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(B);if(z)Fr(z[2],k),Fr(z[1],k);else for(let F of na(B))Fr(F,k)}return k}function ne(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 F of z.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(F))return!0;return!1}var ra="__stx_client_loop_names";function Rr(v){let _=v?.[ra];return Array.isArray(_)?_:[]}function sa(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 F=[...B.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((K)=>/^(?:#[\w-]+|v-slot:[\w-]+)$/i.test(K[1])),H=(F?.[2]??F?.[3])?.trim(),q=H?{start:T.index+B.length,end:v.length,binding:H}:void 0;if(k.push(q),q)_.push(q)}}return _}var oo={},jd=new Map;function dy(v){let _=jd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),jd.set(v,_)}return _.lastIndex=0,_}var sr={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 Nt(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,B=String(v).split("."),z=R;for(let H of B){if(z===void 0||z===null)break;z=z[H]}if(z===void 0||z===null)return T?v:"";let F=String(z);return Object.entries(k).forEach(([H,q])=>{F=F.replace(dy(H),String(q))}),F},t:(v,_,k={})=>sr.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 vc(v,_){if(v in sr)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);oo[v]=_}function Xd(v){for(let[_,k]of Object.entries(v))vc(_,k)}function wc(){return{...sr,...oo}}function Jd(){for(let v of Object.keys(oo))delete oo[v]}function xc(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 F=0;while(v[B+F]==="}")F++;if(F>=k)return B}}return-1}function or(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 F=xc(v,z,k);if(F===-1)break;T+=v.slice(B,z)+_(v.slice(z,F+k),v.slice(z+k,F),z),B=F+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 Nt(v){return kd(b(v))}function fy(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 py(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 gy(v,_){let k=py(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new er(_,"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("#"),F=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(B);if(!z&&!F)throw new er(_,"CSS URLs must be local paths or base64 raster images")}}function Vd(v,_,k,R=!1,T=0){let B=Ed(v,_,R),z=Nt(k);if(!B)return z;if(B.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new er("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(B.kind==="tag"){let q=v.slice(_+T).trimStart(),K=k.trim();if(!q.startsWith("=")&&(K===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(K)))return K;throw new er("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let F=B.name.toLowerCase();if(/^on[a-z]/.test(F))throw new er(B.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(F==="srcdoc")z=Nt(z);if(F==="style")gy(k,B.name);if(B.quote===null)z=fy(z);let H=uc(F);if(H&&B.valuePrefix.trim()===""&&Jo(k,H))return Cd+z;return Ad(Rd(v,_),k,z)}function Ud(v){return v.flatMap((_)=>{let k=_.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!k||/\bserver\b|\bsrc\s*=/.test(k[1])?[]:[k[2]]})}function Ce(v,_){let{scripts:k}=hn(v);for(let R of Ud(k)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(R))return!0;if(Bn(R,_))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 Sc(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(Vr(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 F=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");F.lastIndex=z;let H=1,q=v.length;for(let K=F.exec(v);K;K=F.exec(v)){if(K[2]==="/")continue;if(H+=K[1]==="/"?-1:1,H===0){q=K.index+K[0].length;break}}_.push({start:R.index,end:q,names:B})}return _}function Ld(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 Bd(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 q=0;q<R.length;q++){let K=R[q];if(!B&&K==="`"){B=!0,z=0;continue}if(B){if(K==="`"&&z===0){B=!1;continue}if(K==="$"&&R[q+1]==="{"){z++,q++,T+=" ";continue}if(K==="}"&&z>0){z--;continue}if(z>0){T+=K;continue}continue}T+=K}R=T;let F=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,H;while((H=F.exec(R))!==null){let q=H[1];if(!R.substring(0,H.index).trimEnd().endsWith(".")){if(!k.includes(q)&&!(q in _))return!1}}return!0}function my(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 zd=new Set;function Wd(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function Fd(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!zd.has(k))zd.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 bs(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>{try{let z=x(B,_);if(z===void 0)return Wd(B)?Fd(B.trim(),k):T;return z===null?"":String(z)}catch{return T}}),R=or(R,(T,B,z)=>{let F=B.trim();if(/^__[A-Z_]+__$/.test(F))return T;try{let H=x(B,_);if(H===void 0)return Wd(F)?Fd(F,k):T;return JSON.stringify(H).replace(/</g,"\\u003c")}catch{return T}}),R}function kc(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=or(k,(R,T,B)=>{let z=T.trim();if(/^__[A-Z_]+__$/.test(z))return R;try{let F=x(T,_);if(F===void 0)return R;if(F===null)return"";let H=String(F);return Vd(k,B,H,!0,R.length)}catch(F){if(F instanceof er)throw F;return R}}),k}function Yd(v,_,k={}){let{output:R,scripts:T}=hn(v),B=T.map((z)=>{let F=z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),H=z.match(/^<script\b[^>]*>/i),q=z.search(/<\/script\s*>$/i);if(!F||!H||q===-1)return z;let K=F[1],G=F[2];if(/\bdata-raw\b/.test(K))return z;if(k.skipServer&&/\bserver\b/.test(K))return z;let ae=`<script${kc(K,_)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return ae+G+z.slice(q);return ae+bs(G,_)+z.slice(q)});return ls(R,B)}function Y(v,_,k){let R=v,T=(Q,ce)=>{let ue=cs(Q,ce);if(ue===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Q.slice(ce,ue))?-1:ue},B=(Q,ce,ue,le)=>{let pe=ue.length,{output:de,tokens:Re}=Un(Q,ce,(be,xe)=>le(pe+xe));return ue.push(...Re),de},z=[];R=B(R,T,z,(Q)=>`<!--__STX_STYLE_${Q}__-->`);let F=[];R=B(R,V,F,(Q)=>`<!--__STX_SCRIPT_EXPR_${Q}__-->`);let H=_?.__stx_signals_gate===!0||Ce(v),q=new Set([...Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[],...js(Ud(F))]),K=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);R=or(R,(Q,ce,ue)=>{try{let le=x(ce,_,!1,(pe)=>hc(pe,Q,k,v));return le!==void 0&&le!==null?String(le):""}catch(le){let pe=le instanceof Error?le.message:String(le);return g("Expression",`Error evaluating: {{{ ${ce.trim()}}}}: ${pe}`,k,v,ue,Q)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(Q,ce,ue)=>{try{let le=x(ce,_,!1,(pe)=>hc(pe,Q,k,v));if(le===void 0&&_.__stx_buildMode==="compile")return Go("raw",ce.trim());return le!==void 0&&le!==null?String(le):""}catch(le){if(_.__stx_buildMode==="compile")return Go("raw",ce.trim());let pe=le instanceof Error?le.message:String(le);return g("Expression",`Error evaluating: {!! ${ce.trim()} !!}: ${pe}`,k,v,ue,Q)}}),R=B(R,V,F,(Q)=>`<!--__STX_SCRIPT_EXPR_${Q}__-->`),R=B(R,T,z,(Q)=>`<!--__STX_STYLE_${Q}__-->`);let G=H?Sc(R):[],ee=sa(R).map((Q)=>({...Q,names:new Set(Vr(`${Q.binding} in __slot`))})),ae=new Set(Rr(_));if(R=or(R,(Q,ce,ue)=>{let le=ce.trim();if(Ld(ee,ue,le))return Q;if(ne(le,ae))return Q;if(G.length>0&&Ld(G,ue,le))return Q;if(K.has(le))return Q;let pe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],de=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,be=le.match(de)?.[1],xe=be&&((be in _)||pe.includes(be)),Ie=Boolean(be&&q.has(be)),Me=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Ne=le.match(Me),je=Ne&&!pe.includes(Ne[1])&&!(Ne[1]in _);if(/^__[A-Z_]+__$/.test(le))return"";if(Ie)return Q;let Be;try{let De=x(ce,_,!1,(Ue)=>{Be=Ue});if(H&&!Bd(le,_))return Q;if(Be)hc(Be,Q,k,v);if(_.__stx_buildMode==="compile"&&!H&&(De===void 0||my(le,_)))return Go("expr",le);if(De===void 0||De===null)return"";let Fe=String(De);return Vd(R,ue,Fe,!1,Q.length)}catch(De){if(De instanceof er)throw De;if(H&&!Bd(le,_))return Q;if(je)return Q;let Fe=De instanceof Error?De.message:String(De);return g("Expression",`Error evaluating: {{ ${le} }}: ${Fe}`,k,v,ue,Q)}}),F.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(Q,ce)=>F[Number(ce)]??Q);if(z.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(Q,ce)=>z[Number(ce)]??Q);return R}function Cc(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 F=oo[z]||sr[z];if(!F)throw Error(`Filter not found: ${z}. Available filters: ${Object.keys(wc()).join(", ")}`);let H=[];if(T.startsWith(":")){let q=T.match(/^:([^|\s]+)/);if(q){let K=q[1].trim();try{let G=Number(K);H=[Number.isNaN(G)?K:G]}catch{H=[K]}T=T.substring(q[0].length).trim()}}else if(T.startsWith("(")){let q=1,K=1;while(q>0&&K<T.length){if(T[K]==="(")q++;if(T[K]===")")q--;K++}if(q===0){let G=T.substring(1,K-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))H=[x(`(${G})`,k,!0)];else{let ee=[],ae="",Q=null,ce=0,ue=0,le=0,pe=!1;for(let de=0;de<G.length;de++){let Re=G[de];if(pe){ae+=Re,pe=!1;continue}if(Re==="\\"){ae+=Re,pe=!0;continue}if(Q){if(ae+=Re,Re===Q)Q=null;continue}if(Re==='"'||Re==="'"||Re==="`"){Q=Re,ae+=Re;continue}if(Re==="(")ce++;else if(Re===")")ce--;else if(Re==="[")ue++;else if(Re==="]")ue--;else if(Re==="{")le++;else if(Re==="}")le--;if(Re===","&&ce===0&&ue===0&&le===0){ee.push(ae),ae="";continue}ae+=Re}if(ae)ee.push(ae);H=ee.map((de)=>{let Re=de.trim();return x(Re,k,!0)})}}catch{H=[G]}T=T.substring(K).trim()}}try{R=F(R,k,...H)}catch(q){let K=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${z}': ${K}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function hy(v){let _=!1,k="",R=0,T=0,B=0,z=!1;for(let F=0;F<v.length;F++){let H=v[F],q=v[F+1];if(_&&z){z=!1;continue}if(_&&H==="\\"){z=!0;continue}if(z=!1,(H==='"'||H==="'"||H==="`")&&!z){if(!_)_=!0,k=H;else if(H===k)_=!1,k="";continue}if(_&&k==="`"&&H==="$"&&q==="{"){let K=1;F+=2;while(F<v.length&&K>0){if(v[F]==="{")K++;else if(v[F]==="}")K--;if(K>0)F++}continue}if(_)continue;if(H==="(")R++;else if(H===")")R--;else if(H==="[")T++;else if(H==="]")T--;else if(H==="{")B++;else if(H==="}")B--;if(H==="|"&&R===0&&T===0&&B===0){if(q==="|"){F++;continue}if(q==="="){F++;continue}return F}}return-1}var so=new Set,yy=1000;function Zd(){so.clear()}function hc(v,_,k,R){if(!N())return;let T=`${k}\x00${v.expression}`;if(so.has(T))return;if(so.size>=yy)so.clear();so.add(T);let B=k,z=R;try{if(k&&Nd.existsSync(k))z=Nd.readFileSync(k,"utf8")}catch{}let F=z.indexOf(_);if(F>=0)B=`${k}:${z.slice(0,F).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=hy(T);if(B>0){let F=T.substring(0,B).trim(),H=T.substring(B+1).trim(),q=x(F,_,!0,R);return Cc(q,H,_)}let z=Mn(T);if(z!==null){R?.({expression:T,rule:z});return}try{let F=Object.keys(_),H=Object.values(_);return c(T,F)(...H)}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],F=xy(z,Object.keys(_));if(F&&F!==z)T.message=`${T.message} \u2014 did you mean '${F}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function xy(v,_){let k=null;for(let T of _){if(T===v)continue;let B=by(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 by(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 F=1;F<=k.length;F++){let H=k[F-1]===R[z-1]?0:1;B[F]=Math.min(B[F-1]+1,T[F]+1,T[F-1]+H)}for(let F=0;F<=k.length;F++)T[F]=B[F]}return T[k.length]}function Qd(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 Gd 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 us=new Map,vy=500;function Ur(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!us.has(k)){if(us.size>=vy){let R=us.keys().next().value;if(R)us.delete(R)}us.set(k,new RegExp(v,_))}return us.get(k)}class Hd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),R=this.pool.find((F)=>F.context.join(",")===k);if(R)return R.func;let T=this.fnCache,B=this.fnCacheMaxSize,z=(...F)=>(H)=>{try{let q=`${k}:${H}`,K=T.get(q);if(!K){if(T.size>=B){let G=T.keys().next().value;if(G)T.delete(G)}K=Function(..._,`
125
+ 'use strict';
126
+ try {
127
+ return ${H};
128
+ }
129
+ catch (e) {
130
+ if (e instanceof ReferenceError || e instanceof TypeError) {
131
+ return undefined;
132
+ }
133
+ throw e;
134
+ }
135
+ `),T.set(q,K)}return K(...F)}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 k$=new Hd;class qd{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 H of this.violationHandlers)try{H(z)}catch{}let F=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(F);break;case"warn":console.warn(F);break;case"error":console.error(F);break;case"throw":if(B)throw Error(F);else console.warn(F);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 yc=null;function wy(){if(!yc)yc=new qd;return yc}var X=new Proxy({},{get(v,_){return wy()[_]}});var ef=[];function m(v){let _=new M(v);return ef.push(_),_}function tf(){for(let v of ef)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function nf(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:Gd.statSync(k).mtimeMs})}catch{}return _}function yn(v){for(let _ of v)try{if(Gd.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import WS from"fs";import dn from"path";import lo from"fs";import Xt from"path";import{hasLocalConfig as Rf}from"bunfig";import qn from"fs";import Hr from"path";import tl from"fs";import rf from"path";import{fileURLToPath as Sy}from"url";var nl;function qe(){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 _=rf.dirname(Sy(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(rf.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return nl=v,v}var _c=new Map,qr=new Map;async function eu(v){let k;for(let R=0;R<3;R++)try{let B=(await qn.promises.stat(v)).mtime.getTime(),z=qr.get(v);if(z&&z.mtime===B)return z.content;let F=await Bun.file(v).text(),q=(await qn.promises.stat(v)).mtime.getTime();if(q!==B)continue;return qr.set(v,{content:F,mtime:q}),F}catch(T){k=T;break}throw qr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function tu(v){qr.delete(v)}function nu(v){for(let _ of qr.keys())if(_.startsWith(v))qr.delete(_)}var oa=null,$y=null,of=null;function ru(v){of=v}async function Ec(v=!1){let _=of??await import("./chunk-n6tspwf9.js");if(v)return _.generateSignalsRuntimeDev();if(oa===null)oa=_.generateSignalsRuntime();return oa}var aa=null;async function Tc(){if(aa===null){let{getRouterScript:v}=await import("./chunk-w1szscbz.js");aa=v()}return aa}var sf={};async function su(v,_=!1){let k=v==="runtime"?await Ec(_):await Tc(),R=v==="runtime"&&_?"runtime-debug":v,T=sf[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},sf[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var _y=500,ky=33554432,tr=new Map,ia=0;function af(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function ou(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=tr.get(_),R=k!==void 0;if(R)tr.delete(_),ia-=k.length*2;tr.set(_,v),ia+=v.length*2;while(tr.size>1&&(tr.size>_y||ia>ky)){let T=tr.keys().next().value;ia-=tr.get(T).length*2,tr.delete(T)}if(!R)try{let T=af(_);if(!qn.existsSync(T))qn.mkdirSync(Hr.dirname(T),{recursive:!0}),qn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function pi(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=tr.get(v);if(_!==void 0)return _;try{return qn.readFileSync(af(v),"utf8")}catch{return}}function iu(){qr.clear(),oe(),tf(),oa=null,$y=null,aa=null}function cf(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 vn(v,_){try{if(!_.cachePath)return null;let k=Hr.resolve(_.cachePath),R=Hr.join(k,`${ir(v)}.html`),T=Hr.join(k,`${ir(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!==qe())return null;if(z.optionsSignature!==cf(_))return null;if((await qn.promises.stat(v)).mtime.getTime()>z.mtime)return null;for(let H of z.dependencies)if(await r(H)){if((await qn.promises.stat(H)).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 wn(v,_,k,R){try{if(!R.cachePath)return;let T=Hr.resolve(R.cachePath);await qn.promises.mkdir(T,{recursive:!0});let B=Hr.join(T,`${ir(v)}.html`),z=Hr.join(T,`${ir(v)}.meta.json`),F=await qn.promises.stat(v);await Bun.write(B,_);let H={sourcePath:v,mtime:F.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:qe(),optionsSignature:cf(R),generatedAt:Date.now()};await Bun.write(z,JSON.stringify(H,null,2)),_c.set(v,{output:_,mtime:F.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Ey=16;function ir(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Ey)}var Ke={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 _e(v){return`--stx-${v}`}function ca(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 Cy=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function lf(v,_){let k=_.trim();return ca(v,k)??(Cy.test(k)?k:void 0)}function uf(v={}){return[...Object.keys(v.roles??{}).filter((_)=>!Ke[_]).map((_)=>`roles.${_}`),...Object.keys(v.shapes??{}).filter((_)=>!re[_]).map((_)=>`shapes.${_}`),...Object.keys(v.density??{}).filter((_)=>!fe[_]).map((_)=>`density.${_}`)]}function df(v){let _={};for(let[k,R]of Object.entries(Ke)){let T=ca(v,R.light);if(T===void 0)continue;_[k]=`var(${_e(k)}, ${T})`}return _}function ff(v,_={}){let k=[],R=[];for(let[T,B]of Object.entries(Ke)){let z=_[T],F=typeof z==="string"?z:z?.light,H=typeof z==="string"?z:z?.dark,q=F&&lf(v,F)||ca(v,B.light),K=H&&lf(v,H)||ca(v,B.dark);if(q===void 0)continue;if(k.push(` ${_e(T)}: ${q};`),K!==void 0)R.push(` ${_e(T)}: ${K};`)}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 re={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 Mt(v){return`--stx-radius-${v}`}function pf(){let v={};for(let[_,k]of Object.entries(re))v[_]=`var(${Mt(_)}, ${k.value})`;return v}function gf(v={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(re).map(([_,k])=>` ${Mt(_)}: ${v[_]??k.value};`),"}",""].join(`
137
+ `)}var fe={"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"}},xn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Sn={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 Ee(v){return`--stx-${v}`}function rl(v){let _=fe[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${Ee(v)}, ${_.value})`}function mf(){let v={};for(let[_,k]of Object.entries(xn))v[_]=rl(k);return v}function hf(){let v={};for(let[_,{size:k,leading:R}]of Object.entries(Sn))v[_]=[rl(k),{lineHeight:rl(R)}];return v}function yf(v={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(fe).map(([_,k])=>` ${Ee(_)}: ${v[_]??k.value};`),"}",""].join(`
138
+ `)}function xf(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]=xf(T)&&xf(k[R])?sl(k[R],T):T;return k}function bf(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
139
+ `:k}function vf(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...B}=R,{extend:z,...F}=k,H=F.colors||{};F.colors={...H,...df(H)};let q=F.borderRadius||{};F.borderRadius={...q,...pf()};let K=F.spacing||{};F.spacing={...K,...mf()};let G=F.fontSize||{};F.fontSize={...G,...hf()};let ee=sl(F,B),ae=sl(z||{},T||{});if(Object.keys(ae).length>0)ee.extend=ae;let Q=[...v.safelist||[],..._.safelist||[]],ce={...v.shortcuts||{},..._.shortcuts||{}},ue=[...v.preflights||[],..._.preflights||[]],{fonts:le,...pe}=v,{fonts:de,roles:Re,shapes:be,density:xe,...Ie}=_,Me={roles:Re,shapes:be,density:xe},Ne=de??le;return{config:{...pe,...Ie,theme:ee,safelist:Q,shortcuts:ce,...ue.length>0?{preflights:ue}:{},content:[],output:""},safelist:Q,shortcuts:ce,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:ff({...H,...ee.colors},Re)+gf(be)+yf(xe),unknownRoles:uf(Me),...Ne?{fonts:Ne}:{}}}function wf(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 Sf(v,_,k={}){let{prefix:R="",preserveHost:T=!0,scopeKeyframes:B=!0,scopeCustomProperties:z=!1}=k;if(!v.trim())return"";let F=il(v),H=[],q=new Map;if(B)for(let K of F){let G=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let ee=G[1],ae=`${_}_${ee}`;q.set(ee,ae)}}for(let K of F){let G=$f(K,_,R,T,q,z);H.push(G)}return H.join(`
140
+
141
+ `)}function il(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),R=0,T="",B=!1,z="";for(let F=0;F<k.length;F++){let H=k[F];if(H==="@"&&R===0)B=!0;if(H==="{")R++;else if(H==="}"){if(R--,R===0){if(B){z+=H;let q=z.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,K,G,ee]=q;if(K==="keyframes")_.push({selector:`@keyframes ${G.trim()}`,declarations:ee.trim()});else if(K==="media"||K==="supports"||K==="container"){let ae=il(ee);_.push({selector:`@${K} ${G.trim()}`,declarations:ae.map((Q)=>`${Q.selector} { ${Q.declarations} }`).join(`
142
+ `)})}else _.push({selector:`@${K} ${G.trim()}`,declarations:ee.trim()})}z="",B=!1}else if(T.trim()){T+=H;let q=T.match(/([^{]+)\{([^}]*)\}/);if(q)_.push({selector:q[1].trim(),declarations:q[2].trim()});T=""}continue}}if(B)z+=H;else T+=H}return _}function $f(v,_,k,R,T,B){let{selector:z,declarations:F}=v;if(z.startsWith("@")){if(z.startsWith("@keyframes")){let K=z.replace("@keyframes ","").trim();return`@keyframes ${T.get(K)||K} { ${F} }`}if(z.startsWith("@media")||z.startsWith("@supports")||z.startsWith("@container")){let G=il(`x { ${F} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((ee)=>$f(ee,_,k,R,T,B)).join(`
143
+ `);return`${z} {
144
+ ${G}
145
+ }`}return`${z} { ${F} }`}let H=Ry(z,_,k,R),q=F;for(let[K,G]of T)q=q.replace(new RegExp(`\\b${K}\\b`,"g"),G);if(B)q=q.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${H} { ${q} }`}function Ry(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 q=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(q)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let F=k?`${k} .${_}`:`.${_}`;B.push(`${F} ${z}`);let H=Ay(z,_);if(H)B.push(k?`${k} ${H}`:H)}return B.join(", ")}function Ay(v,_){let k=0,R=v.length;for(let H=0;H<v.length;H++){let q=v[H];if(q==="["||q==="(")k++;else if(q==="]"||q===")")k--;else if(k===0&&(q===" "||q===">"||q==="+"||q==="~")){R=H;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,F=0;for(let H=0;H<T.length;H++){let q=T[H];if(q==="["||q==="(")F++;else if(q==="]"||q===")")F--;else if(k===0&&F===0&&q===":"){z=H;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var Ef=String.raw`(?<![\w-])scoped(?![\w-])`,ol=/<style\s+([^>]*)>/gi,_f=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Cf=new RegExp(Ef,"i"),Ty=new RegExp(Ef,"gi"),al=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Iy(v){ol.lastIndex=0;let _=ol.exec(v);while(_!==null){if(Cf.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 ao(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 la(v,_){if(!Iy(v))return{html:v,hasScoped:!1};let k=wf(_),R=`data-v-${k}`,T=v,B=!1;if(_f.lastIndex=0,T=T.replace(_f,(z,F,H)=>{if(!Cf.test(F))return z;B=!0;let q=Py(H,R),K=F.replace(Ty,"").trim(),G=K?` ${K}`:"";return`<style data-stx-scoped="${k}"${G}>${q}</style>`}),!B)return{html:v,hasScoped:!1};return T=Oy(T,R),{html:T,hasScoped:!0}}function Py(v,_){return Sf(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Dy=(v)=>`\x00stx-scope-mask-${v}\x00`,kf=/\u0000stx-scope-mask-(\d+)\u0000/g;function Oy(v,_){let k=Un(v,(T,B)=>{let z=V(T,B);return z>B?z:cs(T,B)},(T,B)=>Dy(B)),R=My(k.output,_);return kf.lastIndex=0,R.replace(kf,(T,B)=>k.tokens[Number(B)])}function My(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 Kn=null,ua="";function Af(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;ua=`${_}@${Math.trunc(lo.statSync(_).mtimeMs)}`}catch{ua=v}}var ul=!1,Kr=null,co="",ds=!1,Df=256,Tr=new Map,Xn=new Map,da=null,Of=null,fa=new Map,Tf=new Set;function pa(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function ll(v,_){if(Tr.has(v))Tr.delete(v);else if(Tr.size>=Df)Tr.delete(Tr.keys().next().value);Tr.set(v,_)}function Ny(v){let _=pa(v);if(Xn.has(_))Xn.delete(_);else if(Xn.size>=Df)Xn.delete(Xn.keys().next().value);return Xn.set(_,v),_}function au(v){let _=Xn.get(v);if(_===void 0)return;return Xn.delete(v),Xn.set(v,_),_}async function jy(v,_=da){if(!_)return null;try{let k=Bun.file(Xt.join(_,`cw-${pa(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Ly(v,_,k=da){if(!k)return;try{if(!lo.existsSync(k))lo.mkdirSync(k,{recursive:!0});await Bun.write(Xt.join(k,`cw-${pa(v)}.css`),_)}catch{}}async function If(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var By=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],zy=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Wy(){let v=[],_=process.cwd();while(_!==Xt.dirname(_)){for(let k of["node_modules","pantry"])for(let R of By)v.push(Xt.join(_,k,...R));_=Xt.dirname(_)}return v}function Fy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Xt.join(_,"Code","Tools","ts-css"),_&&Xt.join(_,"Code","Tools","crosswind"),_&&Xt.join(_,"repos","stacks-org","ts-css"),_&&Xt.join(_,"repos","stacks-org","crosswind"),Xt.join(process.cwd(),"..","ts-css"),Xt.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Xt.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Xt.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Xt.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function fi(){if(ul)return Kn;ul=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await If(B);if(z){if(Af(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Xt.dirname(Xt.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Xt.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Kn=B,Kn}let _=await v(Wy());if(_)return Kn=_,Kn;let k=zy;for(let T of k){let B=await If(T);if(B){Kn=B;try{Af(import.meta.resolve(T))}catch{ua=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Kn}}let R=await v(Fy());if(R)return Kn=R,Kn;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 cu(){dl.clear(),Kn=null,ul=!1,Kr=null,co="",Tr.clear(),Xn.clear(),Of=null,fa.clear()}var Pf=!1;async function gi(v){try{let _=Rf({name:"css",cwd:v})?"css":Rf({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Pf)Pf=!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=Xt.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 $c(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-f19bzr36.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Xt.isAbsolute(R.css)?R.css:Xt.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=Xt.isAbsolute(R.css.config)?R.css.config:Xt.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 gi(v)}function Rc(v){try{let _=new WeakSet;return pa(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 Lt(v){if(ds)return co;ds=!0;try{let _=await fi();if(!_||!_.build)return ds=!1,"";if(!Kr)Kr=await gi(v);if(!Kr)return ds=!1,"";let k=_.defaultConfig?.theme||{},R=Kr.theme||{},T={..._.defaultConfig,...Kr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),F=performance.now()-B;if(co=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${F.toFixed(1)}ms`),T.output){let H=Xt.isAbsolute(T.output)?T.output:Xt.join(v,T.output),q=Xt.dirname(H);if(!lo.existsSync(q))lo.mkdirSync(q,{recursive:!0});await Bun.write(H,z.css)}return ds=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),ds=!1,co}}async function kn(v){Kr=null,await Lt(v)}function lu(){return co}function Ac(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 F of z)for(let H of F.slice(1,-1).split(/\s+/))if(H.trim())_.add(H.trim())}B=T.exec(v)}return _}var dl=m(64);async function Pc(v,_){let k=()=>fa.get(_?Xt.resolve(_):process.cwd())?.fingerprint??null,R=dl.get(h(v,_,k()));if(R!==void 0)return R;let T=await Vy(v,_);if(T)dl.set(h(v,_,k()),T);return T}function*Mf(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=pi(R);if(T)yield T}}function du(v){return[...Mf(v)].join(`
146
+ `)}async function Vy(v,_){try{let k=await fi();if(!k)return"";let R=new Set;for(let Me of Mf(v)){let Ne=typeof k.extractClasses==="function"?k.extractClasses(Me):Ac(Me);for(let je of Ne)R.add(je)}if(R.size===0)return"";let T=_?Xt.resolve(_):process.cwd(),B=a(T,"cache");if(!da)da=B;let z=fa.get(T);if(!z){let Me=await $c(T);z={config:Me,fingerprint:Rc(Me)},fa.set(T,z),Of=z.fingerprint}let F=[...R].sort().join(" "),H=`${ua}::${z.fingerprint||"default"}::${F}`,q=Tr.get(H);if(q!==void 0)return ll(H,q),q;let K=await jy(H,B);if(K!==null)return ll(H,K),K;let G=k.defaultConfig||k.config,ee=z.config||{},ae=vf(G,ee),{safelist:Q,includePreflight:ce,minify:ue,tokenCSS:le}=ae;if(ae.unknownRoles.length>0&&!Tf.has(T))Tf.add(T),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${ae.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let pe=ae.config,de=new k.CSSGenerator(pe),Re=pe.shortcuts||ee.shortcuts||{},be=Object.keys(Re).filter((Me)=>R.has(Me)||Q.includes(Me));for(let Me of Q)if(!Re[Me])de.generate(Me);for(let Me of R)if(!Re[Me])de.generate(Me);let xe="";if(be.length>0){let Me=new k.CSSGenerator(pe);for(let Ne of be)Me.generate(Ne);if(xe=Me.toCSS(!1,ue),xe&&!xe.endsWith(`
147
+ `))xe+=`
148
+ `}let Ie=xe+de.toCSS(ce,ue);return Ie=bf(k.CSSGenerator,ae)+le+Ie,ll(H,Ie),Ly(H,Ie,B),Ie}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await Pc(v,_);if(!T)return R?ao(v):v;let B=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${Ny(T)}.css">`:`<style data-css="generated">
149
+ ${T}
150
+ </style>`;if(R)return Uy(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 F=!1;return v.replace(z,()=>{if(F)return"";return F=!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 Uy(v,_){let k=cl(v).map((H)=>({...H,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 H=!0;while(T!==null)k.push({start:T.index,end:T.index+T[0].length,replacement:H?_:""}),H=!1,T=R.exec(v)}else{let H=v.indexOf("</head>");if(H!==-1)k.push({start:H,end:H,replacement:`${_}
153
+ `});else{let q=v.match(/<body([^>]*)>/);if(q?.index!==void 0)k.push({start:q.index,end:q.index+q[0].length,replacement:`${q[0]}
154
+ ${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((H,q)=>H.start-q.start||H.end-q.end);for(let H=1;H<k.length;H++)if(k[H].start<k[H-1].end)return Hy(ao(v),_);let B=Array(k.length*2+1),z=0,F=0;for(let H of k)B[F++]=v.slice(z,H.start),B[F++]=H.replacement,z=H.end;return B[F]=v.slice(z),B.join("")}function Hy(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}],Nf=/<body\b([^>]*)>/gi;function Zn(v){let _=0,k,R=fl.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Nf.lastIndex=_,k=Nf.exec(v);if(!k)return null;let T=k.index,B=-1,z=null;for(let H=0;H<fl.length;H++){let q=fl[H],K=R[H];if(K===void 0||K!==null&&K.index<_)q.open.lastIndex=_,K=q.open.exec(v),R[H]=K;if(!K)continue;if(K.index<T&&(B===-1||K.index<B))B=K.index,z=q.close}if(B===-1||!z)return{index:T,tag:k[0],attrs:k[1]??""};z.lastIndex=B;let F=z.exec(v);if(!F)return null;_=F.index+F[0].length}return null}function fs(v,_){let k=Zn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var jf=/<style\b[^>]*>/iy,Lf=/<\/style>/gi,Bf=/<script\b[^>]*>/iy,zf=/<template(?=[\s>/])[^>]*>/iy,Wf=/<\/template\s*>/iy;function uo(v){let _=0,k=0,R=-1;while(_<v.length){let T=v.indexOf("<",_);if(T===-1)return-1;if(v.startsWith("<!--",T)){let H=v.indexOf("-->",T+4);_=H===-1?v.length:H+3;continue}jf.lastIndex=T;let B=jf.exec(v);if(B){Lf.lastIndex=T+B[0].length;let H=Lf.exec(v);_=H===null?v.length:H.index+8;continue}zf.lastIndex=T;let z=zf.exec(v);if(z){if(k===0)R=T;k++,_=T+z[0].length;continue}Wf.lastIndex=T;let F=Wf.exec(v);if(F){if(k>0)k--;_=T+F[0].length;continue}if(Bf.lastIndex=T,Bf.test(v))return k>0?R:T;_=T+1}return-1}function Ff(){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 c_=pl("theme"),l_=pl("router"),u_=pl("i18n");import*as Uf from"crypto";function Vf(v){let _=/\$(\w+)\./g,k=[],R;while((R=_.exec(v))!==null)if(!k.includes(R[1]))k.push(R[1]);return k}function qy(){return`stx-${Uf.randomBytes(4).toString("hex")}`}function Ky(v){return/\$\w+\./.test(v)}function Xy(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,F,H)=>{if(["script","style","template"].includes(z.toLowerCase()))return B;let q=[],K=!1,G=F,ee=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ae=[...F.matchAll(ee)];for(let ue of ae){let le=ue[0],pe=ue[1],de=ue[2];if(Ky(de)){K=!0;let Re=de.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(Re){let be=Re[1];if(q.push({attr:pe,expr:be,fullMatch:le,originalAttr:pe}),Vf(be).forEach((Ie)=>k.add(Ie)),pe==="text")G=G.replace(le,"");else if(pe==="class")G=G.replace(le,'class=""');else if(pe==="disabled"||pe==="hidden")G=G.replace(le,"");else G=G.replace(le,`${pe}=""`)}}}if(!K)return B;let Q=G.match(/\bid\s*=\s*"([^"]+)"/),ce;if(Q)ce=Q[1];else ce=qy(),G=` id="${ce}"${G}`;for(let ue of q)_.push({elementId:ce,attribute:ue.attr,expression:ue.expr,stores:Vf(ue.expr)});return`<${z}${G}${H}`}),{html:T,bindings:_,stores:k}}function Zy(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:F}=T,H=F.replace(/\$(\w+)\./g,"$state.$1.");if(z==="text")R+=` (function() {
525
+ var el = document.getElementById('${B}');
526
+ if (el) {
527
+ try {
528
+ el.textContent = ${H};
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 = ${H};
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 = ${H};
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 = (${H}) ? '' : '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 = (${H}) ? '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 = ${H};
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 Hf(v){let{html:_,bindings:k,stores:R}=Xy(v);if(k.length===0)return v;let T=Zy(k,R),B=_.lastIndexOf("</body>");if(B!==-1)return _.slice(0,B)+T+_.slice(B);return _+T}function Gy(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return Jy(_);case"google-analytics":return Yy(_);case"plausible":return Qy(_);case"self-hosted":return ex(_);case"custom":return tx(_);default:return""}}function Jy(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",R=_.defer!==!1?" defer":"",T=[`data-site="${mn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${mn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
663
+ <!-- Fathom Analytics -->
664
+ <script src="${mn(k)}" ${T.join(" ")}${R}></script>
665
+ `}function Yy(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=mn(_.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 Qy(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",R=[`data-domain="${mn(_.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="${mn(_.domain)}" src="${mn(T)}"></script>
678
+ `}function ex(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=mn(_.siteId),R=mn(_.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 tx(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="${mn(_.scriptId)}"`);if(_.attributes)for(let[T,B]of Object.entries(_.attributes))k.push(`${mn(T)}="${mn(B)}"`);return`
717
+ <!-- Custom Analytics -->
718
+ <script${k.length>0?` ${k.join(" ")}`:""} src="${mn(_.scriptUrl)}" defer></script>
719
+ `}function qf(v,_){let k=Gy(_);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 mn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var nx={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 Kf(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...nx,..._};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 Xf(v,_){let k=Kf(_);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 Zf={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=rx(_.join(" "));T.heatmap={...T.heatmap,...B,enabled:!0}}return Kf(T)}};function rx(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 nr={duration:300,delay:0,ease:"ease",direction:"both"};function sx(v,_={}){let{duration:k,delay:R,ease:T,direction:B,custom:z}={...nr,..._};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 ix(){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 ox(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 ax(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 cx(){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 lx(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 Gf={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)||nr.duration:nr.duration,z=_.length>2?_[2]||nr.ease:nr.ease,F=_.length>3?Number.parseInt(_[3],10)||nr.delay:nr.delay,H=_.length>4?_[4]||nr.direction:nr.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=sx(T,{duration:B,delay:F,ease:z,direction:H}),G="stx-transition",ee="";if(T==="fade")ee="stx-fade";else if(T==="slide")ee="stx-slide";else if(T==="scale")ee="stx-scale";else if(T==="flip")ee="stx-flip";else if(T==="rotate")ee="stx-rotate";return`<div id="${q}" class="${G} ${ee} ${H==="out"?"stx-out":""}"
1336
+ style="--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${F}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Jf={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",F=_.length>3?Number.parseFloat(_[3])||0.2:0.2,H=_.length>4?Number.parseInt(_[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${B}ms; --stx-transition-ease: ${z}; --stx-transition-delay: ${H}ms; will-change: opacity, transform;`,G="stx-transition stx-observe stx-out";if(T==="fade")G+=" stx-fade";else if(T==="slide-up"||T==="slide")G+=" stx-from-bottom";else if(T==="slide-down")G+=" stx-from-top";else if(T==="slide-left")G+=" stx-from-right";else if(T==="slide-right")G+=" stx-from-left";else if(T==="scale")G+=" stx-scale";else if(T.includes("-"))G+=` stx-${T}`;else G+=` stx-${T}`;return`<div id="${q}" class="${G}" style="${K}" data-threshold="${F}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},Yf={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((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),z=k.staggerDelay||50,F=k.sequence||!0,H=lx(T,B,{staggerDelay:z,sequence:F});return`${v}
1337
+ ${H}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Qf={name:"motion",handler:(v,_,k,R)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,B=ix();return`<div data-animate="${T?"auto":"true"}">${v}</div>${B}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function ep(v,_,k,R){let T=v;if(R.animation?.enabled===!1)return T;let B=k.includes("test")&&k.includes("animation");if(!ox(T)&&!B)return T;if(!T.includes('<style id="stx-animation-base">')){let F=cx();T=T.replace("</head>",`${F}
1338
+ </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let H=ax(),q=T.lastIndexOf("</body>");if(q!==-1)T=T.slice(0,q)+H+`
1339
+ `+T.slice(q)}}return T}function Xe(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function tp(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var ux=100,dx=599,ml="__stxResponseStatus",fo="__stxResponseHeaders";function ga(v){return typeof v==="number"&&Number.isInteger(v)&&v>=ux&&v<=dx}function jt(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(ga(R))return R}return}function gl(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!ga(k))return!1;return v[ml]=k,!0}function fx(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[fo]={...v[fo],[R]:String(k)}}function Je(v){let _=v?.[ml];return ga(_)?_:void 0}function Ye(v){let _=v?.[fo];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function mi(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Je(v);if(k!==void 0)_[ml]=k;let R=Ye(v);if(R)_[fo]={..._[fo],...R}}function ar(v){return{setResponseStatus:(_)=>{gl(v,_)},notFound:(_=404)=>{let k=ga(_)&&_>=400?_:404;gl(v,k)},setResponseHeader:(_,k)=>{fx(v,_,k)}}}function np(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,B=T==="compile",z="",F=0,H=/@status\s*\(/g,q;while((q=H.exec(v))!==null){let K=px(v,q.index+q[0].length-1);if(K<0)break;let G=v.slice(q.index+q[0].length,K).trim(),ee=/^\d+$/.test(G)?Number(G):l(G,_),ae=R?` in ${R}`:"";if(B)console.warn(`[stx] @status(${G})${ae} 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(${G}) from <script server> instead \u2014 that runs per request.`);else if(!gl(_,ee))console.warn(`[stx] @status(${G})${ae} is not an HTTP status (100-599) \u2014 ignoring it.`);z+=v.slice(F,q.index),F=K+1+(v.slice(K+1).match(/^[^\S\n]*\n?/)?.[0].length??0),H.lastIndex=F}return F===0?v:z+v.slice(F)}function px(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 gx=0,mx=0;function rp(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 hx(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,F=R.index,H=rp(z,"x-data");if(!H)continue;let q=`__stx_scope_${gx++}`,K=rp(z,"x-init"),G=yx(v,B,F+T.length),ee=v.slice(F,G.endIndex),ae=xx(ee);_.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:H,initExpr:K,bindings:[],refs:ae})}return _}function yx(v,_,k){let R=1,T=k,B=new RegExp(`<${_}(?:\\s|>)`,"gi"),z=new RegExp(`</${_}>`,"gi"),F=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(R>0&&T<v.length){B.lastIndex=T,z.lastIndex=T,F.lastIndex=T;let H=B.exec(v),q=z.exec(v),K=F.exec(v);if(K&&K.index<(H?.index??1/0)){T=K.index+K[0].length;continue}if(!q)return{endIndex:v.length};if(H&&H.index<q.index)R++,T=H.index+H[0].length;else{if(R--,R===0)return{endIndex:q.index+q[0].length};T=q.index+q[0].length}}return{endIndex:v.length}}function xx(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,F=bx(B);_.set(z,F)}return _}function bx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${mx++}`}function vx(){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 sp(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(F,H)=>{try{let q=x(H,_,!0);if(q===void 0)return F;return String(q)}catch{return F}}),R="",T=0,B=null;while(T<k.length){let F=k[T];if(B&&F==="\\"){R+=F+(k[T+1]??""),T+=2;continue}if(F==="{"&&k[T+1]==="{"){let H=k.indexOf("}}",T+2);if(H!==-1){let q=k.slice(T,H+2);R+=z(k.slice(T+2,H),q,B),T=H+2;continue}}if(B){if(F===B)B=null}else if(F==="'"||F==='"'||F==="`")B=F;R+=F,T++}return R;function z(F,H,q){let K;try{K=x(F,_,!0)}catch{return H}if(K===void 0)return H;if(q){let G=String(K).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?G.replace(/\$\{/g,"\\${"):G}if(typeof K==="string"){let G=K.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(K)}}function wx(v,_){if(v.length===0)return"";let k=v.map((R)=>{let T=JSON.stringify(Object.fromEntries(R.refs)),B=sp(R.stateExpr,_),z=R.initExpr?sp(R.initExpr,_):null,F=JSON.stringify(B),H=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, ${F}, [], refs, ${H});
1598
+ })();`}).join(`
1599
+ `);return`
1600
+ <script data-stx-scoped data-stx-reactive data-stx-run="always">
1601
+ ${vx()}
1602
+ ${k}
1603
+ </script>`}function ip(v,_,k){if(!$x(v))return v;let R=hx(v);if(R.length===0)return v;let T=Sx(v,R),B=wx(R,_),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
1604
+ `+T.slice(z);else T+=B;return T}function Sx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let F=_[k++];if(!F)return T;let H=/data-stx-scope="([^"]*)"/.exec(z);if(H)return F.id=H[1],F.selector=`[data-stx-scope="${F.id}"]`,T;return`<${B} data-stx-scope="${F.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 $x(v){return/x-data\s*=\s*["']/.test(v)}import ab from"fs";import Rl from"path";import{createHighlighter as cb}from"ts-syntax-highlighter";import Fs from"fs";import cn from"path";import{loadConfigWithResult as tb}from"bunfig";async function _x(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Oe();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var op={name:"stxRouter",handler:_x,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Ir(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ap(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function rr(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 F=z.trim();if(!F||F.startsWith("#"))continue;let H=F.indexOf(":");if(H===-1)continue;let q=F.slice(0,H).trim(),K=F.slice(H+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}B[q]=K}return{data:B,content:T.trim()}}function We(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,B=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(K,G,ee)=>{let ae=B.length,Q=G?` class="language-${Ir(G)}"`:"";return B.push(`<pre><code${Q}>${Ir(ee.trim())}</code></pre>`),`\x00CODEBLOCK${ae}\x00`}),T=T.replace(/`([^`]*)`/g,(K,G)=>`<code>${Ir(G)}</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,(K,G,ee)=>`<img src="${ap(ee)?Ir(ee):""}" alt="${Ir(G)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,G,ee)=>`<a href="${ap(ee)?Ir(ee):""}">${G}</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,(K,G,ee)=>{let Q=`<tr>${G.split("|").map((ue)=>ue.trim()).filter(Boolean).map((ue)=>`<th>${Ir(ue)}</th>`).join("")}</tr>`,ce=ee.trim().split(`
1607
+ `).map((ue)=>`<tr>${ue.split("|").map((pe)=>pe.trim()).filter(Boolean).map((pe)=>`<td>${Ir(pe)}</td>`).join("")}</tr>`).join(`
1608
+ `);return`<table>
1609
+ <thead>
1610
+ ${Q}
1611
+ </thead>
1612
+ <tbody>
1613
+ ${ce}
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
+ `),F=[],H=!1,q=[];for(let K of z){let G=K.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(G)||/^\0CODEBLOCK\d+\0$/.test(G)||G===""){if(H&&q.length>0)F.push(`<p>${q.join(R?`<br />
1617
+ `:`
1618
+ `)}</p>`),q=[],H=!1;F.push(K)}else H=!0,q.push(G)}if(H&&q.length>0)F.push(`<p>${q.join(R?`<br />
1619
+ `:`
1620
+ `)}</p>`);if(T=F.join(`
1621
+ `),R)T=T.replace(/\n/g,`<br />
1622
+ `);for(let K=0;K<B.length;K++)T=T.replace(`\x00CODEBLOCK${K}\x00`,B[K]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}async function cp(v,_,k=""){let R=v,T=[],B=/@markdown(?:\([^)]*\))?/g,z;while((z=B.exec(v))!==null){let F=z.index,H=z[0].match(/@markdown\(([^)]*)\)/),q=H?H[1]:"",K=F+z[0].length,G=1,ee=K,ae=-1;while(G>0&&ee<v.length){let ue=v.indexOf("@markdown",ee),le=v.indexOf("@endmarkdown",ee);if(le===-1)break;if(ue!==-1&&ue<le&&ue!==F){let pe=v[ue+9];if(pe==="("||pe===`
1623
+ `||pe==="\r"||pe===" "||pe===void 0)G++;ee=ue+9}else{if(G--,G===0){ae=le;break}ee=le+12}}if(ae===-1)continue;let Q=v.slice(K,ae),ce=v.slice(F,ae+12);T.push({fullMatch:ce,options:q,content:Q,index:F}),B.lastIndex=ae+12}for(let{fullMatch:F,options:H,content:q,index:K}of T)try{let G={};if(H)H.split(",").forEach((Q)=>{let ce=Q.trim();if(ce)G[ce]=!0});let ee={gfm:G.gfm??!0,breaks:G.breaks??!1},ae=We(q.trim(),ee);R=R.split(F).join(ae)}catch(G){let ee=G instanceof Error?G.message:String(G),ae=g("Markdown Directive",`Error processing markdown: ${ee}`,k,v,K,F);R=R.split(F).join(ae)}return R}async function lp(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}),We(v.trim(),T)}var ps=[320,480,640,768,1024,1280,1536,1920,2560],kx=[1,1.5,2,3],po=["avif","webp","jpeg"],Ex={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function hl(v,_=ps,k={},R){return _.sort((T,B)=>T-B).map((T)=>`${go(v,{...k,w:T,fm:R})} ${T}w`).join(", ")}function up(v,_,k=kx,R={},T){return k.sort((B,z)=>B-z).map((B)=>{let z=Math.round(_*B);return`${go(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 go(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 Ex[v]||"application/octet-stream"}var Cx={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 Rx(){try{return await import("ts-images")}catch{return null}}async function Ax(v,_={}){let k={...Cx,..._},R=await Rx();if(R)try{return await Tx(v,k,R)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return Ix(v,k)}async function Tx(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 F=await R(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:z,base64Encode:!0});return{dataURL:F.dataURL,width:F.width,height:F.height,aspectRatio:F.aspectRatio,originalWidth:F.originalWidth,originalHeight:F.originalHeight,strategy:_.strategy,dominantColor:F.dominantColor,css:F.css}}function Ix(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 dp(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 fp(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(bl.has(k))return bl.get(k);let R=await Ax(v,_);return bl.set(k,R),R}async function Px(){try{return await import("./chunk-vfk3vn6j.js")}catch(v){if(!pp)console.warn("[stx-media] Image processor not available, some features disabled:",v),pp=!0;return null}}var pp=!1,wl=80,ha="async",ya="lazy",gp=!1;async function ma(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return Nx(R,k)}if(k.processedResult?.processed)return _l(v,k.processedResult,_);if(k.responsiveVariants)return yp(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:F,sizes:H,widths:q=ps,dpr:K,formats:G=po,quality:ee=wl,params:ae={},placeholder:Q="none",placeholderOptions:ce={},lazy:ue=!0,priority:le=!1,loading:pe=le?"eager":ya,decoding:de=ha,fetchpriority:Re,objectFit:be,objectPosition:xe,crossorigin:Ie,referrerpolicy:Me}=v,{class:Ne,style:je,id:Be}=v,De=v.data||{},{isDev:Fe=!1,baseUrl:Ue=""}=_;if(Fe&&!_.optimize)return Mx(v);let ze,Le,it=Be||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(Q!=="none"&&!le)try{ze=await fp(T,{strategy:Q,...ce}),Le=dp(it,ze,ce)}catch{}let xt=K!==void 0&&z!==void 0,bt;if(xt)bt=Ox(v,it,ze,_);else bt=await Dx(v,it,ze,_);let St;if(le){let Ct=G.includes("webp")?"webp":G[0],vt=hl(T,q,{...ae,q:ee},Ct),dt=typeof H==="object"?yl(H):H||"100vw";St=`<link rel="preload" as="image" imagesrcset="${vt}" imagesizes="${dt}" />`}let pt=[];if(!gp&&Q!=="none")pt.push(vl),gp=!0;if(Le)pt.push(Le);let $t=ue?hp(it):void 0;return{html:bt,preloadLink:St,css:pt.length>0?pt.join(`
1670
+ `):void 0,script:$t}}async function Dx(v,_,k,R){let{src:T,alt:B,width:z,height:F,sizes:H,widths:q=ps,formats:K=po,quality:G=wl,params:ee={},lazy:ae=!0,priority:Q=!1,loading:ce=Q?"eager":ya,decoding:ue=ha,fetchpriority:le,objectFit:pe,objectPosition:de,crossorigin:Re,referrerpolicy:be}=v,{class:xe,style:Ie}=v,Me=v.data||{},Ne=typeof H==="object"?yl(H):H||"100vw",je=[];for(let Fe of K){let Ue=hl(T,q,{...ee,q:G},Fe),ze=xl(Fe);if(ae&&!Q)je.push(` <source type="${ze}" data-srcset="${Ue}" data-sizes="${Ne}" />`);else je.push(` <source type="${ze}" srcset="${Ue}" sizes="${Ne}" />`)}let Be=Sl({src:go(T,{...ee,q:G}),alt:B,width:z,height:F,loading:Q?void 0:ce,decoding:ue,fetchpriority:Q?"high":le,objectFit:pe,objectPosition:de,crossorigin:Re,referrerpolicy:be,className:mp(xe,k),style:$l(Ie,pe,de,k),lazy:ae&&!Q,data:Me}),De;if(k){let Fe=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;De=`<div id="${_}" class="stx-img-placeholder" style="${Fe}">
1671
+ <picture>
1672
+ ${je.join(`
1673
+ `)}
1674
+ <img ${Be} />
1675
+ </picture>
1676
+ </div>`}else De=`<picture${_?` id="${_}"`:""}>
1677
+ ${je.join(`
1678
+ `)}
1679
+ <img ${Be} />
1680
+ </picture>`;return De}function Ox(v,_,k,R){let{src:T,alt:B,width:z,height:F,dpr:H=[1,2,3],quality:q=wl,params:K={},lazy:G=!0,priority:ee=!1,loading:ae=ee?"eager":ya,decoding:Q=ha,fetchpriority:ce,objectFit:ue,objectPosition:le,crossorigin:pe,referrerpolicy:de}=v,{class:Re,style:be}=v,xe=v.data||{},Ie=typeof z==="number"?z:Number.parseInt(String(z),10),Me=up(T,Ie,H,{...K,q}),Ne=Sl({src:go(T,{...K,w:Ie,q}),alt:B,width:z,height:F,loading:ee?void 0:ae,decoding:Q,fetchpriority:ee?"high":ce,objectFit:ue,objectPosition:le,crossorigin:pe,referrerpolicy:de,className:mp(Re,k),style:$l(be,ue,le,k),lazy:G&&!ee,data:xe}),je=G&&!ee?`data-srcset="${Me}"`:`srcset="${Me}"`;if(k){let Be=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${Be}">
1681
+ <img ${Ne} ${je} />
1682
+ </div>`}return`<img ${_?`id="${_}" `:""}${Ne} ${je} />`}function Mx(v){let{src:_,alt:k,width:R,height:T,loading:B=ya,decoding:z=ha,fetchpriority:F,objectFit:H,objectPosition:q,crossorigin:K,referrerpolicy:G,priority:ee=!1}=v,{class:ae,style:Q,id:ce}=v,ue=v.data||{};return{html:`<img ${Sl({src:_,alt:k,width:R,height:T,loading:ee?"eager":B,decoding:z,fetchpriority:ee?"high":F,objectFit:H,objectPosition:q,crossorigin:K,referrerpolicy:G,className:ae,style:$l(Q,H,q),id:ce,data:ue})} />`}}function Sl(v){let _=[];if(v.lazy)_.push(`data-src="${Fn(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${Fn(v.src)}"`);if(_.push(`alt="${Fn(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="${Fn(v.className)}"`);if(v.style)_.push(`style="${Fn(v.style)}"`);if(v.id)_.push(`id="${Fn(v.id)}"`);if(v.data)for(let[k,R]of Object.entries(v.data))_.push(`data-${k}="${Fn(R)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function mp(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 Fn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hp(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 Nx(v,_){let k=await Px();if(!k)return ma({...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 yp(v,B,_)}else{let B=await k.processImage(v.src,v,R);if(B.processed)return _l(v,B,_)}return ma({...v,process:!1},_)}async function _l(v,_,k){let{alt:R,width:T,height:B,lazy:z=!0,priority:F=!1,objectFit:H,objectPosition:q,crossorigin:K,referrerpolicy:G}=v,{class:ee,style:ae}=v,Q=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,ce=v.data||{},ue=_.variants||[],le=ue.find((Le)=>Le.format==="jpeg")||ue.find((Le)=>Le.format==="webp")||ue[0],pe=le?.url||v.src,de=ue.filter((Le)=>Le.format===(le?.format||"jpeg")).map((Le)=>`${Le.url} ${Le.width}w`).join(", "),Re=new Map;for(let Le of ue){if(!Re.has(Le.format))Re.set(Le.format,[]);Re.get(Le.format).push(Le)}let be=[],xe=["avif","webp","jpeg","png"];for(let Le of xe){let it=Re.get(Le);if(it&&it.length>0){let xt=it.map((St)=>`${St.url} ${St.width}w`).join(", "),bt=xl(Le);if(z&&!F)be.push(` <source type="${bt}" data-srcset="${xt}" />`);else be.push(` <source type="${bt}" srcset="${xt}" />`)}}let Ie=[];if(z&&!F){if(Ie.push(`data-src="${Fn(pe)}"`),Ie.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),de)Ie.push(`data-srcset="${de}"`)}else if(Ie.push(`src="${Fn(pe)}"`),de)Ie.push(`srcset="${de}"`);Ie.push(`alt="${Fn(R)}"`);let Me=T||_.originalWidth,Ne=B||_.originalHeight;if(Me)Ie.push(`width="${Me}"`);if(Ne)Ie.push(`height="${Ne}"`);if(!F)Ie.push(`loading="${z?"lazy":"eager"}"`);if(Ie.push('decoding="async"'),F)Ie.push('fetchpriority="high"');if(K)Ie.push(`crossorigin="${K}"`);if(G)Ie.push(`referrerpolicy="${G}"`);let je=[];if(H)je.push(`object-fit: ${H}`);if(q)je.push(`object-position: ${q}`);if(_.placeholder&&z)je.push("opacity: 0; transition: opacity 300ms ease-out");if(ae)je.push(ae);if(je.length>0)Ie.push(`style="${je.join("; ")}"`);let Be=[];if(ee)Be.push(ee);if(_.placeholder)Be.push("stx-img-blur");if(Be.length>0)Ie.push(`class="${Be.join(" ")}"`);if(z&&!F)Ie.push("data-stx-lazy");for(let[Le,it]of Object.entries(ce))Ie.push(`data-${Le}="${Fn(it)}"`);let De;if(_.placeholder||_.dominantColor&&v.useDominantColor){let Le=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;De=`<div id="${Q}" class="stx-img-placeholder" style="${Le}">
1720
+ <picture>
1721
+ ${be.join(`
1722
+ `)}
1723
+ <img ${Ie.join(" ")} />
1724
+ </picture>
1725
+ </div>`}else De=`<picture${Q?` id="${Q}"`:""}>
1726
+ ${be.join(`
1727
+ `)}
1728
+ <img ${Ie.join(" ")} />
1729
+ </picture>`;let Fe=[];if(_.placeholder)Fe.push(vl);let Ue=z?hp(Q):void 0,ze;if(F&&de)ze=`<link rel="preload" as="image" imagesrcset="${de}" />`;return{html:De,preloadLink:ze,css:Fe.length>0?Fe.join(`
1730
+ `):void 0,script:Ue}}async function yp(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 jx(){return st({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}=Lx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let F={src:T,alt:B||"",widths:z.widths||ps,formats:z.formats||po,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},H=k.__isDev||!1,q=await ma(F,{isDev:H}),K=q.html;if(q.preloadLink)K=q.preloadLink+`
1731
+ `+K;if(q.css)K+=`
1732
+ <style>${q.css}</style>`;if(q.script)K+=`
1733
+ <script>${q.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Lx(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=Bx(R),B=kl(T[0],k)||"",z=kl(T[1],k)||"",F={};if(T[2]){let H=kl(T[2],k);if(typeof H==="object"&&H!==null)F=H;else if(typeof T[2]==="string")try{F=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:F}}function Bx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let F=0;F<v.length;F++){let H=v[F],q=F>0?v[F-1]:"";if((H==='"'||H==="'"||H==="`")&&q!=="\\"){if(!R)R=!0,T=H;else if(H===T)R=!1,T="";else k+=H;continue}if(!R){if(H==="{")B++;if(H==="}")B--;if(H==="[")z++;if(H==="]")z--;if(H===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=H}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 xp=jx();async function vp(){try{return await import("./chunk-7446n6a3.js")}catch(v){if(!bp)console.warn("[stx-media] Video processor not available, some features disabled:",v),bp=!0;return null}}var bp=!1,wp=!0,Sp="metadata",zx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function xa(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Hx(R,k)}if(k.processedResult?.processed)return _p(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await qx(R,k);let{src:B,sources:z=[],poster:F,posterPlaceholder:H,controls:q=wp,autoplay:K=!1,muted:G=!1,loop:ee=!1,preload:ae=Sp,playsinline:Q=!0,lazy:ce=!0,player:ue="native",type:le,width:pe,height:de,crossorigin:Re,disablePictureInPicture:be=!1,disableRemotePlayback:xe=!1}=v,Ie=T||F,{class:Me,style:Ne}=v,je=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ue==="ts-video")return Fx(v,_);if(le&&le!=="video")return Wx(B||"",le,v);let Be=z.length>0?z:B?[{src:B,type:$p(B)}]:[],De=[`id="${je}"`];if(q)De.push("controls");if(K)De.push("autoplay");if(G)De.push("muted");if(ee)De.push("loop");if(Q)De.push("playsinline");if(be)De.push("disablepictureinpicture");if(xe)De.push("disableremoteplayback");if(Re)De.push(`crossorigin="${Re}"`);if(ce){if(De.push(`data-preload="${ae}"`),De.push('preload="none"'),Ie)De.push(`data-poster="${an(Ie)}"`);De.push("data-stx-lazy")}else if(De.push(`preload="${ae}"`),Ie)De.push(`poster="${an(Ie)}"`);if(pe)De.push(`width="${pe}"`);if(de)De.push(`height="${de}"`);if(Me)De.push(`class="${an(Me)}"`);if(Ne)De.push(`style="${an(Ne)}"`);let Fe=Be.map((Le)=>` <source ${ce?`data-src="${an(Le.src)}"`:`src="${an(Le.src)}"`} type="${Le.type}"${Le.media?` media="${Le.media}"`:""} />`).join(`
1734
+ `),Ue=`<video ${De.join(" ")}>
1735
+ ${Fe}
1736
+ Your browser does not support the video tag.
1737
+ </video>`,ze;if(ce)ze=`
1738
+ (function() {
1739
+ var video = document.getElementById('${je}');
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:Ue,script:ze}}function Wx(v,_,k){let{width:R=640,height:T=360}=k,{class:B,style:z}=k,F=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,H,q=null;switch(_){case"youtube":q=Vx(v),H=q?`https://www.youtube-nocookie.com/embed/${q}`:v;break;case"vimeo":q=Ux(v),H=q?`https://player.vimeo.com/video/${q}`:v;break;case"dailymotion":q=v.split("/").pop()||"",H=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=v.split("/").pop()||"",H=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:H=v}let K=[`id="${F}"`,`src="${an(H)}"`,`width="${R}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(B)K.push(`class="${an(B)}"`);if(z)K.push(`style="${an(z)}"`);if(k.lazy)K.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1773
+ <iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1774
+ </div>`}}function Fx(v,_={}){let{src:k,sources:R=[],poster:T,controls:B=!0,autoplay:z=!1,muted:F=!1,loop:H=!1,preload:q="metadata",playsinline:K=!0,lazy:G=!0,width:ee,height:ae}=v,{class:Q,style:ce}=v,ue=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,le={src:R.length>0?R:k,autoplay:z,loop:H,muted:F,playsinline:K,preload:q,poster:T,controls:B,title:v.title},pe=["position: relative",ee?`width: ${typeof ee==="number"?ee+"px":ee}`:"width: 100%",ae?`height: ${typeof ae==="number"?ae+"px":ae}`:"",ce||""].filter(Boolean).join("; "),de=`
1775
+ <div
1776
+ id="${ue}"
1777
+ class="ts-video-player${Q?" "+an(Q):""}"
1778
+ style="${pe}"
1779
+ data-ts-video-player
1780
+ data-config='${JSON.stringify(le)}'
1781
+ ${G?"data-lazy":""}
1782
+ >
1783
+ <div class="ts-video-player__container">
1784
+ ${T?`
1785
+ <div class="ts-video-player__placeholder" style="background-image: url('${an(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(),Re=`
1796
+ (function() {
1797
+ var container = document.getElementById('${ue}');
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 = '${zx}';
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(),be=`
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:de,script:Re,css:be}}function $p(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 Vx(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 Ux(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function an(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Hx(v,_){let k=await vp();if(!k)return xa({...v,process:!1},_);let R=_.tsVideosConfig,T=await k.processVideo(v.src,v,R,v.onProcessProgress);if(T.processed)return _p(v,T,_);return xa({...v,process:!1},_)}async function qx(v,_){let k=await vp();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 _p(v,_,k){let{controls:R=wp,autoplay:T=!1,muted:B=!1,loop:z=!1,preload:F=Sp,playsinline:H=!0,lazy:q=!0,width:K,height:G,crossorigin:ee,disablePictureInPicture:ae=!1,disableRemotePlayback:Q=!1}=v,{class:ce,style:ue}=v,le=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,pe=v.src,de=$p(pe);if(_.transcoded)pe=_.transcoded.url,de="video/mp4";let Re=_.streaming?.hls||_.streaming?.dash;if(Re){if(_.streaming?.hls)pe=_.streaming.hls.manifestUrl,de="application/x-mpegURL";else if(_.streaming?.dash)pe=_.streaming.dash.manifestUrl,de="application/dash+xml"}let be=_.poster?.url||v.poster,xe=[`id="${le}"`];if(R)xe.push("controls");if(T)xe.push("autoplay");if(B)xe.push("muted");if(z)xe.push("loop");if(H)xe.push("playsinline");if(ae)xe.push("disablepictureinpicture");if(Q)xe.push("disableremoteplayback");if(ee)xe.push(`crossorigin="${ee}"`);if(q){if(xe.push(`data-preload="${F}"`),xe.push('preload="none"'),be)xe.push(`data-poster="${an(be)}"`);xe.push("data-stx-lazy")}else if(xe.push(`preload="${F}"`),be)xe.push(`poster="${an(be)}"`);let Ie=K||_.metadata?.width,Me=G||_.metadata?.height;if(Ie)xe.push(`width="${Ie}"`);if(Me)xe.push(`height="${Me}"`);if(ce)xe.push(`class="${an(ce)}"`);if(ue)xe.push(`style="${an(ue)}"`);let je=` <source ${q?`data-src="${an(pe)}"`:`src="${an(pe)}"`} type="${de}" />`,Be=`<video ${xe.join(" ")}>
1942
+ ${je}
1943
+ Your browser does not support the video tag.
1944
+ </video>`;if(_.spriteSheet)Be=`<div class="stx-video-wrapper" data-sprite-sheet="${an(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
1945
+ ${Be}
1946
+ </div>`;let De;if(q)De=`
1947
+ (function() {
1948
+ var video = document.getElementById('${le}');
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 Fe;if(Re)Fe=`
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:Be,script:De,css:Fe}}function kp(){return st({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}=Kx(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},H={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},q=await xa(z,H),K=q.html;if(q.css)K+=`
1991
+ <style>${q.css}</style>`;if(q.script)K+=`
1992
+ <script>${q.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Kx(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=Xx(R),B=Ep(T[0],k)||"",z={};if(T[1]){let F=Ep(T[1],k);if(typeof F==="object"&&F!==null)z=F;else if(typeof T[1]==="string")try{z=JSON.parse(T[1])}catch{}}return{src:B,options:z}}function Xx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let F=0;F<v.length;F++){let H=v[F],q=F>0?v[F-1]:"";if((H==='"'||H==="'"||H==="`")&&q!=="\\"){if(!R)R=!0,T=H;else if(H===T)R=!1,T="";else k+=H;continue}if(!R){if(H==="{")B++;if(H==="}")B--;if(H==="[")z++;if(H==="]")z--;if(H===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=H}if(k.trim())_.push(k.trim());return _}function Ep(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=kp();import Zx from"fs";import On from"path";async function gr(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 Gx(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 Gx(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 F=null;if(On.isAbsolute(T)&&await r(T))F=T;else if(_.componentsDir){let ce=On.join(_.componentsDir,T);if(await r(ce))F=ce}if(!F)F=await fr(T,process.cwd(),_,k);if(!F)return console.error(`Web component source file not found: ${T}`),null;let H=await Bun.file(F).text();k.add(F);let K=(v.outputFormat||"js")==="ts",G=K?Yx({name:R,tag:B,baseElement:z,source:H,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):Jx({name:R,tag:B,baseElement:z,source:H,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),ee=_.webComponents?.outputDir||"dist/web-components";await Zx.promises.mkdir(ee,{recursive:!0});let ae=K?"ts":"js",Q=On.join(ee,`${B}.${ae}`);if(await Bun.write(Q,G),_.debug)console.log(`Built web component ${R} -> ${Q}`);return Q}function Jx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:F,attributes:H=[]}=v,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>");let K="";if(F)K=`<link rel="stylesheet" href="${F}">`;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 = \`${K}${q}\`
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"} = \`${K}${q}\`
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
+ ${H.length>0?`
2058
+ static get observedAttributes() {
2059
+ return [${H.map((G)=>`'${G}'`).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 Yx(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:B,template:z,styleSource:F,attributes:H=[],attributeTypes:q={}}=v,K=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!B)G=G.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),G=G.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),G=G.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),G=G.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");G=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let ee=F?`<link rel="stylesheet" href="${F}">`:"",ae=(be)=>{switch(q[be]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},Q=(be)=>be.replace(/-([a-z])/g,(xe,Ie)=>Ie.toUpperCase()),ce=H.map((be)=>` private _${Q(be)}: ${ae(be)} | null = null;`).join(`
2085
+ `),ue=H.map((be)=>{let xe=ae(be),Ie=Q(be);return`
2086
+ get ${Ie}(): ${xe} | null {
2087
+ return this._${Ie};
2088
+ }
2089
+
2090
+ set ${Ie}(value: ${xe} | null) {
2091
+ this._${Ie} = value;
2092
+ if (value !== null) {
2093
+ this.setAttribute('${be}', String(value));
2094
+ }
2095
+ else {
2096
+ this.removeAttribute('${be}');
2097
+ }
2098
+ }`}).join(`
2099
+ `),le=H.length>0?`/**
2100
+ * Props interface for ${_}
2101
+ */
2102
+ export interface ${K}Props {
2103
+ ${H.map((be)=>{let xe=ae(be);return` ${Q(be)}?: ${xe};`}).join(`
2104
+ `)}
2105
+ }
2106
+ `:"",pe=H.length>0?`
2107
+ static get observedAttributes(): string[] {
2108
+ return [${H.map((be)=>`'${be}'`).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(q)};
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
+ `:"",de=z?`
2132
+ private _createTemplate(): void {
2133
+ const template = document.createElement('template');
2134
+ template.innerHTML = \`${ee}${G}\`;
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"} = \`${ee}${G}\`;
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
+ ${le}
2160
+ /**
2161
+ * ${_} custom element class
2162
+ * @customElement ${k}
2163
+ */
2164
+ export class ${K} extends ${R} {
2165
+ ${ce}
2166
+ private _initialized = false;
2167
+ ${B?"":"private _slotContent: Node[] = [];"}
2168
+
2169
+ constructor() {
2170
+ super();
2171
+ ${B?'this.attachShadow({ mode: "open" });':""}
2172
+ }
2173
+ ${de}
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
+ ${pe}
2212
+ ${ue}
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}': ${K};
2234
+ }
2235
+ }
2236
+
2237
+ // Register the web component
2238
+ customElements.define('${k}', ${K});
2239
+ `}function Qx(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),R=k?k[1].trim():"",T=_,B=[],z=!0;if(R){let G=R.match(/export\s+default\s+({[\s\S]*})/);if(G)try{let ee=G[1],ae=ee.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(ae)T=ae[1];let Q=ee.match(/props\s*:\s*\[([\s\S]*?)\]/);if(Q)B=Q[1].split(",").map((ue)=>ue.trim().replace(/['"`]/g,"")).filter((ue)=>ue.length>0);let ce=ee.match(/shadowDOM\s*:\s*(true|false)/);if(ce)z=ce[1]==="true"}catch{}}let F=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),H=F?F[1].trim():"",q=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=q?q[1].trim():"";return{tag:T,props:B,template:H,styles:K,script:R,shadowDOM:z}}function eb(v){let{tag:_,props:k,template:R,styles:T,shadowDOM:B}=v,z=_.split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(""),F=R.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),H=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=k.map((G)=>`'${G}'`).join(", "),K=k.map((G)=>`
2240
+ get ${G}() {
2241
+ return this.getAttribute('${G}') || '';
2242
+ }
2243
+ set ${G}(value) {
2244
+ if (value) {
2245
+ this.setAttribute('${G}', value);
2246
+ }
2247
+ else {
2248
+ this.removeAttribute('${G}');
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 [${q}];
2264
+ }
2265
+
2266
+ attributeChangedCallback(name, oldValue, newValue) {
2267
+ if (oldValue !== newValue) {
2268
+ this._render();
2269
+ }
2270
+ }
2271
+ ${K}
2272
+
2273
+ _render() {
2274
+ const template = \`${H?`<style>${H}</style>`:""}${F}\`;
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 Cp(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",F=On.isAbsolute(z)?[On.join(z,`${T}.stx`),On.join(On.dirname(R),`${T}.stx`)]:[On.join(On.dirname(R),z,`${T}.stx`),On.join(process.cwd(),z,`${T}.stx`),On.join(On.dirname(R),`${T}.stx`)],H=null;for(let G of F)if(await r(G)){H=await Bun.file(G).text();break}if(!H)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let q=Qx(H,T);return`<script type="module">
2291
+ ${eb(q)}
2292
+ </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Ft,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:lp,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Cp,hasEndTag:!1,description:"Include a web component in the template"},Li,ji,br,vr,Gf,Yf,Qf,Jf,op,Zf,xp,El,...Pr],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 nb(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=cn.join(T,"resources","views"),z=cn.join(T,"resources","layouts");if(Fs.existsSync(B)&&Fs.existsSync(z))return{root:"resources",pagesDir:"views"};let F=cn.join(T,"resources","views","pages");if(Fs.existsSync(F))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var Rp=new Set,va=["partialsDir","componentsDir","layoutsDir"],Cl=new WeakMap;function rb(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=nb(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!Rp.has(T))Rp.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 va){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 va){let z=v[B];if(typeof z!=="string"||!z)continue;if(cn.isAbsolute(z)||rb(z,T))continue;v[B]=cn.join(T,z)}}for(let T of va){let B=v[T];if(typeof B!=="string"||!B||cn.isAbsolute(B))continue;v[T]=cn.resolve(_,B)}return v}function sb(v,_){let k=Cl.get(v);for(let R of va){let T=v[R];if(typeof T!=="string"||!T)continue;let B=cn.isAbsolute(T)?T:cn.join(_,T);if(Fs.existsSync(B))continue;let z=k?.[R]??T,F=v.root,H=!!F&&F!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(H?`, resolved under root "${F}".`:"."))}}function ib(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function ob(v){if(Vi(v.stateDir),v.stateDir=En(),v.cachePath=Tn(v.cachePath),v.build)v.build.cacheDir=Tn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=Tn(v.media.cache.directory);if(v.story)v.story.outDir=Tn(v.story.outDir)}var Dr=null,Xr=new Map,ba=new Map,mo=null;async function Bs(v,_=tb){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?cn.resolve(v):process.cwd(),k=ba.get(_);if(k&&k.signature!==mr(k.graph)){let B=Xr.get(_);if(Xr.delete(_),ba.delete(_),!v)Dr=null,mo=null;let{clearComponentCache:z}=await import("./chunk-84f8tft8.js"),{partialsCache:F}=await import("./chunk-9vxdjpn5.js");if(z(),F.clear(),B&&k.configSignature===hr(k.graph)){let H=B.then(async(q)=>{let K={...k.graph};await zs(K,_),ba.set(_,{graph:K,signature:mr(K),configSignature:hr(K)});let G={...q,_layerGraph:K};if(!v)Dr=G;return G});return Xr.set(_,H),H}}if(!v){if(Dr)return Dr;if(mo)return mo}let R=Xr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((ee)=>Fs.existsSync(cn.join(_,`stx.config${ee}`))),F=B.some((ee)=>Fs.existsSync(cn.join(_,"config",`ui${ee}`))),H;if(z&&F){let ee=await Bs({name:"ui",cwd:cn.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});H=(await Bs({name:"stx",alias:"ui",cwd:_,defaultConfig:ee.config,errorPolicy:"throw",verbose:!1})).config}else H=(await Bs({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(H.extends!==void 0||k){let ee=await zi(_,A);H=ee.config,ba.set(_,{graph:ee.graph,signature:mr(ee.graph),configSignature:hr(ee.graph)})}if(H.runtimeConfig){let{resolveRuntimeConfig:ee}=await import("./chunk-v6xk1q66.js");ee(H.runtimeConfig,{});let{generateRuntimeConfigTypes:ae}=await import("./chunk-yydx0sfy.js");await ae(_,H.runtimeConfig)}ib(H),ob(H),el(H,_),sb(H,_);let q=[],K=new Set((H.plugins??[]).map((ee)=>typeof ee==="string"?ee:ee[0]));for(let ee of H.componentPackages??["@stacksjs/components"]){let ae=`${ee}/stx-plugin`;if(K.has(ae)||K.has(ee))continue;try{u.resolve(ae,{paths:[_]}),q.push(ae)}catch{}}let G=[...H.plugins??[],...q];if(G.length>0){let{pluginManager:ee}=await import("./chunk-jv3rdes9.js"),ae=[],Q=[];for(let ce of G){let ue=typeof ce==="string"?ce:ce[0],le=typeof ce==="string"?{}:ce[1]||{};try{let pe,de;try{let be=u.resolve(ue,{paths:[_]});pe=await import(be),de=cn.dirname(be)}catch{let be=cn.resolve(_,ue);pe=await import(be),de=cn.dirname(be)}let Re=pe.default||pe;if(!ee.has(Re.name))await ee.register(Re,H);if(Re.components){let be=Array.isArray(Re.components)?Re.components:[Re.components];for(let xe of be)ae.push(cn.resolve(de,xe))}if(Re.pages){let be=cn.resolve(de,Re.pages),xe=le.path||"/";Q.push({dir:be,prefix:xe})}if(Re.setup){let be={addDirective:(xe)=>{H.customDirectives=H.customDirectives||[],H.customDirectives.push(xe)},addRoute:(xe,Ie)=>{H.apiRoutes=H.apiRoutes||{},H.apiRoutes[xe]=Ie},addMiddleware:(xe)=>{H.middleware=H.middleware||[],H.middleware.push(xe)},pluginDir:de,config:H};await Re.setup(le,be)}process.stderr.write(`[stx] Plugin loaded: ${Re.name||ue}
2293
+ `)}catch(pe){console.warn(`[stx] Failed to load plugin ${ue}:`,pe.message)}}H._pluginComponentDirs=ae,H._pluginPageDirs=Q}return H})();if(Xr.set(_,T),T.catch(()=>{if(Xr.get(_)===T)Xr.delete(_)}),!v)mo=T,T.then((B)=>{Dr=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Dr&&_ in Dr)return Dr[_];if(!mo)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function yu(v){return v}function bu(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 he(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await ab.promises.stat(v)).mtime.getTime();if(_.cache&&Al.has(v)){let G=Al.get(v);if(G.updatedAt>=R)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:B,content:z}=rr(T),F=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=We(z,{gfm:!0});if(F.syntaxHighlighting?.enabled&&F.syntaxHighlighting?.serverSide)q=await lb(q,F.syntaxHighlighting?.defaultTheme||"github-dark",F.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:q,data:B||{}};if(_.cache)Al.set(v,{...K,updatedAt:R});return K}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 wa=null;async function lb(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!wa)try{wa=await cb({theme:_||"github-dark",cache:!0})}catch(F){return console.error("Failed to initialize ts-syntax-highlighter:",F),v}let T=async(F,H,q,K)=>{let G=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),ee=q||(k?"text":"");if(!ee)return F;try{if(!wa.getSupportedLanguages().includes(ee))return F;return(await wa.highlight(G,ee,{theme:_})).html}catch(ae){console.error(`Error highlighting code block with language ${q}:`,ae)}return F},B=v,z=v.matchAll(R);for(let F of z){let[H,q,K,G]=F,ee=await T(H,q,K,G);B=B.replace(H,ee)}return B}async function Ap(v,_,k="",R={}){return await ub(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,F,H,q)=>{try{let K=F;if(!Rl.isAbsolute(F))K=Rl.resolve(Rl.dirname(k),F);let G={};if(H)try{try{G=JSON.parse(H)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let pe=H.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let de of pe){let Re=de.indexOf(":");if(Re>0){let be=de.substring(0,Re).trim(),xe=de.substring(Re+1).trim(),Ie=xe.startsWith('"')&&xe.endsWith('"'),Me=xe.startsWith("'")&&xe.endsWith("'");if(Ie||Me)xe=xe.substring(1,xe.length-1);G[be]=xe}}}}catch(le){if(R.debug)console.error("Error parsing context in @markdown-file directive:",le)}let{content:ee,data:ae}=await he(K,R),Q={..._,...ae,...G},ce=ee,ue=/\{\{([^}]+)\}\}/g;return ce=ce.replace(ue,(le,pe)=>{let de=pe.trim();return Q[de]!==void 0?String(Q[de]):le}),ce}catch(K){let G=K instanceof Error?K.message:String(K);return g("Markdown File",`Error including markdown file: ${G}`,k,v,q,z)}})}async function ub(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let F=T[0],H=T.index,q=T;R.push(k(...q).then((K)=>({match:F,replacement:K,index:H})))}let B=await Promise.all(R);B.sort((F,H)=>H.index-F.index);let z=v;for(let{match:F,replacement:H}of B)z=z.replace(F,()=>H);return z}function Or(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Mr(v,_){let k=db(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function db(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 fb(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Zr(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),F=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,F.lastIndex=B;let H=z.exec(v),q=F.exec(v),K=H?H.index:1/0,G=q?q.index:1/0;if(K<G)T++,B=K+H[0].length;else if(G<1/0){if(T--,T===0)return G;B=G+q[0].length}else break}return-1}function Tp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=Mr(v,R);if(!T)return null;let B=T.endPos,z=Zr(v,"if","endif",B);if(z===-1)return null;let F=v.slice(B,z),H=[],q=0,K="if",G=T.expression,ee=0,ae=0;while(q<F.length){let Q=F.indexOf("@",q);if(Q===-1)break;q=Q;let ce=F.substring(Q);if(fb(F,Q)){q++;continue}if(/^@if\s*\(/.test(ce)){ae++,q++;continue}if(/^@endif(?![a-z])/.test(ce)){ae--,q+=6;continue}if(ae===0){let ue=ce.match(/^@elseif\s*/);if(ue){H.push({type:K,condition:G,content:F.substring(ee,q),start:B+ee,end:B+q});let le=q+ue[0].length,pe=Mr(F,le);if(!pe){q++;continue}K="elseif",G=pe.expression,q=pe.endPos,ee=q;continue}else if(/^@else(?![a-z])/.test(ce)){H.push({type:K,condition:G,content:F.substring(ee,q),start:B+ee,end:B+q}),K="else",G=void 0,q+=5,ee=q;continue}}q++}return H.push({type:K,condition:G,content:F.slice(ee),start:B+ee,end:B+F.length}),{fullMatch:v.slice(_,z+6),branches:H,start:_,end:z+6}}function ho(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=Tp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function Sa(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((ce)=>B.index>ce.start&&B.index<ce.end)){B=T.exec(v);continue}let F=B.index,H=F+B[0].length-1,q=S(v,"(",")",H);if(q===-1){B=T.exec(v);continue}let K=v.slice(H+1,q),G=q+1,ee=Zr(v,_,k,G);if(ee===-1){B=T.exec(v);continue}let ae=v.slice(G,ee),Q=ee+`@${k}`.length;R.push({fullMatch:v.slice(F,Q),name:_,params:K,content:ae,start:F,end:Q}),T.lastIndex=Q,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=Mr(v,R);if(!T)return null;let B=T.endPos,z=Zr(v,"switch","endswitch",B);if(z===-1)return null;let F=v.slice(B,z),H=[],q=0,K=null,G=0;while(q<F.length){let ee=F.slice(q),ae=ee.match(/^@switch\s*\(/),Q=ee.match(/^@endswitch(?![a-z])/);if(ae){if(G++,K)K.content+=ae[0];q+=ae[0].length;continue}if(Q){if(G--,K)K.content+=Q[0];q+=Q[0].length;continue}if(G>0){if(K)K.content+=F[q];q++;continue}let ce=ee.match(/^@case\s*/),ue=ee.match(/^@default(?![a-z])/),le=ee.match(/^@break(?![a-z])/);if(ce&&ee.startsWith("@case")){if(K)H.push(K);let pe=q+ce[0].length,de=Mr(F,pe);if(!de){q++;continue}K={type:"case",value:de.expression,content:""},q=de.endPos}else if(ue&&ee.startsWith("@default")){if(K)H.push(K);K={type:"default",content:""},q+=ue[0].length}else if(le&&ee.startsWith("@break"))q+=le[0].length;else{if(K)K.content+=F[q];q++}}if(K)H.push(K);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:H,start:_,end:z+10}}function hb(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,F=Tl(R,z);if(!F)break;try{let H;if(p(F.expression))H=c(F.expression,Object.keys(_))(...Object.values(_));else H=l(F.expression,_);let q="",K=!1;for(let G of F.cases)if(G.type==="default"){if(!K)q=G.content.trim()}else try{let ee;if(G.value&&p(G.value))ee=c(G.value,Object.keys(_))(...Object.values(_));else if(G.value)ee=l(G.value,_);if(H===ee){q=G.content.trim(),K=!0;break}}catch{continue}R=R.substring(0,z)+q+R.substring(F.end),T=!0}catch(H){let q=H instanceof Error?H.message:String(H),K=i("Switch",`Error evaluating @switch expression: ${q}`,t.EVALUATION_ERROR);R=R.substring(0,z)+K+R.substring(F.end);break}}return R}function yb(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function xb(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function xr(v,_,k){let{masked:R,scripts:T}=yb(v);return xb(bb(R,_,k),T)}function bb(v,_,k){let R=v;R=hb(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let F=z.index,H=Mr(R,F+7);if(!H)break;let q=H.endPos,K=Zr(R,"unless","endunless",q);if(K===-1){console.warn(`[stx] @unless directive at position ${F} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=R.slice(q,K),ee=H.expression,ae=-1;{let ce=0,ue=/@(?:if|unless)\s*\(/g,le=/@(?:endif|endunless)(?![a-z])/g,pe=/@else(?![a-z])/g,de=[],Re;while((Re=ue.exec(G))!==null)de.push({pos:Re.index,type:"open"});while((Re=le.exec(G))!==null)de.push({pos:Re.index,type:"close"});while((Re=pe.exec(G))!==null)de.push({pos:Re.index,type:"else"});de.sort((be,xe)=>be.pos-xe.pos);for(let be of de)if(be.type==="open")ce++;else if(be.type==="close")ce--;else if(be.type==="else"&&ce===0){ae=be.pos;break}}let Q;if(ae!==-1){let ce=G.slice(0,ae),ue=G.slice(ae+5);Q=`@if (${ee})${ue}@else ${ce}@endif`}else Q=`@if (!(${ee}))${G}@endif`;R=R.substring(0,F)+Q+R.substring(K+10),B=!0}}R=Pl(R,_,k),R=Dl(R,_,k),R=Il(R,_);let T=()=>{let B=ho(R);if(B.length===0)return!1;let z=Array(B.length);for(let q=B.length-1;q>=0;q--){let K=B[q];try{let G="",ee=!1;for(let ae of K.branches){if(ee)break;if(ae.type==="else")G=ae.content,ee=!0;else try{if(ae.condition?Ji(ae.condition,_):!1)G=ae.content,ee=!0}catch(Q){G=i(ae.type==="if"?"If":"Elseif",`Error in @${ae.type}(${ae.condition}): ${Q instanceof Error?Q.message:String(Q)}`,t.EVALUATION_ERROR),ee=!0}}z[q]=G}catch(G){let ee=G instanceof Error?G.message:String(G);z[q]=i("If",`Error processing @if block: ${ee}`,t.EVALUATION_ERROR)}}let F=Array(B.length*2+1),H=0;for(let q=0;q<B.length;q++){let K=B[q];F[q*2]=R.slice(H,K.start),F[q*2+1]=z[q],H=K.end}return F[B.length*2]=R.slice(H),R=F.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function Ip(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(F,H,q,K){let G=1,ee=K,ae=new RegExp(`@${H}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${q}(?![a-z])`,"g");while(ee<F.length&&G>0){ae.lastIndex=ee,Q.lastIndex=ee;let ce=ae.exec(F),ue=Q.exec(F),le=ce?ce.index:1/0,pe=ue?ue.index:1/0;if(le<pe)G++,ee=le+ce[0].length;else if(pe<1/0){if(G--,G===0)return pe;ee=pe+ue[0].length}else break}return-1}function T(F,H,q){let K=0,G=new RegExp(`@${H}(?:\\s*\\(|\\s|$)`,"g"),ee=new RegExp(`@${q}(?![a-z])`,"g"),ae=/@else(?![a-z])/g,Q=[],ce;while((ce=G.exec(F))!==null)Q.push({pos:ce.index,type:"open"});while((ce=ee.exec(F))!==null)Q.push({pos:ce.index,type:"close"});while((ce=ae.exec(F))!==null)Q.push({pos:ce.index,type:"else"});Q.sort((ue,le)=>ue.pos-le.pos);for(let ue of Q)if(ue.type==="open")K++;else if(ue.type==="close")K--;else if(ue.type==="else"&&K===0)return ue.pos;return-1}{let F=!0;while(F){F=!1;let H=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!H||H.index===void 0)break;let q=H.index,K,G,ee=k.slice(q+5),ae=Ip(ee);if(ae)K=ae.value,G=q+5+ae.consumed;else G=q+5;let Q=R(k,"auth","endauth",G);if(Q===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let ce=k.slice(G,Q),ue=T(ce,"auth","endauth"),le;if(!_.auth)le=!1;else le=K?Or(`auth?.check && auth?.user?.[${K}]`,_):Or("auth?.check",_);let pe;if(ue!==-1){let de=ce.slice(0,ue),Re=ce.slice(ue+5);pe=le?de:Re}else pe=le?ce:"";k=k.substring(0,q)+pe+k.substring(Q+8),F=!0}}{let F=!0;while(F){F=!1;let H=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!H||H.index===void 0)break;let q=H.index,K,G,ee=k.slice(q+6),ae=Ip(ee);if(ae)K=ae.value,G=q+6+ae.consumed;else G=q+6;let Q=R(k,"guest","endguest",G);if(Q===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let ce=k.slice(G,Q),ue=T(ce,"guest","endguest"),le;if(!_.auth)le=!0;else le=K?Or(`!auth?.check || !auth?.user?.[${K}]`,_):Or("!auth?.check",_);let pe;if(ue!==-1){let de=ce.slice(0,ue),Re=ce.slice(ue+5);pe=le?de:Re}else pe=le?ce:"";k=k.substring(0,q)+pe+k.substring(Q+9),F=!0}}function B(F,H,q){if(_.userCan&&typeof _.userCan[F]==="boolean")return _.userCan[F];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let K=[F];if(H)K.push(H);if(q){let G=Or(q,_);K.push(G)}return _.permissions.check(...K)}catch{return!1}return!1}function z(F){let H=F.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!H)return null;return{ability:H[1],type:H[2],id:H[3]?.trim(),paramsEnd:H[0].length}}for(let F of["can","cannot"]){let H=`end${F}`,q=F==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let G=k.match(new RegExp(`@${F}\\s*\\(`));if(!G||G.index===void 0)break;let ee=G.index,ae=k.slice(ee+`@${F}`.length),Q=z(ae);if(!Q)break;let ce=ee+`@${F}`.length+Q.paramsEnd,ue=R(k,F,H,ce);if(ue===-1){console.warn(`[stx] @${F} directive at position ${ee} has no matching @${H} \u2014 the block was skipped.`);break}let le=k.slice(ce,ue),pe=[],de=0,Re=new RegExp(`@${F}\\s*\\(`,"g"),be=new RegExp(`@${H}(?![a-z])`,"g"),xe=new RegExp(`@${q}\\s*\\(`,"g"),Ie=/@else(?![a-z])/g,Me=[],Ne;while((Ne=Re.exec(le))!==null)Me.push({pos:Ne.index,type:"open"});while((Ne=be.exec(le))!==null)Me.push({pos:Ne.index,type:"close"});while((Ne=xe.exec(le))!==null)Me.push({pos:Ne.index,type:"elseDirective"});while((Ne=Ie.exec(le))!==null)Me.push({pos:Ne.index,type:"else"});Me.sort((ze,Le)=>ze.pos-Le.pos);for(let ze of Me){if(ze.type==="open"){de++;continue}if(ze.type==="close"){de--;continue}if(de===0)pe.push(ze)}let je=[],Be=0;for(let ze=0;ze<pe.length;ze++){let Le=pe[ze];if(je.push({content:le.slice(Be,Le.pos),ability:void 0}),Le.type==="elseDirective"){let it=le.slice(Le.pos+`@${q}`.length),xt=z(it);if(xt){je[je.length-1]={content:le.slice(Be,Le.pos)},Be=Le.pos+`@${q}`.length+xt.paramsEnd,je.push({content:"",ability:xt.ability,type:xt.type,id:xt.id}),je.pop();let bt=pe[ze+1],St=bt?bt.pos:le.length;je.push({content:le.slice(Be,St),ability:xt.ability,type:xt.type,id:xt.id}),Be=St}}else Be=Le.pos+5}if(Be<le.length){let ze=je[je.length-1];if(pe.length>0&&pe[pe.length-1].type==="else")je.push({content:le.slice(Be),isFinalElse:!0});else if(je.length===0)je.push({content:le.slice(Be)})}let De=B(Q.ability,Q.type,Q.id),Fe=F==="can"?De:!De,Ue="";if(Fe)Ue=je[0]?.content||"";else{let ze=!1;for(let Le=1;Le<je.length;Le++){let it=je[Le];if(it.isFinalElse){Ue=it.content,ze=!0;break}if(it.ability){let xt=B(it.ability,it.type,it.id);if(F==="can"?xt:!xt){Ue=it.content,ze=!0;break}}}if(!ze&&je.length>0){let Le=je[je.length-1];if(Le.isFinalElse)Ue=Le.content}}k=k.substring(0,ee)+Ue+k.substring(ue+`@${H}`.length),K=!0}}return k}function Pl(v,_,k){let R=v;function T(B,z,F,H,q){let K=!0;while(K){K=!1;let G=new RegExp(`@${z}\\s*\\(`),ee=B.match(G);if(!ee||ee.index===void 0)break;let ae=ee.index,Q=Mr(B,ae+`@${z}`.length);if(!Q)break;let ce=Q.endPos,ue=Zr(B,z,F,ce);if(ue===-1){console.warn(`[stx] @${z} directive at position ${ae} has no matching @${F} \u2014 the block was skipped.`);break}let le=B.slice(ce,ue),pe=Q.expression,de=-1,Re=0,be=0;while(be<le.length){let xe=le.indexOf("@",be);if(xe===-1)break;let Ie=le.substring(xe);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Ie)){Re++,be=xe+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Ie)){Re--,be=xe+1;continue}if(Re===0&&/^@else(?![a-z])/.test(Ie)){de=xe;break}be=xe+1}try{let xe=H(pe.trim()),Ie;if(de!==-1){let Me=le.slice(0,de),Ne=le.slice(de+5);Ie=xe?Me:Ne}else Ie=xe?le:"";B=B.substring(0,ae)+Ie+B.substring(ue+`@${F}`.length),K=!0}catch(xe){let Ie=xe instanceof Error?xe.message:String(xe),Me=i(q,`Error processing @${z} directive: ${Ie}`,t.EVALUATION_ERROR);B=B.substring(0,ae)+Me+B.substring(ue+`@${F}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=Or(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=Or(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,F,H,q){let K=new RegExp(`@${F}(?![a-z])`,"g"),G=new RegExp(`@${H}(?![a-z])`,"g"),ee=new RegExp(`^@${F}(?![a-z])`),ae=new RegExp(`^@${H}(?![a-z])`),Q=z,ce=!0;while(ce){ce=!1,K.lastIndex=0;let ue=K.exec(Q);if(!ue)break;let le=ue.index,pe=le+ue[0].length;if(F==="env"){let De=Q.substring(pe).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!De)break;pe+=De[0].length,q=T===De[2]}let de=1,Re=pe,be=-1;while(de>0&&Re<Q.length){K.lastIndex=Re,G.lastIndex=Re;let De=K.exec(Q),Fe=G.exec(Q),Ue=De?De.index:1/0,ze=Fe?Fe.index:1/0;if(Ue<ze)de++,Re=Ue+De[0].length;else if(ze<1/0){if(de--,de===0){be=ze;break}Re=ze+Fe[0].length}else break}if(be===-1){console.warn(`[stx] @${F} directive at position ${le} has no matching @${H} \u2014 the block was skipped.`);break}let xe=Q.substring(pe,be),Ie=-1,Me=0,Ne=0;while(Ne<xe.length){let De=xe.indexOf("@",Ne);if(De===-1)break;let Fe=xe.substring(De);if(ee.test(Fe)){Me++,Ne=De+1;continue}if(ae.test(Fe)){Me--,Ne=De+1;continue}if(Me===0&&/^@else(?![a-z])/.test(Fe)){Ie=De;break}Ne=De+1}let je;if(Ie!==-1){let De=xe.slice(0,Ie),Fe=xe.slice(Ie+5);je=q?De:Fe}else je=q?xe:"";let Be=`@${H}`.length;Q=Q.substring(0,le)+je+Q.substring(be+Be),ce=!0}return Q}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 Pp=new WeakMap;function Dp(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function $a(v,_){if(!v)return _?.nonceGenerator?.()??Dp();let k=Pp.get(v);if(!k)k=_?.nonceGenerator?.()??Dp(),Pp.set(v,k);return k}function vb(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 Op(v,_){return`<meta http-equiv="Content-Security-Policy" content="${vb(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Mp(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?$a(k,_):void 0,T=Op(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
2294
+ ${T}`)}function Np(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 jp(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?$a(_,B):void 0;return Op(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return $a(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=$a(_,B);return T}import wb from"crypto";var Sb=40,Lp="_token",Ol=null;function $b(v=Sb){let _=wb.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Ol=_,_}function _b(){if(!Ol)$b();return Ol}function kb(v=Lp){let _=_b();return`<input type="hidden" name="${v}" value="${_}">`}function Bp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>kb(R||Lp))}async function zp(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 Eb(T,B,_,k,R);else T=await Cb(T,B,_,k,R)}return T}async function Eb(v,_,k,R,T){let{name:B,handler:z}=_,F=`@${B}`,H=`@end${B}`,q=v,K=Ur(`${F}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${H}`,"g"),G=[],ee=K.exec(q);while(ee!==null){let[ae,Q="",ce=""]=ee,ue=ee.index||0;try{let le=Q?Wp(_,Q):[],pe=ce.trim(),de=await z(pe,le,k,R);G.push({original:ae,processed:de,startIndex:ue})}catch(le){let pe=le instanceof Error?le.message:String(le);if(T.debug)console.error(`Error processing custom directive @${B}:`,le);G.push({original:ae,processed:i("CustomDirective",`Error in @${B}${Q?`(${Q})`:""}: ${pe}`,t.EVALUATION_ERROR),startIndex:ue})}ee=K.exec(q)}for(let ae=G.length-1;ae>=0;ae--){let{original:Q,processed:ce}=G[ae];q=q.replace(Q,ce)}return q}async function Cb(v,_,k,R,T){let{name:B,handler:z}=_,F=v,H=[],q=[];if(_.rawParams){for(let ee of Ks(F,Ur(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(ee.end!==-1)q.push({fullMatch:ee.call,paramString:ee.args,startIndex:ee.start})}else{let ee=Ur(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");ee.lastIndex=0;let ae=ee.exec(F);while(ae!==null)q.push({fullMatch:ae[0],paramString:ae[1]??"",startIndex:ae.index||0}),ae=ee.exec(F)}for(let{fullMatch:ee,paramString:ae,startIndex:Q}of q)try{let ce=Wp(_,ae),ue=await z("",ce,k,R);H.push({original:ee,processed:ue,startIndex:Q})}catch(ce){let ue=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);H.push({original:ee,processed:i("CustomDirective",`Error in @${B}(${ae}): ${ue}`,t.EVALUATION_ERROR),startIndex:Q})}let K=Ur(`@${B}(?!\\w)(?!\\s*\\()`,"g"),G=K.exec(F);while(G!==null){let[ee]=G,ae=G.index||0;try{let Q=await z("",[],k,R);H.push({original:ee,processed:Q,startIndex:ae})}catch(Q){let ce=Q instanceof Error?Q.message:String(Q);if(T.debug)console.error(`Error processing custom directive @${B}:`,Q);H.push({original:ee,processed:i("CustomDirective",`Error in @${B}: ${ce}`,t.EVALUATION_ERROR),startIndex:ae})}G=K.exec(F)}for(let ee=H.length-1;ee>=0;ee--){let{original:ae,processed:Q}=H[ee];F=F.replace(ae,Q)}return F}function Wp(v,_){return v.rawParams?at(_):Rb(_)}function Rb(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 Fp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Vp=/^[A-Za-z_$][\w$]*$/,Ab=new Set(["light","dark","system"]);function Gr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Tb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Gr(_.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(Gr(R.key,"colorMode.key"),Gr(R.attribute,"colorMode.attribute"),Gr(R.default,"colorMode.default"),!Vp.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Fp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Ab.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Gr(k.key,"appearance.key"),Gr(k.attribute,"appearance.attribute"),Gr(k.default,"appearance.default"),!Vp.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Fp.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 Ib(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Pb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Ib(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 Db(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 Up(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Db(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let F=k.slice(B+1,z).trim(),H=l(`(${F})`,_),q=Pb(Tb(H));k=k.slice(0,T.index)+q+k.slice(z+1),R.lastIndex=T.index+q.length}return k}import Ob from"crypto";function sn(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var qp={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 Nn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Hs(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${sn(_)}"`}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="${sn(`${Nn(v)}-error`)}"`;return R}function Mb(){return Ob.randomUUID()}function ka(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=Mb();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${sn(_.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="${sn(B)}">`;return R}),k}function Kp(v,_,k=qp){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,F,H,q="")=>{let K=B||z||"POST",G=F||H||"",ee=Nr(q),ae=K.toUpperCase(),Q=["GET","POST"].includes(ae)?ae:"POST",ce=`<form method="${sn(Q)}" action="${sn(G)}"${ee?` ${ee}`:""}>`;if(ce+=`
2295
+ ${ka("@csrf",_)}`,!["GET","POST"].includes(ae))ce+=`
2296
+ ${ka(`@method('${ae}')`,_)}`;return ce}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,F,H,q="")=>{let K=B||z||"",G=F||H||"",ee=Nr(q),ae=yo(K,_),Q=ae!==void 0&&ae!==null?ae:G||"",ce=ee.match(/type=['"]([^'"]+)['"]/i),ue=ce?ce[1]:"text",le=xo(K,_),pe=ee.match(/class=['"]([^'"]+)['"]/i),de=_a(pe?pe[1]:"",k.input,le,k.inputError),Re=ee.replace(/class=['"][^'"]+['"]/i,"");return Re=Re.replace(/type=['"][^'"]+['"]/i,""),`<input type="${sn(ue)}" name="${sn(K)}"${Hs(ee,Nn(K))} value="${sn(Q)}" class="${de}"${Ml(K,le,ee)}${Re?` ${Re}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",F="")=>{let H=Nr(z),q=yo(B,_)||F.trim(),K=xo(B,_),G=H.match(/class=['"]([^'"]+)['"]/i),ee=_a(G?G[1]:"",k.input,K,k.inputError),ae=H.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${sn(B)}"${Hs(H,Nn(B))} class="${ee}"${Ml(B,K,H)}${ae?` ${ae}`:""}>${sn(q)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",F)=>{let H=Nr(z),q=yo(B,_),K=xo(B,_),G=H.match(/class=['"]([^'"]+)['"]/i),ee=_a(G?G[1]:"",k.input,K,k.inputError),ae=H.replace(/class=['"][^'"]+['"]/i,""),Q=F;if(q!==void 0)Q=F.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(ce,ue,le)=>{if((Array.isArray(q)?q.some((de)=>String(de)===le):String(q)===le)&&!ue.includes("selected"))return ue.replace(/(<option)/,"$1 selected");return ce});return`<select name="${sn(B)}"${Hs(H,Nn(B))} class="${ee}"${Ml(B,K,H)}${ae?` ${ae}`:""}>${Q}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,F="")=>{let H=z===void 0?"1":z,q=z===void 0?Nn(B):`${Nn(B)}-${Nn(H)}`,K=Nr(F),G=yo(B,_),ee=G!==void 0&&(Array.isArray(G)?G.some((ue)=>String(ue)===H):G===!0||String(G)===H),ae=K.match(/class=['"]([^'"]+)['"]/i),Q=ae?ae[1]:k.checkInput,ce=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${sn(B)}"${Hs(K,q)} value="${sn(H)}" class="${Q}"${ee?" checked":""}${ce?` ${ce}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,F="")=>{let H=Nr(F),q=yo(B,_),K=q!==void 0&&q===z,G=H.match(/class=['"]([^'"]+)['"]/i),ee=G?G[1]:k.checkInput,ae=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${sn(B)}"${Hs(H,`${Nn(B)}-${Nn(z)}`)} value="${sn(z)}" class="${ee}"${K?" checked":""}${ae?` ${ae}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let F=Nr(z),H=F.match(/accept=['"]([^'"]+)['"]/i),q=H?H[1]:"",K=F.includes("multiple"),G=xo(B,_),ee=F.match(/class=['"]([^'"]+)['"]/i),ae=_a(ee?ee[1]:"",k.input,G,k.inputError),Q=F.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),ce=[`<input type="file" name="${sn(B)}"${Hs(F,Nn(B))}`,`class="${ae}"`];if(q)ce.push(`accept="${sn(q)}"`);if(K)ce.push("multiple");if(Q)ce.push(Q);return`${ce.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",F)=>{let H=Nr(z),q=H.match(/class=['"]([^'"]+)['"]/i),K=q?q[1]:k.label,G=H.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${sn(Nn(B))}" class="${K}"${G?` ${G}`:""}>${F}</label>`}),R}function Xp(v,_,k=qp){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(xo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(F,H)=>{try{if(H.trim()==="$message"||H.trim()==="message")return Hp(T,_);if(H.trim().includes("errors.first")||H.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Hp(T,_)}let q=H.trim();if(p(q)){let K=l(q,_);return K!==void 0?String(K):q}return q}catch{return H}});return`<div id="${sn(`${Nn(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function xo(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 Hp(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 yo(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 Nr(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 Nl=m(256),Nb=[{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"}],Zp=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function jb(v){let _=Array.from(v,(T)=>T===`
2297
+ `?`
2298
+ `:" "),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]!==`
2299
+ `)_[k]=v[k],k++;continue}if(T==="/"&&B==="*"){let z=v.indexOf("*/",k+2),F=z===-1?v.length:z+2;for(;k<F;k++)_[k]=v[k];continue}if(T==="{"&&B==="{"&&v.slice(k,k+4)==="{{--"){let z=v.indexOf("--}}",k+4),F=z===-1?v.length:z+4;for(;k<F;k++)_[k]=v[k];continue}k++}return _.join("")}function Lb(v){let _=new Map,k=jb(v).split(`
2300
+ `),R=v.split(`
2301
+ `);return k.forEach((T,B)=>{Zp.lastIndex=0;for(let z of T.matchAll(Zp)){let F=z[1]==="-next-line",H=(R[B]??"").slice(0,z.index).trim(),q=F||H===""?B+2:B+1,G=(z[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),ee=G.filter((Q)=>/\w/.test(Q));if(G.length>0&&ee.length===0)continue;let ae=_.get(q);if(ae&&ae.size===0)continue;if(ee.length===0){_.set(q,new Set);continue}if(ae)ee.forEach((Q)=>ae.add(Q));else _.set(q,new Set(ee))}}),_}function Bb(v,_,k){let R=v.get(_);if(!R)return!1;if(R.size===0)return!0;return[...R].some((T)=>k.includes(T))}function Ze(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=Nl.get(B);if(z!==void 0){if(z&&T.failOnViolation)throw new W(z,R??_);return}let F=T.allowPatterns??[],H=Lb(v),q=[],K=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(Q)=>Q.replace(/[^\n]/g," ")));for(let{pattern:Q,message:ce,suggestion:ue}of Nb){if(F.some((pe)=>/\w/.test(pe)&&ce.includes(pe)))continue;Q.lastIndex=0;let le=K.match(Q);if(le&&le.length>0){let pe=K.split(`
2302
+ `),de=v.split(`
2303
+ `),Re=[];if(pe.forEach((Me,Ne)=>{if(Q.lastIndex=0,Q.test(Me)&&!Bb(H,Ne+1,ce))Re.push(Ne+1)}),Re.length===0&&pe.some((Me)=>(Q.lastIndex=0,Q.test(Me))))continue;let be=Re.length>0?` (script line${Re.length>1?"s":""} ${Re.join(", ")})`:"",xe=Re.slice(0,3).map((Me)=>` ${Me} | ${(de[Me-1]??"").trim().slice(0,100)}`).join(`
2304
+ `),Ie=xe?`
2305
+ ${xe}`:"";q.push(` \u2717 ${ce}${be}
2306
+ \u2192 ${ue}${Ie}`)}}if(q.length===0){Nl.set(B,"");return}let G=(Q)=>{let ce=`${process.cwd()}/`;return Q.startsWith(ce)?Q.slice(ce.length):Q},ae=`[STX] DOM API violation in ${R&&R!==_?`${G(R)} (composed into ${G(_)})`:G(_)}:
2307
+ ${q.join(`
2308
+ `)}
2309
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Nl.set(B,ae),console.warn(ae),T.failOnViolation)throw new W(ae,R??_)}var bo=/<\/?template\b[^>]*>/gi,zb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Wb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return zb.test(_)}function se(v){bo.lastIndex=0;let _;while((_=bo.exec(v))!==null){if(_[0].startsWith("</")||Wb(_[0]))continue;let k=_.index,R=bo.lastIndex,T=1,B;while((B=bo.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:bo.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import Jt from"path";import{existsSync as dw}from"fs";class Gp{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=oc(v,R);if(T!==void 0)return T;for(let B of ac(v,_,k,R))if(await r(B))return B;return null}}var ei=new Gp;function Zt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var jr="\x00stx-boolean-attribute";function jl(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Fb=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 Ll(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Fb.has(_)}function Lr(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(Zt(B));continue}if(T===jr){k.push(Zt(B));continue}k.push(`${Zt(B)}="${Zt(jl(String(T)))}"`)}return k}function Br(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(Zt(B));continue}if(typeof T==="object")continue;k.push(`${Zt(B)}="${Zt(jl(String(T)))}"`)}return k}function ti(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vb(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 Bl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Vb(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",F=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,H=[];if(R.reactive)H.push(`:href="${ti(R.value)}"`);else H.push(`href="${ti(ro(R.value,"navigable"))}"`);if(T)H.push(`class="${ti(T)}"`);if(H.push("data-stx-link"),H.push(`data-stx-active-class="${ti(B)}"`),H.push(`data-stx-exact-active-class="${ti(z)}"`),F)H.push("data-stx-prefetch");let q=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(q)H.push(`data-stx-active-match="${ti(q)}"`);let K=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return H.push(...Lr(v,K)),H.push(...Br(v,K)),`<a ${H.join(" ")}>${_}</a>`}};import{createHash as lg}from"crypto";import gn from"fs";import ln from"path";import{decode as Jb,generateThumbHash as Yb}from"ts-images";import{createImageDeliveryCatalog as ng}from"ts-images/delivery";import zl from"fs";function Ea(v,_,k){let R=Buffer.alloc(k),T=zl.readSync(v,R,0,k,_);return R.subarray(0,T)}function Wl(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 Fl(v){let _;try{_=zl.openSync(v,"r");let k=Ea(_,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=Ea(_,T,8);if(z.length<8)return"unknown";let F=z.toString("latin1",4,8);if(F==="tRNS")return"possible";if(F==="IDAT"||F==="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(Wl(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)zl.closeSync(_)}}import Ub from"fs";import Ca from"os";import{join as Jp}from"path";import{fileURLToPath as Yp}from"url";import{Worker as Qp}from"worker_threads";var Aa=Symbol("stx.image-worker.unavailable");function Hb(v=typeof Ca.availableParallelism==="function"?Ca.availableParallelism():Ca.cpus().length){return Math.max(1,Math.min(2,v-1))}var Ra=0,tg=[];async function qb(){if(Ra<Hb()){Ra++;return}await new Promise((v)=>tg.push(v)),Ra++}function Kb(){Ra--,tg.shift()?.()}var Xb="@stacksjs/stx/builtins/image-warmup-worker";function Zb(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:"&&Ub.existsSync(Yp(k)))return Yp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Xb,v):void 0;return k&&Gb(k)?k:void 0}catch{return}}function Gb(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Jp(_.BUN_INSTALL||Jp(Ca.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var eg=!1;function vo(v){if(!eg)eg=!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 Aa}function Vl(v){return v instanceof Error?v.message:String(v)}async function Ul(v,_){if(typeof Qp!=="function")return vo("node:worker_threads has no Worker in this runtime");let k=Zb();if(!k)return vo("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await qb();try{return await new Promise((R,T)=>{let B;try{B=new Qp(k)}catch(q){R(vo(`could not start ${k}: ${Vl(q)}`));return}let z=!1,F=!1,H=(q)=>{if(F)return;F=!0,q(),B.terminate()};B.on("message",(q)=>{if(q.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(q.type==="result"){H(()=>R(q.value));return}let K=Error(q.error?.message??"image worker failed");if(q.error?.name)K.name=q.error.name;if(q.error?.stack)K.stack=q.error.stack;H(()=>T(K))}),B.on("error",(q)=>{H(()=>z?T(q instanceof Error?q:Error(Vl(q)||"image worker crashed")):R(vo(`the worker failed before it was ready: ${Vl(q)}`)))}),B.on("exit",(q)=>{H(()=>z?T(Error("image worker exited before it finished")):R(vo(`the worker exited with code ${q} before it was ready`)))})})}finally{Kb()}}var Qb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),ev=[320,640,960,1280,1920],wo="/_stx/images",tv=`stx:${wo}:alpha-1`,nv=`stx:${wo}:opaque-1`,rv=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ta;function sv(v,_){let k=ln.dirname(Bun.resolveSync(v,_));while(k!==ln.dirname(k)){let R=ln.join(k,"package.json");if(gn.existsSync(R)){let T=JSON.parse(gn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=ln.dirname(k)}return}function rg(){if(Ta!==void 0)return Ta;let v;try{v=ln.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ta=rv.map((_)=>{let k;try{k=v?sv(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),Ta}var sg=Symbol.for("stx.image-delivery");function So(){let v=globalThis;return v[sg]??={catalog:new Map,transparent:new Set},v[sg]}var ig=new Set;function iv(v){return`/${v.split(ln.sep).map(encodeURIComponent).join("/")}`}function ov(v){let _=ln.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=lg("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function og(v,_=`stx:${wo}`){let k=(R)=>`${wo}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=ln.join(v,R);try{let B=await gn.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=ln.join(v,R);await gn.promises.mkdir(ln.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await gn.promises.writeFile(z,T),await gn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function ug(v,_=v){let k=await gn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=ln.join(_,T.name);if(T.isDirectory()){R.push(...await ug(v,B));continue}if(!T.isFile()||!Qb.has(ln.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:ln.relative(v,B)})}return R}function ag(v,_){return v.map((k)=>({key:iv(k.relativePath),input:k.absolutePath,name:ov(k.relativePath),...av(k.absolutePath)?{options:{storage:_}}:{}}))}function av(v){return Fl(v)==="possible"}function cv(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function lv(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 F=z.variants.filter((H)=>H.format==="png").sort((H,q)=>H.width-q.width)[0];try{let H=await Jb(new Uint8Array(await gn.promises.readFile(F?.path??z.fallback.path)));if(cv(H.data))k.add(B)}catch{k.add(B)}}));return k}function uv(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((F)=>F.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((F)=>{let H;try{return H=gn.openSync(F.path,"r"),!Wl(Ea(H,0,32))}catch{return!0}finally{if(H!==void 0)gn.closeSync(H)}}))continue;if(T.variants=T.variants.filter((F)=>F.format!=="webp"),delete T.sources.webp,k.push(R),!ig.has(R))ig.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 dv(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 Yb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Hl(v){return ln.join(v,"undecodable.json")}function fv(v){try{let _=gn.readFileSync(Hl(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function pv(v,_){try{gn.mkdirSync(ln.dirname(Hl(v)),{recursive:!0}),gn.writeFileSync(Hl(v),JSON.stringify(_))}catch{}}function cg(v){try{let _=gn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function dg(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 vs(v){let _=dg(v);return _?So().catalog.get(_):void 0}function ws(v){let _=dg(v);return _?So().transparent.has(_):!1}function xs(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 uu(v){let _=vs(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:xs(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:ws(v)?void 0:_.placeholder?.dataUrl}}function cr(){let v=So();v.catalog=new Map,v.transparent=new Set}function gv(v){let _=So();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function pu(v,_,k={}){if(!v||!gn.existsSync(v))return cr(),{count:0,fingerprint:""};if(k.offThread){let Q=await Ul("delivery",{publicDir:v,outputDir:_});if(Q!==Aa)return gv(Q.state),Q.result}let R=await ug(v);if(R.length===0)return cr(),{count:0,fingerprint:""};let T=fv(_),B=R.filter((Q)=>{let ce=T[Q.relativePath];if(!ce)return!0;let ue=cg(Q.absolutePath);return!ue||ue.mtimeMs!==ce.mtimeMs||ue.size!==ce.size});if(B.length===0)return cr(),{count:0,fingerprint:""};let z=og(ln.join(_,"_stx","images"),`${tv}:${rg()}`),F={outDir:ln.join(_,"_stx","images"),storage:og(ln.join(_,"_stx","images"),`${nv}:${rg()}`),baseUrl:wo,widths:ev,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},H=B,q;try{q=await ng({...F,entries:ag(B,z)})}catch(Q){if(H=await dv(B),H.length===B.length)throw Q;let ce=new Set(H.map((le)=>le.relativePath)),ue=!1;for(let le of B){if(ce.has(le.relativePath))continue;let pe=cg(le.absolutePath);if(!pe)continue;T[le.relativePath]=pe,ue=!0}if(ue)pv(_,T);if(H.length===0)return cr(),{count:0,fingerprint:""};q=await ng({...F,entries:ag(H,z)})}let K=await lv(q.entries),G=uv(q.entries,K),ee=So();ee.catalog=new Map(Object.entries(q.entries)),ee.transparent=K;let ae=K.size===0&&G.length===0?q.fingerprint:lg("sha256").update(q.fingerprint).update(JSON.stringify({transparent:[...K].sort(),droppedWebp:G.sort()})).digest("hex");return{count:H.length,fingerprint:ae}}var mv=new Map;function ql(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return mv.get(_)}var hv={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Kl=[320,640,768,1024,1280,1536,1920];function nn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rn(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=!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 Xl(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=hv[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let F=Number.parseInt(T);if(!Number.isNaN(F))k.push(`(max-width: ${F}px) ${B}`)}}else k.push(R);return k.join(", ")}function Zl(v,_,k,R){return _.map((T)=>`${$o(v,T,void 0,k,R)} ${T}w`).join(", ")}function yv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${$o(v,z,void 0,R,T)} ${B}x`}).join(", ")}function $o(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 xv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function bv(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 Gl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=rn(v,"src")||"",T=vs(R),B=rn(v,"alt")||"",z=rn(v,"width")||(T?String(T.source.width):void 0),F=rn(v,"height")||(T?String(T.source.height):void 0),H=rn(v,"sizes"),q=rn(v,"srcset"),K=rn(v,"densities"),G=rn(v,"format"),ee=ws(R)||ql(R)?.transparent===!0,ae=rn(v,"placeholder")||(T&&!ee?"thumbhash":void 0),Q=rn(v,"placeholderColor")||"#e5e7eb",ce=rn(v,"provider"),ue=rn(v,"class")||rn(v,"className")||"",le=rn(v,"style")||"",pe=rn(v,"objectFit")||rn(v,"fit"),de=rn(v,"objectPosition")||rn(v,"position"),Re=rn(v,"quality"),be=Ia(v,"lazy",!0),xe=Ia(v,"preload",!1),Ie=Ia(v,"priority",!1),Me=rn(v,"loading"),Ne=rn(v,"decoding")||"async",je=!!T||Ia(v,"picture",!1)||!!G,Be=z?Number.parseInt(z):void 0,De=F?Number.parseInt(F):void 0,Fe=q||"",Ue="";if(T)Fe=T.sources[T.fallback.format]||"",Ue=H?Xl(H):"100vw";else if(!Fe&&H&&ce&&ce!=="local"&&ce!=="static")Fe=Zl(R,Kl,ce,G),Ue=Xl(H);else if(!Fe&&K){let vt=K.split(/\s+/).map((dt)=>Number.parseFloat(dt.replace("x","")));Fe=yv(R,vt,Be,ce,G)}else if(H)Ue=Xl(H);let ze=[];if(le)ze.push(le);if(pe)ze.push(`object-fit:${pe}`);if(de)ze.push(`object-position:${de}`);if(Be&&De)ze.push(`aspect-ratio:${Be}/${De}`);let Le=[],it=ae==="blur"||ae==="color"||ae==="thumbhash";if(it&&!ee){let vt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:Q}:ql(R);if(vt&&ae==="color")ze.push(`background-color:${vt.color}`),Le.push("backgroundColor");else if(vt)ze.push(`background-color:${vt.color}`),ze.push(`background-image:url(${vt.dataUrl})`),ze.push("background-size:cover"),ze.push("background-repeat:no-repeat"),Le.push("backgroundColor","backgroundImage");else{let dt=bv(Be||16,De||9,Q);ze.push(`background-image:url(${dt})`),ze.push("background-size:cover"),ze.push("background-repeat:no-repeat"),Le.push("backgroundImage")}}else if(!it&&ae&&ae!=="empty"&&ae!=="none")ze.push(`background-image:url(${nn(ae)})`),ze.push("background-size:cover"),ze.push("background-repeat:no-repeat"),Le.push("backgroundImage");let xt=T?.fallback.url||$o(R,Be,De,ce,G),bt=[];if(bt.push(`src="${nn(ro(xt,"fetched"))}"`),bt.push(`alt="${nn(B)}"`),z)bt.push(`width="${nn(z)}"`);if(F)bt.push(`height="${nn(F)}"`);let St=Me||(Ie||xe?"eager":be?"lazy":"");if(St)bt.push(`loading="${nn(St)}"`);if(Ie)bt.push('fetchpriority="high"');if(bt.push(`decoding="${nn(Ne)}"`),ue)bt.push(`class="${nn(ue)}"`);if(ze.length>0)bt.push(`style="${nn(ze.join(";"))}"`);if(Fe)bt.push(`srcset="${nn(ro(Fe,"fetched"))}"`);if(Ue)bt.push(`sizes="${nn(Ue)}"`);let pt=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(Le.length>0){let vt=typeof v.static.onload==="string"?v.static.onload:"",dt=xv(Le)+(vt?`;${vt}`:"");bt.push(`onload="${nn(dt)}"`),pt.add("onload")}bt.push(...Lr(v,pt)),bt.push(...Br(v,pt));let $t=`<img ${bt.join(" ")} />`,Ct="";if(xe){let dt=G==="webp"?"image/webp":G==="avif"?"image/avif":"";Ct=`<link rel="preload" as="image" href="${nn(xt)}"${dt?` type="${dt}"`:""}${Fe?` imagesrcset="${nn(Fe)}"`:""}${Ue?` imagesizes="${nn(Ue)}"`:""} />
2310
+ `}if(je){let vt=[];if(T)for(let dt of xs(T))vt.push(`<source type="image/${dt.format}" srcset="${nn(dt.srcset)}"${Ue?` sizes="${nn(Ue)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let dt=$o(R,Be,De,ce,"avif"),_t=Fe?Zl(R,Kl,ce,"avif"):`${dt}`;vt.push(`<source type="image/avif" srcset="${nn(_t)}"${Ue?` sizes="${nn(Ue)}"`:""} />`)}if(!T&&(G==="webp"||G==="auto")){let dt=$o(R,Be,De,ce,"webp"),_t=Fe?Zl(R,Kl,ce,"webp"):`${dt}`;vt.push(`<source type="image/webp" srcset="${nn(_t)}"${Ue?` sizes="${nn(Ue)}"`:""} />`)}return`${Ct}<picture>
2311
+ ${vt.join(`
2312
+ `)}
2313
+ ${$t}
2314
+ </picture>`}return`${Ct}${$t}`}};var fg="/images/safe-image-default.svg";function _o(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ni(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var vv=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${fg}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Jl={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let R=ni(v,"src")||"",T=ni(v,"alt")||"",B=ni(v,"fallback")||fg,z=ni(v,"class")||ni(v,"className")||"",F=ni(v,"fallbackClassName")||"",H=[];if(H.push(`src="${_o(R)}"`),H.push(`alt="${_o(T)}"`),z)H.push(`class="${_o(z)}"`);if(H.push(`data-fallback="${_o(B)}"`),F)H.push(`data-fallback-class="${_o(F)}"`);H.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);H.push(...Lr(v,q)),H.push(...Br(v,q));let K=`<img ${H.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${vv}${K}`;return K}};function Yl(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function ko(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Pa(v,_,k){let R=ko(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var Ql={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let R=Yl(ko(v,"color")||"#6366f1"),T=Yl(ko(v,"initialColor")||ko(v,"initial-color")||""),B=Yl(ko(v,"height")||"3px"),z=Pa(v,"duration",2000),F=Pa(v,"throttle",200),H=Pa(v,"zIndex",999999)||Pa(v,"z-index",999999),q=T?`linear-gradient(to right, ${T}, ${R})`:R;return`
2315
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${B};background:${q};z-index:${H};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
2316
+ <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>
2317
+ </div>
2318
+ <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
2319
+ <script>
2320
+ (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)},${F})},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()})})();
2321
+ </script>`}};function gg(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function wv(v,_,k){let R=gg(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var pg={"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%)"},xu={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let R=Zt(gg(v,"position")||"top-right"),T=wv(v,"max",5),B=pg[R]||pg["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>
2322
+ <style>
2323
+ @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
2324
+ @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
2325
+ @keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
2326
+ @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
2327
+ @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
2328
+ @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
2329
+ </style>`}};function Da(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var mg={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)"},vu={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let R=Da(v,"id");if(!R)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Zt(R),B=Da(v,"size")||"md",z=Da(v,"closeOnBackdrop")!=="false",F=Da(v,"closeOnEscape")!=="false",H=mg[B]||mg.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${z}" data-close-escape="${F}" 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">
2330
+ <div class="stx-modal-panel" style="${H};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)">
2331
+ <div style="padding:1.5rem">${_}</div>
2332
+ </div>
2333
+ </div>
2334
+ <style>
2335
+ @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
2336
+ .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
2337
+ .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
2338
+ </style>`}};function ri(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var hg={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},wu={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let R=ri(v,"id");if(!R)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Zt(R),B=ri(v,"side")||"right",z=ri(v,"size")||"md",F=ri(v,"closeOnBackdrop")!=="false",H=ri(v,"closeOnEscape")!=="false",q=ri(v,"overlay")!=="false",K=hg[z]||hg.md,G=B==="left",ee=G?"left:0":"right:0",ae=G?"translateX(-100%)":"translateX(100%)",Q=G?"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="${F}" data-close-escape="${H}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"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">
2339
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${ee};width:${K};max-width:100vw;transform:${ae};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">
2340
+ <div style="padding:1.5rem">${_}</div>
2341
+ </div>
2342
+ </div>
2343
+ <style>
2344
+ @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
2345
+ .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
2346
+ .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
2347
+ </style>`}};import{existsSync as Sv,readFileSync as $v}from"fs";var Oa=new Map,yg=new Set;function _v(v){if(yg.has(v))return;yg.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 kv(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(Sv(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return u.resolve(k)}catch{}return null}function Ev(v){if(Oa.has(v))return Oa.get(v);let _=kv(v);if(!_)return _v(v),null;try{let k=JSON.parse($v(_,"utf8"));return Oa.set(v,k.icons),k.icons}catch{return null}}function si(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 Su={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=si(v,"name")??si(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",B=R;if(R.includes(":")){let pe=R.split(":");T=pe[0],B=pe[1]}let z=Zt(si(v,"size")||"24"),F=Zt(si(v,"color")||"currentColor"),H=Zt(si(v,"class")||""),q=Zt(si(v,"style")||""),K=Oa.get(T)??Ev(T);if(!K)return`<!-- Icon: collection "${T}" not loaded -->`;let G=K[B];if(!G)return`<!-- Icon: "${B}" not found in ${T} -->`;let ee=G.width||24,ae=G.height||24,Q=`0 0 ${ee} ${ae}`,ce=G.body;if(F!=="currentColor")ce=ce.replace(/currentColor/g,F);let ue=H?` class="${H}"`:"",le=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${z}" height="${z}" viewBox="${Q}" fill="none"${ue}${le}>${ce}</svg>`}};function $u(){return`
2348
+ (function(){
2349
+ var tip=null,hideTimer=null,currentEl=null;
2350
+
2351
+ function createTip(){
2352
+ tip=document.createElement("div");
2353
+ tip.id="stx-tooltip";
2354
+ 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)";
2355
+ var arrow=document.createElement("div");
2356
+ arrow.className="stx-tip-arrow";
2357
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
2358
+ tip.appendChild(arrow);
2359
+ var text=document.createElement("span");
2360
+ text.className="stx-tip-text";
2361
+ tip.appendChild(text);
2362
+ document.body.appendChild(tip);
2363
+ }
2364
+
2365
+ function position(el){
2366
+ var pos=el.getAttribute("x-tooltip-position")||"top";
2367
+ var r=el.getBoundingClientRect();
2368
+ var sy=window.scrollY,sx=window.scrollX;
2369
+ tip.style.display="block";
2370
+ tip.style.opacity="0";
2371
+ // Force layout so we can measure
2372
+ var tw=tip.offsetWidth,th=tip.offsetHeight;
2373
+ var arrow=tip.querySelector(".stx-tip-arrow");
2374
+ var left,top;
2375
+
2376
+ if(pos==="top"){
2377
+ left=r.left+r.width/2-tw/2+sx;
2378
+ top=r.top-th-8+sy;
2379
+ if(top-sy<0){pos="bottom";}
2380
+ }
2381
+ if(pos==="bottom"){
2382
+ left=r.left+r.width/2-tw/2+sx;
2383
+ top=r.bottom+8+sy;
2384
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
2385
+ }
2386
+ if(pos==="left"){
2387
+ left=r.left-tw-8+sx;
2388
+ top=r.top+r.height/2-th/2+sy;
2389
+ if(left-sx<0){pos="right";}
2390
+ }
2391
+ if(pos==="right"){
2392
+ left=r.right+8+sx;
2393
+ top=r.top+r.height/2-th/2+sy;
2394
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
2395
+ }
2396
+
2397
+ // Set arrow for top/left after potential flips
2398
+ if(pos==="top"){
2399
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
2400
+ }
2401
+ if(pos==="left"){
2402
+ arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
2403
+ }
2404
+
2405
+ // Clamp horizontal
2406
+ if(left<sx+4) left=sx+4;
2407
+ if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
2408
+
2409
+ tip.style.left=left+"px";
2410
+ tip.style.top=top+"px";
2411
+ tip.style.opacity="1";
2412
+ }
2413
+
2414
+ function showTip(el){
2415
+ if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
2416
+ if(!tip) createTip();
2417
+ var text=el.getAttribute("x-tooltip");
2418
+ if(!text) return;
2419
+ tip.querySelector(".stx-tip-text").textContent=text;
2420
+ currentEl=el;
2421
+ position(el);
2422
+ }
2423
+
2424
+ function hideTip(){
2425
+ if(!tip) return;
2426
+ tip.style.opacity="0";
2427
+ hideTimer=setTimeout(function(){
2428
+ if(tip) tip.style.display="none";
2429
+ currentEl=null;
2430
+ },150);
2431
+ }
2432
+
2433
+ document.addEventListener("mouseover",function(e){
2434
+ var el=e.target.closest("[x-tooltip]");
2435
+ if(el) showTip(el);
2436
+ });
2437
+ document.addEventListener("mouseout",function(e){
2438
+ var el=e.target.closest("[x-tooltip]");
2439
+ if(el&&el===currentEl) hideTip();
2440
+ });
2441
+ document.addEventListener("focusin",function(e){
2442
+ var el=e.target.closest("[x-tooltip]");
2443
+ if(el) showTip(el);
2444
+ });
2445
+ document.addEventListener("focusout",function(e){
2446
+ var el=e.target.closest("[x-tooltip]");
2447
+ if(el) hideTip();
2448
+ });
2449
+ })();
2450
+ `}function xg(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 bg(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 _u={name:"Suspense",aliases:["suspense"],render(v,_,k){let R=bg(_,"fallback"),T=R.rest,B=bg(T,"error"),z=B.rest,F=R.region??xg(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',H=B.region??xg(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${F}</div><div data-stx-suspense-error hidden>${H}</div><div data-stx-suspense-content hidden>${z}</div></div>`}};function Ma(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 ku={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let R=(Ma(v,"name")||"v").replace(/["'<>]/g,""),T=(Ma(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",B=Ma(v,"class"),z=Ma(v,"id"),F=[`data-stx-transition-group="${R}"`,B?`class="${B}"`:"",z?`id="${z}"`:""].filter(Boolean).join(" ");return`<${T} ${F}>${_}</${T}>`}};function vg(v=ei){v.registerBuiltin(Bl),v.registerBuiltin(Gl),v.registerBuiltin(Jl),v.registerBuiltin(Ql),v.registerBuiltin(xu),v.registerBuiltin(vu),v.registerBuiltin(wu),v.registerBuiltin(Su),v.registerBuiltin(_u),v.registerBuiltin(ku)}var wg=new Map;function Cv(v){let _=wg.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),wg.set(v.source,_);return _}var Sg=new WeakMap;function $g(v){let _=Sg.get(v);if(!_)_=new Set([...v].map((R)=>R.toLowerCase())),Sg.set(v,_);let k=_;return(R)=>!/[a-z]/.test(R)&&k.has(R.toLowerCase())}function Rv(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 _g(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 F=Cv(_);F.lastIndex=z+1;let H=F.exec(v);if(!H){T=z+1;continue}let q=H[1];if(B&&B(q)){let ue=z+1+q.length;while(ue<v.length&&v[ue]!==">")ue++;T=ue+1;continue}let K=z+1+q.length,G=null,ee=K,ae=-1,Q=!1;while(K<v.length){let ue=v[K];if(G){if(ue==="\\"&&K+1<v.length){K+=2;continue}if(ue===G)G=null;K++;continue}if(ue==='"'||ue==="'"){G=ue,K++;continue}if(ue==="/"&&K+1<v.length&&v[K+1]===">"){ae=K+2,Q=!0;break}if(ue===">"){ae=K+1;break}K++}if(ae===-1){T=z+1;continue}let ce=v.slice(ee,Q?ae-2:ae-1).trim();if(Q)R.push({fullMatch:v.slice(z,ae),tagName:q,attributes:ce,content:"",startIndex:z,endIndex:ae,isSelfClosing:!0}),T=ae;else{let ue=`<${q}`,le=`</${q}>`,pe=1,de=ae,Re=-1;while(pe>0&&de<v.length){let Ie=v.indexOf(ue,de),Me=v.indexOf(le,de);if(Me===-1)break;if(Ie!==-1&&Ie<Me){let Ne=v[Ie+ue.length];if(Ne===" "||Ne===">"||Ne==="/"||Ne===`
2451
+ `||Ne==="\t"){let je=Rv(v,Ie+ue.length);if(v[je-1]!=="/")pe++;de=je+1}else de=Ie+ue.length}else{if(pe--,pe===0){Re=Me;break}de=Me+le.length}}if(Re===-1){T=ae;continue}let be=v.slice(ae,Re),xe=Re+le.length;R.push({fullMatch:v.slice(z,xe),tagName:q,attributes:ce,content:be,startIndex:z,endIndex:xe,isSelfClosing:!1}),T=xe}}return R}function Eu(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function kg(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 Cu(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 Eg(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(Cu(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var Av=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Tv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Iv(v){return Ru(v).map((_)=>[_.start,_.end])}function Ru(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=Vr(B[1]??B[2]??B[3]??""),F=R.index,H=F+R[0].length,q=R[1].toLowerCase();if(R[0].endsWith("/>")||Tv.has(q)){_.push({start:F,end:H,names:z});continue}let K=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),G=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");G.lastIndex=H;let ee=1,ae=H,Q;while((Q=G.exec(v))!==null)if(Q[0].startsWith("</")){if(ee--,ee===0){ae=Q.index+Q[0].length;break}}else if(!Q[0].endsWith("/>"))ee++;_.push({start:F,end:ae,names:z})}return _}function Cg(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>Cg(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function Rg(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(...Iv(v));let z=new Set([...Rr(_),...Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]]);function F(ee){return T.some(([ae,Q])=>ee>=ae&&ee<Q)}let H=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,q=[],K=new Map,G=256;while((B=H.exec(k))!==null){if(F(B.index))continue;let ee=B[0],ae=B[2];if(!ae||!ae.includes(":"))continue;let Q=/(?:^|\s)data-native(?:\s|=|$)/i.test(ae.replace(/"[^"]*"|'[^']*'/g,"")),ce=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,ue,le=ae,pe=!1;while((ue=ce.exec(ae))!==null){let de=ue[1],Re=ue[2];if(ea(de))continue;if(ne(Re,z))continue;if(Re.includes("()")&&!Re.includes(".get(")||Re.includes("$store")||Re.includes("$ref"))continue;try{let be=Object.keys(_),xe=Object.values(_),Ie=Re.match(/^([a-zA-Z_$][\w$]*)/);if(Ie&&!be.includes(Ie[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Ie[1]))continue;let Me=JSON.stringify([be,Re]),Ne=K.get(Me);if(!Ne){if(Ne=Function(...be,`return (${Re})`),K.size>=G)K.clear();K.set(Me,Ne)}let je=Ne(...xe);if(de==="class"){let Be=Cg(je);if(Be){let De=le.match(/\sclass="([^"]*)"/);if(De)le=le.replace(De[0],` class="${De[1]} ${Be}"`);else le=le.replace(ue[0],` class="${Be}"`)}else le=le.replace(ue[0],"");pe=!0;continue}if(Av.has(de)){if(je)le=le.replace(ue[0],` ${de}`);else le=le.replace(ue[0],"");pe=!0;continue}if(je===null||je===void 0||je===!1)le=le.replace(ue[0],"");else{let De=(Q&&typeof je==="object"?JSON.stringify(je):String(je)).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");le=le.replace(ue[0],` ${de}="${De}"`)}pe=!0}catch{continue}}if(pe){let de=B[3]?" /":"",be=`<${B[1]}${le}${de}>`;q.push({start:B.index,end:B.index+ee.length,replacement:be})}}if(q.length>0){let ee=Array(q.length*2+1),ae=0;for(let Q=0;Q<q.length;Q++){let{start:ce,end:ue,replacement:le}=q[Q];ee[Q*2]=k.slice(ae,ce),ee[Q*2+1]=le,ae=ue}ee[q.length*2]=k.slice(ae),k=ee.join("")}return k}var J=["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 Wg from"path";import Tu from"fs";import Co from"path";function Ag(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 Pv(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 Au(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 H=Ag(k,B,"<",">");if(H<0)continue;z=v.slice(B+1,H),B=H+1;while(/\s/.test(k[B]||"")&&B<k.length)B++}if(k[B]!=="(")continue;let F=Ag(k,B,"(",")");if(F>=0)return{type:z,args:Pv(v.slice(B+1,F))}}return null}var Tg=`
2452
+ 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;
2453
+ type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
2454
+ 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>;
2455
+ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
2456
+ type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
2457
+ 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]> };
2458
+ type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
2459
+ `;function Ig(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,(ee,ae,Q,ce,ue)=>{if(T.slice(ue,ue+6)!=="import")return ee;if(ce.endsWith(".stx"))return"";let le=`${_}Import${k.length}`;if(k.push(`import * as ${le} from ${JSON.stringify(ce)};`),ae.startsWith("*"))return`import ${ae.replace(/^\*\s+as\s+/,"")} = ${le};`;if(!ae.startsWith("{"))return`import ${ae} = ${le}.default;`;return ae.slice(1,-1).split(",").map((pe)=>{let[de,Re=de]=pe.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!de)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(ce)&&de in R)R[de].push(Re);return`import ${Re} = ${le}.${de};`}).join(`
2460
+ `)}),z=Au(v,R.defineProps),F=Au(v,R.defineEmits),H=Au(v,R.withDefaults);if(!z&&!F)return{declarations:"",props:null,events:null};let q=[],K=null,G=null;if(z){q.push(`const __options = (${z.args[0]||"{}"}) as const;`),q.push(`const __defaults = (${H?.args[1]||"{}"});`);let ee=z.type||"__StxOptions<typeof __options>";q.push(`export type __StxProps = __StxDefaults<${ee}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),K=`${_}.__StxProps`}if(F)q.push(`const __events = (${F.args[0]||"[]"}) as const;`),q.push(`export type __StxEvents = ${F.type||"Record<(typeof __events)[number], any[]>"};`),G=`${_}.__StxEvents`;return{declarations:`${k.join(`
2461
+ `)}
2462
+ namespace ${_} {
2463
+ ${B}
2464
+ ${q.join(`
2465
+ `)}
2466
+ }`,props:K,events:G}}var Eo=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 Cn(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...Eo].some((_)=>_.toLowerCase()===v.toLowerCase());return Eo.has(v)||/[A-Z]/.test(v)}function*Dv(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 F=v[R],H=F==="{",q=F==='"'||F==="'";if(q||H)R++;let K=R;if(H){let G=s(v.slice(R)),ee=1,ae=0;for(;ae<G.length;ae++){if(G[ae]==="{")ee++;if(G[ae]==="}"&&--ee===0)break}R+=ae}else if(q)while(R<v.length&&v[R]!==F)R++;else while(R<v.length&&!/[\s/>]/.test(v[R]))R++;if(T.push({name:B,value:v.slice(K,R),offset:K,braced:H}),q||H)R++}_.lastIndex=R,yield{name:k[1],offset:k.index,attributes:T}}}function Pg(v,_,k){let R=[],T=[Tg,"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,F=new Map,H=k.scriptCode(v,k.filePath),q=s(H);for(let Q of H.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(q.slice(Q.index,Q.index+6)!=="import")continue;let ce=Q[2],ue=Co.isAbsolute(ce)||ce.startsWith(".")?Co.resolve(Co.dirname(k.filePath),ce):qo(ce,Co.dirname(k.filePath));if(!ue)continue;let le=ue.endsWith(".stx")?ue:Tu.existsSync(`${ue}.stx`)?`${ue}.stx`:void 0,pe=le?null:Ho(ue,!1),de=Q[1].startsWith("{")?Q[1].slice(1,-1).split(","):[Q[1]];for(let Re of de){let[be,xe=be]=Re.trim().split(/\s+as\s+/),Ie=le||pe?.get(be)||pe?.get(be.toLowerCase());if(Ie)F.set(xe,Ie),F.set(xe.toLowerCase(),Ie),F.set(xe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ie)}}for(let Q of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let ce of Q[1].matchAll(/['"]([^'"]+)['"]/g)){let ue=Ko(ce[1],k.filePath,k).find((le)=>Tu.statSync(le,{throwIfNoEntry:!1})?.isFile());if(ue)F.set(Co.basename(ce[1]).replace(/\.stx$/,""),ue)}let K={__importedComponents:F},G=new Map,ee=(Q,ce,ue)=>{let le=v.slice(0,Q);return{code:ce,offset:Q,attribute:ue,anchor:!0,kind:"directive",line:le.split(`
2467
+ `).length,column:Q-le.lastIndexOf(`
2468
+ `)}},ae=(Q,ce,ue)=>R.push({expression:Q,statement:{text:ce+Q.code+ue,prefixLength:ce.length}});for(let Q of Dv(_)){if(Cn(Q.name)||Q.name==="component")continue;let ce=yd(Q.name,k.filePath,k,K);if(!ce)continue;let ue=G.get(ce);if(!ue){let pe;try{pe=k.readComponent?k.readComponent(ce):Tu.readFileSync(ce,"utf8")}catch{continue}if(pe===void 0)continue;z.set(ce,pe),ue=Ig(k.scriptCode(pe,ce),`__StxComponent${G.size}`),G.set(ce,ue),T.push(ue.declarations)}let le=[];for(let pe of Q.attributes){let{name:de,offset:Re}=pe,be=pe.value===!0?"true":pe.value;if(de.startsWith("@")||de.startsWith("v-on:")){if(ue.events&&pe.value!==!0)B.set(Re,`__StxEvent<${ue.events}, ${JSON.stringify(de.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let xe=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(de);if(de.startsWith("v-")&&!de.startsWith("v-bind:")&&!xe)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(de))continue;let Ie=(xe?xe[1]||"modelValue":de.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(je,Be)=>Be.toUpperCase());if(le.push(Ie),!ue.props)continue;let Ne=de.startsWith(":")||de.startsWith("v-bind:")||!!xe||pe.braced?be:pe.value!==!0?JSON.stringify(be):"true";ae(ee(Re,Ne,de),";void ((",`) satisfies __StxProp<${ue.props}, ${JSON.stringify(Ie)}>);`)}if(ue.props){let pe=[...new Set(le)].map((Re)=>`${JSON.stringify(Re)}: undefined as any`).join(", "),de=ee(Q.offset,`<${Q.name}>`);R.push({expression:de,statement:{text:`;void ({ ${pe} } satisfies ${ue.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
2469
+ `):"",checks:R,events:B,dependencies:z}}var Dg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Ov(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function Qe(v){let _=[],k=Ov(v);Dg.lastIndex=0;let R;while((R=Dg.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,F=R.index+B,H=R.index+R[0].length-z,q=v.slice(F,H);if(/\bsrc\s*=/.test(T))continue;let K=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(K&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(K[1]))continue;let G=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",ee=Ro(v,F);_.push({kind:G,code:q,startLine:ee,startColumn:Ao(v,F),offset:F,attrs:T})}return _}function Ro(v,_){let k=1;for(let R=0;R<_&&R<v.length;R++)if(v.charCodeAt(R)===10)k++;return k}function Ao(v,_){let k=v.lastIndexOf(`
2470
+ `,_-1)+1;return _-k+1}function Na(v){let _=v.split(""),k=(T,B)=>{for(let z=T;z<B&&z<_.length;z++)if(_[z]!==`
2471
+ `)_[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 Mv(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 Fg=new Set([":for","x-for","v-for"]),ja=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Iu="__stx_interpolated",Og="__StxElement",Vg="__StxTemplateValue",Nv=`type ${Vg}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Mg(v){return v.replace(/\{\{[\s\S]*?\}\}/g,Iu).replace(/\{!![\s\S]*?!!\}/g,Iu)}function Ss(v){return v.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(_)=>{let k=_.split(`
2472
+ `).length-1,R=_.length-k;return`0${" ".repeat(Math.max(0,R-1))}${`
2473
+ `.repeat(k)}`})}var jv=["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"],Lv=new RegExp(String.raw`^[ \t]*@(?:${jv.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function ks(v){return v.replace(Lv,(_)=>_.replace(/[^\n]/g," "))}var Ng=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Ic(v){let _=Na(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let F=T[2]??T[4]??"",H=T[2]!==void 0?2:3,q=Mv(F);if(!q.trim())continue;let K=T.index+H+(q.length-q.trimStart().length);k.push({code:q.trim(),line:Ro(_,K),column:Ao(_,K),offset:K,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,F=0,H=z;for(;H<_.length;H++){let ee=_[H];if(ee==="(")F++;else if(ee===")"){if(F--,F===0)break}}if(F!==0)continue;let q=_.slice(z+1,H),K=q.trim();if(B.lastIndex=H+1,!K)continue;let G=z+1+(q.length-q.trimStart().length);k.push({code:K,line:Ro(_,G),column:Ao(_,G),offset:T.index,kind:"condition"})}ja.lastIndex=0;while((T=ja.exec(_))!==null){let z=T[1],F=T[3]??"",H=z.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Ng.has(H)||Ng.has(z))continue;if(!F.trim())continue;let q=T.index+T[0].indexOf(T[2],T[0].indexOf(z)+z.length)+1;if(Fg.has(H)){let G=F.match(/\s+(?:in|of)\s+/);if(!G||G.index===void 0)continue;let ee=F.slice(G.index+G[0].length),ae=G.index+G[0].length+(ee.length-ee.trimStart().length);k.push({code:Mg(ee.trim()),line:Ro(_,q+ae),column:Ao(_,q+ae),offset:q+ae,kind:"directive",attribute:H});continue}let K=F.length-F.trimStart().length;k.push({code:Mg(F.trim()),line:Ro(_,q+K),column:Ao(_,q+K),offset:q+K,kind:"directive",attribute:H})}return k.sort((z,F)=>z.line-F.line||z.column-F.column),k}var Bv=2000;function zv(v,_){let k=0,R=Math.min(v.length,_+Bv);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 Wv(v){let _=new Map,k=(F,H)=>{let q=F.split(/[,[\]{}()\s]+/).filter(Boolean);for(let K of q){let G=K.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(G))continue;let ee=q.length===1?H:void 0,ae=_.get(G);if(!ae)_.set(G,{name:G,iterable:ee});else if(ae.iterable!==ee)ae.iterable=void 0}},R=/^\$?[A-Z_$][\w$]*$/i,T=(F)=>{let H=F.trim();return R.test(H)?H:void 0};for(let F of v.matchAll(/@for(?:each|else)\s*\(/g)){let H=zv(v,F.index+F[0].length-1);if(H===null)continue;let q=Dt(H);if(!q)continue;k(q.itemVar.replace(/=>/g," "),T(q.arrayExpr))}for(let F of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(F[1],F[2]==="of"?T(F[3]):void 0);for(let F of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(F[1]);let B=Na(v);ja.lastIndex=0;let z;while((z=ja.exec(B))!==null){let F=z[1].replace(/\..*$/,"");if(!Fg.has(F))continue;let H=z[3].match(/\s+(?:in|of)\s+/);if(!H||H.index===void 0)continue;k(z[3].slice(0,H.index),T(z[3].slice(H.index+H[0].length)))}for(let F of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let H of F[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(H[1]);return[..._.values()].sort((F,H)=>F.name.localeCompare(H.name))}function ge(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 Pu=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Fv={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function hi(v=new Set){return[...Pu.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Fv).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
2474
+ `)}function yi(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Ug(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 Vv(k[1])){let F=z.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(F))T.add(F)}}return R?[...T]:null}function Vv(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 Uv(v){let _=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,k=[],R=v.replace(_,(T)=>(k.push(T.trim()),T.split(`
2475
+ `).map(()=>"").join(`
2476
+ `)));return{imports:k.join(`
2477
+ `),body:R}}function Hg(v){let _=s(v),k=Array(_.length),R=0;for(let F=0;F<_.length;F++){let H=_[F];if(H==="}"||H===")"||H==="]")R=Math.max(0,R-1);if(k[F]=R,H==="{"||H==="("||H==="[")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 F=z[1],H=z[2],q;if(F==="interface"){let K=_.indexOf("{",z.index);if(K===-1)continue;let G=0;q=-1;for(let ee=K;ee<_.length;ee++)if(_[ee]==="{")G++;else if(_[ee]==="}"&&--G===0){q=ee+1;break}if(q===-1)continue}else{let K=0;q=_.length;for(let G=_.indexOf("=",z.index)+1;G<_.length;G++){let ee=_[G];if(ee==="{"||ee==="["||ee==="("||ee==="<")K++;else if(ee==="}"||ee==="]"||ee===")"||ee===">")K--;else if(K<=0&&(ee===";"||ee===`
2478
+ `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,G-40),G)))){q=ee===";"?G+1:G;break}}}T.push({name:H,text:v.slice(z.index,q).replace(/^[ \t]*export[ \t]+/,"")}),B.lastIndex=q}return T}function Hv(v){return new Set(Hg(v).map((_)=>_.name))}function bi(v,_=""){let k=Ug(v),R=Hv(_),T=Hg(v).filter((q)=>!R.has(q.name)).map((q)=>q.text);if(!k){let q=ge(v).filter((K)=>!no(_,K));if(q.length===0&&T.length===0)return"";return["",`// ${qv}`,...T,...q.map((K)=>`declare var ${K}: any`)].join(`
2479
+ `)}if(k.length===0)return T.length>0?["",`// ${jg}`,...T].join(`
2480
+ `):"";let{imports:B,body:z}=Uv(v),F=z.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),H=["",`// ${jg}`];if(B)H.push(B);return H.push(...T),H.push(`async function ${Lg}() {`,F,` return { ${k.join(", ")} }`,"}",`type ${Bg} = Awaited<ReturnType<typeof ${Lg}>>`,...k.map((q)=>`declare var ${q}: ${Bg}[${JSON.stringify(q)}]`)),H.join(`
2481
+ `)}function Du(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!==`
2482
+ `)k[T]=" "}return ge(k.join(""))}function vi(v,_){if(Ug(v)!==null)return[];let k=Du(v),R=It(_,new Set(k)),T=new Set(y);return k.filter((B)=>{if(T.has(B))return!1;if(no(_,B))return!1;return R.has(B)})}var jg="stx: types for the declared client payload (#1868)",qv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Lg="__stxServerScope",Bg="__StxClientPayload";var zg=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var Kv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Xv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:B,balanced:z}=$e(T);if(!z)continue;let F=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let H of T.matchAll(F)){let q=H.index??0;if(B[q+H[1].length]!==0)continue;let K=H[2],G=q+H[0].length-H[3].length,ee=R.slice(G,q+H[0].length).trim().replace(/;$/,"").trim(),ae=H[3],Q=k.test(ae)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ae)&&!/[,+\-*/%&|?:=]$/.test(ee)&&$e(ae).balanced;_.set(K,_.has(K)||!Q?null:ee)}}return new Map([..._].filter((R)=>R[1]!==null))}function qg(v,_,k=0,R=new Set){if(_.size===0||k>=5)return v;let T=s(v),B="",z=0;for(let F of T.matchAll(/[A-Za-z_$][\w$]*/g)){let H=F.index??0,q=F[0],K=_.get(q);if(!K||R.has(q))continue;let G=T.slice(0,H).trimEnd(),ee=T.slice(H+q.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(ee)&&/[{,]$/.test(G))continue;if(H>0&&/[\w$]/.test(T[H-1]))continue;B+=`${v.slice(z,H)}(${qg(K,_,k+1,new Set([...R,q]))})`,z=H+q.length}return B+v.slice(z)}function Zv(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 F=R[R.length-1];if(F?.current)F.seen.push(F.current);if(F)F.current=null}break}if(B==="endif"||B==="endunless"){R.pop();continue}let z="";if(T[2]==="("){let F=0,H=T.index+T[0].length-1,q=H+1;for(;H<v.length;H++){let K=v[H];if(K==="(")F++;else if(K===")"){if(F--,F===0)break}}z=v.slice(q,H).trim(),k.lastIndex=H+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 F=R[R.length-1];if(!F)continue;if(F.current)F.seen.push(F.current);F.current=B==="elseif"?z:null}}return R.flatMap((B)=>[...B.seen.map((z)=>`!(${z})`),...B.current?[B.current]:[]]).filter(Boolean)}function Gv(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(Kv.test(_))return null;let R=";(($event: any): void => { ";return{text:`${R}${_} });`,prefixLength:R.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var Jv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function lr(v,_){if(!_)return v;return v.replace(Jv,(k,R,T,B)=>{let z=Wg.resolve(_,B).replace(/\\/g,"/");return`${R}${T}${z}${T}`})}function Cs(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function Yv(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 q of B?.[1].split(",")??[]){let K=q.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(K&&/^[A-Z_$][\w$]*$/i.test(K))_.add(K)}let z=T.replace(/\{[^}]*\}/,""),F=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(z);if(F)_.add(F[1]);let H=/^\s*([A-Z_$][\w$]*)/i.exec(z);if(H&&H[1]!=="type")_.add(H[1])}return[..._].sort()}function wi(v,_={}){let k=Qe(v),R=v.split(`
2483
+ `),T=Array.from({length:R.length},()=>""),B=new Map,z=_.filePath&&_.templateExpressions!==!1?Pg(v,Na(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(G,ee)=>Qe(G).map((ae)=>lr(ae.code,Wg.dirname(ee))).join(`
2484
+ `)}):void 0,F=new Set,H=[];for(let G of k){let ee=ks(Ss(G.code)),ae=lr(ee,_.originDir??"").split(`
2485
+ `);ae.forEach((Q,ce)=>{let ue=G.startLine-1+ce;if(ue<T.length)T[ue]=ce===0?Cs(G)+Q:Q,F.add(ue)}),H.push(G.startLine-1+ae.length-1)}for(let G of H){let ee=T[G]?.trim()===""?G:G+1;if(ee<T.length&&T[ee].trim()===""&&(ee===G||!F.has(ee)))T[ee]=";"}let q=(G,ee)=>{for(let[ae,Q]of G.split(`
2486
+ `).entries())if(T.push(Q),ee)B.set(T.length,ae===0?ee:{...ee,line:ee.line+ae,column:1,prefixLength:0})};if(_.globals!==!1){q("");let G=new Set([...k.flatMap((ce)=>ge(ce.code)),...k.flatMap((ce)=>Yv(ce.code))]),ee=(ce)=>{if(!G.has(ce))q(`declare var ${ce}: any`)};if(_.runtimeGlobals!==!1){if(!G.has("window"))q("declare var window: any");for(let ce of y)ee(ce)}let ae=[...new Set([...Pu,...J,...zg])].filter((ce)=>_.runtimeGlobals!==!1||!y.includes(ce));if(_.contextScope==="global"){q("declare global {");for(let ce of ae)q(` var ${ce}: any`);q("}")}else{for(let ce of Pu)ee(ce);for(let ce of J)ee(ce);for(let ce of zg)ee(ce)}q(`declare var ${Iu}: any`);let Q=new Set(k.flatMap((ce)=>ge(ce.code)));q(`type ${Og}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let ce of Wv(v)){if(Q.has(ce.name))continue;let ue=ce.iterable&&Q.has(ce.iterable)?`${Og}<typeof ${ce.iterable}>`:"any";q(`declare var ${ce.name}: ${ue}`)}}if(_.templateExpressions!==!1){if(z?.declarations)for(let ee of z.declarations.split(`
2487
+ `))q(ee);let G=Ic(v).map((ee)=>{let ae=z?.events.get(ee.offset??-1);if(ae){ee.anchor=!0;let Q=ee.code.trim(),ce=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(Q),ue=ce?`void ((${ce[2]}) satisfies __StxAssignedValue<typeof ${ce[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(Q)?`${Q} satisfies (($event: ${ae}) => unknown)`:Q,le=`;(($event: ${ae}): void => { `;return{expression:ee,statement:{text:`${le}${ue} });`,prefixLength:le.length}}}return{expression:ee,statement:Gv(ee)}}).filter((ee)=>ee.statement!==null);if(G.push(...z?.checks||[]),G.length>0){let ee=Na(v),ae=sa(ee),Q=Xv(k.map((pe)=>pe.code)),ue=[...new Set(k.flatMap((pe)=>ge(pe.code)))].filter((pe)=>/^[A-Z_$][\w$]*$/i.test(pe)),le=0;if(ue.length>0){q(Nv);for(let pe of ue)q(`type __StxT_${pe} = ${Vg}<typeof ${pe}>`);q(`;((${ue.map((pe)=>`${pe}: __StxT_${pe}`).join(", ")}) => {`),le=1}for(let{expression:pe,statement:de}of G){let Re=" ".repeat(le),be=pe.offset===void 0?[]:ae.filter((Be)=>pe.offset>=Be.start&&pe.offset<Be.end),xe=be.map((Be)=>`;((${Be.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Ie=" });".repeat(be.length),Me=pe.offset===void 0?[]:Zv(ee,pe.offset),Ne=Me.length>0?`${Me.map((Be)=>`if (${qg(Be,Q)}) `).join("")}{ `:"",je=Me.length>0?" }":"";q(Re+xe+Ne+de.text+je+Ie,{line:pe.line,column:pe.column,expression:pe,prefixLength:de.prefixLength+Re.length+xe.length+Ne.length,guardPrefixLength:Re.length+xe.length+Ne.length})}if(le>0)q("});")}}let K=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,K=!0;return q("export {}"),{text:T.join(`
2488
+ `),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:K}}function xi(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function Si(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 Kg from"fs";import Xg from"path";var Zg=!1;function Qv(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:[]),F=(G)=>{if(z.size===0)return!1;let ee=s(G),ae=ee.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(ae&&z.has(ae))return!0;for(let Q of z){let ce=Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${ce}\\s*\\(`).test(ee))return!0}return!1},H=new Set(ta),q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;if(G.startsWith("aria-")||G.startsWith("data-"))return G;return G.replace(/-([a-z0-9])/g,(ee,ae)=>ae.toUpperCase())},K=(G,ee)=>{let ae=q(G);if(B.static[ae]=ee,ae!==G)B.staticNames[ae]=G};for(let[G,ee]of Object.entries(v)){let ae=G.startsWith("x-")&&!H.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(ae.startsWith("@")){B.events[ae]=ee;continue}if(ae.startsWith("__stx_")){let Q=q(ae.slice(6));B.serverDynamic[Q]=kg(ee,k);continue}if(ae.startsWith(":")){let Q=q(ae.slice(1)),ce=ee===jr?Q:ee;if(Q==="if"||Q==="for"||Q==="show"){B.clientReactive[Q]=ce;continue}if(R){B.clientReactive[Q]=ce;continue}if(ne(ce,T)){B.clientReactive[Q]=ce;continue}if(F(ce)){B.clientReactive[Q]=ce;continue}try{if(!p(ce)){if(k.debug)console.error(`Unsafe expression in :${Q} binding: ${ce}`);B.clientReactive[Q]=ce;continue}let ue=Object.keys(_),le=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),pe=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Pe(ce).some((xe)=>!le.has(xe)&&!ue.includes(xe)&&(!(xe in globalThis)||pe.has(xe)))){B.clientReactive[Q]=ce;continue}let be=c(ce,ue)(...Object.values(_));if(B.serverDynamic[Q]=be,Q!==ae.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[Q]=ae.slice(1)}catch{B.clientReactive[Q]=ce}continue}if(typeof ee==="string"&&ee.includes("{{")&&ee.includes("}}")){let Q=ew(ee,T);if(Q!==null){B.clientReactive[q(ae)]=Q;continue}let ce=ee.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(ce)try{let ue=ce[1];if(p(ue)){let pe=c(ue,Object.keys(_))(...Object.values(_));K(ae,pe!=null?String(pe):"")}else{if(k.debug)console.error(`Unsafe expression in ${ae}: ${ue}`);K(ae,ee)}}catch(ue){if(k.debug)console.error(`Error evaluating expression for ${ae}:`,ue);K(ae,ee)}else{let ue=ee,le=/\{\{\s*([\s\S]+?)\s*\}\}/g,pe;while((pe=le.exec(ee))!==null)try{let de=pe[1];if(!p(de)){if(k.debug)console.error(`Unsafe expression in ${ae}: ${de}`);continue}let be=c(de,Object.keys(_))(...Object.values(_));ue=ue.replace(pe[0],String(be??""))}catch(de){if(k.debug)console.error(`Error evaluating expression in ${ae}:`,de)}K(ae,ue)}continue}K(ae,ee===jr?"true":Eu(ee))}return B}function ew(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((F)=>ne(F[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 F of R)B+=v.slice(z,F.index).replace(/[`\\$]/g,(H)=>`\\${H}`),B+=`\${${F[1]}}`,z=F.index+F[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(F)=>`\\${F}`),`\`${B}\``}var tw=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function nw(v,_,k){if(!v.includes("@"))return v;if(!tw.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return xr(v,_,k)}catch{return v}}function ii(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 F=v[k];if(F==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(F===z){k++;break}B+=F,k++}}else if(v[k]==="{"){B=Cu(v,k),k+=B.length;let z=Eg(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=jr}return _}function Gg(v){return Object.entries(v).map(([_,k])=>k===jr?_:`${_}="${rw(k)}"`).join(" ")}function rw(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sw(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(ei.isBuiltin(T))_.add(T)}return[..._].sort()}async function Oc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=Xg.dirname(k),F=[],H=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(H)){let[ee,ae,Q]=G,ce=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ue=Q,le,pe=[];while((le=ce.exec(Q))!==null){let[de,Re,be,xe]=le,Ie=null,Me=null;if(xe.startsWith(".")||xe.startsWith("/")){let Be=Xg.resolve(z,xe);if(Be.endsWith(".stx"))Me=Be;else{let De=`${Be}.stx`;try{if(Kg.statSync(De).isFile())Me=De}catch{try{if(Kg.statSync(Be).isDirectory())Ie=Be}catch{}}}}else Ie=qo(xe,z);if(!Ie&&!Me)continue;let Ne=!1,je=(Be,De)=>{B.set(Be,De),B.set(Be.toLowerCase(),De);let Fe=Be.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(Fe,De),T.add(De)};if(be&&Me)je(be,Me),Ne=!0;else if(Re){let Be=Re.slice(1,-1).split(",").map((Fe)=>Fe.trim()).filter(Boolean).map((Fe)=>{let Ue=Fe.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ue)return{source:Ue[1],local:Ue[2]};return{source:Fe,local:Fe}}),De=Ie?Ho(Ie):null;for(let{source:Fe,local:Ue}of Be){let ze=null;if(Me)ze=Me;else if(De)ze=De.get(Fe)??De.get(Fe.toLowerCase())??De.get(Fe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(ze)je(Ue,ze),Ne=!0}}if(Ne)pe.push({start:le.index,end:le.index+de.length})}if(pe.length===0)continue;for(let de=pe.length-1;de>=0;de--)ue=ue.slice(0,pe[de].start)+ue.slice(pe[de].end);F.push({start:G.index,end:G.index+ee.length,value:`<script${ae}>${ue}</script>`})}if(F.length===0)return v;let q=[],K=0;for(let G of F)q.push(v.slice(K,G.start),G.value),K=G.end;return q.push(v.slice(K)),q.join("")}async function iw(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,F=/@import\s*\(\s*([^)]+)\s*\)/g,H;while((H=F.exec(B))!==null){let[q,K]=H,G=K.split(",").map((ee)=>ee.trim().replace(/^['"]|['"]$/g,"")).filter((ee)=>ee.length>0);for(let ee of G){let ae=ee.split("/"),ce=ae[ae.length-1].replace(/\.stx$/,""),ue=ce.includes("-")?ce.split("-").map((de)=>de.charAt(0).toUpperCase()+de.slice(1)).join(""):ce.charAt(0).toUpperCase()+ce.slice(1),le=null,pe=Ko(ee,k,R);for(let de of pe)try{if(await Bun.file(de).exists()){le=de;break}}catch{}if(le){z.set(ue,le),z.set(ce,le),z.set(ce.toLowerCase(),le);let de=ue.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(de,le),T.add(le),R.debug)console.log(`Imported component: ${ue} -> ${le}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${ee}`)}B=B.replace(q,""),F.lastIndex=0}return B}async function ow(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let F=_.__processedComponents,H=/@component\s*\(/g,q;while((q=H.exec(B))!==null){let K=q.index,G=K+q[0].length-1,ee=1,ae=G+1;while(ae<B.length&&ee>0){if(B[ae]==="(")ee++;else if(B[ae]===")"){if(ee--,ee===0)break}ae++}if(ee!==0)break;let Q=B.substring(G+1,ae),ce=ae+1,ue=Q.match(/^\s*['"]([^'"]+)['"]/);if(!ue){H.lastIndex=0;continue}let le=ue[1],pe,de=Q.slice(ue[0].length),Re=de.match(/^\s*,\s*/);if(Re)pe=de.slice(Re[0].length).trim();let be={};if(pe)try{be=D(pe,_)}catch(Be){let De=Be instanceof Error?Be.message:String(Be);B=B.replace(B.substring(K,ce),`[Error parsing component props: ${De}]`);continue}let xe="",Ie=ce,Ne=B.substring(ce).match(/^([\s\S]*?)@endcomponent/);if(Ne)xe=Ne[1].trim(),Ie=ce+Ne[0].length;let je=await rt(le,be,xe,z,_,k,R,F,T);B=B.substring(0,K)+je+B.substring(Ie),H.lastIndex=0}return B}async function aw(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let F=_.__processedComponents,H=uw(B);if(H.size>0){let ce=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...ce,...H])]}let q=hn(B);B=q.output;let K=Rr(_);return B=await Q(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await Q(B,/[A-Z][a-zA-Z0-9]*/,!0,$g(Eo)),B=await Q(B,/[a-z][a-z0-9]*/,!1,Eo),B=q.restore(B),B;async function Q(ce,ue,le,pe){if(!ce)return ce;let de=ce,Re=_g(de,ue,pe),be=Ru(de),xe=new Map;for(let Ne=Re.length-1;Ne>=0;Ne--){let je=Re[Ne],Be=le?pn(je.tagName):je.tagName,De=ii(nw(je.attributes,_,k)),Fe=be.filter(({start:Ct,end:vt})=>je.startIndex>=Ct&&je.startIndex<vt),Ue=Fe.length>0,ze=new Set(K);for(let Ct of Fe)for(let vt of Ct.names)ze.add(vt);let Le=Qv(De,_,R,Ue,ze);if(typeof Le.clientReactive.for==="string")for(let Ct of Vr(Le.clientReactive.for))ze.add(Ct);let it=ei.getBuiltin(je.tagName),xt=it?await pr(je.tagName,z,_,k,R):!1;if(it&&!xt){let Ct={context:_,filePath:k,options:R,dependencies:T},vt=it.render(Le,je.content,Ct);if(Object.keys(Le.events).length>0){let dt=Gg(Le.events);vt=vt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${dt}`)}if(Object.keys(Le.clientReactive).length>0)vt=Jg(vt,Le.clientReactive);xe.set(Ne,vt);continue}if(!le&&je.tagName.includes("-")&&!await pr(Be,z,_,k,R))continue;let bt={};for(let[Ct,vt]of Object.entries(Le.static))bt[Ct]=vt;for(let[Ct,vt]of Object.entries(Le.serverDynamic))bt[Ct]=vt;let St={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(Le.clientReactive),events:Object.keys(Le.events)},$t=await rt(Be,bt,q.restore(je.content),z,_,k,R,F,T,[...ze],St,je.tagName);if($t=cw($t,Le,St.declaredProps,St.consumedProps,R._nativeHostAttrs),R._nativeHostAttrs){let Ct=St.reactiveProps.filter((_t)=>!St.consumedProps.has(_t)&&!["if","for","show","key","ref"].includes(_t)).map(pn),vt=Ou($t,!0);if(Ct.length&&vt){if(!Object.hasOwn(ii($t.slice(vt.insertPos,vt.tagEnd)),"data-stx-native-host-root"))$t=$t.slice(0,vt.insertPos)+' data-stx-native-host-root="true"'+$t.slice(vt.insertPos);let _t=To($t);$t=$t.slice(0,_t.insertPos)+` data-stx-native-forward="${Ct.join(" ")}"`+$t.slice(_t.insertPos)}let dt=Ou($t,!0);if(dt){let _t=ii($t.slice(dt.insertPos,dt.tagEnd)),yt=To($t),Kt=ii($t.slice(yt.insertPos,yt.tagEnd));if(Object.hasOwn(_t,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))$t=$t.slice(0,yt.insertPos)+" data-stx-native-host-owner"+$t.slice(yt.insertPos)}}if(Object.keys(Le.events).length>0){let Ct=To($t);if(Ct){let vt=Gg(Le.events),dt=Object.keys(Le.events).map((_t)=>_t.replace(/^@/,"").split(".")[0]).join(" ");$t=$t.substring(0,Ct.insertPos)+` data-stx-parent-events="${dt}" ${vt}`+$t.substring(Ct.insertPos)}}if(Object.keys(Le.clientReactive).length>0)$t=Jg($t,Le.clientReactive);xe.set(Ne,$t)}if(xe.size===0)return de;let Ie="",Me=0;for(let Ne=0;Ne<Re.length;Ne++){let je=xe.get(Ne);if(je===void 0)continue;Ie+=de.slice(Me,Re[Ne].startIndex),Ie+=je,Me=Re[Ne].endIndex}return Ie+=de.slice(Me),Ie}}function Jg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([K])=>!k.has(K)),B=T.filter(([K])=>!R.has(K)).map(([K])=>pn(K)).join(" "),z=v,F=T.length>0?To(z):null;if(F){let K=T.map(([ee,ae])=>`:${pn(ee)}="${ae.replace(/"/g,"&quot;")}"`).join(" "),G=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,F.insertPos)+`${G} ${K}`+z.substring(F.insertPos)}let H=_.if;if(H)z=`<template :if="${H.replace(/"/g,"&quot;")}">${z}</template>`;let q=_.for;if(q)z=`<template :for="${q.replace(/"/g,"&quot;")}">${z}</template>`;return z}function cw(v,_,k=new Set,R=new Set,T=!1){let B=Ou(v,T);if(!B)return v;let z=v.slice(B.insertPos,B.tagEnd),F=_.serverDynamic.class??_.static.class;if(T&&typeof F==="string"&&F&&!R.has("class")){let Q=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,ce=Q.test(z)?z.replace(Q,(ue,le,pe,de,Re)=>`${le}class="${Zt(`${Eu(pe??de??Re)} ${F}`)}"`):` class="${Zt(F)}"${z}`;v=v.slice(0,B.insertPos)+ce+v.slice(B.tagEnd),B.tagEnd+=ce.length-z.length,z=ce}let H=T||/\bdata-native(?:\s|=)/i.test(z),q=H?R:k,K=new Set(Object.keys(ii(z))),G=new Set(["class","className"]);for(let Q of Object.keys(_.static)){let ce=_.staticNames[Q]??Q;if(K.has(ce)||q.has(Q)||!H&&!Ll(ce))G.add(Q)}for(let Q of Object.keys(_.serverDynamic)){let ce=_.serverDynamicNames?.[Q]??Q;if(K.has(ce)||q.has(Q)||!H&&!Ll(ce))G.add(Q)}let ee=[];if(H){for(let[Q,ce]of Object.entries(_.static)){if(G.has(Q)||ce!==!0&&ce!==jr)continue;G.add(Q),ee.push(`${Zt(_.staticNames?.[Q]??Q)}="true"`)}for(let[Q,ce]of Object.entries(_.serverDynamic)){if(G.has(Q)||ce!==!0)continue;G.add(Q),ee.push(`${Zt(_.serverDynamicNames?.[Q]??Q)}="true"`)}}let ae=[...Lr(_,G),...Br(_,G),...ee];if(H){for(let[Q,ce]of Object.entries(_.serverDynamic)){if(G.has(Q)||ce!==!1)continue;let ue=_.serverDynamicNames?.[Q]??Q;ae.push(`${Zt(ue)}="false"`)}for(let[Q,ce]of Object.entries(_.serverDynamic)){if(G.has(Q)||ce===null||typeof ce!=="object")continue;let ue=JSON.stringify(ce);if(ue!==void 0){let le=_.serverDynamicNames?.[Q]??Q;ae.push(`${Zt(le)}="${Zt(ue)}"`)}}}if(ae.length===0)return v;return`${v.slice(0,B.insertPos)} ${ae.join(" ")}${v.slice(B.insertPos)}`}function To(v){let _=Yg(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 Ou(v,_=!1){let k=To(v);if(!k)return null;let R=v.slice(k.insertPos,k.tagEnd),T=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(R)?Yg(v,k.tagEnd+1):k;return T&&_?lw(v,T)??T:T}function lw(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 K=v.indexOf("-->",R+4);if(K<0)return null;R=v.indexOf("<",K+3);continue}let z=/^<(\/?)([a-z][\w-]*)\b/i.exec(v.slice(R));if(!z){R=v.indexOf("<",R+1);continue}let F=z[2].toLowerCase(),H=R+z[0].length,q=Mu(v,H);if(z[1]){if(T--,B!==void 0&&T<B)B=void 0;if(T<=0)return null}else if(F==="script"||F==="style"){let K=new RegExp(`</${F}\\s*>`,"gi");if(K.lastIndex=q+1,!K.exec(v))return null;R=v.indexOf("<",K.lastIndex);continue}else{let K=ii(v.slice(H,q)),G=T>0&&(Object.hasOwn(K,"data-stx-component-wrapper")||Object.hasOwn(K,"data-stx-native-host-owner"));if(B===void 0&&!G&&Object.hasOwn(K,"data-stx-native-host-root"))return{insertPos:H,tagEnd:q};if(!k.has(F)&&v[q-1]!=="/"){if(T++,B===void 0&&G)B=T}else if(T===0)return null}R=v.indexOf("<",q+1)}return null}function Yg(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 F=v.indexOf("-->",k+4);if(F===-1)return null;k=F+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let F=`</${B[1].toLowerCase()}>`,H=v.toLowerCase().indexOf(F,k+B[0].length);if(H===-1)return null;k=H+F.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 uw(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 Du(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 _s(v,_,k,R,T){if(!Zg)vg(ei),Zg=!0;let B=await Oc(v,_,k,R,T);B=await iw(B,_,k,R,T),B=await ow(B,_,k,R,T);let z=[];for(let F=0;F<3;F++){let H=z.length,q=Un(B,Ge,(G,ee)=>`\x00STX_COMPONENT_COMMENT_${H+ee}\x00`,`STX_COMPONENT_COMMENT:${H}`);z.push(...q.tokens);let K=B;if(B=await aw(q.output,_,k,R,T),B===K)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(F,H)=>z[Number(H)]??"");if(R.debug){let F=sw(B);if(F.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${F.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function Nu(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 fw(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,F=z+B[0].length-1,H=1,q=F+1;while(q<R.length&&H>0){if(R[q]==="(")H++;else if(R[q]===")")H--;q++}if(H!==0)break;let K=R.substring(F+1,q-1),G=`${k}(${K})`;R=R.substring(0,z)+G+R.substring(q),T.lastIndex=z+G.length,B=T.exec(R)}return R}function pw(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function nm(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,F=(G)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===G){B++;return}B++}},H=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let G=1;while(B<z&&G>0)if(_[B]==="{")G++,B++;else if(_[B]==="}")G--,B++;else if(_[B]==="'"||_[B]==='"')F(_[B]);else if(_[B]==="`")H();else B++;continue}B++}},q=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
2489
+ `)B++;return!0}if(_[B]==="/"&&_[B+1]==="*"){B+=2;while(B<z-1&&!(_[B]==="*"&&_[B+1]==="/"))B++;return B+=2,!0}return!1},K=()=>{if(T!==0)return;let G=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let Q=G[2];if(!R.has(Q))k.push(Q),R.add(Q);return}let ee=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ee){let Q=ee[1];if(!R.has(Q))k.push(Q),R.add(Q);return}let ae=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ae){let Q=ae[1];if(!R.has(Q))k.push(Q),R.add(Q)}};while(B<z){if(q())continue;if(_[B]==="'"||_[B]==='"'){F(_[B]);continue}if(_[B]==="`"){H();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])))K();B++}return k.join(", ")}function gw(v,_=""){let k=nm(v).split(",").map((R)=>R.trim()).filter(Boolean);return`
2490
+ (function() {
2491
+ ${Wt("var",k)}
2492
+ var __destroyHooks = [];
2493
+ var __origOnDestroy = onDestroy;
2494
+ onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
2495
+
2496
+ ${v}
2497
+ ${_}})();
2498
+ `}function mw(v,_){let T=nm(v).split(",").map((B)=>B.trim()).filter(Boolean).map((B)=>` try { __scopeRegistration[${JSON.stringify(B)}] = ${B}; } catch (e) { /* not actually top-level */ }`).join(`
2499
+ `);return`
2500
+ // Register scope variables for STX runtime
2501
+ if (!window.stx._scopes) window.stx._scopes = {};
2502
+ var __scopeRegistration = window.stx._scopes['${_}'] || { __destroyCallbacks: __destroyHooks };
2503
+ ${T}
2504
+ // #1767: when the bundler renamed a component const that collided with an
2505
+ // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
2506
+ // renamed declaration so it resolves to the component's value, not the
2507
+ // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
2508
+ try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
2509
+ window.stx._scopes['${_}'] = __scopeRegistration;
2510
+ `}function hw(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 Qg(v,_){let k=mw(v,_);return yw(gw(v,k),_)}function yw(v,_){let k=`
2511
+ (function() {
2512
+ var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
2513
+ var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
2514
+ if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
2515
+ if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
2516
+ if (!window.stx._scopes) window.stx._scopes = {};
2517
+ window.stx._scopes['${_}'] = {};
2518
+ }
2519
+ try {`,R=`
2520
+ } finally {
2521
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2522
+ }
2523
+ })();`;return k+v+`
2524
+ } finally {
2525
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2526
+ }
2527
+ })();`}function xw(v,_){if(Zn(v)){let T=Zn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:fs(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],F=k[2],H=k[3];return{html:`${z}${F} data-stx-scope="${_}"${H}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var bw=0;function em(v,_){let k=Jt.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}_${++bw}`}var ju=new Set,Lu=new Set;function gu(){ju.clear(),Lu.clear()}var vw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wc(v){let _=(F)=>F.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 F=z[1]==="/",H=z[2],q=z[3]==="/"||vw.has(H.toLowerCase());if(F){T=Math.max(0,T-1);continue}if(T===0)R.push(H);if(!q)T++}return R}function tm(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var Te=new M(500),Ai=new Set;function mu(){Ai.clear()}function ww(v){if(v.__onceStore instanceof Set)return v.__onceStore;return Ai}async function Is(v,_,k,R,T,B=new Set){let z=R.partialsDir||Jt.join(Jt.dirname(k),"partials");if(z&&!Jt.isAbsolute(z))z=Jt.resolve(process.cwd(),z);let F=fw(v,"@partial","@include"),H=ww(_);F=F.replace(/@once([\s\S]*?)@endonce/g,(ce,ue,le)=>{let pe=ue.trim(),de=`${k}:${pe}`;if(H.has(de))return"";return H.add(de),ue});{let ce=/@includeIf\s*\(/g,ue;while((ue=ce.exec(F))!==null){let le=ue.index,pe=le+ue[0].length-1,de=1,Re=pe+1;while(Re<F.length&&de>0){if(F[Re]==="(")de++;else if(F[Re]===")")de--;Re++}if(de!==0)break;let be=F.substring(pe+1,Re-1),xe=be.match(/^\s*['"]([^'"]+)['"]/);if(!xe){ce.lastIndex=Re;continue}let Ie=xe[1],Me=q(Ie,z,k),Ne="";if(Me&&await Bun.file(Me).exists())T.add(Me),Ne=`@include(${be})`;F=F.substring(0,le)+Ne+F.substring(Re),ce.lastIndex=0}}for(let[ce,ue]of[["@includeWhen",!1],["@includeUnless",!0]]){let le=new RegExp(`${ce.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),pe;while((pe=le.exec(F))!==null){let de=pe.index,Re=de+pe[0].length-1,be=1,xe=Re+1;while(xe<F.length&&be>0){if(F[xe]==="(")be++;else if(F[xe]===")")be--;xe++}if(be!==0)break;let Ie=F.substring(Re+1,xe-1),Me=Nu(Ie,0);if(Me===-1){le.lastIndex=xe;continue}let Ne=Ie.substring(0,Me).trim(),je=Ie.substring(Me+1).trim(),Be=je.match(/^\s*['"]([^'"]+)['"]/);if(!Be){le.lastIndex=xe;continue}let De=Be[1],Fe=je.substring(Be[0].length),Ue,ze=Nu(Fe,0);if(ze!==-1)Ue=Fe.substring(ze+1).trim();try{let Le=`Boolean(${Ne})`,it;if(p(Le)){let St=c(Le,Object.keys(_));it=Boolean(St(...Object.values(_)))}else it=Boolean(l(Le,_));let xt=ue?!it:it,bt="";if(xt){let St=q(De,z,k);if(St&&await Bun.file(St).exists())T.add(St);bt=`@include('${De}'${Ue?`, ${Ue}`:""})`}F=F.substring(0,de)+bt+F.substring(xe),le.lastIndex=0}catch(Le){let it=Le instanceof Error?Le.message:String(Le),xt=g("Include",`Error evaluating ${ce} condition: ${it}`,k,v,de);F=F.substring(0,de)+xt+F.substring(xe),le.lastIndex=0}}}{let ce=/@each\s*\(/g,ue;while((ue=ce.exec(F))!==null){let le=ue.index,pe=le+ue[0].length-1,de=1,Re=pe+1;while(Re<F.length&&de>0){if(F[Re]==="(")de++;else if(F[Re]===")"){if(de--,de===0)break}Re++}if(de!==0)break;let be=F.substring(pe+1,Re),xe=F.substring(le,Re+1),Ie=be.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Ie){ce.lastIndex=0,F=F.replace(xe,"");continue}let[,Me,Ne,je,Be]=Ie;try{let De,Fe=Ne.trim();if(p(Fe))De=c(Fe,Object.keys(_))(...Object.values(_));else De=l(Fe,_);let Ue="";if(Array.isArray(De)&&De.length>0)for(let ze of De){let Le={..._,[je]:ze},it=await ee(Me,Le,v,le);Ue+=it}else if(Be)Ue=await ee(Be,{},v,le);F=F.substring(0,le)+Ue+F.substring(Re+1),ce.lastIndex=0}catch(De){let Fe=De instanceof Error?De.message:String(De);F=F.substring(0,le)+g("Each",`Error in @each: ${Fe}`,k,v,le)+F.substring(Re+1),ce.lastIndex=0}}}{let ce=/@includeFirst\s*\(/g,ue;while((ue=ce.exec(F))!==null){let le=ue.index,pe=le+ue[0].length-1,de=1,Re=pe+1;while(Re<F.length&&de>0){if(F[Re]==="(")de++;else if(F[Re]===")"){if(de--,de===0)break}Re++}if(de!==0)break;let be=F.substring(pe+1,Re),xe=F.substring(le,Re+1),Ie=be.match(/^\s*(\[[^\]]+\])/);if(!Ie){ce.lastIndex=0,F=F.replace(xe,"");continue}let Me=Ie[1],Ne=be.slice(Ie[0].length),je,Be=Ne.match(/^\s*,\s*\{/);if(Be){Ne=Ne.slice(Be[0].length-1);let Ue=1,ze=1;while(ze<Ne.length&&Ue>0){if(Ne[ze]==="{")Ue++;else if(Ne[ze]==="}"){if(Ue--,Ue===0)break}ze++}je=Ne.substring(0,ze+1),Ne=Ne.slice(ze+1)}let De,Fe=Ne.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Fe)De=Fe[1];try{let Ue=JSON.parse(Me.replace(/'/g,'"')),ze={};if(je)try{ze=D(je,_)}catch(it){let xt=it instanceof Error?it.message:String(it);if(R.debug){let bt=g("Include",`Error parsing includeFirst variables: ${xt}`,k,v,le,xe);F=F.replace(xe,()=>bt)}else F=F.replace(xe,()=>De||"");continue}let Le=!1;for(let it of Ue){let xt=q(it,z,k);if(!xt)continue;if(await r(xt)){let bt=await ee(it,ze,v,le);F=F.replace(xe,()=>bt),Le=!0;break}}if(!Le)if(De!==void 0)F=F.replace(xe,()=>De);else if(R.debug){let it=g("Include",`None of the includeFirst paths exist: ${Me}`,k,v,le,xe);F=F.replace(xe,()=>it)}else F=F.replace(xe,"")}catch(Ue){let ze=Ue instanceof Error?Ue.message:String(Ue),Le=g("Include",`Error processing @includeFirst: ${ze}`,k,v,le,xe);F=F.replace(xe,()=>Le)}ce.lastIndex=0}}function q(ce,ue,le){try{let pe=ce;if(!ce.endsWith(".stx"))pe=`${ce}.stx`;let de=Jt.resolve(ue),Re=Jt.resolve(Jt.dirname(le)),be;if(!pe.startsWith("./")&&!pe.startsWith("../")){for(let Be of R._layerPartialDirs??[]){let De=Jt.resolve(Be,pe);if(De.startsWith(`${Jt.resolve(Be)}${Jt.sep}`)&&dw(De))return De}be=Jt.resolve(ue,pe)}else be=Jt.resolve(Re,pe);let xe=Jt.normalize(be),Ie=xe.startsWith(de+Jt.sep)||xe===de,Me=xe.startsWith(Re+Jt.sep)||xe===Re,Ne=!1,je=Jt.dirname(Re);if(xe.startsWith(je+Jt.sep)){if(!Jt.relative(je,xe).split(Jt.sep).some((Ue)=>Ue.startsWith(".")&&Ue!=="."&&Ue!==".."))Ne=!0}if(!Ie&&!Me&&!Ne)return console.error(`Security: Path traversal attempt blocked for include path: ${ce}`),console.error(` Resolved to: ${xe}`),console.error(` Allowed dirs: ${de}, ${Re}`),null;return xe}catch(pe){return console.error(`Error resolving path ${ce}: ${pe}`),null}}let K=Jt.resolve(k);B.add(K);function G(ce,ue,le,pe){return R.onIncludeError?.({includePath:ce,templatePath:k,message:ue,partialsDir:z}),g("Include",ue,k,le,pe)}async function ee(ce,ue={},le,pe){let de=q(ce,z,k);if(!de)return G(ce,`Could not resolve path for include: ${ce}`,le,pe);let Re=Jt.resolve(de);if(B.has(Re)){let be=[...B,Re].map((xe)=>Jt.basename(xe)).join(" -> ");return G(ce,`Circular include detected: ${be}`,le,pe)}try{T.add(de);let be;if(!be)try{be=await Bun.file(de).text()}catch(dt){let _t=dt instanceof Error?dt.message:String(dt);return G(ce,`Error loading include file ${ce}: ${_t}`,le,pe)}if(be)be=be.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(be&&be.includes("@stream")){let{processStreamDirectives:dt}=await import("./chunk-k5vytrbx.js");be=dt(be,_)}if(be&&(R.debug||!E()&&!Ln()))try{let{warnUnbalancedTags:dt}=await import("./chunk-r8a96bbd.js");dt(be,de)}catch{}try{let{processESImports:dt}=await import("./chunk-9mmy9m0y.js");be=await dt(be,_,de,R,T)}catch(dt){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${de}:`,dt instanceof Error?dt.message:dt)}let xe=be,Ie=se(xe);if(Ie)xe=Ie.content.trim();let Ne=be.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),je="";if(Ne)je=`<style${Ne[1]}>${Ne[2]}</style>`;let Be=[];xe=xe.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(dt,_t,yt)=>{if(!tm(_t))return"";return Be.push({attrs:_t,body:yt}),`__STX_DATA_BLOCK_${Be.length-1}__`}),xe=xe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let De={..._};De.__stx_signals_gate=Ce(be,de);for(let[dt,_t]of Object.entries(ue))De[dt]=_t;let Fe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ue=[...be.matchAll(Fe)].sort((dt,_t)=>{let yt=(dt[1]||"").includes("server"),Kt=(_t[1]||"").includes("server");return Number(Kt)-Number(yt)}),ze="",Le=null,it=!1,xt=!1;for(let dt of Ue){let _t=dt[1]||"",yt=dt[2]||"";if(tm(_t))continue;let Kt=_t.includes("server"),Vn=tt(_t);if(!Kt&&!/\bsrc\s*=/i.test(_t))Ze(yt,de,R.strict);if(!Kt&&yt.trim()){let{interpolateScriptExpressions:gt}=await import("./chunk-64vnwrkw.js");yt=gt(yt,De,ce)}let jn="";try{let{extractAndStripCssImports:gt,renderVendorStyleTags:kt}=await import("./chunk-cwvazqab.js"),Ut=gt(yt,{filePath:de,projectRoot:process.cwd()});yt=Ut.code,jn=kt(Ut.styles)}catch(gt){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${de}:`,gt instanceof Error?gt.message:gt)}if(Vn&&yt.trim())yt=nt(yt);if(!Kt){try{let{injectBrowserCoreAutoImports:kt}=await import("./chunk-cwvazqab.js");yt=kt(yt).code;let{hasUserImports:Ut,bundleClientScript:Yt}=await import("./chunk-g24kapd5.js");if(Ut(yt))yt=await Yt(yt,de,{projectRoot:process.cwd()})}catch(kt){if(R.debug)console.warn(`[stx] bundler skipped for ${de}:`,kt instanceof Error?kt.message:kt)}let{stripStxRuntimeImports:gt}=await import("./chunk-76ebcf61.js");yt=gt(yt)}let wt=pw(yt);if(!Kt){let{extractBridgeData:gt,generateServerDataBridge:kt}=await import("./chunk-cwvazqab.js"),Ut=kt(yt,gt(De));if(Ut)yt=`${Ut}
2528
+ ${yt}`}if(wt&&!Kt){it=!0,Le=em(de,_);let gt=I(yt),kt=Qg(gt,Le);ze+=`${jn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Le}">${kt}</script>
2529
+ `;continue}if(Kt)try{let{extractVariables:gt}=await import("./chunk-0gpjks6k.js");await gt(yt,De,de)}catch(gt){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${de}:`,gt)}if(!Kt&&!wt){let gt=_t.replace(/\bclient\b/i,"").trim();Le=em(de,_);let kt=I(yt),Ut=Qg(kt,Le);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Ut))xt=!0;ze+=`${jn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Le}"${gt?` ${gt}`:""}>${Ut}</script>
2530
+ `}}if(Be.length>0){let{interpolateScriptExpressions:dt}=await import("./chunk-64vnwrkw.js");xe=xe.replace(/__STX_DATA_BLOCK_(\d+)__/g,(_t,yt)=>{let Kt=Be[Number(yt)];return`<script${Kt.attrs}>${dt(Kt.body,De,ce)}</script>`})}if(Le){let dt=xw(xe,Le);if(xe=dt.html,dt.mergedIntoExisting){let yt=Le,Kt=dt.mergedIntoExisting;ze=ze.split(`'${yt}'`).join(`'${Kt}'`).split(`"${yt}"`).join(`"${Kt}"`),Le=Kt}else if(!dt.stamped&&it&&!ju.has(de))ju.add(de),console.warn(`[stx] ${Jt.relative(process.cwd(),de)} 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(dt.stamped&&dt.root!=="body"&&(it||xt)&&!Lu.has(de)){let yt=Wc(xe);if(yt.length>1)Lu.add(de),console.warn(`[stx] ${Jt.relative(process.cwd(),de)} declares ${it?"signals":"bindings"} and has ${yt.length} top-level elements (${yt.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 _t=dt.stamped&&dt.root!==null&&Cn(dt.root);ze=hw(ze,_t?Le:null)}if(xe.includes("@include")||xe.includes("@partial"))xe=await Is(xe,De,de,R,T,B);let{processLoops:bt,reportDeferredLoopWarnings:St}=await import("./chunk-brbybne9.js"),pt=bt(xe,De,de,void 0,!0);pt=xr(pt,De,de),pt=St(pt);let{processMetaDirectives:$t,processSeoDirective:Ct,processStructuredData:vt}=await import("./chunk-yda8t21j.js");if(pt=$t(pt,De,de,R),pt=vt(pt,De,de),pt=Ct(pt,De,de,R),pt=Y(pt,De,de),je)pt+=`
2531
+ `+je;if(ze)pt+=`
2532
+ `+ze;return pt}catch(be){if(be instanceof W)throw be;let xe=be instanceof Error?be.message:String(be);return G(ce,`Error processing include ${ce}: ${xe}`,le,pe)}}let ae=/@include\s*\(/g,Q;while((Q=ae.exec(F))!==null){let ce=Q.index,ue=ce+Q[0].length-1,le=1,pe=ue+1;while(pe<F.length&&le>0){if(F[pe]==="(")le++;else if(F[pe]===")")le--;pe++}if(le!==0)break;let de=F.substring(ce,pe),Re=F.substring(ue+1,pe-1),be=Re.match(/^\s*['"]([^'"]+)['"]/);if(!be){ae.lastIndex=pe;continue}let xe=be[1],Ie,Me=Re.substring(be[0].length),Ne=Nu(Me,0);if(Ne!==-1)Ie=Me.substring(Ne+1).trim();let je={};if(Ie)try{je=D(Ie,_)}catch(De){let Fe=De instanceof Error?De.message:String(De);F=F.replace(de,g("Include",`Error parsing include variables for ${xe}: ${Fe}`,k,v,ce)),ae.lastIndex=0;continue}let Be=await ee(xe,je,v,ce);F=F.substring(0,ce)+Be+F.substring(pe),ae.lastIndex=0}return F}function Os(v,_){let k=v;function R(T,B,z,F){let H=T,q=!0;while(q){q=!1;let K=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),G=H.match(K);if(!G||G.index===void 0)break;let ee=G.index,ae=G[1],Q=ee+G[0].length,ce=new RegExp(`@${B}\\(`),ue=new RegExp(`@${z}(?![a-z])`),le=1,pe=Q,de=-1;while(le>0&&pe<H.length){let be=H.slice(pe),xe=be.match(ce),Ie=be.match(ue),Me=xe?pe+xe.index:1/0,Ne=Ie?pe+Ie.index:1/0;if(Me<Ne)le++,pe=Me+(xe[0].length||1);else if(Ne<1/0){if(le--,le===0){de=Ne;break}pe=Ne+z.length+1}else break}if(de===-1)break;let Re=H.slice(Q,de);if(!_[ae])_[ae]=[];if(F)_[ae].unshift(Re);else _[ae].push(Re);H=H.substring(0,ee)+H.substring(de+`@${z}`.length),q=!0}return H}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function Ds(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
2533
+ `)})}import*as Bu from"path";async function rm(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 im(v,_,k,"@js","@endjs")}async function sm(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 im(v,_,k,"@ts","@endts")}async function im(v,_,k,R,T){let B=v,z=Ur(`${R}([\\s\\S]*?)${T}`,"g"),F=[],H;while((H=z.exec(v))!==null)F.push({fullMatch:H[0],content:H[1]||"",index:H.index});for(let{fullMatch:q,content:K,index:G}of F)try{let ee={..._,global:_},ae=Object.keys(ee),Q=Object.values(ee),ce=K.trim();if(R==="@ts")ce=ce.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 le=(ce.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((xe)=>xe.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),pe=le.length>0?`return { ${le.join(", ")} };`:"return {};",de=`
2534
+ ${ce}
2535
+ ${pe}
2536
+ `,be=Function(...ae,de)(...Q);if(be&&typeof be==="object")Object.assign(_,be);B=B.replace(q,"")}catch(ee){console.error(`Error executing ${R} code block in ${k}:`,ee);let ae=ee instanceof Error?ee.message:String(ee),Q=g(`${R} Directive`,`Error executing code: ${ae}`,k,v,G,q);console.error(Q),B=B.replace(q,"")}return B}var Sw=1000,$w=!1;function _w(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,F=B.index+B[0].indexOf("("),H=S(v,"(",")",F);if(H===-1)continue;let q=v.slice(z,H).trim();if(!q)continue;if(!Object.keys(_).some((ee)=>new RegExp(`(?:^|[^\\w$.])${ee.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let G;try{let ee=D(q,_);if(!ee||typeof ee!=="object")continue;G=JSON.stringify(ee)}catch{continue}R+=v.slice(T,z)+G,T=H,k.lastIndex=H}return T===0?v:R+v.slice(T)}function kw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,F=z+T[0].length-1,H=1,q=F+1;while(q<R.length&&H>0){if(R[q]==="(")H++;else if(R[q]===")"){if(H--,H===0)break}q++}if(H!==0)continue;let K=R.substring(F+1,q),G=q+1,ee=K.match(/^\s*['"]([^'"]+)['"]/);if(!ee)continue;let ae=ee[1],Q=K.slice(ee[0].length),ce=Q.match(/^\s*,\s*/);if(!ce)continue;let ue=Q.slice(ce[0].length).trim();if(!ue)continue;try{let le=D(ue,_),pe=JSON.stringify(le),de=`@component('${ae}', ${pe})`;B.push({start:z,end:G,replacement:de})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:F,end:H,replacement:q}=B[z];R=R.substring(0,F)+q+R.substring(H)}return R}function La(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,F=z+B[0].length-1,H=1,q=F+1,K=null,G=!1;while(q<R.length&&H>0){let Q=R[q];if(G){G=!1,q++;continue}if(Q==="\\"&&K){G=!0,q++;continue}if(K){if(Q===K)K=null;q++;continue}if(Q==='"'||Q==="'"||Q==="`"){K=Q,q++;continue}if(Q==="(")H++;else if(Q===")"){if(H--,H===0)break}q++}if(H!==0)break;let ee=R.substring(F+1,q),ae=k(ee);R=R.substring(0,z)+ae+R.substring(q+1)}return R}function Ew(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(_),F=Object.values(_);Qs(B);let q=c(B,z)(...F),K=JSON.stringify(q);if(K===void 0){if(!Pe(B).some((ae)=>!(ae in _)))return"";return R}let G=Buffer.from(K,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(z){return R}}),k}var Ba="<!--__STX_BREAK__-->",za="<!--__STX_CONTINUE__-->";function Cw(v,_){let k=v;return k=La(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let F=c(B,Object.keys(_));z=Boolean(F(...Object.values(_)))}else z=Boolean(l(B,_));return z?Ba:""}catch{return""}}),k=La(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let F=c(B,Object.keys(_));z=Boolean(F(...Object.values(_)))}else z=Boolean(l(B,_));return z?za:""}catch{return""}}),k}function Rw(v){let _=v;return _=_.replace(/@break(?!\()/g,Ba),_=_.replace(/@continue(?!\()/g,za),_}function om(v){let _=v.includes(Ba),k=_?v.substring(0,v.indexOf(Ba)):v;return{hasBreak:_,content:k}}function am(v){let _=v.includes(za),k=_?v.substring(0,v.indexOf(za)):v;return{hasContinue:_,content:k}}function lm(v){let _=v;return _=La(_,"@break",(k)=>{let R=k.trim();if(!_r(R))return"";return`\`; if (${R}) { break; } result += \``}),_=La(_,"@continue",(k)=>{let R=k.trim();if(!_r(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function Aw(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((K,G)=>K.pos-G.pos);let F=[],H=0;for(let K of R)H+=K.delta,F.push({pos:K.pos,depth:H});function q(K){let G=0,ee=F.length-1,ae=0;while(G<=ee){let Q=G+ee>>1;if(F[Q].pos<=K)ae=F[Q].depth,G=Q+1;else ee=Q-1}return ae}while((k=_.exec(v))!==null){if(q(k.index)>0)continue;let K=k.index,G=k.index+k[0].length-1,ee=1,ae=G+1,Q=-1;while(ae<v.length&&ee>0){if(v[ae]==="(")ee++;else if(v[ae]===")"){if(ee--,ee===0){Q=ae;break}}ae++}if(Q===-1)continue;let ce=v.substring(G+1,Q),ue=Dt(ce);if(!ue)continue;let{arrayExpr:le,itemVar:pe}=ue,de=Q+1,Re=1,be=de,xe=/@forelse\s*\(/g,Ie=/@endforelse/g,Me=-1;while(Re>0&&be<v.length){xe.lastIndex=be,Ie.lastIndex=be;let Ue=xe.exec(v),ze=Ie.exec(v);if(!ze)break;if(Ue&&Ue.index<ze.index)Re++,be=Ue.index+Ue[0].length;else{if(Re--,Re===0){Me=ze.index;break}be=ze.index+11}}if(Me===-1)continue;let Ne=v.substring(de,Me),je=Me+11,Be=-1,De=0,Fe=0;while(Fe<Ne.length){let Ue=Ne.indexOf("@",Fe);if(Ue===-1)break;let ze=Ne.substring(Ue);if(/^@forelse\s*\(/.test(ze))De++,Fe=Ue+1;else if(ze.startsWith("@endforelse"))De--,Fe=Ue+11;else if(De===0&&ze.startsWith("@empty")){if(Ne.length<=Ue+6||!/[a-z]/i.test(Ne[Ue+6])){Be=Ue;break}Fe=Ue+1}else Fe=Ue+1}if(Be===-1)continue;return{start:K,end:je,arrayExpr:le,itemVar:pe,foreachContent:Ne.substring(0,Be),emptyContent:Ne.substring(Be+6)}}return null}function cm(v,_){let k=v;while(!0){let R=Aw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:F,foreachContent:H,emptyContent:q}=R;try{let K;if(p(z))K=c(z,Object.keys(_))(...Object.values(_));else K=l(z,_);let G;if(!Array.isArray(K)||K.length===0)G=q;else G=`@foreach (${z} as ${F})${H}@endforeach`;k=k.substring(0,T)+G+k.substring(B)}catch(K){let G=K instanceof Error?K.message:String(K),ee=i("Forelse",`Error in @forelse(${z} as ${F}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+ee+k.substring(B)}}return k}var um="<!--stx:foreach-not-iterable:",Tw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Iw(v,_){return`${um}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Pw(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 Ps(v){if(!v.includes(um))return v;return v.replace(Tw,(_,k,R)=>(Pw(decodeURIComponent(k),decodeURIComponent(R)),""))}function Ri(v,_,k,R,T=!1){let B=v;B=cm(B,_);function z(q){let K=/@foreach\s*\(/g,G;while((G=K.exec(q))!==null){let ee=G.index,ae=G.index+G[0].length-1,Q=1,ce=ae+1,ue=-1;while(ce<q.length&&Q>0){if(q[ce]==="(")Q++;else if(q[ce]===")"){if(Q--,Q===0){ue=ce;break}}ce++}if(ue===-1)continue;let le=q.substring(ae+1,ue),pe=Dt(le);if(!pe)continue;let de=ee,{arrayExpr:Re,itemVar:be}=pe,xe=ue+1,Ie=1,Me=xe,Ne=/@foreach\s*\(/g,je=/@endforeach/g;while(Ie>0&&Me<q.length){Ne.lastIndex=Me,je.lastIndex=Me;let Be=Ne.exec(q),De=je.exec(q);if(!De)break;if(Be&&Be.index<De.index)Ie++,Me=Be.index+Be[0].length;else{if(Ie--,Ie===0){let Fe=q.substring(xe,De.index),Ue=De.index+11;return{start:de,end:Ue,arrayExpr:Re,itemVar:be,content:Fe}}Me=De.index+11}}}return null}function F(q,K){let G=q;while(!0){let ee=z(G);if(!ee)break;let{start:ae,end:Q,arrayExpr:ce,itemVar:ue,content:le}=ee;try{let pe=ce.trim(),de;if(p(pe))de=c(pe,Object.keys(K))(...Object.values(K));else de=l(pe,K);let Re=!1;if(!Array.isArray(de))if(de instanceof Map)de=Array.from(de),Re=!0;else if(de instanceof Set)de=Array.from(de);else if(typeof de==="string")de=Array.from(de);else if(de&&typeof de==="object"&&!(de instanceof Date)&&!(de instanceof RegExp))de=Object.entries(de),Re=!0;else{let De=Iw(pe,k)+i("Foreach",`Error in @foreach: ${pe} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ae)+De+G.substring(Q);continue}let be=R?.loops?.useAltLoopVariable??$w,xe=ue.trim(),Ie=null,Me,Ne=!1;if(xe.includes("=>")){let De=xe.split("=>").map((Fe)=>Fe.trim());if(De.length===2&&De[0]&&De[1])Ie=De[0],Me=De[1];else Me=xe}else if(!xe.startsWith("[")&&!xe.startsWith("{")&&xe.includes(",")){let De=xe.split(",").map((Fe)=>Fe.trim());if(De.length===2&&De[0]&&De[1])Me=De[0],Ie=De[1],Ne=!0;else Me=xe}else Me=xe;let je="",Be=de;for(let De=0;De<Be.length;De++){let Fe=Be[De],Ue={index:De,iteration:De+1,first:De===0,last:De===Be.length-1,count:Be.length},ze={...K,loop:Ue,$loop:Ue};if(Me.startsWith("[")&&Me.endsWith("]")){let bt=Me.slice(1,-1).split(",").map((St)=>St.trim());if(Array.isArray(Fe))bt.forEach((St,pt)=>{if(St)ze[St]=Fe[pt]});else ze[Me]=Fe}else if(Me.startsWith("{")&&Me.endsWith("}")){let bt=Me.slice(1,-1).split(",").map((St)=>St.trim()).filter(Boolean);if(Fe!==null&&typeof Fe==="object")bt.forEach((St)=>{let pt=St.indexOf(":"),$t=(pt===-1?St:St.slice(0,pt)).trim(),Ct=pt===-1?$t:St.slice(pt+1).trim();if($t&&Ct)ze[Ct]=Fe[$t]});else ze[Me]=Fe}else ze[Me]=Fe;if(Ie)if(!Ne&&Re&&Array.isArray(Fe)&&Fe.length===2)ze[Ie]=Fe[0],ze[Me]=Fe[1];else ze[Ie]=De;let Le=Cw(le,ze),it=am(Le);if(it.hasContinue){je+=it.content;continue}let xt=om(Le);if(xt.hasBreak){je+=xt.content;break}if(Le=cm(Le,ze),Le=F(Le,ze),Le=xr(Le,ze,k),Le=Rw(Le),xt=om(Le),xt.hasBreak){je+=xt.content;break}if(it=am(Le),it.hasContinue){je+=it.content;continue}Le=Y(Le,ze,k),Le=Ew(Le,ze),Le=kw(Le,ze),Le=_w(Le,ze),je+=Le}G=G.substring(0,ae)+je+G.substring(Q)}catch(pe){let de=i("Foreach",`Error in @foreach(${ce.trim()} as ${ue.trim()}): ${pe instanceof Error?pe.message:String(pe)}`,t.EVALUATION_ERROR);G=G.substring(0,ae)+de+G.substring(Q)}}return G}B=F(B,_),B=fm(B,_,k,R);let H=R?.loops?.maxWhileIterations??Sw;return B=Mw(B,_,H),T?B:Ps(B)}function Uc(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 dm(v){return _r(v)}function fm(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 F=z.index,H=F+z[0].length-1,q=S(T,"(",")",H);if(q===-1)break;let K=Uc(T.slice(H+1,q)),G=q+1,ee=Sa(T.slice(F),"for","endfor");if(ee.length===0)break;let ae=ee[0].content,Q=F+ee[0].end;if(!dm(K)){let ce=i("For",`Unsafe expression in @for: ${K}`,t.UNSAFE_EXPRESSION);T=T.substring(0,F)+ce+T.substring(Q),B=!0;continue}try{let ce=Dw(K),ue=/@(?:for|foreach|if|unless)\s*\(/.test(ae);if(ce.length>0&&ue){let xe=Ow({forExpr:K,content:ae,iterVarNames:ce,context:_,filePath:k,options:R});T=T.substring(0,F)+xe+T.substring(Q),B=!0;continue}let le=Object.keys(_),pe=Object.values(_),de=ae.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(xe,Ie)=>`\${${Ie}}`);de=lm(de);let be=Function(...le,`
2537
+ let result = '';
2538
+ for (${K}) {
2539
+ result += \`${de}\`;
2540
+ }
2541
+ return result;
2542
+ `)(...pe);T=T.substring(0,F)+be+T.substring(Q),B=!0}catch(ce){let ue=i("For",`Error in @for(${K}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);T=T.substring(0,F)+ue+T.substring(Q),B=!0}}return T}function Dw(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((F)=>{let H=F.trim();if(!H)return"";let q=H.indexOf(":");if(q>=0&&B.startsWith("{")){let ee=H.slice(q+1).trim(),ae=ee.indexOf("=");return(ae>=0?ee.slice(0,ae):ee).trim()}let K=H.indexOf("="),G=(K>=0?H.slice(0,K):H).trim();return/^[A-Za-z_$][\w$]*$/.test(G)?G:""}).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 Ow(v){let{forExpr:_,content:k,iterVarNames:R,context:T,filePath:B,options:z}=v,F=Object.keys(T),H=Object.values(T),q=Function(...F,"__pushIter",`
2543
+ for (${_}) {
2544
+ __pushIter([${R.join(", ")}])
2545
+ }
2546
+ `),K=[];q(...H,(ae)=>{K.push(ae)});let G=B??"inline.stx",ee="";for(let ae of K){let Q={...T};R.forEach((ue,le)=>{Q[ue]=ae[le]});let ce=fm(k,Q,B,z);ce=xr(ce,Q,G),ce=Y(ce,Q,G),ee+=ce}return ee}function Mw(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,F=z+B[0].length-1,H=S(R,"(",")",F);if(H===-1)break;let q=R.slice(F+1,H),K=Sa(R.slice(z),"while","endwhile");if(K.length===0)break;let G=K[0].content,ee=z+K[0].end;if(!dm(q)){let ae=i("While",`Unsafe expression in @while: ${q}`,t.UNSAFE_EXPRESSION);R=R.substring(0,z)+ae+R.substring(ee),T=!0;continue}try{let ae=Object.keys(_),Q=Object.values(_),ce=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(pe,de)=>`\${${de}}`);ce=lm(ce);let le=Function(...ae,`
2547
+ let result = '';
2548
+ let maxIterations = ${k}; // Configurable safety limit
2549
+ let counter = 0;
2550
+ while (${q} && counter < maxIterations) {
2551
+ counter++;
2552
+ result += \`${ce}\`;
2553
+ }
2554
+ if (counter > maxIterations) {
2555
+ result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2556
+ }
2557
+ return result;
2558
+ `)(...Q);R=R.substring(0,z)+le+R.substring(ee),T=!0}catch(ae){let Q=i("While",`Error in @while(${q}): ${ae instanceof Error?ae.message:String(ae)}`,t.EVALUATION_ERROR);R=R.substring(0,z)+Q+R.substring(ee),T=!0}}return R}function Nw(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function pm(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,R,T,B)=>Nw(R,B||"_method"))}async function gm(v,_,k,R,T){if(!R.middleware||R.middleware.length===0)return v;let B=v,z=R.middleware.filter((F)=>F.timing===T);if(z.length===0)return B;for(let F of z){if(!F.name||typeof F.handler!=="function"){if(R.debug)console.warn("Invalid middleware:",F);continue}try{let H=await F.handler(B,_,k,R);if(typeof H==="string")B=H;else if(R.debug)console.warn(`Middleware ${F.name} did not return a string`)}catch(H){if(R.debug)console.error(`Error in middleware ${F.name}:`,H);if(R.debug){let q=g("Middleware",`Error in middleware '${F.name}': ${H instanceof Error?H.message:String(H)}`,k,v);B=B.replace(/<body[^>]*>/,`$&
2559
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(q)}</div>
2560
+ `)}}}return B}async function mm(v,_,k,R){return gm(v,_,k,R,"before")}async function hm(v,_,k,R){return gm(v,_,k,R,"after")}function ym(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 Hn(R,z,B==="true")}catch(z){return console.error(`Error processing @route directive: ${z}`),"#route-error"}})}var Io={patterns:[],exact:{}};async function xm(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Io.exact[v])for(let R of Io.exact[v])await Promise.resolve(R(_,v));if(Io.exact[k])for(let R of Io.exact[k])await Promise.resolve(R(_,v));for(let{pattern:R,callback:T}of Io.patterns)if(R.test(v)||R.test(k))await Promise.resolve(T(_,v))}var jw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Lw=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 Yr(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()&&jw.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 Bw(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 F=B.exec(v),H=z.exec(v);if(!H)return-1;if(F&&F.index<H.index)R++,T=F.index+F[0].length;else{if(R--,R===0)return H.index+H[0].length;T=H.index+H[0].length}}return-1}function Jr(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Bw(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 bm(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function Po(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return R?R[1]:null}function zr(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 oi(v,_,k){let R=_.selfClosing?" /":"",T=`<${_.tag}${k}${R}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function zw(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Ww(v){let _=v,k=0;while(k<_.length){let R=Yr(_,k);if(!R)break;let T=Po(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(),F=B[2].trim(),H;if(z.includes(",")){let ue=z.split(",").map((de)=>de.trim()),le=ue[0],pe=ue[1];H=`${F} as ${pe} => ${le}`}else H=`${F} as ${z}`;let q=zr(R.attrs,"v-for"),K=zr(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=Jr(_,R),ee=_.slice(G.outerStart,G.outerEnd),ae=oi(ee,{...R,start:0,end:R.end-R.start},K),Q=`@foreach(${H})
2561
+ `,ce=`${Q}${ae}
2562
+ @endforeach`;_=_.slice(0,G.outerStart)+ce+_.slice(G.outerEnd),k=G.outerStart+Q.length}return _}function Fw(v){let _=v,k=0;while(k<_.length){let R=Yr(_,k);if(!R)break;let T=Po(R.attrs,"v-if");if(T===null){k=R.end;continue}let B=[],z=Jr(_,R),F=zr(R.attrs,"v-if"),H=oi(_.slice(z.outerStart,z.outerEnd),{...R,start:0,end:R.end-R.start},F);B.push({type:"if",expr:T,outerStart:z.outerStart,outerEnd:z.outerEnd,element:H,parsedTag:R});let q=z.outerEnd,K=!0;while(K){let ce=_.slice(q).match(/^\s*/),ue=ce?ce[0].length:0,le=Yr(_,q+ue);if(!le){K=!1;break}let pe=Po(le.attrs,"v-else-if"),de=bm(le.attrs,"v-else");if(pe!==null){let Re=Jr(_,le),be=zr(le.attrs,"v-else-if"),xe=oi(_.slice(Re.outerStart,Re.outerEnd),{...le,start:0,end:le.end-le.start},be);B.push({type:"else-if",expr:pe,outerStart:q,outerEnd:Re.outerEnd,element:xe,parsedTag:le}),q=Re.outerEnd}else if(de){let Re=Jr(_,le),be=zr(le.attrs,"v-else"),xe=oi(_.slice(Re.outerStart,Re.outerEnd),{...le,start:0,end:le.end-le.start},be);B.push({type:"else",outerStart:q,outerEnd:Re.outerEnd,element:xe,parsedTag:le}),K=!1}else K=!1}let G=[];for(let ce of B)if(ce.type==="if")G.push(`@if(${ce.expr})
2563
+ ${ce.element}`);else if(ce.type==="else-if")G.push(`@elseif(${ce.expr})
2564
+ ${ce.element}`);else G.push(`@else
2565
+ ${ce.element}`);G.push("@endif");let ee=G.join(`
2566
+ `),ae=B[0].outerStart,Q=B[B.length-1].outerEnd;_=_.slice(0,ae)+ee+_.slice(Q),k=ae+ee.length}return _}function Vw(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Uw(v){let _=v,k=0;while(k<_.length){let R=Yr(_,k);if(!R)break;let T=Lw.has(R.tag),B=R.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(F,H,q)=>{let K=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(H);if(!K||!q||!/^["']/.test(q))return F;let G=K[1]||"modelValue",ee=K[2];if(T&&!K[1])return`@model${ee}=${q}`;let ae=q[0],Q=q.slice(1,-1),ce=`:${G}=${q} @update:${G}=${ae}${Q} = $event${ae}`;if(ee){let ue=K[1]?`${G}Modifiers`:"modelModifiers",le=ee.slice(1).split(".").map((pe)=>`${pe}: true`).join(", ");ce+=` :${ue}="{ ${le} }"`}return ce});if(B===R.attrs){k=R.end;continue}let z=oi(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 Hw(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function qw(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Kw(v){let _=v,k=0;while(k<_.length){let R=Yr(_,k);if(!R)break;let T=Po(R.attrs,"v-html");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Jr(_,R),z=zr(R.attrs,"v-html"),F=R.selfClosing?" /":"",H=`<${R.tag}${z}${F}>{!! ${T} !!}</${R.tag}>`;_=_.slice(0,B.outerStart)+H+_.slice(B.outerEnd),k=B.outerStart+H.length}return _}function Xw(v){let _=v,k=0;while(k<_.length){let R=Yr(_,k);if(!R)break;let T=Po(R.attrs,"v-text");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let B=Jr(_,R),z=zr(R.attrs,"v-text"),F=R.selfClosing?" /":"",H=`<${R.tag}${z}${F}>{{ ${T} }}</${R.tag}>`;_=_.slice(0,B.outerStart)+H+_.slice(B.outerEnd),k=B.outerStart+H.length}return _}function Zw(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 Gw(v){let _=v,k=0;while(k<_.length){let R=Yr(_,k);if(!R)break;if(!bm(R.attrs,"v-once")){k=R.end;continue}let T=zr(R.attrs,"v-once"),B=Jr(_,R),z=_.slice(B.outerStart,B.outerEnd),H=`@once
2567
+ ${oi(z,{...R,start:0,end:R.end-R.start},T)}
2568
+ @endonce`;_=_.slice(0,B.outerStart)+H+_.slice(B.outerEnd),k=B.outerStart+H.length}return _}function Jw(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Yw(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 vm(v){if(!zw(v))return v;let _=v;return _=Ww(_),_=Fw(_),_=Gw(_),_=Hw(_),_=qw(_),_=Uw(_),_=Vw(_),_=Yw(_),_=Kw(_),_=Xw(_),_=Zw(_),_=Jw(_),_}function Wa(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var zu=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"]),Qw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function wm(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 zu.has(B)?B:null}function Sm(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function $m(v,_,k){let R=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=R?`<${v} ${R}>`:`<${v}>`;if(Qw.has(v))return R?`<${v} ${R}>`:`<${v}>`;return`${T}${k}</${v}>`}async function _m(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,F=[],H;while((H=z.exec(B))!==null)F.push({full:H[0],expr:H[1],attrs:H[2],slotContent:H[3],index:H.index});for(let q=F.length-1;q>=0;q--){let K=F[q];try{let G=wm(K.expr,_);if(!G||typeof G!=="string"){let pe=`<!-- dynamic component: could not resolve "${Wa(Sm(K.expr))}" -->`;B=B.slice(0,K.index)+pe+B.slice(K.index+K.full.length);continue}if(zu.has(G)){let pe=$m(G,K.attrs,K.slotContent);B=B.slice(0,K.index)+pe+B.slice(K.index+K.full.length);continue}let ee=K.attrs.trim(),ae={},Q=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,ce;while((ce=Q.exec(ee))!==null){let pe=ce[1]||ce[2],de=ce[3];if(ce[1])try{ae[pe]=l(de,_)}catch{ae[pe]=de}else ae[pe]=de}let ue=R.componentsDir||"components",le=await rt(G,ae,K.slotContent,ue,_,k,R,new Set,T??new Set);B=B.slice(0,K.index)+le+B.slice(K.index+K.full.length)}catch(G){let ee=G instanceof Error?G.message:String(G),ae=`<!-- dynamic component error: ${Wa(ee)} -->`;B=B.slice(0,K.index)+ae+B.slice(K.index+K.full.length)}}return B=await eS(B,_,k,R,T),B}async function eS(v,_,k,R,T){let B=v,z=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,F=[],H;while((H=z.exec(B))!==null)F.push({full:H[0],expr:H[1],attrs:H[2],index:H.index});for(let q=F.length-1;q>=0;q--){let K=F[q];try{let G=wm(K.expr,_);if(!G||typeof G!=="string"){let Q=`<!-- dynamic component: could not resolve "${Wa(Sm(K.expr))}" -->`;B=B.slice(0,K.index)+Q+B.slice(K.index+K.full.length);continue}if(zu.has(G)){let Q=$m(G,K.attrs,"");B=B.slice(0,K.index)+Q+B.slice(K.index+K.full.length);continue}let ee=R.componentsDir||"components",ae=await rt(G,{},"",ee,_,k,R,new Set,T??new Set);B=B.slice(0,K.index)+ae+B.slice(K.index+K.full.length)}catch(G){let ee=G instanceof Error?G.message:String(G),ae=`<!-- dynamic component error: ${Wa(ee)} -->`;B=B.slice(0,K.index)+ae+B.slice(K.index+K.full.length)}}return B}var Pi="X-STX-Build",Wu=Symbol.for("stx.buildId");function Ns(){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 km(v,_=Ns()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
2569
+ <meta name="stx-build" content="${_}">`}function tS(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(K){if(z.updateReady)try{K()}catch{}else B.push(K);return()=>{let G=B.indexOf(K);if(G!==-1)B.splice(G,1)}},applyUpdate(){let K=R&&R.waiting;if(!K)return!1;return T=!0,K.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=z;let F=(K)=>{if(!K.waiting||!_.controller||z.updateReady)return;z.updateReady=!0;let G=B.splice(0);for(let ee of G)try{ee()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(K)=>{let G=K.data||{};if(G.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:G.url,kind:G.kind,fragment:!!G.fragment}}))}catch{}if(G.type==="stx:reachability"){if(k.stxOffline.reachable=G.reachable!==!1,Number(G.at)>0)k.stxOffline.reachedAt=Number(G.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:G.reachable!==!1,at:Number(G.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 H=()=>{_.register(v,{scope:"/"}).then((K)=>{R=K;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(K.waiting)F(K),K.waiting.postMessage({type:"stx:activate-update",reason:"load"});K.addEventListener("updatefound",()=>{let G=K.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")F(K)})})}).catch(()=>{})},q=()=>{let K=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>K(H));else K(H)};if(!_.controller)if(document.readyState==="complete")q();else addEventListener("load",q);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",q);else q()}function nS(){let v=`(${tS.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var Em=`<script data-stx-offline>${nS()}</script>`;import{AsyncLocalStorage as rS}from"async_hooks";var Cm=new rS;function _n(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Rm(v,_){return Cm.run(_n(v),_)}async function Am(v,_){let k=Cm.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,(H,q)=>{if(q===void 0||typeof q==="function"||typeof q==="symbol"||typeof q==="bigint"||typeof q==="number"&&!Number.isFinite(q))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(q&&typeof q==="object"&&!Array.isArray(q)&&Object.getPrototypeOf(q)!==Object.prototype&&Object.getPrototypeOf(q)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return q}),F=JSON.parse(z);return k.values.set(v,F),F}).catch((B)=>{throw k.pending.delete(v),B});return k.pending.set(v,T),T}function ur(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 sS=/<\/(script)/gi;function Mi(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(sS,"<\\/$1")}import Tm from"path";function L(v,_={}){return new zn(v,_).routes}var Im=new Map;async function Pm(v,_){let k=v,R=_;if(!k||!R)try{let F=await o();k||=F?.pagesDir||"pages",R||=F?.root||"."}catch{k||="pages",R||="."}let T=Tm.isAbsolute(k)?k:Tm.join(R,k),B=Im.get(T);if(B)return B;let z=[];try{z=L(".",{pagesDir:T,emit:!1}).map((F)=>F.regex.source).filter(Boolean)}catch{z=[]}return Im.set(T,z),z}function oS(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Dm(v){return oS(JSON.stringify(v))}function me(v){return v.includes("data-stx-runtime")}function Om(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 Fu(v,_){let k=uo(v),R=v.search(/<!doctype\b/i);if(k!==-1&&(R===-1||k>R))return v.slice(0,k)+_+`
2570
+ `+v.slice(k);let T=Rn(v);if(T!==null)return`${v.slice(0,T)}
2571
+ ${_}${v.slice(T)}`;if(v.includes("</head>")){let z=v.indexOf("</head>");return v.slice(0,z)+_+`
2572
+ `+v.slice(z)}if(Zn(v))return fs(v,(z)=>`${z}
2573
+ ${_}`);return`${_}
2574
+ ${v}`}async function Fa(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-4j3fmxeg.js"),{url:B}=await T("runtime",_.debug===!0);return Fu(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return Fu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-4j3fmxeg.js"),R=await k(_.debug);return Fu(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function aS(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Mm(v){if(v.includes("data-stx-tooltip-runtime")||!aS(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${$u()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2575
+ ${_}`;return`${v.slice(0,k)}${_}
2576
+ ${v.slice(k)}`}var cS=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function lS(v){return cS.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function Z(v,_){if(!v.includes("</body>"))return v;if(lS(v))return v;let k=_?.router,R="";{let H={};if(k){if(k.container)H.container=k.container;if(k.interceptAllLinks!==void 0)H.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)H.progress=k.progress;if(k.viewTransitions!==void 0)H.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)H.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)H.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)H.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)H.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)H.prefetch=k.prefetch;if(k.cache!==void 0)H.cache=k.cache;if(k.progressColor!==void 0)H.progressColor=k.progressColor;if(k.progressHeight!==void 0)H.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)H.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)H.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)H.keepOpening=k.keepOpening}try{let q=await Pm(_?.pagesDir,_?.root);if(q.length>0)H.ownedRoutes=q}catch{}if(Object.keys(H).length>0)R=`<script>window.__stxRouterConfig=${Dm(H)};</script>
2577
+ `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-4j3fmxeg.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>`,F=v.lastIndexOf("</body>");return v.slice(0,F)+R+z+`
2578
+ </body>`+v.slice(F+7)}var Nm=Symbol.for("stx.lazy-module-promises");function uS(){let v=globalThis;return v[Nm]??=new Map,v[Nm]}function Et(v,_){let k=uS(),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 Vu=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Vm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,dS=65536,fS=4,Ua=new Map;function fu(){Ua.clear()}function pS(v){let _=[];for(let k of te(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 Dc(v,_={}){let k=v.length>=dS,R=k?Ua.get(v):void 0;if(R===void 0){if(R=pS(v),k)Dd(Ua,fS),Ua.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 Es(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:F}=jm(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:F}}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:F}=jm(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:F}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function jm(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 Ts(v,_){return Qi(v,_)}function gS(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 Um(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 mS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Vu})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=te(v,(B,z)=>{_.lastIndex=z;let F=_.exec(B);if(!F||F.index!==z||!k.test(F[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let F=z[2].match(k),H=Es(F?.[1]??F?.[2]??""),q=[H.itemVar,H.indexVar].filter(Boolean);if(q.length===0)continue;let K=z[1],ee=/\/\s*>$/.test(B.token)||Ha.has(K.toLowerCase())?B.end:Hu(v,B.start,K,B.end);if(ee!==-1)T.push({start:B.start,end:ee,vars:new Set(q)})}return T}var Lm=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 hS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Bm(v,_,k,R){if(!v)return!1;let T=hS(v),B=!1,z=!1,F=!1,H=/([a-zA-Z_$][\w$]*)/g,q;while((q=H.exec(T))!==null){let ae=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if(Lm.has(ae))continue;if(_.has(ae)||R?.has(ae))B=!0;else if(k&&ae in k)z=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=K.exec(T))!==null){let ae=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(Lm.has(ae)||k&&ae in k)continue;F=!0}return(B||F)&&!z}function Va(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),B=T.match(Vm);if(B&&yS(B[3],B[1])){let[,z,F,H]=B;return`<${z}${F}${R}>${H}</${z}>`}return`<template${R}>${T}</template>`}function yS(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 ki(v,_){let k=Um(v);function R(T){let B=T,z=mS(T),F=(G)=>{let ee=new Set;for(let ae of z)if(G>ae.start&&G<ae.end)for(let Q of ae.vars)ee.add(Q);return ee},H=/@if\s*\(/g,q,K=[];while((q=H.exec(B))!==null){let G=q.index,ee=G+q[0].length,ae=1,Q=ee;while(Q<B.length&&ae>0){if(B[Q]==="(")ae++;else if(B[Q]===")")ae--;Q++}if(ae!==0)continue;let ce=B.substring(ee,Q-1).trim(),ue=Q,le=1,pe=ue,de=/@(if\s*\(|endif)/g;de.lastIndex=ue;let Re;while((Re=de.exec(B))!==null)if(Re[1].startsWith("if"))le++;else if(Re[1]==="endif"){if(le--,le===0){pe=Re.index+Re[0].length;break}}if(le!==0)continue;let be=B.substring(ue,pe-6).trim(),xe;if(gS(be)){let Ie=ho(B.substring(G,pe));if(Ie.length===0)continue;let Me=Ie[0].branches.filter((De)=>De.type!=="else"),Ne=F(G);if(!(Me.length>0&&Me.every((De)=>Bm(De.condition,k,_,Ne))))continue;xe=Ie[0].branches.map((De)=>{let Fe=R(De.content);if(De.type==="elseif")return Va(Fe,"@else-if",De.condition??"");if(De.type==="else")return Va(Fe,"@else");return Va(Fe,"@if",De.condition??"")}).join(`
2579
+ `)}else{if(!Bm(ce,k,_,F(G)))continue;xe=Va(R(be),"@if",ce)}K.push({start:G,end:pe,replacement:xe}),H.lastIndex=pe}for(let G=K.length-1;G>=0;G--){let{start:ee,end:ae,replacement:Q}=K[G];B=B.substring(0,ee)+Q+B.substring(ae)}return B}return R(v)}function xS(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 Ha=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zm=/<(script|style)\b/iy,bS=/<\/script/gi,vS=/<\/style/gi;function Hu(v,_,k,R){if(Ha.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,F=R;while(F<B){let H=v.indexOf("<",F);if(H===-1)return-1;if(F=H,v.startsWith("<!--",F)){let ee=v.indexOf("-->",F+4);if(ee===-1)return-1;F=ee+3;continue}zm.lastIndex=F;let q=zm.exec(v);if(q){let ee=v.indexOf(">",F);if(ee===-1)return-1;if(v[ee-1]==="/"){F=ee+1;continue}let ae=q[1].toLowerCase()==="script"?bS:vS;ae.lastIndex=F;let Q=ae.exec(v);if(Q===null)return-1;let ce=v.indexOf(">",Q.index);if(ce===-1)return-1;F=ce+1;continue}if(v[F+1]==="/"){let ee=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(F,F+64));if(!ee){F++;continue}if(ee[1].toLowerCase()===T){if(z--,F+=ee[0].length,z===0)return F;continue}F+=ee[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec(v.slice(F,F+64));if(!K){F++;continue}let G=v.indexOf(">",F);if(G===-1)return-1;if(K[1].toLowerCase()===T){let ee=v.slice(F,G+1);if(!(/\/\s*>$/.test(ee)||Ha.has(T)))z++}F=G+1}return-1}var wS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function SS(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 wS.test(B)}function Ci(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=(G)=>_.some(([ee,ae])=>G>=ee&&G<ae),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=[],F;while((F=B.exec(v))!==null){if(T(F.index))continue;let[G,ee,ae,Q,ce,ue,le]=F,pe=xS(ce);if(pe===void 0)continue;let de=F.index,Re=de+G.length,Ie=!!le||/\/\s*>$/.test(G)||Ha.has(ee.toLowerCase())?Re:Hu(v,de,ee,Re);if(Ie===-1)continue;if((Q===":if"||Q==="x-if"||Q==="@if")&&SS(v,Ie)){B.lastIndex=Re;continue}if(pe===!0){let Ne=`<${ee}${ae}${ue}${le}>`;z.push({start:de,end:Re,replacement:Ne});continue}z.push({start:de,end:Ie,replacement:""}),B.lastIndex=Ie}if(z.length===0)return v;z.sort((G,ee)=>G.start-ee.start);let H=[],q=-1;for(let G of z){if(G.start<q)continue;H.push(G),q=G.end}let K=v;for(let G=H.length-1;G>=0;G--){let{start:ee,end:ae,replacement:Q}=H[G];K=K.substring(0,ee)+Q+K.substring(ae)}return K}var Wm=[":for","@for","x-for"];function $s(v,_){if(!_||Object.keys(_).length===0)return v;if(!Wm.some((F)=>v.includes(`${F}=`)))return v;let k=Um(v);if(Array.isArray(_.__stx_client_signal_names)){for(let F of _.__stx_client_signal_names)if(typeof F==="string")k.add(F)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[F,H,q]=z,K=z.index,G=K+F.length,ee=Wm.map((xe)=>({attr:xe,m:new RegExp(`\\s${xe}="([^"]*)"`).exec(q)})).find((xe)=>xe.m!==null);if(!ee||!ee.m)continue;let ae=Es(ee.m[1]);if(!ae.iterable||!ae.itemVar)continue;let Q=ae.iterable.trim().split(/[.[(]/)[0].trim();if(!Q||k.has(Q)||!(Q in _))continue;let ce=Hu(R,K,H,G);if(ce===-1)continue;let ue=q.replace(new RegExp(`\\s${ee.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),le=R.slice(G,ce-`</${H}>`.length),pe={..._,[ae.itemVar]:void 0};if(ae.indexVar)pe[ae.indexVar]=void 0;let de=$s(le,pe),Re=ae.indexVar?`${ae.iterable} as ${ae.indexVar} => ${ae.itemVar}`:`${ae.iterable} as ${ae.itemVar}`,be=H.toLowerCase()==="template"?de:`<${H}${ue}>${de}</${H}>`;T.push({start:K,end:ce,replacement:`@foreach(${Re})${be}@endforeach`}),B.lastIndex=ce}for(let F=T.length-1;F>=0;F--){let{start:H,end:q,replacement:K}=T[F];R=R.slice(0,H)+K+R.slice(q)}return R}function Rs(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let F=T[1],H=T.index,q=H+T[0].length,K=1,G=q;while(G<k.length&&K>0){if(k[G]==="(")K++;else if(k[G]===")")K--;G++}if(K!==0)continue;let ee=k.substring(q,G-1).trim(),ae=G,Q=Es(ee),ce=F==="for"?"@endfor":"@endforeach",ue=1,le=ae,pe=F==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${F}\\s*\\(|end${F})`,"g");pe.lastIndex=ae;let de;while((de=pe.exec(k))!==null)if(de[1].startsWith(F))ue++;else if(ue--,ue===0){le=de.index+de[0].length;break}if(ue!==0)continue;let Re=()=>{let je=[Q.itemVar,Q.indexVar].filter(Boolean);if(je.length)z.push({start:H,end:le,vars:je})};if(Q.iterable){let je=Q.iterable.trim();if(je.startsWith("[")||je.startsWith("{")||je.startsWith("'")||je.startsWith('"')||je.startsWith("`")||/^-?\d/.test(je)){Re();continue}let Be=je.split(/[.[(]/)[0].trim(),De=_?Be in _:!1,Fe=z.some((Ue)=>H>Ue.start&&H<Ue.end&&Ue.vars.includes(Be));if(Be&&(De||Fe)){Re();continue}}if(Q.style==="as")ee=Q.indexVar?`(${Q.itemVar}, ${Q.indexVar}) in ${Q.iterable}`:`${Q.itemVar} in ${Q.iterable}`;let be=k.substring(ae,le-ce.length).trim(),xe=_?{..._}:{};if(Q.itemVar)delete xe[Q.itemVar];if(Q.indexVar)delete xe[Q.indexVar];let Ie=Rs(be,xe),Me=Ie.match(Vm),Ne;if(Me){let[,je,Be,De]=Me;Ne=`<${je}${Be} @for="${ee}">${De}</${je}>`}else Ne=`<template @for="${ee}">${Ie}</template>`;B.push({start:H,end:le,replacement:Ne}),R.lastIndex=le}for(let F=B.length-1;F>=0;F--){let{start:H,end:q,replacement:K}=B[F];k=k.substring(0,H)+K+k.substring(q)}return k}function $S(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(K)=>{let G=R+1;while(G<B){let ee=v[G];if(ee==="\\"){G+=2;continue}if(ee===K)return G+1;G++}return B},F=()=>{let K=R+2;while(K<B&&v[K]!==`
2580
+ `)K++;return K},H=()=>{let K=R+2;while(K<B-1){if(v[K]==="*"&&v[K+1]==="/")return K+2;K++}return B},q=(K)=>{let G=K,ee=0;while(G<B){let ae=v[G];if(ae==="/"&&v[G+1]==="/"){let Q=G+2;while(Q<B&&v[Q]!==`
2581
+ `)Q++;G=Q;continue}if(ae==="/"&&v[G+1]==="*"){let Q=G+2;while(Q<B-1&&!(v[Q]==="*"&&v[Q+1]==="/"))Q++;G=Q+2;continue}if(ae==='"'||ae==="'"||ae==="`"){let Q=G+1;while(Q<B){if(v[Q]==="\\"){Q+=2;continue}if(v[Q]===ae){Q++;break}Q++}G=Q;continue}if(ae==="("||ae==="["||ae==="{"){ee++,G++;continue}if(ae===")"||ae==="]"||ae==="}"){ee--,G++;continue}if(ae===";"&&ee===0)return G+1;G++}return B};while(R<B){let K=v[R];if(K==="/"&&v[R+1]==="/"){let G=F();k.push(v.slice(R,G)),R=G;continue}if(K==="/"&&v[R+1]==="*"){let G=H();k.push(v.slice(R,G)),R=G;continue}if(K==='"'||K==="'"||K==="`"){let G=z(K);k.push(v.slice(R,G)),R=G;continue}if(K==="{"){T++,k.push(K),R++;continue}if(K==="}"){T--,k.push(K),R++;continue}if(T===0){let G=R>0?v[R-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ae=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ae){let Q=ae[2],ce=q(R+ae[0].length);if(_.has(Q)){k.push(`/* stx: deduped const ${Q} */`),R=ce;continue}_.add(Q),k.push(v.slice(R,ce)),R=ce;continue}}}k.push(K),R++}return k.join("")}var _S=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Uu(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function kS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!Uu(T,T+_.length,k))return!0;R=T+_.length}return!1}function ES(v,_){if(kS(v,"<body",_)){let T=new RegExp(`<body(${Vu})>`,"g"),B;while((B=T.exec(v))!==null)if(!Uu(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(${Vu})>`,"gi"),R;while((R=k.exec(v))!==null){if(Uu(R.index,R.index+R[0].length,_))continue;if(_S.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function CS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,F=!1,H=(q)=>{if(k!==null&&!F&&k>=z&&k<=q)T.push(v.slice(z,k),B,v.slice(k,q)),F=!0;else T.push(v.slice(z,q))};for(let q of _){if(q.start<z)continue;H(q.start),z=q.end}return H(v.length),T.join("")}async function dr(v,_,k,R={}){let T=Dc(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:F,bundleClientScript:H}=await Et("stx/client-script-bundler",()=>import("./chunk-g24kapd5.js"));for(let de of T){let Re=de.body;if(tt(de.attrs))Re=nt(Re);if(R.forceClientSetup||B.test(Re)){z.push({content:Re,start:de.start,end:de.end});continue}if(!F(Re))continue;try{let be=await H(Ot(Re).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(be))z.push({content:Re,start:de.start,end:de.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let q=`${_??""}\x00${z.map((de)=>de.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,G=[];for(let de=0;de<z.length;de++){let Re=z[de].bundled??Ot(z[de].content).code;if(!z[de].bundled&&F(Re))Re=await H(Re,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});Re=et(Re);let be=I(Re);G.push(`// \u2500\u2500 merged signal script #${de+1} \u2500\u2500
2582
+ ${be}`)}let ee=G.join(`
2583
+
2584
+ `);ee=$S(ee);let ae=Nc(ee),Q=ae.split(",").map((de)=>de.trim()).filter(Boolean),ce=bn(ee,k),ue=`
2585
+ <script data-stx-scoped>
2586
+ function ${K}() {
2587
+ ${Wt("const",Q)}
2588
+ ${Mi(`${ce}${ee}`)}
2589
+ return { ${ae} };
2590
+ }
2591
+ window.__stx_latestSetup=${K};
2592
+ if(window.stx)window.stx._latestSetup=${K};
2593
+ </script>`,le=ES(v,z);return{output:CS(v,z,le,K),setupCode:ue}}function Nc(v){let _=s(v),k=[],R=new Set,T=0,B=0,z=_.length,F=()=>{if(T!==0)return;let H=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(H){let ae=H[2];if(!R.has(ae))k.push(ae),R.add(ae);return}let q=_.slice(B).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(q){q[1].split(",").forEach((ae)=>{let Q=ae.trim();if(!Q)return;let ce=Q.indexOf(":"),le=(ce>=0?Q.slice(ce+1).trim():Q).split(/[\s=]/)[0];if(le&&!R.has(le))k.push(le),R.add(le)});return}let K=_.slice(B).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(K){K[1].split(",").forEach((ae)=>{let Q=ae.trim().replace(/^\.\.\./,"");if(!Q)return;let ce=Q.split(/[\s=]/)[0];if(ce&&!R.has(ce))k.push(ce),R.add(ce)});return}let G=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(G){let ae=G[1];if(!R.has(ae))k.push(ae),R.add(ae);return}let ee=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ee){let ae=ee[1];if(!R.has(ae))k.push(ae),R.add(ae)}};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])))F();B++}return k.join(", ")}async function _i(v,_,k,R){if(!Ts(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:B,setupCode:z}=await dr(T,k,R);if(T=B,!z){let F=Zn(T);if(F&&!/data-stx/.test(F.attrs)&&!/data-stx-auto/.test(F.attrs)){let H=F.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,F.index)+H+T.slice(F.index+F.tag.length)}}if(T=await Fa(T,_),z){let F=Ei(T,/<\/head>/i),H=F===-1?Ei(T,/<body[^>]*>/i):-1;if(F!==-1)T=`${T.slice(0,F)}${z}
2594
+ ${T.slice(F)}`;else if(H!==-1){let q=/<body[^>]*>/i.exec(T.slice(H))[0],K=H+q.length;T=`${T.slice(0,K)}
2595
+ ${z}${T.slice(K)}`}else T=`${T}
2596
+ ${z}`}return T}function Ei(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 F=B.exec(v.slice(z));if(!F)return-1;let H=z+F.index;if(!R.some(([K,G])=>H>=K&&H<G))return H;z=H+Math.max(F[0].length,1)}return-1}var Fm="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Mc(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 Fm;return`var ${_.join(", ")}; ${Fm}`}var RS=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function et(v){return v.replace(RS,(_,k)=>Mc(k))}import Bi from"path";import AS from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[R,T]of Object.entries(AS.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 Hm(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function qm(v,_,k){try{let R;if(v.startsWith("/")){let T=_;for(let B=0;B<5;B++){let z=Bi.join(T,v);if(await Bun.file(z).exists())return z;T=Bi.dirname(T)}R=Bi.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))R=Bi.resolve(_,v);else R=Bi.resolve(_,v);if(await Bun.file(R).exists())return R;return null}catch{return null}}var Km=Symbol.for("stx.inline-assets.import-meta");function TS(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.
2597
+ `+" `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[Km]=!0,k}async function Xm(v,_,k){let R=v,T=Bi.dirname(_),B=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,z;while((z=B.exec(R))!==null){let[q,K,G,ee]=z;if(Hm(G))continue;let ae=await qm(G,T,_);if(ae)try{let Q=await Bun.file(ae).text();if(k.add(ae),G.endsWith(".ts")||G.endsWith(".tsx")){let ue=await Bun.build({entrypoints:[ae],target:"browser",minify:!0,define:w()});if(ue.outputs.length>0)Q=await ue.outputs[0].text(),TS(Q,G)}let ce=`<script>
2598
+ // Source: ${G}
2599
+ ${Q}
2600
+ </script>`;R=R.replace(q,ce),B.lastIndex=0}catch(Q){if(Q?.[Km])throw Q}}let F=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,H;while((H=F.exec(R))!==null){let[q,K,G,ee]=H,ae=K+ee;if(Hm(G))continue;if(/rel=["']stylesheet["']/.test(ae)||G.endsWith(".css")){let ce=await qm(G,T,_);if(ce)try{let ue=await Bun.file(ce).text();k.add(ce);let le=`<style>
2601
+ /* Source: ${G} */
2602
+ ${ue}
2603
+ </style>`;R=R.replace(q,le),F.lastIndex=0}catch(ue){}}}return R}function Ms(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,F=1,H=z+1,q=null,K=!1;while(H<k.length&&F>0){let de=k[H];if(K){K=!1,H++;continue}if(de==="\\"&&q){K=!0,H++;continue}if(q){if(de===q)q=null;H++;continue}if(de==='"'||de==="'"||de==="`"){q=de,H++;continue}if(de==="(")F++;else if(de===")"){if(F--,F===0)break}H++}if(F!==0)break;let G=k.substring(z+1,H).trim(),ee=k.substring(B,H+1),ae=-1,Q=0,ce=null,ue=!1;for(let de=0;de<G.length;de++){let Re=G[de];if(ue){ue=!1;continue}if(Re==="\\"&&ce){ue=!0;continue}if(ce){if(Re===ce)ce=null;continue}if(Re==='"'||Re==="'"||Re==="`"){ce=Re;continue}if(Re==="("||Re==="["||Re==="{")Q++;else if(Re===")"||Re==="]"||Re==="}")Q--;if(Re===","&&Q===0){ae=de;break}}let le=ae>=0?G.substring(0,ae).trim():G,pe=ae>=0?G.substring(ae+1).trim():void 0;try{let de=le.trim(),Re;if(p(de))Re=c(de,Object.keys(_))(...Object.values(_));else Re=void 0;let be;if(pe==="true")be=JSON.stringify(Re,null,2);else be=JSON.stringify(Re);let xe=be.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,B)+xe+k.substring(H+1),R.lastIndex=B+xe.length}catch(de){O.log(de instanceof Error?de:Error(String(de)),{directive:"@json"},"error"),R.lastIndex=B+ee.length}}return k}function Ls(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Ym(v){let _=v,k=/@memo\s*\(/g,R,T=[];while((R=k.exec(_))!==null){let B=R.index,z=B+R[0].length,F=1,H=z;while(H<_.length&&F>0){if(_[H]==="(")F++;else if(_[H]===")")F--;H++}if(F!==0)continue;let q=_.slice(z,H-1).trim(),K=H,G=_.slice(K),ee=G.indexOf("@endmemo");if(ee===-1)continue;let ae=G.slice(0,ee),Q=K+ee+8,ce=ae.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ue=ce?ce[0].length:0,le=ae.slice(ue),pe=ae.match(/(\s*)$/),de=pe?pe[0].length:0,Re=le.slice(0,le.length-de),be=Re.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),xe;if(be){let[Ie,Me,Ne="",je]=be,Be=`<${Me}${Ne} data-stx-memo="${q}"${je}>`;xe=ae.slice(0,ue)+Be+Re.slice(Ie.length)+ae.slice(ue+Re.length)}else xe=`${ae.slice(0,ue)}<div data-stx-memo="${q}">${Re}</div>${ae.slice(ue+Re.length)}`;T.push({start:B,end:Q,replacement:xe}),k.lastIndex=Q}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 qu(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 Qm(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,R=te(v,(H,q)=>{k.lastIndex=q;let K=k.exec(H);if(!K||/^(?:script|style)$/i.test(K[1]))return-1;return k.lastIndex}),T=[],B=0,z=0,F=[];for(let{start:H,end:q,token:K}of R){let G=/^<\/?([\w-]+)/.exec(K)[1].toLowerCase();if(K.startsWith("</")){let ae;while(ae=T.pop()){if(ae.scoped)B--;if(ae.name===G)break}continue}let ee=/\sdata-stx-scope\s*=/.test(K);if(!B&&!ee&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(K)&&!/\sdata-stx-ref-caller\s*=/.test(K))F.push(v.slice(z,H),K.replace(/\s*\/?>$/,(ae)=>` data-stx-ref-caller="${_}"${ae}`)),z=q;if(!eh.has(G)&&!/\/>$/.test(K)){if(T.push({name:G,scoped:ee}),ee)B++}}return F.push(v.slice(z)),F.join("")}var eh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),th=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Zm=/<\/?\s*([a-z][\w-]*)/iy,IS=/\s/;function PS(v,_){let k=_-1;while(k>=0&&IS.test(v[k]))k--;return k>=0&&v[k]==="/"}function DS(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 OS(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 F=v.indexOf("<",R),H=F===-1?v.length:F;if(H>R){if(k===0)while(R<H){let G=v.indexOf(B?"}":"{",R);if(G===-1||G>=H){if(B)z=!1;else T=!1;break}if(G>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=G+1}R=H;continue}if(v.startsWith("<!--",R)){let G=v.indexOf("-->",R);R=G===-1?v.length:G+3;continue}let q=DS(v,R);if(q===-1)break;Zm.lastIndex=R;let K=Zm.exec(v)?.[1]?.toLowerCase()??"";if(v[R+1]==="/"){if(k===0)break;k--}else if(!PS(v,q)&&!eh.has(K))k++;R=q+1}return!1}var Gm=m(256);function nh(v){if(v.length<1024)return Jm(v);let _=h(v),k=Gm.get(_);if(k!==void 0)return k;let R=Jm(v);return Gm.set(_,R),R}function Jm(v){if(v.length>=32768&&!Pd(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,F=z+B[0].length,H=!1,q=!1,K=-1;while(F<v.length){let ee=v[F];if(H){if(ee==="'")H=!1}else if(q){if(ee==='"')q=!1}else if(ee==="'")H=!0;else if(ee==='"')q=!0;else if(ee===">"){K=F;break}F++}if(K===-1)continue;let G=v.slice(z,K+1);if(th.test(G))continue;if(G.includes("x-cloak"))continue;if(OS(v,K+1))R+=v.slice(T,K)+" x-cloak>",T=K+1}return R+=v.slice(T),R}var MS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,NS=/<\/script>/gi,jS=/<\/style>/gi;function rh(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 Q=z==="script"?NS:jS;Q.lastIndex=B;let ce=Q.exec(v);if(ce!==null)_.lastIndex=ce.index+ce[0].length;continue}let F=B+T[0].length,H=!1,q=!1,K=-1;while(F<v.length){let Q=v[F];if(H){if(Q==="'")H=!1}else if(q){if(Q==='"')q=!1}else if(Q==="'")H=!0;else if(Q==='"')q=!0;else if(Q===">"){K=F;break}F++}if(K===-1)continue;let G=v.slice(B+T[0].length,K);if(th.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!MS.test(G))continue;let ee=v[K-1]==="/",ae=ee?K-1:K;k+=`${v.slice(R,ae)} x-cloak${ee?" ":""}`,R=ae}return k+=v.slice(R),k}import Ku from"path";var LS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,BS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function zS(v,_){if(!_||!v.includes("/"))return v;let k=Ku.dirname(_);return v.replace(LS,(R,T,B,z)=>{let F=Ku.resolve(k,z);return`${T}${B}${F.split(Ku.sep).join("/")}${B}`})}function sh(v,_){if(!_||!v.includes("<script"))return v;return v.replace(BS,(k,R,T,B)=>`${R}${zS(T,_)}${B}`)}var Qr="<!--PARENT_CONTENT_PLACEHOLDER-->";function ih(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fh(v,_){let k=v.length,R=_,T=!0,B=[],z=(F)=>F+9<=k&&v[F]==="<"&&v[F+1]==="/"&&(v[F+2]==="s"||v[F+2]==="S")&&(v[F+3]==="c"||v[F+3]==="C")&&(v[F+4]==="r"||v[F+4]==="R")&&(v[F+5]==="i"||v[F+5]==="I")&&(v[F+6]==="p"||v[F+6]==="P")&&(v[F+7]==="t"||v[F+7]==="T")&&(v[F+8]===">"||/\s/.test(v[F+8]));while(R<k){let F=v[R];if(z(R))return R;if(F==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
2604
+ `,R+2),R===-1)return-1;R+=1,T=!0;continue}if(F==="/"&&v[R+1]==="*"){let H=v.indexOf("*/",R+2);if(H===-1)return-1;R=H+2,T=!0;continue}if(F==="/"&&T){let H=R+1,q=!1;while(H<k){let K=v[H];if(K==="\\"){H+=2;continue}if(K==="[")q=!0;else if(K==="]")q=!1;else if(K==="/"&&!q){H++;break}else if(K===`
2605
+ `){H=-1;break}H++}if(H===-1){R++,T=!1;continue}while(H<k&&/[a-z]/.test(v[H]))H++;R=H,T=!1;continue}if(F==="'"||F==='"'){let H=F;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===H){R++;break}if(v[R]===`
2606
+ `)break;R++}T=!1;continue}if(F==="`"){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(F==="}"&&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(F));else if(/[)\].\w$]/.test(F))T=!1;else T=!0;R++}return-1}function ph(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 FS=4096;async function oh(v,_,k){if(k.buildMode!=="serve"||_.length<FS)return null;let{registerServeModuleBundle:R}=await import("./chunk-4j3fmxeg.js");return`<script ${v} src="${R(_)}"></script>`}async function ah(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await Et("stx/client-module-registry",()=>import("./chunk-e98jqwnf.js")),B=[],z=await T(R(...v),{minify:eo(_.buildMode),collectInputs:B});for(let F of B)k?.add(F);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:F}=await import("./chunk-4j3fmxeg.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${F(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function VS(v,_=""){let k=ph(v,"data-stx-runtime");if(!k)return v;let R=uo(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=uo(B);if(z===-1)return T+_+`
2608
+ `+B;return B.slice(0,z)+T+_+`
2609
+ `+B.slice(z)}function US(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=Ce(v,k);let B=!_.__stxProcessingDepth;_n(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await $n(_,k,R.runtimeConfig);if(B)bd(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Xs(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Ln())&&k&&k.endsWith(".stx"))io(v,k);try{return await X.timeAsync("template-processing",async()=>{let z=await HS(v,_,k,R,T);if(B)z=qu(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let F=ve(R.app?.head,{known:Dn,source:"app.head"}),q=(_.__stx_runtime_head||null)??Ys(),K=(_.__stx_head_raw||"").trim(),G,ee=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(ee)G=ee[1].trim(),K=K.replace(ee[0],"").trim();let ae=_.__sections?.title,Q=q.title||G||ae,ce=!q.title&&(!!G||!!ae),ue=q.meta||[],le=new Set(ue.map((Ie)=>Ae(Ie)).filter(Boolean)),pe={...F,...Q&&{title:Q},meta:[...(F.meta||[]).filter((Ie)=>!le.has(Ae(Ie))),...ue],link:[...F.link||[],...q.link||[]],script:[...F.script||[],...q.script||[]],headRaw:[F.headRaw,K].filter(Boolean).join(`
2610
+ `),...q.htmlAttrs&&{htmlAttrs:qi(F.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...F.bodyAttrs||{},...q.bodyAttrs}}},de=Js(z);if(z=In(z,pe,{...ce&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},de),de)z=Ki(z,F),z=Pn(z,pe.htmlAttrs);let Re=z.match(/<!-- stx-layout: ([^ ]+) -->/);if(Re&&z.includes("<head")){let Ie=Re[1],Me=Ar(Ie);z=z.replace(/<head\b[^>]*>/i,(Ne)=>`${Ne}
2611
+ <meta name="stx-layout" content="${ih(Ie)}">
2612
+ <meta name="stx-layout-group" content="${ih(Me)}">`)}let be=z.match(/function (__stx_setup_\w+)\(/),xe=be?Zn(z):null;if(be&&xe&&!/\bdata-stx=/.test(xe.tag)){z=fs(z,(Me,Ne)=>`<body${Ne} data-stx="${be[1]}">`);let Ie=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${be[1]}"`,"i");z=z.replace(Ie,"$1")}}if(B){let F=_.__stx_head_injections??Xs(),H=Gi(z);if(H!==null)F.beforeClose.push(H);let q=km(z);if(q!==null)F.afterOpen.push(q);if(R.offline?.enabled&&!z.includes("data-stx-offline"))F.beforeClose.push(Em);z=Ui(z,F);let K=R.app?.colorMode;if(K)z=An(z,K)}if(B)if(ph(z,"data-stx-runtime")){let H=null,q=null,K=null,G=null,ee=null;try{let{getStoreScript:Q}=await Et("stx/store-loader",()=>import("./chunk-1239cnda.js")),ce=R.storesDir,ue=await Q(ce);if(ue)K=`<script data-stx-stores>${ue}</script>`,q=await oh("data-stx-stores",ue,R)??K}catch{}H=await ah([z,K],R,T);try{let{getFrameworkComposableScript:Q}=await Et("stx/framework-composables",()=>import("./chunk-3v862v2c.js"));ee=await Q(z)}catch{}try{let{getComposableScript:Q}=await Et("stx/composable-loader",()=>import("./chunk-qa5c5x2n.js")),ce=R.composablesDir,ue=[H,K,ee].filter((pe)=>pe!==null),le=await Q(R._layerComposableDirs??ce,z,ue);if(le)G=await oh('data-stx-scoped data-stx-run="always" data-stx-composables',le,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${le}</script>`}catch{}let ae=[H,q,G,ee].filter((Q)=>Q!==null).map((Q)=>`
2613
+ ${Q}`).join("");z=VS(z,ae)}else{let H=await ah([z],R,T);if(H){let q=z.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(q!==-1)z=z.slice(0,q)+H+`
2614
+ `+z.slice(q)}}if(B)z=Wi(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=ao(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=US(z),B&&_.__stx_runtime_config)z=ot(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let F=ur(_);if(F){let H=/<head\b[^>]*>/i.exec(z),q=H?H.index+H[0].length:0;z=z.slice(0,q)+F+z.slice(q)}}return z})}catch(z){if(z instanceof W)throw z;let F=z instanceof Error?z.message:String(z),H=new U(`Template processing failed: ${F}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(O.log(H,{filePath:k,context:_}),Vt.logDetailedError(H,{filePath:k,template:v.substring(0,500)}),R.debug)throw H;return Zs.createFallbackContent("Template Processing",H)}}async function HS(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!dn.isAbsolute(R.partialsDir)?dn.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!dn.isAbsolute(R.componentsDir)?dn.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!dn.isAbsolute(R.layoutsDir)?dn.resolve(B,R.layoutsDir):R.layoutsDir},F=z,H=v;await XS(k,_),KS(_,F),H=await ie(()=>mm(H,_,k,F),H,(be)=>{O.log(be,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${be.message}`)}),H=H.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=Un(H,Ge,(be,xe)=>`\x00STX_HTML_COMMENT_${xe}\x00`);H=q.output;let K=q.tokens,G=(be)=>K.length===0?be:be.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(xe,Ie)=>K[Number(Ie)]??""),ee="\x00STX_ESCAPED_AT\x00",ae="\x00STX_ESC_MUSTACHE_OPEN\x00",Q="\x00STX_ESC_MUSTACHE_CLOSE\x00";H=H.replace(/@@/g,ee),H=H.replace(/@\{\{([\s\S]*?)\}\}/g,(be,xe)=>`${ae}${xe}${Q}`),H=vm(H),H=await Xm(H,k,T);let ce={};H=Os(H,ce);let ue={..._.__sections||{}},le="",pe=tp(Xe(v)),de=/@nolayout\b/.test(H)||pe===!1;if(/@nolayout\b/.test(H))H=H.replace(/@nolayout\b\s*/g,"");let Re=H.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Re)le=Re[1],H=H.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof pe==="string"){if(le=pe,!/@section\s*\(/.test(H))H=`@section('content')
2615
+ ${H.trim()}
2616
+ @endsection`}if(!le&&!de&&F.defaultLayout){let be=Ht(H),xe=/@section\s*\(/.test(H);if(!be||xe){let Ie="",Me=dn.dirname(k),Ne=F.layoutsDir?dn.dirname(F.layoutsDir):process.cwd();for(let je=0;je<20;je++){let Be=dn.join(Me,"_layout.stx");if(await r(Be)){Ie=Be;break}let De=dn.dirname(Me);if(De===Me||De.length<Ne.length)break;Me=De}if(Ie)le=Ie;else if(F.layoutsDir){let je=dn.isAbsolute(F.layoutsDir)?F.layoutsDir:dn.resolve(process.cwd(),F.layoutsDir),Be=dn.join(je,`${F.defaultLayout}.stx`);if(await r(Be))le=Be}if(le&&!xe)H=`@section('content')
2617
+ ${H.trim()}
2618
+ @endsection`}}if(le&&H.includes("<script")){let be=hn(H),xe=be.scripts.map((Ie)=>ch(Ie,k)??Ie);H=ls(be.output,xe)}if(H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(be,xe,Ie)=>(ue[xe]=Ie,"")),H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(be,xe,Ie)=>{if(/^(['"]).*\1$/.test(Ie.trim()))return be;try{let Me=l(Ie.trim(),_);if(Me===void 0)return be;return ue[xe]=String(Me??""),""}catch{return be}}),H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(be,xe,Ie)=>{if(Ie.includes("@parent"))ue[xe]=Ie.replace("@parent",Qr);else ue[xe]=Ie.trim();return""}),_.__sections=ue,H=H.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(be,xe,Ie)=>ue[xe]||Ie||""),!("slot"in _)||_.slot===void 0)H=H.replace(/\{\{\s*slot\s*\}\}/g,()=>ue.content||"");if(H=Ds(H,ce),le){let be=[],xe=hn(H),Ie=Un(xe.output,cs,(Me,Ne)=>`\x00STX_ORPHAN_STYLE_${Ne}\x00`);if(H=Ie.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Me,Ne,je)=>{let Be=Ne==="SCRIPT"?ch(xe.scripts[Number(je)],k):Ie.tokens[Number(je)];if(Be)be.push(Be);return""}),be.length>0){let Me=be.join(`
2619
+ `);ue.content=ue.content?`${ue.content}
2620
+ ${Me}`:Me,_.__sections=ue}}if(le)try{let be;if(dn.isAbsolute(le))be=le,T.add(le);else be=await ie(()=>fr(le,k,z,T),null,()=>{throw new U(`Failed to resolve layout path: ${le}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!be){let Be=(Ue)=>{if(!Ue)return[];try{let ze=dn.isAbsolute(Ue)?Ue:dn.resolve(process.cwd(),Ue);return WS.readdirSync(ze).filter((Le)=>Le.endsWith(".stx")).map((Le)=>Le.replace(/\.stx$/,""))}catch{return[]}},De=[...Be(z.layoutsDir),...Be(z.fallbackLayoutsDir)].filter((Ue,ze,Le)=>Le.indexOf(Ue)===ze).sort(),Fe=`Layout not found: ${le} (referenced from ${k})`+(De.length>0?`. Available layouts: ${De.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(O.log(Error(Fe),{layoutPath:le,filePath:k,available:De},"error"),console.error(`[stx] ${Fe}`),z.debug)throw new U(Fe,k);return H}let xe=await ie(()=>Bun.file(be).text(),"",()=>{throw new U(`Failed to read layout file: ${be}`,k,void 0,void 0,"Layout content could not be loaded")});xe=sh(xe,be);let Ie=xe.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Ie){if(z.debug)console.log(`Found nested layout: ${Ie[1]} in ${be}`);let Be={},De=xe.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ze,Le,it)=>(Be[Le]=it.trim(),""));for(let[ze,Le]of Object.entries(Be))if(ue[ze]&&ue[ze].includes(Qr)){let it=ue[ze].indexOf(Qr);ue[ze]=ue[ze].slice(0,it)+Le+ue[ze].slice(it+Qr.length)}else if(!ue[ze])ue[ze]=Le;let Fe={..._,__sections:ue},Ue=`@layout('${Ie[1]}')${De}`;return await n(Ue,Fe,be,z,T)}let Me=xe.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ne=Os(Me,ce),je={};return Ne=Ne.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Be,De,Fe)=>(je[De]=Fe.trim(),`@slot('${De}')`)),Ne=Ne.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Be,De,Fe)=>{if(ue[De]){let Ue=ue[De];if(Ue.includes(Qr)){let ze=je[De]||"",Le=Ue.indexOf(Qr);Ue=Ue.slice(0,Le)+ze+Ue.slice(Le+Qr.length)}return Ue}return Fe||""}),Ne=qS(Ne,ue),Ne=Ne.replace(/\{\{\s*slot\s*\}\}/g,()=>ue.content||""),Ne=Ds(Ne,ce),_.__originalFilePath=k,H=await dh(Ne,_,be,z,T),H=`<!-- stx-layout: ${le} -->
2621
+ ${H}`,G(H)}catch(be){if(be instanceof W)throw be;throw new U(`Error processing layout ${le}: ${be instanceof Error?be.message:String(be)}`,k)}return G(await dh(H,_,k,z,T))}function qS(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 KS(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 XS(v,_){await ie(()=>xm(v,_),void 0,(k)=>{O.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Xu="data-stx-source";function ch(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Xu))return v;return`<script ${Xu}="${encodeURIComponent(_)}"${v.slice(7)}`}function ZS(v){let _=new RegExp(`${Xu}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function lh(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function uh(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">${lh(v)}</span><span style="display:block;margin-top:4px">${lh(k)}</span></div>`}async function GS(v,_,k,R){let{scanScriptTags:T}=await Et("stx/signal-processing",()=>import("./chunk-76ebcf61.js")),B=[],z=!E()&&!Ln();for(let H of T(v)){let q=H.attrs;if(!/\bserver\b/.test(q))continue;let K=H.start+H.fullMatch.indexOf(">")+1,G=fh(v,K);if(G===-1)continue;let ee=v.slice(K,G);if(!ee.trim())continue;let ae=ZS(q)??k,Q={index:H.start,length:G+9-H.start};try{let{extractVariables:ce}=await Et("stx/variable-extractor",()=>import("./chunk-0gpjks6k.js"));await ce(ee,_,ae,{preserveExisting:!0,onFailure:(ue)=>{if(ue.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:ae,kind:ue.kind,message:ue.message}),!z)return;B.push({...Q,markup:uh(ae,ue.kind,ue.message)})}})}catch(ce){let ue=ce instanceof Error?ce:Error(String(ce));if(O.log(ue,{filePath:ae,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ae}: ${ue.message}`),z)B.push({...Q,markup:uh(ae,"unknown",ue.message)})}}if(B.length===0)return v;let F=v;for(let H of B.sort((q,K)=>K.index-q.index))F=F.slice(0,H.index)+H.markup+F.slice(H.index+H.length);return F}async function JS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await Et("stx/expressions",()=>import("./chunk-64vnwrkw.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return O.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function dh(v,_,k,R,T){let B=v,z=R;if(B=await GS(B,_,k,R),B=await JS(B,_,k),B=await rm(B,_,k),B=await sm(B,_,k),B=await zp(B,_,k,z),Ce(B))B=ki(B,_),B=Rs(B,_),B=$s(B,_);B=Ci(B);let{processStreamDirectives:F}=await Et("stx/streaming",()=>import("./chunk-k5vytrbx.js"));B=F(B,_),B=Ri(B,_,k,z,!0),B=await _m(B,_,k,z,T),B=await _s(B,_,k,z,T),B=ep(B,_,k,z);let{processDeferDirectives:H}=await Et("stx/defer",()=>import("./chunk-h3fr7c5y.js"));B=H(B,_,k);let{processTeleportDirectives:q}=await Et("stx/teleport",()=>import("./chunk-8t8wf1w2.js"));B=q(B,_,k);let{processTransitionDirectives:K,processTransitionAttributes:G}=await Et("stx/transitions",()=>import("./chunk-24tx4ysv.js"));B=K(B,_,k),B=G(B);let{processErrorBoundaryDirectives:ee,stripRenderFailedMarkers:ae}=await Et("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=ee(B,_,k),B=ae(B);let{processSuspenseDirectives:Q}=await Et("stx/suspense",()=>import("./chunk-zg0z8qt6.js"));B=Q(B,_,k);let{processAsyncDirectives:ce}=await Et("stx/async-components",()=>import("./chunk-k7vg01vv.js"));B=ce(B,_,k);let{processKeepAliveDirectives:ue}=await Et("stx/keep-alive",()=>import("./chunk-myqhdz1w.js"));B=ue(B,_,k);let{processVirtualListDirectives:le,processVirtualGridDirectives:pe,processInfiniteListDirectives:de}=await Et("stx/virtual-scrolling",()=>import("./chunk-ng819bkf.js"));B=le(B,_,k),B=pe(B,_,k),B=de(B,_,k);let{processPartialHydrationDirectives:Re,processStaticDirectives:be}=await Et("stx/partial-hydration",()=>import("./chunk-wkx2m2br.js"));B=Re(B,_,k),B=be(B);let{processComputedDirectives:xe,processWatchDirectives:Ie}=await Et("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=xe(B,_,k),B=Ie(B,_,k);let{processFormValidationDirectives:Me}=await Et("stx/forms-validation",()=>import("./chunk-7awf2gqs.js"));B=Me(B,_,k);let{processHeadDirective:Ne,processTitleDirective:je,processMetaDirective:Be,resetHead:De}=await Et("stx/head",()=>import("./chunk-k36ve5ct.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)De();let Fe=Ne(B);if(B=Fe.content,Fe.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Fe.headContent}
2622
+ `;if(B=je(B,_),B=Be(B,_,k),B=ym(B),B=Il(B,_),B=Bp(B),B=pm(B),B=await Is(B,_,k,z,T),B=await _s(B,_,k,z,T),_.__stxProcessingDepth===1)B=vd(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=qu(B),B=xr(B,_,k),B=Ps(B),B=np(B,_,{filePath:k,buildMode:z.buildMode}),B=Pl(B,_),B=Dl(B,_),B=ka(B,_),B=Kp(B,_),B=Xp(B,_),B=await Ap(B,_,k,z),B=await cp(B,_,k),B=await Di(B,_,k,z),B=Ni(B,_,k,z),B=Us(B,_,k,z),B=Ws(B,_,k),B=qs(B,_,k,z),B=jp(B,_,k,z),B=Ms(B,_),B=Ls(B),B=Ym(B),!z.skipEventDirectives)B=ud(B,_,k);if(B=ip(B,_,k),z.debug){let wt=/\bx-data\s*=/.test(B),gt=Ts(v);if(wt&&gt)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=Rg(B,_),B=await Y(B,_,k),B=nh(B),B=rh(B),B=Hf(B);let{processXElementDirectives:Ue}=await Et("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Ue(B);let ze=_.__originalFilePath||k,Le=Se(_);if(B=await _i(B,z,ze,Le),B=Up(B,_),B=await hm(B,_,k,z),z.media?.image?.autoSiblings){let wt=z.publicDir||"public",{rewriteImagesWithSiblings:gt}=await Et("stx/image-optimization/auto-sibling",()=>import("./chunk-fa0aa98d.js"));B=await gt(B,{publicDir:wt})}if(z.seo?.enabled)B=Gs(B,_,z);let it=(wt,gt,kt=!0)=>{if(!gt)return wt;let Ut=gt.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Yt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(wt),tn=Yt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Yt[0]):null;if(Ut&&Yt&&tn){if(kt){let fn=Yt.index+tn.index;wt=wt.slice(0,fn)+Ut[0]+wt.slice(fn+tn[0].length)}if(gt=gt.replace(Ut[0],"").trim(),!gt)return wt}if(/<\/head>/i.test(wt))return wt.replace(/<\/head>/i,`${gt}
2625
+ </head>`);if(/<head\b[^>]*>/i.test(wt))return wt.replace(/(<head\b[^>]*>)/i,`$1
2626
+ ${gt}`);if(/<html\b[^>]*>/i.test(wt))return wt.replace(/(<html\b[^>]*>)/i,`$1
2627
+ <head>
2628
+ ${gt}
2629
+ </head>`);return wt},{renderHead:xt,getHead:bt}=await Et("stx/head",()=>import("./chunk-k36ve5ct.js")),pt=_.__stx_runtime_head??bt();if(pt.title||pt.meta?.length||pt.link?.length){let wt=xt(pt);if(wt)B=it(B,wt)}if(Fe.headContent)B=it(B,Fe.headContent,!pt.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=Mp(B,z.csp,_);if(z.analytics?.enabled)B=qf(B,z);if(z.heatmap?.enabled)B=Xf(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:wt}=await Et("stx/pwa/inject",()=>import("./chunk-sj0bkdy8.js"));B=wt(B,z)}let $t=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),Ct=/\bSTX\.\w+/.test(B),vt=/window\.STX\s*=/.test(B);if($t&&Ct&&!vt){let gt=`<script data-stx-scoped data-stx-run="once">
2630
+ ${Ff()}
2631
+ </script>`;if(B.includes("</head>")){let kt=B.indexOf("</head>"),Yt=B.slice(0,kt).indexOf("<script");if(Yt!==-1){let tn=B.slice(0,Yt),fn=B.slice(Yt);B=tn+gt+`
2632
+ `+fn}else B=B.replace("</head>",`${gt}
2633
+ </head>`)}else if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1>
2634
+ ${gt}`);else B=gt+`
2635
+ `+B}{let{scanScriptTags:wt}=await Et("stx/signal-processing",()=>import("./chunk-76ebcf61.js")),gt=[];for(let kt of wt(B)){if(!/\bserver\b/i.test(kt.attrs))continue;let Ut=kt.start+kt.fullMatch.indexOf(">")+1,Yt=fh(B,Ut);if(Yt===-1)continue;let tn=Yt+9;while(tn<B.length&&/\s/.test(B[tn]))tn++;gt.push({start:kt.start,end:tn})}if(gt.length>0){let kt=Array(gt.length+1),Ut=0;for(let Yt=0;Yt<gt.length;Yt++){let{start:tn,end:fn}=gt[Yt];kt[Yt]=B.slice(Ut,tn),Ut=fn}kt[gt.length]=B.slice(Ut),B=kt.join("")}}let dt=la(B,k);if(dt.hasScoped)B=dt.html;let _t=_.__stx_event_bindings||[],yt=!1,Kt=[],Vn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:jn}=await Et("stx/signal-processing",()=>import("./chunk-76ebcf61.js"));for(let wt of jn(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:wt.fullMatch,attrs:wt.attrs,content:wt.body});for(let{match:wt,attrs:gt,content:kt}of Kt){yt=!0;let Ut=kt;Ze(kt,k,R.strict,_.__originalFilePath);let Yt=await ke(kt,{eventBindings:_t,attrs:gt,hasColonDirectives:Vn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:eo(R.buildMode),serverData:Le});B=B.replace(wt,()=>Yt)}if(yt)_.__stx_event_bindings=[];if(!yt&&_.__stxProcessingDepth===1){let wt=_.__stx_event_bindings||[];if(wt.length>0){let gt=rc(wt);if(gt){let kt=B.lastIndexOf("</body>");B=kt===-1?B+gt:B.slice(0,kt)+gt+`
2636
+ `+B.slice(kt)}_.__stx_event_bindings=[]}}if(!me(B)&&Om(B))B=await Fa(B,z);if(B=Mm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=Np(B,_.cspNonce);return B}var YS=[{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"}],QS=[{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')"}],e0=[{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 qc(v){let _=[],k=[];return t0(v,_),n0(v,_,k),r0(v,k),s0(v,_),{valid:_.length===0,errors:_,warnings:k}}function t0(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 n0(v,_,k){for(let R of YS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,F=(v.match(B)||[]).length;if(R.altClose){let H=new RegExp(R.altClose,"g");F+=(v.match(H)||[]).length}if(z>F)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${F} closing`,suggestion:`Add ${z-F} missing ${R.close} tag(s)`});else if(F>z)k.push({type:"directive",message:`Extra ${R.close} found: ${F-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function r0(v,_){for(let k of QS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function s0(v,_){for(let k of e0)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Gc(v,_){let k=v.slice(0,_).split(`
2637
+ `);return{line:k.length,column:k[k.length-1].length+1}}function Kc(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 Xc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Jc(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 Gn from"path";import Fi from"process";var Bt=["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 gh=new Set(Bt),i0=new Set(["props","$props","defineProps"]),o0=new Set(["stx","@stacksjs/stx"]),mh=m(128),hh=m(64);function a0(v){let _=[],k=0,R=v.split(`
2638
+ `);for(let T of R){let B=k,z=null,F=!1;for(let H=0;H<T.length;H++){let q=T[H];if(F){F=!1;continue}if(q==="\\"){F=!0;continue}if(z){if(q===z)z=null;continue}if(q==="'"||q==='"'||q==="`"){z=q;continue}if(q==="/"&&H+1<T.length&&T[H+1]==="/")break;if(q==="{")k++;else if(q==="}")k--}if(B===0){let H=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(H)_.push(H[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let q=T.match(/(?:const|let|var)\s+(\w+)/);if(q)_.push(q[1])}else{let q=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let G=q[1].slice(1,-1).split(",").map((ee)=>{let ae=ee.split(":");return(ae.length>1?ae[1]:ae[0]).trim()}).filter((ee)=>/^\w+$/.test(ee));_.push(...G)}}}}return[...new Set(_)]}function Lc(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,F=0,H=null;for(let q=0;q<R.length;q++){let K=R[q];if(H){if(B+=K,K===H)H=null;continue}if(K==='"'||K==="'"||K==="`"){H=K,B+=K;continue}if(K==="<")z++;else if(K===">"&&z>0)z--;else if(K==="(")F++;else if(K===")")F--;if(K===","&&z===0&&F===0){T.push(B),B="";continue}B+=K}if(B)T.push(B);return T.map((q)=>{let K=q.trim(),G=K.startsWith("..."),ee=G?K.slice(3):K,ae=-1,Q=0;for(let be=0;be<ee.length;be++)if(ee[be]==="<")Q++;else if(ee[be]===">")Q--;else if(ee[be]===":"&&Q===0){ae=be;break}if(ae===-1)return q;let ue=ee.substring(0,ae).trim().replace(/\?$/,""),le=ee.substring(ae+1),pe=-1,de=0;for(let be=0;be<le.length;be++)if(le[be]==="<")de++;else if(le[be]===">")de--;else if(le[be]==="="&&de===0){pe=be;break}let Re=G?"...":"";if(pe!==-1)return`${Re}${ue} = ${le.substring(pe+1).trim()}`;return`${Re}${ue}`}).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,F=1,H=z+1,q=0,K=null;while(H<_.length&&F>0){let ae=_[H];if(K){if(ae===K)K=null;H++;continue}if(ae==='"'||ae==="'"||ae==="`"){K=ae,H++;continue}if(ae==="<")q++;else if(ae===">"&&q>0)q--;else if(q===0){if(ae==="(")F++;else if(ae===")")F--}if(F>0)H++}if(F!==0)continue;let G=_.substring(z+1,H);if(!G.includes(":"))continue;let ee=k(G);B.push({start:z+1,end:H,replacement:ee})}for(let z=B.length-1;z>=0;z--){let{start:F,end:H,replacement:q}=B[z];_=_.substring(0,F)+q+_.substring(H)}}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[F,...H]=z.split("="),q=F.split(":")[0].trim();if(H.length>0)return`${q} = ${H.join("=").trim()}`;return q}).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 jc(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 Bc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function Fc(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 zc(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 yh=new Set;async function d(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=mh.get(B);if(z===void 0){try{let Ve=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=Ve.transformSync(He)}catch{z=Lc(v)}mh.set(B,z)}let F={exports:{}},H=F.exports,q=Fi.cwd(),K={},G=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Ve)=>Ve[1]).filter((Ve)=>!Ve.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Ve)),ee=new Map;for(let Ve of G)try{if(Ve.startsWith(".")){K[Ve]=await import(Gn.resolve(Gn.dirname(k),Ve));continue}let He=Gn.resolve(q,"node_modules",Ve),mt=Gn.join(He,"package.json"),At=JSON.parse(u("fs").readFileSync(mt,"utf8")),qt=At.main||"index.js";if(At.exports){let on=typeof At.exports==="string"?At.exports:At.exports["."];if(typeof on==="string")qt=on;else if(on?.bun)qt=on.bun;else if(on?.import)qt=on.import;else if(on?.default)qt=on.default}K[Ve]=await import(Gn.resolve(He,qt))}catch(He){if(Ve.startsWith("."))ee.set(Ve,He instanceof Error?He.message:String(He))}let ae=(Ve)=>{if(K[Ve])return K[Ve];let He=ee.get(Ve);if(He!==void 0)throw Error(`Cannot require '${Ve}' from ${k}: ${He}`);return u(Ve)},Q=_.props||{},ce=(Ve)=>{if(!Ve)return Q;let He={};for(let[mt,At]of Object.entries(Ve)){let qt=Q[mt];if(qt!==void 0)He[mt]=qt;else if(typeof At==="function")He[mt]=At();else He[mt]=At}return He};for(let[Ve,He]of Object.entries(Q))Object.defineProperty(ce,Ve,{value:He,enumerable:!0,configurable:!0,writable:!0});let ue=(Ve,He=!1)=>{if(Ve===void 0||Ve===null)return He;if(typeof Ve==="string"){let mt=Ve.trim().toLowerCase();if(mt===""||mt==="true"||mt==="1"||mt==="on"||mt==="yes")return!0;if(mt==="false"||mt==="0"||mt==="off"||mt==="no")return!1;return!0}return Boolean(Ve)},le=(Ve,He=0)=>{if(Ve===void 0||Ve===null)return He;if(typeof Ve==="string"){let At=Ve.trim();if(At==="")return He;let qt=Number(At);return Number.isFinite(qt)?qt:He}let mt=Number(Ve);return Number.isFinite(mt)?mt:He};for(let Ve of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(Q,Ve))continue;try{Object.defineProperty(ce,Ve,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let pe=(Ve)=>{if(!Ve)return Q;let He={...Q};for(let[mt,At]of Object.entries(Ve)){let qt=At&&typeof At==="object"&&!Array.isArray(At)?At:{type:At};if(He[mt]===void 0&&qt.default!==void 0)He[mt]=typeof qt.default==="function"?qt.default():qt.default}return He},de=()=>_.slots||{},Re=(Ve,He)=>{let mt={...Ve};for(let[At,qt]of Object.entries(He))if(mt[At]===void 0)if(typeof qt==="function")mt[At]=qt();else mt[At]=qt;return mt},be=(Ve)=>{let He=()=>Ve;return He.set=(mt)=>{},He.update=(mt)=>{},He},xe=(Ve)=>{let He,mt=!1;return()=>{if(!mt)try{He=Ve(),mt=!0}catch{He=void 0}return He}},Ie=(Ve)=>{},Me=(Ve)=>Ve(),Ne=(Ve)=>{},je=(Ve)=>{},Be=ar(_);function De(Ve){let He=Ve||{};if(He.title!==void 0||He.description!==void 0)it({title:He.title,description:He.description})}function Fe(Ve){if(!Ve||typeof Ve!=="object")return;let He=_.__stxClientPayload??{};Object.assign(He,Ve),_.__stxClientPayload=He}let Ue=()=>{let Ve=_.__stxServeContext,He=_.__stxServeSearch??Ve?.search??"",mt=Ve?.path??"",At=Object.fromEntries(new URLSearchParams(He)),qt=_.query,on=Object.keys(At).length>0?At:qt??{},ts=He||(Object.keys(on).length>0?`?${new URLSearchParams(on).toString()}`:"");return{params:_.params??{},query:on,path:mt,name:"",fullPath:mt+ts,hash:"",matched:[]}},ze=()=>({push:(Ve)=>{},replace:(Ve)=>{},back:()=>{},forward:()=>{},go:(Ve)=>{}}),Le=(Ve)=>{let He=_.__stx_runtime_head||{};_.__stx_runtime_head=we(He,ve(Ve||{},{known:Sr,source:"useHead()"}))},it=(Ve)=>{Le(kr(Ve||{}))},xt=(Ve)=>({value:Ve}),bt=(Ve)=>Ve,St=(Ve)=>({value:typeof Ve==="function"?Ve():Ve}),pt=(Ve,He)=>{},$t=(Ve)=>{},Ct=(Ve)=>{},vt=(Ve)=>Ve?Ve():Promise.resolve(),dt=(Ve)=>(He,...mt)=>{},_t=(Ve)=>{},yt=(Ve,He)=>{},Kt=(Ve,He)=>He,Vn=()=>({value:"light"}),jn=()=>be(!1),wt=(Ve)=>be(!1),gt=()=>be(!1),kt=()=>wt("(prefers-color-scheme: dark)"),Ut=()=>wt("(prefers-color-scheme: light)"),Yt=()=>wt("(prefers-reduced-motion: reduce)"),tn=()=>wt("(prefers-contrast: more)"),fn={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:{}},Za=new Proxy(fn,{get(Ve,He){if(He in Ve)return Ve[He];return},set(Ve,He,mt){return Ve[He]=mt,!0}}),Jn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ga=console;try{let Ve=As(z,k),He=new Set(Object.keys(Q)),mt=Object.keys(_).filter((ct)=>!He.has(ct)&&!i0.has(ct)&&lt(ct)),At=mt.map((ct)=>_[ct]);if(!mt.includes("__stxServeContext"))mt.push("__stxServeContext"),At.push(void 0);if(!He.has("cookies")){let ct=_.cookies??_.__stxServeContext?.cookies??{},Gt=mt.indexOf("cookies");if(Gt<0)mt.push("cookies"),At.push(ct);else At[Gt]=ct}let qt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),on=[],ts=[];for(let[ct,Gt]of Object.entries(Q)){if(!lt(ct))continue;if(qt.has(ct))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ct}\\b`).test(Ve))continue;on.push(ct),ts.push(Gt)}let Mo=a0(Ve).map((ct)=>`module.exports.${ct} = typeof ${ct} !== 'undefined' ? ${ct} : module.exports.${ct};`).join(`
2641
+ `),No=_.params??{},jo=[],wr=[];for(let ct=0;ct<mt.length;ct++){if(mt[ct]==="params")continue;jo.push(mt[ct]),wr.push(At[ct])}let ns=[...Bt,...on,...jo],Yn=`return (async () => {
2642
+ ${Ve}
2643
+ ${Mo}
2644
+ return module.exports
2645
+ })()`,un=h(Yn,ns.join("\x00")),ut=hh.get(un);if(!ut)ut=Function(...ns,Yn),hh.set(un,ut);let ht=_.__stx_options?.runtimeConfig;if(ht||/\buse(?:Server)?RuntimeConfig\b/.test(z))await $n(_,k,ht);let Rt=await ye(_.__stx_runtime_config??zt()??C(),()=>Rm(_,()=>ut(F,H,ae,Q,ce,ue,le,pe,Re,Fe,Am,Vs,yr,be,xe,Ie,Me,Ne,je,De,Ue,ze,Le,it,Be.setResponseStatus,Be.setResponseHeader,Be.notFound,xt,bt,St,pt,$t,Ct,vt,dt,_t,de,yt,Kt,Vn,jn,wt,gt,kt,Ut,Yt,tn,Za,Jn,Ga,fn.confirm,fn.alert,fn.fetch,No,...ts,...wr)));if(R.preserveExisting){for(let[ct,Gt]of Object.entries(Rt))if(!(ct in _)||_[ct]===void 0)_[ct]=Gt}else Object.assign(_,Rt);for(let[ct,Gt]of Object.entries(Q))if(!(ct in _))_[ct]=Gt}catch(Ve){if(_.__stx_strict_hydration)throw Ve;let He=jc(Ve instanceof Error?Ve.message:String(Ve));if(Bc(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:Ve});else if(Fc(Ve))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:Ve});else if(zc(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:Ve});else{let mt=`${k??"<unknown>"}\x00${He}`;if(Fi.env.STX_DEBUG||!yh.has(mt))yh.add(mt),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:Ve})}try{await p0(z,_,k)}catch(mt){if(Fi.env.STX_DEBUG){let At=mt instanceof Error?mt.message:String(mt);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${At}`)}}}}function Hc(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 c0=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function As(v,_){let k=_?Gn.dirname(_):Fi.cwd(),R=Fi.cwd(),T=v.split(`
2646
+ `),B=[],z=0;while(z<T.length){let F=T[z].trim();if(F.startsWith("interface ")||F.startsWith("export interface ")||F.startsWith("type ")||F.startsWith("export type ")){if(F.includes("{")&&!F.includes("}")){let H=0;for(;z<T.length;z++){for(let q of T[z])if(q==="{")H++;else if(q==="}")H--;if(H<=0)break}}z++;continue}if(F.startsWith("definePageMeta(")){let H=0,q=!1,K=z;for(let ae=z;ae<T.length&&!q;ae++){let Q=null,ce=!1,ue=T[ae];for(let le=0;le<ue.length;le++){let pe=ue[le];if(ce){ce=!1;continue}if(pe==="\\"){ce=!0;continue}if(Q){if(pe===Q)Q=null;continue}if(pe==='"'||pe==="'"||pe==="`"){Q=pe;continue}if(pe==="(")H++;else if(pe===")"){if(H--,H===0){z=ae+1,q=!0;break}}}}if(!q)z=T.length;let G=T.slice(K,z).join(`
2647
+ `),ee=[];for(let ae of["title","description"]){let Q=new RegExp(`\\b${ae}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(Q)ee.push(`${ae}: ${JSON.stringify(Q[2])}`)}if(ee.length>0)B.push(`useSeoMeta({ ${ee.join(", ")} });`);continue}if(F.startsWith("import ")||F==="import"||F.startsWith("import{")||/^import['"]/.test(F)){let H=F,q=0;while(!Hc(H)&&z+q+1<T.length)q++,H=`${H} ${T[z+q].trim()}`;z+=q;let K=H.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=H.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),ee=H.match(/^import\s*['"](.+?)['"]/),ae=H,Q=(ce)=>{if(ce.startsWith("."))return Gn.resolve(k,ce);if(ce.startsWith("~/")||ce.startsWith("@/"))return Gn.resolve(R,ce.slice(2));try{return Bun.resolveSync(ce,k)}catch{return ce}};if(K){let[,ce,ue]=K,le=Q(ue);B.push(`const ${ce} = (await import('${le}')).default`),B.push(`module.exports.${ce} = ${ce};`)}else if(G){let[,ce,ue]=G,le=Q(ue),pe=[],de=[],Re=o0.has(ue);for(let be of ce.split(",")){let xe=be.trim();if(!xe)continue;let Ie=xe.split(/\s+as\s+/);if(Ie.length===2){let[Me,Ne]=[Ie[0].trim(),Ie[1].trim()];if(Re&&gh.has(Me)){B.push(`const ${Ne} = ${Me};`);continue}pe.push(`${Me}: ${Ne}`),de.push(Ne)}else{if(Re&&gh.has(xe))continue;pe.push(xe),de.push(xe)}}if(pe.length>0)B.push(`const { ${pe.join(", ")} } = await import('${le}')`);for(let be of de)B.push(`module.exports.${be} = ${be};`)}else if(ee){let ce=Q(ee[1]);B.push(`await import('${ce}')`)}else B.push(ae);z++;continue}if(c0.test(F))B.push(T[z]),z++;else if(F.startsWith("export const ")||F.startsWith("export let ")||F.startsWith("export var ")){let H=bh(T,z),{type:q,name:K,value:G}=H;B.push(`${q} ${K} = ${G};`),B.push(`module.exports.${K} = ${K};`),z=H.nextIndex}else if(F.startsWith("export function ")||F.startsWith("export async function ")){let H=Zu(T,z);B.push(H.functionCode),B.push(`module.exports.${H.name} = ${H.name};`),z=H.nextIndex}else if(F.startsWith("const ")||F.startsWith("let ")||F.startsWith("var ")){let H=bh(T,z),{type:q,name:K,value:G}=H;B.push(`${q} ${K} = ${G};`),B.push(`module.exports.${K} = ${K};`),z=H.nextIndex}else if(F.startsWith("function ")||F.startsWith("async function ")){let H=Zu(T,z);B.push(H.functionCode),B.push(`module.exports.${H.name} = ${H.name};`),z=H.nextIndex}else if(F.startsWith("export default function ")||F.startsWith("export default async function ")){let H=T[z].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...T];q[z]=H;let K=Zu(q,z);if(B.push(K.functionCode),K.name)B.push(`module.exports.default = ${K.name};`);z=K.nextIndex}else if(F.startsWith("export default ")){let H=F.replace(/^export\s+default\s+/,"").replace(/;$/,"");B.push(`module.exports.default = ${H};`),z++}else if(F.startsWith("class ")||F.startsWith("export class ")){let H=F.match(/(?:export\s+)?class\s+(\w+)/);if(H){let q=H[1],K=T[z].replace(/^export\s+/,""),G=0,ee=z;for(;ee<T.length;ee++){let ae=T[ee];for(let Q of ae)if(Q==="{")G++;else if(Q==="}")G--;if(ee>z)K+=`
2648
+ `+ae;if(G<=0&&ee>=z)break}B.push(K),B.push(`module.exports.${q} = ${q};`),z=ee+1}else B.push(F),z++}else if(F.includes("module.exports"))B.push(F),z++;else if(F.trim()&&!F.startsWith("//"))B.push(F),z++;else z++}return l0(B.join(`
2649
+ `),k,R)}function l0(v,_,k){let R=v.length,T="",B=0,z=null,F=!1,H=!1,q=0;while(B<R){let K=v[B],G=v[B+1];if(F){if(T+=K,K===`
2650
+ `)F=!1;B++;continue}if(H){if(T+=K,K==="*"&&G==="/"){T+=G,B+=2,H=!1;continue}B++;continue}if(!z&&K==="/"&&G==="/"){F=!0,T+=K,B++;continue}if(!z&&K==="/"&&G==="*"){H=!0,T+=K,B++;continue}if(z){if(T+=K,K==="\\"){T+=G,B+=2;continue}if(K===z&&z!=="`"){z=null,B++;continue}if(z==="`"){if(K==="$"&&G==="{"){q++,T+=G,B+=2;continue}if(K==="`"){z=null,B++;continue}}B++;continue}if(q>0){if(K==="{")q++;else if(K==="}")q--}if(K==='"'||K==="'"||K==="`"){z=K,T+=K,B++;continue}if(K==="a"&&v.startsWith("await",B)){let ee=u0(v,B);if(ee){let{quote:ae,path:Q,end:ce}=ee;if(Q.startsWith(".")||Q.startsWith("~/")||Q.startsWith("@/")){let ue=Q.startsWith(".")?Gn.resolve(_,Q):Gn.resolve(k,Q.slice(2));T+=`await import(${ae}${ue}${ae})`,B=ce;continue}}}T+=K,B++}return T}function u0(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 $h(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 _h(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 F=T===0?$h(k,R):null;if(F){_.push(..._h(F.pattern)),R=F.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 Vc(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 F=v[k+1],H=v[k-1];if(F!=="="&&F!==">"&&H!=="="&&H!=="!"&&H!=="<"&&H!==">")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 xh(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 bh(v,_){let k=v[_].trim(),R=Vc(k),T=R?[k,R.type,R.name,R.value]:null;if(!T){let K=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let G=k.slice(K[0].length),ee=_;if(G.startsWith("{")||G.startsWith("[")){let Q=G[0],ce=Q==="{"?"}":"]",ue=xh(G,Q,ce,0),le=G;for(let pe=_+1;pe<v.length&&ue>0;pe++)le+=` ${v[pe].trim()}`,ee=pe,ue=xh(v[pe],Q,ce,ue);if(ue>0)le=G,ee=_;G=le}let ae=$h(G,0);if(ae){let Q=K[1],ce=ae.pattern,ue=G.slice(ae.endPos).trim();if(ue.startsWith("=")){let le=ue.slice(1).trim(),pe=le,de=Math.max(ee,_);if(vh(le)){let Ie=wh(v,de,le);pe=Ie.value,de=Ie.nextIndex}else de=de+1;pe=pe.trim().replace(/;$/,"");let Re=_h(ce),be=`__stx_src_${_}`,xe=Re.map((Ie)=>`module.exports.${Ie} = ${Ie};`).join(`
2651
+ `);return{type:Q,name:be,value:`${pe}; ${Q} ${ce} = ${be};
2652
+ ${xe}`,nextIndex:de}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,B,z,F]=T,H=F,q=_;if(vh(F)){let K=wh(v,_,F);H=K.value,q=K.nextIndex}else q=_+1;while(q<v.length){let K=v[q].trim();if(K.startsWith(".")||K.startsWith("?."))H+=`
2653
+ ${v[q]}`,q++;else break}return H=H.trim().replace(/;$/,""),{type:B,name:z,value:H,nextIndex:q}}function Zu(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(d0(k)){let F=f0(v,_,B);B=F.functionCode,z=F.nextIndex}else z=_+1;return{name:T,functionCode:B,nextIndex:z}}function vh(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!kh(_)}function kh(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 Eh(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function d0(v){let _=Eh(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function wh(v,_,k){let R=k,T=_+1;while(T<v.length&&!kh(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 f0(v,_,k){let R=k,T=_+1;while(T<v.length){let B=Eh(R);if(B!==-1){if(S(R,"{","}",B)!==-1)break}let z=v[T];R+=`
2656
+ ${z}`,T++}return{functionCode:R,nextIndex:T}}function Sh(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:{...Fi.env}})},T=Object.keys(R).filter(lt),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 p0(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,F]=B;try{let H=F.trim().replace(/;$/,""),q=Sh(H,_);if(q!==void 0)_[z]=q}catch(H){console.warn(`Failed to parse export ${z} in fallback:`,H)}}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,F]=B;if(!(z in _))try{let H=F.trim().replace(/;$/,""),q=Sh(H,_);if(q!==void 0)_[z]=q}catch{}}}function Ti(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 $i(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Do=new M(500),Ka=new M(1000),Yu=new M(2000),Qu=new M(500),Dh=33554432,ed=Dh;function g0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===ed)return;ed=_,Xa.setMaxBytes(_)}var Xa=new M(2000,{maxBytes:Dh,sizeOf:(v)=>v.output.length});function m0(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 h0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function Gu(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function tt(v){return!Yc(v)}var qa=new Map;function j(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=qa.get(_);if(k)return k;if(qa.size>=16)qa.clear();let R=new Bun.Transpiler(v);return qa.set(_,R),R}var Ch=new WeakMap,y0=256;function nt(v){try{let _=j({loader:"ts",target:"browser",define:w()}),k=Ch.get(_);if(!k)k=new Map,Ch.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,(F)=>{let H=B.length;return B.push(F),`"__STX_EXPR_${H}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(F)=>{let H=B.length;return B.push(F),`"__STX_EXPR_${H}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(F)=>{let H=B.length;return B.push(F),`"__STX_EXPR_${H}__"`});let z=_.transformSync(T);for(let F=0;F<B.length;F++)z=z.replace(`"__STX_EXPR_${F}__"`,B[F]),z=z.replace(`'__STX_EXPR_${F}__'`,B[F]);if(k.size>=y0){let F=k.keys().next();if(!F.done)k.delete(F.value)}return k.set(v,z),z}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function x0(v){let _=[],k=new Set,R=0,T=0,B=v.length,z=(K)=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]===K){T++;return}T++}},F=()=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let K=1;while(T<B&&K>0)if(v[T]==="{")K++,T++;else if(v[T]==="}")K--,T++;else if(v[T]==="'"||v[T]==='"')z(v[T]);else if(v[T]==="`")F();else T++;continue}T++}},H=()=>{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},q=()=>{if(R!==0)return;let K=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let Q=K[2].split(",").map((ce)=>{let ue=ce.trim().split(":");return ue[ue.length-1].trim()});for(let ce of Q)if(ce&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(ce)&&!k.has(ce))_.push(ce),k.add(ce);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let Q=G[2];if(!k.has(Q))_.push(Q),k.add(Q);return}let ee=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ee){let Q=ee[1];if(!k.has(Q))_.push(Q),k.add(Q);return}let ae=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ae){let Q=ae[1];if(!k.has(Q))_.push(Q),k.add(Q)}};while(T<B){if(H())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){F();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])))q();T++}return _}function b0(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 v0(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 w0(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 H=v[R];if(H==="}")B++;else if(H==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let F=v.slice(z+1,T);for(let H of b0(F)){let q=H.trim();if(!q||q.startsWith("..."))continue;let K=v0(q);if(K===-1)continue;let G=q.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let ee=q.slice(K+1).trim();if(!ee)continue;try{let ae=Object.keys(_).filter(lt),Q=Function(...ae,`"use strict"; return (${ee});`);_[G]=Q(...ae.map((ce)=>_[ce]))}catch{}}}catch{}}var S0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function Zc(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(!S0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=te(v,(q,K)=>(T.lastIndex=K,T.exec(q)?.index===K?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,F=!1;for(let q of B){if(z+=q.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(q.end).trim())return null;F=!0;break}}if(!F)return null;let H=k[0].length;return v.slice(0,H)+_+v.slice(H)}async function pr(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(be)=>be.split("-").map((xe)=>xe.charAt(0).toUpperCase()+xe.slice(1)).join(""),F=k.__importedComponents;if(F){for(let be of[B,B.toLowerCase(),z(B),pn(B)])if(F.has(be))return!0}let H=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${pn(B)}.stx`])],q=typeof T.root==="string"?ft.resolve(T.root):void 0,K=q??ft.dirname(R),G=[],ee=(be)=>{if(be&&!G.includes(be))G.push(be)},ae=k.__originalFilePath;if(ae)ee(ft.join(ft.dirname(ae),"components"));ee(_),ee(T._rootComponentsDir),ee(ft.join(ft.dirname(R),"components")),ee(T.componentsDir);let Q=T._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===B.toLowerCase());if(!Q)for(let be of T._targetComponentDirs??[])ee(be);if(q)ee(ft.resolve(q,"resources/views/components")),ee(ft.resolve(q,"resources/components")),ee(ft.resolve(q,"src/components")),ee(ft.resolve(q,"components"));for(let be of T._layerComponentDirs??[])ee(be);let ce=T._pluginComponentDirs;if(Array.isArray(ce))for(let be of ce)ee(typeof be==="string"?be:null);if(ee(T.fallbackComponentsDir),Q)for(let be of T._targetComponentDirs??[])ee(be);if(B.startsWith("./")||B.startsWith("../"))return r(ft.resolve(ft.dirname(R),`${B}.stx`));let ue=Rh(ft.resolve(import.meta.dir,"components")),le=G.map((be)=>ft.isAbsolute(be)?be:ft.resolve(K,be)),pe=`${H.join("\x00")}\x00\x00${le.join("\x00")}`,de=Yu.get(pe);if(de!==void 0)return de;let Re=!1;e:for(let be of le){if(Rh(be)===ue)continue;for(let xe of H)if(await r(ft.join(be,xe))){Re=!0;break e}}return Yu.set(pe,Re),Re}function Rh(v){let _=Qu.get(v);if(_!==void 0)return _;let k=v;try{k=Ph.realpathSync(v)}catch{}return Qu.set(v,k),k}function Qc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function Ii(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 $0(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 F=String(z);if(/<\/style/i.test(F))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 F};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var Ah=new Set;function Th(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&Ah.has(T))return;Ah.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",F=k.length>0?`
2658
+ searched:
2659
+ ${k.map((H)=>` - ${H}`).join(`
2660
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${F}`)}function Ih(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function js(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 rt(v,_,k,R,T,B,z,F=new Set,H,q=Rr(T),K,G=v){let{extractVariables:ee}=await Et("stx/variable-extractor",()=>import("./chunk-0gpjks6k.js")),ae=F??new Set;if(ae.has(v))return`[Circular component reference: ${v}]`;let Q=new Set(ae);Q.add(v);let ce=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ue=ce&&ce!=="load"&&Qc(ce)?ce:"";try{let le=(ut)=>ut.split("-").map((ht)=>ht.charAt(0).toUpperCase()+ht.slice(1)).join(""),pe=G.endsWith(".stx")?G.slice(0,-4):G,de=null,Re=T.__importedComponents;if(Re){let ut=[pe,pe.toLowerCase(),le(pe),pn(pe)];for(let ht of ut)if(Re.has(ht)){de=Re.get(ht);break}}let be=[];if(!de){let ut=[`${pe}.stx`,`${le(pe)}.stx`,`${pn(pe)}.stx`],ht=[...new Set(ut)],Rt=T.__originalFilePath,ct=[];if(ct.push(...z._layerComponentDirs??[]),Rt){let Tt=ft.join(ft.dirname(Rt),"components");ct.push(Tt)}if(R)ct.push(R);let Gt=z._rootComponentsDir;if(typeof Gt==="string"&&!ct.includes(Gt))ct.push(Gt);let Qt=ft.join(ft.dirname(B),"components");if(!ct.includes(Qt))ct.push(Qt);if(z.componentsDir&&z.componentsDir!==R&&!ct.includes(z.componentsDir))ct.push(z.componentsDir);let $r=z._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(pe),rs=(K?.events??[]).map((Tt)=>Tt.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Er=!rs.includes("valuechange")&&(Object.hasOwn(_,"checked")||K?.reactiveProps?.includes("checked")||rs.includes("change")),Wr=z._targetComponentFallbackNames?.some((Tt)=>Tt.toLowerCase()===pe.toLowerCase())&&(!$r||Er);for(let Tt of Wr?[]:z._targetComponentDirs??[])if(Tt&&!ct.includes(Tt))ct.push(Tt);let Qn=typeof z.root==="string"?ft.resolve(z.root):void 0,Ya=Qn??ft.dirname(B),Wn=[];if(Qn)Wn.push(ft.resolve(Qn,"resources/views/components")),Wn.push(ft.resolve(Qn,"resources/components")),Wn.push(ft.resolve(Qn,"src/components")),Wn.push(ft.resolve(Qn,"components"));Wn.push(ft.resolve(import.meta.dir,"components"));for(let Tt of Wn)if(!ct.includes(Tt))ct.push(Tt);let Hi=z._pluginComponentDirs;if(Array.isArray(Hi)){for(let Tt of Hi)if(typeof Tt==="string"&&!ct.includes(Tt))ct.push(Tt)}if(z.fallbackComponentsDir&&!ct.includes(z.fallbackComponentsDir))ct.push(z.fallbackComponentsDir);if(Wr){for(let Tt of z._targetComponentDirs??[])if(Tt&&!ct.includes(Tt))ct.push(Tt)}let Xi=[...new Set(ct.map((Tt)=>{if(!Tt)return Tt;return ft.isAbsolute(Tt)?Tt:ft.resolve(Ya,Tt)}))];ct.length=0,ct.push(...Xi);let ss=`${pe}\x00${B}\x00${Xi.join("\x00")}`,is=Ka.get(ss);if(is)if(await r(is))de=is;else Ka.delete(ss);if(!de&&(pe.startsWith("./")||pe.startsWith("../")))de=ft.resolve(ft.dirname(B),`${pe}.stx`),be.push(de);else if(!de)for(let Tt of ct){if(!Tt)continue;for(let Lo of ht){let Bo=ft.join(Tt,Lo);if(be.push(Bo),await r(Bo)){de=Bo;break}}if(de)break;if(!de)try{let Lo=await import("fs");if(!Lo.statSync(Tt,{throwIfNoEntry:!1})?.isDirectory())continue;let Bh=8,Qa=[{path:Tt,depth:0}];while(Qa.length>0&&!de){let zo=Qa.pop();if(zo.depth>=Bh)continue;let nd;try{nd=Lo.readdirSync(zo.path,{withFileTypes:!0})}catch{continue}for(let Wo of nd){if(!Wo.isDirectory())continue;if(Wo.name==="node_modules"||Wo.name.startsWith("."))continue;let rd=ft.join(zo.path,Wo.name);for(let zh of ht){let ec=ft.join(rd,zh);if(be.push(ec),await r(ec)){de=ec;break}}if(de)break;Qa.push({path:rd,depth:zo.depth+1})}}}catch{}if(de)break}if(de)Ka.set(ss,de)}if(!de||!await r(de))return Th(v,B,be),Ih(v);H.add(de);let xe;if(Do.has(de))xe=Do.get(de);else try{xe=await Bun.file(de).text(),Do.set(de,xe)}catch(ut){let ht=ut instanceof Error?ut.message:String(ut);return Th(v,B,[de],ht),Ih(v)}if(K)for(let ut of new Set([...Object.keys(_),...K.reactiveProps??[]])){let ht=ut.toLowerCase();if(ht.startsWith("aria-")||ht.startsWith("data-"))continue;let Rt=ut.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${Rt}\\b`).test(xe))K.declaredProps.add(ut);if(new RegExp(`\\$props\\s*(?:\\.\\s*${Rt}\\b|\\[\\s*['"]${Rt}['"]\\s*\\])`).test(xe)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${Rt}['"]`).test(xe))K.consumedProps?.add(ut)}let Ie=new Set(["__originalFilePath","__importedComponents",Xo,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Me={};for(let[ut,ht]of Object.entries(T))if(!ut.startsWith("__")||Ie.has(ut))Me[ut]=ht;let Ne=q.length>0?{[ra]:[...q]}:{},je=k;if(k.includes("@include")){let{processIncludes:ut}=await Et("stx/includes",()=>import("./chunk-9vxdjpn5.js"));je=await ut(k,T,B,z,H)}if(/<[A-Z][\w.-]*[\s/>]/.test(je)){let{processComponents:ut}=await Et("stx/component-renderer",()=>import("./chunk-9mmy9m0y.js"));je=await ut(je,{...T,__processedComponents:ae,...Ne},B,z,H)}let Be=[];if(Ii(je)){let{processExpressions:ut}=await Et("stx/expressions",()=>import("./chunk-64vnwrkw.js")),ht=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ne}:q.length>0?{...T,...Ne}:T;je=ut(je,ht,B);for(let Rt of je.matchAll(/\{\{([\s\S]*?)\}\}/g))Be.push(Rt[1].trim())}let De=hn(je),Fe=[],Ue=De.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ut,ht)=>{let Rt=De.scripts[Number(ht)]||"",ct=Rt.match(/^<script\b([^>]*)>/i)?.[1]||"",Gt=ct.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Qt=!Gt||["module","text/javascript","application/javascript"].includes(Gt),$r=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${ct}`);if(!/\bserver\b/i.test(ct)&&Qt&&!$r)return Fe.push(Rt),"";return Rt}),{extractSlotContent:ze}=await Et("stx/slots",()=>import("./chunk-5ys7azpj.js")),Le=ze(Ue),it={};if(Le.defaultSlot?.trim())it.default=Le.defaultSlot;for(let[ut,ht]of Le.namedSlots)it[ut]=ht.content;let xt=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},St=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++xt.n}_${xt.key}`,pt={...Me,$uid:St,..._,props:_,slot:Ue,$slots:it,__processedComponents:Q,__sections:{},__stx_signals_gate:Ce(xe)||Ii(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Be]};w0(xe,pt);let $t=xe,Ct=se($t);if(Ct)$t=Ct.content.trim();let vt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,dt=[...xe.matchAll(vt)];for(let[,ut,ht]of dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ut))Ze(ht,de,z.strict);let _t=[],yt=null,Kt=dt.some((ut)=>/\bserver\b/.test(ut[1]||"")&&/\bcache\b/.test(ut[1]||"")),Vn=null,jn=null,wt=null,gt=0,kt=null;if(g0(z),Kt&&ed>0){let ut=m0({props:_,slot:je,slotContext:k.trim()?h0(Me):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...q].sort(),layers:z._layerGraph?.layers.map((ht)=>ht.configFile),uid:St});if(ut!==null){Vn=`${de}\x00${h(xe)}\x00${ut}`;let ht=Xa.get(Vn);if(ht){for(let Rt of ht.dependencies)H.add(Rt);if($d(T,ht.clientFactories),xt.n+=ht.uidsConsumed,ht.preservedClientExpressions.length>0){let Rt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let ct of ht.preservedClientExpressions)Rt.add(ct);T.__stx_preserved_client_expressions=[...Rt]}return ht.output}jn=new Set(H),wt=wd(T),gt=xt.n,kt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Ut=new Set;for(let ut of dt){let ht=ut[1]||"",Rt=ut[2]||"",ct=ht.includes("server");if(tt(ht)&&Rt.trim())Rt=nt(Rt);if(ct&&Rt){for(let Qt of ge(Rt))Ut.add(Qt);try{await ee(Rt,pt,de,{onFailure:(Qt)=>{if(Qt.kind!=="unknown")yt=Qt.kind}})}catch(Qt){}}if(!ct){let Qt=Rt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),$r=Qt.includes("{{")&&Qt.includes("}}"),rs=Qt.includes("{!!")&&Qt.includes("!!}");if($r||rs)Qt=bs(Qt,pt,de);let Er=ht.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");_t.push(`<script${Er}>${Qt}</script>`)}}let tn=hn(xe).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),fn=tn?tn[1]:"",Za=tn?tn[2]:"",Jn="",Ga=fn&&/\bscoped\b/i.test(fn);if(tn)Jn=`<style${fn}>${$0(Za,pt,de)}</style>`;let Ve=$t;if(Ve=Ve.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),tn)Ve=Ve.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ut=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ht=[];if(Ve=Ve.replace(ut,(Rt,ct)=>{let Gt=ct.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Gt)ht.push(`<style${Gt[1]}>${Gt[2]}</style>`);return""}),Ve=Ve.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ht.length>0)Jn=`${Jn}${ht.join(`
2661
+ `)}`}if(k&&Ve.includes("{{ text || slot }}"))Ve=Ve.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:He}=await Et("stx/slots",()=>import("./chunk-5ys7azpj.js")),{defaultSlot:mt,namedSlots:At}=Le,qt=_t.some((ut)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(ut)),on=(ut)=>qt?Qm(ut,St):ut,ts=new Map([...At].map(([ut,ht])=>[ut,{...ht,content:on(ht.content)}]));Ve=await He(Ve,on(mt),ts,pt);let Ja=js(_t),Mo=(Array.isArray(pt.__stx_client_signal_names)?pt.__stx_client_signal_names:[]).filter((ut)=>!Ut.has(ut));if(Ja.length>0||Mo.length>0)pt.__stx_client_signal_names=[...new Set([...Mo,...Ja])];else delete pt.__stx_client_signal_names;let No=q.filter((ut)=>!Ut.has(ut)&&!(ut in _));if(No.length>0)pt[ra]=No;let jo={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:ft.dirname(de),skipSignalsRuntime:!0,skipEventDirectives:z._nativeHostAttrs===!0||qt||_t.length===0,defaultLayout:void 0};pt.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let wr=await n(Ve,pt,de,jo,H),ns=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let ut of wr.matchAll(/\{\{([\s\S]*?)\}\}/g))ns.add(ut[1].trim());if(ns.size>0)T.__stx_preserved_client_expressions=[...ns];let Yn=St,un=wr;if(qt){let ut="";if(Object.keys(_).length>0)try{ut=` data-stx-props="${Gu(JSON.stringify(_))}"`}catch{}let ht=ue?` stx-hydrate="${Gu(ue)}"`:"",Rt=Object.fromEntries(Object.entries(it).map(([Er,Wr])=>[Er,Boolean(Wr)])),ct=Object.keys(Rt).length>0?` data-stx-slots="${Gu(JSON.stringify(Rt))}"`:"",Gt=` data-stx-scope="${Yn}"${ut}${ct}${ht}`,Qt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(wr),$r=Qt?"span":"div";un=Zc(wr,Gt)??`<${$r}${Gt} data-stx-component-wrapper${Qt?' style="display:contents"':""}>${wr}</${$r}>`;let rs=await Promise.all(_t.map(async(Er)=>{let Wr=Er.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Wr)return Er;let[,Qn,Ya]=Wr,Wn=await E0(Ya,de,z.buildMode==="compile"),Hi=bn(Wn.clientCode,Se(pt)),{vendorStyleTags:Xi}=Wn,ss=Hi?`function(__scopeId) {
2662
+ ${Hi}
2663
+ return (${Wn.factoryBody})(__scopeId);
2664
+ }`:Wn.factoryBody,is=ue?null:cc(T,ss),Tt=is?`window.__stxComponentFactories[${JSON.stringify(is)}](${JSON.stringify(Yn)});`:`(${ss})(${JSON.stringify(Yn)});`;if(ue)return`${Xi}<script type="stx/island" data-stx-island="${Yn}" data-stx-scoped data-stx-owner="${Yn}"${Qn}>${Tt}</script>`;return`${Xi}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Yn}"${Qn}>${Tt}</script>`}));if(un=un+`
2665
+ `+rs.join(`
2666
+ `),Jn)un+=`
2667
+ `+Jn}else{if(Jn)un+=`
2668
+ `+Jn;if(_t.length>0){let ut=pt.__stx_event_bindings||[],ht=Se(pt),Rt=await Promise.all(_t.map(async(ct)=>{let Gt=ct.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Gt)return ct;return await ke(Gt[1],{eventBindings:ut,templateContent:un,filePath:de,projectRoot:process.cwd(),serverData:ht,instanceId:St})}));un+=`
2669
+ `+Rt.join(`
2670
+ `),pt.__stx_event_bindings=[]}}if(Ga){let ut=la(un,de);if(ut.hasScoped)un=ut.html}if(Vn&&jn){let ut=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Xa.set(Vn,{output:un,dependencies:[...H].filter((ht)=>!jn.has(ht)),clientFactories:wt?Sd(T,wt):[],uidsConsumed:xt.n-gt,preservedClientExpressions:kt?ut.filter((ht)=>!kt.has(ht)):[]})}if(yt)un=`<!--stx-render-failed:${yt}-->${un}`;return Fe.length>0?`${un}
2671
+ ${Fe.join(`
2672
+ `)}`:un}catch(le){if(le instanceof W)throw le;return`[Error processing component: ${le instanceof Error?le.message:String(le)}]`}finally{ae.delete(v)}}async function r(v){return Bun.file(v).exists()}function td(v,_){let k=ft.resolve(_),R=ft.resolve(v),T=k.endsWith(ft.sep)?k:k+ft.sep;if(R===k||R.startsWith(T))return R;return null}async function _0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,B=ft.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 fr(v,_,k,R){let T=await k0(v,_,k,R);if(T===null)return null;let B=td(T,process.cwd());if(B)return B;let z=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((F)=>typeof F==="string"&&F.length>0);for(let F of z){let H=ft.isAbsolute(F)?F:ft.resolve(process.cwd(),F);if(td(T,H))return ft.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function k0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=ft.dirname(_),B=process.cwd();if(v.startsWith("/")){let ee=ft.join(B,v),ae=td(ee,B);if(!ae)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${ae}`);if(await r(ae)&&R)R.add(ae);return ae}let z=ft.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 ee of[".stx",".tsx",".jsx"]){let ae=`${z}${ee}`;if(await r(ae)){if(k.debug)console.log(`Found direct path with extension: ${ae}`);if(R)R.add(ae);return ae}}let F=[];if(F.push(...k._layerLayoutDirs??[]),k.layoutsDir)F.push(ft.isAbsolute(k.layoutsDir)?k.layoutsDir:ft.resolve(process.cwd(),k.layoutsDir));let H=ft.resolve(T),q=process.cwd();for(let ee=0;ee<10;ee++){let ae=ft.join(H,"layouts"),Q=!1;try{Q=Ph.statSync(ae,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(Q){F.push(ae);break}let ce=ft.dirname(H);if(ce===H||ce.length<q.length)break;H=ce}for(let ee of F){let ae=await _0(ee,v,R,k.debug);if(ae)return ae}if(k.fallbackLayoutsDir){let ee=ft.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:ft.resolve(process.cwd(),k.fallbackLayoutsDir),ae=v.startsWith("layouts/")?v.slice(8):v,Q=[ft.join(ee,ae)];if(!v.endsWith(".stx"))Q.push(`${Q[0]}.stx`);for(let ce of Q)if(await r(ce)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${ce}`);if(R)R.add(ce);return ce}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let ee=v.split("layouts/"),ae=ft.join(k.partialsDir||T,"layouts",ee[1]);if(await r(ae)){if(k.debug)console.log(`Found in layouts path: ${ae}`);if(R)R.add(ae);return ae}if(!ae.endsWith(".stx")){let Q=`${ae}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in layouts path with extension: ${Q}`);if(R)R.add(Q);return Q}}}if(k.partialsDir){let ee=ft.join(k.partialsDir,"layouts");if(await r(ee)){let ae=ft.join(ee,v);if(await r(ae)){if(k.debug)console.log(`Found in partials layouts dir: ${ae}`);if(R)R.add(ae);return ae}if(!v.endsWith(".stx")){let Q=`${ae}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${Q}`);if(R)R.add(Q);return Q}}}}let K=k.partialsDir||ft.join(process.cwd(),"views"),G=ft.join(K,v);if(await r(G)){if(k.debug)console.log(`Found in views path: ${G}`);if(R)R.add(G);return G}if(!v.endsWith(".stx")){let ee=`${G}.stx`;if(await r(ee)){if(k.debug)console.log(`Found in views path with extension: ${ee}`);if(R)R.add(ee);return ee}}if(T.includes("temp")){let ee=ft.join(ft.dirname(T),"layouts",v);if(await r(ee)){if(k.debug)console.log(`Found in temp layouts dir: ${ee}`);if(R)R.add(ee);return ee}if(!v.endsWith(".stx")){let ae=`${ee}.stx`;if(await r(ae)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ae}`);if(R)R.add(ae);return ae}}}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 Oi(v,_,k){let R=0,T="",B="";try{if(typeof _==="number"&&_>=0){let z=v.split(`
2673
+ `),F=0;for(let H=0;H<z.length;H++)if(F+=z[H].length+1,F>=_){R=H+1,T=z[H].trim();let q=Math.max(0,H-2),K=Math.min(z.length,H+3);B=z.slice(q,K).map((G,ee)=>{let ae=q+ee+1;return`${ae===R?"> ":" "}${ae}: ${G}`}).join(`
2674
+ `);break}}else if(k){let z=v.indexOf(k);if(z>=0)return Oi(v,z)}}catch{}return{lineNumber:R,lineContent:T,context:B}}var Pt={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:F}=Oi(R,T,B),H=k.split("/").pop(),q=0;if(typeof T==="number"&&T>=0&&R){let G=R.lastIndexOf(`
2675
+ `,Math.max(0,T-1));q=T-(G+1)+1}let K="";if(z>0)K+=`
2676
+ ${k}:${z}${q>0?`:${q}`:""}: ${v.toLowerCase()} error: ${_}
2677
+ `;if(K+=`
2678
+ ${Pt.bold}${Pt.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${Pt.reset}
2679
+ `,K+=`${Pt.bold}${Pt.red}\u2502${Pt.reset} ${Pt.bold}${Pt.bgRed} ERROR ${Pt.reset} ${Pt.red}${v} Error${Pt.reset}${" ".repeat(Math.max(0,43-v.length))}${Pt.bold}${Pt.red}\u2502${Pt.reset}
2680
+ `,K+=`${Pt.bold}${Pt.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${Pt.reset}
2681
+ `,K+=`
2682
+ ${Pt.cyan}${Pt.bold}File:${Pt.reset} ${Pt.dim}${H}${Pt.reset}`,z>0)K+=` ${Pt.gray}(line ${z}${q>0?`, col ${q}`:""})${Pt.reset}`;if(K+=`
2683
+ ${Pt.yellow}${Pt.bold}Message:${Pt.reset} ${_}
2684
+ `,F)K+=`
2685
+ ${Pt.blue}${Pt.bold}Context:${Pt.reset}
2686
+ ${Pt.dim}${F}${Pt.reset}
2687
+ `;return K}function oe(){Do.clear(),Ka.clear(),Yu.clear(),Qu.clear(),Xa.clear()}function hu(){return{size:Do.size,maxSize:500}}var Ju=m(128);async function E0(v,_,k){let R=h(v,_,k),T=Ju.get(R);if(T){if(yn(T.deps))return T;Ju.delete(R)}let B=gs(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,F=ms(B.styles);z=Ot(z).code;let{hasUserImports:H,bundleClientScript:q}=await Et("stx/client-script-bundler",()=>import("./chunk-g24kapd5.js")),K=[],G=!1;if(H(z)){let le=z;z=await q(le,_,{projectRoot:process.cwd(),minify:k,collectInputs:K}),G=z===le}let{stripStxRuntimeImports:ee}=await Et("stx/signal-processing",()=>import("./chunk-76ebcf61.js"));z=ee(z);let ae=I(z),Q=x0(ae),ce=`function(__scopeId) {
2688
+ ${Wt("const",[...Yi,...Q],ae)}
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
+ __scopeVars.$slots = Object.create(null);
2700
+ if (__componentElement) {
2701
+ try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
2702
+ catch {}
2703
+ }
2704
+ window.__STX_CURRENT_ELEMENT__ = __componentElement;
2705
+ let __componentProps = __componentElement && __componentElement.__stx_props;
2706
+ if (!__componentProps && __componentElement) {
2707
+ try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
2708
+ catch { __componentProps = {}; }
2709
+ }
2710
+ window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
2711
+
2712
+ // Scope-specific lifecycle callbacks. The queues drain as they run; the
2713
+ // hook lists keep what setup registered, because a component behind an :if
2714
+ // unmounts at each hide and mounts again at each show (signals.ts,
2715
+ // suspendSubtreeScopes).
2716
+ if (__scopeVars.__suspended && !__scopeVars.__mounted) {
2717
+ // Set up again after an :if hid it -- a <template :if> clones the
2718
+ // component afresh on every show, and the clone's script runs. This run's
2719
+ // hooks close over this run's state, so they replace the ones the hide
2720
+ // kept for a re-show rather than queueing beside them.
2721
+ __scopeVars.__mountCallbacks = [];
2722
+ __scopeVars.__destroyCallbacks = [];
2723
+ __scopeVars.__mountHooks = [];
2724
+ __scopeVars.__destroyHooks = [];
2725
+ }
2726
+ __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
2727
+ __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
2728
+ __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
2729
+ __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
2730
+ let __registeringSetupHooks = true;
2731
+ const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
2732
+ const onDestroy = (fn) => {
2733
+ __scopeVars.__destroyCallbacks.push(fn);
2734
+ // A teardown registered inside onMount belongs to this mount alone.
2735
+ // Replaying it AND registering the next mount's teardown doubles cleanup.
2736
+ if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
2737
+ };
2738
+
2739
+ try {
2740
+ ${ae}
2741
+
2742
+ // Register all defined signals and functions in this scope
2743
+ const __localVars = {};
2744
+ try {
2745
+ ${Q.map((le)=>`if (typeof ${le} !== 'undefined') __localVars['${le}'] = ${le};`).join(`
2746
+ `)}
2747
+ }
2748
+ catch (e) {}
2749
+ Object.assign(__scopeVars, __localVars);
2750
+ }
2751
+ finally {
2752
+ __registeringSetupHooks = false;
2753
+ window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
2754
+ window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
2755
+ }
2756
+ }`,ue={vendorStyleTags:F,factoryBody:ce,clientCode:ae,deps:nf([...K,...B.styles.map((le)=>le.resolvedPath)])};if(!G&&B.unresolved.length===0)Ju.set(R,ue);return ue}var C0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function R0(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 A0(v,_){let k=_;while(!0){let R=es.join(k,"node_modules",v,"package.json");if(Oo.existsSync(R))return es.dirname(R);let T=es.dirname(k);if(T===k)return null;k=T}}function T0(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),F=T.slice(B+1);if(!_.startsWith(z)||!_.endsWith(F))continue;if(_.length<z.length+F.length)continue;if(!R||z.length>R.prefix.length)R={pattern:T,prefix:z,suffix:F}}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 I0(v,_){let k=R0(v);if(!k||!k.subpath)return null;let R=A0(k.pkg,_);if(!R)return null;let T;try{T=JSON.parse(Oo.readFileSync(es.join(R,"package.json"),"utf8"))}catch{return null}let B=`.${k.subpath}`,z=T0(T.exports,B);if(!z)return null;let F=es.resolve(R,z);return Oo.existsSync(F)?F:null}function gs(v,_){let k=_.filePath?es.dirname(_.filePath):_.projectRoot||process.cwd(),R=_.projectRoot||process.cwd(),T=new Set,B=[],z=[];return{code:v.replace(C0,(H,q)=>{let K;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(K=q.startsWith("/")?q:es.resolve(k,q),!Oo.existsSync(K))throw Error(`file not found: ${K}`)}else{let G=null;try{G=Bun.resolveSync(q,R)}catch{G=I0(q,R)}if(!G)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);K=G}}catch(G){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${_.filePath||"<unknown>"}): ${G?.message||G}`),z.push(q),""}if(T.has(K))return"";T.add(K);try{let G=Oo.readFileSync(K,"utf8");B.push({source:q,resolvedPath:K,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${K}: ${G?.message||G}`),z.push(q)}return""}),styles:B,unresolved:z}}function P0(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ms(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${P0(_.source)}" data-stx-layer="vendor">
2757
+ @layer vendor {
2758
+ ${_.contents}
2759
+ }
2760
+ </style>`).join(`
2761
+ `)}
2762
+ `}var bc=y,Oh=m(256);function Ot(v){let _=h(v),k=Oh.get(_);if(!k)k=D0(v),Oh.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function D0(v){let _=s(v),k=new Set;for(let F of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of F[1].split(",")){let q=H.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)k.add(q)}let R=Vo(_),T=J.filter((F)=>{if(k.has(F)||R.has(F))return!1;return hs(_,F,!0)}),B=Lh(_).filter((F)=>!k.has(F)&&!R.has(F));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(`
2763
+ `)}
2764
+ ${v}`,imports:T,models:B}}var O0=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 Lh(v){let _=new Set,k=ic(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(O0.has(z)||R.has(z)||z.length<3)continue;if(k.shadows(z,B.index??0))continue;_.add(z)}return Array.from(_)}function M0(v){return Vo(v)}var Mh=m(128);function ai(v){let _=h(v),k=Mh.get(_);if(!k)k=N0(v),Mh.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function N0(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 G=z[1],ee=z[2];if(z[0].includes("import type"))continue;let ae=[];for(let ce of G.split(",")){let ue=ce.trim();if(!ue||ue.startsWith("type "))continue;let le=ue.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!le)continue;let pe=le[1],de=le[2]||pe;if(T.add(pe),T.add(de),ee==="stx"||ee==="@stacksjs/stx")_.add(pe);else k.add(pe);if(de!==pe)ae.push(`${de} = ${pe}`)}let Q=ae.length>0?`var ${ae.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";R=R.replace(z[0],Q)}let F=M0(R);for(let G of bc){if(T.has(G)||F.has(G))continue;if(hs(R,G,!0))_.add(G)}let H=s(R),q=new Set;for(let G of R.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let ee of G[1].split(",")){let ae=ee.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let Q of ae){let ce=Q.trim();if(ce)q.add(ce)}}for(let G of J){if(T.has(G)||F.has(G)||q.has(G))continue;if(hs(H,G))k.add(G)}let K=Lh(H);for(let G of K)if(!T.has(G)&&!F.has(G))k.add(G);return{code:R,stxImports:Array.from(_),browserImports:Array.from(k)}}function hs(v,_,k=!1){let R=ic(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 F=z+_.length,H=z-1;while(H>=0&&/\s/.test(v[H]))H--;if(v[H]==="."&&v.slice(Math.max(0,H-2),H+1)!=="...")continue;let q=F;while(q<v.length&&/\s/.test(v[q]))q++;if(v[q]===":"&&v[q+1]!==":"&&(v[H]==="{"||v[H]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(F)))continue;if(j0(v,F))continue;return!0}return!1}function j0(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 ci(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
2765
+ ${k.join(`
2766
+ `)}
2767
+ ${L0(v,_)}`;return""}function Kd(v,_=[]){let{browserImports:k}=ai(v),R=new Set(_);return ci([],k.filter((T)=>!R.has(T)))}function L0(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
2768
+ [${k.join(", ")}].forEach(function (e) {
2769
+ if (e[1] !== 'undefined') return;
2770
+ console.error(
2771
+ '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
2772
+ + 'but the client runtime does not provide it. Either it is not exported to the browser, '
2773
+ + 'or it should be imported from a relative path so the bundler includes it.'
2774
+ );
2775
+ });
2776
+ `}function Se(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 B0=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Nh=new Set;function z0(v,_){let k=B0.test(v),R=_.length>32768;if(!k&&!R)return;if(Nh.has(v))return;if(Nh.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 bn(v,_){if(!_)return"";let k=It(v,new Set(Object.keys(_))),R=_.__stxDeclaredPayload===!0,T=[],B=Object.entries(_).sort(([z],[F])=>z<F?-1:z>F?1:0);for(let[z,F]of B){if(!/^[A-Za-z_$][\w$]*$/.test(z))continue;if(z.startsWith("__")||z.startsWith("$"))continue;if(!R&&!k.has(z))continue;if(no(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 H;try{H=JSON.stringify(F)}catch{continue}if(H===void 0)continue;z0(z,H),T.push(` var ${z} = ${H.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2777
+ ${T.join(`
2778
+ `)}
2779
+ `}var W0={left:0,middle:1,right:2};function F0(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=W0[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function V0(v,_){let{elementId:k,event:R,modifiers:T}=v,B=nc(v.handler),z=F0(T),F=[];if(T.once)F.push("once: true");if(T.capture)F.push("capture: true");if(tc(R,T))F.push("passive: true");let H=F.length>0?`, { ${F.join(", ")} }`:"",q="";if(z)q+=`${z}; `;let K=B.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
2780
+ $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2781
+ };`;function ee(ae){if(/\$emit\s*\(/.test(ae))return`${G}
2782
+ ${ae}`;return`var scope = $el.closest('[data-stx-scope]');
2783
+ if (scope && scope.__stx_execute) {
2784
+ scope.__stx_execute('${K}', $event, $el);
2785
+ }
2786
+ else {
2787
+ ${ae}
2788
+ }`}if(T.debounce!==null)return` ;(function() {
2789
+ // eslint-disable-next-line pickier/no-unused-vars
2790
+ var $el = document.getElementById('${k}')
2791
+ if (!$el) return
2792
+ var __timer
2793
+ $el.addEventListener('${R}', function($event) {
2794
+ ${z?z+"; ":""}clearTimeout(__timer)
2795
+ __timer = setTimeout(function() { ${ee(B)} }, ${T.debounce})
2796
+ }${H})
2797
+ })()`;if(T.throttle!==null)return` ;(function() {
2798
+ // eslint-disable-next-line pickier/no-unused-vars
2799
+ var $el = document.getElementById('${k}')
2800
+ if (!$el) return
2801
+ var __last = 0
2802
+ $el.addEventListener('${R}', function($event) {
2803
+ ${z?z+"; ":""}var __now = Date.now()
2804
+ if (__now - __last >= ${T.throttle}) {
2805
+ __last = __now
2806
+ ${ee(B)}
2807
+ }
2808
+ }${H})
2809
+ })()`;if(/\$emit\s*\(/.test(B))return` var $el = document.getElementById('${k}')
2810
+ if ($el) $el.addEventListener('${R}', function($event) {
2811
+ ${q}${G}
2812
+ ${B}
2813
+ }${H})`;return` var $el = document.getElementById('${k}')
2814
+ if ($el) $el.addEventListener('${R}', function($event) {
2815
+ ${q}var scope = $el.closest('[data-stx-scope]');
2816
+ if (scope && scope.__stx_execute) {
2817
+ scope.__stx_execute('${K}', $event, $el);
2818
+ }
2819
+ else {
2820
+ ${B}
2821
+ }
2822
+ }${H})`}function U0(v){if(v.length===0)return"";return`
2823
+ // STX: auto-generated event bindings
2824
+ ${v.map((k,R)=>V0(k,R)).join(`
2825
+ `)}`}function jh(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let F=R[z];if(F==="'"||F==='"'||F==="`"){let H=F;if(z++,H==="`"){let q=0;while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]==="`"&&q===0){z++;break}if(R[z]==="$"&&R[z+1]==="{"){q++,z+=2;continue}if(R[z]==="}"&&q>0){q--,z++;continue}z++}}else while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]===H){z++;break}z++}continue}if(F==="/"&&R[z+1]==="/"){while(z<B&&R[z]!==`
2826
+ `)z++;continue}if(F==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(F==="{"){T++,z++;continue}if(F==="}"){T--,z++;continue}if(T===0){let H=R.slice(z),q=H.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let ee=q[1];if(!ee.startsWith("_")&&!k.has(ee))_.push(ee),k.add(ee);z+=q[0].length;continue}let K=H.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((ee)=>{let ae=ee.trim(),Q=ae.indexOf(":"),ce=Q>=0?ae.slice(Q+1).trim().split(/[\s=]/)[0]:ae.split(/[\s=]/)[0];if(ce&&!ce.startsWith("_")&&!k.has(ce))_.push(ce),k.add(ce)}),z+=K[0].length;continue}let G=H.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let ee=G[1];if(!ee.startsWith("_")&&!k.has(ee))_.push(ee),k.add(ee);z+=G[0].length;continue}}z++}return _}var H0=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 q0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(ee){let ae;while((ae=k.exec(ee))!==null){let Q=ae[0];if(!H0.has(Q))_.add(Q)}}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 F=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=F.exec(v))!==null)R(B[1]);let H=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=q.exec(v))!==null)R(B[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((B=K.exec(v))!==null)R(B[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=G.exec(v))!==null)R(B[1]);return _}async function ke(v,_={}){let k=v,R="",T=!1,B=[],z=gs(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let F=ms(z.styles),H=Ot(k);k=H.code,B=[...H.imports,...H.models];let{hasUserImports:q,bundleClientScript:K}=await Et("stx/client-script-bundler",()=>import("./chunk-g24kapd5.js"));if(q(k))k=await K(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let de=ai(k);k=de.code,R=ci(de.stxImports,de.browserImports.filter((Re)=>!B.includes(Re)))}if(R=`${bn(k,_.serverData)}${R}`,k=I(k),!T&&tt(_.attrs||""))k=nt(k);let G=U0(_.eventBindings||[]),ee=(_.attrs||"").trim(),ae=/\btype\s*=\s*["']module["']/i.test(ee),Q=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ae){let de=ee.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Re=`type="module" data-stx-scoped${Q}${de?` ${de}`:""}`;return`${F}<script ${Re}>
2827
+ ${Mi(`${R}${k}
2828
+ ${G}`)}
2829
+ </script>`}let ce=to(v),ue=/function __stx_setup_/.test(k),le=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function pe(de){let Re=de.length>0?`
2830
+ return { ${de.join(", ")} };`:"",be=JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`);return`${F}<script data-stx-scoped data-stx-run="always"${Q}>
2831
+ window.stx.mount(function() {
2832
+ 'use strict';
2833
+ try {
2834
+ ${Mi(`${R}${k}
2835
+ ${G}${Re}`)}
2836
+ } catch (error) {
2837
+ console.error(${be}, error);
2838
+ return {};
2839
+ }
2840
+ })</script>`}if(!le&&!ue){if(ce)return pe(jh(v));if(_.templateContent){let de=jh(v);if(de.length>0){let Re=q0(_.templateContent);if(de.some((xe)=>Re.has(xe)))return pe(de)}}}return`${F}<script data-stx-scoped data-stx-run="always"${Q}>
2841
+ ;(function() {
2842
+ 'use strict';
2843
+ try {
2844
+ ${Mi(`${R}${k}
2845
+ ${G}`)}
2846
+ } catch (error) {
2847
+ console.error(${JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`)}, error);
2848
+ }
2849
+ })()</script>`}
2850
+ export{rr,We,It,M,X,m,h,yn,J,w,qe,gs,ms,bc,Ot,ai,hs,ci,Kd,Se,bn,ke,li,di,ui,ys,V,Ge,te,Dt,ne,sr,vc,Xd,wc,Jd,xc,or,b,Nt,Ce,Sc,bs,kc,Yd,Y,Cc,Zd,x,Qd,_c,eu,tu,nu,ru,Ec,Tc,su,ou,pi,iu,vn,wn,ir,Ke,_e,re,Mt,fe,xn,Sn,Ee,e,au,fi,cu,gi,$c,Rc,Lt,kn,lu,Ac,Pc,du,f,Xe,jt,Je,Ye,mi,ar,Ze,se,vs,ws,xs,uu,cr,pu,Cn,Qe,Ss,ks,Ic,ge,hi,yi,bi,vi,lr,Cs,wi,xi,Si,Oc,_s,L,me,Z,fu,Dc,Es,Ts,ki,Ci,$s,Rs,dr,Nc,_i,Ei,Mc,et,_n,ur,Bt,Lc,jc,Bc,Fc,zc,d,Hc,As,Vc,Ti,$i,Ps,Ri,Uc,gu,Wc,Te,Ai,mu,Is,Os,Ds,Pi,Ns,Ms,Ls,n,qc,Gc,Kc,Xc,Jc,Yc,tt,j,nt,Zc,pr,Qc,Ii,js,rt,r,fr,Oi,g,oe,hu,gr,A,el,Bs,o,P,yu,bu,he};