@stacksjs/stx 0.2.634 → 0.2.635

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 (223) hide show
  1. package/dist/chunk-0d7dqt4d.js +2 -0
  2. package/dist/chunk-0grt24vd.js +2 -0
  3. package/dist/{chunk-7q55jxf5.js → chunk-0tm9ep8b.js} +2 -2
  4. package/dist/{chunk-7gq7w95h.js → chunk-14yjt309.js} +3 -3
  5. package/dist/{chunk-ygpa12ez.js → chunk-1d25z8q2.js} +3 -3
  6. package/dist/{chunk-6bhaa9g7.js → chunk-1wb98s7b.js} +13 -13
  7. package/dist/{chunk-nh7bcc4h.js → chunk-2efrxnnt.js} +2 -2
  8. package/dist/chunk-2vzfn6vy.js +2 -0
  9. package/dist/chunk-3bsz101e.js +2 -0
  10. package/dist/{chunk-w9e17a74.js → chunk-3e2v2fdh.js} +4 -4
  11. package/dist/{chunk-jq7ymh7q.js → chunk-3f4xy76k.js} +6 -6
  12. package/dist/chunk-3jwjesb5.js +2 -0
  13. package/dist/{chunk-968jp303.js → chunk-3td99hnc.js} +3 -3
  14. package/dist/chunk-4b4es5wg.js +2 -0
  15. package/dist/{chunk-phbnrw2h.js → chunk-4n24jbfs.js} +2 -2
  16. package/dist/{chunk-72p9brmx.js → chunk-4vkpgz28.js} +9 -9
  17. package/dist/chunk-4xeafdr6.js +2 -0
  18. package/dist/chunk-4xkqdfqd.js +2 -0
  19. package/dist/chunk-5k989nr4.js +2 -0
  20. package/dist/chunk-5v95x083.js +3 -0
  21. package/dist/chunk-5yf9yzkp.js +2 -0
  22. package/dist/{chunk-923vrf9c.js → chunk-6gwrmn3w.js} +7 -7
  23. package/dist/{chunk-p77g4mhy.js → chunk-6w1ngwsd.js} +2 -2
  24. package/dist/chunk-7m5xrqnj.js +2852 -0
  25. package/dist/chunk-7mtdjjbt.js +2 -0
  26. package/dist/{chunk-94yycjz8.js → chunk-7vdcsr14.js} +2 -2
  27. package/dist/{chunk-k5atee35.js → chunk-839m1t8t.js} +1 -1
  28. package/dist/chunk-88dxeynx.js +2 -0
  29. package/dist/chunk-8er7jc3c.js +2 -0
  30. package/dist/chunk-8phbb8wj.js +2 -0
  31. package/dist/{chunk-p4hmv654.js → chunk-8y3mff5c.js} +2 -2
  32. package/dist/{chunk-gqdh68vx.js → chunk-954tcahb.js} +2 -2
  33. package/dist/{chunk-sg5zgq5v.js → chunk-97zrn4wb.js} +5 -5
  34. package/dist/{chunk-q6evk3a4.js → chunk-9gx5p7zh.js} +2 -2
  35. package/dist/{chunk-g2rxbaah.js → chunk-a6hv03yw.js} +3 -3
  36. package/dist/chunk-a7s1j320.js +127 -0
  37. package/dist/chunk-a83r1xx9.js +2 -0
  38. package/dist/chunk-abpeac2d.js +2 -0
  39. package/dist/chunk-adzsqsjt.js +2 -0
  40. package/dist/{chunk-4fv3jq16.js → chunk-ahyq08mp.js} +2 -2
  41. package/dist/chunk-b1ndskw9.js +2 -0
  42. package/dist/chunk-b7fp3zta.js +2 -0
  43. package/dist/{chunk-pbphq5pj.js → chunk-b7hv69ty.js} +2 -2
  44. package/dist/{chunk-avt9cske.js → chunk-baw176ay.js} +6 -6
  45. package/dist/chunk-bgfkbesj.js +2 -0
  46. package/dist/{chunk-cy1j2zpr.js → chunk-bk9bx2ns.js} +2 -2
  47. package/dist/{chunk-gh34r6qb.js → chunk-bsts9pr5.js} +2 -2
  48. package/dist/{chunk-jzmz66a3.js → chunk-bysyrwfa.js} +3 -3
  49. package/dist/{chunk-y89m80pf.js → chunk-c4ysk7x2.js} +4 -4
  50. package/dist/{chunk-90pe63me.js → chunk-camd8j1q.js} +3 -3
  51. package/dist/{chunk-0qt1887j.js → chunk-cdab66xt.js} +2 -2
  52. package/dist/{chunk-gv15dd41.js → chunk-cjr8cpb7.js} +3 -3
  53. package/dist/{chunk-y8h823cb.js → chunk-cw9pc5yx.js} +41 -41
  54. package/dist/chunk-cy83yfy9.js +2 -0
  55. package/dist/chunk-dbqb1a51.js +2 -0
  56. package/dist/{chunk-pk757m0k.js → chunk-e0nq8g9j.js} +1 -1
  57. package/dist/chunk-e8t64hxk.js +2 -0
  58. package/dist/chunk-e943xk88.js +2 -0
  59. package/dist/{chunk-w8bf4mbw.js → chunk-emcbmr0r.js} +3 -3
  60. package/dist/{chunk-kpxty3pe.js → chunk-f30t1g74.js} +2 -2
  61. package/dist/{chunk-tx4xxpgg.js → chunk-f3agc1a3.js} +3 -3
  62. package/dist/{chunk-27784ceh.js → chunk-fm80xpxn.js} +4 -4
  63. package/dist/{chunk-xrrkf04f.js → chunk-fwawm5r3.js} +2 -2
  64. package/dist/chunk-g039c67x.js +2 -0
  65. package/dist/{chunk-gxpgwpq7.js → chunk-g9dz0mx9.js} +2 -2
  66. package/dist/{chunk-bd5na0h0.js → chunk-g9sdjgfw.js} +5 -5
  67. package/dist/{chunk-k2nrx78c.js → chunk-gcj5jfbv.js} +2 -2
  68. package/dist/chunk-ghfxfcr9.js +2 -0
  69. package/dist/chunk-gvyq9xt6.js +2 -0
  70. package/dist/chunk-h30y9k44.js +2 -0
  71. package/dist/{chunk-236twqn4.js → chunk-hbzk179w.js} +3 -3
  72. package/dist/chunk-hwp3m8a8.js +2 -0
  73. package/dist/{chunk-2bxsc7gf.js → chunk-j79f6syh.js} +4 -4
  74. package/dist/chunk-jarptkbv.js +2 -0
  75. package/dist/{chunk-ftkrsvqp.js → chunk-jtr30kkz.js} +1 -1
  76. package/dist/{chunk-fdy0hka5.js → chunk-kjtvdqb9.js} +13 -13
  77. package/dist/chunk-kk6tq07c.js +3 -0
  78. package/dist/chunk-km4xp898.js +2 -0
  79. package/dist/{chunk-j1rnhv0w.js → chunk-kr14jt4m.js} +3 -3
  80. package/dist/{chunk-az1y9jks.js → chunk-kwwrrasa.js} +2 -2
  81. package/dist/chunk-kxbw0e2f.js +3 -0
  82. package/dist/{chunk-a887js9p.js → chunk-m56ee2tw.js} +5 -5
  83. package/dist/chunk-meze7k8v.js +2 -0
  84. package/dist/chunk-mfwrxz9z.js +2 -0
  85. package/dist/chunk-mmpm1awz.js +2 -0
  86. package/dist/{chunk-0whv8hnp.js → chunk-mn97jhaq.js} +2 -2
  87. package/dist/{chunk-3yh585yv.js → chunk-mpb0ezee.js} +3 -3
  88. package/dist/{chunk-g35zftfn.js → chunk-mvt5n2q4.js} +1 -1
  89. package/dist/chunk-n7vetrt4.js +2 -0
  90. package/dist/chunk-nd716zha.js +2 -0
  91. package/dist/{chunk-0hs8jgw5.js → chunk-npn3h566.js} +2 -2
  92. package/dist/{chunk-5x59qjzs.js → chunk-pak6ngv0.js} +6 -6
  93. package/dist/{chunk-v5500ews.js → chunk-pp6ycfay.js} +2 -2
  94. package/dist/{chunk-vhktd16g.js → chunk-psranzfr.js} +2 -2
  95. package/dist/chunk-ptjz4f2e.js +2 -0
  96. package/dist/{chunk-8qrhz7n7.js → chunk-ptv5f34x.js} +6 -6
  97. package/dist/{chunk-86zj56pf.js → chunk-q0kbn64j.js} +5 -5
  98. package/dist/chunk-q4hmgj72.js +2 -0
  99. package/dist/chunk-q841b6x4.js +2 -0
  100. package/dist/{chunk-v4tmwamd.js → chunk-qa58qdz8.js} +2 -2
  101. package/dist/{chunk-8hjrr8j3.js → chunk-qczse5w4.js} +33 -33
  102. package/dist/{chunk-tn7hgtyn.js → chunk-qjfgdcck.js} +5 -5
  103. package/dist/chunk-qnh5x7vv.js +2 -0
  104. package/dist/chunk-qxjfvkjt.js +2 -0
  105. package/dist/chunk-rhhwz7e9.js +2 -0
  106. package/dist/chunk-rpbe5h6v.js +2 -0
  107. package/dist/chunk-rrdn4qnn.js +2 -0
  108. package/dist/{chunk-xm911f1g.js → chunk-ry1w4ghk.js} +1 -1
  109. package/dist/chunk-s7c9kb53.js +2 -0
  110. package/dist/chunk-sfj84n72.js +2 -0
  111. package/dist/chunk-sgr2hhsc.js +2 -0
  112. package/dist/{chunk-jbmjcs83.js → chunk-shcn4wve.js} +2 -2
  113. package/dist/{chunk-zs7t42b5.js → chunk-sn0a8cjd.js} +5 -5
  114. package/dist/chunk-taztcvv3.js +2 -0
  115. package/dist/chunk-vczt5k2j.js +2 -0
  116. package/dist/chunk-vj5fghnv.js +2 -0
  117. package/dist/{chunk-6dzqjbsz.js → chunk-vyjdzpb8.js} +2 -2
  118. package/dist/chunk-wj4rf7sb.js +2 -0
  119. package/dist/chunk-wn1s8af8.js +2 -0
  120. package/dist/{chunk-t7e9y46s.js → chunk-x7g0946r.js} +1 -1
  121. package/dist/{chunk-rq1c46zb.js → chunk-xdwpbqzz.js} +34 -9
  122. package/dist/chunk-y3jyk5bj.js +2 -0
  123. package/dist/chunk-y51ndrdb.js +2 -0
  124. package/dist/{chunk-xrkechs8.js → chunk-y5b25eks.js} +5 -5
  125. package/dist/{chunk-tc7gm68a.js → chunk-ycz5th6b.js} +2 -2
  126. package/dist/{chunk-3kkf43fv.js → chunk-ym0e374a.js} +2 -2
  127. package/dist/{chunk-pxpmx8vc.js → chunk-ymntav9f.js} +1 -1
  128. package/dist/{chunk-8kc6byaz.js → chunk-yp8tk3v3.js} +5 -5
  129. package/dist/{chunk-bng1ayzm.js → chunk-ytv0k9gy.js} +9 -9
  130. package/dist/chunk-ytxzy6eg.js +2 -0
  131. package/dist/chunk-ywf319rp.js +2 -0
  132. package/dist/chunk-yww6c9we.js +2 -0
  133. package/dist/chunk-yy43hxb7.js +2 -0
  134. package/dist/chunk-z42jb949.js +2 -0
  135. package/dist/{chunk-y04hzz4w.js → chunk-zfrpss8y.js} +4 -4
  136. package/dist/{chunk-8b2452m1.js → chunk-zpzk4wd2.js} +11 -11
  137. package/dist/chunk-zw20a7q4.js +2 -0
  138. package/dist/cli.js +76 -76
  139. package/dist/client/signals-public-api-runtime.js +1 -0
  140. package/dist/client/signals-timer-runtime.js +24 -0
  141. package/dist/craft-entry.js +2 -2
  142. package/dist/craft.js +2 -2
  143. package/dist/lazy-module.js +2 -1
  144. package/dist/menubar.d.ts +2 -0
  145. package/dist/menubar.js +15 -2
  146. package/dist/native/compiler/headwind-to-style.d.ts +6 -3
  147. package/dist/native/compiler/headwind-to-style.js +25 -3
  148. package/dist/native/compiler/html-to-ir.js +4 -4
  149. package/dist/native/prop-names.d.ts +1 -1
  150. package/dist/native/prop-names.js +3 -1
  151. package/dist/native/runtime/native-host.js +66 -7
  152. package/dist/pwa.js +3 -3
  153. package/dist/runtime-globals.js +1 -0
  154. package/dist/ssg.js +9 -9
  155. package/dist/stx-module.d.ts +1 -0
  156. package/package.json +5 -5
  157. package/stx-module.d.ts +1 -0
  158. package/stx.d.ts +7 -0
  159. package/dist/chunk-0mgtrbaa.js +0 -2
  160. package/dist/chunk-0xc6rncm.js +0 -2852
  161. package/dist/chunk-1tpr8d8n.js +0 -2
  162. package/dist/chunk-20kjbf3h.js +0 -2
  163. package/dist/chunk-3gcg3gvy.js +0 -2
  164. package/dist/chunk-3wsrhj0k.js +0 -2
  165. package/dist/chunk-575cqc6z.js +0 -2
  166. package/dist/chunk-5x836mv3.js +0 -2
  167. package/dist/chunk-5yceay9n.js +0 -2
  168. package/dist/chunk-6pg2kxsq.js +0 -2
  169. package/dist/chunk-7nthebqr.js +0 -2
  170. package/dist/chunk-7s5304ae.js +0 -2
  171. package/dist/chunk-8dybd0g5.js +0 -2
  172. package/dist/chunk-8em788gc.js +0 -2
  173. package/dist/chunk-9svygzeg.js +0 -2
  174. package/dist/chunk-9z4qr5w9.js +0 -2
  175. package/dist/chunk-af4ss0p5.js +0 -2
  176. package/dist/chunk-aj34t5h3.js +0 -2
  177. package/dist/chunk-atcy4zq6.js +0 -2
  178. package/dist/chunk-az28kd7f.js +0 -2
  179. package/dist/chunk-cncdgxk3.js +0 -2
  180. package/dist/chunk-d2t2pq1s.js +0 -3
  181. package/dist/chunk-dcx2t3sy.js +0 -2
  182. package/dist/chunk-dn28q0m3.js +0 -2
  183. package/dist/chunk-dn89zg1v.js +0 -2
  184. package/dist/chunk-dwddzp5f.js +0 -2
  185. package/dist/chunk-enchx79c.js +0 -2
  186. package/dist/chunk-ev8ma4ph.js +0 -2
  187. package/dist/chunk-ftrsaag8.js +0 -2
  188. package/dist/chunk-g6efz3ww.js +0 -2
  189. package/dist/chunk-gd59tkhr.js +0 -2
  190. package/dist/chunk-h1g9m148.js +0 -2
  191. package/dist/chunk-h8tew5mz.js +0 -2
  192. package/dist/chunk-hdrcgepx.js +0 -127
  193. package/dist/chunk-hn64343d.js +0 -2
  194. package/dist/chunk-htaed68z.js +0 -2
  195. package/dist/chunk-j5jkh05f.js +0 -2
  196. package/dist/chunk-j90yng9b.js +0 -2
  197. package/dist/chunk-jabb3v4c.js +0 -2
  198. package/dist/chunk-jczvjn7z.js +0 -2
  199. package/dist/chunk-kqkhcbrx.js +0 -2
  200. package/dist/chunk-mgzegkvk.js +0 -2
  201. package/dist/chunk-mk71833d.js +0 -2
  202. package/dist/chunk-n3s3w1f5.js +0 -2
  203. package/dist/chunk-nj0b4ryt.js +0 -2
  204. package/dist/chunk-ny6enm8b.js +0 -3
  205. package/dist/chunk-p8ndfekp.js +0 -2
  206. package/dist/chunk-qhjm9hvz.js +0 -2
  207. package/dist/chunk-qzy34xmt.js +0 -2
  208. package/dist/chunk-ra40trfh.js +0 -2
  209. package/dist/chunk-rjq597cn.js +0 -2
  210. package/dist/chunk-rrdwynz4.js +0 -2
  211. package/dist/chunk-sddytf9n.js +0 -2
  212. package/dist/chunk-shhtbdnj.js +0 -2
  213. package/dist/chunk-t4g97h08.js +0 -2
  214. package/dist/chunk-t7f9zmy8.js +0 -2
  215. package/dist/chunk-tme29zh9.js +0 -3
  216. package/dist/chunk-x1xx8qt0.js +0 -2
  217. package/dist/chunk-xmfhb2v0.js +0 -2
  218. package/dist/chunk-xsw183n7.js +0 -2
  219. package/dist/chunk-xtwe2rnp.js +0 -2
  220. package/dist/chunk-xxnh7gv8.js +0 -2
  221. package/dist/chunk-y84n0dvg.js +0 -2
  222. package/dist/chunk-zr0k9pz5.js +0 -2
  223. package/dist/chunk-zytcxy8p.js +0 -2
@@ -0,0 +1,2852 @@
1
+ // @bun
2
+ import{zn,y,na,Gt,io,ra,sa,oa,ia}from"./chunk-kk6tq07c.js";import{I}from"./chunk-ahyq08mp.js";import{t,W,q,i,ae,ro,O,Wt,jn,so,Tr,l,p,ta,N,Oe,dt,c,Rr}from"./chunk-ptv5f34x.js";import{Vn,Un,Nr,De}from"./chunk-c4ysk7x2.js";import{S,Qs,lt,eo,Xi,Pn,In,Ji,Ie,Yi,On,Zi,Ut,to,Qi,Nn,Mn,_r,xe,no,Se,Er}from"./chunk-zpzk4wd2.js";import{Xs,Js,Ys,Zs,xr,Sr}from"./chunk-1wb98s7b.js";import{qi,qs,br,vr}from"./chunk-j79f6syh.js";import{ve,Vt,wr,Ks,C,at}from"./chunk-fwawm5r3.js";import{An}from"./chunk-bk9bx2ns.js";import{po}from"./chunk-ym0e374a.js";import{Bi,Fi,Hi,Vi}from"./chunk-bysyrwfa.js";import{it}from"./chunk-pp6ycfay.js";import{s,Ae}from"./chunk-3e2v2fdh.js";import{Ht,Ki,$n,a,Rn}from"./chunk-5v95x083.js";import{d}from"./chunk-yn2d8x8m.js";import{E,D,Bn,oo}from"./chunk-shcn4wve.js";import{Dr}from"./chunk-8y3mff5c.js";import ss from"path";import jo from"fs";var Jh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function uc(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Jh.has(v.toLowerCase())}var Zu=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"]),Gu={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"},Yh=new Set(["ctrl","alt","shift","meta"]),Qu={left:0,middle:1,right:2};function Ju(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(Yh.has(R))_.systemKeys.push(R);else if(R in Qu)_.mouse=R;else if(R in Gu||/^[a-z]$/.test(R))_.keys.push(Gu[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 $d(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,z;while((z=T.exec(v))!==null){let[F,V,H]=z,K=z.index,X=K+F.length,G=`__stx_evt_${_}${R++}`,te=[],ce=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,ee;while((ee=ce.exec(H))!==null){let[,ue,de]=ee,pe=ue.split("."),fe=pe[0];if(!Zu.has(fe))continue;te.push({attribute:`@${ue}`,event:fe,handler:de,modifiers:Ju(pe.slice(1)),elementId:G})}let le=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((ee=le.exec(H))!==null){let[,ue,de]=ee,pe=ue.split("."),fe=pe[0];if(!Zu.has(fe))continue;te.push({attribute:`@${ue}`,event:fe,handler:de,modifiers:Ju(pe.slice(1)),elementId:G})}if(te.length>0)k.push({originalTag:F,elementId:G,events:te,startIndex:K,endIndex:X})}return k}function Qh(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=Qu[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function ey(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function dc(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function ty(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Qh(v),T=ey(dc(v.handler),_),z=[];if(_.once)z.push("once: true");if(_.capture)z.push("capture: true");if(uc(v.event,_))z.push("passive: true");let F=z.length>0?`, { ${z.join(", ")} }`:"",V=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('${V}', null, $el);
10
+ }
11
+ else {
12
+ __stx_runHandler('${V}', 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('${V}', null, $el);
27
+ }
28
+ else {
29
+ __stx_runHandler('${V}', 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('${V}', $event, $el);
50
+ }
51
+ else {
52
+ // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
+ __stx_runHandler('${V}', $event, $el);
54
+ }
55
+ }${F});
56
+ })();`}function pc(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(ty).join(`
112
+ `)}
113
+ })();
114
+ </script>`}function ny(v,_=""){let k=$d(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let z=k.length-1;z>=0;z--){let F=k[z],V=F.originalTag;if(!V.includes(" id="))V=V.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${F.elementId}"`);else{let H=V.match(/id=["']([^"']+)["']/);if(H)for(let K of F.events)K.elementId=H[1]}for(let H of F.events){let K=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),G=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");V=V.replace(X,""),V=V.replace(G,"")}R=R.slice(0,F.startIndex)+V+R.slice(F.endIndex),T.push(...F.events)}return{template:R,bindings:T}}function Yu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function _d(v,_,k){if(ra(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:V,bindings:H}=ny(v,Yu(_)),K=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...K,...H],V}let R=$d(v,Yu(_));if(R.length===0)return v;let T=v;for(let V=R.length-1;V>=0;V--){let H=R[V],K=H.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${H.elementId}"`);else{let X=K.match(/id=["']([^"']+)["']/);if(X)for(let G of H.events)G.elementId=X[1]}for(let X of H.events){let G=X.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),te=new RegExp(`\\s*${G}\\s*=\\s*"[^"]*"`,"g"),ce=new RegExp(`\\s*${G}\\s*=\\s*'[^']*'`,"g");K=K.replace(te,""),K=K.replace(ce,"")}T=T.slice(0,H.startIndex)+K+T.slice(H.endIndex)}let z=pc(R.flatMap((V)=>V.events)),F=T.lastIndexOf("</body>");if(F!==-1)T=T.slice(0,F)+z+`
115
+ `+T.slice(F);else T+=z;return T}function Ed(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let z=T.lastIndexOf(":");if(z!==-1)T=T.slice(z+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function Wi(v,_){let k=s(v),{depths:R,balanced:T}=Ae(k),z=(V)=>!T||R[V]===0,F=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let V of k.matchAll(F)){let H=(V.index??0)+V[0].length-V[1].length;if(z(H))return!0}for(let V of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(z(V.index??0)&&Ed(V[1],!0).has(_))return!0;for(let V of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(z(V.index??0)&&Ed(V[1],!1).has(_))return!0;return!1}function M(v,_=!1){let k=s(v),R=[],T=new Set,z=0,F=0,V=k.length,H=()=>{if(z!==0)return;let K=k.slice(F).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(K){if(_&&K[1]==="const")return;let ee=K[2];if(!T.has(ee))R.push(ee),T.add(ee);return}let X=k.slice(F).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(X){if(_&&k.slice(F).startsWith("const"))return;X[1].split(",").forEach((ee)=>{let le=ee.trim();if(!le)return;let ue=le.indexOf(":"),pe=(ue>=0?le.slice(ue+1).trim():le).split(/[\s=]/)[0];if(pe&&!T.has(pe))R.push(pe),T.add(pe)});return}let G=k.slice(F).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(G){if(_&&k.slice(F).startsWith("const"))return;G[1].split(",").forEach((ee)=>{let le=ee.trim().replace(/^\.\.\./,"");if(!le)return;let ue=le.split(/[\s=]/)[0];if(ue&&!T.has(ue))R.push(ue),T.add(ue)});return}if(_)return;let te=k.slice(F).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let ee=te[1];if(!T.has(ee))R.push(ee),T.add(ee);return}let ce=k.slice(F).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ce){let ee=ce[1];if(!T.has(ee))R.push(ee),T.add(ee)}};while(F<V){if(k[F]==="{"){z++,F++;continue}if(k[F]==="}"){z--,F++;continue}if(z===0&&/[a-z]/i.test(k[F])&&(F===0||/\s|[;{}()]/.test(k[F-1])))H();F++}return R.join(", ")}function Ko(v){return`{ enumerable: true, configurable: true, get() { return ${v} }, set(__stxValue_${v}) { ${v} = __stxValue_${v} } }`}function ry(v,_=M(v).split(",").map((k)=>k.trim()).filter(Boolean)){let k=new Set(M(v,!0).split(",").map((R)=>R.trim()));return _.map((R)=>k.has(R)?`get ${R}() { return ${R} }, set ${R}(__stxValue_${R}) { ${R} = __stxValue_${R} }`:R).join(", ")}function Xo(v,_){let k=`{ ${ry(v,_)} }`;return M(v).split(",").some((R)=>R.trim()==="__stxLiveBindings")?`Object.defineProperties(${k}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:k}var Rd="",Zo,Ar=/^[A-Za-z_$][\w$]*$/,sy=new Set(["if","for","while","switch","with"]),Ad=["(","[","{"],Td=[")","]","}"],iy=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function oy(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 fc(v){if(Zo&&v===Rd)return Zo;let{code:_,tokens:k}=oy(v),R=new Map,T=[];for(let ee=0;ee<k.length;ee++){let le=k[ee].text;if(["(","[","{"].includes(le))T.push(ee);else if([")","]","}"].includes(le)){let ue=T.at(-1);if(ue!==void 0&&["()","[]","{}"].includes(k[ue].text+le))T.pop(),R.set(ue,ee),R.set(ee,ue)}}function z(ee,le){let ue=[],de=ee;for(let pe=ee;pe<le;pe++){if(["(","[","{"].includes(k[pe].text)&&(R.get(pe)??le)<le){pe=R.get(pe);continue}if(k[pe].text===",")ue.push([de,pe]),de=pe+1}return ue.push([de,le]),ue}let F=[];function V(ee,le,ue,de=!1){if(k[ee]?.text==="...")ee++;if(ee>=le)return;let pe=k[ee].text;if(Ar.test(pe)){if(ue.add(pe),ue===X)F.push({name:pe,token:ee,functionScoped:de});return}if(pe!=="{"&&pe!=="[")return;let fe=R.get(ee);if(fe===void 0||fe>=le)return;for(let[Pe,ke]of z(ee+1,fe)){let we=Pe;if(pe==="{")for(let Me=Pe;Me<ke;Me++){if(k[Me].text===":"){we=Me+1;break}if(k[Me].text==="=")break;if(["(","[","{"].includes(k[Me].text)&&R.has(Me))Me=R.get(Me)}V(we,ke,ue,de)}}function H(ee,le){let ue=new Set;for(let[de,pe]of z(ee,le))V(de,pe,ue);return ue}function K(ee){let le=ee;for(;le<k.length;le++){let ue=k[le].text;if(["(","[","{"].includes(ue)&&R.has(le)){le=R.get(le);continue}if([",",";",")","]","}"].includes(ue))break}return k[Math.max(ee,le-1)]?.end??_.length}let X=new Set,G=[];for(let ee=0;ee<k.length;ee++)if(k[ee].text==="=>"){let le=ee-1,ue=le,de;if(k[le]?.text===")"&&R.has(le))ue=R.get(le),de=H(ue+1,le);else if(k[le]&&Ar.test(k[le].text))de=new Set([k[le].text]);else continue;let pe=ee+1,fe=k[pe]?.text==="{"&&R.has(pe)?k[R.get(pe)].end:K(pe);G.push({start:k[ue].start,end:fe,bodyStart:k[pe]?.start??fe,functionBody:!0,names:de})}else if(k[ee].text==="("&&R.has(ee)){let le=k[ee-1]?.text;if(!le||sy.has(le)||!Ar.test(le)&&le!=="*"&&le!=="]")continue;let ue=R.get(ee),de=ue+1;if(k[de]?.text===":"){de++;while(de<k.length&&!["{","=>",";","="].includes(k[de].text))de++}if(k[de]?.text!=="{"||!R.has(de))continue;G.push({start:k[ee].start,end:k[R.get(de)].end,bodyStart:k[de].start,functionBody:le!=="catch",names:H(ee+1,ue)})}function te(ee){let le=ee;for(;le<k.length;le++){let ue=k[le].text;if(Ad.includes(ue)&&R.has(le)){le=R.get(le);continue}if(ue===";"||Td.includes(ue))break;let de=k[le-1];if(le>ee&&iy.has(ue)&&de.text!==".")break;if(le>ee&&/[\n\r]/.test(_.slice(de.end,k[le].start))&&(/^[\w$]+$/.test(de.text)||Td.includes(de.text)||['"',"'","`"].includes(de.text))&&Ar.test(ue)&&!["in","of","instanceof"].includes(ue))break}return le}let ce=[];for(let ee=0;ee<k.length;ee++){if(k[ee].text!=="for")continue;let le=k[ee+1]?.text==="await"?ee+2:ee+1;if(k[le]?.text!=="("||!R.has(le))continue;let ue=R.get(le),de=ue+1,pe=k[de]?.text==="{"&&R.has(de)?R.get(de):te(de),fe=k[pe]?.text===";"||k[pe]?.text==="}"?k[pe].end:k[Math.max(de,pe-1)]?.end??_.length;ce.push({headStart:le,headEnd:ue,start:k[le].start,end:fe})}for(let ee=0;ee<k.length;ee++){let le=k[ee].text,ue=k[ee-1]?.text;if(ue==="."||k[ee+1]?.text===":")continue;if(ue==="as"||ue==="<")continue;if(le==="const"||le==="let"||le==="var"){let de=te(ee+1),pe=ee+1,fe=!1,Pe=!1,ke=0;for(let we=ee+1;we<=de;we++){let Me=k[we]?.text;if(we<de&&Ad.includes(Me)&&R.has(we)&&R.get(we)<de){we=R.get(we);continue}if(we<de&&Me===":"&&!Pe)fe=!0;else if(we<de&&Me==="="&&ke===0)fe=!1,Pe=!0;else if(we<de&&fe&&Me==="<")ke++;else if(we<de&&fe&&Me===">"&&ke>0)ke--;else if(we===de||Me===","&&ke===0)V(pe,we,X,le==="var"),pe=we+1,fe=!1,Pe=!1}}else if(le==="function"||le==="class"){let de=ee+1;if(k[de]?.text==="*")de++;if(k[de]&&Ar.test(k[de].text)&&k[de].text!=="extends")X.add(k[de].text),F.push({name:k[de].text,token:de})}else if(le==="import"){let de=ee+1;if(k[de]?.text==="*"&&k[de+1]?.text==="as")de+=2;let pe=k[de]?.text;if(pe&&Ar.test(pe)&&pe!=="type"&&k[de+1]?.text!=="("&&k[de+1]?.text!==".")X.add(pe),F.push({name:pe,token:de,file:!0});let fe=k[de]?.text==="{"?de:k[de+1]?.text===","&&k[de+2]?.text==="{"?de+2:-1;if(fe!==-1&&R.has(fe)){let Pe=R.get(fe);for(let[ke,we]of z(fe+1,Pe)){let Me=we-1;while(Me>=ke&&!Ar.test(k[Me].text))Me--;if(Me>=ke&&k[Me].text!=="type")F.push({name:k[Me].text,token:Me,file:!0})}}}}return Rd=v,Zo={code:_,scopes:G,loops:ce,declarations:X,sites:F,tokens:k,pairs:R},Zo}function gc(v){let _=fc(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function Go(v){return new Set(fc(v).declarations)}function Nt(v,_){let{scopes:k,loops:R,sites:T,tokens:z,pairs:F}=fc(v),V=Array.from({length:z.length},()=>-1),H=[];for(let ce=0;ce<z.length;ce++){V[ce]=H.length?H[H.length-1]:-1;let ee=z[ce].text;if(ee==="{"&&F.has(ce))H.push(ce);else if(ee==="}"&&H.length&&F.get(ce)===H[H.length-1])H.pop()}let K=new Set,X=new Map;for(let ce of T){if(!_.has(ce.name))continue;K.add(ce.token);let ee=ce.file?-1:V[ce.token],le=ee===-1?[0,Number.POSITIVE_INFINITY]:[z[ee].start,z[F.get(ee)].end];if(ce.functionScoped){let de=z[ce.token].start,pe=k.filter((fe)=>fe.functionBody&&de>=fe.bodyStart&&de<fe.end).sort((fe,Pe)=>fe.end-fe.bodyStart-(Pe.end-Pe.bodyStart))[0];le=pe?[pe.bodyStart,pe.end]:[0,Number.POSITIVE_INFINITY]}else if(!ce.file){let de=R.filter((pe)=>ce.token>pe.headStart&&ce.token<pe.headEnd).sort((pe,fe)=>pe.headEnd-pe.headStart-(fe.headEnd-fe.headStart))[0];if(de)le=[de.start,de.end]}let ue=X.get(ce.name);if(ue)ue.push(le);else X.set(ce.name,[le])}let G=new Set;for(let ce=0;ce<z.length;ce++){if(z[ce].text!=="import"||z[ce-1]?.text===".")continue;let ee=ce+1;if(z[ee]?.text==="type")ee++;if(z[ee]&&Ar.test(z[ee].text)&&z[ee+1]?.text===",")ee+=2;if(z[ee]?.text==="{"&&F.has(ee))for(let le=ee+1;le<F.get(ee);le++)G.add(le)}let te=new Set;for(let ce=0;ce<z.length;ce++){let ee=z[ce].text;if(!_.has(ee)||te.has(ee)||K.has(ce)||G.has(ce))continue;let le=z[ce-1]?.text;if(le==="#"||le==="."&&z[ce-2]?.text!=="..")continue;if(z[ce+1]?.text===":"&&(le==="{"||le===","))continue;let ue=z[ce].start;if(X.get(ee)?.some(([de,pe])=>ue>=de&&ue<pe))continue;if(k.some((de)=>ue>=de.start&&ue<de.end&&de.names.has(ee)))continue;te.add(ee)}return te}import Jo from"fs";import en from"path";function mn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Id=new Map;function Yo(v,_=!0){let k=Id.get(v);if(_&&k)return k;let R=new Map,T=[en.join(v,"src"),en.join(v,"dist"),v];function z(F,V){if(V>6)return;let H;try{H=Jo.readdirSync(F,{withFileTypes:!0})}catch{return}for(let K of H){let X=en.join(F,K.name);if(K.isDirectory()){if(K.name==="node_modules"||K.name.startsWith("."))continue;z(X,V+1)}else if(K.isFile()&&K.name.endsWith(".stx")){let G=K.name.slice(0,-4);if(!R.has(G))R.set(G,X);let te=G.toLowerCase();if(!R.has(te))R.set(te,X);let ce=mn(G);if(!R.has(ce))R.set(ce,X)}}}for(let F of T)if(z(F,0),R.size>0)break;if(_)Id.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(Jo.statSync(R).isDirectory())return R}catch{}let T=en.dirname(k);if(T===k)return null;k=T}}function ea(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 Pd(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=mn(_);return[_,k,R]}function mc(v,_){let[k,R,T]=Pd(v);for(let z of[k,k.toLowerCase(),R,T]){let F=_?.__importedComponents?.get(z);if(F!==void 0)return F}}function*hc(v,_,k={},R){let T=Pd(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield en.resolve(en.dirname(_),`${T[0]}.stx`);return}let z=[...new Set(T.map((H)=>`${H}.stx`))],F=k.projectRoot||process.cwd(),V=[...R?.__originalFilePath?[en.join(en.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],en.join(en.dirname(_),"components"),en.resolve(F,"src/components"),en.resolve(F,"components"),...import.meta.dir?[en.resolve(import.meta.dir,"components")]:[]];for(let H of new Set(V)){for(let K of z)yield en.join(H,K);try{for(let K of Jo.readdirSync(H,{withFileTypes:!0}))if(K.isDirectory())for(let X of z)yield en.join(H,K.name,X)}catch{}}}function Dd(v,_,k={},R){let T=mc(v,R);if(T!==void 0)return T;for(let z of hc(v,_,k,R))try{if(Jo.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return null}import Hu from"fs";import gt from"path";import{createHash as ay}from"crypto";var aa="__stx_component_client_factories";function ca(v){let _=v[aa];return _ instanceof Map?_:null}function Md(v){v[aa]=new Map}function yc(v,_){let k=ca(v);if(!k)return null;let R=ay("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 jd(v,_){let k=ca(_);if(!k?.size)return v;let R=new Map;for(let[X,G]of k)if(G.instances===1)R.set(X,G.body);let T=[];if(R.size>0){let X=[...R.keys()].map((ce)=>JSON.stringify(ce).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),G=new RegExp(`window\\.__stxComponentFactories\\[(${X})\\]\\(("[^"]+")\\);`,"g"),te=G.exec(v);while(te!==null){let ce=R.get(JSON.parse(te[1]));if(ce!==void 0)T.push({start:te.index,end:te.index+te[0].length,replacement:`(${ce})(${te[2]});`});te=G.exec(v)}}let z=[...k].filter(([,X])=>X.instances>1);if(z.length===0)return Od(v,T);let V=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
116
+ (function() {
117
+ const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
118
+ ${z.map(([X,G])=>` try { factories[${JSON.stringify(X)}] = factories[${JSON.stringify(X)}] || ${G.body}; }
119
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(X)} + ' 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),K=H<0?0:H;return T.push({start:K,end:K,replacement:`${V}
123
+ `}),Od(v,T)}function Od(v,_){if(_.length===0)return v;_.sort((z,F)=>z.start-F.start||z.end-F.end);let k=Array(_.length*2+1),R=0,T=0;for(let z of _)k[T++]=v.slice(R,z.start),k[T++]=z.replacement,R=z.end;return k[T]=v.slice(R),k.join("")}function Nd(v){let _=ca(v),k=new Map;if(_)for(let[R,T]of _)k.set(R,T.instances);return k}function Ld(v,_){let k=ca(v);if(!k)return[];let R=[];for(let[T,z]of k){let F=z.instances-(_.get(T)??0);if(F>0)R.push({body:z.body,count:F})}return R}function Bd(v,_){for(let{body:k,count:R}of _)for(let T=0;T<R;T++)yc(v,k)}import Yd from"fs";var zd=0,xc=new Map;function gi(){zd=0,xc.clear()}function la(v,_){let k=zd++,R=`<!--__STX_${v.toUpperCase()}_${k}__-->`;return xc.set(R,{type:v,expression:_}),R}function mi(){let v={};for(let[_,k]of xc)v[_]={type:k.type,expression:k.expression};return v}function hi(v,_){let k=v;for(let[R,T]of _)k=k.split(R).join(T);return k}function xs(v){return v.includes("<!--__STX_")}var cy=/@(?=[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 ly(v){return Array.from({length:v},()=>"&#123;").join("&#8288;")}function Wd(v){return v.replace(/\{{2,}/g,(_)=>ly(_.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(cy,"&#64;")}function Fd(v,_,k=!1){let R=v.slice(0,_),T=R.lastIndexOf("<"),z=R.lastIndexOf(">");if(T>=0&&z>T)return null;if(T<0&&!k)return null;let F=T>=0?R.slice(T+1):R;if(T>=0&&/^\s*[!/?]/.test(F))return/^\s*\/?\s*$/.test(F)?{kind:"tag-name"}:null;if(T>=0&&/^\s*$/.test(F))return{kind:"tag-name"};let V=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*"([^"]*)$/.exec(F);if(V)return{kind:"attribute",name:V[1],quote:'"',valuePrefix:V[2]};let H=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*'([^']*)$/.exec(F);if(H)return{kind:"attribute",name:H[1],quote:"'",valuePrefix:H[2]};let K=/(?:^|\s)([^\s"'<>/=]+)\s*=\s*([^\s"'=<>`]*)$/.exec(F);if(K)return{kind:"attribute",name:K[1],quote:null,valuePrefix:K[2]};return T>=0||/^\s*[^<>]*$/.test(F)?{kind:"tag"}:null}class tr extends Error{attribute;constructor(v,_){super(`Unsafe interpolation in ${v}: ${_}`);this.name="UnsafeInterpolationContextError",this.attribute=v}}var Vd="unsafe:";var uy=/^(?:javascript|vbscript|livescript|mocha|view-source):/,dy=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,py=/^data:(?:text\/html|application\/xhtml\+xml)/,fy=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function gy(v){return v.replace(fy,"").toLowerCase()}function bc(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 ua(v,_="navigable"){let k=gy(v);if(uy.test(k))return!0;return _==="navigable"?dy.test(k):py.test(k)}function Ui(v,_="navigable"){return ua(v,_)?"unsafe:"+v:v}function my(v){let _=v.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!_)return null;if(_[3].trim()!=="")return null;return bc(_[1])}function Ud(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 Hd(v,_,k=_){let R=my(v);return R&&ua(_,R)?"unsafe:"+k:k}var da=/<script\b[^>]*>/iy,kc=/<\/script\s*>/ig,pa=/<style\b[^>]*>/iy,Cc=/<\/style\s*>/ig;function qd(v,_,k,R){k.lastIndex=_;let T=k.exec(v);if(!T||T.index!==_)return-1;R.lastIndex=k.lastIndex;let z=R.exec(v);if(!z)return-1;return z.index+z[0].length}function U(v,_){return qd(v,_,da,kc)}function ds(v,_){return qd(v,_,pa,Cc)}function Xe(v,_){if(!v.startsWith("<!--",_))return-1;let k=v.indexOf("-->",_+4);if(k===-1)return-1;return k+3}function Kd(v,_){if(v.startsWith("<!--",_)){let T=Xe(v,_);return T===-1?v.length:T}if(da.lastIndex=_,da.exec(v)?.index===_){kc.lastIndex=da.lastIndex;let T=kc.exec(v);return T?T.index+T[0].length:v.length}if(pa.lastIndex=_,pa.exec(v)?.index===_){Cc.lastIndex=pa.lastIndex;let T=Cc.exec(v);return T?T.index+T[0].length:v.length}return-1}function ne(v,_){let k=[],R=0,T=v.length,z=!1,F=null;while(R<T){let V=v[R];if(z){if(F){if(V===F)F=null}else if(V==='"'||V==="'")F=V;else if(V===">")z=!1;R++;continue}if(V!=="<"){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 K=Kd(v,R);if(K>R){R=K;continue}let X=v.charCodeAt(R+1);if(X>=65&&X<=90||X>=97&&X<=122)z=!0;R++}return k}function Xd(v){let _=0,k=0,R=0,T=!1,z=null;while(R<v.length){if(T){let G=v[R];if(z){if(G===z)z=null}else if(G==='"'||G==="'")z=G;else if(G===">")T=!1;R++;continue}let F=v.indexOf("<",R),V=F===-1?v.length:F;while(R<V){let G=v[R++];if(G==="{")_++;else if(G==="}")k++;if(_>=2&&k>=2)return!0}if(F===-1)break;let H=Kd(v,F);if(H>F){R=H;continue}let K=v.charCodeAt(F+1),X=K===47?v.charCodeAt(F+2):K;if(X>=65&&X<=90||X>=97&&X<=122)T=!0;R=F+1}return!1}function Zd(v,_){while(v.size>=_){let k=v.keys().next();if(k.done)return;v.delete(k.value)}}var hy=1024,yy=16777216,ls=new Map,wc=0;function xy(v,_){ls.set(v,_),wc+=v.length+_.output.length;for(let[k,R]of ls){if(wc<=yy)break;ls.delete(k),wc-=k.length+R.output.length}}function qn(v,_,k,R){let T=R!==void 0&&v.length>=hy,z=T?`${R}\x00${v}`:"";if(T){let X=ls.get(z);if(X)return ls.delete(z),ls.set(z,X),{output:X.output,tokens:X.tokens.slice()}}let F=ne(v,_);if(F.length===0)return{output:v,tokens:[]};let V=F.map((X)=>X.token),H="",K=0;for(let X=0;X<F.length;X++){let G=F[X];H+=v.slice(K,G.start),H+=k(G.token,X),K=G.end}if(H+=v.slice(K),T)return xy(z,{output:H,tokens:V}),{output:H,tokens:V.slice()};return{output:H,tokens:V}}var by=1024,wy=16777216,us=new Map,vc=0;function vy(v,_){us.set(v,_),vc+=v.length+_.output.length;for(let[k,R]of us){if(vc<=wy)break;us.delete(k),vc-=k.length+R.output.length}}function Sc(v,_,k){return{output:_,scripts:k,restore:(R)=>R===_?v:ps(R,k)}}function Dn(v){let _=v.length>=by;if(_){let T=us.get(v);if(T)return us.delete(v),us.set(v,T),Sc(v,T.output,T.scripts.slice())}let{output:k,tokens:R}=qn(v,U,(T,z)=>`\x00STX_SCRIPT_${z}\x00`);if(_)return vy(v,{output:k,scripts:R}),Sc(v,k,R.slice());return Sc(v,k,R)}function ps(v,_){if(_.length===0)return v;return v.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(k,R)=>_[+R]??"")}function Mt(v){let _=v.indexOf(" as ");if(_!==-1){let z=v.slice(0,_).trim(),F=v.slice(_+4).trim();return z&&F?{arrayExpr:z,itemVar:F}: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 fa(v){let _=[],k=0,R="",T=0;for(let z=0;z<v.length;z++){let F=v[z];if(R){if(F==="\\")z++;else if(F===R)R="";continue}if(F==="'"||F==='"'||F==="`")R=F;else if(F==="("||F==="["||F==="{")k++;else if(F===")"||F==="]"||F==="}")k--;else if(F===","&&k===0)_.push(v.slice(T,z)),T=z+1}return _.push(v.slice(T)),_}function Gd(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 Jd(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 qr(v,_){let k=v.trim().replace(/^\.\.\./,"").trim(),R=Gd(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 fa(k.slice(1,-1))){let z=T.trim();if(!z)continue;if(z.startsWith("...")){qr(z,_);continue}let F=Gd(z,":");qr(F===-1?z:z.slice(F+1),_)}return}if(k.startsWith("[")&&k.endsWith("]")){for(let T of fa(k.slice(1,-1)))qr(T,_);return}if(/^[A-Z_$][\w$]*$/i.test(k))_.push(k)}function Kr(v){let _=v.trim(),k=[],R=0;for(let z=0;z<_.length;z++){let F=_[z];if(F==="("||F==="["||F==="{")R++;else if(F===")"||F==="]"||F==="}")R--;else if(R===0&&/\s/.test(F)){if(!/^\s+(?:in|of)\s/.exec(_.slice(z)))continue;let H=_.slice(0,z).trim();if(H.startsWith("(")&&Jd(H)===H.length-1)H=H.slice(1,-1);for(let K of fa(H))qr(K,k);if(k.length>0)return k;break}}let T=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(_);if(T){let z=T[1].trim();if(z.startsWith("(")&&Jd(z)===z.length-1)z=z.slice(1,-1);let F=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(z);if(F)qr(F[2],k),qr(F[1],k);else for(let V of fa(z))qr(V,k)}return k}function re(v,_){let k=_ instanceof Set?_:new Set(_);if(k.size===0)return!1;let F=v.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let V of F.match(/[a-zA-Z_$][\w$]*/g)||[])if(k.has(V))return!0;return!1}var ga="__stx_client_loop_names";function Ir(v){let _=v?.[ga];return Array.isArray(_)?_:[]}function ma(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 z=T[0];if(/^<\/template\s*>$/i.test(z)){let F=k.pop();if(F)F.end=T.index}else if(/^<template\b/i.test(z)&&!/\/\s*>$/.test(z)){let V=[...z.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((X)=>/^(?:#[\w-]+|v-slot:[\w-]+)$/i.test(X[1])),H=(V?.[2]??V?.[3])?.trim(),K=H?{start:T.index+z.length,end:v.length,binding:H}:void 0;if(k.push(K),K)_.push(K)}}return _}var ao={},Qd=new Map;function Sy(v){let _=Qd.get(v);if(!_){let k=v.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");_=new RegExp(`:${k}(?!\\w)`,"g"),Qd.set(v,_)}return _.lastIndex=0,_}var ar={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 Lt(String(v))},translate:(v,_,k={})=>{if(!_||!_.__translations)return v;let R=_.__translations,T=_.__i18nConfig?.fallbackToKey??!0,z=String(v).split("."),F=R;for(let H of z){if(F===void 0||F===null)break;F=F[H]}if(F===void 0||F===null)return T?v:"";let V=String(F);return Object.entries(k).forEach(([H,K])=>{V=V.replace(Sy(H),String(K))}),V},t:(v,_,k={})=>ar.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 z={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,z[k]||z.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 z=R||`${k}s`;return T===1?k:z},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 Ec(v,_){if(v in ar)console.warn(`Filter "${v}" already exists as a built-in filter. Custom filter will take precedence.`);ao[v]=_}function td(v){for(let[_,k]of Object.entries(v))Ec(_,k)}function Tc(){return{...ar,...ao}}function nd(){for(let v of Object.keys(ao))delete ao[v]}function $c(v,_,k=2){let R=0,T=null;for(let z=_+k;z<v.length;z++){let F=v[z];if(T){if(F==="\\"){z++;continue}if(F===T)T=null;continue}if(F==='"'||F==="'"||F==="`"){T=F;continue}if(F==="{"){R++;continue}if(F==="}"){if(R>0){R--;continue}let V=0;while(v[z+V]==="}")V++;if(V>=k)return z}}return-1}function cr(v,_,k=2){let R="{".repeat(k);if(!v.includes(R))return v;let T="",z=0;for(;;){let F=v.indexOf(R,z);if(F===-1)break;let V=$c(v,F,k);if(V===-1)break;T+=v.slice(z,F)+_(v.slice(F,V+k),v.slice(F+k,V),F),z=V+k}return z===0?v:T+v.slice(z)}function b(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Lt(v){return Wd(b(v))}function $y(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 _y(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 ky(v,_){let k=_y(v);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(k))throw new tr(_,"network-capable or executable CSS is not allowed in an escaped interpolation");let R=/url\(([^)]*)\)/g,T;while((T=R.exec(k))!==null){let z=T[1].replace(/^["']|["']$/g,""),F=z.startsWith("/")&&!z.startsWith("//")||z.startsWith("./")||z.startsWith("../")||z.startsWith("#"),V=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(z);if(!F&&!V)throw new tr(_,"CSS URLs must be local paths or base64 raster images")}}function ip(v,_,k,R=!1,T=0){let z=Fd(v,_,R),F=Lt(k);if(!z)return F;if(z.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(k))throw new tr("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return k}if(z.kind==="tag"){let K=v.slice(_+T).trimStart(),X=k.trim();if(!K.startsWith("=")&&(X===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(X)))return X;throw new tr("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let V=z.name.toLowerCase();if(/^on[a-z]/.test(V))throw new tr(z.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(V==="srcdoc")F=Lt(F);if(V==="style")ky(k,z.name);if(z.quote===null)F=$y(F);let H=bc(V);if(H&&z.valuePrefix.trim()===""&&ua(k,H))return Vd+F;return Hd(Ud(v,_),k,F)}function op(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 Ee(v,_){let{scripts:k}=Dn(v);for(let R of op(k)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(R))return!0;if(zn(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 Rc(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(),z=new Set(Kr(R[3]));if(z.size===0)continue;let F=R.index+R[0].length;if(R[0].endsWith("/>")){_.push({start:R.index,end:F,names:z});continue}let V=new RegExp(`<(/?)${T}\\b[^>]*?(/?)>`,"gi");V.lastIndex=F;let H=1,K=v.length;for(let X=V.exec(v);X;X=V.exec(v)){if(X[2]==="/")continue;if(H+=X[1]==="/"?-1:1,H===0){K=X.index+X[0].length;break}}_.push({start:R.index,end:K,names:z})}return _}function ep(v,_,k){let R=s(k);for(let T of v){if(_<T.start||_>=T.end)continue;for(let z of T.names)if(new RegExp(`(?<![.#\\w$])${z.replace(/\$/g,"\\$")}(?![\\w$])`).test(R))return!0}return!1}function tp(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="",z=!1,F=0;for(let K=0;K<R.length;K++){let X=R[K];if(!z&&X==="`"){z=!0,F=0;continue}if(z){if(X==="`"&&F===0){z=!1;continue}if(X==="$"&&R[K+1]==="{"){F++,K++,T+=" ";continue}if(X==="}"&&F>0){F--;continue}if(F>0){T+=X;continue}continue}T+=X}R=T;let V=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,H;while((H=V.exec(R))!==null){let K=H[1];if(!R.substring(0,H.index).trimEnd().endsWith(".")){if(!k.includes(K)&&!(K in _))return!1}}return!0}function Ey(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 np=new Set;function rp(v){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(v.trim())}function sp(v,_){let k=`${_??"<unknown>"}\x00${v}`;if(process.env.STX_DEBUG||!np.has(k))np.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 Ss(v,_,k){let R=v;return R=R.replace(/\{!!([\s\S]*?)!!\}/g,(T,z)=>{try{let F=x(z,_);if(F===void 0)return rp(z)?sp(z.trim(),k):T;return F===null?"":String(F)}catch{return T}}),R=cr(R,(T,z,F)=>{let V=z.trim();if(/^__[A-Z_]+__$/.test(V))return T;try{let H=x(z,_);if(H===void 0)return rp(V)?sp(V,k):T;return JSON.stringify(H).replace(/</g,"\\u003c")}catch{return T}}),R}function Ac(v,_){if(!v.includes("{"))return v;let k=v;return k=k.replace(/\{!!([\s\S]*?)!!\}/g,(R,T)=>{try{let z=x(T,_);if(z===void 0)return R;return z===null?"":String(z)}catch{return R}}),k=cr(k,(R,T,z)=>{let F=T.trim();if(/^__[A-Z_]+__$/.test(F))return R;try{let V=x(T,_);if(V===void 0)return R;if(V===null)return"";let H=String(V);return ip(k,z,H,!0,R.length)}catch(V){if(V instanceof tr)throw V;return R}}),k}function rd(v,_,k={}){let{output:R,scripts:T}=Dn(v),z=T.map((F)=>{let V=F.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),H=F.match(/^<script\b[^>]*>/i),K=F.search(/<\/script\s*>$/i);if(!V||!H||K===-1)return F;let X=V[1],G=V[2];if(/\bdata-raw\b/.test(X))return F;if(k.skipServer&&/\bserver\b/.test(X))return F;let ce=`<script${Ac(X,_)}>`;if(/\bsrc\s*=/.test(X)||/\btype\s*=\s*["']application\/json["']/.test(X))return ce+G+F.slice(K);return ce+Ss(G,_)+F.slice(K)});return ps(R,z)}function Z(v,_,k){let R=v,T=(ee,le)=>{let ue=ds(ee,le);if(ue===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(ee.slice(le,ue))?-1:ue},z=(ee,le,ue,de)=>{let pe=ue.length,{output:fe,tokens:Pe}=qn(ee,le,(ke,we)=>de(pe+we));return ue.push(...Pe),fe},F=[];R=z(R,T,F,(ee)=>`<!--__STX_STYLE_${ee}__-->`);let V=[];R=z(R,U,V,(ee)=>`<!--__STX_SCRIPT_EXPR_${ee}__-->`);let H=_?.__stx_signals_gate===!0||Ee(v),K=new Set([...Array.isArray(_?.__stx_client_signal_names)?_.__stx_client_signal_names:[],...Vs(op(V))]),X=new Set(Array.isArray(_?.__stx_preserved_client_expressions)?_.__stx_preserved_client_expressions:[]);R=cr(R,(ee,le,ue)=>{try{let de=x(le,_,!1,(pe)=>al(pe,ee,k,v));return de!==void 0&&de!==null?String(de):""}catch(de){let pe=de instanceof Error?de.message:String(de);return g("Expression",`Error evaluating: {{{ ${le.trim()}}}}: ${pe}`,k,v,ue,ee)}},3),R=R.replace(/\{!!([\s\S]*?)!!\}/g,(ee,le,ue)=>{try{let de=x(le,_,!1,(pe)=>al(pe,ee,k,v));if(de===void 0&&_.__stx_buildMode==="compile")return la("raw",le.trim());return de!==void 0&&de!==null?String(de):""}catch(de){if(_.__stx_buildMode==="compile")return la("raw",le.trim());let pe=de instanceof Error?de.message:String(de);return g("Expression",`Error evaluating: {!! ${le.trim()} !!}: ${pe}`,k,v,ue,ee)}}),R=z(R,U,V,(ee)=>`<!--__STX_SCRIPT_EXPR_${ee}__-->`),R=z(R,T,F,(ee)=>`<!--__STX_STYLE_${ee}__-->`);let G=H?Rc(R):[],te=ma(R).map((ee)=>({...ee,names:new Set(Kr(`${ee.binding} in __slot`))})),ce=new Set(Ir(_));if(R=cr(R,(ee,le,ue)=>{let de=le.trim();if(ep(te,ue,de))return ee;if(re(de,ce))return ee;if(G.length>0&&ep(G,ue,de))return ee;if(X.has(de))return ee;let pe=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],fe=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ke=de.match(fe)?.[1],we=ke&&((ke in _)||pe.includes(ke)),Me=Boolean(ke&&K.has(ke)),Ne=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,Le=de.match(Ne),Be=Le&&!pe.includes(Le[1])&&!(Le[1]in _);if(/^__[A-Z_]+__$/.test(de))return"";if(Me)return ee;let ze;try{let je=x(le,_,!1,(Ve)=>{ze=Ve});if(H&&!tp(de,_))return ee;if(ze)al(ze,ee,k,v);if(_.__stx_buildMode==="compile"&&!H&&(je===void 0||Ey(de,_)))return la("expr",de);if(je===void 0||je===null)return"";let Fe=String(je);return ip(R,ue,Fe,!1,ee.length)}catch(je){if(je instanceof tr)throw je;if(H&&!tp(de,_))return ee;if(Be)return ee;let Fe=je instanceof Error?je.message:String(je);return g("Expression",`Error evaluating: {{ ${de} }}: ${Fe}`,k,v,ue,ee)}}),V.length>0)R=R.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(ee,le)=>V[Number(le)]??ee);if(F.length>0)R=R.replace(/<!--__STX_STYLE_(\d+)__-->/g,(ee,le)=>F[Number(le)]??ee);return R}function Pc(v,_,k){if(!_.trim())return v;let R=v,T=_.trim();while(T.length>0){let z=T.match(/^(\w+)/);if(!z)break;let F=z[1];T=T.substring(F.length).trim();let V=ao[F]||ar[F];if(!V)throw Error(`Filter not found: ${F}. Available filters: ${Object.keys(Tc()).join(", ")}`);let H=[];if(T.startsWith(":")){let K=T.match(/^:([^|\s]+)/);if(K){let X=K[1].trim();try{let G=Number(X);H=[Number.isNaN(G)?X:G]}catch{H=[X]}T=T.substring(K[0].length).trim()}}else if(T.startsWith("(")){let K=1,X=1;while(K>0&&X<T.length){if(T[X]==="(")K++;if(T[X]===")")K--;X++}if(K===0){let G=T.substring(1,X-1).trim();if(G)try{if(G.startsWith("{")&&G.endsWith("}"))H=[x(`(${G})`,k,!0)];else{let te=[],ce="",ee=null,le=0,ue=0,de=0,pe=!1;for(let fe=0;fe<G.length;fe++){let Pe=G[fe];if(pe){ce+=Pe,pe=!1;continue}if(Pe==="\\"){ce+=Pe,pe=!0;continue}if(ee){if(ce+=Pe,Pe===ee)ee=null;continue}if(Pe==='"'||Pe==="'"||Pe==="`"){ee=Pe,ce+=Pe;continue}if(Pe==="(")le++;else if(Pe===")")le--;else if(Pe==="[")ue++;else if(Pe==="]")ue--;else if(Pe==="{")de++;else if(Pe==="}")de--;if(Pe===","&&le===0&&ue===0&&de===0){te.push(ce),ce="";continue}ce+=Pe}if(ce)te.push(ce);H=te.map((fe)=>{let Pe=fe.trim();return x(Pe,k,!0)})}}catch{H=[G]}T=T.substring(X).trim()}}try{R=V(R,k,...H)}catch(K){let X=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${F}': ${X}`)}if(T.startsWith("|"))T=T.substring(1).trim();else break}return R}function Cy(v){let _=!1,k="",R=0,T=0,z=0,F=!1;for(let V=0;V<v.length;V++){let H=v[V],K=v[V+1];if(_&&F){F=!1;continue}if(_&&H==="\\"){F=!0;continue}if(F=!1,(H==='"'||H==="'"||H==="`")&&!F){if(!_)_=!0,k=H;else if(H===k)_=!1,k="";continue}if(_&&k==="`"&&H==="$"&&K==="{"){let X=1;V+=2;while(V<v.length&&X>0){if(v[V]==="{")X++;else if(v[V]==="}")X--;if(X>0)V++}continue}if(_)continue;if(H==="(")R++;else if(H===")")R--;else if(H==="[")T++;else if(H==="]")T--;else if(H==="{")z++;else if(H==="}")z--;if(H==="|"&&R===0&&T===0&&z===0){if(K==="|"){V++;continue}if(K==="="){V++;continue}return V}}return-1}var Gi=new Set,Ry=1000;function sd(){Gi.clear()}function al(v,_,k,R){if(!D())return;let T=`${k}\x00${v.expression}`;if(Gi.has(T))return;if(Gi.size>=Ry)Gi.clear();Gi.add(T);let z=k,F=R;try{if(k&&Yd.existsSync(k))F=Yd.readFileSync(k,"utf8")}catch{}let V=F.indexOf(_);if(V>=0)z=`${k}:${F.slice(0,V).split(`
124
+ `).length}`;console.warn(`${z}: 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(),z=Cy(T);if(z>0){let V=T.substring(0,z).trim(),H=T.substring(z+1).trim(),K=x(V,_,!0,R);return Pc(K,H,_)}let F=jn(T);if(F!==null){R?.({expression:T,rule:F});return}try{let V=Object.keys(_),H=Object.values(_);return c(T,V)(...H)}catch{return l(T,_)}}catch(T){if(T instanceof ReferenceError){let z=/(\b\w+)\s+is not defined/.exec(T.message);if(z){let F=z[1],V=Ay(F,Object.keys(_));if(V&&V!==F)T.message=`${T.message} \u2014 did you mean '${V}'?`}}if(!k)console.error(`Error evaluating expression: ${v}`,T);throw T}}function Ay(v,_){let k=null;for(let T of _){if(T===v)continue;let z=Ty(v,T);if(k===null||z<k.dist)k={key:T,dist:z}}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 Ty(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),z=Array(k.length+1);for(let F=0;F<=k.length;F++)T[F]=F;for(let F=1;F<=R.length;F++){z[0]=F;for(let V=1;V<=k.length;V++){let H=k[V-1]===R[F-1]?0:1;z[V]=Math.min(z[V-1]+1,T[V]+1,T[V-1]+H)}for(let V=0;V<=k.length;V++)T[V]=z[V]}return T[k.length]}function od(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 lp from"fs";class L{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 fs=new Map,Iy=500;function Xr(v,_){if(_?.includes("g"))return new RegExp(v,_);let k=`${v}:${_||""}`;if(!fs.has(k)){if(fs.size>=Iy){let R=fs.keys().next().value;if(R)fs.delete(R)}fs.set(k,new RegExp(v,_))}return fs.get(k)}class ap{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(v){let _=Array.from(new Set(v)),k=_.sort().join(","),R=this.pool.find((V)=>V.context.join(",")===k);if(R)return R.func;let T=this.fnCache,z=this.fnCacheMaxSize,F=(...V)=>(H)=>{try{let K=`${k}:${H}`,X=T.get(K);if(!X){if(T.size>=z){let G=T.keys().next().value;if(G)T.delete(G)}X=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(K,X)}return X(...V)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:F,context:_.slice()});return F}clear(){this.pool.length=0,this.fnCache.clear()}}var B$=new ap;class cp{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,z=_>=k.maxTime;if(!T&&!z)return;let F={label:v,actualTime:_,budgetTime:k.maxTime,exceedancePercent:R,timestamp:new Date,isWarning:T};this.violations.push(F);while(this.violations.length>this.maxViolations)this.violations.shift();for(let H of this.violationHandlers)try{H(F)}catch{}let V=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(V);break;case"warn":console.warn(V);break;case"error":console.error(V);break;case"throw":if(z)throw Error(V);else console.warn(V);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 cl=null;function Py(){if(!cl)cl=new cp;return cl}var J=new Proxy({},{get(v,_){return Py()[_]}});var up=[];function m(v){let _=new L(v);return up.push(_),_}function dp(){for(let v of up)v.clear()}function h(v,..._){return`${_.map((k)=>String(k??"")).join("\x00")}\x00${v.length}\x00${Bun.hash(v)}`}function vn(v){let _=[];for(let k of new Set(v))try{_.push({path:k,mtimeMs:lp.statSync(k).mtimeMs})}catch{}return _}function ir(v){for(let _ of v)try{if(lp.statSync(_.path).mtimeMs!==_.mtimeMs)return!1}catch{return!1}return!0}import QS from"fs";import fn from"path";import uo from"fs";import Xt from"path";import{hasLocalConfig as jp}from"bunfig";import Kn from"fs";import Zr from"path";import ll from"fs";import pp from"path";import{fileURLToPath as Dy}from"url";var ul;function Ke(){if(ul)return ul;let v="unknown";try{v=String(JSON.parse(ll.readFileSync(new URL("../package.json",import.meta.url),"utf8")).version)}catch{}if(import.meta.url.endsWith(".ts"))try{let _=pp.dirname(Dy(import.meta.url)),k=0;for(let R of ll.readdirSync(_,{recursive:!0,withFileTypes:!0}))if(R.isFile()&&R.name.endsWith(".ts"))k=Math.max(k,ll.statSync(pp.join(R.parentPath,R.name)).mtimeMs);v+=`+src.${Math.trunc(k)}`}catch{}return ul=v,v}var Ic=new Map,Gr=new Map;async function id(v){let k;for(let R=0;R<3;R++)try{let z=(await Kn.promises.stat(v)).mtime.getTime(),F=Gr.get(v);if(F&&F.mtime===z)return F.content;let V=await Bun.file(v).text(),K=(await Kn.promises.stat(v)).mtime.getTime();if(K!==z)continue;return Gr.set(v,{content:V,mtime:K}),V}catch(T){k=T;break}throw Gr.delete(v),Error(`File not found: ${v}${k?` (${k.message})`:""}`)}function ad(v){Gr.delete(v)}function cd(v){for(let _ of Gr.keys())if(_.startsWith(v))Gr.delete(_)}var ya=null,Oy=null,gp=null;function ld(v){gp=v}async function Oc(v=!1){let _=gp??await import("./chunk-4b4es5wg.js");if(v)return _.generateSignalsRuntimeDev();if(ya===null)ya=_.generateSignalsRuntime();return ya}var xa=null;async function Nc(){if(xa===null){let{getRouterScript:v}=await import("./chunk-b7fp3zta.js");xa=v()}return xa}var fp={};async function ud(v,_=!1){let k=v==="runtime"?await Oc(_):await Nc(),R=v==="runtime"&&_?"runtime-debug":v,T=fp[R];if(!T||T.content!==k)T={content:k,hash:Bun.hash(k).toString(16).padStart(16,"0").slice(0,16)},fp[R]=T;return{content:k,hash:T.hash,url:`/_stx/${v}.${T.hash}.js`}}var My=500,jy=33554432,nr=new Map,ha=0;function mp(v){return a(process.cwd(),"module-bundles",`${v}.js`)}function dd(v){let _=Bun.hash(v).toString(16).padStart(16,"0").slice(0,16),k=nr.get(_),R=k!==void 0;if(R)nr.delete(_),ha-=k.length*2;nr.set(_,v),ha+=v.length*2;while(nr.size>1&&(nr.size>My||ha>jy)){let T=nr.keys().next().value;ha-=nr.get(T).length*2,nr.delete(T)}if(!R)try{let T=mp(_);if(!Kn.existsSync(T))Kn.mkdirSync(Zr.dirname(T),{recursive:!0}),Kn.writeFileSync(T,v)}catch{}return`/_stx/modules.${_}.js`}function yi(v){if(!/^[0-9a-f]{16}$/.test(v))return;let _=nr.get(v);if(_!==void 0)return _;try{return Kn.readFileSync(mp(v),"utf8")}catch{return}}function pd(){Gr.clear(),ie(),dp(),ya=null,Oy=null,xa=null}function hp(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 xn(v,_){try{if(!_.cachePath)return null;let k=Zr.resolve(_.cachePath),R=Zr.join(k,`${lr(v)}.html`),T=Zr.join(k,`${lr(v)}.meta.json`);if(!await r(R)||!await r(T))return null;let z=await Bun.file(T).text(),F=JSON.parse(z);if(F.cacheVersion!==_.cacheVersion)return null;if(F.engine!==Ke())return null;if(F.optionsSignature!==hp(_))return null;if((await Kn.promises.stat(v)).mtime.getTime()>F.mtime)return null;for(let H of F.dependencies)if(await r(H)){if((await Kn.promises.stat(H)).mtime.getTime()>F.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 Sn(v,_,k,R){try{if(!R.cachePath)return;let T=Zr.resolve(R.cachePath);await Kn.promises.mkdir(T,{recursive:!0});let z=Zr.join(T,`${lr(v)}.html`),F=Zr.join(T,`${lr(v)}.meta.json`),V=await Kn.promises.stat(v);await Bun.write(z,_);let H={sourcePath:v,mtime:V.mtime.getTime(),dependencies:Array.from(k),cacheVersion:R.cacheVersion,engine:Ke(),optionsSignature:hp(R),generatedAt:Date.now()};await Bun.write(F,JSON.stringify(H,null,2)),Ic.set(v,{output:_,mtime:V.mtime.getTime(),dependencies:k})}catch(T){console.warn(`Failed to cache template ${v}:`,T)}}var Ny=16;function lr(v){return new Bun.CryptoHasher("sha1").update(v).digest("hex").substring(0,Ny)}var Je={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 Te(v){return`--stx-${v}`}function ba(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 Ly=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function yp(v,_){let k=_.trim();return ba(v,k)??(Ly.test(k)?k:void 0)}function xp(v={}){return[...Object.keys(v.roles??{}).filter((_)=>!Je[_]).map((_)=>`roles.${_}`),...Object.keys(v.shapes??{}).filter((_)=>!se[_]).map((_)=>`shapes.${_}`),...Object.keys(v.density??{}).filter((_)=>!me[_]).map((_)=>`density.${_}`)]}function bp(v){let _={};for(let[k,R]of Object.entries(Je)){let T=ba(v,R.light);if(T===void 0)continue;_[k]=`var(${Te(k)}, ${T})`}return _}function wp(v,_={}){let k=[],R=[];for(let[T,z]of Object.entries(Je)){let F=_[T],V=typeof F==="string"?F:F?.light,H=typeof F==="string"?F:F?.dark,K=V&&yp(v,V)||ba(v,z.light),X=H&&yp(v,H)||ba(v,z.dark);if(K===void 0)continue;if(k.push(` ${Te(T)}: ${K};`),X!==void 0)R.push(` ${Te(T)}: ${X};`)}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 se={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 jt(v){return`--stx-radius-${v}`}function vp(){let v={};for(let[_,k]of Object.entries(se))v[_]=`var(${jt(_)}, ${k.value})`;return v}function Sp(v={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(se).map(([_,k])=>` ${jt(_)}: ${v[_]??k.value};`),"}",""].join(`
137
+ `)}var me={"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"}},kn={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},Cn={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function $e(v){return`--stx-${v}`}function dl(v){let _=me[v];if(!_)throw Error(`[stx] unknown density token "${v}"`);return`var(${$e(v)}, ${_.value})`}function $p(){let v={};for(let[_,k]of Object.entries(kn))v[_]=dl(k);return v}function _p(){let v={};for(let[_,{size:k,leading:R}]of Object.entries(Cn))v[_]=[dl(k),{lineHeight:dl(R)}];return v}function kp(v={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(me).map(([_,k])=>` ${$e(_)}: ${v[_]??k.value};`),"}",""].join(`
138
+ `)}function Ep(v){return typeof v==="object"&&v!==null&&!Array.isArray(v)}function pl(v,_){let k={...v};for(let[R,T]of Object.entries(_))k[R]=Ep(T)&&Ep(k[R])?pl(k[R],T):T;return k}function Cp(v,_){if(!_.fonts)return"";let k=new v({..._.config,fonts:_.fonts,cssVariables:!1}).toCSS(!1,_.minify);return k&&!_.minify?`${k}
139
+ `:k}function Rp(v={},_={}){let k=v.theme||{},R=_.theme||{},{extend:T,...z}=R,{extend:F,...V}=k,H=V.colors||{};V.colors={...H,...bp(H)};let K=V.borderRadius||{};V.borderRadius={...K,...vp()};let X=V.spacing||{};V.spacing={...X,...$p()};let G=V.fontSize||{};V.fontSize={...G,..._p()};let te=pl(V,z),ce=pl(F||{},T||{});if(Object.keys(ce).length>0)te.extend=ce;let ee=[...v.safelist||[],..._.safelist||[]],le={...v.shortcuts||{},..._.shortcuts||{}},ue=[...v.preflights||[],..._.preflights||[]],{fonts:de,...pe}=v,{fonts:fe,roles:Pe,shapes:ke,density:we,...Me}=_,Ne={roles:Pe,shapes:ke,density:we},Le=fe??de;return{config:{...pe,...Me,theme:te,safelist:ee,shortcuts:le,...ue.length>0?{preflights:ue}:{},content:[],output:""},safelist:ee,shortcuts:le,includePreflight:_.preflight!==!1,minify:_.minify===!0,tokenCSS:wp({...H,...te.colors},Pe)+Sp(ke)+kp(we),unknownRoles:xp(Ne),...Le?{fonts:Le}:{}}}function Ap(v,_=""){let k=`${v}${_}`,R=0;for(let T=0;T<k.length;T++){let z=k.charCodeAt(T);R=(R<<5)-R+z,R=R&R}return`stx-${Math.abs(R).toString(36)}`}function Tp(v,_,k={}){let{prefix:R="",preserveHost:T=!0,scopeKeyframes:z=!0,scopeCustomProperties:F=!1}=k;if(!v.trim())return"";let V=fl(v),H=[],K=new Map;if(z)for(let X of V){let G=X.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(G){let te=G[1],ce=`${_}_${te}`;K.set(te,ce)}}for(let X of V){let G=Ip(X,_,R,T,K,F);H.push(G)}return H.join(`
140
+
141
+ `)}function fl(v){let _=[],k=v.replace(/\/\*[\s\S]*?\*\//g,""),R=0,T="",z=!1,F="";for(let V=0;V<k.length;V++){let H=k[V];if(H==="@"&&R===0)z=!0;if(H==="{")R++;else if(H==="}"){if(R--,R===0){if(z){F+=H;let K=F.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(K){let[,X,G,te]=K;if(X==="keyframes")_.push({selector:`@keyframes ${G.trim()}`,declarations:te.trim()});else if(X==="media"||X==="supports"||X==="container"){let ce=fl(te);_.push({selector:`@${X} ${G.trim()}`,declarations:ce.map((ee)=>`${ee.selector} { ${ee.declarations} }`).join(`
142
+ `)})}else _.push({selector:`@${X} ${G.trim()}`,declarations:te.trim()})}F="",z=!1}else if(T.trim()){T+=H;let K=T.match(/([^{]+)\{([^}]*)\}/);if(K)_.push({selector:K[1].trim(),declarations:K[2].trim()});T=""}continue}}if(z)F+=H;else T+=H}return _}function Ip(v,_,k,R,T,z){let{selector:F,declarations:V}=v;if(F.startsWith("@")){if(F.startsWith("@keyframes")){let X=F.replace("@keyframes ","").trim();return`@keyframes ${T.get(X)||X} { ${V} }`}if(F.startsWith("@media")||F.startsWith("@supports")||F.startsWith("@container")){let G=fl(`x { ${V} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((te)=>Ip(te,_,k,R,T,z)).join(`
143
+ `);return`${F} {
144
+ ${G}
145
+ }`}return`${F} { ${V} }`}let H=By(F,_,k,R),K=V;for(let[X,G]of T)K=K.replace(new RegExp(`\\b${X}\\b`,"g"),G);if(z)K=K.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${H} { ${K} }`}function By(v,_,k,R){let T=v.split(",").map((F)=>F.trim()),z=[];for(let F of T){if(F.startsWith(":host")){if(R)z.push(F);else{let K=F.replace(/:host(\([^)]*\))?/,`.${_}$1`);z.push(K)}continue}if(F.includes("::slotted")){z.push(F);continue}if(F===":root"){z.push(`:root .${_}`);continue}let V=k?`${k} .${_}`:`.${_}`;z.push(`${V} ${F}`);let H=zy(F,_);if(H)z.push(k?`${k} ${H}`:H)}return z.join(", ")}function zy(v,_){let k=0,R=v.length;for(let H=0;H<v.length;H++){let K=v[H];if(K==="["||K==="(")k++;else if(K==="]"||K===")")k--;else if(k===0&&(K===" "||K===">"||K==="+"||K==="~")){R=H;break}}let T=v.slice(0,R),z=v.slice(R);if(!T)return"";let F=T.length,V=0;for(let H=0;H<T.length;H++){let K=T[H];if(K==="["||K==="(")V++;else if(K==="]"||K===")")V--;else if(k===0&&V===0&&K===":"){F=H;break}}return`${T.slice(0,F)}.${_}${T.slice(F)}${z}`}var Op=String.raw`(?<![\w-])scoped(?![\w-])`,gl=/<style\s+([^>]*)>/gi,Pp=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Mp=new RegExp(Op,"i"),Wy=new RegExp(Op,"gi"),ml=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Fy(v){gl.lastIndex=0;let _=gl.exec(v);while(_!==null){if(Mp.test(_[1]))return!0;_=gl.exec(v)}return!1}function hl(v){let _=new Set,k=[];ml.lastIndex=0;let R=ml.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=ml.exec(v)}return k}function co(v){let _=hl(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let z=_[T];k[T]=v.slice(R,z.start),R=z.end}return k[_.length]=v.slice(R),k.join("")}function wa(v,_){if(!Fy(v))return{html:v,hasScoped:!1};let k=Ap(_),R=`data-v-${k}`,T=v,z=!1;if(Pp.lastIndex=0,T=T.replace(Pp,(F,V,H)=>{if(!Mp.test(V))return F;z=!0;let K=Vy(H,R),X=V.replace(Wy,"").trim(),G=X?` ${X}`:"";return`<style data-stx-scoped="${k}"${G}>${K}</style>`}),!z)return{html:v,hasScoped:!1};return T=Hy(T,R),{html:T,hasScoped:!0}}function Vy(v,_){return Tp(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Uy=(v)=>`\x00stx-scope-mask-${v}\x00`,Dp=/\u0000stx-scope-mask-(\d+)\u0000/g;function Hy(v,_){let k=qn(v,(T,z)=>{let F=U(T,z);return F>z?F:ds(T,z)},(T,z)=>Uy(z)),R=qy(k.output,_);return Dp.lastIndex=0,R.replace(Dp,(T,z)=>k.tokens[Number(z)])}function qy(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,z)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(z)return R.replace(`<${T}${z}`,`<${T} ${_}${z}`);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 Xn=null,va="";function Np(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;va=`${_}@${Math.trunc(uo.statSync(_).mtimeMs)}`}catch{va=v}}var xl=!1,Jr=null,lo="",gs=!1,Wp=256,Pr=new Map,Zn=new Map,Sa=null,Fp=null,$a=new Map,Lp=new Set;function _a(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function yl(v,_){if(Pr.has(v))Pr.delete(v);else if(Pr.size>=Wp)Pr.delete(Pr.keys().next().value);Pr.set(v,_)}function Ky(v){let _=_a(v);if(Zn.has(_))Zn.delete(_);else if(Zn.size>=Wp)Zn.delete(Zn.keys().next().value);return Zn.set(_,v),_}function fd(v){let _=Zn.get(v);if(_===void 0)return;return Zn.delete(v),Zn.set(v,_),_}async function Xy(v,_=Sa){if(!_)return null;try{let k=Bun.file(Xt.join(_,`cw-${_a(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Zy(v,_,k=Sa){if(!k)return;try{if(!uo.existsSync(k))uo.mkdirSync(k,{recursive:!0});await Bun.write(Xt.join(k,`cw-${_a(v)}.css`),_)}catch{}}async function Bp(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Gy=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Jy=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Yy(){let v=[],_=process.cwd();while(_!==Xt.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Gy)v.push(Xt.join(_,k,...R));_=Xt.dirname(_)}return v}function Qy(){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 bi(){if(xl)return Xn;xl=!0;try{let v=async(T)=>{for(let z of T){if(!await Bun.file(z).exists())continue;let F=await Bp(z);if(F){if(Np(z),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Xt.dirname(Xt.dirname(z))}`);return F}}return null};if(process.env.CROSSWIND_SRC){let T=Xt.resolve(process.env.CROSSWIND_SRC),z=await v([T]);if(!z)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return Xn=z,Xn}let _=await v(Yy());if(_)return Xn=_,Xn;let k=Jy;for(let T of k){let z=await Bp(T);if(z){Xn=z;try{Np(import.meta.resolve(T))}catch{va=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return Xn}}let R=await v(Qy());if(R)return Xn=R,Xn;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 gd(){bl.clear(),Xn=null,xl=!1,Jr=null,lo="",Pr.clear(),Zn.clear(),Fp=null,$a.clear()}var zp=!1;async function vi(v){try{let _=jp({name:"css",cwd:v})?"css":jp({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!zp)zp=!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 Dc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-5k989nr4.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 z=await import(T);_=z.default||z,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 z=await import(T);_={...z.default||z,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await vi(v)}function Mc(v){try{let _=new WeakSet;return _a(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 Bt(v){if(gs)return lo;gs=!0;try{let _=await bi();if(!_||!_.build)return gs=!1,"";if(!Jr)Jr=await vi(v);if(!Jr)return gs=!1,"";let k=_.defaultConfig?.theme||{},R=Jr.theme||{},T={..._.defaultConfig,...Jr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},z=performance.now(),F=await _.build(T),V=performance.now()-z;if(lo=F.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${F.classes.size} classes in ${V.toFixed(1)}ms`),T.output){let H=Xt.isAbsolute(T.output)?T.output:Xt.join(v,T.output),K=Xt.dirname(H);if(!uo.existsSync(K))uo.mkdirSync(K,{recursive:!0});await Bun.write(H,F.css)}return gs=!1,F.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),gs=!1,lo}}async function _n(v){Jr=null,await Bt(v)}function md(){return lo}function Lc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let F of R[1].split(/\s+/))if(F.trim())_.add(F.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,z=T.exec(v);while(z!==null){let F=z[1].match(/'([^']+)'/g);if(F){for(let V of F)for(let H of V.slice(1,-1).split(/\s+/))if(H.trim())_.add(H.trim())}z=T.exec(v)}return _}var bl=m(64);async function jc(v,_){let k=()=>$a.get(_?Xt.resolve(_):process.cwd())?.fingerprint??null,R=bl.get(h(v,_,k()));if(R!==void 0)return R;let T=await ex(v,_);if(T)bl.set(h(v,_,k()),T);return T}function*Vp(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=yi(R);if(T)yield T}}function hd(v){return[...Vp(v)].join(`
146
+ `)}async function ex(v,_){try{let k=await bi();if(!k)return"";let R=new Set;for(let Ne of Vp(v)){let Le=typeof k.extractClasses==="function"?k.extractClasses(Ne):Lc(Ne);for(let Be of Le)R.add(Be)}if(R.size===0)return"";let T=_?Xt.resolve(_):process.cwd(),z=a(T,"cache");if(!Sa)Sa=z;let F=$a.get(T);if(!F){let Ne=await Dc(T);F={config:Ne,fingerprint:Mc(Ne)},$a.set(T,F),Fp=F.fingerprint}let V=[...R].sort().join(" "),H=`${va}::${F.fingerprint||"default"}::${V}`,K=Pr.get(H);if(K!==void 0)return yl(H,K),K;let X=await Xy(H,z);if(X!==null)return yl(H,X),X;let G=k.defaultConfig||k.config,te=F.config||{},ce=Rp(G,te),{safelist:ee,includePreflight:le,minify:ue,tokenCSS:de}=ce;if(ce.unknownRoles.length>0&&!Lp.has(T))Lp.add(T),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${ce.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let pe=ce.config,fe=new k.CSSGenerator(pe),Pe=pe.shortcuts||te.shortcuts||{},ke=Object.keys(Pe).filter((Ne)=>R.has(Ne)||ee.includes(Ne));for(let Ne of ee)if(!Pe[Ne])fe.generate(Ne);for(let Ne of R)if(!Pe[Ne])fe.generate(Ne);let we="";if(ke.length>0){let Ne=new k.CSSGenerator(pe);for(let Le of ke)Ne.generate(Le);if(we=Ne.toCSS(!1,ue),we&&!we.endsWith(`
147
+ `))we+=`
148
+ `}let Me=we+fe.toCSS(le,ue);return Me=Cp(k.CSSGenerator,ce)+de+Me,yl(H,Me),Zy(H,Me,z),Me}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await jc(v,_);if(!T)return R?co(v):v;let z=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${Ky(T)}.css">`:`<style data-css="generated">
149
+ ${T}
150
+ </style>`;if(R)return tx(v,z);let F=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(F.test(v)){let V=!1;return v.replace(F,()=>{if(V)return"";return V=!0,z})}if(v.includes("</head>"))return v.replace("</head>",`${z}
151
+ </head>`);if(v.includes("<body"))return v.replace(/<body([^>]*)>/,`<body$1>
152
+ ${z}`);return z+v}function tx(v,_){let k=hl(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 K=v.match(/<body([^>]*)>/);if(K?.index!==void 0)k.push({start:K.index,end:K.index+K[0].length,replacement:`${K[0]}
154
+ ${_}`});else k.push({start:0,end:0,replacement:_})}}k.sort((H,K)=>H.start-K.start||H.end-K.end);for(let H=1;H<k.length;H++)if(k[H].start<k[H-1].end)return nx(co(v),_);let z=Array(k.length*2+1),F=0,V=0;for(let H of k)z[V++]=v.slice(F,H.start),z[V++]=H.replacement,F=H.end;return z[V]=v.slice(F),z.join("")}function nx(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 wl=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Up=/<body\b([^>]*)>/gi;function Gn(v){let _=0,k,R=wl.map(()=>{return});while(_<v.length){if(k===void 0||k!==null&&k.index<_)Up.lastIndex=_,k=Up.exec(v);if(!k)return null;let T=k.index,z=-1,F=null;for(let H=0;H<wl.length;H++){let K=wl[H],X=R[H];if(X===void 0||X!==null&&X.index<_)K.open.lastIndex=_,X=K.open.exec(v),R[H]=X;if(!X)continue;if(X.index<T&&(z===-1||X.index<z))z=X.index,F=K.close}if(z===-1||!F)return{index:T,tag:k[0],attrs:k[1]??""};F.lastIndex=z;let V=F.exec(v);if(!V)return null;_=V.index+V[0].length}return null}function ms(v,_){let k=Gn(v);if(!k)return v;return v.slice(0,k.index)+_(k.tag,k.attrs)+v.slice(k.index+k.tag.length)}var Hp=/<style\b[^>]*>/iy,qp=/<\/style>/gi,Kp=/<script\b[^>]*>/iy,Xp=/<template(?=[\s>/])[^>]*>/iy,Zp=/<\/template\s*>/iy;function fo(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}Hp.lastIndex=T;let z=Hp.exec(v);if(z){qp.lastIndex=T+z[0].length;let H=qp.exec(v);_=H===null?v.length:H.index+8;continue}Xp.lastIndex=T;let F=Xp.exec(v);if(F){if(k===0)R=T;k++,_=T+F[0].length;continue}Zp.lastIndex=T;let V=Zp.exec(v);if(V){if(k>0)k--;_=T+V[0].length;continue}if(Kp.lastIndex=T,Kp.test(v))return k>0?R:T;_=T+1}return-1}function Gp(){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 vl(v){return Symbol(v)}var S_=vl("theme"),$_=vl("router"),__=vl("i18n");import*as Yp from"crypto";function Jp(v){let _=/\$(\w+)\./g,k=[],R;while((R=_.exec(v))!==null)if(!k.includes(R[1]))k.push(R[1]);return k}function rx(){return`stx-${Yp.randomBytes(4).toString("hex")}`}function sx(v){return/\$\w+\./.test(v)}function ix(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,(z,F,V,H)=>{if(["script","style","template"].includes(F.toLowerCase()))return z;let K=[],X=!1,G=V,te=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,ce=[...V.matchAll(te)];for(let ue of ce){let de=ue[0],pe=ue[1],fe=ue[2];if(sx(fe)){X=!0;let Pe=fe.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(Pe){let ke=Pe[1];if(K.push({attr:pe,expr:ke,fullMatch:de,originalAttr:pe}),Jp(ke).forEach((Me)=>k.add(Me)),pe==="text")G=G.replace(de,"");else if(pe==="class")G=G.replace(de,'class=""');else if(pe==="disabled"||pe==="hidden")G=G.replace(de,"");else G=G.replace(de,`${pe}=""`)}}}if(!X)return z;let ee=G.match(/\bid\s*=\s*"([^"]+)"/),le;if(ee)le=ee[1];else le=rx(),G=` id="${le}"${G}`;for(let ue of K)_.push({elementId:le,attribute:ue.attr,expression:ue.expr,stores:Jp(ue.expr)});return`<${F}${G}${H}`}),{html:T,bindings:_,stores:k}}function ox(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:z,attribute:F,expression:V}=T,H=V.replace(/\$(\w+)\./g,"$state.$1.");if(F==="text")R+=` (function() {
525
+ var el = document.getElementById('${z}');
526
+ if (el) {
527
+ try {
528
+ el.textContent = ${H};
529
+ }
530
+ catch (e) { console.error('Binding error:', e); }
531
+ }
532
+ })();
533
+ `;else if(F==="html")R+=` (function() {
534
+ var el = document.getElementById('${z}');
535
+ if (el) {
536
+ try {
537
+ el.innerHTML = ${H};
538
+ }
539
+ catch (e) { console.error('Binding error:', e); }
540
+ }
541
+ })();
542
+ `;else if(F==="class")R+=` (function() {
543
+ var el = document.getElementById('${z}');
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(F==="show")R+=` (function() {
572
+ var el = document.getElementById('${z}');
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(F==="if")R+=` (function() {
581
+ var el = document.getElementById('${z}');
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('${z}');
591
+ if (el) {
592
+ try {
593
+ var value = ${H};
594
+ if (value === false || value === null || value === undefined) {
595
+ el.removeAttribute('${F}');
596
+ }
597
+ else if (value === true) {
598
+ el.setAttribute('${F}', '');
599
+ }
600
+ else {
601
+ el.setAttribute('${F}', 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 Qp(v){let{html:_,bindings:k,stores:R}=ix(v);if(k.length===0)return v;let T=ox(k,R),z=_.lastIndexOf("</body>");if(z!==-1)return _.slice(0,z)+T+_.slice(z);return _+T}function ax(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return cx(_);case"google-analytics":return lx(_);case"plausible":return ux(_);case"self-hosted":return dx(_);case"custom":return px(_);default:return""}}function cx(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",R=_.defer!==!1?" defer":"",T=[`data-site="${yn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${yn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
663
+ <!-- Fathom Analytics -->
664
+ <script src="${yn(k)}" ${T.join(" ")}${R}></script>
665
+ `}function lx(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=yn(_.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 ux(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",R=[`data-domain="${yn(_.domain)}"`],T=k,z=[];if(_.trackLocalhost)z.push("local");if(_.hashMode)z.push("hash");if(z.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${z.join(".")}.js`;return`
676
+ <!-- Plausible Analytics -->
677
+ <script defer data-domain="${yn(_.domain)}" src="${yn(T)}"></script>
678
+ `}function dx(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=yn(_.siteId),R=yn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",z=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",F=_.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
+ ${z}
705
+ ${F}
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 px(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="${yn(_.scriptId)}"`);if(_.attributes)for(let[T,z]of Object.entries(_.attributes))k.push(`${yn(T)}="${yn(z)}"`);return`
717
+ <!-- Custom Analytics -->
718
+ <script${k.length>0?` ${k.join(" ")}`:""} src="${yn(_.scriptUrl)}" defer></script>
719
+ `}function ef(v,_){let k=ax(_);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 yn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var fx={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 tf(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...fx,..._};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 nf(v,_){let k=tf(_);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 rf={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 z=gx(_.join(" "));T.heatmap={...T.heatmap,...z,enabled:!0}}return tf(T)}};function gx(v){let _={},k=v.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let R of k){let[T,z]=R.split("="),F=z?.replace(/["']/g,"");switch(T){case"endpoint":_.endpoint=F;break;case"samplingRate":_.samplingRate=Number.parseInt(F,10);break;case"batchSize":_.batchSize=Number.parseInt(F,10);break;case"trackMouse":_.trackMouse=F==="true";break;case"trackClicks":_.trackClicks=F==="true";break;case"trackScroll":_.trackScroll=F==="true";break;case"honorDnt":_.honorDnt=F==="true";break;case"debugOverlay":_.debugOverlay=F==="true";break}}return _}var rr={duration:300,delay:0,ease:"ease",direction:"both"};function mx(v,_={}){let{duration:k,delay:R,ease:T,direction:z,custom:F}={...rr,..._};if(v==="custom"&&F)return F;switch(v){case"fade":return`${z==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":z==="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`${z==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":z==="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`${z==="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;":z==="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`${z==="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;":z==="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`${z==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":z==="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 hx(){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 yx(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 xx(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 bx(){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 wx(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 sf={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],z=_.length>1?Number.parseInt(_[1],10)||rr.duration:rr.duration,F=_.length>2?_[2]||rr.ease:rr.ease,V=_.length>3?Number.parseInt(_[3],10)||rr.delay:rr.delay,H=_.length>4?_[4]||rr.direction:rr.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,X=mx(T,{duration:z,delay:V,ease:F,direction:H}),G="stx-transition",te="";if(T==="fade")te="stx-fade";else if(T==="slide")te="stx-slide";else if(T==="scale")te="stx-scale";else if(T==="flip")te="stx-flip";else if(T==="rotate")te="stx-rotate";return`<div id="${K}" class="${G} ${te} ${H==="out"?"stx-out":""}"
1336
+ style="--stx-transition-duration: ${z}ms; --stx-transition-ease: ${F}; --stx-transition-delay: ${V}ms;">${v}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},of={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],z=_.length>1?Number.parseInt(_[1],10)||300:300,F=_.length>2?_[2]||"ease":"ease",V=_.length>3?Number.parseFloat(_[3])||0.2:0.2,H=_.length>4?Number.parseInt(_[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,X=`--stx-transition-duration: ${z}ms; --stx-transition-ease: ${F}; --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="${K}" class="${G}" style="${X}" data-threshold="${V}">${v}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},af={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],z=_.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),F=k.staggerDelay||50,V=k.sequence||!0,H=wx(T,z,{staggerDelay:F,sequence:V});return`${v}
1337
+ ${H}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},cf={name:"motion",handler:(v,_,k,R)=>{let T=_.length>0?_[0].toLowerCase()==="true":!0,z=hx();return`<div data-animate="${T?"auto":"true"}">${v}</div>${z}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function lf(v,_,k,R){let T=v;if(R.animation?.enabled===!1)return T;let z=k.includes("test")&&k.includes("animation");if(!yx(T)&&!z)return T;if(!T.includes('<style id="stx-animation-base">')){let V=bx();T=T.replace("</head>",`${V}
1338
+ </head>`)}if(T.includes("stx-observe")){if(!T.includes("Intersection Observer for scroll animations")){let H=xx(),K=T.lastIndexOf("</body>");if(K!==-1)T=T.slice(0,K)+H+`
1339
+ `+T.slice(K)}}return T}function Ye(v){let _=v.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!_)return null;try{return Function(`return ${_[1]}`)()}catch{return null}}function uf(v){let _=v?.layout;if(_===!1)return!1;return typeof _==="string"&&_.trim()?_.trim():void 0}var vx=100,Sx=599,$l="__stxResponseStatus",go="__stxResponseHeaders";function ka(v){return typeof v==="number"&&Number.isInteger(v)&&v>=vx&&v<=Sx}function Ft(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(ka(R))return R}return}function Sl(v,_){if(!v||typeof v!=="object")return!1;let k=typeof _==="string"&&/^\d+$/.test(_.trim())?Number(_.trim()):_;if(!ka(k))return!1;return v[$l]=k,!0}function $x(v,_,k){if(!v||typeof v!=="object")return;let R=String(_??"").trim();if(!R)return;v[go]={...v[go],[R]:String(k)}}function Ze(v){let _=v?.[$l];return ka(_)?_:void 0}function Qe(v){let _=v?.[go];if(!_||typeof _!=="object")return;let k=Object.entries(_).map(([R,T])=>[R,String(T)]);return k.length>0?Object.fromEntries(k):void 0}function wi(v,_){if(!v||!_||v===_||typeof _!=="object")return;let k=Ze(v);if(k!==void 0)_[$l]=k;let R=Qe(v);if(R)_[go]={..._[go],...R}}function ur(v){return{setResponseStatus:(_)=>{Sl(v,_)},notFound:(_=404)=>{let k=ka(_)&&_>=400?_:404;Sl(v,k)},setResponseHeader:(_,k)=>{$x(v,_,k)}}}function df(v,_,k={}){if(!v.includes("@status"))return v;let{filePath:R,buildMode:T}=k,z=T==="compile",F="",V=0,H=/@status\s*\(/g,K;while((K=H.exec(v))!==null){let X=_x(v,K.index+K[0].length-1);if(X<0)break;let G=v.slice(K.index+K[0].length,X).trim(),te=/^\d+$/.test(G)?Number(G):l(G,_),ce=R?` in ${R}`:"";if(z)console.warn(`[stx] @status(${G})${ce} 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(!Sl(_,te))console.warn(`[stx] @status(${G})${ce} is not an HTTP status (100-599) \u2014 ignoring it.`);F+=v.slice(V,K.index),V=X+1+(v.slice(X+1).match(/^[^\S\n]*\n?/)?.[0].length??0),H.lastIndex=V}return V===0?v:F+v.slice(V)}function _x(v,_){let k=1,R=null,T=!1;for(let z=_+1;z<v.length;z++){let F=v[z];if(T){T=!1;continue}if(R){if(F==="\\")T=!0;else if(F===R)R=null;continue}if(F==='"'||F==="'"||F==="`"){R=F;continue}if(F==="(")k++;else if(F===")"&&--k===0)return z}return-1}var kx=0,Ex=0;function pf(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 Cx(v){let _=[],k=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,R;while((R=k.exec(v))!==null){let[T,z,F]=R,V=R.index,H=pf(F,"x-data");if(!H)continue;let K=`__stx_scope_${kx++}`,X=pf(F,"x-init"),G=Rx(v,z,V+T.length),te=v.slice(V,G.endIndex),ce=Ax(te);_.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:H,initExpr:X,bindings:[],refs:ce})}return _}function Rx(v,_,k){let R=1,T=k,z=new RegExp(`<${_}(?:\\s|>)`,"gi"),F=new RegExp(`</${_}>`,"gi"),V=new RegExp(`<${_}[^>]*/\\s*>`,"gi");while(R>0&&T<v.length){z.lastIndex=T,F.lastIndex=T,V.lastIndex=T;let H=z.exec(v),K=F.exec(v),X=V.exec(v);if(X&&X.index<(H?.index??1/0)){T=X.index+X[0].length;continue}if(!K)return{endIndex:v.length};if(H&&H.index<K.index)R++,T=H.index+H[0].length;else{if(R--,R===0)return{endIndex:K.index+K[0].length};T=K.index+K[0].length}}return{endIndex:v.length}}function Ax(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[,z,F]=T,V=Tx(z);_.set(F,V)}return _}function Tx(v){let _=v.match(/\bid\s*=\s*["']([^"']*)["']/);if(_)return _[1];return`__stx_el_${Ex++}`}function Ix(){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 ff(v,_){let k=v.replace(/\{!!([\s\S]*?)!!\}/g,(V,H)=>{try{let K=x(H,_,!0);if(K===void 0)return V;return String(K)}catch{return V}}),R="",T=0,z=null;while(T<k.length){let V=k[T];if(z&&V==="\\"){R+=V+(k[T+1]??""),T+=2;continue}if(V==="{"&&k[T+1]==="{"){let H=k.indexOf("}}",T+2);if(H!==-1){let K=k.slice(T,H+2);R+=F(k.slice(T+2,H),K,z),T=H+2;continue}}if(z){if(V===z)z=null}else if(V==="'"||V==='"'||V==="`")z=V;R+=V,T++}return R;function F(V,H,K){let X;try{X=x(V,_,!0)}catch{return H}if(X===void 0)return H;if(K){let G=String(X).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?G.replace(/\$\{/g,"\\${"):G}if(typeof X==="string"){let G=X.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(X)}}function Px(v,_){if(v.length===0)return"";let k=v.map((R)=>{let T=JSON.stringify(Object.fromEntries(R.refs)),z=ff(R.stateExpr,_),F=R.initExpr?ff(R.initExpr,_):null,V=JSON.stringify(z),H=F?JSON.stringify(F):"null";return`
1593
+ (function() {
1594
+ var scopeEl = document.querySelector('${R.selector}');
1595
+ if (!scopeEl) return;
1596
+ var refs = ${T};
1597
+ __stx_reactive.initScope(scopeEl, ${V}, [], refs, ${H});
1598
+ })();`}).join(`
1599
+ `);return`
1600
+ <script data-stx-scoped data-stx-reactive data-stx-run="always">
1601
+ ${Ix()}
1602
+ ${k}
1603
+ </script>`}function gf(v,_,k){if(!Ox(v))return v;let R=Cx(v);if(R.length===0)return v;let T=Dx(v,R),z=Px(R,_),F=T.lastIndexOf("</body>");if(F!==-1)T=T.slice(0,F)+z+`
1604
+ `+T.slice(F);else T+=z;return T}function Dx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,z,F)=>{let V=_[k++];if(!V)return T;let H=/data-stx-scope="([^"]*)"/.exec(F);if(H)return V.id=H[1],V.selector=`[data-stx-scope="${V.id}"]`,T;return`<${z} data-stx-scope="${V.id}"${F}>`});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 Ox(v){return/x-data\s*=\s*["']/.test(v)}import xb from"fs";import jl from"path";import{createHighlighter as bb}from"ts-syntax-highlighter";import ys from"fs";import dn from"path";import{loadConfigWithResult as pb}from"bunfig";async function Mx(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",z=De();if(T!=="main")z=z.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${z}</script>`}var mf={name:"stxRouter",handler:Mx,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Or(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function hf(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function or(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),z={};for(let F of R.split(`
1605
+ `)){let V=F.trim();if(!V||V.startsWith("#"))continue;let H=V.indexOf(":");if(H===-1)continue;let K=V.slice(0,H).trim(),X=V.slice(H+1).trim();if(typeof X==="string"){if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))X=X.slice(1,-1);else if(X.startsWith("[")&&X.endsWith("]"))try{X=JSON.parse(X)}catch{}else if(X==="true")X=!0;else if(X==="false")X=!1;else if(/^-?\d+(?:\.\d+)?$/.test(X))X=Number(X)}z[K]=X}return{data:z,content:T.trim()}}function Ge(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,z=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(X,G,te)=>{let ce=z.length,ee=G?` class="language-${Or(G)}"`:"";return z.push(`<pre><code${ee}>${Or(te.trim())}</code></pre>`),`\x00CODEBLOCK${ce}\x00`}),T=T.replace(/`([^`]*)`/g,(X,G)=>`<code>${Or(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,(X,G,te)=>`<img src="${hf(te)?Or(te):""}" alt="${Or(G)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(X,G,te)=>`<a href="${hf(te)?Or(te):""}">${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,(X,G,te)=>{let ee=`<tr>${G.split("|").map((ue)=>ue.trim()).filter(Boolean).map((ue)=>`<th>${Or(ue)}</th>`).join("")}</tr>`,le=te.trim().split(`
1607
+ `).map((ue)=>`<tr>${ue.split("|").map((pe)=>pe.trim()).filter(Boolean).map((pe)=>`<td>${Or(pe)}</td>`).join("")}</tr>`).join(`
1608
+ `);return`<table>
1609
+ <thead>
1610
+ ${ee}
1611
+ </thead>
1612
+ <tbody>
1613
+ ${le}
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 F=T.split(`
1616
+ `),V=[],H=!1,K=[];for(let X of F){let G=X.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&&K.length>0)V.push(`<p>${K.join(R?`<br />
1617
+ `:`
1618
+ `)}</p>`),K=[],H=!1;V.push(X)}else H=!0,K.push(G)}if(H&&K.length>0)V.push(`<p>${K.join(R?`<br />
1619
+ `:`
1620
+ `)}</p>`);if(T=V.join(`
1621
+ `),R)T=T.replace(/\n/g,`<br />
1622
+ `);for(let X=0;X<z.length;X++)T=T.replace(`\x00CODEBLOCK${X}\x00`,z[X]);return T=T.replace(/<p>\s*<\/p>/g,""),T.trim()}async function yf(v,_,k=""){let R=v,T=[],z=/@markdown(?:\([^)]*\))?/g,F;while((F=z.exec(v))!==null){let V=F.index,H=F[0].match(/@markdown\(([^)]*)\)/),K=H?H[1]:"",X=V+F[0].length,G=1,te=X,ce=-1;while(G>0&&te<v.length){let ue=v.indexOf("@markdown",te),de=v.indexOf("@endmarkdown",te);if(de===-1)break;if(ue!==-1&&ue<de&&ue!==V){let pe=v[ue+9];if(pe==="("||pe===`
1623
+ `||pe==="\r"||pe===" "||pe===void 0)G++;te=ue+9}else{if(G--,G===0){ce=de;break}te=de+12}}if(ce===-1)continue;let ee=v.slice(X,ce),le=v.slice(V,ce+12);T.push({fullMatch:le,options:K,content:ee,index:V}),z.lastIndex=ce+12}for(let{fullMatch:V,options:H,content:K,index:X}of T)try{let G={};if(H)H.split(",").forEach((ee)=>{let le=ee.trim();if(le)G[le]=!0});let te={gfm:G.gfm??!0,breaks:G.breaks??!1},ce=Ge(K.trim(),te);R=R.split(V).join(ce)}catch(G){let te=G instanceof Error?G.message:String(G),ce=g("Markdown Directive",`Error processing markdown: ${te}`,k,v,X,V);R=R.split(V).join(ce)}return R}async function xf(v,_,k,R){let T={gfm:!0,breaks:!1};return _.forEach((z)=>{let F=z.trim().replace(/['"]/g,"");if(F==="breaks")T.breaks=!0;if(F==="no-gfm")T.gfm=!1}),Ge(v.trim(),T)}var hs=[320,480,640,768,1024,1280,1536,1920,2560],jx=[1,1.5,2,3],mo=["avif","webp","jpeg"],Nx={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"};function _l(v,_=hs,k={},R){return _.sort((T,z)=>T-z).map((T)=>`${ho(v,{...k,w:T,fm:R})} ${T}w`).join(", ")}function bf(v,_,k=jx,R={},T){return k.sort((z,F)=>z-F).map((z)=>{let F=Math.round(_*z);return`${ho(v,{...R,w:F,dpr:z,fm:T})} ${z}x`}).join(", ")}function kl(v,_="100vw"){if(!v||Object.keys(v).length===0)return _;let R=Object.entries(v).map(([T,z])=>{let F=/^\d+$/.test(T)?`${T}px`:T;return{bp:F,size:z,numericBp:Number.parseInt(F)||0}}).sort((T,z)=>T.numericBp-z.numericBp).map(({bp:T,size:z})=>`(max-width: ${T}) ${z}`);return R.push(_),R.join(", ")}function ho(v,_={}){let k=Object.entries(_).filter(([,z])=>z!==void 0&&z!==null).map(([z,F])=>{if(Array.isArray(F))return[z,F.join(",")];return[z,String(F)]});if(k.length===0)return v;let R=k.map(([z,F])=>`${z}=${encodeURIComponent(F)}`).join("&"),T=v.includes("?")?"&":"?";return`${v}${T}${R}`}function El(v){return Nx[v]||"application/octet-stream"}var Lx={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Rl=`
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 Bx(){try{return await import("ts-images")}catch{return null}}async function zx(v,_={}){let k={...Lx,..._},R=await Bx();if(R)try{return await Wx(v,k,R)}catch(T){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${T}`)}return Fx(v,k)}async function Wx(v,_,k){let{generatePlaceholder:R,generateThumbHash:T}=k,F={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 V=await R(v,{width:_.width,height:_.height,quality:_.quality,blurLevel:_.blurLevel,strategy:F,base64Encode:!0});return{dataURL:V.dataURL,width:V.width,height:V.height,aspectRatio:V.aspectRatio,originalWidth:V.originalWidth,originalHeight:V.originalHeight,strategy:_.strategy,dominantColor:V.dominantColor,css:V.css}}function Fx(v,_){let k=_.width||20,R=_.height||k,T="#e5e7eb",z=`<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(z)}`,width:k,height:R,aspectRatio:k/R,originalWidth:0,originalHeight:0,strategy:_.strategy,dominantColor:"#e5e7eb"}}function wf(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 Cl=new Map;async function vf(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(Cl.has(k))return Cl.get(k);let R=await zx(v,_);return Cl.set(k,R),R}async function Vx(){try{return await import("./chunk-z42jb949.js")}catch(v){if(!Sf)console.warn("[stx-media] Image processor not available, some features disabled:",v),Sf=!0;return null}}var Sf=!1,Al=80,Ca="async",Ra="lazy",$f=!1;async function Ea(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return Kx(R,k)}if(k.processedResult?.processed)return Pl(v,k.processedResult,_);if(k.responsiveVariants)return Ef(v,k.responsiveVariants,_);let{src:T,alt:z,width:F,height:V,sizes:H,widths:K=hs,dpr:X,formats:G=mo,quality:te=Al,params:ce={},placeholder:ee="none",placeholderOptions:le={},lazy:ue=!0,priority:de=!1,loading:pe=de?"eager":Ra,decoding:fe=Ca,fetchpriority:Pe,objectFit:ke,objectPosition:we,crossorigin:Me,referrerpolicy:Ne}=v,{class:Le,style:Be,id:ze}=v,je=v.data||{},{isDev:Fe=!1,baseUrl:Ve=""}=_;if(Fe&&!_.optimize)return qx(v);let Ue,We,ct=ze||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(ee!=="none"&&!de)try{Ue=await vf(T,{strategy:ee,...le}),We=wf(ct,Ue,le)}catch{}let $t=X!==void 0&&F!==void 0,wt;if($t)wt=Hx(v,ct,Ue,_);else wt=await Ux(v,ct,Ue,_);let It;if(de){let Ct=G.includes("webp")?"webp":G[0],vt=_l(T,K,{...ce,q:te},Ct),pt=typeof H==="object"?kl(H):H||"100vw";It=`<link rel="preload" as="image" imagesrcset="${vt}" imagesizes="${pt}" />`}let St=[];if(!$f&&ee!=="none")St.push(Rl),$f=!0;if(We)St.push(We);let mt=ue?kf(ct):void 0;return{html:wt,preloadLink:It,css:St.length>0?St.join(`
1670
+ `):void 0,script:mt}}async function Ux(v,_,k,R){let{src:T,alt:z,width:F,height:V,sizes:H,widths:K=hs,formats:X=mo,quality:G=Al,params:te={},lazy:ce=!0,priority:ee=!1,loading:le=ee?"eager":Ra,decoding:ue=Ca,fetchpriority:de,objectFit:pe,objectPosition:fe,crossorigin:Pe,referrerpolicy:ke}=v,{class:we,style:Me}=v,Ne=v.data||{},Le=typeof H==="object"?kl(H):H||"100vw",Be=[];for(let Fe of X){let Ve=_l(T,K,{...te,q:G},Fe),Ue=El(Fe);if(ce&&!ee)Be.push(` <source type="${Ue}" data-srcset="${Ve}" data-sizes="${Le}" />`);else Be.push(` <source type="${Ue}" srcset="${Ve}" sizes="${Le}" />`)}let ze=Tl({src:ho(T,{...te,q:G}),alt:z,width:F,height:V,loading:ee?void 0:le,decoding:ue,fetchpriority:ee?"high":de,objectFit:pe,objectPosition:fe,crossorigin:Pe,referrerpolicy:ke,className:_f(we,k),style:Il(Me,pe,fe,k),lazy:ce&&!ee,data:Ne}),je;if(k){let Fe=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;je=`<div id="${_}" class="stx-img-placeholder" style="${Fe}">
1671
+ <picture>
1672
+ ${Be.join(`
1673
+ `)}
1674
+ <img ${ze} />
1675
+ </picture>
1676
+ </div>`}else je=`<picture${_?` id="${_}"`:""}>
1677
+ ${Be.join(`
1678
+ `)}
1679
+ <img ${ze} />
1680
+ </picture>`;return je}function Hx(v,_,k,R){let{src:T,alt:z,width:F,height:V,dpr:H=[1,2,3],quality:K=Al,params:X={},lazy:G=!0,priority:te=!1,loading:ce=te?"eager":Ra,decoding:ee=Ca,fetchpriority:le,objectFit:ue,objectPosition:de,crossorigin:pe,referrerpolicy:fe}=v,{class:Pe,style:ke}=v,we=v.data||{},Me=typeof F==="number"?F:Number.parseInt(String(F),10),Ne=bf(T,Me,H,{...X,q:K}),Le=Tl({src:ho(T,{...X,w:Me,q:K}),alt:z,width:F,height:V,loading:te?void 0:ce,decoding:ee,fetchpriority:te?"high":le,objectFit:ue,objectPosition:de,crossorigin:pe,referrerpolicy:fe,className:_f(Pe,k),style:Il(ke,ue,de,k),lazy:G&&!te,data:we}),Be=G&&!te?`data-srcset="${Ne}"`:`srcset="${Ne}"`;if(k){let ze=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${_}" class="stx-img-placeholder" style="${ze}">
1681
+ <img ${Le} ${Be} />
1682
+ </div>`}return`<img ${_?`id="${_}" `:""}${Le} ${Be} />`}function qx(v){let{src:_,alt:k,width:R,height:T,loading:z=Ra,decoding:F=Ca,fetchpriority:V,objectFit:H,objectPosition:K,crossorigin:X,referrerpolicy:G,priority:te=!1}=v,{class:ce,style:ee,id:le}=v,ue=v.data||{};return{html:`<img ${Tl({src:_,alt:k,width:R,height:T,loading:te?"eager":z,decoding:F,fetchpriority:te?"high":V,objectFit:H,objectPosition:K,crossorigin:X,referrerpolicy:G,className:ce,style:Il(ee,H,K),id:le,data:ue})} />`}}function Tl(v){let _=[];if(v.lazy)_.push(`data-src="${Hn(v.src)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else _.push(`src="${Hn(v.src)}"`);if(_.push(`alt="${Hn(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="${Hn(v.className)}"`);if(v.style)_.push(`style="${Hn(v.style)}"`);if(v.id)_.push(`id="${Hn(v.id)}"`);if(v.data)for(let[k,R]of Object.entries(v.data))_.push(`data-${k}="${Hn(R)}"`);if(v.lazy)_.push("data-stx-lazy");return _.join(" ")}function _f(v,_){let k=[];if(v)k.push(v);if(_)k.push("stx-img-blur");return k.join(" ")||""}function Il(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 Hn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kf(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 Kx(v,_){let k=await Vx();if(!k)return Ea({...v,process:!1},_);let R=_.tsImagesConfig;if(v.responsiveWidths&&v.responsiveWidths.length>0||v.widths&&v.widths.length>0||!v.width&&!v.dpr){let z=await k.generateResponsiveVariants(v.src,v,R);if(z)return Ef(v,z,_)}else{let z=await k.processImage(v.src,v,R);if(z.processed)return Pl(v,z,_)}return Ea({...v,process:!1},_)}async function Pl(v,_,k){let{alt:R,width:T,height:z,lazy:F=!0,priority:V=!1,objectFit:H,objectPosition:K,crossorigin:X,referrerpolicy:G}=v,{class:te,style:ce}=v,ee=v.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,le=v.data||{},ue=_.variants||[],de=ue.find((We)=>We.format==="jpeg")||ue.find((We)=>We.format==="webp")||ue[0],pe=de?.url||v.src,fe=ue.filter((We)=>We.format===(de?.format||"jpeg")).map((We)=>`${We.url} ${We.width}w`).join(", "),Pe=new Map;for(let We of ue){if(!Pe.has(We.format))Pe.set(We.format,[]);Pe.get(We.format).push(We)}let ke=[],we=["avif","webp","jpeg","png"];for(let We of we){let ct=Pe.get(We);if(ct&&ct.length>0){let $t=ct.map((It)=>`${It.url} ${It.width}w`).join(", "),wt=El(We);if(F&&!V)ke.push(` <source type="${wt}" data-srcset="${$t}" />`);else ke.push(` <source type="${wt}" srcset="${$t}" />`)}}let Me=[];if(F&&!V){if(Me.push(`data-src="${Hn(pe)}"`),Me.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),fe)Me.push(`data-srcset="${fe}"`)}else if(Me.push(`src="${Hn(pe)}"`),fe)Me.push(`srcset="${fe}"`);Me.push(`alt="${Hn(R)}"`);let Ne=T||_.originalWidth,Le=z||_.originalHeight;if(Ne)Me.push(`width="${Ne}"`);if(Le)Me.push(`height="${Le}"`);if(!V)Me.push(`loading="${F?"lazy":"eager"}"`);if(Me.push('decoding="async"'),V)Me.push('fetchpriority="high"');if(X)Me.push(`crossorigin="${X}"`);if(G)Me.push(`referrerpolicy="${G}"`);let Be=[];if(H)Be.push(`object-fit: ${H}`);if(K)Be.push(`object-position: ${K}`);if(_.placeholder&&F)Be.push("opacity: 0; transition: opacity 300ms ease-out");if(ce)Be.push(ce);if(Be.length>0)Me.push(`style="${Be.join("; ")}"`);let ze=[];if(te)ze.push(te);if(_.placeholder)ze.push("stx-img-blur");if(ze.length>0)Me.push(`class="${ze.join(" ")}"`);if(F&&!V)Me.push("data-stx-lazy");for(let[We,ct]of Object.entries(le))Me.push(`data-${We}="${Hn(ct)}"`);let je;if(_.placeholder||_.dominantColor&&v.useDominantColor){let We=_.placeholder?`background-image: url('${_.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${_.dominantColor};`;je=`<div id="${ee}" class="stx-img-placeholder" style="${We}">
1720
+ <picture>
1721
+ ${ke.join(`
1722
+ `)}
1723
+ <img ${Me.join(" ")} />
1724
+ </picture>
1725
+ </div>`}else je=`<picture${ee?` id="${ee}"`:""}>
1726
+ ${ke.join(`
1727
+ `)}
1728
+ <img ${Me.join(" ")} />
1729
+ </picture>`;let Fe=[];if(_.placeholder)Fe.push(Rl);let Ve=F?kf(ee):void 0,Ue;if(V&&fe)Ue=`<link rel="preload" as="image" imagesrcset="${fe}" />`;return{html:je,preloadLink:Ue,css:Fe.length>0?Fe.join(`
1730
+ `):void 0,script:Ve}}async function Ef(v,_,k){let R={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,z]of Object.entries(_.byFormat))if(z)R.variants.push(...z);return Pl(v,R,k)}function Xx(){return it({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,R)=>{let{src:T,alt:z,options:F}=Zx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let V={src:T,alt:z||"",widths:F.widths||hs,formats:F.formats||mo,quality:F.quality,sizes:F.sizes,dpr:F.dpr,params:F.params,placeholder:F.placeholder,placeholderOptions:F.placeholderOptions,lazy:F.lazy!==!1,priority:F.priority||!1,loading:F.loading,decoding:F.decoding,fetchpriority:F.fetchpriority,objectFit:F.objectFit,objectPosition:F.objectPosition,class:F.class,style:F.style,id:F.id,width:F.width,height:F.height},H=k.__isDev||!1,K=await Ea(V,{isDev:H}),X=K.html;if(K.preloadLink)X=K.preloadLink+`
1731
+ `+X;if(K.css)X+=`
1732
+ <style>${K.css}</style>`;if(K.script)X+=`
1733
+ <script>${K.script}</script>`;return X},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Zx(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=Gx(R),z=Dl(T[0],k)||"",F=Dl(T[1],k)||"",V={};if(T[2]){let H=Dl(T[2],k);if(typeof H==="object"&&H!==null)V=H;else if(typeof T[2]==="string")try{V=JSON.parse(T[2])}catch{}}return{src:z,alt:F,options:V}}function Gx(v){let _=[],k="",R=!1,T="",z=0,F=0;for(let V=0;V<v.length;V++){let H=v[V],K=V>0?v[V-1]:"";if((H==='"'||H==="'"||H==="`")&&K!=="\\"){if(!R)R=!0,T=H;else if(H===T)R=!1,T="";else k+=H;continue}if(!R){if(H==="{")z++;if(H==="}")z--;if(H==="[")F++;if(H==="]")F--;if(H===","&&z===0&&F===0){_.push(k.trim()),k="";continue}}k+=H}if(k.trim())_.push(k.trim());return _}function Dl(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 Cf=Xx();async function Af(){try{return await import("./chunk-bgfkbesj.js")}catch(v){if(!Rf)console.warn("[stx-media] Video processor not available, some features disabled:",v),Rf=!0;return null}}var Rf=!1,Tf=!0,If="metadata",Jx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function Aa(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return nb(R,k)}if(k.processedResult?.processed)return Df(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await rb(R,k);let{src:z,sources:F=[],poster:V,posterPlaceholder:H,controls:K=Tf,autoplay:X=!1,muted:G=!1,loop:te=!1,preload:ce=If,playsinline:ee=!0,lazy:le=!0,player:ue="native",type:de,width:pe,height:fe,crossorigin:Pe,disablePictureInPicture:ke=!1,disableRemotePlayback:we=!1}=v,Me=T||V,{class:Ne,style:Le}=v,Be=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ue==="ts-video")return Qx(v,_);if(de&&de!=="video")return Yx(z||"",de,v);let ze=F.length>0?F:z?[{src:z,type:Pf(z)}]:[],je=[`id="${Be}"`];if(K)je.push("controls");if(X)je.push("autoplay");if(G)je.push("muted");if(te)je.push("loop");if(ee)je.push("playsinline");if(ke)je.push("disablepictureinpicture");if(we)je.push("disableremoteplayback");if(Pe)je.push(`crossorigin="${Pe}"`);if(le){if(je.push(`data-preload="${ce}"`),je.push('preload="none"'),Me)je.push(`data-poster="${un(Me)}"`);je.push("data-stx-lazy")}else if(je.push(`preload="${ce}"`),Me)je.push(`poster="${un(Me)}"`);if(pe)je.push(`width="${pe}"`);if(fe)je.push(`height="${fe}"`);if(Ne)je.push(`class="${un(Ne)}"`);if(Le)je.push(`style="${un(Le)}"`);let Fe=ze.map((We)=>` <source ${le?`data-src="${un(We.src)}"`:`src="${un(We.src)}"`} type="${We.type}"${We.media?` media="${We.media}"`:""} />`).join(`
1734
+ `),Ve=`<video ${je.join(" ")}>
1735
+ ${Fe}
1736
+ Your browser does not support the video tag.
1737
+ </video>`,Ue;if(le)Ue=`
1738
+ (function() {
1739
+ var video = document.getElementById('${Be}');
1740
+ if (!video) return;
1741
+
1742
+ var observer = new IntersectionObserver(function(entries) {
1743
+ entries.forEach(function(entry) {
1744
+ if (entry.isIntersecting) {
1745
+ // Load poster
1746
+ if (video.dataset.poster) {
1747
+ video.poster = video.dataset.poster;
1748
+ delete video.dataset.poster;
1749
+ }
1750
+
1751
+ // Load sources
1752
+ var sources = video.querySelectorAll('source[data-src]');
1753
+ sources.forEach(function(source) {
1754
+ source.src = source.dataset.src;
1755
+ delete source.dataset.src;
1756
+ });
1757
+
1758
+ // Set preload
1759
+ if (video.dataset.preload) {
1760
+ video.preload = video.dataset.preload;
1761
+ delete video.dataset.preload;
1762
+ }
1763
+
1764
+ video.load();
1765
+ observer.disconnect();
1766
+ }
1767
+ });
1768
+ }, { rootMargin: '50px' });
1769
+
1770
+ observer.observe(video);
1771
+ })();
1772
+ `.trim();return{html:Ve,script:Ue}}function Yx(v,_,k){let{width:R=640,height:T=360}=k,{class:z,style:F}=k,V=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,H,K=null;switch(_){case"youtube":K=eb(v),H=K?`https://www.youtube-nocookie.com/embed/${K}`:v;break;case"vimeo":K=tb(v),H=K?`https://player.vimeo.com/video/${K}`:v;break;case"dailymotion":K=v.split("/").pop()||"",H=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=v.split("/").pop()||"",H=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:H=v}let X=[`id="${V}"`,`src="${un(H)}"`,`width="${R}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(z)X.push(`class="${un(z)}"`);if(F)X.push(`style="${un(F)}"`);if(k.lazy)X.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1773
+ <iframe ${X.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1774
+ </div>`}}function Qx(v,_={}){let{src:k,sources:R=[],poster:T,controls:z=!0,autoplay:F=!1,muted:V=!1,loop:H=!1,preload:K="metadata",playsinline:X=!0,lazy:G=!0,width:te,height:ce}=v,{class:ee,style:le}=v,ue=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,de={src:R.length>0?R:k,autoplay:F,loop:H,muted:V,playsinline:X,preload:K,poster:T,controls:z,title:v.title},pe=["position: relative",te?`width: ${typeof te==="number"?te+"px":te}`:"width: 100%",ce?`height: ${typeof ce==="number"?ce+"px":ce}`:"",le||""].filter(Boolean).join("; "),fe=`
1775
+ <div
1776
+ id="${ue}"
1777
+ class="ts-video-player${ee?" "+un(ee):""}"
1778
+ style="${pe}"
1779
+ data-ts-video-player
1780
+ data-config='${JSON.stringify(de)}'
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('${un(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(),Pe=`
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 = '${Jx}';
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(),ke=`
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:fe,script:Pe,css:ke}}function Pf(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 eb(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 tb(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function un(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function nb(v,_){let k=await Af();if(!k)return Aa({...v,process:!1},_);let R=_.tsVideosConfig,T=await k.processVideo(v.src,v,R,v.onProcessProgress);if(T.processed)return Df(v,T,_);return Aa({...v,process:!1},_)}async function rb(v,_){let k=await Af();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 Df(v,_,k){let{controls:R=Tf,autoplay:T=!1,muted:z=!1,loop:F=!1,preload:V=If,playsinline:H=!0,lazy:K=!0,width:X,height:G,crossorigin:te,disablePictureInPicture:ce=!1,disableRemotePlayback:ee=!1}=v,{class:le,style:ue}=v,de=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,pe=v.src,fe=Pf(pe);if(_.transcoded)pe=_.transcoded.url,fe="video/mp4";let Pe=_.streaming?.hls||_.streaming?.dash;if(Pe){if(_.streaming?.hls)pe=_.streaming.hls.manifestUrl,fe="application/x-mpegURL";else if(_.streaming?.dash)pe=_.streaming.dash.manifestUrl,fe="application/dash+xml"}let ke=_.poster?.url||v.poster,we=[`id="${de}"`];if(R)we.push("controls");if(T)we.push("autoplay");if(z)we.push("muted");if(F)we.push("loop");if(H)we.push("playsinline");if(ce)we.push("disablepictureinpicture");if(ee)we.push("disableremoteplayback");if(te)we.push(`crossorigin="${te}"`);if(K){if(we.push(`data-preload="${V}"`),we.push('preload="none"'),ke)we.push(`data-poster="${un(ke)}"`);we.push("data-stx-lazy")}else if(we.push(`preload="${V}"`),ke)we.push(`poster="${un(ke)}"`);let Me=X||_.metadata?.width,Ne=G||_.metadata?.height;if(Me)we.push(`width="${Me}"`);if(Ne)we.push(`height="${Ne}"`);if(le)we.push(`class="${un(le)}"`);if(ue)we.push(`style="${un(ue)}"`);let Be=` <source ${K?`data-src="${un(pe)}"`:`src="${un(pe)}"`} type="${fe}" />`,ze=`<video ${we.join(" ")}>
1942
+ ${Be}
1943
+ Your browser does not support the video tag.
1944
+ </video>`;if(_.spriteSheet)ze=`<div class="stx-video-wrapper" data-sprite-sheet="${un(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
1945
+ ${ze}
1946
+ </div>`;let je;if(K)je=`
1947
+ (function() {
1948
+ var video = document.getElementById('${de}');
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(Pe)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:ze,script:je,css:Fe}}function Of(){return it({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:z}=sb(v,_,k);if(!T)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let F={src:T,poster:z.poster,controls:z.controls!==!1,autoplay:z.autoplay||!1,muted:z.muted||!1,loop:z.loop||!1,preload:z.preload||"metadata",playsinline:z.playsinline!==!1,lazy:z.lazy!==!1,player:z.player||"native",type:z.type,width:z.width,height:z.height,class:z.class,style:z.style,id:z.id,crossorigin:z.crossorigin,disablePictureInPicture:z.disablePictureInPicture,disableRemotePlayback:z.disableRemotePlayback,title:z.title,quality:z.quality,platform:z.platform,process:z.process,generatePoster:z.generatePoster,streaming:z.streaming,transcode:z.transcode,spriteSheet:z.spriteSheet,waveform:z.waveform},H={isDev:k.__isDev||!1,tsVideosConfig:k.__tsVideosConfig},K=await Aa(F,H),X=K.html;if(K.css)X+=`
1991
+ <style>${K.css}</style>`;if(K.script)X+=`
1992
+ <script>${K.script}</script>`;return X},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function sb(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=ib(R),z=Mf(T[0],k)||"",F={};if(T[1]){let V=Mf(T[1],k);if(typeof V==="object"&&V!==null)F=V;else if(typeof T[1]==="string")try{F=JSON.parse(T[1])}catch{}}return{src:z,options:F}}function ib(v){let _=[],k="",R=!1,T="",z=0,F=0;for(let V=0;V<v.length;V++){let H=v[V],K=V>0?v[V-1]:"";if((H==='"'||H==="'"||H==="`")&&K!=="\\"){if(!R)R=!0,T=H;else if(H===T)R=!1,T="";else k+=H;continue}if(!R){if(H==="{")z++;if(H==="}")z--;if(H==="[")F++;if(H==="]")F--;if(H===","&&z===0&&F===0){_.push(k.trim()),k="";continue}}k+=H}if(k.trim())_.push(k.trim());return _}function Mf(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 Ol=Of();import ob from"fs";import Ln from"path";async function yr(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 z=await ab(T,v,_);if(z)R.push(z)}catch(z){if(console.error(`Error building web component ${T.name}:`,z),v.debug)throw z}}return R}async function ab(v,_,k){let{name:R,file:T,tag:z,extends:F}=v;if(!R||!T||!z)return console.error("Invalid web component configuration, missing required fields:",v),null;let V=null;if(Ln.isAbsolute(T)&&await r(T))V=T;else if(_.componentsDir){let le=Ln.join(_.componentsDir,T);if(await r(le))V=le}if(!V)V=await hr(T,process.cwd(),_,k);if(!V)return console.error(`Web component source file not found: ${T}`),null;let H=await Bun.file(V).text();k.add(V);let X=(v.outputFormat||"js")==="ts",G=X?lb({name:R,tag:z,baseElement:F,source:H,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[],attributeTypes:v.attributeTypes||{}}):cb({name:R,tag:z,baseElement:F,source:H,shadowDOM:v.shadowDOM??!0,template:v.template??!0,styleSource:v.styleSource,attributes:v.attributes||[]}),te=_.webComponents?.outputDir||"dist/web-components";await ob.promises.mkdir(te,{recursive:!0});let ce=X?"ts":"js",ee=Ln.join(te,`${z}.${ce}`);if(await Bun.write(ee,G),_.debug)console.log(`Built web component ${R} -> ${ee}`);return ee}function cb(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:z,template:F,styleSource:V,attributes:H=[]}=v,K=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!z)K=K.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),K=K.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),K=K.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),K=K.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let X="";if(V)X=`<link rel="stylesheet" href="${V}">`;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
+ ${z?"":"this._slotContent = []"}
2001
+ ${z?'this.attachShadow({ mode: "open" })':""}
2002
+ }
2003
+
2004
+ ${F?`
2005
+ _createTemplate() {
2006
+ const template = document.createElement('template')
2007
+ template.innerHTML = \`${X}${K}\`
2008
+ ${z?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
2009
+ this._processSlots()
2010
+ }
2011
+ `:`
2012
+ _render() {
2013
+ ${z?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${X}${K}\`
2014
+ this._processSlots()
2015
+ }
2016
+ `}
2017
+
2018
+ _processSlots() {
2019
+ ${z?`// 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
+ ${F?"":"if (this._initialized) this._render()"}
2066
+ }
2067
+ }
2068
+ `:""}
2069
+
2070
+ connectedCallback() {
2071
+ if (this._initialized) return
2072
+ ${z?"":"this._slotContent = Array.from(this.childNodes)"}
2073
+ this._initialized = true
2074
+ ${F?"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 lb(v){let{name:_,tag:k,baseElement:R="HTMLElement",source:T,shadowDOM:z,template:F,styleSource:V,attributes:H=[],attributeTypes:K={}}=v,X=_.replace(/\W/g,""),G=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!z)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 te=V?`<link rel="stylesheet" href="${V}">`:"",ce=(ke)=>{switch(K[ke]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},ee=(ke)=>ke.replace(/-([a-z])/g,(we,Me)=>Me.toUpperCase()),le=H.map((ke)=>` private _${ee(ke)}: ${ce(ke)} | null = null;`).join(`
2085
+ `),ue=H.map((ke)=>{let we=ce(ke),Me=ee(ke);return`
2086
+ get ${Me}(): ${we} | null {
2087
+ return this._${Me};
2088
+ }
2089
+
2090
+ set ${Me}(value: ${we} | null) {
2091
+ this._${Me} = value;
2092
+ if (value !== null) {
2093
+ this.setAttribute('${ke}', String(value));
2094
+ }
2095
+ else {
2096
+ this.removeAttribute('${ke}');
2097
+ }
2098
+ }`}).join(`
2099
+ `),de=H.length>0?`/**
2100
+ * Props interface for ${_}
2101
+ */
2102
+ export interface ${X}Props {
2103
+ ${H.map((ke)=>{let we=ce(ke);return` ${ee(ke)}?: ${we};`}).join(`
2104
+ `)}
2105
+ }
2106
+ `:"",pe=H.length>0?`
2107
+ static get observedAttributes(): string[] {
2108
+ return [${H.map((ke)=>`'${ke}'`).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
+ ${F?"":"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(K)};
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
+ `:"",fe=F?`
2132
+ private _createTemplate(): void {
2133
+ const template = document.createElement('template');
2134
+ template.innerHTML = \`${te}${G}\`;
2135
+ ${z?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
2136
+ this._processSlots();
2137
+ }`:`
2138
+ private _render(): void {
2139
+ ${z?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${te}${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
+ ${de}
2160
+ /**
2161
+ * ${_} custom element class
2162
+ * @customElement ${k}
2163
+ */
2164
+ export class ${X} extends ${R} {
2165
+ ${le}
2166
+ private _initialized = false;
2167
+ ${z?"":"private _slotContent: Node[] = [];"}
2168
+
2169
+ constructor() {
2170
+ super();
2171
+ ${z?'this.attachShadow({ mode: "open" });':""}
2172
+ }
2173
+ ${fe}
2174
+ ${z?`
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
+ ${z?"":"this._slotContent = Array.from(this.childNodes);"}
2217
+ this._initialized = true;
2218
+ ${F?"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}': ${X};
2234
+ }
2235
+ }
2236
+
2237
+ // Register the web component
2238
+ customElements.define('${k}', ${X});
2239
+ `}function ub(v,_){let k=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),R=k?k[1].trim():"",T=_,z=[],F=!0;if(R){let G=R.match(/export\s+default\s+({[\s\S]*})/);if(G)try{let te=G[1],ce=te.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(ce)T=ce[1];let ee=te.match(/props\s*:\s*\[([\s\S]*?)\]/);if(ee)z=ee[1].split(",").map((ue)=>ue.trim().replace(/['"`]/g,"")).filter((ue)=>ue.length>0);let le=te.match(/shadowDOM\s*:\s*(true|false)/);if(le)F=le[1]==="true"}catch{}}let V=v.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),H=V?V[1].trim():"",K=v.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),X=K?K[1].trim():"";return{tag:T,props:z,template:H,styles:X,script:R,shadowDOM:F}}function db(v){let{tag:_,props:k,template:R,styles:T,shadowDOM:z}=v,F=_.split("-").map((G)=>G.charAt(0).toUpperCase()+G.slice(1)).join(""),V=R.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),H=T.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=k.map((G)=>`'${G}'`).join(", "),X=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
+ * ${F} Web Component
2253
+ * Auto-generated from SFC
2254
+ */
2255
+ class ${F} extends HTMLElement {
2256
+ constructor() {
2257
+ super();
2258
+ ${z?"this.attachShadow({ mode: 'open' });":""}
2259
+ this._render();
2260
+ }
2261
+
2262
+ static get observedAttributes() {
2263
+ return [${K}];
2264
+ }
2265
+
2266
+ attributeChangedCallback(name, oldValue, newValue) {
2267
+ if (oldValue !== newValue) {
2268
+ this._render();
2269
+ }
2270
+ }
2271
+ ${X}
2272
+
2273
+ _render() {
2274
+ const template = \`${H?`<style>${H}</style>`:""}${V}\`;
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
+ ${z?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
2282
+ }
2283
+
2284
+ connectedCallback() {
2285
+ this._render();
2286
+ }
2287
+ }
2288
+
2289
+ customElements.define('${_}', ${F});
2290
+ `}async function jf(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,""),F=(k.__stx_options||{}).componentsDir||"components",V=Ln.isAbsolute(F)?[Ln.join(F,`${T}.stx`),Ln.join(Ln.dirname(R),`${T}.stx`)]:[Ln.join(Ln.dirname(R),F,`${T}.stx`),Ln.join(process.cwd(),F,`${T}.stx`),Ln.join(Ln.dirname(R),`${T}.stx`)],H=null;for(let G of V)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 K=ub(H,T);return`<script type="module">
2291
+ ${db(K)}
2292
+ </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Ht,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:xf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:jf,hasEndTag:!1,description:"Include a web component in the template"},Hi,Vi,xr,Sr,sf,af,cf,of,mf,rf,Cf,Ol,...Dr],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 fb(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),z=dn.join(T,"resources","views"),F=dn.join(T,"resources","layouts");if(ys.existsSync(z)&&ys.existsSync(F))return{root:"resources",pagesDir:"views"};let V=dn.join(T,"resources","views","pages");if(ys.existsSync(V))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var Nf=new Set,Ia=["partialsDir","componentsDir","layoutsDir"],Ml=new WeakMap;function gb(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 il(v,_){let k=!v.root,R=fb(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!Nf.has(T))Nf.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(!Ml.has(v)){let T={};for(let z of Ia){let F=v[z];if(typeof F==="string"&&F)T[z]=F}Ml.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let z of Ia){let F=v[z];if(typeof F!=="string"||!F)continue;if(dn.isAbsolute(F)||gb(F,T))continue;v[z]=dn.join(T,F)}}for(let T of Ia){let z=v[T];if(typeof z!=="string"||!z||dn.isAbsolute(z))continue;v[T]=dn.resolve(_,z)}return v}function mb(v,_){let k=Ml.get(v);for(let R of Ia){let T=v[R];if(typeof T!=="string"||!T)continue;let z=dn.isAbsolute(T)?T:dn.join(_,T);if(ys.existsSync(z))continue;let F=k?.[R]??T,V=v.root,H=!!V&&V!==".";console.warn(`[stx] ${String(R)} resolves to "${z}", which does not exist. Configured as "${F}"`+(H?`, resolved under root "${V}".`:"."))}}function hb(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function yb(v){if(Ki(v.stateDir),v.stateDir=$n(),v.cachePath=Rn(v.cachePath),v.build)v.build.cacheDir=Rn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=Rn(v.media.cache.directory);if(v.story)v.story.outDir=Rn(v.story.outDir)}var Mr=null,Yr=new Map,Ta=new Map,yo=null;async function Us(v,_=pb){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?dn.resolve(v):process.cwd(),k=Ta.get(_);if(k&&k.signature!==br(k.graph)){let z=Yr.get(_);if(Yr.delete(_),Ta.delete(_),!v)Mr=null,yo=null;let{clearComponentCache:F}=await import("./chunk-rpbe5h6v.js"),{partialsCache:V}=await import("./chunk-taztcvv3.js");if(F(),V.clear(),z&&k.configSignature===vr(k.graph)){let H=z.then(async(K)=>{let X={...k.graph};await qs(X,_),Ta.set(_,{graph:X,signature:br(X),configSignature:vr(X)});let G={...K,_layerGraph:X};if(!v)Mr=G;return G});return Yr.set(_,H),H}}if(!v){if(Mr)return Mr;if(yo)return yo}let R=Yr.get(_);if(R)return R;let T=(async()=>{let z=[".ts",".js",".mjs",".cjs",".json"],F=z.some((te)=>ys.existsSync(dn.join(_,`stx.config${te}`))),V=z.some((te)=>ys.existsSync(dn.join(_,"config",`ui${te}`))),H;if(F&&V){let te=await Us({name:"ui",cwd:dn.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});H=(await Us({name:"stx",alias:"ui",cwd:_,defaultConfig:te.config,errorPolicy:"throw",verbose:!1})).config}else H=(await Us({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(H.extends!==void 0||k){let te=await qi(_,A);H=te.config,Ta.set(_,{graph:te.graph,signature:br(te.graph),configSignature:vr(te.graph)})}if(H.runtimeConfig){let{resolveRuntimeConfig:te}=await import("./chunk-qnh5x7vv.js");te(H.runtimeConfig,{});let{generateRuntimeConfigTypes:ce}=await import("./chunk-0d7dqt4d.js");await ce(_,H.runtimeConfig)}hb(H),yb(H),il(H,_),mb(H,_);let K=[],X=new Set((H.plugins??[]).map((te)=>typeof te==="string"?te:te[0]));for(let te of H.componentPackages??["@stacksjs/components"]){let ce=`${te}/stx-plugin`;if(X.has(ce)||X.has(te))continue;try{d.resolve(ce,{paths:[_]}),K.push(ce)}catch{}}let G=[...H.plugins??[],...K];if(G.length>0){let{pluginManager:te}=await import("./chunk-88dxeynx.js"),ce=[],ee=[];for(let le of G){let ue=typeof le==="string"?le:le[0],de=typeof le==="string"?{}:le[1]||{};try{let pe,fe;try{let ke=d.resolve(ue,{paths:[_]});pe=await import(ke),fe=dn.dirname(ke)}catch{let ke=dn.resolve(_,ue);pe=await import(ke),fe=dn.dirname(ke)}let Pe=pe.default||pe;if(!te.has(Pe.name))await te.register(Pe,H);if(Pe.components){let ke=Array.isArray(Pe.components)?Pe.components:[Pe.components];for(let we of ke)ce.push(dn.resolve(fe,we))}if(Pe.pages){let ke=dn.resolve(fe,Pe.pages),we=de.path||"/";ee.push({dir:ke,prefix:we})}if(Pe.setup){let ke={addDirective:(we)=>{H.customDirectives=H.customDirectives||[],H.customDirectives.push(we)},addRoute:(we,Me)=>{H.apiRoutes=H.apiRoutes||{},H.apiRoutes[we]=Me},addMiddleware:(we)=>{H.middleware=H.middleware||[],H.middleware.push(we)},pluginDir:fe,config:H};await Pe.setup(de,ke)}process.stderr.write(`[stx] Plugin loaded: ${Pe.name||ue}
2293
+ `)}catch(pe){console.warn(`[stx] Failed to load plugin ${ue}:`,pe.message)}}H._pluginComponentDirs=ce,H._pluginPageDirs=ee}return H})();if(Yr.set(_,T),T.catch(()=>{if(Yr.get(_)===T)Yr.delete(_)}),!v)yo=T,T.then((z)=>{Mr=z}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(Mr&&_ in Mr)return Mr[_];if(!yo)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function kd(v){return v}function Cd(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,z)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${z}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${z}].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[${z}].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[${z}].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((z)=>!R.includes(z)).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 Nl=new Map;async function be(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await xb.promises.stat(v)).mtime.getTime();if(_.cache&&Nl.has(v)){let G=Nl.get(v);if(G.updatedAt>=R)return{content:G.content,data:G.data}}let T=await Bun.file(v).text(),{data:z,content:F}=or(T),V=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=Ge(F,{gfm:!0});if(V.syntaxHighlighting?.enabled&&V.syntaxHighlighting?.serverSide)K=await wb(K,V.syntaxHighlighting?.defaultTheme||"github-dark",V.syntaxHighlighting?.highlightUnknownLanguages||!1);let X={content:K,data:z||{}};if(_.cache)Nl.set(v,{...X,updatedAt:R});return X}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 Pa=null;async function wb(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Pa)try{Pa=await bb({theme:_||"github-dark",cache:!0})}catch(V){return console.error("Failed to initialize ts-syntax-highlighter:",V),v}let T=async(V,H,K,X)=>{let G=X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),te=K||(k?"text":"");if(!te)return V;try{if(!Pa.getSupportedLanguages().includes(te))return V;return(await Pa.highlight(G,te,{theme:_})).html}catch(ce){console.error(`Error highlighting code block with language ${K}:`,ce)}return V},z=v,F=v.matchAll(R);for(let V of F){let[H,K,X,G]=V,te=await T(H,K,X,G);z=z.replace(H,te)}return z}async function Lf(v,_,k="",R={}){return await vb(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(F,V,H,K)=>{try{let X=V;if(!jl.isAbsolute(V))X=jl.resolve(jl.dirname(k),V);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 fe of pe){let Pe=fe.indexOf(":");if(Pe>0){let ke=fe.substring(0,Pe).trim(),we=fe.substring(Pe+1).trim(),Me=we.startsWith('"')&&we.endsWith('"'),Ne=we.startsWith("'")&&we.endsWith("'");if(Me||Ne)we=we.substring(1,we.length-1);G[ke]=we}}}}catch(de){if(R.debug)console.error("Error parsing context in @markdown-file directive:",de)}let{content:te,data:ce}=await be(X,R),ee={..._,...ce,...G},le=te,ue=/\{\{([^}]+)\}\}/g;return le=le.replace(ue,(de,pe)=>{let fe=pe.trim();return ee[fe]!==void 0?String(ee[fe]):de}),le}catch(X){let G=X instanceof Error?X.message:String(X);return g("Markdown File",`Error including markdown file: ${G}`,k,v,K,F)}})}async function vb(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let V=T[0],H=T.index,K=T;R.push(k(...K).then((X)=>({match:V,replacement:X,index:H})))}let z=await Promise.all(R);z.sort((V,H)=>H.index-V.index);let F=v;for(let{match:V,replacement:H}of z)F=F.replace(V,()=>H);return F}function jr(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Lr(v,_){let k=Sb(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function Sb(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 $b(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Qr(v,_,k,R){let T=1,z=R,F=new RegExp(`@${_}\\s*\\(`,"g"),V=new RegExp(`@${k}(?![a-z])`,"g");while(z<v.length&&T>0){F.lastIndex=z,V.lastIndex=z;let H=F.exec(v),K=V.exec(v),X=H?H.index:1/0,G=K?K.index:1/0;if(X<G)T++,z=X+H[0].length;else if(G<1/0){if(T--,T===0)return G;z=G+K[0].length}else break}return-1}function Bf(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=Lr(v,R);if(!T)return null;let z=T.endPos,F=Qr(v,"if","endif",z);if(F===-1)return null;let V=v.slice(z,F),H=[],K=0,X="if",G=T.expression,te=0,ce=0;while(K<V.length){let ee=V.indexOf("@",K);if(ee===-1)break;K=ee;let le=V.substring(ee);if($b(V,ee)){K++;continue}if(/^@if\s*\(/.test(le)){ce++,K++;continue}if(/^@endif(?![a-z])/.test(le)){ce--,K+=6;continue}if(ce===0){let ue=le.match(/^@elseif\s*/);if(ue){H.push({type:X,condition:G,content:V.substring(te,K),start:z+te,end:z+K});let de=K+ue[0].length,pe=Lr(V,de);if(!pe){K++;continue}X="elseif",G=pe.expression,K=pe.endPos,te=K;continue}else if(/^@else(?![a-z])/.test(le)){H.push({type:X,condition:G,content:V.substring(te,K),start:z+te,end:z+K}),X="else",G=void 0,K+=5,te=K;continue}}K++}return H.push({type:X,condition:G,content:V.slice(te),start:z+te,end:z+V.length}),{fullMatch:v.slice(_,F+6),branches:H,start:_,end:F+6}}function xo(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((F)=>R.index>F.start&&R.index<F.end)){R=k.exec(v);continue}let z=Bf(v,R.index);if(z)_.push(z),k.lastIndex=z.end;R=k.exec(v)}return _}function Da(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),z=T.exec(v);while(z!==null){if(R.some((le)=>z.index>le.start&&z.index<le.end)){z=T.exec(v);continue}let V=z.index,H=V+z[0].length-1,K=S(v,"(",")",H);if(K===-1){z=T.exec(v);continue}let X=v.slice(H+1,K),G=K+1,te=Qr(v,_,k,G);if(te===-1){z=T.exec(v);continue}let ce=v.slice(G,te),ee=te+`@${k}`.length;R.push({fullMatch:v.slice(V,ee),name:_,params:X,content:ce,start:V,end:ee}),T.lastIndex=ee,z=T.exec(v)}return R}function Ll(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=Lr(v,R);if(!T)return null;let z=T.endPos,F=Qr(v,"switch","endswitch",z);if(F===-1)return null;let V=v.slice(z,F),H=[],K=0,X=null,G=0;while(K<V.length){let te=V.slice(K),ce=te.match(/^@switch\s*\(/),ee=te.match(/^@endswitch(?![a-z])/);if(ce){if(G++,X)X.content+=ce[0];K+=ce[0].length;continue}if(ee){if(G--,X)X.content+=ee[0];K+=ee[0].length;continue}if(G>0){if(X)X.content+=V[K];K++;continue}let le=te.match(/^@case\s*/),ue=te.match(/^@default(?![a-z])/),de=te.match(/^@break(?![a-z])/);if(le&&te.startsWith("@case")){if(X)H.push(X);let pe=K+le[0].length,fe=Lr(V,pe);if(!fe){K++;continue}X={type:"case",value:fe.expression,content:""},K=fe.endPos}else if(ue&&te.startsWith("@default")){if(X)H.push(X);X={type:"default",content:""},K+=ue[0].length}else if(de&&te.startsWith("@break"))K+=de[0].length;else{if(X)X.content+=V[K];K++}}if(X)H.push(X);return{fullMatch:v.slice(_,F+10),expression:T.expression,cases:H,start:_,end:F+10}}function Cb(v,_,k){let R=v,T=!0;while(T){T=!1;let z=R.match(/@switch\s*\(/);if(!z||z.index===void 0)break;let F=z.index,V=Ll(R,F);if(!V)break;try{let H;if(p(V.expression))H=c(V.expression,Object.keys(_))(...Object.values(_));else H=l(V.expression,_);let K="",X=!1;for(let G of V.cases)if(G.type==="default"){if(!X)K=G.content.trim()}else try{let te;if(G.value&&p(G.value))te=c(G.value,Object.keys(_))(...Object.values(_));else if(G.value)te=l(G.value,_);if(H===te){K=G.content.trim(),X=!0;break}}catch{continue}R=R.substring(0,F)+K+R.substring(V.end),T=!0}catch(H){let K=H instanceof Error?H.message:String(H),X=i("Switch",`Error evaluating @switch expression: ${K}`,t.EVALUATION_ERROR);R=R.substring(0,F)+X+R.substring(V.end);break}}return R}function Rb(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function Ab(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function sr(v,_,k){let{masked:R,scripts:T}=Rb(v);return Ab(Tb(R,_,k),T)}function Tb(v,_,k){let R=v;R=Cb(R,_,k);{let z=!0;while(z){z=!1;let F=R.match(/@unless\s*\(/);if(!F||F.index===void 0)break;let V=F.index,H=Lr(R,V+7);if(!H)break;let K=H.endPos,X=Qr(R,"unless","endunless",K);if(X===-1){console.warn(`[stx] @unless directive at position ${V} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let G=R.slice(K,X),te=H.expression,ce=-1;{let le=0,ue=/@(?:if|unless)\s*\(/g,de=/@(?:endif|endunless)(?![a-z])/g,pe=/@else(?![a-z])/g,fe=[],Pe;while((Pe=ue.exec(G))!==null)fe.push({pos:Pe.index,type:"open"});while((Pe=de.exec(G))!==null)fe.push({pos:Pe.index,type:"close"});while((Pe=pe.exec(G))!==null)fe.push({pos:Pe.index,type:"else"});fe.sort((ke,we)=>ke.pos-we.pos);for(let ke of fe)if(ke.type==="open")le++;else if(ke.type==="close")le--;else if(ke.type==="else"&&le===0){ce=ke.pos;break}}let ee;if(ce!==-1){let le=G.slice(0,ce),ue=G.slice(ce+5);ee=`@if (${te})${ue}@else ${le}@endif`}else ee=`@if (!(${te}))${G}@endif`;R=R.substring(0,V)+ee+R.substring(X+10),z=!0}}R=zl(R,_,k),R=Wl(R,_,k),R=Bl(R,_);let T=()=>{let z=xo(R);if(z.length===0)return!1;let F=Array(z.length);for(let K=z.length-1;K>=0;K--){let X=z[K];try{let G="",te=!1;for(let ce of X.branches){if(te)break;if(ce.type==="else")G=ce.content,te=!0;else try{if(ce.condition?ta(ce.condition,_):!1)G=ce.content,te=!0}catch(ee){G=i(ce.type==="if"?"If":"Elseif",`Error in @${ce.type}(${ce.condition}): ${ee instanceof Error?ee.message:String(ee)}`,t.EVALUATION_ERROR),te=!0}}F[K]=G}catch(G){let te=G instanceof Error?G.message:String(G);F[K]=i("If",`Error processing @if block: ${te}`,t.EVALUATION_ERROR)}}let V=Array(z.length*2+1),H=0;for(let K=0;K<z.length;K++){let X=z[K];V[K*2]=R.slice(H,X.start),V[K*2+1]=F[K],H=X.end}return V[z.length*2]=R.slice(H),R=V.join(""),!0};while(!0){let z=R;if(!T())break;if(R===z)break}return R}function zf(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 Bl(v,_){let k=v;function R(V,H,K,X){let G=1,te=X,ce=new RegExp(`@${H}(?:\\s*\\(|\\s|$)`,"g"),ee=new RegExp(`@${K}(?![a-z])`,"g");while(te<V.length&&G>0){ce.lastIndex=te,ee.lastIndex=te;let le=ce.exec(V),ue=ee.exec(V),de=le?le.index:1/0,pe=ue?ue.index:1/0;if(de<pe)G++,te=de+le[0].length;else if(pe<1/0){if(G--,G===0)return pe;te=pe+ue[0].length}else break}return-1}function T(V,H,K){let X=0,G=new RegExp(`@${H}(?:\\s*\\(|\\s|$)`,"g"),te=new RegExp(`@${K}(?![a-z])`,"g"),ce=/@else(?![a-z])/g,ee=[],le;while((le=G.exec(V))!==null)ee.push({pos:le.index,type:"open"});while((le=te.exec(V))!==null)ee.push({pos:le.index,type:"close"});while((le=ce.exec(V))!==null)ee.push({pos:le.index,type:"else"});ee.sort((ue,de)=>ue.pos-de.pos);for(let ue of ee)if(ue.type==="open")X++;else if(ue.type==="close")X--;else if(ue.type==="else"&&X===0)return ue.pos;return-1}{let V=!0;while(V){V=!1;let H=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!H||H.index===void 0)break;let K=H.index,X,G,te=k.slice(K+5),ce=zf(te);if(ce)X=ce.value,G=K+5+ce.consumed;else G=K+5;let ee=R(k,"auth","endauth",G);if(ee===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let le=k.slice(G,ee),ue=T(le,"auth","endauth"),de;if(!_.auth)de=!1;else de=X?jr(`auth?.check && auth?.user?.[${X}]`,_):jr("auth?.check",_);let pe;if(ue!==-1){let fe=le.slice(0,ue),Pe=le.slice(ue+5);pe=de?fe:Pe}else pe=de?le:"";k=k.substring(0,K)+pe+k.substring(ee+8),V=!0}}{let V=!0;while(V){V=!1;let H=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!H||H.index===void 0)break;let K=H.index,X,G,te=k.slice(K+6),ce=zf(te);if(ce)X=ce.value,G=K+6+ce.consumed;else G=K+6;let ee=R(k,"guest","endguest",G);if(ee===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let le=k.slice(G,ee),ue=T(le,"guest","endguest"),de;if(!_.auth)de=!0;else de=X?jr(`!auth?.check || !auth?.user?.[${X}]`,_):jr("!auth?.check",_);let pe;if(ue!==-1){let fe=le.slice(0,ue),Pe=le.slice(ue+5);pe=de?fe:Pe}else pe=de?le:"";k=k.substring(0,K)+pe+k.substring(ee+9),V=!0}}function z(V,H,K){if(_.userCan&&typeof _.userCan[V]==="boolean")return _.userCan[V];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let X=[V];if(H)X.push(H);if(K){let G=jr(K,_);X.push(G)}return _.permissions.check(...X)}catch{return!1}return!1}function F(V){let H=V.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 V of["can","cannot"]){let H=`end${V}`,K=V==="can"?"elsecan":"elsecannot",X=!0;while(X){X=!1;let G=k.match(new RegExp(`@${V}\\s*\\(`));if(!G||G.index===void 0)break;let te=G.index,ce=k.slice(te+`@${V}`.length),ee=F(ce);if(!ee)break;let le=te+`@${V}`.length+ee.paramsEnd,ue=R(k,V,H,le);if(ue===-1){console.warn(`[stx] @${V} directive at position ${te} has no matching @${H} \u2014 the block was skipped.`);break}let de=k.slice(le,ue),pe=[],fe=0,Pe=new RegExp(`@${V}\\s*\\(`,"g"),ke=new RegExp(`@${H}(?![a-z])`,"g"),we=new RegExp(`@${K}\\s*\\(`,"g"),Me=/@else(?![a-z])/g,Ne=[],Le;while((Le=Pe.exec(de))!==null)Ne.push({pos:Le.index,type:"open"});while((Le=ke.exec(de))!==null)Ne.push({pos:Le.index,type:"close"});while((Le=we.exec(de))!==null)Ne.push({pos:Le.index,type:"elseDirective"});while((Le=Me.exec(de))!==null)Ne.push({pos:Le.index,type:"else"});Ne.sort((Ue,We)=>Ue.pos-We.pos);for(let Ue of Ne){if(Ue.type==="open"){fe++;continue}if(Ue.type==="close"){fe--;continue}if(fe===0)pe.push(Ue)}let Be=[],ze=0;for(let Ue=0;Ue<pe.length;Ue++){let We=pe[Ue];if(Be.push({content:de.slice(ze,We.pos),ability:void 0}),We.type==="elseDirective"){let ct=de.slice(We.pos+`@${K}`.length),$t=F(ct);if($t){Be[Be.length-1]={content:de.slice(ze,We.pos)},ze=We.pos+`@${K}`.length+$t.paramsEnd,Be.push({content:"",ability:$t.ability,type:$t.type,id:$t.id}),Be.pop();let wt=pe[Ue+1],It=wt?wt.pos:de.length;Be.push({content:de.slice(ze,It),ability:$t.ability,type:$t.type,id:$t.id}),ze=It}}else ze=We.pos+5}if(ze<de.length){let Ue=Be[Be.length-1];if(pe.length>0&&pe[pe.length-1].type==="else")Be.push({content:de.slice(ze),isFinalElse:!0});else if(Be.length===0)Be.push({content:de.slice(ze)})}let je=z(ee.ability,ee.type,ee.id),Fe=V==="can"?je:!je,Ve="";if(Fe)Ve=Be[0]?.content||"";else{let Ue=!1;for(let We=1;We<Be.length;We++){let ct=Be[We];if(ct.isFinalElse){Ve=ct.content,Ue=!0;break}if(ct.ability){let $t=z(ct.ability,ct.type,ct.id);if(V==="can"?$t:!$t){Ve=ct.content,Ue=!0;break}}}if(!Ue&&Be.length>0){let We=Be[Be.length-1];if(We.isFinalElse)Ve=We.content}}k=k.substring(0,te)+Ve+k.substring(ue+`@${H}`.length),X=!0}}return k}function zl(v,_,k){let R=v;function T(z,F,V,H,K){let X=!0;while(X){X=!1;let G=new RegExp(`@${F}\\s*\\(`),te=z.match(G);if(!te||te.index===void 0)break;let ce=te.index,ee=Lr(z,ce+`@${F}`.length);if(!ee)break;let le=ee.endPos,ue=Qr(z,F,V,le);if(ue===-1){console.warn(`[stx] @${F} directive at position ${ce} has no matching @${V} \u2014 the block was skipped.`);break}let de=z.slice(le,ue),pe=ee.expression,fe=-1,Pe=0,ke=0;while(ke<de.length){let we=de.indexOf("@",ke);if(we===-1)break;let Me=de.substring(we);if(/^@(?:if|unless|isset|empty)\s*\(/.test(Me)){Pe++,ke=we+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(Me)){Pe--,ke=we+1;continue}if(Pe===0&&/^@else(?![a-z])/.test(Me)){fe=we;break}ke=we+1}try{let we=H(pe.trim()),Me;if(fe!==-1){let Ne=de.slice(0,fe),Le=de.slice(fe+5);Me=we?Ne:Le}else Me=we?de:"";z=z.substring(0,ce)+Me+z.substring(ue+`@${V}`.length),X=!0}catch(we){let Me=we instanceof Error?we.message:String(we),Ne=i(K,`Error processing @${F} directive: ${Me}`,t.EVALUATION_ERROR);z=z.substring(0,ce)+Ne+z.substring(ue+`@${V}`.length);break}}return z}return R=T(R,"isset","endisset",(z)=>{let F=jr(z,_);return F!==void 0&&F!==null},"Isset"),R=T(R,"empty","endempty",(z)=>{let F=jr(z,_);return F===void 0||F===null||F===""||F===0||F===!1||Array.isArray(F)&&F.length===0||typeof F==="object"&&F!==null&&Object.keys(F).length===0},"Empty"),R}function Wl(v,_,k){let R=v,T="development";function z(F,V,H,K){let X=new RegExp(`@${V}(?![a-z])`,"g"),G=new RegExp(`@${H}(?![a-z])`,"g"),te=new RegExp(`^@${V}(?![a-z])`),ce=new RegExp(`^@${H}(?![a-z])`),ee=F,le=!0;while(le){le=!1,X.lastIndex=0;let ue=X.exec(ee);if(!ue)break;let de=ue.index,pe=de+ue[0].length;if(V==="env"){let je=ee.substring(pe).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!je)break;pe+=je[0].length,K=T===je[2]}let fe=1,Pe=pe,ke=-1;while(fe>0&&Pe<ee.length){X.lastIndex=Pe,G.lastIndex=Pe;let je=X.exec(ee),Fe=G.exec(ee),Ve=je?je.index:1/0,Ue=Fe?Fe.index:1/0;if(Ve<Ue)fe++,Pe=Ve+je[0].length;else if(Ue<1/0){if(fe--,fe===0){ke=Ue;break}Pe=Ue+Fe[0].length}else break}if(ke===-1){console.warn(`[stx] @${V} directive at position ${de} has no matching @${H} \u2014 the block was skipped.`);break}let we=ee.substring(pe,ke),Me=-1,Ne=0,Le=0;while(Le<we.length){let je=we.indexOf("@",Le);if(je===-1)break;let Fe=we.substring(je);if(te.test(Fe)){Ne++,Le=je+1;continue}if(ce.test(Fe)){Ne--,Le=je+1;continue}if(Ne===0&&/^@else(?![a-z])/.test(Fe)){Me=je;break}Le=je+1}let Be;if(Me!==-1){let je=we.slice(0,Me),Fe=we.slice(Me+5);Be=K?je:Fe}else Be=K?we:"";let ze=`@${H}`.length;ee=ee.substring(0,de)+Be+ee.substring(ke+ze),le=!0}return ee}return R=z(R,"env","endenv",!1),R=z(R,"production","endproduction",T==="production"),R=z(R,"development","enddevelopment",T==="development"),R=z(R,"staging","endstaging",T==="staging"),R=z(R,"testing","endtesting",T==="testing"),R}var Wf=new WeakMap;function Ff(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function Oa(v,_){if(!v)return _?.nonceGenerator?.()??Ff();let k=Wf.get(v);if(!k)k=_?.nonceGenerator?.()??Ff(),Wf.set(v,k);return k}function Ib(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 z=[...T];if(_&&(R==="script-src"||R==="style-src"))z=z.filter((F)=>!F.startsWith("'nonce-")),z.push(`'nonce-${_}'`);if(z.length>0)k.push(`${R} ${z.join(" ")}`)}}return k.join("; ")}function Vf(v,_){return`<meta http-equiv="Content-Security-Policy" content="${Ib(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function Uf(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?Oa(k,_):void 0,T=Vf(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
2294
+ ${T}`)}function Hf(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 qf(v,_,k,R){let T=v,z=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!z?.enabled||!z.directives)return"<!-- CSP not configured -->";let F=z.useNonce?Oa(_,z):void 0;return Vf(z.directives,F)}),T=T.replace(/@cspNonce\b/g,()=>{if(!z?.enabled||!z.useNonce)return"";return Oa(_,z)}),z?.enabled&&z.useNonce)_.cspNonce=Oa(_,z);return T}import Pb from"crypto";var Db=40,Kf="_token",Fl=null;function Ob(v=Db){let _=Pb.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return Fl=_,_}function Mb(){if(!Fl)Ob();return Fl}function jb(v=Kf){let _=Mb();return`<input type="hidden" name="${v}" value="${_}">`}function Xf(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>jb(R||Kf))}async function Zf(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let z of R.customDirectives){if(!z.name||typeof z.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",z);continue}if(z.hasEndTag)T=await Nb(T,z,_,k,R);else T=await Lb(T,z,_,k,R)}return T}async function Nb(v,_,k,R,T){let{name:z,handler:F}=_,V=`@${z}`,H=`@end${z}`,K=v,X=Xr(`${V}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${H}`,"g"),G=[],te=X.exec(K);while(te!==null){let[ce,ee="",le=""]=te,ue=te.index||0;try{let de=ee?Gf(_,ee):[],pe=le.trim(),fe=await F(pe,de,k,R);G.push({original:ce,processed:fe,startIndex:ue})}catch(de){let pe=de instanceof Error?de.message:String(de);if(T.debug)console.error(`Error processing custom directive @${z}:`,de);G.push({original:ce,processed:i("CustomDirective",`Error in @${z}${ee?`(${ee})`:""}: ${pe}`,t.EVALUATION_ERROR),startIndex:ue})}te=X.exec(K)}for(let ce=G.length-1;ce>=0;ce--){let{original:ee,processed:le}=G[ce];K=K.replace(ee,le)}return K}async function Lb(v,_,k,R,T){let{name:z,handler:F}=_,V=v,H=[],K=[];if(_.rawParams){for(let te of Qs(V,Xr(`(?<![\\w$@])@${z}\\s*\\(`,"g")))if(te.end!==-1)K.push({fullMatch:te.call,paramString:te.args,startIndex:te.start})}else{let te=Xr(`@${z}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");te.lastIndex=0;let ce=te.exec(V);while(ce!==null)K.push({fullMatch:ce[0],paramString:ce[1]??"",startIndex:ce.index||0}),ce=te.exec(V)}for(let{fullMatch:te,paramString:ce,startIndex:ee}of K)try{let le=Gf(_,ce),ue=await F("",le,k,R);H.push({original:te,processed:ue,startIndex:ee})}catch(le){let ue=le instanceof Error?le.message:String(le);if(T.debug)console.error(`Error processing custom directive @${z}:`,le);H.push({original:te,processed:i("CustomDirective",`Error in @${z}(${ce}): ${ue}`,t.EVALUATION_ERROR),startIndex:ee})}let X=Xr(`@${z}(?!\\w)(?!\\s*\\()`,"g"),G=X.exec(V);while(G!==null){let[te]=G,ce=G.index||0;try{let ee=await F("",[],k,R);H.push({original:te,processed:ee,startIndex:ce})}catch(ee){let le=ee instanceof Error?ee.message:String(ee);if(T.debug)console.error(`Error processing custom directive @${z}:`,ee);H.push({original:te,processed:i("CustomDirective",`Error in @${z}: ${le}`,t.EVALUATION_ERROR),startIndex:ce})}G=X.exec(V)}for(let te=H.length-1;te>=0;te--){let{original:ce,processed:ee}=H[te];V=V.replace(ce,ee)}return V}function Gf(v,_){return v.rawParams?lt(_):Bb(_)}function Bb(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let z=0;z<v.length;z++){let F=v[z];if((F==='"'||F==="'")&&(z===0||v[z-1]!=="\\"))if(!R)R=!0,T=F;else if(F===T)R=!1;else k+=F;else if(F===","&&!R)_.push(k.trim()),k="";else k+=F}if(k.trim())_.push(k.trim());return _.map((z)=>{let F=z.trim();if(F.startsWith('"')&&F.endsWith('"')||F.startsWith("'")&&F.endsWith("'"))return F.substring(1,F.length-1);return F})}var Jf=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Yf=/^[A-Za-z_$][\w$]*$/,zb=new Set(["light","dark","system"]);function es(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function Wb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(es(_.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(es(R.key,"colorMode.key"),es(R.attribute,"colorMode.attribute"),es(R.default,"colorMode.default"),!Yf.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Jf.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!zb.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(es(k.key,"appearance.key"),es(k.attribute,"appearance.attribute"),es(k.default,"appearance.default"),!Yf.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Jf.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((z)=>typeof z!=="string"||z.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 Fb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Vb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${Fb(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 Ub(v,_){let k=1,R=null,T=!1;for(let z=_+1;z<v.length;z++){let F=v[z];if(T){T=!1;continue}if(R){if(F==="\\")T=!0;else if(F===R)R=null;continue}if(F==='"'||F==="'"||F==="`"){R=F;continue}if(F==="(")k++;else if(F===")"&&--k===0)return z}return-1}function Qf(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let z=T.index+T[0].length-1,F=Ub(k,z);if(F===-1)throw Error("@appearanceBootstrap has an unclosed options object");let V=k.slice(z+1,F).trim(),H=l(`(${V})`,_),K=Vb(Wb(H));k=k.slice(0,T.index)+K+k.slice(F+1),R.lastIndex=T.index+K.length}return k}import Hb from"crypto";function sn(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var tg={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ma(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function Wn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ws(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${sn(_)}"`}function Vl(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(`${Wn(v)}-error`)}"`;return R}function qb(){return Hb.randomUUID()}function ja(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=qb();_.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 z=T.toUpperCase();if(T&&!["GET","POST"].includes(z))return`<input type="hidden" name="_method" value="${sn(z)}">`;return R}),k}function ng(v,_,k=tg){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,z,F,V,H,K="")=>{let X=z||F||"POST",G=V||H||"",te=Br(K),ce=X.toUpperCase(),ee=["GET","POST"].includes(ce)?ce:"POST",le=`<form method="${sn(ee)}" action="${sn(G)}"${te?` ${te}`:""}>`;if(le+=`
2295
+ ${ja("@csrf",_)}`,!["GET","POST"].includes(ce))le+=`
2296
+ ${ja(`@method('${ce}')`,_)}`;return le}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,z,F,V,H,K="")=>{let X=z||F||"",G=V||H||"",te=Br(K),ce=bo(X,_),ee=ce!==void 0&&ce!==null?ce:G||"",le=te.match(/type=['"]([^'"]+)['"]/i),ue=le?le[1]:"text",de=wo(X,_),pe=te.match(/class=['"]([^'"]+)['"]/i),fe=Ma(pe?pe[1]:"",k.input,de,k.inputError),Pe=te.replace(/class=['"][^'"]+['"]/i,"");return Pe=Pe.replace(/type=['"][^'"]+['"]/i,""),`<input type="${sn(ue)}" name="${sn(X)}"${Ws(te,Wn(X))} value="${sn(ee)}" class="${fe}"${Vl(X,de,te)}${Pe?` ${Pe}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,z,F="",V="")=>{let H=Br(F),K=bo(z,_)||V.trim(),X=wo(z,_),G=H.match(/class=['"]([^'"]+)['"]/i),te=Ma(G?G[1]:"",k.input,X,k.inputError),ce=H.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${sn(z)}"${Ws(H,Wn(z))} class="${te}"${Vl(z,X,H)}${ce?` ${ce}`:""}>${sn(K)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,z,F="",V)=>{let H=Br(F),K=bo(z,_),X=wo(z,_),G=H.match(/class=['"]([^'"]+)['"]/i),te=Ma(G?G[1]:"",k.input,X,k.inputError),ce=H.replace(/class=['"][^'"]+['"]/i,""),ee=V;if(K!==void 0)ee=V.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(le,ue,de)=>{if((Array.isArray(K)?K.some((fe)=>String(fe)===de):String(K)===de)&&!ue.includes("selected"))return ue.replace(/(<option)/,"$1 selected");return le});return`<select name="${sn(z)}"${Ws(H,Wn(z))} class="${te}"${Vl(z,X,H)}${ce?` ${ce}`:""}>${ee}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,z,F,V="")=>{let H=F===void 0?"1":F,K=F===void 0?Wn(z):`${Wn(z)}-${Wn(H)}`,X=Br(V),G=bo(z,_),te=G!==void 0&&(Array.isArray(G)?G.some((ue)=>String(ue)===H):G===!0||String(G)===H),ce=X.match(/class=['"]([^'"]+)['"]/i),ee=ce?ce[1]:k.checkInput,le=X.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${sn(z)}"${Ws(X,K)} value="${sn(H)}" class="${ee}"${te?" checked":""}${le?` ${le}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,z,F,V="")=>{let H=Br(V),K=bo(z,_),X=K!==void 0&&K===F,G=H.match(/class=['"]([^'"]+)['"]/i),te=G?G[1]:k.checkInput,ce=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${sn(z)}"${Ws(H,`${Wn(z)}-${Wn(F)}`)} value="${sn(F)}" class="${te}"${X?" checked":""}${ce?` ${ce}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,z,F="")=>{let V=Br(F),H=V.match(/accept=['"]([^'"]+)['"]/i),K=H?H[1]:"",X=V.includes("multiple"),G=wo(z,_),te=V.match(/class=['"]([^'"]+)['"]/i),ce=Ma(te?te[1]:"",k.input,G,k.inputError),ee=V.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),le=[`<input type="file" name="${sn(z)}"${Ws(V,Wn(z))}`,`class="${ce}"`];if(K)le.push(`accept="${sn(K)}"`);if(X)le.push("multiple");if(ee)le.push(ee);return`${le.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,z,F="",V)=>{let H=Br(F),K=H.match(/class=['"]([^'"]+)['"]/i),X=K?K[1]:k.label,G=H.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${sn(Wn(z))}" class="${X}"${G?` ${G}`:""}>${V}</label>`}),R}function rg(v,_,k=tg){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,z)=>{try{if(wo(T,_)){let F=z.replace(/\{\{([^}]+)\}\}/g,(V,H)=>{try{if(H.trim()==="$message"||H.trim()==="message")return eg(T,_);if(H.trim().includes("errors.first")||H.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return eg(T,_)}let K=H.trim();if(p(K)){let X=l(K,_);return X!==void 0?String(X):K}return K}catch{return H}});return`<div id="${sn(`${Wn(T)}-error`)}" role="alert">${F}</div>`}return""}catch(F){return console.error("Error processing @error directive:",F),R}})}function wo(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 eg(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 bo(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 Br(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[,z,,F]=T;_.push(`${z}="${F.trim()}"`)}return _.join(" ")}var Ul=m(256),Kb=[{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"}],sg=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Xb(v){let _=Array.from(v,(T)=>T===`
2297
+ `?`
2298
+ `:" "),k=0,R="";while(k<v.length){let T=v[k],z=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==="/"&&z==="/"){while(k<v.length&&v[k]!==`
2299
+ `)_[k]=v[k],k++;continue}if(T==="/"&&z==="*"){let F=v.indexOf("*/",k+2),V=F===-1?v.length:F+2;for(;k<V;k++)_[k]=v[k];continue}if(T==="{"&&z==="{"&&v.slice(k,k+4)==="{{--"){let F=v.indexOf("--}}",k+4),V=F===-1?v.length:F+4;for(;k<V;k++)_[k]=v[k];continue}k++}return _.join("")}function Zb(v){let _=new Map,k=Xb(v).split(`
2300
+ `),R=v.split(`
2301
+ `);return k.forEach((T,z)=>{sg.lastIndex=0;for(let F of T.matchAll(sg)){let V=F[1]==="-next-line",H=(R[z]??"").slice(0,F.index).trim(),K=V||H===""?z+2:z+1,G=(F[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),te=G.filter((ee)=>/\w/.test(ee));if(G.length>0&&te.length===0)continue;let ce=_.get(K);if(ce&&ce.size===0)continue;if(te.length===0){_.set(K,new Set);continue}if(ce)te.forEach((ee)=>ce.add(ee));else _.set(K,new Set(te))}}),_}function Gb(v,_,k){let R=v.get(_);if(!R)return!1;if(R.size===0)return!0;return[...R].some((T)=>k.includes(T))}function et(v,_,k,R){let T=typeof k==="boolean"?{enabled:k,failOnViolation:k}:k??{enabled:!1};if(!T.enabled)return;let z=h(v,_,R,JSON.stringify(T)),F=Ul.get(z);if(F!==void 0){if(F&&T.failOnViolation)throw new q(F,R??_);return}let V=T.allowPatterns??[],H=Zb(v),K=[],X=s(v.replace(/\{\{--[\s\S]*?--\}\}/g,(ee)=>ee.replace(/[^\n]/g," ")));for(let{pattern:ee,message:le,suggestion:ue}of Kb){if(V.some((pe)=>/\w/.test(pe)&&le.includes(pe)))continue;ee.lastIndex=0;let de=X.match(ee);if(de&&de.length>0){let pe=X.split(`
2302
+ `),fe=v.split(`
2303
+ `),Pe=[];if(pe.forEach((Ne,Le)=>{if(ee.lastIndex=0,ee.test(Ne)&&!Gb(H,Le+1,le))Pe.push(Le+1)}),Pe.length===0&&pe.some((Ne)=>(ee.lastIndex=0,ee.test(Ne))))continue;let ke=Pe.length>0?` (script line${Pe.length>1?"s":""} ${Pe.join(", ")})`:"",we=Pe.slice(0,3).map((Ne)=>` ${Ne} | ${(fe[Ne-1]??"").trim().slice(0,100)}`).join(`
2304
+ `),Me=we?`
2305
+ ${we}`:"";K.push(` \u2717 ${le}${ke}
2306
+ \u2192 ${ue}${Me}`)}}if(K.length===0){Ul.set(z,"");return}let G=(ee)=>{let le=`${process.cwd()}/`;return ee.startsWith(le)?ee.slice(le.length):ee},ce=`[STX] DOM API violation in ${R&&R!==_?`${G(R)} (composed into ${G(_)})`:G(_)}:
2307
+ ${K.join(`
2308
+ `)}
2309
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Ul.set(z,ce),console.warn(ce),T.failOnViolation)throw new q(ce,R??_)}var vo=/<\/?template\b[^>]*>/gi,Jb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Yb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return Jb.test(_)}function oe(v){vo.lastIndex=0;let _;while((_=vo.exec(v))!==null){if(_[0].startsWith("</")||Yb(_[0]))continue;let k=_.index,R=vo.lastIndex,T=1,z;while((z=vo.exec(v))!==null)if(z[0].startsWith("</")){if(T--,T===0){let F=z.index;return{start:k,openEnd:R,closeStart:F,end:vo.lastIndex,content:v.slice(R,F)}}}else T++;return null}return null}import Qt from"path";import{existsSync as Sv}from"fs";class ig{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=mc(v,R);if(T!==void 0)return T;for(let z of hc(v,_,k,R))if(await r(z))return z;return null}}var Gs=new ig;function Zt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var zr="\x00stx-boolean-attribute";function Hl(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Qb=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 ql(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Qb.has(_)}function Wr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let z=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(Zt(z));continue}if(T===zr){k.push(Zt(z));continue}k.push(`${Zt(z)}="${Zt(Hl(String(T)))}"`)}return k}function Fr(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 z=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(Zt(z));continue}if(typeof T==="object")continue;k.push(`${Zt(z)}="${Zt(Hl(String(T)))}"`)}return k}function ei(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ew(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 Kl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=ew(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),z=typeof v.static.activeClass==="string"?v.static.activeClass:"active",F=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",V=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,H=[];if(R.reactive)H.push(`:href="${ei(R.value)}"`);else H.push(`href="${ei(Ui(R.value,"navigable"))}"`);if(T)H.push(`class="${ei(T)}"`);if(H.push("data-stx-link"),H.push(`data-stx-active-class="${ei(z)}"`),H.push(`data-stx-exact-active-class="${ei(F)}"`),V)H.push("data-stx-prefetch");let K=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(K)H.push(`data-stx-active-match="${ei(K)}"`);let X=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return H.push(...Wr(v,X)),H.push(...Fr(v,X)),`<a ${H.join(" ")}>${_}</a>`}};import{createHash as xg}from"crypto";import hn from"fs";import pn from"path";import{decode as cw,generateThumbHash as lw}from"ts-images";import{createImageDeliveryCatalog as dg}from"ts-images/delivery";import Xl from"fs";function Na(v,_,k){let R=Buffer.alloc(k),T=Xl.readSync(v,R,0,k,_);return R.subarray(0,T)}function Zl(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function Gl(v){let _;try{_=Xl.openSync(v,"r");let k=Na(_,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 z=0;z<64;z++){let F=Na(_,T,8);if(F.length<8)return"unknown";let V=F.toString("latin1",4,8);if(V==="tRNS")return"possible";if(V==="IDAT"||V==="IEND")return"none";T+=12+F.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Zl(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)Xl.closeSync(_)}}import tw from"fs";import La from"os";import{join as og}from"path";import{fileURLToPath as ag}from"url";import{Worker as cg}from"worker_threads";var za=Symbol("stx.image-worker.unavailable");function nw(v=typeof La.availableParallelism==="function"?La.availableParallelism():La.cpus().length){return Math.max(1,Math.min(2,v-1))}var Ba=0,ug=[];async function rw(){if(Ba<nw()){Ba++;return}await new Promise((v)=>ug.push(v)),Ba++}function sw(){Ba--,ug.shift()?.()}var iw="@stacksjs/stx/builtins/image-warmup-worker";function ow(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:"&&tw.existsSync(ag(k)))return ag(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(iw,v):void 0;return k&&aw(k)?k:void 0}catch{return}}function aw(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,og(_.BUN_INSTALL||og(La.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var lg=!1;function So(v){if(!lg)lg=!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 za}function Jl(v){return v instanceof Error?v.message:String(v)}async function Yl(v,_){if(typeof cg!=="function")return So("node:worker_threads has no Worker in this runtime");let k=ow();if(!k)return So("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await rw();try{return await new Promise((R,T)=>{let z;try{z=new cg(k)}catch(K){R(So(`could not start ${k}: ${Jl(K)}`));return}let F=!1,V=!1,H=(K)=>{if(V)return;V=!0,K(),z.terminate()};z.on("message",(K)=>{if(K.type==="ready"){F=!0,z.postMessage({task:v,args:_});return}if(K.type==="result"){H(()=>R(K.value));return}let X=Error(K.error?.message??"image worker failed");if(K.error?.name)X.name=K.error.name;if(K.error?.stack)X.stack=K.error.stack;H(()=>T(X))}),z.on("error",(K)=>{H(()=>F?T(K instanceof Error?K:Error(Jl(K)||"image worker crashed")):R(So(`the worker failed before it was ready: ${Jl(K)}`)))}),z.on("exit",(K)=>{H(()=>F?T(Error("image worker exited before it finished")):R(So(`the worker exited with code ${K} before it was ready`)))})})}finally{sw()}}var uw=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dw=[320,640,960,1280,1920],$o="/_stx/images",pw=`stx:${$o}:alpha-1`,fw=`stx:${$o}:opaque-1`,gw=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Wa;function mw(v,_){let k=pn.dirname(Bun.resolveSync(v,_));while(k!==pn.dirname(k)){let R=pn.join(k,"package.json");if(hn.existsSync(R)){let T=JSON.parse(hn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=pn.dirname(k)}return}function pg(){if(Wa!==void 0)return Wa;let v;try{v=pn.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Wa=gw.map((_)=>{let k;try{k=v?mw(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),Wa}var fg=Symbol.for("stx.image-delivery");function _o(){let v=globalThis;return v[fg]??={catalog:new Map,transparent:new Set},v[fg]}var gg=new Set;function hw(v){return`/${v.split(pn.sep).map(encodeURIComponent).join("/")}`}function yw(v){let _=pn.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=xg("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function mg(v,_=`stx:${$o}`){let k=(R)=>`${$o}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=pn.join(v,R);try{let z=await hn.promises.stat(T);return z.size>0?{bytes:z.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let z=pn.join(v,R);await hn.promises.mkdir(pn.dirname(z),{recursive:!0});let F=`${z}.${process.pid}.tmp`;return await hn.promises.writeFile(F,T),await hn.promises.rename(F,z),{bytes:T.byteLength,path:z,url:k(R)}},url:k}}async function bg(v,_=v){let k=await hn.promises.readdir(_,{withFileTypes:!0});k.sort((T,z)=>T.name.localeCompare(z.name));let R=[];for(let T of k){let z=pn.join(_,T.name);if(T.isDirectory()){R.push(...await bg(v,z));continue}if(!T.isFile()||!uw.has(pn.extname(T.name).toLowerCase()))continue;R.push({absolutePath:z,relativePath:pn.relative(v,z)})}return R}function hg(v,_){return v.map((k)=>({key:hw(k.relativePath),input:k.absolutePath,name:yw(k.relativePath),...xw(k.absolutePath)?{options:{storage:_}}:{}}))}function xw(v){return Gl(v)==="possible"}function bw(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function ww(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([z,F])=>{let V=F.variants.filter((H)=>H.format==="png").sort((H,K)=>H.width-K.width)[0];try{let H=await cw(new Uint8Array(await hn.promises.readFile(V?.path??F.fallback.path)));if(bw(H.data))k.add(z)}catch{k.add(z)}}));return k}function vw(v,_){let k=[];for(let R of _){let T=v[R],z=T?.variants.filter((V)=>V.format==="webp")??[];if(!T||z.length===0)continue;if(!z.some((V)=>{let H;try{return H=hn.openSync(V.path,"r"),!Zl(Na(H,0,32))}catch{return!0}finally{if(H!==void 0)hn.closeSync(H)}}))continue;if(T.variants=T.variants.filter((V)=>V.format!=="webp"),delete T.sources.webp,k.push(R),!gg.has(R))gg.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 Sw(v){let _=[],k=8;for(let R=0;R<v.length;R+=8){let T=v.slice(R,R+8),z=await Promise.all(T.map(async(F)=>{try{return await lw(F.absolutePath),F}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${F.relativePath}`),null}}));_.push(...z.filter((F)=>F!==null))}return _}function Ql(v){return pn.join(v,"undecodable.json")}function $w(v){try{let _=hn.readFileSync(Ql(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function _w(v,_){try{hn.mkdirSync(pn.dirname(Ql(v)),{recursive:!0}),hn.writeFileSync(Ql(v),JSON.stringify(_))}catch{}}function yg(v){try{let _=hn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function wg(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 ks(v){let _=wg(v);return _?_o().catalog.get(_):void 0}function Cs(v){let _=wg(v);return _?_o().transparent.has(_):!1}function _s(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,z)=>T+z.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 yd(v){let _=ks(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:_s(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:Cs(v)?void 0:_.placeholder?.dataUrl}}function dr(){let v=_o();v.catalog=new Map,v.transparent=new Set}function kw(v){let _=_o();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function bd(v,_,k={}){if(!v||!hn.existsSync(v))return dr(),{count:0,fingerprint:""};if(k.offThread){let ee=await Yl("delivery",{publicDir:v,outputDir:_});if(ee!==za)return kw(ee.state),ee.result}let R=await bg(v);if(R.length===0)return dr(),{count:0,fingerprint:""};let T=$w(_),z=R.filter((ee)=>{let le=T[ee.relativePath];if(!le)return!0;let ue=yg(ee.absolutePath);return!ue||ue.mtimeMs!==le.mtimeMs||ue.size!==le.size});if(z.length===0)return dr(),{count:0,fingerprint:""};let F=mg(pn.join(_,"_stx","images"),`${pw}:${pg()}`),V={outDir:pn.join(_,"_stx","images"),storage:mg(pn.join(_,"_stx","images"),`${fw}:${pg()}`),baseUrl:$o,widths:dw,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},H=z,K;try{K=await dg({...V,entries:hg(z,F)})}catch(ee){if(H=await Sw(z),H.length===z.length)throw ee;let le=new Set(H.map((de)=>de.relativePath)),ue=!1;for(let de of z){if(le.has(de.relativePath))continue;let pe=yg(de.absolutePath);if(!pe)continue;T[de.relativePath]=pe,ue=!0}if(ue)_w(_,T);if(H.length===0)return dr(),{count:0,fingerprint:""};K=await dg({...V,entries:hg(H,F)})}let X=await ww(K.entries),G=vw(K.entries,X),te=_o();te.catalog=new Map(Object.entries(K.entries)),te.transparent=X;let ce=X.size===0&&G.length===0?K.fingerprint:xg("sha256").update(K.fingerprint).update(JSON.stringify({transparent:[...X].sort(),droppedWebp:G.sort()})).digest("hex");return{count:H.length,fingerprint:ce}}var Ew=new Map;function eu(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return Ew.get(_)}var Cw={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},tu=[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 Fa(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 nu(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,z]=R.split(":"),F=Cw[T];if(F)k.push(`(max-width: ${F}px) ${z}`);else{let V=Number.parseInt(T);if(!Number.isNaN(V))k.push(`(max-width: ${V}px) ${z}`)}}else k.push(R);return k.join(", ")}function ru(v,_,k,R){return _.map((T)=>`${ko(v,T,void 0,k,R)} ${T}w`).join(", ")}function Rw(v,_,k,R,T){return _.map((z)=>{let F=k?k*z:void 0;return`${ko(v,F,void 0,R,T)} ${z}x`}).join(", ")}function ko(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let z=[];if(_)z.push(`w_${_}`);if(k)z.push(`h_${k}`);if(T)z.push(`f_${T}`);z.push("q_auto");let F=z.join(",");return v.replace("/upload/",`/upload/${F}/`)}if(R==="imgix"){let z=new URLSearchParams;if(_)z.set("w",String(_));if(k)z.set("h",String(k));if(T)z.set("fm",T);z.set("auto","format");let F=v.includes("?")?"&":"?";return`${v}${F}${z.toString()}`}if(R==="bunny"){let z=new URLSearchParams;if(_)z.set("width",String(_));if(k)z.set("height",String(k));if(T)z.set("format",T);let F=v.includes("?")?"&":"?";return`${v}${F}${z.toString()}`}return v}function Aw(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function Tw(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 su={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=rn(v,"src")||"",T=ks(R),z=rn(v,"alt")||"",F=rn(v,"width")||(T?String(T.source.width):void 0),V=rn(v,"height")||(T?String(T.source.height):void 0),H=rn(v,"sizes"),K=rn(v,"srcset"),X=rn(v,"densities"),G=rn(v,"format"),te=Cs(R)||eu(R)?.transparent===!0,ce=rn(v,"placeholder")||(T&&!te?"thumbhash":void 0),ee=rn(v,"placeholderColor")||"#e5e7eb",le=rn(v,"provider"),ue=rn(v,"class")||rn(v,"className")||"",de=rn(v,"style")||"",pe=rn(v,"objectFit")||rn(v,"fit"),fe=rn(v,"objectPosition")||rn(v,"position"),Pe=rn(v,"quality"),ke=Fa(v,"lazy",!0),we=Fa(v,"preload",!1),Me=Fa(v,"priority",!1),Ne=rn(v,"loading"),Le=rn(v,"decoding")||"async",Be=!!T||Fa(v,"picture",!1)||!!G,ze=F?Number.parseInt(F):void 0,je=V?Number.parseInt(V):void 0,Fe=K||"",Ve="";if(T)Fe=T.sources[T.fallback.format]||"",Ve=H?nu(H):"100vw";else if(!Fe&&H&&le&&le!=="local"&&le!=="static")Fe=ru(R,tu,le,G),Ve=nu(H);else if(!Fe&&X){let vt=X.split(/\s+/).map((pt)=>Number.parseFloat(pt.replace("x","")));Fe=Rw(R,vt,ze,le,G)}else if(H)Ve=nu(H);let Ue=[];if(de)Ue.push(de);if(pe)Ue.push(`object-fit:${pe}`);if(fe)Ue.push(`object-position:${fe}`);if(ze&&je)Ue.push(`aspect-ratio:${ze}/${je}`);let We=[],ct=ce==="blur"||ce==="color"||ce==="thumbhash";if(ct&&!te){let vt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:ee}:eu(R);if(vt&&ce==="color")Ue.push(`background-color:${vt.color}`),We.push("backgroundColor");else if(vt)Ue.push(`background-color:${vt.color}`),Ue.push(`background-image:url(${vt.dataUrl})`),Ue.push("background-size:cover"),Ue.push("background-repeat:no-repeat"),We.push("backgroundColor","backgroundImage");else{let pt=Tw(ze||16,je||9,ee);Ue.push(`background-image:url(${pt})`),Ue.push("background-size:cover"),Ue.push("background-repeat:no-repeat"),We.push("backgroundImage")}}else if(!ct&&ce&&ce!=="empty"&&ce!=="none")Ue.push(`background-image:url(${nn(ce)})`),Ue.push("background-size:cover"),Ue.push("background-repeat:no-repeat"),We.push("backgroundImage");let $t=T?.fallback.url||ko(R,ze,je,le,G),wt=[];if(wt.push(`src="${nn(Ui($t,"fetched"))}"`),wt.push(`alt="${nn(z)}"`),F)wt.push(`width="${nn(F)}"`);if(V)wt.push(`height="${nn(V)}"`);let It=Ne||(Me||we?"eager":ke?"lazy":"");if(It)wt.push(`loading="${nn(It)}"`);if(Me)wt.push('fetchpriority="high"');if(wt.push(`decoding="${nn(Le)}"`),ue)wt.push(`class="${nn(ue)}"`);if(Ue.length>0)wt.push(`style="${nn(Ue.join(";"))}"`);if(Fe)wt.push(`srcset="${nn(Ui(Fe,"fetched"))}"`);if(Ve)wt.push(`sizes="${nn(Ve)}"`);let St=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(We.length>0){let vt=typeof v.static.onload==="string"?v.static.onload:"",pt=Aw(We)+(vt?`;${vt}`:"");wt.push(`onload="${nn(pt)}"`),St.add("onload")}wt.push(...Wr(v,St)),wt.push(...Fr(v,St));let mt=`<img ${wt.join(" ")} />`,Ct="";if(we){let pt=G==="webp"?"image/webp":G==="avif"?"image/avif":"";Ct=`<link rel="preload" as="image" href="${nn($t)}"${pt?` type="${pt}"`:""}${Fe?` imagesrcset="${nn(Fe)}"`:""}${Ve?` imagesizes="${nn(Ve)}"`:""} />
2310
+ `}if(Be){let vt=[];if(T)for(let pt of _s(T))vt.push(`<source type="image/${pt.format}" srcset="${nn(pt.srcset)}"${Ve?` sizes="${nn(Ve)}"`:""} />`);if(!T&&(G==="avif"||G==="auto")){let pt=ko(R,ze,je,le,"avif"),Rt=Fe?ru(R,tu,le,"avif"):`${pt}`;vt.push(`<source type="image/avif" srcset="${nn(Rt)}"${Ve?` sizes="${nn(Ve)}"`:""} />`)}if(!T&&(G==="webp"||G==="auto")){let pt=ko(R,ze,je,le,"webp"),Rt=Fe?ru(R,tu,le,"webp"):`${pt}`;vt.push(`<source type="image/webp" srcset="${nn(Rt)}"${Ve?` sizes="${nn(Ve)}"`:""} />`)}return`${Ct}<picture>
2311
+ ${vt.join(`
2312
+ `)}
2313
+ ${mt}
2314
+ </picture>`}return`${Ct}${mt}`}};var vg="/images/safe-image-default.svg";function Eo(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ti(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var Iw=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${vg}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,iu={name:"SafeImage",aliases:["safe-image","safe-img"],render(v,_,k){let R=ti(v,"src")||"",T=ti(v,"alt")||"",z=ti(v,"fallback")||vg,F=ti(v,"class")||ti(v,"className")||"",V=ti(v,"fallbackClassName")||"",H=[];if(H.push(`src="${Eo(R)}"`),H.push(`alt="${Eo(T)}"`),F)H.push(`class="${Eo(F)}"`);if(H.push(`data-fallback="${Eo(z)}"`),V)H.push(`data-fallback-class="${Eo(V)}"`);H.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);H.push(...Wr(v,K)),H.push(...Fr(v,K));let X=`<img ${H.join(" ")} />`,G=k.context;if(!G.__safeImageHandlerEmitted)return G.__safeImageHandlerEmitted=!0,`${Iw}${X}`;return X}};function ou(v){return v.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Co(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Va(v,_,k){let R=Co(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var au={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(v,_,k){let R=ou(Co(v,"color")||"#6366f1"),T=ou(Co(v,"initialColor")||Co(v,"initial-color")||""),z=ou(Co(v,"height")||"3px"),F=Va(v,"duration",2000),V=Va(v,"throttle",200),H=Va(v,"zIndex",999999)||Va(v,"z-index",999999),K=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:${z};background:${K};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)},${V})},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 $g(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function Pw(v,_,k){let R=$g(v,_);if(R!==void 0){let T=Number.parseInt(R,10);if(!Number.isNaN(T))return T}return k}var Sg={"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%)"},cu={name:"StxToast",aliases:["stx-toast"],render(v,_,k){let R=Zt($g(v,"position")||"top-right"),T=Pw(v,"max",5),z=Sg[R]||Sg["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${R}" data-stx-toast-max="${T}" style="position:fixed;${z};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 Ua(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var _g={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)"},lu={name:"StxModal",aliases:["stx-modal"],render(v,_,k){let R=Ua(v,"id");if(!R)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let T=Zt(R),z=Ua(v,"size")||"md",F=Ua(v,"closeOnBackdrop")!=="false",V=Ua(v,"closeOnEscape")!=="false",H=_g[z]||_g.md;return`<div id="stx-modal-${T}" class="stx-modal-backdrop" data-stx-modal="${T}" data-close-backdrop="${F}" data-close-escape="${V}" 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 ni(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}var kg={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},uu={name:"StxDrawer",aliases:["stx-drawer"],render(v,_,k){let R=ni(v,"id");if(!R)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let T=Zt(R),z=ni(v,"side")||"right",F=ni(v,"size")||"md",V=ni(v,"closeOnBackdrop")!=="false",H=ni(v,"closeOnEscape")!=="false",K=ni(v,"overlay")!=="false",X=kg[F]||kg.md,G=z==="left",te=G?"left:0":"right:0",ce=G?"translateX(-100%)":"translateX(100%)",ee=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="${V}" data-close-escape="${H}" style="display:none;position:fixed;inset:0;z-index:99999;${K?"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;${te};width:${X};max-width:100vw;transform:${ce};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 Dw,readFileSync as Ow}from"fs";var Ha=new Map,Eg=new Set;function Mw(v){if(Eg.has(v))return;Eg.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 jw(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(Dw(k))return k;for(let k of[`@iconify-json/${v}/icons.json`,`@iconify/json/json/${v}.json`])try{return d.resolve(k)}catch{}return null}function Nw(v){if(Ha.has(v))return Ha.get(v);let _=jw(v);if(!_)return Mw(v),null;try{let k=JSON.parse(Ow(_,"utf8"));return Ha.set(v,k.icons),k.icons}catch{return null}}function ri(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 du={name:"Icon",aliases:["icon","stx-icon"],render(v,_,k){let R=ri(v,"name")??ri(v,"icon");if(!R)return"<!-- Icon: missing name/icon prop -->";let T="lucide",z=R;if(R.includes(":")){let pe=R.split(":");T=pe[0],z=pe[1]}let F=Zt(ri(v,"size")||"24"),V=Zt(ri(v,"color")||"currentColor"),H=Zt(ri(v,"class")||""),K=Zt(ri(v,"style")||""),X=Ha.get(T)??Nw(T);if(!X)return`<!-- Icon: collection "${T}" not loaded -->`;let G=X[z];if(!G)return`<!-- Icon: "${z}" not found in ${T} -->`;let te=G.width||24,ce=G.height||24,ee=`0 0 ${te} ${ce}`,le=G.body;if(V!=="currentColor")le=le.replace(/currentColor/g,V);let ue=H?` class="${H}"`:"",de=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${F}" height="${F}" viewBox="${ee}" fill="none"${ue}${de}>${le}</svg>`}};function pu(){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 Cg(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 Rg(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 fu={name:"Suspense",aliases:["suspense"],render(v,_,k){let R=Rg(_,"fallback"),T=R.rest,z=Rg(T,"error"),F=z.rest,V=R.region??Cg(v,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',H=z.region??Cg(v,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${V}</div><div data-stx-suspense-error hidden>${H}</div><div data-stx-suspense-content hidden>${F}</div></div>`}};function qa(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 gu={name:"TransitionGroup",aliases:["transition-group"],render(v,_,k){let R=(qa(v,"name")||"v").replace(/["'<>]/g,""),T=(qa(v,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",z=qa(v,"class"),F=qa(v,"id"),V=[`data-stx-transition-group="${R}"`,z?`class="${z}"`:"",F?`id="${F}"`:""].filter(Boolean).join(" ");return`<${T} ${V}>${_}</${T}>`}};function Ag(v=Gs){v.registerBuiltin(Kl),v.registerBuiltin(su),v.registerBuiltin(iu),v.registerBuiltin(au),v.registerBuiltin(cu),v.registerBuiltin(lu),v.registerBuiltin(uu),v.registerBuiltin(du),v.registerBuiltin(fu),v.registerBuiltin(gu)}var Tg=new Map;function Lw(v){let _=Tg.get(v.source);if(!_)_=new RegExp(`(${v.source})(?![\\w.:-])`,"y"),Tg.set(v.source,_);return _}var Ig=new WeakMap;function Pg(v){let _=Ig.get(v);if(!_)_=new Set([...v].map((R)=>R.toLowerCase())),Ig.set(v,_);let k=_;return(R)=>!/[a-z]/.test(R)&&k.has(R.toLowerCase())}function Bw(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 Dg(v,_,k){let R=[],T=0,z=typeof k==="function"?k:k?(F)=>k.has(F.toLowerCase()):void 0;while(T<v.length){let F=v.indexOf("<",T);if(F===-1)break;let V=Lw(_);V.lastIndex=F+1;let H=V.exec(v);if(!H){T=F+1;continue}let K=H[1];if(z&&z(K)){let ue=F+1+K.length;while(ue<v.length&&v[ue]!==">")ue++;T=ue+1;continue}let X=F+1+K.length,G=null,te=X,ce=-1,ee=!1;while(X<v.length){let ue=v[X];if(G){if(ue==="\\"&&X+1<v.length){X+=2;continue}if(ue===G)G=null;X++;continue}if(ue==='"'||ue==="'"){G=ue,X++;continue}if(ue==="/"&&X+1<v.length&&v[X+1]===">"){ce=X+2,ee=!0;break}if(ue===">"){ce=X+1;break}X++}if(ce===-1){T=F+1;continue}let le=v.slice(te,ee?ce-2:ce-1).trim();if(ee)R.push({fullMatch:v.slice(F,ce),tagName:K,attributes:le,content:"",startIndex:F,endIndex:ce,isSelfClosing:!0}),T=ce;else{let ue=`<${K}`,de=`</${K}>`,pe=1,fe=ce,Pe=-1;while(pe>0&&fe<v.length){let Me=v.indexOf(ue,fe),Ne=v.indexOf(de,fe);if(Ne===-1)break;if(Me!==-1&&Me<Ne){let Le=v[Me+ue.length];if(Le===" "||Le===">"||Le==="/"||Le===`
2451
+ `||Le==="\t"){let Be=Bw(v,Me+ue.length);if(v[Be-1]!=="/")pe++;fe=Be+1}else fe=Me+ue.length}else{if(pe--,pe===0){Pe=Ne;break}fe=Ne+de.length}}if(Pe===-1){T=ce;continue}let ke=v.slice(ce,Pe),we=Pe+de.length;R.push({fullMatch:v.slice(F,we),tagName:K,attributes:le,content:ke,startIndex:F,endIndex:we,isSelfClosing:!1}),T=we}}return R}function mu(v){return v.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Og(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 hu(v,_){let k=0,R="",T=_;while(T<v.length){let z=v[T];if(R){if(z==="\\")T++;else if(z===R)R=""}else if(z==='"'||z==="'"||z==="`")R=z;else if(z==="{")k++;else if(z==="}"){if(k--,k===0)return v.slice(_,T+1)}T++}return v.slice(_)}function Mg(v){let _=v.trim();if(!_.startsWith("{")||!_.endsWith("}"))return null;if(hu(_,0).length!==_.length)return null;return _.slice(1,-1).trim()}var zw=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Ww=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Fw(v){return yu(v).map((_)=>[_.start,_.end])}function yu(v){let _=[],k=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,R;while((R=k.exec(v))!==null){let T=R[2]||"",z=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(T);if(!z)continue;let F=Kr(z[1]??z[2]??z[3]??""),V=R.index,H=V+R[0].length,K=R[1].toLowerCase();if(R[0].endsWith("/>")||Ww.has(K)){_.push({start:V,end:H,names:F});continue}let X=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),G=new RegExp(`<\\/?${X}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");G.lastIndex=H;let te=1,ce=H,ee;while((ee=G.exec(v))!==null)if(ee[0].startsWith("</")){if(te--,te===0){ce=ee.index+ee[0].length;break}}else if(!ee[0].endsWith("/>"))te++;_.push({start:V,end:ce,names:F})}return _}function jg(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.filter(Boolean).map((_)=>jg(_)).join(" ");if(v&&typeof v==="object")return Object.entries(v).filter(([,_])=>_).map(([_])=>_).join(" ");return v?String(v):""}function Ng(v,_){if(!/:[\w-]+=/.test(v))return v;let k=v,R=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,T=[],z;while((z=R.exec(v))!==null)T.push([z.index,z.index+z[0].length]);T.push(...Fw(v));let F=new Set([...Ir(_),...Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]]);function V(te){return T.some(([ce,ee])=>te>=ce&&te<ee)}let H=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,K=[],X=new Map,G=256;while((z=H.exec(k))!==null){if(V(z.index))continue;let te=z[0],ce=z[2];if(!ce||!ce.includes(":"))continue;let ee=/(?:^|\s)data-native(?:\s|=|$)/i.test(ce.replace(/"[^"]*"|'[^']*'/g,"")),le=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,ue,de=ce,pe=!1;while((ue=le.exec(ce))!==null){let fe=ue[1],Pe=ue[2];if(oa(fe))continue;if(re(Pe,F))continue;if(Pe.includes("()")&&!Pe.includes(".get(")||Pe.includes("$store")||Pe.includes("$ref"))continue;try{let ke=Object.keys(_),we=Object.values(_),Me=Pe.match(/^([a-zA-Z_$][\w$]*)/);if(Me&&!ke.includes(Me[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(Me[1]))continue;let Ne=JSON.stringify([ke,Pe]),Le=X.get(Ne);if(!Le){if(Le=Function(...ke,`return (${Pe})`),X.size>=G)X.clear();X.set(Ne,Le)}let Be=Le(...we);if(fe==="class"){let ze=jg(Be);if(ze){let je=de.match(/\sclass="([^"]*)"/);if(je)de=de.replace(je[0],` class="${je[1]} ${ze}"`);else de=de.replace(ue[0],` class="${ze}"`)}else de=de.replace(ue[0],"");pe=!0;continue}if(zw.has(fe)){if(Be)de=de.replace(ue[0],` ${fe}`);else de=de.replace(ue[0],"");pe=!0;continue}if(Be===null||Be===void 0||Be===!1)de=de.replace(ue[0],"");else{let je=(ee&&typeof Be==="object"?JSON.stringify(Be):String(Be)).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");de=de.replace(ue[0],` ${fe}="${je}"`)}pe=!0}catch{continue}}if(pe){let fe=z[3]?" /":"",ke=`<${z[1]}${de}${fe}>`;K.push({start:z.index,end:z.index+te.length,replacement:ke})}}if(K.length>0){let te=Array(K.length*2+1),ce=0;for(let ee=0;ee<K.length;ee++){let{start:le,end:ue,replacement:de}=K[ee];te[ee*2]=k.slice(ce,le),te[ee*2+1]=de,ce=ue}te[K.length*2]=k.slice(ce),k=te.join("")}return k}var Y=["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 Gg from"path";import bu from"fs";import Ao from"path";function Lg(v,_,k,R){let T=0;for(let z=_;z<v.length;z++)if(v[z]===k)T++;else if(v[z]===R&&!(R===">"&&v[z-1]==="=")){if(--T===0)return z}return-1}function Vw(v){let _=s(v),k=0,R=0,T=[];for(let z=0;z<_.length;z++)if("([{".includes(_[z]))k++;else if(")]}".includes(_[z]))k--;else if(_[z]===","&&k===0)T.push(v.slice(R,z).trim()),R=z+1;return T.push(v.slice(R).trim()),T}function xu(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 z=T.index+T[0].length,F="";if(k[z]==="<"){let H=Lg(k,z,"<",">");if(H<0)continue;F=v.slice(z+1,H),z=H+1;while(/\s/.test(k[z]||"")&&z<k.length)z++}if(k[z]!=="(")continue;let V=Lg(k,z,"(",")");if(V>=0)return{type:F,args:Vw(v.slice(z+1,V))}}return null}var Bg=`
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 zg(v,_){let k=[],R={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},T=s(v),z=v.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(te,ce,ee,le,ue)=>{if(T.slice(ue,ue+6)!=="import")return te;if(le.endsWith(".stx"))return"";let de=`${_}Import${k.length}`;if(k.push(`import * as ${de} from ${JSON.stringify(le)};`),ce.startsWith("*"))return`import ${ce.replace(/^\*\s+as\s+/,"")} = ${de};`;if(!ce.startsWith("{"))return`import ${ce} = ${de}.default;`;return ce.slice(1,-1).split(",").map((pe)=>{let[fe,Pe=fe]=pe.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!fe)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(le)&&fe in R)R[fe].push(Pe);return`import ${Pe} = ${de}.${fe};`}).join(`
2460
+ `)}),F=xu(v,R.defineProps),V=xu(v,R.defineEmits),H=xu(v,R.withDefaults);if(!F&&!V)return{declarations:"",props:null,events:null};let K=[],X=null,G=null;if(F){K.push(`const __options = (${F.args[0]||"{}"}) as const;`),K.push(`const __defaults = (${H?.args[1]||"{}"});`);let te=F.type||"__StxOptions<typeof __options>";K.push(`export type __StxProps = __StxDefaults<${te}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),X=`${_}.__StxProps`}if(V)K.push(`const __events = (${V.args[0]||"[]"}) as const;`),K.push(`export type __StxEvents = ${V.type||"Record<(typeof __events)[number], any[]>"};`),G=`${_}.__StxEvents`;return{declarations:`${k.join(`
2461
+ `)}
2462
+ namespace ${_} {
2463
+ ${z}
2464
+ ${K.join(`
2465
+ `)}
2466
+ }`,props:X,events:G}}var Ro=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 En(v){if(v.includes("-")||v==="component")return!1;if(/^[A-Z]/.test(v))return!/[a-z]/.test(v)&&[...Ro].some((_)=>_.toLowerCase()===v.toLowerCase());return Ro.has(v)||/[A-Z]/.test(v)}function*Uw(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 z=/^[^\s=/>]+/.exec(v.slice(R))?.[0];if(!z){R++;continue}let F=R;R+=z.length;while(/\s/.test(v[R]||""))R++;if(v[R]!=="="){T.push({name:z,value:!0,offset:F,braced:!1});continue}R++;while(/\s/.test(v[R]||""))R++;let V=v[R],H=V==="{",K=V==='"'||V==="'";if(K||H)R++;let X=R;if(H){let G=s(v.slice(R)),te=1,ce=0;for(;ce<G.length;ce++){if(G[ce]==="{")te++;if(G[ce]==="}"&&--te===0)break}R+=ce}else if(K)while(R<v.length&&v[R]!==V)R++;else while(R<v.length&&!/[\s/>]/.test(v[R]))R++;if(T.push({name:z,value:v.slice(X,R),offset:X,braced:H}),K||H)R++}_.lastIndex=R,yield{name:k[1],offset:k.index,attributes:T}}}function Wg(v,_,k){let R=[],T=[Bg,"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;'],z=new Map,F=new Map,V=new Map,H=k.scriptCode(v,k.filePath),K=s(H);for(let ee of H.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(K.slice(ee.index,ee.index+6)!=="import")continue;let le=ee[2],ue=Ao.isAbsolute(le)||le.startsWith(".")?Ao.resolve(Ao.dirname(k.filePath),le):Qo(le,Ao.dirname(k.filePath));if(!ue)continue;let de=ue.endsWith(".stx")?ue:bu.existsSync(`${ue}.stx`)?`${ue}.stx`:void 0,pe=de?null:Yo(ue,!1),fe=ee[1].startsWith("{")?ee[1].slice(1,-1).split(","):[ee[1]];for(let Pe of fe){let[ke,we=ke]=Pe.trim().split(/\s+as\s+/),Me=de||pe?.get(ke)||pe?.get(ke.toLowerCase());if(Me)V.set(we,Me),V.set(we.toLowerCase(),Me),V.set(we.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Me)}}for(let ee of _.matchAll(/@import\s*\(([^)]+)\)/g))for(let le of ee[1].matchAll(/['"]([^'"]+)['"]/g)){let ue=ea(le[1],k.filePath,k).find((de)=>bu.statSync(de,{throwIfNoEntry:!1})?.isFile());if(ue)V.set(Ao.basename(le[1]).replace(/\.stx$/,""),ue)}let X={__importedComponents:V},G=new Map,te=(ee,le,ue)=>{let de=v.slice(0,ee);return{code:le,offset:ee,attribute:ue,anchor:!0,kind:"directive",line:de.split(`
2467
+ `).length,column:ee-de.lastIndexOf(`
2468
+ `)}},ce=(ee,le,ue)=>R.push({expression:ee,statement:{text:le+ee.code+ue,prefixLength:le.length}});for(let ee of Uw(_)){if(En(ee.name)||ee.name==="component")continue;let le=Dd(ee.name,k.filePath,k,X);if(!le)continue;let ue=G.get(le);if(!ue){let pe;try{pe=k.readComponent?k.readComponent(le):bu.readFileSync(le,"utf8")}catch{continue}if(pe===void 0)continue;F.set(le,pe),ue=zg(k.scriptCode(pe,le),`__StxComponent${G.size}`),G.set(le,ue),T.push(ue.declarations)}let de=[];for(let pe of ee.attributes){let{name:fe,offset:Pe}=pe,ke=pe.value===!0?"true":pe.value;if(fe.startsWith("@")||fe.startsWith("v-on:")){if(ue.events&&pe.value!==!0)z.set(Pe,`__StxEvent<${ue.events}, ${JSON.stringify(fe.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let we=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(fe);if(fe.startsWith("v-")&&!fe.startsWith("v-bind:")&&!we)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(fe))continue;let Me=(we?we[1]||"modelValue":fe.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Be,ze)=>ze.toUpperCase());if(de.push(Me),!ue.props)continue;let Le=fe.startsWith(":")||fe.startsWith("v-bind:")||!!we||pe.braced?ke:pe.value!==!0?JSON.stringify(ke):"true";ce(te(Pe,Le,fe),";void ((",`) satisfies __StxProp<${ue.props}, ${JSON.stringify(Me)}>);`)}if(ue.props){let pe=[...new Set(de)].map((Pe)=>`${JSON.stringify(Pe)}: undefined as any`).join(", "),fe=te(ee.offset,`<${ee.name}>`);R.push({expression:fe,statement:{text:`;void ({ ${pe} } satisfies ${ue.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:G.size?T.join(`
2469
+ `):"",checks:R,events:z,dependencies:F}}var Fg=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Hw(v){let _=(k)=>k.replace(/[^\n]/g," ");return v.replace(/<!--[\s\S]*?-->/g,_).replace(/\{\{--[\s\S]*?--\}\}/g,_)}function tt(v){let _=[],k=Hw(v);Fg.lastIndex=0;let R;while((R=Fg.exec(k))!==null){let T=(R[1]||"").trim(),z=(R[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,F=(R[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,V=R.index+z,H=R.index+R[0].length-F,K=v.slice(V,H);if(/\bsrc\s*=/.test(T))continue;let X=T.match(/\btype\s*=\s*["']([^"']+)["']/i);if(X&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(X[1]))continue;let G=/\bserver\b/.test(T)?"server":/\bclient\b/.test(T)?"client":"plain",te=To(v,V);_.push({kind:G,code:K,startLine:te,startColumn:Io(v,V),offset:V,attrs:T})}return _}function To(v,_){let k=1;for(let R=0;R<_&&R<v.length;R++)if(v.charCodeAt(R)===10)k++;return k}function Io(v,_){let k=v.lastIndexOf(`
2470
+ `,_-1)+1;return _-k+1}function Ka(v){let _=v.split(""),k=(T,z)=>{for(let F=T;F<z&&F<_.length;F++)if(_[F]!==`
2471
+ `)_[F]=" "},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 z;while((z=T.exec(v))!==null)k(z.index,z.index+z[0].length)}return _.join("")}function qw(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 Jg=new Set([":for","x-for","v-for"]),Xa=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,wu="__stx_interpolated",Vg="__StxElement",Yg="__StxTemplateValue",Kw=`type ${Yg}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Ug(v){return v.replace(/\{\{[\s\S]*?\}\}/g,wu).replace(/\{!![\s\S]*?!!\}/g,wu)}function Es(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 Xw=["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"],Zw=new RegExp(String.raw`^[ \t]*@(?:${Xw.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Ts(v){return v.replace(Zw,(_)=>_.replace(/[^\n]/g," "))}var Hg=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Bc(v){let _=Ka(v),k=[],R=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,T;while((T=R.exec(_))!==null){if(T[1]||T[3])continue;let V=T[2]??T[4]??"",H=T[2]!==void 0?2:3,K=qw(V);if(!K.trim())continue;let X=T.index+H+(K.length-K.trimStart().length);k.push({code:K.trim(),line:To(_,X),column:Io(_,X),offset:X,kind:"interpolation"})}let z=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((T=z.exec(_))!==null){let F=T.index+T[0].length-1,V=0,H=F;for(;H<_.length;H++){let te=_[H];if(te==="(")V++;else if(te===")"){if(V--,V===0)break}}if(V!==0)continue;let K=_.slice(F+1,H),X=K.trim();if(z.lastIndex=H+1,!X)continue;let G=F+1+(K.length-K.trimStart().length);k.push({code:X,line:To(_,G),column:Io(_,G),offset:T.index,kind:"condition"})}Xa.lastIndex=0;while((T=Xa.exec(_))!==null){let F=T[1],V=T[3]??"",H=F.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(Hg.has(H)||Hg.has(F))continue;if(!V.trim())continue;let K=T.index+T[0].indexOf(T[2],T[0].indexOf(F)+F.length)+1;if(Jg.has(H)){let G=V.match(/\s+(?:in|of)\s+/);if(!G||G.index===void 0)continue;let te=V.slice(G.index+G[0].length),ce=G.index+G[0].length+(te.length-te.trimStart().length);k.push({code:Ug(te.trim()),line:To(_,K+ce),column:Io(_,K+ce),offset:K+ce,kind:"directive",attribute:H});continue}let X=V.length-V.trimStart().length;k.push({code:Ug(V.trim()),line:To(_,K+X),column:Io(_,K+X),offset:K+X,kind:"directive",attribute:H})}return k.sort((F,V)=>F.line-V.line||F.column-V.column),k}var Gw=2000;function Jw(v,_){let k=0,R=Math.min(v.length,_+Gw);for(let T=_;T<R;T++){let z=v[T];if(z==="(")k++;else if(z===")"){if(k--,k===0)return v.slice(_+1,T)}}return null}function Yw(v){let _=new Map,k=(V,H)=>{let K=V.split(/[,[\]{}()\s]+/).filter(Boolean);for(let X of K){let G=X.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(G))continue;let te=K.length===1?H:void 0,ce=_.get(G);if(!ce)_.set(G,{name:G,iterable:te});else if(ce.iterable!==te)ce.iterable=void 0}},R=/^\$?[A-Z_$][\w$]*$/i,T=(V)=>{let H=V.trim();return R.test(H)?H:void 0};for(let V of v.matchAll(/@for(?:each|else)\s*\(/g)){let H=Jw(v,V.index+V[0].length-1);if(H===null)continue;let K=Mt(H);if(!K)continue;k(K.itemVar.replace(/=>/g," "),T(K.arrayExpr))}for(let V of v.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))k(V[1],V[2]==="of"?T(V[3]):void 0);for(let V of v.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))k(V[1]);let z=Ka(v);Xa.lastIndex=0;let F;while((F=Xa.exec(z))!==null){let V=F[1].replace(/\..*$/,"");if(!Jg.has(V))continue;let H=F[3].match(/\s+(?:in|of)\s+/);if(!H||H.index===void 0)continue;k(F[3].slice(0,H.index),T(F[3].slice(H.index+H[0].length)))}for(let V of v.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let H of V[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))k(H[1]);return[..._.values()].sort((V,H)=>V.name.localeCompare(H.name))}function he(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 vu=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Qw={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string"};function xi(v=new Set){return[...vu.filter((_)=>!v.has(_)).map((_)=>`declare var ${_}: any`),...Object.entries(Qw).filter(([_])=>!v.has(_)).map(([,_])=>_)].join(`
2474
+ `)}function Si(v){return new Set([...v.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((_)=>_[1]))}function Qg(v){let _=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,k,R=!1,T=new Set,z=s(v);while((k=_.exec(z))!==null){R=!0;for(let F of ev(k[1])){let V=F.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(V))T.add(V)}}return R?[...T]:null}function ev(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 tv(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 em(v){let _=s(v),k=Array(_.length),R=0;for(let V=0;V<_.length;V++){let H=_[V];if(H==="}"||H===")"||H==="]")R=Math.max(0,R-1);if(k[V]=R,H==="{"||H==="("||H==="[")R++}let T=[],z=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,F;while((F=z.exec(_))!==null){if(k[F.index]!==0)continue;let V=F[1],H=F[2],K;if(V==="interface"){let X=_.indexOf("{",F.index);if(X===-1)continue;let G=0;K=-1;for(let te=X;te<_.length;te++)if(_[te]==="{")G++;else if(_[te]==="}"&&--G===0){K=te+1;break}if(K===-1)continue}else{let X=0;K=_.length;for(let G=_.indexOf("=",F.index)+1;G<_.length;G++){let te=_[G];if(te==="{"||te==="["||te==="("||te==="<")X++;else if(te==="}"||te==="]"||te===")"||te===">")X--;else if(X<=0&&(te===";"||te===`
2478
+ `&&!/[=|&,<([{]\s*$/.test(_.slice(Math.max(0,G-40),G)))){K=te===";"?G+1:G;break}}}T.push({name:H,text:v.slice(F.index,K).replace(/^[ \t]*export[ \t]+/,"")}),z.lastIndex=K}return T}function nv(v){return new Set(em(v).map((_)=>_.name))}function ki(v,_=""){let k=Qg(v),R=nv(_),T=em(v).filter((K)=>!R.has(K.name)).map((K)=>K.text);if(!k){let K=he(v).filter((X)=>!Wi(_,X));if(K.length===0&&T.length===0)return"";return["",`// ${rv}`,...T,...K.map((X)=>`declare var ${X}: any`)].join(`
2479
+ `)}if(k.length===0)return T.length>0?["",`// ${qg}`,...T].join(`
2480
+ `):"";let{imports:z,body:F}=tv(v),V=F.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),H=["",`// ${qg}`];if(z)H.push(z);return H.push(...T),H.push(`async function ${Kg}() {`,V,` return { ${k.join(", ")} }`,"}",`type ${Xg} = Awaited<ReturnType<typeof ${Kg}>>`,...k.map((K)=>`declare var ${K}: ${Xg}[${JSON.stringify(K)}]`)),H.join(`
2481
+ `)}function Su(v){let k=s(v).split(""),R=0;for(let T=0;T<k.length;T++){let z=k[T];if(z==="{"||z==="("||z==="["){R++;continue}if(z==="}"||z===")"||z==="]"){R=Math.max(0,R-1);continue}if(R>0&&z!==`
2482
+ `)k[T]=" "}return he(k.join(""))}function Ci(v,_){if(Qg(v)!==null)return[];let k=Su(v),R=Nt(_,new Set(k)),T=new Set(y);return k.filter((z)=>{if(T.has(z))return!1;if(Wi(_,z))return!1;return R.has(z)})}var qg="stx: types for the declared client payload (#1868)",rv="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Kg="__stxServerScope",Xg="__StxClientPayload";var Zg=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","props","slot"];var sv=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function iv(v){let _=new Map,k=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let R of v){let T=s(R),{depths:z,balanced:F}=Ae(T);if(!F)continue;let V=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let H of T.matchAll(V)){let K=H.index??0;if(z[K+H[1].length]!==0)continue;let X=H[2],G=K+H[0].length-H[3].length,te=R.slice(G,K+H[0].length).trim().replace(/;$/,"").trim(),ce=H[3],ee=k.test(ce)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(ce)&&!/[,+\-*/%&|?:=]$/.test(te)&&Ae(ce).balanced;_.set(X,_.has(X)||!ee?null:te)}}return new Map([..._].filter((R)=>R[1]!==null))}function tm(v,_,k=0,R=new Set){if(_.size===0||k>=5)return v;let T=s(v),z="",F=0;for(let V of T.matchAll(/[A-Za-z_$][\w$]*/g)){let H=V.index??0,K=V[0],X=_.get(K);if(!X||R.has(K))continue;let G=T.slice(0,H).trimEnd(),te=T.slice(H+K.length).trimStart();if(G.endsWith(".")||/^:(?!:)/.test(te)&&/[{,]$/.test(G))continue;if(H>0&&/[\w$]/.test(T[H-1]))continue;z+=`${v.slice(F,H)}(${tm(X,_,k+1,new Set([...R,K]))})`,F=H+K.length}return z+v.slice(F)}function ov(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 z=T[1];if(T.index===_){if(z==="elseif"){let V=R[R.length-1];if(V?.current)V.seen.push(V.current);if(V)V.current=null}break}if(z==="endif"||z==="endunless"){R.pop();continue}let F="";if(T[2]==="("){let V=0,H=T.index+T[0].length-1,K=H+1;for(;H<v.length;H++){let X=v[H];if(X==="(")V++;else if(X===")"){if(V--,V===0)break}}F=v.slice(K,H).trim(),k.lastIndex=H+1}if(z==="if")R.push({seen:[],current:F});else if(z==="unless")R.push({seen:[],current:`!(${F})`});else if(z==="elseif"||z==="else"){let V=R[R.length-1];if(!V)continue;if(V.current)V.seen.push(V.current);V.current=z==="elseif"?F:null}}return R.flatMap((z)=>[...z.seen.map((F)=>`!(${F})`),...z.current?[z.current]:[]]).filter(Boolean)}function av(v){let _=v.code.trim();if(!_)return null;if(v.attribute?.startsWith("@")){if(sv.test(_))return null;let R=";(($event: any): void => { ";return{text:`${R}${_} });`,prefixLength:R.length}}let k=";void ((";return{text:`${k}${_}));`,prefixLength:k.length}}var cv=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function pr(v,_){if(!_)return v;return v.replace(cv,(k,R,T,z)=>{let F=Gg.resolve(_,z).replace(/\\/g,"/");return`${R}${T}${F}${T}`})}function $s(v){return" ".repeat(Math.max(0,(v.startColumn??1)-1))}function lv(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],z=/\{([^}]*)\}/.exec(T);for(let K of z?.[1].split(",")??[]){let X=K.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(X&&/^[A-Z_$][\w$]*$/i.test(X))_.add(X)}let F=T.replace(/\{[^}]*\}/,""),V=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(F);if(V)_.add(V[1]);let H=/^\s*([A-Z_$][\w$]*)/i.exec(F);if(H&&H[1]!=="type")_.add(H[1])}return[..._].sort()}function _i(v,_={}){let k=tt(v),R=v.split(`
2483
+ `),T=Array.from({length:R.length},()=>""),z=new Map,F=_.filePath&&_.templateExpressions!==!1?Wg(v,Ka(v),{filePath:_.filePath,componentsDir:_.componentsDir,projectRoot:_.projectRoot,readComponent:_.readComponent,scriptCode:(G,te)=>tt(G).map((ce)=>pr(ce.code,Gg.dirname(te))).join(`
2484
+ `)}):void 0,V=new Set,H=[];for(let G of k){let te=Ts(Es(G.code)),ce=pr(te,_.originDir??"").split(`
2485
+ `);ce.forEach((ee,le)=>{let ue=G.startLine-1+le;if(ue<T.length)T[ue]=le===0?$s(G)+ee:ee,V.add(ue)}),H.push(G.startLine-1+ce.length-1)}for(let G of H){let te=T[G]?.trim()===""?G:G+1;if(te<T.length&&T[te].trim()===""&&(te===G||!V.has(te)))T[te]=";"}let K=(G,te)=>{for(let[ce,ee]of G.split(`
2486
+ `).entries())if(T.push(ee),te)z.set(T.length,ce===0?te:{...te,line:te.line+ce,column:1,prefixLength:0})};if(_.globals!==!1){K("");let G=new Set([...k.flatMap((le)=>he(le.code)),...k.flatMap((le)=>lv(le.code))]),te=(le)=>{if(!G.has(le))K(`declare var ${le}: any`)};if(_.runtimeGlobals!==!1){if(!G.has("window"))K("declare var window: any");for(let le of y)te(le)}let ce=[...new Set([...vu,...Y,...Zg])].filter((le)=>_.runtimeGlobals!==!1||!y.includes(le));if(_.contextScope==="global"){K("declare global {");for(let le of ce)K(` var ${le}: any`);K("}")}else{for(let le of vu)te(le);for(let le of Y)te(le);for(let le of Zg)te(le)}K(`declare var ${wu}: any`);let ee=new Set(k.flatMap((le)=>he(le.code)));K(`type ${Vg}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let le of Yw(v)){if(ee.has(le.name))continue;let ue=le.iterable&&ee.has(le.iterable)?`${Vg}<typeof ${le.iterable}>`:"any";K(`declare var ${le.name}: ${ue}`)}}if(_.templateExpressions!==!1){if(F?.declarations)for(let te of F.declarations.split(`
2487
+ `))K(te);let G=Bc(v).map((te)=>{let ce=F?.events.get(te.offset??-1);if(ce){te.anchor=!0;let ee=te.code.trim(),le=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(ee),ue=le?`void ((${le[2]}) satisfies __StxAssignedValue<typeof ${le[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(ee)?`${ee} satisfies (($event: ${ce}) => unknown)`:ee,de=`;(($event: ${ce}): void => { `;return{expression:te,statement:{text:`${de}${ue} });`,prefixLength:de.length}}}return{expression:te,statement:av(te)}}).filter((te)=>te.statement!==null);if(G.push(...F?.checks||[]),G.length>0){let te=Ka(v),ce=ma(te),ee=iv(k.map((pe)=>pe.code)),ue=[...new Set(k.flatMap((pe)=>he(pe.code)))].filter((pe)=>/^[A-Z_$][\w$]*$/i.test(pe)),de=0;if(ue.length>0){K(Kw);for(let pe of ue)K(`function __StxRead_${pe}() { return ${pe} }`),K(`type __StxT_${pe} = ${Yg}<ReturnType<typeof __StxRead_${pe}>>`);K(`;((${ue.map((pe)=>`${pe}: __StxT_${pe}`).join(", ")}) => {`),de=1}for(let{expression:pe,statement:fe}of G){let Pe=" ".repeat(de),ke=pe.offset===void 0?[]:ce.filter((ze)=>pe.offset>=ze.start&&pe.offset<ze.end),we=ke.map((ze)=>`;((${ze.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Me=" });".repeat(ke.length),Ne=pe.offset===void 0?[]:ov(te,pe.offset),Le=Ne.length>0?`${Ne.map((ze)=>`if (${tm(ze,ee)}) `).join("")}{ `:"",Be=Ne.length>0?" }":"";K(Pe+we+Le+fe.text+Be+Me,{line:pe.line,column:pe.column,expression:pe,prefixLength:fe.prefixLength+Pe.length+we.length+Le.length,guardPrefixLength:Pe.length+we.length+Le.length})}if(de>0)K("});")}}let X=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,X=!0;return K("export {}"),{text:T.join(`
2488
+ `),lineMap:z,sourceLineCount:R.length,componentDependencies:F?.dependencies,referenced:X}}function Ei(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function Ti(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 nm from"fs";import rm from"path";var sm=!1;function uv(v,_,k,R=!1,T=new Set){let z={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},F=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),V=(G)=>{if(F.size===0)return!1;let te=s(G),ce=te.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(ce&&F.has(ce))return!0;for(let ee of F){let le=ee.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${le}\\s*\\(`).test(te))return!0}return!1},H=new Set(ia),K=(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,(te,ce)=>ce.toUpperCase())},X=(G,te)=>{let ce=K(G);if(z.static[ce]=te,ce!==G)z.staticNames[ce]=G};for(let[G,te]of Object.entries(v)){let ce=G.startsWith("x-")&&!H.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(ce.startsWith("@")){z.events[ce]=te;continue}if(ce.startsWith("__stx_")){let ee=K(ce.slice(6));z.serverDynamic[ee]=Og(te,k);continue}if(ce.startsWith(":")){let ee=K(ce.slice(1)),le=te===zr?ee:te;if(ee==="if"||ee==="for"||ee==="show"){z.clientReactive[ee]=le;continue}if(R){z.clientReactive[ee]=le;continue}if(re(le,T)){z.clientReactive[ee]=le;continue}if(V(le)){z.clientReactive[ee]=le;continue}try{if(!p(le)){if(k.debug)console.error(`Unsafe expression in :${ee} binding: ${le}`);z.clientReactive[ee]=le;continue}let ue=Object.keys(_),de=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(Oe(le).some((we)=>!de.has(we)&&!ue.includes(we)&&(!(we in globalThis)||pe.has(we)))){z.clientReactive[ee]=le;continue}let ke=c(le,ue)(...Object.values(_));if(z.serverDynamic[ee]=ke,ee!==ce.slice(1)&&z.serverDynamicNames)z.serverDynamicNames[ee]=ce.slice(1)}catch{z.clientReactive[ee]=le}continue}if(typeof te==="string"&&te.includes("{{")&&te.includes("}}")){let ee=dv(te,T);if(ee!==null){z.clientReactive[K(ce)]=ee;continue}let le=te.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(le)try{let ue=le[1];if(p(ue)){let pe=c(ue,Object.keys(_))(...Object.values(_));X(ce,pe!=null?String(pe):"")}else{if(k.debug)console.error(`Unsafe expression in ${ce}: ${ue}`);X(ce,te)}}catch(ue){if(k.debug)console.error(`Error evaluating expression for ${ce}:`,ue);X(ce,te)}else{let ue=te,de=/\{\{\s*([\s\S]+?)\s*\}\}/g,pe;while((pe=de.exec(te))!==null)try{let fe=pe[1];if(!p(fe)){if(k.debug)console.error(`Unsafe expression in ${ce}: ${fe}`);continue}let ke=c(fe,Object.keys(_))(...Object.values(_));ue=ue.replace(pe[0],String(ke??""))}catch(fe){if(k.debug)console.error(`Error evaluating expression in ${ce}:`,fe)}X(ce,ue)}continue}X(ce,te===zr?"true":mu(te))}return z}function dv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((V)=>re(V[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let z="",F=0;for(let V of R)z+=v.slice(F,V.index).replace(/[`\\$]/g,(H)=>`\\${H}`),z+=`\${${V[1]}}`,F=V.index+V[0].length;return z+=v.slice(F).replace(/[`\\$]/g,(V)=>`\\${V}`),`\`${z}\``}var pv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function fv(v,_,k){if(!v.includes("@"))return v;if(!pv.some(([T,z])=>T.test(v)&&v.includes(z)))return v;try{return sr(v,_,k)}catch{return v}}function si(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 z="";if(k<R&&(v[k]==='"'||v[k]==="'")){let F=v[k];k++;while(k<R){let V=v[k];if(V==="\\"&&k+1<R){k++,z+=v[k],k++;continue}if(V===F){k++;break}z+=V,k++}}else if(v[k]==="{"){z=hu(v,k),k+=z.length;let F=Mg(z);if(F!==null){_[`:${T}`]=F;continue}}else while(k<R&&!/\s/.test(v[k]))z+=v[k],k++;_[T]=z}else _[T]=zr}return _}function im(v){return Object.entries(v).map(([_,k])=>k===zr?_:`${_}="${gv(k)}"`).join(" ")}function gv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mv(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(Gs.isBuiltin(T))_.add(T)}return[..._].sort()}async function Fc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,F=rm.dirname(k),V=[],H=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let G of v.matchAll(H)){let[te,ce,ee]=G,le=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ue=ee,de,pe=[];while((de=le.exec(ee))!==null){let[fe,Pe,ke,we]=de,Me=null,Ne=null;if(we.startsWith(".")||we.startsWith("/")){let ze=rm.resolve(F,we);if(ze.endsWith(".stx"))Ne=ze;else{let je=`${ze}.stx`;try{if(nm.statSync(je).isFile())Ne=je}catch{try{if(nm.statSync(ze).isDirectory())Me=ze}catch{}}}}else Me=Qo(we,F);if(!Me&&!Ne)continue;let Le=!1,Be=(ze,je)=>{z.set(ze,je),z.set(ze.toLowerCase(),je);let Fe=ze.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();z.set(Fe,je),T.add(je)};if(ke&&Ne)Be(ke,Ne),Le=!0;else if(Pe){let ze=Pe.slice(1,-1).split(",").map((Fe)=>Fe.trim()).filter(Boolean).map((Fe)=>{let Ve=Fe.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ve)return{source:Ve[1],local:Ve[2]};return{source:Fe,local:Fe}}),je=Me?Yo(Me):null;for(let{source:Fe,local:Ve}of ze){let Ue=null;if(Ne)Ue=Ne;else if(je)Ue=je.get(Fe)??je.get(Fe.toLowerCase())??je.get(Fe.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Ue)Be(Ve,Ue),Le=!0}}if(Le)pe.push({start:de.index,end:de.index+fe.length})}if(pe.length===0)continue;for(let fe=pe.length-1;fe>=0;fe--)ue=ue.slice(0,pe[fe].start)+ue.slice(pe[fe].end);V.push({start:G.index,end:G.index+te.length,value:`<script${ce}>${ue}</script>`})}if(V.length===0)return v;let K=[],X=0;for(let G of V)K.push(v.slice(X,G.start),G.value),X=G.end;return K.push(v.slice(X)),K.join("")}async function hv(v,_,k,R,T){let z=v;if(!_.__importedComponents)_.__importedComponents=new Map;let F=_.__importedComponents,V=/@import\s*\(\s*([^)]+)\s*\)/g,H;while((H=V.exec(z))!==null){let[K,X]=H,G=X.split(",").map((te)=>te.trim().replace(/^['"]|['"]$/g,"")).filter((te)=>te.length>0);for(let te of G){let ce=te.split("/"),le=ce[ce.length-1].replace(/\.stx$/,""),ue=le.includes("-")?le.split("-").map((fe)=>fe.charAt(0).toUpperCase()+fe.slice(1)).join(""):le.charAt(0).toUpperCase()+le.slice(1),de=null,pe=ea(te,k,R);for(let fe of pe)try{if(await Bun.file(fe).exists()){de=fe;break}}catch{}if(de){F.set(ue,de),F.set(le,de),F.set(le.toLowerCase(),de);let fe=ue.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(F.set(fe,de),T.add(de),R.debug)console.log(`Imported component: ${ue} -> ${de}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${te}`)}z=z.replace(K,""),V.lastIndex=0}return z}async function yv(v,_,k,R,T){let z=v,F=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let V=_.__processedComponents,H=/@component\s*\(/g,K;while((K=H.exec(z))!==null){let X=K.index,G=X+K[0].length-1,te=1,ce=G+1;while(ce<z.length&&te>0){if(z[ce]==="(")te++;else if(z[ce]===")"){if(te--,te===0)break}ce++}if(te!==0)break;let ee=z.substring(G+1,ce),le=ce+1,ue=ee.match(/^\s*['"]([^'"]+)['"]/);if(!ue){H.lastIndex=0;continue}let de=ue[1],pe,fe=ee.slice(ue[0].length),Pe=fe.match(/^\s*,\s*/);if(Pe)pe=fe.slice(Pe[0].length).trim();let ke={};if(pe)try{ke=N(pe,_)}catch(ze){let je=ze instanceof Error?ze.message:String(ze);z=z.replace(z.substring(X,le),`[Error parsing component props: ${je}]`);continue}let we="",Me=le,Le=z.substring(le).match(/^([\s\S]*?)@endcomponent/);if(Le)we=Le[1].trim(),Me=le+Le[0].length;let Be=await ot(de,ke,we,F,_,k,R,V,T);z=z.substring(0,X)+Be+z.substring(Me),H.lastIndex=0}return z}async function xv(v,_,k,R,T){if(!v)return v;let z=v,F=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let V=_.__processedComponents,H=vv(z);if(H.size>0){let le=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...le,...H])]}let K=Dn(z);z=K.output;let X=Ir(_);return z=await ee(z,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),z=await ee(z,/[A-Z][a-zA-Z0-9]*/,!0,Pg(Ro)),z=await ee(z,/[a-z][a-z0-9]*/,!1,Ro),z=K.restore(z),z;async function ee(le,ue,de,pe){if(!le)return le;let fe=le,Pe=Dg(fe,ue,pe),ke=yu(fe),we=new Map;for(let Le=Pe.length-1;Le>=0;Le--){let Be=Pe[Le],ze=de?mn(Be.tagName):Be.tagName,je=si(fv(Be.attributes,_,k)),Fe=ke.filter(({start:Ct,end:vt})=>Be.startIndex>=Ct&&Be.startIndex<vt),Ve=Fe.length>0,Ue=new Set(X);for(let Ct of Fe)for(let vt of Ct.names)Ue.add(vt);let We=uv(je,_,R,Ve,Ue);if(typeof We.clientReactive.for==="string")for(let Ct of Kr(We.clientReactive.for))Ue.add(Ct);let ct=Gs.getBuiltin(Be.tagName),$t=ct?await mr(Be.tagName,F,_,k,R):!1;if(ct&&!$t){let Ct={context:_,filePath:k,options:R,dependencies:T},vt=ct.render(We,Be.content,Ct);if(Object.keys(We.events).length>0){let pt=im(We.events);vt=vt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${pt}`)}if(Object.keys(We.clientReactive).length>0)vt=om(vt,We.clientReactive);we.set(Le,vt);continue}if(!de&&Be.tagName.includes("-")&&!await mr(ze,F,_,k,R))continue;let wt={};for(let[Ct,vt]of Object.entries(We.static))wt[Ct]=vt;for(let[Ct,vt]of Object.entries(We.serverDynamic))wt[Ct]=vt;let It={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(We.clientReactive),events:Object.keys(We.events)},mt=await ot(ze,wt,K.restore(Be.content),F,_,k,R,V,T,[...Ue],It,Be.tagName);if(mt=bv(mt,We,It.declaredProps,It.consumedProps,R._nativeHostAttrs),R._nativeHostAttrs){let Ct=It.reactiveProps.filter((Rt)=>!It.consumedProps.has(Rt)&&!["if","for","show","key","ref"].includes(Rt)).map(mn),vt=$u(mt,!0);if(Ct.length&&vt){if(!Object.hasOwn(si(mt.slice(vt.insertPos,vt.tagEnd)),"data-stx-native-host-root"))mt=mt.slice(0,vt.insertPos)+' data-stx-native-host-root="true"'+mt.slice(vt.insertPos);let Rt=Po(mt);mt=mt.slice(0,Rt.insertPos)+` data-stx-native-forward="${Ct.join(" ")}"`+mt.slice(Rt.insertPos)}let pt=$u(mt,!0);if(pt){let Rt=si(mt.slice(pt.insertPos,pt.tagEnd)),xt=Po(mt),qt=si(mt.slice(xt.insertPos,xt.tagEnd));if(Object.hasOwn(Rt,"data-stx-native-host-root")&&!Object.hasOwn(qt,"data-stx-native-host-owner"))mt=mt.slice(0,xt.insertPos)+" data-stx-native-host-owner"+mt.slice(xt.insertPos)}}if(Object.keys(We.events).length>0){let Ct=Po(mt);if(Ct){let vt=im(We.events),pt=Object.keys(We.events).map((Rt)=>Rt.replace(/^@/,"").split(".")[0]).join(" ");mt=mt.substring(0,Ct.insertPos)+` data-stx-parent-events="${pt}" ${vt}`+mt.substring(Ct.insertPos)}}if(Object.keys(We.clientReactive).length>0)mt=om(mt,We.clientReactive);we.set(Le,mt)}if(we.size===0)return fe;let Me="",Ne=0;for(let Le=0;Le<Pe.length;Le++){let Be=we.get(Le);if(Be===void 0)continue;Me+=fe.slice(Ne,Pe[Le].startIndex),Me+=Be,Ne=Pe[Le].endIndex}return Me+=fe.slice(Ne),Me}}function om(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([X])=>!k.has(X)),z=T.filter(([X])=>!R.has(X)).map(([X])=>mn(X)).join(" "),F=v,V=T.length>0?Po(F):null;if(V){let X=T.map(([te,ce])=>`:${mn(te)}="${ce.replace(/"/g,"&quot;")}"`).join(" "),G=z?` data-stx-parent-bindings="${z}"`:"";F=F.substring(0,V.insertPos)+`${G} ${X}`+F.substring(V.insertPos)}let H=_.if;if(H)F=`<template :if="${H.replace(/"/g,"&quot;")}">${F}</template>`;let K=_.for;if(K)F=`<template :for="${K.replace(/"/g,"&quot;")}">${F}</template>`;return F}function bv(v,_,k=new Set,R=new Set,T=!1){let z=$u(v,T);if(!z)return v;let F=v.slice(z.insertPos,z.tagEnd),V=_.serverDynamic.class??_.static.class;if(T&&typeof V==="string"&&V&&!R.has("class")){let ee=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,le=ee.test(F)?F.replace(ee,(ue,de,pe,fe,Pe)=>`${de}class="${Zt(`${mu(pe??fe??Pe)} ${V}`)}"`):` class="${Zt(V)}"${F}`;v=v.slice(0,z.insertPos)+le+v.slice(z.tagEnd),z.tagEnd+=le.length-F.length,F=le}let H=T||/\bdata-native(?:\s|=)/i.test(F),K=H?R:k,X=new Set(Object.keys(si(F))),G=new Set(["class","className"]);for(let ee of Object.keys(_.static)){let le=_.staticNames[ee]??ee;if(X.has(le)||K.has(ee)||!H&&!ql(le))G.add(ee)}for(let ee of Object.keys(_.serverDynamic)){let le=_.serverDynamicNames?.[ee]??ee;if(X.has(le)||K.has(ee)||!H&&!ql(le))G.add(ee)}let te=[];if(H){for(let[ee,le]of Object.entries(_.static)){if(G.has(ee)||le!==!0&&le!==zr)continue;G.add(ee),te.push(`${Zt(_.staticNames?.[ee]??ee)}="true"`)}for(let[ee,le]of Object.entries(_.serverDynamic)){if(G.has(ee)||le!==!0)continue;G.add(ee),te.push(`${Zt(_.serverDynamicNames?.[ee]??ee)}="true"`)}}let ce=[...Wr(_,G),...Fr(_,G),...te];if(H){for(let[ee,le]of Object.entries(_.serverDynamic)){if(G.has(ee)||le!==!1)continue;let ue=_.serverDynamicNames?.[ee]??ee;ce.push(`${Zt(ue)}="false"`)}for(let[ee,le]of Object.entries(_.serverDynamic)){if(G.has(ee)||le===null||typeof le!=="object")continue;let ue=JSON.stringify(le);if(ue!==void 0){let de=_.serverDynamicNames?.[ee]??ee;ce.push(`${Zt(de)}="${Zt(ue)}"`)}}}if(ce.length===0)return v;return`${v.slice(0,z.insertPos)} ${ce.join(" ")}${v.slice(z.insertPos)}`}function Po(v){let _=am(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:_u(v,k.index+1+k[1].length)};return null}function $u(v,_=!1){let k=Po(v);if(!k)return null;let R=v.slice(k.insertPos,k.tagEnd),T=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(R)?am(v,k.tagEnd+1):k;return T&&_?wv(v,T)??T:T}function wv(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,z;while(R>=0&&R<v.length){if(v.startsWith("<!--",R)){let X=v.indexOf("-->",R+4);if(X<0)return null;R=v.indexOf("<",X+3);continue}let F=/^<(\/?)([a-z][\w-]*)\b/i.exec(v.slice(R));if(!F){R=v.indexOf("<",R+1);continue}let V=F[2].toLowerCase(),H=R+F[0].length,K=_u(v,H);if(F[1]){if(T--,z!==void 0&&T<z)z=void 0;if(T<=0)return null}else if(V==="script"||V==="style"){let X=new RegExp(`</${V}\\s*>`,"gi");if(X.lastIndex=K+1,!X.exec(v))return null;R=v.indexOf("<",X.lastIndex);continue}else{let X=si(v.slice(H,K)),G=T>0&&(Object.hasOwn(X,"data-stx-component-wrapper")||Object.hasOwn(X,"data-stx-native-host-owner"));if(z===void 0&&!G&&Object.hasOwn(X,"data-stx-native-host-root"))return{insertPos:H,tagEnd:K};if(!k.has(V)&&v[K-1]!=="/"){if(T++,z===void 0&&G)z=T}else if(T===0)return null}R=v.indexOf("<",K+1)}return null}function am(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 V=v.indexOf("-->",k+4);if(V===-1)return null;k=V+3;continue}let z=R.match(/^<(script|style)\b[^>]*>/i);if(z){let V=`</${z[1].toLowerCase()}>`,H=v.toLowerCase().indexOf(V,k+z[0].length);if(H===-1)return null;k=H+V.length;continue}let F=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!F)return null;return{insertPos:k+1+F[1].length,tagEnd:_u(v,k+1+F[1].length)}}return null}function _u(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 vv(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 Su(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 z of(T[2]??"").split(",")){let F=z.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(F))_.add(F)}}}return _}async function Rs(v,_,k,R,T){if(!sm)Ag(Gs),sm=!0;let z=await Fc(v,_,k,R,T);z=await hv(z,_,k,R,T),z=await yv(z,_,k,R,T);let F=[];for(let V=0;V<3;V++){let H=F.length,K=qn(z,Xe,(G,te)=>`\x00STX_COMPONENT_COMMENT_${H+te}\x00`,`STX_COMPONENT_COMMENT:${H}`);F.push(...K.tokens);let X=z;if(z=await xv(K.output,_,k,R,T),z===X)break}if(F.length>0)z=z.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(V,H)=>F[Number(H)]??"");if(R.debug){let V=mv(z);if(V.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${V.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return z}function ku(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 $v(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),z=T.exec(R);while(z){let F=z.index,V=F+z[0].length-1,H=1,K=V+1;while(K<R.length&&H>0){if(R[K]==="(")H++;else if(R[K]===")")H--;K++}if(H!==0)break;let X=R.substring(V+1,K-1),G=`${k}(${X})`;R=R.substring(0,F)+G+R.substring(K),T.lastIndex=F+G.length,z=T.exec(R)}return R}function _v(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function dm(v){let _=v,k=[],R=new Set,T=0,z=0,F=_.length,V=(G)=>{z++;while(z<F){if(_[z]==="\\"){z+=2;continue}if(_[z]===G){z++;return}z++}},H=()=>{z++;while(z<F){if(_[z]==="\\"){z+=2;continue}if(_[z]==="`"){z++;return}if(_[z]==="$"&&_[z+1]==="{"){z+=2;let G=1;while(z<F&&G>0)if(_[z]==="{")G++,z++;else if(_[z]==="}")G--,z++;else if(_[z]==="'"||_[z]==='"')V(_[z]);else if(_[z]==="`")H();else z++;continue}z++}},K=()=>{if(_[z]==="/"&&_[z+1]==="/"){while(z<F&&_[z]!==`
2489
+ `)z++;return!0}if(_[z]==="/"&&_[z+1]==="*"){z+=2;while(z<F-1&&!(_[z]==="*"&&_[z+1]==="/"))z++;return z+=2,!0}return!1},X=()=>{if(T!==0)return;let G=_.slice(z).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let ee=G[2];if(!R.has(ee))k.push(ee),R.add(ee);return}let te=_.slice(z).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let ee=te[1];if(!R.has(ee))k.push(ee),R.add(ee);return}let ce=_.slice(z).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ce){let ee=ce[1];if(!R.has(ee))k.push(ee),R.add(ee)}};while(z<F){if(K())continue;if(_[z]==="'"||_[z]==='"'){V(_[z]);continue}if(_[z]==="`"){H();continue}if(_[z]==="{"){T++,z++;continue}if(_[z]==="}"){T--,z++;continue}if(T===0&&/[a-z]/i.test(_[z])&&(z===0||/\s|[;{}()]/.test(_[z-1])))X();z++}return k.join(", ")}function kv(v,_=""){let k=dm(v).split(",").map((R)=>R.trim()).filter(Boolean);return`
2490
+ (function() {
2491
+ ${Gt("var",k)}
2492
+ var __destroyHooks = [];
2493
+ var __origOnDestroy = onDestroy;
2494
+ onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
2495
+
2496
+ ${v}
2497
+ ${_}})();
2498
+ `}function Ev(v,_){let R=dm(v).split(",").map((F)=>F.trim()).filter(Boolean),T=new Set(M(v,!0).split(",").map((F)=>F.trim())),z=R.map((F)=>T.has(F)?` try { ${F}; Object.defineProperty(__scopeRegistration, ${JSON.stringify(F)}, ${Ko(F)}); } catch (e) { /* not actually top-level */ }`:` try { __scopeRegistration[${JSON.stringify(F)}] = ${F}; } 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
+ ${z}
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
+ if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeRegistration, Object.getOwnPropertyDescriptors(__stxLiveBindings));
2510
+ window.stx._scopes['${_}'] = __scopeRegistration;
2511
+ `}function Cv(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 cm(v,_){let k=Ev(v,_);return Rv(kv(v,k),_)}function Rv(v,_){let k=`
2512
+ (function() {
2513
+ var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${_}"]') : null;
2514
+ var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
2515
+ if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
2516
+ if (__stxScopeEl && typeof window !== 'undefined' && window.stx) {
2517
+ if (!window.stx._scopes) window.stx._scopes = {};
2518
+ window.stx._scopes['${_}'] = {};
2519
+ }
2520
+ try {`,R=`
2521
+ } finally {
2522
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2523
+ }
2524
+ })();`;return k+v+`
2525
+ } finally {
2526
+ if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2527
+ }
2528
+ })();`}function Av(v,_){if(Gn(v)){let T=Gn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:ms(v,(z,F)=>`<body${F} 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),z=R.match(/data-stx-scope="([^"]*)"/);if(z)return{html:v,mergedIntoExisting:z[1],stamped:!0,root:T};let F=k[1],V=k[2],H=k[3];return{html:`${F}${V} 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 Tv=0;function lm(v,_){let k=Qt.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}_${++Tv}`}var Eu=new Set,Cu=new Set;function wd(){Eu.clear(),Cu.clear()}var Iv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Yc(v){let _=(V)=>V.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,z=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,F;while((F=z.exec(k))!==null){let V=F[1]==="/",H=F[2],K=F[3]==="/"||Iv.has(H.toLowerCase());if(V){T=Math.max(0,T-1);continue}if(T===0)R.push(H);if(!K)T++}return R}function um(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var Re=new L(500),Di=new Set;function xd(){Di.clear()}function Pv(v){if(v.__onceStore instanceof Set)return v.__onceStore;return Di}async function Ms(v,_,k,R,T,z=new Set){let F=R.partialsDir||Qt.join(Qt.dirname(k),"partials");if(F&&!Qt.isAbsolute(F))F=Qt.resolve(process.cwd(),F);let V=$v(v,"@partial","@include"),H=Pv(_);V=V.replace(/@once([\s\S]*?)@endonce/g,(le,ue,de)=>{let pe=ue.trim(),fe=`${k}:${pe}`;if(H.has(fe))return"";return H.add(fe),ue});{let le=/@includeIf\s*\(/g,ue;while((ue=le.exec(V))!==null){let de=ue.index,pe=de+ue[0].length-1,fe=1,Pe=pe+1;while(Pe<V.length&&fe>0){if(V[Pe]==="(")fe++;else if(V[Pe]===")")fe--;Pe++}if(fe!==0)break;let ke=V.substring(pe+1,Pe-1),we=ke.match(/^\s*['"]([^'"]+)['"]/);if(!we){le.lastIndex=Pe;continue}let Me=we[1],Ne=K(Me,F,k),Le="";if(Ne&&await Bun.file(Ne).exists())T.add(Ne),Le=`@include(${ke})`;V=V.substring(0,de)+Le+V.substring(Pe),le.lastIndex=0}}for(let[le,ue]of[["@includeWhen",!1],["@includeUnless",!0]]){let de=new RegExp(`${le.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),pe;while((pe=de.exec(V))!==null){let fe=pe.index,Pe=fe+pe[0].length-1,ke=1,we=Pe+1;while(we<V.length&&ke>0){if(V[we]==="(")ke++;else if(V[we]===")")ke--;we++}if(ke!==0)break;let Me=V.substring(Pe+1,we-1),Ne=ku(Me,0);if(Ne===-1){de.lastIndex=we;continue}let Le=Me.substring(0,Ne).trim(),Be=Me.substring(Ne+1).trim(),ze=Be.match(/^\s*['"]([^'"]+)['"]/);if(!ze){de.lastIndex=we;continue}let je=ze[1],Fe=Be.substring(ze[0].length),Ve,Ue=ku(Fe,0);if(Ue!==-1)Ve=Fe.substring(Ue+1).trim();try{let We=`Boolean(${Le})`,ct;if(p(We)){let It=c(We,Object.keys(_));ct=Boolean(It(...Object.values(_)))}else ct=Boolean(l(We,_));let $t=ue?!ct:ct,wt="";if($t){let It=K(je,F,k);if(It&&await Bun.file(It).exists())T.add(It);wt=`@include('${je}'${Ve?`, ${Ve}`:""})`}V=V.substring(0,fe)+wt+V.substring(we),de.lastIndex=0}catch(We){let ct=We instanceof Error?We.message:String(We),$t=g("Include",`Error evaluating ${le} condition: ${ct}`,k,v,fe);V=V.substring(0,fe)+$t+V.substring(we),de.lastIndex=0}}}{let le=/@each\s*\(/g,ue;while((ue=le.exec(V))!==null){let de=ue.index,pe=de+ue[0].length-1,fe=1,Pe=pe+1;while(Pe<V.length&&fe>0){if(V[Pe]==="(")fe++;else if(V[Pe]===")"){if(fe--,fe===0)break}Pe++}if(fe!==0)break;let ke=V.substring(pe+1,Pe),we=V.substring(de,Pe+1),Me=ke.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!Me){le.lastIndex=0,V=V.replace(we,"");continue}let[,Ne,Le,Be,ze]=Me;try{let je,Fe=Le.trim();if(p(Fe))je=c(Fe,Object.keys(_))(...Object.values(_));else je=l(Fe,_);let Ve="";if(Array.isArray(je)&&je.length>0)for(let Ue of je){let We={..._,[Be]:Ue},ct=await te(Ne,We,v,de);Ve+=ct}else if(ze)Ve=await te(ze,{},v,de);V=V.substring(0,de)+Ve+V.substring(Pe+1),le.lastIndex=0}catch(je){let Fe=je instanceof Error?je.message:String(je);V=V.substring(0,de)+g("Each",`Error in @each: ${Fe}`,k,v,de)+V.substring(Pe+1),le.lastIndex=0}}}{let le=/@includeFirst\s*\(/g,ue;while((ue=le.exec(V))!==null){let de=ue.index,pe=de+ue[0].length-1,fe=1,Pe=pe+1;while(Pe<V.length&&fe>0){if(V[Pe]==="(")fe++;else if(V[Pe]===")"){if(fe--,fe===0)break}Pe++}if(fe!==0)break;let ke=V.substring(pe+1,Pe),we=V.substring(de,Pe+1),Me=ke.match(/^\s*(\[[^\]]+\])/);if(!Me){le.lastIndex=0,V=V.replace(we,"");continue}let Ne=Me[1],Le=ke.slice(Me[0].length),Be,ze=Le.match(/^\s*,\s*\{/);if(ze){Le=Le.slice(ze[0].length-1);let Ve=1,Ue=1;while(Ue<Le.length&&Ve>0){if(Le[Ue]==="{")Ve++;else if(Le[Ue]==="}"){if(Ve--,Ve===0)break}Ue++}Be=Le.substring(0,Ue+1),Le=Le.slice(Ue+1)}let je,Fe=Le.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(Fe)je=Fe[1];try{let Ve=JSON.parse(Ne.replace(/'/g,'"')),Ue={};if(Be)try{Ue=N(Be,_)}catch(ct){let $t=ct instanceof Error?ct.message:String(ct);if(R.debug){let wt=g("Include",`Error parsing includeFirst variables: ${$t}`,k,v,de,we);V=V.replace(we,()=>wt)}else V=V.replace(we,()=>je||"");continue}let We=!1;for(let ct of Ve){let $t=K(ct,F,k);if(!$t)continue;if(await r($t)){let wt=await te(ct,Ue,v,de);V=V.replace(we,()=>wt),We=!0;break}}if(!We)if(je!==void 0)V=V.replace(we,()=>je);else if(R.debug){let ct=g("Include",`None of the includeFirst paths exist: ${Ne}`,k,v,de,we);V=V.replace(we,()=>ct)}else V=V.replace(we,"")}catch(Ve){let Ue=Ve instanceof Error?Ve.message:String(Ve),We=g("Include",`Error processing @includeFirst: ${Ue}`,k,v,de,we);V=V.replace(we,()=>We)}le.lastIndex=0}}function K(le,ue,de){try{let pe=le;if(!le.endsWith(".stx"))pe=`${le}.stx`;let fe=Qt.resolve(ue),Pe=Qt.resolve(Qt.dirname(de)),ke;if(!pe.startsWith("./")&&!pe.startsWith("../")){for(let ze of R._layerPartialDirs??[]){let je=Qt.resolve(ze,pe);if(je.startsWith(`${Qt.resolve(ze)}${Qt.sep}`)&&Sv(je))return je}ke=Qt.resolve(ue,pe)}else ke=Qt.resolve(Pe,pe);let we=Qt.normalize(ke),Me=we.startsWith(fe+Qt.sep)||we===fe,Ne=we.startsWith(Pe+Qt.sep)||we===Pe,Le=!1,Be=Qt.dirname(Pe);if(we.startsWith(Be+Qt.sep)){if(!Qt.relative(Be,we).split(Qt.sep).some((Ve)=>Ve.startsWith(".")&&Ve!=="."&&Ve!==".."))Le=!0}if(!Me&&!Ne&&!Le)return console.error(`Security: Path traversal attempt blocked for include path: ${le}`),console.error(` Resolved to: ${we}`),console.error(` Allowed dirs: ${fe}, ${Pe}`),null;return we}catch(pe){return console.error(`Error resolving path ${le}: ${pe}`),null}}let X=Qt.resolve(k);z.add(X);function G(le,ue,de,pe){return R.onIncludeError?.({includePath:le,templatePath:k,message:ue,partialsDir:F}),g("Include",ue,k,de,pe)}async function te(le,ue={},de,pe){let fe=K(le,F,k);if(!fe)return G(le,`Could not resolve path for include: ${le}`,de,pe);let Pe=Qt.resolve(fe);if(z.has(Pe)){let ke=[...z,Pe].map((we)=>Qt.basename(we)).join(" -> ");return G(le,`Circular include detected: ${ke}`,de,pe)}try{T.add(fe);let ke;if(!ke)try{ke=await Bun.file(fe).text()}catch(pt){let Rt=pt instanceof Error?pt.message:String(pt);return G(le,`Error loading include file ${le}: ${Rt}`,de,pe)}if(ke)ke=ke.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ke&&ke.includes("@stream")){let{processStreamDirectives:pt}=await import("./chunk-g039c67x.js");ke=pt(ke,_)}if(ke&&(R.debug||!E()&&!Bn()))try{let{warnUnbalancedTags:pt}=await import("./chunk-ytxzy6eg.js");pt(ke,fe)}catch{}try{let{processESImports:pt}=await import("./chunk-ghfxfcr9.js");ke=await pt(ke,_,fe,R,T)}catch(pt){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${fe}:`,pt instanceof Error?pt.message:pt)}let we=ke,Me=oe(we);if(Me)we=Me.content.trim();let Le=ke.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Be="";if(Le)Be=`<style${Le[1]}>${Le[2]}</style>`;let ze=[];we=we.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(pt,Rt,xt)=>{if(!um(Rt))return"";return ze.push({attrs:Rt,body:xt}),`__STX_DATA_BLOCK_${ze.length-1}__`}),we=we.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let je={..._};je.__stx_signals_gate=Ee(ke,fe);for(let[pt,Rt]of Object.entries(ue))je[pt]=Rt;let Fe=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ve=[...ke.matchAll(Fe)].sort((pt,Rt)=>{let xt=(pt[1]||"").includes("server"),qt=(Rt[1]||"").includes("server");return Number(qt)-Number(xt)}),Ue="",We=null,ct=!1,$t=!1;for(let pt of Ve){let Rt=pt[1]||"",xt=pt[2]||"";if(um(Rt))continue;let qt=Rt.includes("server"),Ur=rt(Rt);if(!qt&&!/\bsrc\s*=/i.test(Rt))et(xt,fe,R.strict);if(!qt&&xt.trim()){let{interpolateScriptExpressions:ht}=await import("./chunk-mfwrxz9z.js");xt=ht(xt,je,le)}let bn="";try{let{extractAndStripCssImports:ht,renderVendorStyleTags:At}=await import("./chunk-ywf319rp.js"),Kt=ht(xt,{filePath:fe,projectRoot:process.cwd()});xt=Kt.code,bn=At(Kt.styles)}catch(ht){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${fe}:`,ht instanceof Error?ht.message:ht)}if(Ur&&xt.trim())xt=st(xt);if(!qt){try{let{injectBrowserCoreAutoImports:At}=await import("./chunk-ywf319rp.js");xt=At(xt).code;let{hasUserImports:Kt,bundleClientScript:Jt}=await import("./chunk-sfj84n72.js");if(Kt(xt))xt=await Jt(xt,fe,{projectRoot:process.cwd()})}catch(At){if(R.debug)console.warn(`[stx] bundler skipped for ${fe}:`,At instanceof Error?At.message:At)}let{stripStxRuntimeImports:ht}=await import("./chunk-yww6c9we.js");xt=ht(xt)}let kt=_v(xt);if(!qt){let{extractBridgeData:ht,generateServerDataBridge:At}=await import("./chunk-ywf319rp.js"),Kt=At(xt,ht(je));if(Kt)xt=`${Kt}
2529
+ ${xt}`}if(kt&&!qt){ct=!0,We=lm(fe,_);let ht=I(xt),At=cm(ht,We);Ue+=`${bn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${We}">${At}</script>
2530
+ `;continue}if(qt)try{let{extractVariables:ht}=await import("./chunk-8er7jc3c.js");await ht(xt,je,fe)}catch(ht){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${fe}:`,ht)}if(!qt&&!kt){let ht=Rt.replace(/\bclient\b/i,"").trim();We=lm(fe,_);let At=I(xt),Kt=cm(At,We);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(Kt))$t=!0;Ue+=`${bn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${We}"${ht?` ${ht}`:""}>${Kt}</script>
2531
+ `}}if(ze.length>0){let{interpolateScriptExpressions:pt}=await import("./chunk-mfwrxz9z.js");we=we.replace(/__STX_DATA_BLOCK_(\d+)__/g,(Rt,xt)=>{let qt=ze[Number(xt)];return`<script${qt.attrs}>${pt(qt.body,je,le)}</script>`})}if(We){let pt=Av(we,We);if(we=pt.html,pt.mergedIntoExisting){let xt=We,qt=pt.mergedIntoExisting;Ue=Ue.split(`'${xt}'`).join(`'${qt}'`).split(`"${xt}"`).join(`"${qt}"`),We=qt}else if(!pt.stamped&&ct&&!Eu.has(fe))Eu.add(fe),console.warn(`[stx] ${Qt.relative(process.cwd(),fe)} 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(pt.stamped&&pt.root!=="body"&&(ct||$t)&&!Cu.has(fe)){let xt=Yc(we);if(xt.length>1)Cu.add(fe),console.warn(`[stx] ${Qt.relative(process.cwd(),fe)} declares ${ct?"signals":"bindings"} and has ${xt.length} top-level elements (${xt.map((qt)=>`<${qt}>`).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 Rt=pt.stamped&&pt.root!==null&&En(pt.root);Ue=Cv(Ue,Rt?We:null)}if(we.includes("@include")||we.includes("@partial"))we=await Ms(we,je,fe,R,T,z);let{processLoops:wt,reportDeferredLoopWarnings:It}=await import("./chunk-zw20a7q4.js"),St=wt(we,je,fe,void 0,!0);St=sr(St,je,fe),St=It(St);let{processMetaDirectives:mt,processSeoDirective:Ct,processStructuredData:vt}=await import("./chunk-gvyq9xt6.js");if(St=mt(St,je,fe,R),St=vt(St,je,fe),St=Ct(St,je,fe,R),St=Z(St,je,fe),Be)St+=`
2532
+ `+Be;if(Ue)St+=`
2533
+ `+Ue;return St}catch(ke){if(ke instanceof q)throw ke;let we=ke instanceof Error?ke.message:String(ke);return G(le,`Error processing include ${le}: ${we}`,de,pe)}}let ce=/@include\s*\(/g,ee;while((ee=ce.exec(V))!==null){let le=ee.index,ue=le+ee[0].length-1,de=1,pe=ue+1;while(pe<V.length&&de>0){if(V[pe]==="(")de++;else if(V[pe]===")")de--;pe++}if(de!==0)break;let fe=V.substring(le,pe),Pe=V.substring(ue+1,pe-1),ke=Pe.match(/^\s*['"]([^'"]+)['"]/);if(!ke){ce.lastIndex=pe;continue}let we=ke[1],Me,Ne=Pe.substring(ke[0].length),Le=ku(Ne,0);if(Le!==-1)Me=Ne.substring(Le+1).trim();let Be={};if(Me)try{Be=N(Me,_)}catch(je){let Fe=je instanceof Error?je.message:String(je);V=V.replace(fe,g("Include",`Error parsing include variables for ${we}: ${Fe}`,k,v,le)),ce.lastIndex=0;continue}let ze=await te(we,Be,v,le);V=V.substring(0,le)+ze+V.substring(pe),ce.lastIndex=0}return V}function Ls(v,_){let k=v;function R(T,z,F,V){let H=T,K=!0;while(K){K=!1;let X=new RegExp(`@${z}\\(['"]([^'"]+)['"]\\)`),G=H.match(X);if(!G||G.index===void 0)break;let te=G.index,ce=G[1],ee=te+G[0].length,le=new RegExp(`@${z}\\(`),ue=new RegExp(`@${F}(?![a-z])`),de=1,pe=ee,fe=-1;while(de>0&&pe<H.length){let ke=H.slice(pe),we=ke.match(le),Me=ke.match(ue),Ne=we?pe+we.index:1/0,Le=Me?pe+Me.index:1/0;if(Ne<Le)de++,pe=Ne+(we[0].length||1);else if(Le<1/0){if(de--,de===0){fe=Le;break}pe=Le+F.length+1}else break}if(fe===-1)break;let Pe=H.slice(ee,fe);if(!_[ce])_[ce]=[];if(V)_[ce].unshift(Pe);else _[ce].push(Pe);H=H.substring(0,te)+H.substring(fe+`@${F}`.length),K=!0}return H}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function js(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
2534
+ `)})}import*as Ru from"path";async function pm(v,_,k=""){if(Ru.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return gm(v,_,k,"@js","@endjs")}async function fm(v,_,k=""){if(Ru.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((z)=>({...z,displayName:`User ${z.id}: ${z.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return gm(v,_,k,"@ts","@endts")}async function gm(v,_,k,R,T){let z=v,F=Xr(`${R}([\\s\\S]*?)${T}`,"g"),V=[],H;while((H=F.exec(v))!==null)V.push({fullMatch:H[0],content:H[1]||"",index:H.index});for(let{fullMatch:K,content:X,index:G}of V)try{let te={..._,global:_},ce=Object.keys(te),ee=Object.values(te),le=X.trim();if(R==="@ts")le=le.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 de=(le.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((we)=>we.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),pe=de.length>0?`return { ${de.join(", ")} };`:"return {};",fe=`
2535
+ ${le}
2536
+ ${pe}
2537
+ `,ke=Function(...ce,fe)(...ee);if(ke&&typeof ke==="object")Object.assign(_,ke);z=z.replace(K,"")}catch(te){console.error(`Error executing ${R} code block in ${k}:`,te);let ce=te instanceof Error?te.message:String(te),ee=g(`${R} Directive`,`Error executing code: ${ce}`,k,v,G,K);console.error(ee),z=z.replace(K,"")}return z}var Dv=1000,Ov=!1;function Mv(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,z;while((z=k.exec(v))!==null){let F=z.index+z[0].length,V=z.index+z[0].indexOf("("),H=S(v,"(",")",V);if(H===-1)continue;let K=v.slice(F,H).trim();if(!K)continue;if(!Object.keys(_).some((te)=>new RegExp(`(?:^|[^\\w$.])${te.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let G;try{let te=N(K,_);if(!te||typeof te!=="object")continue;G=JSON.stringify(te)}catch{continue}R+=v.slice(T,F)+G,T=H,k.lastIndex=H}return T===0?v:R+v.slice(T)}function jv(v,_){let k=/@component\s*\(/g,R=v,T,z=[];while((T=k.exec(R))!==null){let F=T.index,V=F+T[0].length-1,H=1,K=V+1;while(K<R.length&&H>0){if(R[K]==="(")H++;else if(R[K]===")"){if(H--,H===0)break}K++}if(H!==0)continue;let X=R.substring(V+1,K),G=K+1,te=X.match(/^\s*['"]([^'"]+)['"]/);if(!te)continue;let ce=te[1],ee=X.slice(te[0].length),le=ee.match(/^\s*,\s*/);if(!le)continue;let ue=ee.slice(le[0].length).trim();if(!ue)continue;try{let de=N(ue,_),pe=JSON.stringify(de),fe=`@component('${ce}', ${pe})`;z.push({start:F,end:G,replacement:fe})}catch{continue}}for(let F=z.length-1;F>=0;F--){let{start:V,end:H,replacement:K}=z[F];R=R.substring(0,V)+K+R.substring(H)}return R}function Za(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),z;while((z=T.exec(R))!==null){let F=z.index,V=F+z[0].length-1,H=1,K=V+1,X=null,G=!1;while(K<R.length&&H>0){let ee=R[K];if(G){G=!1,K++;continue}if(ee==="\\"&&X){G=!0,K++;continue}if(X){if(ee===X)X=null;K++;continue}if(ee==='"'||ee==="'"||ee==="`"){X=ee,K++;continue}if(ee==="(")H++;else if(ee===")"){if(H--,H===0)break}K++}if(H!==0)break;let te=R.substring(V+1,K),ce=k(te);R=R.substring(0,F)+ce+R.substring(K+1)}return R}function Nv(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,z)=>{try{let F=Object.keys(_),V=Object.values(_);so(z);let K=c(z,F)(...V),X=JSON.stringify(K);if(X===void 0){if(!Oe(z).some((ce)=>!(ce in _)))return"";return R}let G=Buffer.from(X,"utf8").toString("base64");return`__stx_${T}="${G}"`}catch(F){return R}}),k}var Ga="<!--__STX_BREAK__-->",Ja="<!--__STX_CONTINUE__-->";function Lv(v,_){let k=v;return k=Za(k,"@break",(R)=>{try{let z=`!!(${R.trim()})`,F;if(p(z)){let V=c(z,Object.keys(_));F=Boolean(V(...Object.values(_)))}else F=Boolean(l(z,_));return F?Ga:""}catch{return""}}),k=Za(k,"@continue",(R)=>{try{let z=`!!(${R.trim()})`,F;if(p(z)){let V=c(z,Object.keys(_));F=Boolean(V(...Object.values(_)))}else F=Boolean(l(z,_));return F?Ja:""}catch{return""}}),k}function Bv(v){let _=v;return _=_.replace(/@break(?!\()/g,Ga),_=_.replace(/@continue(?!\()/g,Ja),_}function mm(v){let _=v.includes(Ga),k=_?v.substring(0,v.indexOf(Ga)):v;return{hasBreak:_,content:k}}function hm(v){let _=v.includes(Ja),k=_?v.substring(0,v.indexOf(Ja)):v;return{hasContinue:_,content:k}}function xm(v){let _=v;return _=Za(_,"@break",(k)=>{let R=k.trim();if(!Rr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=Za(_,"@continue",(k)=>{let R=k.trim();if(!Rr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function zv(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,z=/@endforeach/g,F;while((F=T.exec(v))!==null)R.push({pos:F.index,delta:1});while((F=z.exec(v))!==null)R.push({pos:F.index,delta:-1});R.sort((X,G)=>X.pos-G.pos);let V=[],H=0;for(let X of R)H+=X.delta,V.push({pos:X.pos,depth:H});function K(X){let G=0,te=V.length-1,ce=0;while(G<=te){let ee=G+te>>1;if(V[ee].pos<=X)ce=V[ee].depth,G=ee+1;else te=ee-1}return ce}while((k=_.exec(v))!==null){if(K(k.index)>0)continue;let X=k.index,G=k.index+k[0].length-1,te=1,ce=G+1,ee=-1;while(ce<v.length&&te>0){if(v[ce]==="(")te++;else if(v[ce]===")"){if(te--,te===0){ee=ce;break}}ce++}if(ee===-1)continue;let le=v.substring(G+1,ee),ue=Mt(le);if(!ue)continue;let{arrayExpr:de,itemVar:pe}=ue,fe=ee+1,Pe=1,ke=fe,we=/@forelse\s*\(/g,Me=/@endforelse/g,Ne=-1;while(Pe>0&&ke<v.length){we.lastIndex=ke,Me.lastIndex=ke;let Ve=we.exec(v),Ue=Me.exec(v);if(!Ue)break;if(Ve&&Ve.index<Ue.index)Pe++,ke=Ve.index+Ve[0].length;else{if(Pe--,Pe===0){Ne=Ue.index;break}ke=Ue.index+11}}if(Ne===-1)continue;let Le=v.substring(fe,Ne),Be=Ne+11,ze=-1,je=0,Fe=0;while(Fe<Le.length){let Ve=Le.indexOf("@",Fe);if(Ve===-1)break;let Ue=Le.substring(Ve);if(/^@forelse\s*\(/.test(Ue))je++,Fe=Ve+1;else if(Ue.startsWith("@endforelse"))je--,Fe=Ve+11;else if(je===0&&Ue.startsWith("@empty")){if(Le.length<=Ve+6||!/[a-z]/i.test(Le[Ve+6])){ze=Ve;break}Fe=Ve+1}else Fe=Ve+1}if(ze===-1)continue;return{start:X,end:Be,arrayExpr:de,itemVar:pe,foreachContent:Le.substring(0,ze),emptyContent:Le.substring(ze+6)}}return null}function ym(v,_){let k=v;while(!0){let R=zv(k);if(!R)break;let{start:T,end:z,arrayExpr:F,itemVar:V,foreachContent:H,emptyContent:K}=R;try{let X;if(p(F))X=c(F,Object.keys(_))(...Object.values(_));else X=l(F,_);let G;if(!Array.isArray(X)||X.length===0)G=K;else G=`@foreach (${F} as ${V})${H}@endforeach`;k=k.substring(0,T)+G+k.substring(z)}catch(X){let G=X instanceof Error?X.message:String(X),te=i("Forelse",`Error in @forelse(${F} as ${V}): ${G}`,t.EVALUATION_ERROR);k=k.substring(0,T)+te+k.substring(z)}}return k}var bm="<!--stx:foreach-not-iterable:",Wv=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Fv(v,_){return`${bm}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function Vv(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 Ds(v){if(!v.includes(bm))return v;return v.replace(Wv,(_,k,R)=>(Vv(decodeURIComponent(k),decodeURIComponent(R)),""))}function Ni(v,_,k,R,T=!1){let z=v;z=ym(z,_);function F(K){let X=/@foreach\s*\(/g,G;while((G=X.exec(K))!==null){let te=G.index,ce=G.index+G[0].length-1,ee=1,le=ce+1,ue=-1;while(le<K.length&&ee>0){if(K[le]==="(")ee++;else if(K[le]===")"){if(ee--,ee===0){ue=le;break}}le++}if(ue===-1)continue;let de=K.substring(ce+1,ue),pe=Mt(de);if(!pe)continue;let fe=te,{arrayExpr:Pe,itemVar:ke}=pe,we=ue+1,Me=1,Ne=we,Le=/@foreach\s*\(/g,Be=/@endforeach/g;while(Me>0&&Ne<K.length){Le.lastIndex=Ne,Be.lastIndex=Ne;let ze=Le.exec(K),je=Be.exec(K);if(!je)break;if(ze&&ze.index<je.index)Me++,Ne=ze.index+ze[0].length;else{if(Me--,Me===0){let Fe=K.substring(we,je.index),Ve=je.index+11;return{start:fe,end:Ve,arrayExpr:Pe,itemVar:ke,content:Fe}}Ne=je.index+11}}}return null}function V(K,X){let G=K;while(!0){let te=F(G);if(!te)break;let{start:ce,end:ee,arrayExpr:le,itemVar:ue,content:de}=te;try{let pe=le.trim(),fe;if(p(pe))fe=c(pe,Object.keys(X))(...Object.values(X));else fe=l(pe,X);let Pe=!1;if(!Array.isArray(fe))if(fe instanceof Map)fe=Array.from(fe),Pe=!0;else if(fe instanceof Set)fe=Array.from(fe);else if(typeof fe==="string")fe=Array.from(fe);else if(fe&&typeof fe==="object"&&!(fe instanceof Date)&&!(fe instanceof RegExp))fe=Object.entries(fe),Pe=!0;else{let Fe=Fv(pe,k)+i("Foreach",`Error in @foreach: ${pe} is not iterable`,t.TYPE_ERROR);G=G.substring(0,ce)+Fe+G.substring(ee);continue}let ke=R?.loops?.useAltLoopVariable??Ov,we=ue.trim(),Me=null,Ne,Le=!1;if(we.includes("=>")){let Fe=we.split("=>").map((Ve)=>Ve.trim());if(Fe.length===2&&Fe[0]&&Fe[1])Me=Fe[0],Ne=Fe[1];else Ne=we}else if(!we.startsWith("[")&&!we.startsWith("{")&&we.includes(",")){let Fe=we.split(",").map((Ve)=>Ve.trim());if(Fe.length===2&&Fe[0]&&Fe[1])Ne=Fe[0],Me=Fe[1],Le=!0;else Ne=we}else Ne=we;let Be="",ze=fe,je=X[Tr]??new WeakMap;for(let Fe=0;Fe<ze.length;Fe++){let Ve=ze[Fe],Ue={index:Fe,iteration:Fe+1,first:Fe===0,last:Fe===ze.length-1,count:ze.length},We={...X,loop:Ue,$loop:Ue,[Tr]:je};if(Ne.startsWith("[")&&Ne.endsWith("]")){let It=Ne.slice(1,-1).split(",").map((St)=>St.trim());if(Array.isArray(Ve))It.forEach((St,mt)=>{if(St)We[St]=Ve[mt]});else We[Ne]=Ve}else if(Ne.startsWith("{")&&Ne.endsWith("}")){let It=Ne.slice(1,-1).split(",").map((St)=>St.trim()).filter(Boolean);if(Ve!==null&&typeof Ve==="object")It.forEach((St)=>{let mt=St.indexOf(":"),Ct=(mt===-1?St:St.slice(0,mt)).trim(),vt=mt===-1?Ct:St.slice(mt+1).trim();if(Ct&&vt)We[vt]=Ve[Ct]});else We[Ne]=Ve}else We[Ne]=Ve;if(Me)if(!Le&&Pe&&Array.isArray(Ve)&&Ve.length===2)We[Me]=Ve[0],We[Ne]=Ve[1];else We[Me]=Fe;let ct=Lv(de,We),$t=hm(ct);if($t.hasContinue){Be+=$t.content;continue}let wt=mm(ct);if(wt.hasBreak){Be+=wt.content;break}if(ct=ym(ct,We),ct=V(ct,We),ct=sr(ct,We,k),ct=Bv(ct),wt=mm(ct),wt.hasBreak){Be+=wt.content;break}if($t=hm(ct),$t.hasContinue){Be+=$t.content;continue}ct=Z(ct,We,k),ct=Nv(ct,We),ct=jv(ct,We),ct=Mv(ct,We),Be+=ct}G=G.substring(0,ce)+Be+G.substring(ee)}catch(pe){let fe=i("Foreach",`Error in @foreach(${le.trim()} as ${ue.trim()}): ${pe instanceof Error?pe.message:String(pe)}`,t.EVALUATION_ERROR);G=G.substring(0,ce)+fe+G.substring(ee)}}return G}z=V(z,_),z=vm(z,_,k,R);let H=R?.loops?.maxWhileIterations??Dv;return z=qv(z,_,H),T?z:Ds(z)}function Jc(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 wm(v){return Rr(v)}function vm(v,_,k,R){let T=v,z=!0;while(z){z=!1;let F=T.match(/@for\s*\(/);if(!F||F.index===void 0)break;let V=F.index,H=V+F[0].length-1,K=S(T,"(",")",H);if(K===-1)break;let X=Jc(T.slice(H+1,K)),G=K+1,te=Da(T.slice(V),"for","endfor");if(te.length===0)break;let ce=te[0].content,ee=V+te[0].end;if(!wm(X)){let le=i("For",`Unsafe expression in @for: ${X}`,t.UNSAFE_EXPRESSION);T=T.substring(0,V)+le+T.substring(ee),z=!0;continue}try{let le=Uv(X),ue=/@(?:for|foreach|if|unless)\s*\(/.test(ce);if(le.length>0&&ue){let we=Hv({forExpr:X,content:ce,iterVarNames:le,context:_,filePath:k,options:R});T=T.substring(0,V)+we+T.substring(ee),z=!0;continue}let de=Object.keys(_),pe=Object.values(_),fe=ce.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(we,Me)=>`\${${Me}}`);fe=xm(fe);let ke=Function(...de,`
2538
+ let result = '';
2539
+ for (${X}) {
2540
+ result += \`${fe}\`;
2541
+ }
2542
+ return result;
2543
+ `)(...pe);T=T.substring(0,V)+ke+T.substring(ee),z=!0}catch(le){let ue=i("For",`Error in @for(${X}): ${le instanceof Error?le.message:String(le)}`,t.EVALUATION_ERROR);T=T.substring(0,V)+ue+T.substring(ee),z=!0}}return T}function Uv(v){let _=v.trim(),k=_.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(k){let z=k[1];return z.slice(1,-1).split(",").map((V)=>{let H=V.trim();if(!H)return"";let K=H.indexOf(":");if(K>=0&&z.startsWith("{")){let te=H.slice(K+1).trim(),ce=te.indexOf("=");return(ce>=0?te.slice(0,ce):te).trim()}let X=H.indexOf("="),G=(X>=0?H.slice(0,X):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 Hv(v){let{forExpr:_,content:k,iterVarNames:R,context:T,filePath:z,options:F}=v,V=Object.keys(T),H=Object.values(T),K=Function(...V,"__pushIter",`
2544
+ for (${_}) {
2545
+ __pushIter([${R.join(", ")}])
2546
+ }
2547
+ `),X=[];K(...H,(ce)=>{X.push(ce)});let G=z??"inline.stx",te="";for(let ce of X){let ee={...T};R.forEach((ue,de)=>{ee[ue]=ce[de]});let le=vm(k,ee,z,F);le=sr(le,ee,G),le=Z(le,ee,G),te+=le}return te}function qv(v,_,k){let R=v,T=!0;while(T){T=!1;let z=R.match(/@while\s*\(/);if(!z||z.index===void 0)break;let F=z.index,V=F+z[0].length-1,H=S(R,"(",")",V);if(H===-1)break;let K=R.slice(V+1,H),X=Da(R.slice(F),"while","endwhile");if(X.length===0)break;let G=X[0].content,te=F+X[0].end;if(!wm(K)){let ce=i("While",`Unsafe expression in @while: ${K}`,t.UNSAFE_EXPRESSION);R=R.substring(0,F)+ce+R.substring(te),T=!0;continue}try{let ce=Object.keys(_),ee=Object.values(_),le=G.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(pe,fe)=>`\${${fe}}`);le=xm(le);let de=Function(...ce,`
2548
+ let result = '';
2549
+ let maxIterations = ${k}; // Configurable safety limit
2550
+ let counter = 0;
2551
+ while (${K} && counter < maxIterations) {
2552
+ counter++;
2553
+ result += \`${le}\`;
2554
+ }
2555
+ if (counter > maxIterations) {
2556
+ result += '<!-- [While Error [1104]]: Maximum iterations (${k}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2557
+ }
2558
+ return result;
2559
+ `)(...ee);R=R.substring(0,F)+de+R.substring(te),T=!0}catch(ce){let ee=i("While",`Error in @while(${K}): ${ce instanceof Error?ce.message:String(ce)}`,t.EVALUATION_ERROR);R=R.substring(0,F)+ee+R.substring(te),T=!0}}return R}function Kv(v,_="_method"){let k=v.toUpperCase();if(k==="GET"||k==="POST")return"";return`<input type="hidden" name="${_}" value="${k}">`}function Sm(v){return v.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(_,k,R,T,z)=>Kv(R,z||"_method"))}async function $m(v,_,k,R,T){if(!R.middleware||R.middleware.length===0)return v;let z=v,F=R.middleware.filter((V)=>V.timing===T);if(F.length===0)return z;for(let V of F){if(!V.name||typeof V.handler!=="function"){if(R.debug)console.warn("Invalid middleware:",V);continue}try{let H=await V.handler(z,_,k,R);if(typeof H==="string")z=H;else if(R.debug)console.warn(`Middleware ${V.name} did not return a string`)}catch(H){if(R.debug)console.error(`Error in middleware ${V.name}:`,H);if(R.debug){let K=g("Middleware",`Error in middleware '${V.name}': ${H instanceof Error?H.message:String(H)}`,k,v);z=z.replace(/<body[^>]*>/,`$&
2560
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${b(K)}</div>
2561
+ `)}}}return z}async function _m(v,_,k,R){return $m(v,_,k,R,"before")}async function km(v,_,k,R){return $m(v,_,k,R,"after")}function Em(v){return v.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(_,k,R,T,z)=>{try{let F=T?N(T,{}):{};return Un(R,F,z==="true")}catch(F){return console.error(`Error processing @route directive: ${F}`),"#route-error"}})}var Do={patterns:[],exact:{}};async function Cm(v,_){let k=v.split("/").pop()?.split(".")[0]||"";if(Do.exact[v])for(let R of Do.exact[v])await Promise.resolve(R(_,v));if(Do.exact[k])for(let R of Do.exact[k])await Promise.resolve(R(_,v));for(let{pattern:R,callback:T}of Do.patterns)if(R.test(v)||R.test(k))await Promise.resolve(T(_,v))}var Xv=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Zv=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 ns(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()&&Xv.has(R[1]),z=T?R[2].replace(/\/\s*$/,""):R[2];return{full:R[0],tag:R[1],attrs:z,selfClosing:T,start:R.index,end:R.index+R[0].length}}function Gv(v,_,k){let R=1,T=k,z=new RegExp(`<${_}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),F=new RegExp(`</${_}\\s*>`,"gi");while(R>0&&T<v.length){z.lastIndex=T,F.lastIndex=T;let V=z.exec(v),H=F.exec(v);if(!H)return-1;if(V&&V.index<H.index)R++,T=V.index+V[0].length;else{if(R--,R===0)return H.index+H[0].length;T=H.index+H[0].length}}return-1}function ts(v,_){if(_.selfClosing)return{outerStart:_.start,outerEnd:_.end,innerHTML:""};let k=Gv(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 Rm(v,_){return new RegExp(`(?:^|\\s)${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(v)||v.includes(` ${_}=`)||v.includes(` ${_} `)||v.trimEnd().endsWith(` ${_}`)}function Oo(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=v.match(new RegExp(`${k}="([^"]*)"`,"s"))||v.match(new RegExp(`${k}='([^']*)'`,"s"));return R?R[1]:null}function Vr(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 ii(v,_,k){let R=_.selfClosing?" /":"",T=`<${_.tag}${k}${R}>`;return v.slice(0,_.start)+T+v.slice(_.end)}function Jv(v){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(v)}function Yv(v){let _=v,k=0;while(k<_.length){let R=ns(_,k);if(!R)break;let T=Oo(R.attrs,"v-for");if(T===null){k=R.end;continue}let z=T.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!z){k=R.end;continue}let F=z[1].trim(),V=z[2].trim(),H;if(F.includes(",")){let ue=F.split(",").map((fe)=>fe.trim()),de=ue[0],pe=ue[1];H=`${V} as ${pe} => ${de}`}else H=`${V} as ${F}`;let K=Vr(R.attrs,"v-for"),X=Vr(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),G=ts(_,R),te=_.slice(G.outerStart,G.outerEnd),ce=ii(te,{...R,start:0,end:R.end-R.start},X),ee=`@foreach(${H})
2562
+ `,le=`${ee}${ce}
2563
+ @endforeach`;_=_.slice(0,G.outerStart)+le+_.slice(G.outerEnd),k=G.outerStart+ee.length}return _}function Qv(v){let _=v,k=0;while(k<_.length){let R=ns(_,k);if(!R)break;let T=Oo(R.attrs,"v-if");if(T===null){k=R.end;continue}let z=[],F=ts(_,R),V=Vr(R.attrs,"v-if"),H=ii(_.slice(F.outerStart,F.outerEnd),{...R,start:0,end:R.end-R.start},V);z.push({type:"if",expr:T,outerStart:F.outerStart,outerEnd:F.outerEnd,element:H,parsedTag:R});let K=F.outerEnd,X=!0;while(X){let le=_.slice(K).match(/^\s*/),ue=le?le[0].length:0,de=ns(_,K+ue);if(!de){X=!1;break}let pe=Oo(de.attrs,"v-else-if"),fe=Rm(de.attrs,"v-else");if(pe!==null){let Pe=ts(_,de),ke=Vr(de.attrs,"v-else-if"),we=ii(_.slice(Pe.outerStart,Pe.outerEnd),{...de,start:0,end:de.end-de.start},ke);z.push({type:"else-if",expr:pe,outerStart:K,outerEnd:Pe.outerEnd,element:we,parsedTag:de}),K=Pe.outerEnd}else if(fe){let Pe=ts(_,de),ke=Vr(de.attrs,"v-else"),we=ii(_.slice(Pe.outerStart,Pe.outerEnd),{...de,start:0,end:de.end-de.start},ke);z.push({type:"else",outerStart:K,outerEnd:Pe.outerEnd,element:we,parsedTag:de}),X=!1}else X=!1}let G=[];for(let le of z)if(le.type==="if")G.push(`@if(${le.expr})
2564
+ ${le.element}`);else if(le.type==="else-if")G.push(`@elseif(${le.expr})
2565
+ ${le.element}`);else G.push(`@else
2566
+ ${le.element}`);G.push("@endif");let te=G.join(`
2567
+ `),ce=z[0].outerStart,ee=z[z.length-1].outerEnd;_=_.slice(0,ce)+te+_.slice(ee),k=ce+te.length}return _}function eS(v){return v.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function tS(v){let _=v,k=0;while(k<_.length){let R=ns(_,k);if(!R)break;let T=Zv.has(R.tag),z=R.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(V,H,K)=>{let X=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(H);if(!X||!K||!/^["']/.test(K))return V;let G=X[1]||"modelValue",te=X[2];if(T&&!X[1])return`@model${te}=${K}`;let ce=K[0],ee=K.slice(1,-1),le=`:${G}=${K} @update:${G}=${ce}${ee} = $event${ce}`;if(te){let ue=X[1]?`${G}Modifiers`:"modelModifiers",de=te.slice(1).split(".").map((pe)=>`${pe}: true`).join(", ");le+=` :${ue}="{ ${de} }"`}return le});if(z===R.attrs){k=R.end;continue}let F=ii(R.full,{...R,start:0,end:R.full.length},z);_=_.slice(0,R.start)+F+_.slice(R.end),k=R.start+F.length}return _}function nS(v){return v.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function rS(v){return v.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function sS(v){let _=v,k=0;while(k<_.length){let R=ns(_,k);if(!R)break;let T=Oo(R.attrs,"v-html");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let z=ts(_,R),F=Vr(R.attrs,"v-html"),V=R.selfClosing?" /":"",H=`<${R.tag}${F}${V}>{!! ${T} !!}</${R.tag}>`;_=_.slice(0,z.outerStart)+H+_.slice(z.outerEnd),k=z.outerStart+H.length}return _}function iS(v){let _=v,k=0;while(k<_.length){let R=ns(_,k);if(!R)break;let T=Oo(R.attrs,"v-text");if(T===null){k=R.end;continue}if(R.selfClosing){k=R.end;continue}let z=ts(_,R),F=Vr(R.attrs,"v-text"),V=R.selfClosing?" /":"",H=`<${R.tag}${F}${V}>{{ ${T} }}</${R.tag}>`;_=_.slice(0,z.outerStart)+H+_.slice(z.outerEnd),k=z.outerStart+H.length}return _}function oS(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 aS(v){let _=v,k=0;while(k<_.length){let R=ns(_,k);if(!R)break;if(!Rm(R.attrs,"v-once")){k=R.end;continue}let T=Vr(R.attrs,"v-once"),z=ts(_,R),F=_.slice(z.outerStart,z.outerEnd),H=`@once
2568
+ ${ii(F,{...R,start:0,end:R.end-R.start},T)}
2569
+ @endonce`;_=_.slice(0,z.outerStart)+H+_.slice(z.outerEnd),k=z.outerStart+H.length}return _}function cS(v){return v.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function lS(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 Am(v){if(!Jv(v))return v;let _=v;return _=Yv(_),_=Qv(_),_=aS(_),_=nS(_),_=rS(_),_=tS(_),_=eS(_),_=lS(_),_=sS(_),_=iS(_),_=oS(_),_=cS(_),_}function Ya(v){return v.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Au=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"]),uS=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Tm(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 z=R.trim();return Au.has(z)?z:null}function Im(v){let _=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(v);return _?_[1]:v}function Pm(v,_,k){let R=_.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),T=R?`<${v} ${R}>`:`<${v}>`;if(uS.has(v))return R?`<${v} ${R}>`:`<${v}>`;return`${T}${k}</${v}>`}async function Dm(v,_,k,R,T){let z=v,F=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,V=[],H;while((H=F.exec(z))!==null)V.push({full:H[0],expr:H[1],attrs:H[2],slotContent:H[3],index:H.index});for(let K=V.length-1;K>=0;K--){let X=V[K];try{let G=Tm(X.expr,_);if(!G||typeof G!=="string"){let pe=`<!-- dynamic component: could not resolve "${Ya(Im(X.expr))}" -->`;z=z.slice(0,X.index)+pe+z.slice(X.index+X.full.length);continue}if(Au.has(G)){let pe=Pm(G,X.attrs,X.slotContent);z=z.slice(0,X.index)+pe+z.slice(X.index+X.full.length);continue}let te=X.attrs.trim(),ce={},ee=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,le;while((le=ee.exec(te))!==null){let pe=le[1]||le[2],fe=le[3];if(le[1])try{ce[pe]=l(fe,_)}catch{ce[pe]=fe}else ce[pe]=fe}let ue=R.componentsDir||"components",de=await ot(G,ce,X.slotContent,ue,_,k,R,new Set,T??new Set);z=z.slice(0,X.index)+de+z.slice(X.index+X.full.length)}catch(G){let te=G instanceof Error?G.message:String(G),ce=`<!-- dynamic component error: ${Ya(te)} -->`;z=z.slice(0,X.index)+ce+z.slice(X.index+X.full.length)}}return z=await dS(z,_,k,R,T),z}async function dS(v,_,k,R,T){let z=v,F=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,V=[],H;while((H=F.exec(z))!==null)V.push({full:H[0],expr:H[1],attrs:H[2],index:H.index});for(let K=V.length-1;K>=0;K--){let X=V[K];try{let G=Tm(X.expr,_);if(!G||typeof G!=="string"){let ee=`<!-- dynamic component: could not resolve "${Ya(Im(X.expr))}" -->`;z=z.slice(0,X.index)+ee+z.slice(X.index+X.full.length);continue}if(Au.has(G)){let ee=Pm(G,X.attrs,"");z=z.slice(0,X.index)+ee+z.slice(X.index+X.full.length);continue}let te=R.componentsDir||"components",ce=await ot(G,{},"",te,_,k,R,new Set,T??new Set);z=z.slice(0,X.index)+ce+z.slice(X.index+X.full.length)}catch(G){let te=G instanceof Error?G.message:String(G),ce=`<!-- dynamic component error: ${Ya(te)} -->`;z=z.slice(0,X.index)+ce+z.slice(X.index+X.full.length)}}return z}var Mi="X-STX-Build",Tu=Symbol.for("stx.buildId");function Bs(){let v=globalThis;if(!v[Tu])v[Tu]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v[Tu]}function Om(v,_=Bs()){if(v.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(v))return null;return`
2570
+ <meta name="stx-build" content="${_}">`}function pS(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,z=[],F={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>R,onUpdateReady(X){if(F.updateReady)try{X()}catch{}else z.push(X);return()=>{let G=z.indexOf(X);if(G!==-1)z.splice(G,1)}},applyUpdate(){let X=R&&R.waiting;if(!X)return!1;return T=!0,X.postMessage({type:"stx:activate-update",force:!0}),!0}};k.stxOffline=F;let V=(X)=>{if(!X.waiting||!_.controller||F.updateReady)return;F.updateReady=!0;let G=z.splice(0);for(let te of G)try{te()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};_.addEventListener("message",(X)=>{let G=X.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((X)=>{R=X;try{_.controller?.postMessage({type:"stx:reachability?"})}catch{}if(X.waiting)V(X),X.waiting.postMessage({type:"stx:activate-update",reason:"load"});X.addEventListener("updatefound",()=>{let G=X.installing;if(!G)return;G.addEventListener("statechange",()=>{if(G.state==="installed")V(X)})})}).catch(()=>{})},K=()=>{let X=(G)=>{setTimeout(G,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>X(H));else X(H)};if(!_.controller)if(document.readyState==="complete")K();else addEventListener("load",K);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",K);else K()}function fS(){let v=`(${pS.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(v).trim().replace(/;$/,"")}catch{return v}}var Mm=`<script data-stx-offline>${fS()}</script>`;import{AsyncLocalStorage as gS}from"async_hooks";var jm=new gS;function Tn(v){return v.__stx_server_data??={pending:new Map,values:new Map}}function Nm(v,_){return jm.run(Tn(v),_)}async function Lm(v,_){let k=jm.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((z)=>{let F=JSON.stringify(z,(H,K)=>{if(K===void 0||typeof K==="function"||typeof K==="symbol"||typeof K==="bigint"||typeof K==="number"&&!Number.isFinite(K))throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);if(K&&typeof K==="object"&&!Array.isArray(K)&&Object.getPrototypeOf(K)!==Object.prototype&&Object.getPrototypeOf(K)!==null)throw TypeError(`useServerData(${JSON.stringify(v)}) requires JSON-serializable data`);return K}),V=JSON.parse(F);return k.values.set(v,V),V}).catch((z)=>{throw k.pending.delete(v),z});return k.pending.set(v,T),T}function gr(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 mS=/<\/(script)/gi;function oi(v){if(!v||v.indexOf("</")===-1)return v;return v.replace(mS,"<\\/$1")}import Bm from"path";function j(v,_={}){return new Vn(v,_).routes}var zm=new Map;async function Wm(v,_){let k=v,R=_;if(!k||!R)try{let V=await o();k||=V?.pagesDir||"pages",R||=V?.root||"."}catch{k||="pages",R||="."}let T=Bm.isAbsolute(k)?k:Bm.join(R,k),z=zm.get(T);if(z)return z;let F=[];try{F=j(".",{pagesDir:T,emit:!1}).map((V)=>V.regex.source).filter(Boolean)}catch{F=[]}return zm.set(T,F),F}function yS(v){return v.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Fm(v){return yS(JSON.stringify(v))}function ye(v){return v.includes("data-stx-runtime")}function Vm(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 Iu(v,_){let k=fo(v),R=v.search(/<!doctype\b/i);if(k!==-1&&(R===-1||k>R))return v.slice(0,k)+_+`
2571
+ `+v.slice(k);let T=Pn(v);if(T!==null)return`${v.slice(0,T)}
2572
+ ${_}${v.slice(T)}`;if(v.includes("</head>")){let F=v.indexOf("</head>");return v.slice(0,F)+_+`
2573
+ `+v.slice(F)}if(Gn(v))return ms(v,(F)=>`${F}
2574
+ ${_}`);return`${_}
2575
+ ${v}`}async function Qa(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-q4hmgj72.js"),{url:z}=await T("runtime",_.debug===!0);return Iu(v,`<script data-stx-runtime src="${z}"></script>`)}if(_.buildMode==="compile")return Iu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-q4hmgj72.js"),R=await k(_.debug);return Iu(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function xS(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function Um(v){if(v.includes("data-stx-tooltip-runtime")||!xS(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${pu()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2576
+ ${_}`;return`${v.slice(0,k)}${_}
2577
+ ${v.slice(k)}`}var bS=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function wS(v){return bS.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function Q(v,_){if(!v.includes("</body>"))return v;if(wS(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 K=await Wm(_?.pagesDir,_?.root);if(K.length>0)H.ownedRoutes=K}catch{}if(Object.keys(H).length>0)R=`<script>window.__stxRouterConfig=${Fm(H)};</script>
2578
+ `}let{getCachedRouterScript:T,getServeClientAsset:z}=await import("./chunk-q4hmgj72.js"),F=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await z("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,V=v.lastIndexOf("</body>");return v.slice(0,V)+R+F+`
2579
+ </body>`+v.slice(V+7)}var ge="0.2.635";var Hm=Symbol.for(`stx.lazy-module-promises.${ge}`);function SS(){let v=globalThis;return v[Hm]??=new Map,v[Hm]}function Et(v,_){let k=SS(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let z=_();return k.set(R,z),z.catch(()=>{if(k.get(R)===z)k.delete(R)}),z}var Pu=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Ym=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,$S=65536,_S=4,tc=new Map;function vd(){tc.clear()}function kS(v){let _=[];for(let k of ne(v,U)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let z=R[0].length,F=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(z,F),start:k.start,end:k.end}))}return _}function zc(v,_={}){let k=v.length>=$S,R=k?tc.get(v):void 0;if(R===void 0){if(R=kS(v),k)Zd(tc,_S),tc.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let z=[];for(let F of R)if(T.lastIndex=0,!T.test(F.attrs))z.push(F);return z}function As(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),z=k[2].trim(),{itemVar:F,indexVar:V}=qm(z);if(F)return{style:"as",iterable:T,itemVar:F,indexVar:V}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),z=R[2].trim(),{itemVar:F,indexVar:V}=qm(T);if(F)return{style:"in",iterable:z,itemVar:F,indexVar:V}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function qm(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 z=_.match(/^(\w+)$/);if(z)return{itemVar:z[1],indexVar:null};return{itemVar:null,indexVar:null}}function Ps(v,_){return sa(v,_)}function ES(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 Qm(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 z=T[1],F;while((F=R.exec(z))!==null)_.add(F[1])}return _}function CS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${Pu})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=ne(v,(z,F)=>{_.lastIndex=F;let V=_.exec(z);if(!V||V.index!==F||!k.test(V[2]))return-1;return _.lastIndex}),T=[];for(let z of R){_.lastIndex=0;let F=_.exec(z.token);if(!F)continue;let V=F[2].match(k),H=As(V?.[1]??V?.[2]??""),K=[H.itemVar,H.indexVar].filter(Boolean);if(K.length===0)continue;let X=F[1],te=/\/\s*>$/.test(z.token)||nc.has(X.toLowerCase())?z.end:Ou(v,z.start,X,z.end);if(te!==-1)T.push({start:z.start,end:te,vars:new Set(K)})}return T}var Km=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 RS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function Xm(v,_,k,R){if(!v)return!1;let T=RS(v),z=!1,F=!1,V=!1,H=/([a-zA-Z_$][\w$]*)/g,K;while((K=H.exec(T))!==null){let ce=K[1];if(T.slice(0,K.index).trimEnd().endsWith("."))continue;if(Km.has(ce))continue;if(_.has(ce)||R?.has(ce))z=!0;else if(k&&ce in k)F=!0}let X=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,G;while((G=X.exec(T))!==null){let ce=G[1];if(T.slice(0,G.index).trimEnd().endsWith("."))continue;if(Km.has(ce)||k&&ce in k)continue;V=!0}return(z||V)&&!F}function ec(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),z=T.match(Ym);if(z&&AS(z[3],z[1])){let[,F,V,H]=z;return`<${F}${V}${R}>${H}</${F}>`}return`<template${R}>${T}</template>`}function AS(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 $i(v,_){let k=Qm(v);function R(T){let z=T,F=CS(T),V=(G)=>{let te=new Set;for(let ce of F)if(G>ce.start&&G<ce.end)for(let ee of ce.vars)te.add(ee);return te},H=/@if\s*\(/g,K,X=[];while((K=H.exec(z))!==null){let G=K.index,te=G+K[0].length,ce=1,ee=te;while(ee<z.length&&ce>0){if(z[ee]==="(")ce++;else if(z[ee]===")")ce--;ee++}if(ce!==0)continue;let le=z.substring(te,ee-1).trim(),ue=ee,de=1,pe=ue,fe=/@(if\s*\(|endif)/g;fe.lastIndex=ue;let Pe;while((Pe=fe.exec(z))!==null)if(Pe[1].startsWith("if"))de++;else if(Pe[1]==="endif"){if(de--,de===0){pe=Pe.index+Pe[0].length;break}}if(de!==0)continue;let ke=z.substring(ue,pe-6).trim(),we;if(ES(ke)){let Me=xo(z.substring(G,pe));if(Me.length===0)continue;let Ne=Me[0].branches.filter((je)=>je.type!=="else"),Le=V(G);if(!(Ne.length>0&&Ne.every((je)=>Xm(je.condition,k,_,Le))))continue;we=Me[0].branches.map((je)=>{let Fe=R(je.content);if(je.type==="elseif")return ec(Fe,"@else-if",je.condition??"");if(je.type==="else")return ec(Fe,"@else");return ec(Fe,"@if",je.condition??"")}).join(`
2580
+ `)}else{if(!Xm(le,k,_,V(G)))continue;we=ec(R(ke),"@if",le)}X.push({start:G,end:pe,replacement:we}),H.lastIndex=pe}for(let G=X.length-1;G>=0;G--){let{start:te,end:ce,replacement:ee}=X[G];z=z.substring(0,te)+ee+z.substring(ce)}return z}return R(v)}function TS(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 nc=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Zm=/<(script|style)\b/iy,IS=/<\/script/gi,PS=/<\/style/gi;function Ou(v,_,k,R){if(nc.has(k.toLowerCase()))return R;let T=k.toLowerCase(),z=v.length,F=1,V=R;while(V<z){let H=v.indexOf("<",V);if(H===-1)return-1;if(V=H,v.startsWith("<!--",V)){let te=v.indexOf("-->",V+4);if(te===-1)return-1;V=te+3;continue}Zm.lastIndex=V;let K=Zm.exec(v);if(K){let te=v.indexOf(">",V);if(te===-1)return-1;if(v[te-1]==="/"){V=te+1;continue}let ce=K[1].toLowerCase()==="script"?IS:PS;ce.lastIndex=V;let ee=ce.exec(v);if(ee===null)return-1;let le=v.indexOf(">",ee.index);if(le===-1)return-1;V=le+1;continue}if(v[V+1]==="/"){let te=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(V,V+64));if(!te){V++;continue}if(te[1].toLowerCase()===T){if(F--,V+=te[0].length,F===0)return V;continue}V+=te[0].length;continue}let X=/^<([a-z][\w-]*)\b/i.exec(v.slice(V,V+64));if(!X){V++;continue}let G=v.indexOf(">",V);if(G===-1)return-1;if(X[1].toLowerCase()===T){let te=v.slice(V,G+1);if(!(/\/\s*>$/.test(te)||nc.has(T)))F++}V=G+1}return-1}var DS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function OS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let F=v.indexOf("-->",k+4);if(F===-1)return!1;k=F+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let z=v.slice(k,T+1);return DS.test(z)}function Ri(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(([te,ce])=>G>=te&&G<ce),z=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,F=[],V;while((V=z.exec(v))!==null){if(T(V.index))continue;let[G,te,ce,ee,le,ue,de]=V,pe=TS(le);if(pe===void 0)continue;let fe=V.index,Pe=fe+G.length,Me=!!de||/\/\s*>$/.test(G)||nc.has(te.toLowerCase())?Pe:Ou(v,fe,te,Pe);if(Me===-1)continue;if((ee===":if"||ee==="x-if"||ee==="@if")&&OS(v,Me)){z.lastIndex=Pe;continue}if(pe===!0){let Le=`<${te}${ce}${ue}${de}>`;F.push({start:fe,end:Pe,replacement:Le});continue}F.push({start:fe,end:Me,replacement:""}),z.lastIndex=Me}if(F.length===0)return v;F.sort((G,te)=>G.start-te.start);let H=[],K=-1;for(let G of F){if(G.start<K)continue;H.push(G),K=G.end}let X=v;for(let G=H.length-1;G>=0;G--){let{start:te,end:ce,replacement:ee}=H[G];X=X.substring(0,te)+ee+X.substring(ce)}return X}var Gm=[":for","@for","x-for"];function Is(v,_){if(!_||Object.keys(_).length===0)return v;if(!Gm.some((V)=>v.includes(`${V}=`)))return v;let k=Qm(v);if(Array.isArray(_.__stx_client_signal_names)){for(let V of _.__stx_client_signal_names)if(typeof V==="string")k.add(V)}let R=v,T=[],z=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,F;while((F=z.exec(R))!==null){let[V,H,K]=F,X=F.index,G=X+V.length,te=Gm.map((we)=>({attr:we,m:new RegExp(`\\s${we}="([^"]*)"`).exec(K)})).find((we)=>we.m!==null);if(!te||!te.m)continue;let ce=As(te.m[1]);if(!ce.iterable||!ce.itemVar)continue;let ee=ce.iterable.trim().split(/[.[(]/)[0].trim();if(!ee||k.has(ee)||!(ee in _))continue;let le=Ou(R,X,H,G);if(le===-1)continue;let ue=K.replace(new RegExp(`\\s${te.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),de=R.slice(G,le-`</${H}>`.length),pe={..._,[ce.itemVar]:void 0};if(ce.indexVar)pe[ce.indexVar]=void 0;let fe=Is(de,pe),Pe=ce.indexVar?`${ce.iterable} as ${ce.indexVar} => ${ce.itemVar}`:`${ce.iterable} as ${ce.itemVar}`,ke=H.toLowerCase()==="template"?fe:`<${H}${ue}>${fe}</${H}>`;T.push({start:X,end:le,replacement:`@foreach(${Pe})${ke}@endforeach`}),z.lastIndex=le}for(let V=T.length-1;V>=0;V--){let{start:H,end:K,replacement:X}=T[V];R=R.slice(0,H)+X+R.slice(K)}return R}function Os(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,z=[],F=[];while((T=R.exec(k))!==null){let V=T[1],H=T.index,K=H+T[0].length,X=1,G=K;while(G<k.length&&X>0){if(k[G]==="(")X++;else if(k[G]===")")X--;G++}if(X!==0)continue;let te=k.substring(K,G-1).trim(),ce=G,ee=As(te),le=V==="for"?"@endfor":"@endforeach",ue=1,de=ce,pe=V==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${V}\\s*\\(|end${V})`,"g");pe.lastIndex=ce;let fe;while((fe=pe.exec(k))!==null)if(fe[1].startsWith(V))ue++;else if(ue--,ue===0){de=fe.index+fe[0].length;break}if(ue!==0)continue;let Pe=()=>{let Be=[ee.itemVar,ee.indexVar].filter(Boolean);if(Be.length)F.push({start:H,end:de,vars:Be})};if(ee.iterable){let Be=ee.iterable.trim();if(Be.startsWith("[")||Be.startsWith("{")||Be.startsWith("'")||Be.startsWith('"')||Be.startsWith("`")||/^-?\d/.test(Be)){Pe();continue}let ze=Be.split(/[.[(]/)[0].trim(),je=_?ze in _:!1,Fe=F.some((Ve)=>H>Ve.start&&H<Ve.end&&Ve.vars.includes(ze));if(ze&&(je||Fe)){Pe();continue}}if(ee.style==="as")te=ee.indexVar?`(${ee.itemVar}, ${ee.indexVar}) in ${ee.iterable}`:`${ee.itemVar} in ${ee.iterable}`;let ke=k.substring(ce,de-le.length).trim(),we=_?{..._}:{};if(ee.itemVar)delete we[ee.itemVar];if(ee.indexVar)delete we[ee.indexVar];let Me=Os(ke,we),Ne=Me.match(Ym),Le;if(Ne){let[,Be,ze,je]=Ne;Le=`<${Be}${ze} @for="${te}">${je}</${Be}>`}else Le=`<template @for="${te}">${Me}</template>`;z.push({start:H,end:de,replacement:Le}),R.lastIndex=de}for(let V=z.length-1;V>=0;V--){let{start:H,end:K,replacement:X}=z[V];k=k.substring(0,H)+X+k.substring(K)}return k}function MS(v){let _=new Set,k=[],R=0,T=0,z=v.length,F=(X)=>{let G=R+1;while(G<z){let te=v[G];if(te==="\\"){G+=2;continue}if(te===X)return G+1;G++}return z},V=()=>{let X=R+2;while(X<z&&v[X]!==`
2581
+ `)X++;return X},H=()=>{let X=R+2;while(X<z-1){if(v[X]==="*"&&v[X+1]==="/")return X+2;X++}return z},K=(X)=>{let G=X,te=0;while(G<z){let ce=v[G];if(ce==="/"&&v[G+1]==="/"){let ee=G+2;while(ee<z&&v[ee]!==`
2582
+ `)ee++;G=ee;continue}if(ce==="/"&&v[G+1]==="*"){let ee=G+2;while(ee<z-1&&!(v[ee]==="*"&&v[ee+1]==="/"))ee++;G=ee+2;continue}if(ce==='"'||ce==="'"||ce==="`"){let ee=G+1;while(ee<z){if(v[ee]==="\\"){ee+=2;continue}if(v[ee]===ce){ee++;break}ee++}G=ee;continue}if(ce==="("||ce==="["||ce==="{"){te++,G++;continue}if(ce===")"||ce==="]"||ce==="}"){te--,G++;continue}if(ce===";"&&te===0)return G+1;G++}return z};while(R<z){let X=v[R];if(X==="/"&&v[R+1]==="/"){let G=V();k.push(v.slice(R,G)),R=G;continue}if(X==="/"&&v[R+1]==="*"){let G=H();k.push(v.slice(R,G)),R=G;continue}if(X==='"'||X==="'"||X==="`"){let G=F(X);k.push(v.slice(R,G)),R=G;continue}if(X==="{"){T++,k.push(X),R++;continue}if(X==="}"){T--,k.push(X),R++;continue}if(T===0){let G=R>0?v[R-1]:"";if(G===""||/\s/.test(G)||G===";"||G==="}"||G==="{"){let ce=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(ce){let ee=ce[2],le=K(R+ce[0].length);if(_.has(ee)){k.push(`/* stx: deduped const ${ee} */`),R=le;continue}_.add(ee),k.push(v.slice(R,le)),R=le;continue}}}k.push(X),R++}return k.join("")}var jS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function Du(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function NS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!Du(T,T+_.length,k))return!0;R=T+_.length}return!1}function LS(v,_){if(NS(v,"<body",_)){let T=new RegExp(`<body(${Pu})>`,"g"),z;while((z=T.exec(v))!==null)if(!Du(z.index,z.index+z[0].length,_))return z.index+z[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Pu})>`,"gi"),R;while((R=k.exec(v))!==null){if(Du(R.index,R.index+R[0].length,_))continue;if(jS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function BS(v,_,k,R){let T=[],z=` data-stx="${R}"`,F=0,V=!1,H=(K)=>{if(k!==null&&!V&&k>=F&&k<=K)T.push(v.slice(F,k),z,v.slice(k,K)),V=!0;else T.push(v.slice(F,K))};for(let K of _){if(K.start<F)continue;H(K.start),F=K.end}return H(v.length),T.join("")}async function fr(v,_,k,R={}){let T=zc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),z=/\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*\(/,F=[],{hasUserImports:V,bundleClientScript:H}=await Et("stx/client-script-bundler",()=>import("./chunk-sfj84n72.js"));for(let fe of T){let Pe=fe.body;if(rt(fe.attrs))Pe=st(Pe);if(R.forceClientSetup||z.test(Pe)){F.push({content:Pe,start:fe.start,end:fe.end});continue}if(!V(Pe))continue;try{let ke=await H(Dt(Pe).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(z.test(ke))F.push({content:Pe,start:fe.start,end:fe.end})}catch{}}if(F.length===0)return{output:v,setupCode:null};let K=`${_??""}\x00${F.map((fe)=>fe.content).join("\x00")}`,X=`__stx_setup_${Bun.hash(K).toString(36).slice(0,10)}`,G=[];for(let fe=0;fe<F.length;fe++){let Pe=F[fe].bundled??Dt(F[fe].content).code;if(!F[fe].bundled&&V(Pe))Pe=await H(Pe,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});Pe=nt(Pe);let ke=I(Pe);G.push(`// \u2500\u2500 merged signal script #${fe+1} \u2500\u2500
2583
+ ${ke}`)}let te=G.join(`
2584
+
2585
+ `);te=MS(te);let ee=M(te).split(",").map((fe)=>fe.trim()).filter(Boolean),le=wn(te,k),ue=`
2586
+ <script data-stx-scoped>
2587
+ function ${X}() {
2588
+ ${Gt("const",ee)}
2589
+ ${oi(`${le}${te}`)}
2590
+ return ${Xo(te,ee)};
2591
+ }
2592
+ window.__stx_latestSetup=${X};
2593
+ if(window.stx)window.stx._latestSetup=${X};
2594
+ </script>`,de=LS(v,F);return{output:BS(v,F,de,X),setupCode:ue}}async function Ai(v,_,k,R){if(!Ps(v,k))return v;let T=v;if(_.skipSignalsRuntime)return T;let{output:z,setupCode:F}=await fr(T,k,R);if(T=z,!F){let V=Gn(T);if(V&&!/data-stx/.test(V.attrs)&&!/data-stx-auto/.test(V.attrs)){let H=V.tag.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>");T=T.slice(0,V.index)+H+T.slice(V.index+V.tag.length)}}if(T=await Qa(T,_),F){let V=Pi(T,/<\/head>/i),H=V===-1?Pi(T,/<body[^>]*>/i):-1;if(V!==-1)T=`${T.slice(0,V)}${F}
2595
+ ${T.slice(V)}`;else if(H!==-1){let K=/<body[^>]*>/i.exec(T.slice(H))[0],X=H+K.length;T=`${T.slice(0,X)}
2596
+ ${F}${T.slice(X)}`}else T=`${T}
2597
+ ${F}`}return T}function Pi(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 z=new RegExp(_.source,_.flags.replace(/[gy]/g,"")),F=0;while(F<v.length){let V=z.exec(v.slice(F));if(!V)return-1;let H=F+V.index;if(!R.some(([X,G])=>H>=X&&H<G))return H;F=H+Math.max(V[0].length,1)}return-1}var Jm="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function Hc(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 Jm;return`var ${_.join(", ")}; ${Jm}`}var zS=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function nt(v){return v.replace(zS,(_,k)=>Hc(k))}import ai from"path";import WS from"process";function w(v="STX_PUBLIC_"){let _={},k={};for(let[R,T]of Object.entries(WS.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 eh(v){return v.startsWith("http://")||v.startsWith("https://")||v.startsWith("//")}async function th(v,_,k){try{let R;if(v.startsWith("/")){let T=_;for(let z=0;z<5;z++){let F=ai.join(T,v);if(await Bun.file(F).exists())return F;T=ai.dirname(T)}R=ai.join(_,v)}else if(v.startsWith("./")||v.startsWith("../"))R=ai.resolve(_,v);else R=ai.resolve(_,v);if(await Bun.file(R).exists())return R;return null}catch{return null}}var nh=Symbol.for("stx.inline-assets.import-meta");function FS(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.
2598
+ `+" `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[nh]=!0,k}async function rh(v,_,k){let R=v,T=ai.dirname(_),z=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,F;while((F=z.exec(R))!==null){let[K,X,G,te]=F;if(eh(G))continue;let ce=await th(G,T,_);if(ce)try{let ee=await Bun.file(ce).text();if(k.add(ce),G.endsWith(".ts")||G.endsWith(".tsx")){let ue=await Bun.build({entrypoints:[ce],target:"browser",minify:!0,define:w()});if(ue.outputs.length>0)ee=await ue.outputs[0].text(),FS(ee,G)}let le=`<script>
2599
+ // Source: ${G}
2600
+ ${ee}
2601
+ </script>`;R=R.replace(K,le),z.lastIndex=0}catch(ee){if(ee?.[nh])throw ee}}let V=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,H;while((H=V.exec(R))!==null){let[K,X,G,te]=H,ce=X+te;if(eh(G))continue;if(/rel=["']stylesheet["']/.test(ce)||G.endsWith(".css")){let le=await th(G,T,_);if(le)try{let ue=await Bun.file(le).text();k.add(le);let de=`<style>
2602
+ /* Source: ${G} */
2603
+ ${ue}
2604
+ </style>`;R=R.replace(K,de),V.lastIndex=0}catch(ue){}}}return R}function Fs(v,_){let k=v,R=/@json\s*\(/g,T;while((T=R.exec(k))!==null){let z=T.index,F=z+T[0].length-1,V=1,H=F+1,K=null,X=!1;while(H<k.length&&V>0){let fe=k[H];if(X){X=!1,H++;continue}if(fe==="\\"&&K){X=!0,H++;continue}if(K){if(fe===K)K=null;H++;continue}if(fe==='"'||fe==="'"||fe==="`"){K=fe,H++;continue}if(fe==="(")V++;else if(fe===")"){if(V--,V===0)break}H++}if(V!==0)break;let G=k.substring(F+1,H).trim(),te=k.substring(z,H+1),ce=-1,ee=0,le=null,ue=!1;for(let fe=0;fe<G.length;fe++){let Pe=G[fe];if(ue){ue=!1;continue}if(Pe==="\\"&&le){ue=!0;continue}if(le){if(Pe===le)le=null;continue}if(Pe==='"'||Pe==="'"||Pe==="`"){le=Pe;continue}if(Pe==="("||Pe==="["||Pe==="{")ee++;else if(Pe===")"||Pe==="]"||Pe==="}")ee--;if(Pe===","&&ee===0){ce=fe;break}}let de=ce>=0?G.substring(0,ce).trim():G,pe=ce>=0?G.substring(ce+1).trim():void 0;try{let fe=de.trim(),Pe;if(p(fe))Pe=c(fe,Object.keys(_))(...Object.values(_));else Pe=void 0;let ke;if(pe==="true")ke=JSON.stringify(Pe,null,2);else ke=JSON.stringify(Pe);let we=ke.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");k=k.substring(0,z)+we+k.substring(H+1),R.lastIndex=z+we.length}catch(fe){O.log(fe instanceof Error?fe:Error(String(fe)),{directive:"@json"},"error"),R.lastIndex=z+te.length}}return k}function zs(v){return v.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ah(v){let _=v,k=/@memo\s*\(/g,R,T=[];while((R=k.exec(_))!==null){let z=R.index,F=z+R[0].length,V=1,H=F;while(H<_.length&&V>0){if(_[H]==="(")V++;else if(_[H]===")")V--;H++}if(V!==0)continue;let K=_.slice(F,H-1).trim(),X=H,G=_.slice(X),te=G.indexOf("@endmemo");if(te===-1)continue;let ce=G.slice(0,te),ee=X+te+8,le=ce.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),ue=le?le[0].length:0,de=ce.slice(ue),pe=ce.match(/(\s*)$/),fe=pe?pe[0].length:0,Pe=de.slice(0,de.length-fe),ke=Pe.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),we;if(ke){let[Me,Ne,Le="",Be]=ke,ze=`<${Ne}${Le} data-stx-memo="${K}"${Be}>`;we=ce.slice(0,ue)+ze+Pe.slice(Me.length)+ce.slice(ue+Pe.length)}else we=`${ce.slice(0,ue)}<div data-stx-memo="${K}">${Pe}</div>${ce.slice(ue+Pe.length)}`;T.push({start:z,end:ee,replacement:we}),k.lastIndex=ee}for(let z=T.length-1;z>=0;z--){let F=T[z];_=_.slice(0,F.start)+F.replacement+_.slice(F.end)}return _.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Mu(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 ch(v,_){if(!/\bref\s*=/.test(v))return v;let k=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,R=ne(v,(H,K)=>{k.lastIndex=K;let X=k.exec(H);if(!X||/^(?:script|style)$/i.test(X[1]))return-1;return k.lastIndex}),T=[],z=0,F=0,V=[];for(let{start:H,end:K,token:X}of R){let G=/^<\/?([\w-]+)/.exec(X)[1].toLowerCase();if(X.startsWith("</")){let ce;while(ce=T.pop()){if(ce.scoped)z--;if(ce.name===G)break}continue}let te=/\sdata-stx-scope\s*=/.test(X);if(!z&&!te&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(X)&&!/\sdata-stx-ref-caller\s*=/.test(X))V.push(v.slice(F,H),X.replace(/\s*\/?>$/,(ce)=>` data-stx-ref-caller="${_}"${ce}`)),F=K;if(!lh.has(G)&&!/\/>$/.test(X)){if(T.push({name:G,scoped:te}),te)z++}}return V.push(v.slice(F)),V.join("")}var lh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),uh=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,sh=/<\/?\s*([a-z][\w-]*)/iy,VS=/\s/;function US(v,_){let k=_-1;while(k>=0&&VS.test(v[k]))k--;return k>=0&&v[k]==="/"}function HS(v,_){let k=!1,R=!1;for(let T=_;T<v.length;T++){let z=v[T];if(k){if(z==="'")k=!1}else if(R){if(z==='"')R=!1}else if(z==="'")k=!0;else if(z==='"')R=!0;else if(z===">")return T}return-1}function qS(v,_){if(v.indexOf("{",_)===-1||v.indexOf("}",_)===-1)return!1;let k=0,R=_,T=!1,z=!1,F=!1;while(R<v.length){let V=v.indexOf("<",R),H=V===-1?v.length:V;if(H>R){if(k===0)while(R<H){let G=v.indexOf(z?"}":"{",R);if(G===-1||G>=H){if(z)F=!1;else T=!1;break}if(G>R)if(z)F=!1;else T=!1;if(z){if(F)return!0;F=!0}else if(T)z=!0,F=!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 K=HS(v,R);if(K===-1)break;sh.lastIndex=R;let X=sh.exec(v)?.[1]?.toLowerCase()??"";if(v[R+1]==="/"){if(k===0)break;k--}else if(!US(v,K)&&!lh.has(X))k++;R=K+1}return!1}var ih=m(256);function dh(v){if(v.length<1024)return oh(v);let _=h(v),k=ih.get(_);if(k!==void 0)return k;let R=oh(v);return ih.set(_,R),R}function oh(v){if(v.length>=32768&&!Xd(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,z;while((z=k.exec(v))!==null){let F=z.index,V=F+z[0].length,H=!1,K=!1,X=-1;while(V<v.length){let te=v[V];if(H){if(te==="'")H=!1}else if(K){if(te==='"')K=!1}else if(te==="'")H=!0;else if(te==='"')K=!0;else if(te===">"){X=V;break}V++}if(X===-1)continue;let G=v.slice(F,X+1);if(uh.test(G))continue;if(G.includes("x-cloak"))continue;if(qS(v,X+1))R+=v.slice(T,X)+" x-cloak>",T=X+1}return R+=v.slice(T),R}var KS=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,XS=/<\/script>/gi,ZS=/<\/style>/gi;function ph(v){let _=/<[a-z][\w-]*/gi,k="",R=0,T;while((T=_.exec(v))!==null){let z=T.index,F=T[0].slice(1).toLowerCase();if(F==="script"||F==="style"){let ee=F==="script"?XS:ZS;ee.lastIndex=z;let le=ee.exec(v);if(le!==null)_.lastIndex=le.index+le[0].length;continue}let V=z+T[0].length,H=!1,K=!1,X=-1;while(V<v.length){let ee=v[V];if(H){if(ee==="'")H=!1}else if(K){if(ee==='"')K=!1}else if(ee==="'")H=!0;else if(ee==='"')K=!0;else if(ee===">"){X=V;break}V++}if(X===-1)continue;let G=v.slice(z+T[0].length,X);if(uh.test(G))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(G))continue;if(!KS.test(G))continue;let te=v[X-1]==="/",ce=te?X-1:X;k+=`${v.slice(R,ce)} x-cloak${te?" ":""}`,R=ce}return k+=v.slice(R),k}import ju from"path";var GS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,JS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function YS(v,_){if(!_||!v.includes("/"))return v;let k=ju.dirname(_);return v.replace(GS,(R,T,z,F)=>{let V=ju.resolve(k,F);return`${T}${z}${V.split(ju.sep).join("/")}${z}`})}function fh(v,_){if(!_||!v.includes("<script"))return v;return v.replace(JS,(k,R,T,z)=>`${R}${YS(T,_)}${z}`)}var rs="<!--PARENT_CONTENT_PLACEHOLDER-->";function gh(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vh(v,_){let k=v.length,R=_,T=!0,z=[],F=(V)=>V+9<=k&&v[V]==="<"&&v[V+1]==="/"&&(v[V+2]==="s"||v[V+2]==="S")&&(v[V+3]==="c"||v[V+3]==="C")&&(v[V+4]==="r"||v[V+4]==="R")&&(v[V+5]==="i"||v[V+5]==="I")&&(v[V+6]==="p"||v[V+6]==="P")&&(v[V+7]==="t"||v[V+7]==="T")&&(v[V+8]===">"||/\s/.test(v[V+8]));while(R<k){let V=v[R];if(F(R))return R;if(V==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
2605
+ `,R+2),R===-1)return-1;R+=1,T=!0;continue}if(V==="/"&&v[R+1]==="*"){let H=v.indexOf("*/",R+2);if(H===-1)return-1;R=H+2,T=!0;continue}if(V==="/"&&T){let H=R+1,K=!1;while(H<k){let X=v[H];if(X==="\\"){H+=2;continue}if(X==="[")K=!0;else if(X==="]")K=!1;else if(X==="/"&&!K){H++;break}else if(X===`
2606
+ `){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(V==="'"||V==='"'){let H=V;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===H){R++;break}if(v[R]===`
2607
+ `)break;R++}T=!1;continue}if(V==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){z.push(!0),R+=2,T=!0;break}R++}if(z.length===0)T=!1;continue}if(V==="}"&&z.length>0){z.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){z.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(V));else if(/[)\].\w$]/.test(V))T=!1;else T=!0;R++}return-1}function Sh(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,z=v.indexOf("</script>",T);if(z===-1)return null;let F=v.indexOf(">",z);if(F===-1)return null;return{start:R.index,end:F+1}}var e0=4096;async function mh(v,_,k){if(k.buildMode!=="serve"||_.length<e0)return null;let{registerServeModuleBundle:R}=await import("./chunk-q4hmgj72.js");return`<script ${v} src="${R(_)}"></script>`}async function hh(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await Et("stx/client-module-registry",()=>import("./chunk-x7g0946r.js")),z=[],F=await T(R(...v),{minify:oo(_.buildMode),collectInputs:z});for(let V of z)k?.add(V);if(!F)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:V}=await import("./chunk-q4hmgj72.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${V(F)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${F.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function t0(v,_=""){let k=Sh(v,"data-stx-runtime");if(!k)return v;let R=fo(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)+_+`
2608
+ `+v.slice(R,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),z=v.slice(0,k.start)+v.slice(k.end),F=fo(z);if(F===-1)return T+_+`
2609
+ `+z;return z.slice(0,F)+T+_+`
2610
+ `+z.slice(F)}function n0(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let z=v.slice(0,T);return z.lastIndexOf("<")>z.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=Ee(v,k);let z=!_.__stxProcessingDepth;Tn(_);for(let F of R._layerGraph?.configDependencies??[])T.add(F);if(z&&R.runtimeConfig)await An(_,k,R.runtimeConfig);if(z)Md(_),_.__stx_scope_seq??={n:0,key:Hs(String(_.__filename??k))},_.__stx_head_injections=eo(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Bn())&&k&&k.endsWith(".stx"))po(v,k);try{return await J.timeAsync("template-processing",async()=>{let F=await r0(v,_,k,R,T);if(z)F=Mu(F);if(z&&R.autoShell&&R.buildMode!=="compile"){let V=xe(R.app?.head,{known:Mn,source:"app.head"}),K=(_.__stx_runtime_head||null)??no(),X=(_.__stx_head_raw||"").trim(),G,te=X.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(te)G=te[1].trim(),X=X.replace(te[0],"").trim();let ce=_.__sections?.title,ee=K.title||G||ce,le=!K.title&&(!!G||!!ce),ue=K.meta||[],de=new Set(ue.map((Me)=>Ie(Me)).filter(Boolean)),pe={...V,...ee&&{title:ee},meta:[...(V.meta||[]).filter((Me)=>!de.has(Ie(Me))),...ue],link:[...V.link||[],...K.link||[]],script:[...V.script||[],...K.script||[]],headRaw:[V.headRaw,X].filter(Boolean).join(`
2611
+ `),...K.htmlAttrs&&{htmlAttrs:Yi(V.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...V.bodyAttrs||{},...K.bodyAttrs}}},fe=to(F);if(F=Nn(F,pe,{...le&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},fe),fe)F=Qi(F,V),F=On(F,pe.htmlAttrs);let Pe=F.match(/<!-- stx-layout: ([^ ]+) -->/);if(Pe&&F.includes("<head")){let Me=Pe[1],Ne=Nr(Me);F=F.replace(/<head\b[^>]*>/i,(Le)=>`${Le}
2612
+ <meta name="stx-layout" content="${gh(Me)}">
2613
+ <meta name="stx-layout-group" content="${gh(Ne)}">`)}let ke=F.match(/function (__stx_setup_\w+)\(/),we=ke?Gn(F):null;if(ke&&we&&!/\bdata-stx=/.test(we.tag)){F=ms(F,(Ne,Le)=>`<body${Le} data-stx="${ke[1]}">`);let Me=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ke[1]}"`,"i");F=F.replace(Me,"$1")}}if(z){let V=_.__stx_head_injections??eo(),H=Zi(F);if(H!==null)V.beforeClose.push(H);let K=Om(F);if(K!==null)V.afterOpen.push(K);if(R.offline?.enabled&&!F.includes("data-stx-offline"))V.beforeClose.push(Mm);F=Xi(F,V);let X=R.app?.colorMode;if(X)F=In(F,X)}if(z)if(Sh(F,"data-stx-runtime")){let H=null,K=null,X=null,G=null,te=null;try{let{getStoreScript:ee}=await Et("stx/store-loader",()=>import("./chunk-3jwjesb5.js")),le=R.storesDir,ue=await ee(le);if(ue)X=`<script data-stx-stores>${ue}</script>`,K=await mh("data-stx-stores",ue,R)??X}catch{}H=await hh([F,X],R,T);try{let{getFrameworkComposableScript:ee}=await Et("stx/framework-composables",()=>import("./chunk-ry1w4ghk.js"));te=await ee(F)}catch{}try{let{getComposableScript:ee}=await Et("stx/composable-loader",()=>import("./chunk-e943xk88.js")),le=R.composablesDir,ue=[H,X,te].filter((pe)=>pe!==null),de=await ee(R._layerComposableDirs??le,F,ue);if(de)G=await mh('data-stx-scoped data-stx-run="always" data-stx-composables',de,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${de}</script>`}catch{}let ce=[H,K,G,te].filter((ee)=>ee!==null).map((ee)=>`
2614
+ ${ee}`).join("");F=t0(F,ce)}else{let H=await hh([F],R,T);if(H){let K=F.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(K!==-1)F=F.slice(0,K)+H+`
2615
+ `+F.slice(K)}}if(z)F=Ji(F);if(z&&_.__stx_inject_css!==!1)F=await f(F,void 0,R.buildMode==="serve",!0);else if(z)F=co(F);if(F=F.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),F=n0(F),z&&_.__stx_runtime_config)F=at(F,_.__stx_runtime_config);if(z&&!_.__stx_defer_server_data){let V=gr(_);if(V){let H=/<head\b[^>]*>/i.exec(F),K=H?H.index+H[0].length:0;F=F.slice(0,K)+V+F.slice(K)}}return F})}catch(F){if(F instanceof q)throw F;let V=F instanceof Error?F.message:String(F),H=new W(`Template processing failed: ${V}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(O.log(H,{filePath:k,context:_}),Wt.logDetailedError(H,{filePath:k,template:v.substring(0,500)}),R.debug)throw H;return ro.createFallbackContent("Template Processing",H)}}async function r0(v,_,k,R,T){let z=process.cwd(),F={...R,partialsDir:R.partialsDir&&!fn.isAbsolute(R.partialsDir)?fn.resolve(z,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!fn.isAbsolute(R.componentsDir)?fn.resolve(z,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!fn.isAbsolute(R.layoutsDir)?fn.resolve(z,R.layoutsDir):R.layoutsDir},V=F,H=v;await o0(k,_),i0(_,V),H=await ae(()=>_m(H,_,k,V),H,(ke)=>{O.log(ke,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ke.message}`)}),H=H.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=qn(H,Xe,(ke,we)=>`\x00STX_HTML_COMMENT_${we}\x00`);H=K.output;let X=K.tokens,G=(ke)=>X.length===0?ke:ke.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(we,Me)=>X[Number(Me)]??""),te="\x00STX_ESCAPED_AT\x00",ce="\x00STX_ESC_MUSTACHE_OPEN\x00",ee="\x00STX_ESC_MUSTACHE_CLOSE\x00";H=H.replace(/@@/g,te),H=H.replace(/@\{\{([\s\S]*?)\}\}/g,(ke,we)=>`${ce}${we}${ee}`),H=Am(H),H=await rh(H,k,T);let le={};H=Ls(H,le);let ue={..._.__sections||{}},de="",pe=uf(Ye(v)),fe=/@nolayout\b/.test(H)||pe===!1;if(/@nolayout\b/.test(H))H=H.replace(/@nolayout\b\s*/g,"");let Pe=H.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Pe)de=Pe[1],H=H.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof pe==="string"){if(de=pe,!/@section\s*\(/.test(H))H=`@section('content')
2616
+ ${H.trim()}
2617
+ @endsection`}if(!de&&!fe&&V.defaultLayout){let ke=Ut(H),we=/@section\s*\(/.test(H);if(!ke||we){let Me="",Ne=fn.dirname(k),Le=V.layoutsDir?fn.dirname(V.layoutsDir):process.cwd();for(let Be=0;Be<20;Be++){let ze=fn.join(Ne,"_layout.stx");if(await r(ze)){Me=ze;break}let je=fn.dirname(Ne);if(je===Ne||je.length<Le.length)break;Ne=je}if(Me)de=Me;else if(V.layoutsDir){let Be=fn.isAbsolute(V.layoutsDir)?V.layoutsDir:fn.resolve(process.cwd(),V.layoutsDir),ze=fn.join(Be,`${V.defaultLayout}.stx`);if(await r(ze))de=ze}if(de&&!we)H=`@section('content')
2618
+ ${H.trim()}
2619
+ @endsection`}}if(de&&H.includes("<script")){let ke=Dn(H),we=ke.scripts.map((Me)=>yh(Me,k)??Me);H=ps(ke.output,we)}if(H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ke,we,Me)=>(ue[we]=Me,"")),H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ke,we,Me)=>{if(/^(['"]).*\1$/.test(Me.trim()))return ke;try{let Ne=l(Me.trim(),_);if(Ne===void 0)return ke;return ue[we]=String(Ne??""),""}catch{return ke}}),H=H.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ke,we,Me)=>{if(Me.includes("@parent"))ue[we]=Me.replace("@parent",rs);else ue[we]=Me.trim();return""}),_.__sections=ue,H=H.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ke,we,Me)=>ue[we]||Me||""),!("slot"in _)||_.slot===void 0)H=H.replace(/\{\{\s*slot\s*\}\}/g,()=>ue.content||"");if(H=js(H,le),de){let ke=[],we=Dn(H),Me=qn(we.output,ds,(Ne,Le)=>`\x00STX_ORPHAN_STYLE_${Le}\x00`);if(H=Me.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Ne,Le,Be)=>{let ze=Le==="SCRIPT"?yh(we.scripts[Number(Be)],k):Me.tokens[Number(Be)];if(ze)ke.push(ze);return""}),ke.length>0){let Ne=ke.join(`
2620
+ `);ue.content=ue.content?`${ue.content}
2621
+ ${Ne}`:Ne,_.__sections=ue}}if(de)try{let ke;if(fn.isAbsolute(de))ke=de,T.add(de);else ke=await ae(()=>hr(de,k,F,T),null,()=>{throw new W(`Failed to resolve layout path: ${de}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ke){let ze=(Ve)=>{if(!Ve)return[];try{let Ue=fn.isAbsolute(Ve)?Ve:fn.resolve(process.cwd(),Ve);return QS.readdirSync(Ue).filter((We)=>We.endsWith(".stx")).map((We)=>We.replace(/\.stx$/,""))}catch{return[]}},je=[...ze(F.layoutsDir),...ze(F.fallbackLayoutsDir)].filter((Ve,Ue,We)=>We.indexOf(Ve)===Ue).sort(),Fe=`Layout not found: ${de} (referenced from ${k})`+(je.length>0?`. Available layouts: ${je.join(", ")}`:F.layoutsDir?`. No .stx layouts found in ${F.layoutsDir}`:"");if(O.log(Error(Fe),{layoutPath:de,filePath:k,available:je},"error"),console.error(`[stx] ${Fe}`),F.debug)throw new W(Fe,k);return H}let we=await ae(()=>Bun.file(ke).text(),"",()=>{throw new W(`Failed to read layout file: ${ke}`,k,void 0,void 0,"Layout content could not be loaded")});we=fh(we,ke);let Me=we.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(Me){if(F.debug)console.log(`Found nested layout: ${Me[1]} in ${ke}`);let ze={},je=we.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ue,We,ct)=>(ze[We]=ct.trim(),""));for(let[Ue,We]of Object.entries(ze))if(ue[Ue]&&ue[Ue].includes(rs)){let ct=ue[Ue].indexOf(rs);ue[Ue]=ue[Ue].slice(0,ct)+We+ue[Ue].slice(ct+rs.length)}else if(!ue[Ue])ue[Ue]=We;let Fe={..._,__sections:ue},Ve=`@layout('${Me[1]}')${je}`;return await n(Ve,Fe,ke,F,T)}let Ne=we.replace(/\{\{--[\s\S]*?--\}\}/g,""),Le=Ls(Ne,le),Be={};return Le=Le.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ze,je,Fe)=>(Be[je]=Fe.trim(),`@slot('${je}')`)),Le=Le.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ze,je,Fe)=>{if(ue[je]){let Ve=ue[je];if(Ve.includes(rs)){let Ue=Be[je]||"",We=Ve.indexOf(rs);Ve=Ve.slice(0,We)+Ue+Ve.slice(We+rs.length)}return Ve}return Fe||""}),Le=s0(Le,ue),Le=Le.replace(/\{\{\s*slot\s*\}\}/g,()=>ue.content||""),Le=js(Le,le),_.__originalFilePath=k,H=await wh(Le,_,ke,F,T),H=`<!-- stx-layout: ${de} -->
2622
+ ${H}`,G(H)}catch(ke){if(ke instanceof q)throw ke;throw new W(`Error processing layout ${de}: ${ke instanceof Error?ke.message:String(ke)}`,k)}return G(await wh(H,_,k,F,T))}function s0(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let z=_[R];if(z!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(z))return z}return T||""})}function i0(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,z]of Object.entries(process.env))if(T.startsWith(k)&&z!==void 0)R[T]=z;v.$env=R}async function o0(v,_){await ae(()=>Cm(v,_),void 0,(k)=>{O.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Nu="data-stx-source";function yh(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Nu))return v;return`<script ${Nu}="${encodeURIComponent(_)}"${v.slice(7)}`}function a0(v){let _=new RegExp(`${Nu}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function xh(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function bh(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">${xh(v)}</span><span style="display:block;margin-top:4px">${xh(k)}</span></div>`}async function c0(v,_,k,R){let{scanScriptTags:T}=await Et("stx/signal-processing",()=>import("./chunk-yww6c9we.js")),z=[],F=!E()&&!Bn();for(let H of T(v)){let K=H.attrs;if(!/\bserver\b/.test(K))continue;let X=H.start+H.fullMatch.indexOf(">")+1,G=vh(v,X);if(G===-1)continue;let te=v.slice(X,G);if(!te.trim())continue;let ce=a0(K)??k,ee={index:H.start,length:G+9-H.start};try{let{extractVariables:le}=await Et("stx/variable-extractor",()=>import("./chunk-8er7jc3c.js"));await le(te,_,ce,{preserveExisting:!0,onFailure:(ue)=>{if(ue.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:ce,kind:ue.kind,message:ue.message}),!F)return;z.push({...ee,markup:bh(ce,ue.kind,ue.message)})}})}catch(le){let ue=le instanceof Error?le:Error(String(le));if(O.log(ue,{filePath:ce,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${ce}: ${ue.message}`),F)z.push({...ee,markup:bh(ce,"unknown",ue.message)})}}if(z.length===0)return v;let V=v;for(let H of z.sort((K,X)=>X.index-K.index))V=V.slice(0,H.index)+H.markup+V.slice(H.index+H.length);return V}async function l0(v,_,k){try{let{interpolateScriptsInTemplate:R}=await Et("stx/expressions",()=>import("./chunk-mfwrxz9z.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 wh(v,_,k,R,T){let z=v,F=R;if(z=await c0(z,_,k,R),z=await l0(z,_,k),z=await pm(z,_,k),z=await fm(z,_,k),z=await Zf(z,_,k,F),Ee(z))z=$i(z,_),z=Os(z,_),z=Is(z,_);z=Ri(z);let{processStreamDirectives:V}=await Et("stx/streaming",()=>import("./chunk-g039c67x.js"));z=V(z,_),z=Ni(z,_,k,F,!0),z=await Dm(z,_,k,F,T),z=await Rs(z,_,k,F,T),z=lf(z,_,k,F);let{processDeferDirectives:H}=await Et("stx/defer",()=>import("./chunk-mmpm1awz.js"));z=H(z,_,k);let{processTeleportDirectives:K}=await Et("stx/teleport",()=>import("./chunk-2vzfn6vy.js"));z=K(z,_,k);let{processTransitionDirectives:X,processTransitionAttributes:G}=await Et("stx/transitions",()=>import("./chunk-rrdn4qnn.js"));z=X(z,_,k),z=G(z);let{processErrorBoundaryDirectives:te,stripRenderFailedMarkers:ce}=await Et("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));z=te(z,_,k),z=ce(z);let{processSuspenseDirectives:ee}=await Et("stx/suspense",()=>import("./chunk-cy83yfy9.js"));z=ee(z,_,k);let{processAsyncDirectives:le}=await Et("stx/async-components",()=>import("./chunk-vczt5k2j.js"));z=le(z,_,k);let{processKeepAliveDirectives:ue}=await Et("stx/keep-alive",()=>import("./chunk-rhhwz7e9.js"));z=ue(z,_,k);let{processVirtualListDirectives:de,processVirtualGridDirectives:pe,processInfiniteListDirectives:fe}=await Et("stx/virtual-scrolling",()=>import("./chunk-s7c9kb53.js"));z=de(z,_,k),z=pe(z,_,k),z=fe(z,_,k);let{processPartialHydrationDirectives:Pe,processStaticDirectives:ke}=await Et("stx/partial-hydration",()=>import("./chunk-dbqb1a51.js"));z=Pe(z,_,k),z=ke(z);let{processComputedDirectives:we,processWatchDirectives:Me}=await Et("stx/computed",()=>import("./chunk-1xdzcy9d.js"));z=we(z,_,k),z=Me(z,_,k);let{processFormValidationDirectives:Ne}=await Et("stx/forms-validation",()=>import("./chunk-km4xp898.js"));z=Ne(z,_,k);let{processHeadDirective:Le,processTitleDirective:Be,processMetaDirective:ze,resetHead:je}=await Et("stx/head",()=>import("./chunk-e8t64hxk.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)je();let Fe=Le(z);if(z=Fe.content,Fe.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${Fe.headContent}
2623
+ `;if(z=Be(z,_),z=ze(z,_,k),z=Em(z),z=Bl(z,_),z=Xf(z),z=Sm(z),z=await Ms(z,_,k,F,T),z=await Rs(z,_,k,F,T),_.__stxProcessingDepth===1)z=jd(z,_);if(z=z.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),z=Mu(z),z=sr(z,_,k),z=Ds(z),z=df(z,_,{filePath:k,buildMode:F.buildMode}),z=zl(z,_),z=Wl(z,_),z=ja(z,_),z=ng(z,_),z=rg(z,_),z=await Lf(z,_,k,F),z=await yf(z,_,k),z=await Bi(z,_,k,F),z=Fi(z,_,k,F),z=Xs(z,_,k,F),z=Js(z,_,k),z=Ys(z,_,k,F),z=qf(z,_,k,F),z=Fs(z,_),z=zs(z),z=ah(z),!F.skipEventDirectives)z=_d(z,_,k);if(z=gf(z,_,k),F.debug){let kt=/\bx-data\s*=/.test(z),ht=Ps(v);if(kt&&ht)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2624
+ Both work on the same page, but they manage separate scopes.
2625
+ Prefer signals (state/derived/effect) for new components.`)}z=Ng(z,_),z=await Z(z,_,k),z=dh(z),z=ph(z),z=Qp(z);let{processXElementDirectives:Ve}=await Et("stx/x-element",()=>import("./chunk-zhxdpzga.js"));z=Ve(z);let Ue=_.__originalFilePath||k,We=Ce(_);if(z=await Ai(z,F,Ue,We),z=Qf(z,_),z=await km(z,_,k,F),F.media?.image?.autoSiblings){let kt=F.publicDir||"public",{rewriteImagesWithSiblings:ht}=await Et("stx/image-optimization/auto-sibling",()=>import("./chunk-5yf9yzkp.js"));z=await ht(z,{publicDir:kt})}if(F.seo?.enabled)z=Zs(z,_,F);let ct=(kt,ht,At=!0)=>{if(!ht)return kt;let Kt=ht.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Jt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(kt),gn=Jt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Jt[0]):null;if(Kt&&Jt&&gn){if(At){let cn=Jt.index+gn.index;kt=kt.slice(0,cn)+Kt[0]+kt.slice(cn+gn[0].length)}if(ht=ht.replace(Kt[0],"").trim(),!ht)return kt}if(/<\/head>/i.test(kt))return kt.replace(/<\/head>/i,`${ht}
2626
+ </head>`);if(/<head\b[^>]*>/i.test(kt))return kt.replace(/(<head\b[^>]*>)/i,`$1
2627
+ ${ht}`);if(/<html\b[^>]*>/i.test(kt))return kt.replace(/(<html\b[^>]*>)/i,`$1
2628
+ <head>
2629
+ ${ht}
2630
+ </head>`);return kt},{renderHead:$t,getHead:wt}=await Et("stx/head",()=>import("./chunk-e8t64hxk.js")),St=_.__stx_runtime_head??wt();if(St.title||St.meta?.length||St.link?.length){let kt=$t(St);if(kt)z=ct(z,kt)}if(Fe.headContent)z=ct(z,Fe.headContent,!St.title);if(F.csp?.enabled&&F.csp.addMetaTag)z=Uf(z,F.csp,_);if(F.analytics?.enabled)z=ef(z,F);if(F.heatmap?.enabled)z=nf(z,F);if(F.pwa?.enabled&&F.pwa.autoInject!==!1){let{injectPwaTags:kt}=await Et("stx/pwa/inject",()=>import("./chunk-a83r1xx9.js"));z=kt(z,F)}let mt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(z),Ct=/\bSTX\.\w+/.test(z),vt=/window\.STX\s*=/.test(z);if(mt&&Ct&&!vt){let ht=`<script data-stx-scoped data-stx-run="once">
2631
+ ${Gp()}
2632
+ </script>`;if(z.includes("</head>")){let At=z.indexOf("</head>"),Jt=z.slice(0,At).indexOf("<script");if(Jt!==-1){let gn=z.slice(0,Jt),cn=z.slice(Jt);z=gn+ht+`
2633
+ `+cn}else z=z.replace("</head>",`${ht}
2634
+ </head>`)}else if(z.includes("<body"))z=z.replace(/<body([^>]*)>/,`<body$1>
2635
+ ${ht}`);else z=ht+`
2636
+ `+z}{let{scanScriptTags:kt}=await Et("stx/signal-processing",()=>import("./chunk-yww6c9we.js")),ht=[];for(let At of kt(z)){if(!/\bserver\b/i.test(At.attrs))continue;let Kt=At.start+At.fullMatch.indexOf(">")+1,Jt=vh(z,Kt);if(Jt===-1)continue;let gn=Jt+9;while(gn<z.length&&/\s/.test(z[gn]))gn++;ht.push({start:At.start,end:gn})}if(ht.length>0){let At=Array(ht.length+1),Kt=0;for(let Jt=0;Jt<ht.length;Jt++){let{start:gn,end:cn}=ht[Jt];At[Jt]=z.slice(Kt,gn),Kt=cn}At[ht.length]=z.slice(Kt),z=At.join("")}}let pt=wa(z,k);if(pt.hasScoped)z=pt.html;let Rt=_.__stx_event_bindings||[],xt=!1,qt=[],Ur=/\s:[a-z][\w.-]*\s*=/.test(z),{scanScriptTags:bn}=await Et("stx/signal-processing",()=>import("./chunk-yww6c9we.js"));for(let kt of bn(z,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))qt.push({match:kt.fullMatch,attrs:kt.attrs,content:kt.body});for(let{match:kt,attrs:ht,content:At}of qt){xt=!0;let Kt=At;et(At,k,R.strict,_.__originalFilePath);let Jt=await _e(At,{eventBindings:Rt,attrs:ht,hasColonDirectives:Ur,templateContent:v,filePath:k,projectRoot:process.cwd(),production:oo(R.buildMode),serverData:We});z=z.replace(kt,()=>Jt)}if(xt)_.__stx_event_bindings=[];if(!xt&&_.__stxProcessingDepth===1){let kt=_.__stx_event_bindings||[];if(kt.length>0){let ht=pc(kt);if(ht){let At=z.lastIndexOf("</body>");z=At===-1?z+ht:z.slice(0,At)+ht+`
2637
+ `+z.slice(At)}_.__stx_event_bindings=[]}}if(!ye(z)&&Vm(z))z=await Qa(z,F);if(z=Um(z),F.csp?.enabled&&F.csp.useNonce&&typeof _.cspNonce==="string")z=Hf(z,_.cspNonce);return z}var u0=[{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"}],d0=[{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')"}],p0=[{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 Zc(v){let _=[],k=[];return f0(v,_),g0(v,_,k),m0(v,k),h0(v,_),{valid:_.length===0,errors:_,warnings:k}}function f0(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 g0(v,_,k){for(let R of u0){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),z=new RegExp(R.close,"g"),F=(v.match(T)||[]).length,V=(v.match(z)||[]).length;if(R.altClose){let H=new RegExp(R.altClose,"g");V+=(v.match(H)||[]).length}if(F>V)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${F} opening and ${V} closing`,suggestion:`Add ${F-V} missing ${R.close} tag(s)`});else if(V>F)k.push({type:"directive",message:`Extra ${R.close} found: ${V-F} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function m0(v,_){for(let k of d0)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function h0(v,_){for(let k of p0)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Qc(v,_){let k=v.slice(0,_).split(`
2638
+ `);return{line:k.length,column:k[k.length-1].length+1}}function el(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 tl(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function nl(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 Jn from"path";import ci from"process";var zt=["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 $h=new Set(zt),y0=new Set(["props","$props","defineProps"]),x0=new Set(["stx","@stacksjs/stx"]),_h=m(128),kh=m(64);function b0(v){let _=[],k=0,R=v.split(`
2639
+ `);for(let T of R){let z=k,F=null,V=!1;for(let H=0;H<T.length;H++){let K=T[H];if(V){V=!1;continue}if(K==="\\"){V=!0;continue}if(F){if(K===F)F=null;continue}if(K==="'"||K==='"'||K==="`"){F=K;continue}if(K==="/"&&H+1<T.length&&T[H+1]==="/")break;if(K==="{")k++;else if(K==="}")k--}if(z===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 K=T.match(/(?:const|let|var)\s+(\w+)/);if(K)_.push(K[1])}else{let K=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let G=K[1].slice(1,-1).split(",").map((te)=>{let ce=te.split(":");return(ce.length>1?ce[1]:ce[0]).trim()}).filter((te)=>/^\w+$/.test(te));_.push(...G)}}}}return[...new Set(_)]}function Vc(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=[],z="",F=0,V=0,H=null;for(let K=0;K<R.length;K++){let X=R[K];if(H){if(z+=X,X===H)H=null;continue}if(X==='"'||X==="'"||X==="`"){H=X,z+=X;continue}if(X==="<")F++;else if(X===">"&&F>0)F--;else if(X==="(")V++;else if(X===")")V--;if(X===","&&F===0&&V===0){T.push(z),z="";continue}z+=X}if(z)T.push(z);return T.map((K)=>{let X=K.trim(),G=X.startsWith("..."),te=G?X.slice(3):X,ce=-1,ee=0;for(let ke=0;ke<te.length;ke++)if(te[ke]==="<")ee++;else if(te[ke]===">")ee--;else if(te[ke]===":"&&ee===0){ce=ke;break}if(ce===-1)return K;let ue=te.substring(0,ce).trim().replace(/\?$/,""),de=te.substring(ce+1),pe=-1,fe=0;for(let ke=0;ke<de.length;ke++)if(de[ke]==="<")fe++;else if(de[ke]===">")fe--;else if(de[ke]==="="&&fe===0){pe=ke;break}let Pe=G?"...":"";if(pe!==-1)return`${Pe}${ue} = ${de.substring(pe+1).trim()}`;return`${Pe}${ue}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(R,T,z)=>{if(!z.includes(":"))return R;return`${T}(${k(z)})`});{let R=/\b(function\s+\w*\s*)\(/g,T,z=[];while((T=R.exec(_))!==null){let F=T.index+T[0].length-1,V=1,H=F+1,K=0,X=null;while(H<_.length&&V>0){let ce=_[H];if(X){if(ce===X)X=null;H++;continue}if(ce==='"'||ce==="'"||ce==="`"){X=ce,H++;continue}if(ce==="<")K++;else if(ce===">"&&K>0)K--;else if(K===0){if(ce==="(")V++;else if(ce===")")V--}if(V>0)H++}if(V!==0)continue;let G=_.substring(F+1,H);if(!G.includes(":"))continue;let te=k(G);z.push({start:F+1,end:H,replacement:te})}for(let F=z.length-1;F>=0;F--){let{start:V,end:H,replacement:K}=z[F];_=_.substring(0,V)+K+_.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((F)=>{let[V,...H]=F.split("="),K=V.split(":")[0].trim();if(H.length>0)return`${K} = ${H.join("=").trim()}`;return K}).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,`
2640
+
2641
+ `),_}function Uc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,z=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(z)?"":_})}function Wc(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function qc(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 Gc(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 Eh=new Set;async function u(v,_,k,R={}){if(!v.trim())return;let T=w(),z=h(v,JSON.stringify(T)),F=_h.get(z);if(F===void 0){try{let He=B({loader:"ts",target:"browser",define:T}),qe=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");qe=qe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),F=He.transformSync(qe)}catch{F=Vc(v)}_h.set(z,F)}let V={exports:{}},H=V.exports,K=ci.cwd(),X={},G=[...F.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((He)=>He[1]).filter((He)=>!He.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(He)),te=new Map;for(let He of G)try{if(He.startsWith(".")){X[He]=await import(Jn.resolve(Jn.dirname(k),He));continue}let qe=Jn.resolve(K,"node_modules",He),yt=Jn.join(qe,"package.json"),Tt=JSON.parse(d("fs").readFileSync(yt,"utf8")),Yt=Tt.main||"index.js";if(Tt.exports){let on=typeof Tt.exports==="string"?Tt.exports:Tt.exports["."];if(typeof on==="string")Yt=on;else if(on?.bun)Yt=on.bun;else if(on?.import)Yt=on.import;else if(on?.default)Yt=on.default}X[He]=await import(Jn.resolve(qe,Yt))}catch(qe){if(He.startsWith("."))te.set(He,qe instanceof Error?qe.message:String(qe))}let ce=(He)=>{if(X[He])return X[He];let qe=te.get(He);if(qe!==void 0)throw Error(`Cannot require '${He}' from ${k}: ${qe}`);return d(He)},ee=_.props||{},le=(He)=>{if(!He)return ee;let qe={};for(let[yt,Tt]of Object.entries(He)){let Yt=ee[yt];if(Yt!==void 0)qe[yt]=Yt;else if(typeof Tt==="function")qe[yt]=Tt();else qe[yt]=Tt}return qe};for(let[He,qe]of Object.entries(ee))Object.defineProperty(le,He,{value:qe,enumerable:!0,configurable:!0,writable:!0});let ue=(He,qe=!1)=>{if(He===void 0||He===null)return qe;if(typeof He==="string"){let yt=He.trim().toLowerCase();if(yt===""||yt==="true"||yt==="1"||yt==="on"||yt==="yes")return!0;if(yt==="false"||yt==="0"||yt==="off"||yt==="no")return!1;return!0}return Boolean(He)},de=(He,qe=0)=>{if(He===void 0||He===null)return qe;if(typeof He==="string"){let Tt=He.trim();if(Tt==="")return qe;let Yt=Number(Tt);return Number.isFinite(Yt)?Yt:qe}let yt=Number(He);return Number.isFinite(yt)?yt:qe};for(let He of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(ee,He))continue;try{Object.defineProperty(le,He,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let pe=(He)=>{if(!He)return ee;let qe={...ee};for(let[yt,Tt]of Object.entries(He)){let Yt=Tt&&typeof Tt==="object"&&!Array.isArray(Tt)?Tt:{type:Tt};if(qe[yt]===void 0&&Yt.default!==void 0)qe[yt]=typeof Yt.default==="function"?Yt.default():Yt.default}return qe},fe=()=>_.slots||{},Pe=(He,qe)=>{let yt={...He};for(let[Tt,Yt]of Object.entries(qe))if(yt[Tt]===void 0)if(typeof Yt==="function")yt[Tt]=Yt();else yt[Tt]=Yt;return yt},ke=(He)=>{let qe=()=>He;return qe.set=(yt)=>{},qe.update=(yt)=>{},qe},we=(He)=>{let qe,yt=!1;return()=>{if(!yt)try{qe=He(),yt=!0}catch{qe=void 0}return qe}},Me=(He)=>{},Ne=(He)=>He(),Le=(He)=>{},Be=(He)=>{},ze=ur(_);function je(He){let qe=He||{};if(qe.title!==void 0||qe.description!==void 0)ct({title:qe.title,description:qe.description})}function Fe(He){if(!He||typeof He!=="object")return;let qe=_.__stxClientPayload??{};Object.assign(qe,He),_.__stxClientPayload=qe}let Ve=()=>{let He=_.__stxServeContext,qe=_.__stxServeSearch??He?.search??"",yt=He?.path??"",Tt=Object.fromEntries(new URLSearchParams(qe)),Yt=_.query,on=Object.keys(Tt).length>0?Tt:Yt??{},Hr=qe||(Object.keys(on).length>0?`?${new URLSearchParams(on).toString()}`:"");return{params:_.params??{},query:on,path:yt,name:"",fullPath:yt+Hr,hash:"",matched:[]}},Ue=()=>({push:(He)=>{},replace:(He)=>{},back:()=>{},forward:()=>{},go:(He)=>{}}),We=(He)=>{let qe=_.__stx_runtime_head||{};_.__stx_runtime_head=Se(qe,xe(He||{},{known:_r,source:"useHead()"}))},ct=(He)=>{We(Er(He||{}))},$t=(He)=>({value:He}),wt=(He)=>He,It=(He)=>({value:typeof He==="function"?He():He}),St=(He,qe)=>{},mt=(He)=>{},Ct=(He)=>{},vt=(He)=>He?He():Promise.resolve(),pt=(He)=>(qe,...yt)=>{},Rt=(He)=>{},xt=(He,qe)=>{},qt=(He,qe)=>qe,Ur=()=>({value:"light"}),bn=()=>ke(!1),kt=(He)=>ke(!1),ht=()=>ke(!1),At=()=>kt("(prefers-color-scheme: dark)"),Kt=()=>kt("(prefers-color-scheme: light)"),Jt=()=>kt("(prefers-reduced-motion: reduce)"),gn=()=>kt("(prefers-contrast: more)"),cn={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:{}},li=new Proxy(cn,{get(He,qe){if(qe in He)return He[qe];return},set(He,qe,yt){return He[qe]=yt,!0}}),oc={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Yn=console;try{let He=Ns(F,k),qe=new Set(Object.keys(ee)),yt=Object.keys(_).filter((ft)=>!qe.has(ft)&&!y0.has(ft)&&dt(ft)),Tt=yt.map((ft)=>_[ft]);if(!yt.includes("__stxServeContext"))yt.push("__stxServeContext"),Tt.push(void 0);if(!qe.has("cookies")){let ft=_.cookies??_.__stxServeContext?.cookies??{},_t=yt.indexOf("cookies");if(_t<0)yt.push("cookies"),Tt.push(ft);else Tt[_t]=ft}let Yt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),on=[],Hr=[];for(let[ft,_t]of Object.entries(ee)){if(!dt(ft))continue;if(Yt.has(ft))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${ft}\\b`).test(He))continue;on.push(ft),Hr.push(_t)}let No=b0(He).map((ft)=>`module.exports.${ft} = typeof ${ft} !== 'undefined' ? ${ft} : module.exports.${ft};`).join(`
2642
+ `),Lo=_.params??{},ui=[],Bo=[];for(let ft=0;ft<yt.length;ft++){if(yt[ft]==="params")continue;ui.push(yt[ft]),Bo.push(Tt[ft])}let $r=[...zt,...on,...ui],is=`return (async () => {
2643
+ ${He}
2644
+ ${No}
2645
+ return module.exports
2646
+ })()`,Qn=h(is,$r.join("\x00")),an=kh.get(Qn);if(!an)an=Function(...$r,is),kh.set(Qn,an);let ut=_.__stx_options?.runtimeConfig;if(ut||/\buse(?:Server)?RuntimeConfig\b/.test(F))await An(_,k,ut);let bt=await ve(_.__stx_runtime_config??Vt()??C(),()=>Nm(_,()=>an(V,H,ce,ee,le,ue,de,pe,Pe,Fe,Lm,Ks,wr,ke,we,Me,Ne,Le,Be,je,Ve,Ue,We,ct,ze.setResponseStatus,ze.setResponseHeader,ze.notFound,$t,wt,It,St,mt,Ct,vt,pt,Rt,fe,xt,qt,Ur,bn,kt,ht,At,Kt,Jt,gn,li,oc,Yn,cn.confirm,cn.alert,cn.fetch,Lo,...Hr,...Bo)));if(R.preserveExisting){for(let[ft,_t]of Object.entries(bt))if(!(ft in _)||_[ft]===void 0)_[ft]=_t}else Object.assign(_,bt);for(let[ft,_t]of Object.entries(ee))if(!(ft in _))_[ft]=_t}catch(He){if(_.__stx_strict_hydration)throw He;let qe=Uc(He instanceof Error?He.message:String(He));if(Wc(qe))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${qe}`),R.onFailure?.({kind:"module-resolution",message:qe,error:He});else if(qc(He))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${qe}`),R.onFailure?.({kind:"syntax",message:qe,error:He});else if(Gc(qe))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: ${qe}`),R.onFailure?.({kind:"missing-binding",message:qe,error:He});else{let yt=`${k??"<unknown>"}\x00${qe}`;if(ci.env.STX_DEBUG||!Eh.has(yt))Eh.add(yt),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: ${qe}`);R.onFailure?.({kind:"unknown",message:qe,error:He})}try{await k0(F,_,k)}catch(yt){if(ci.env.STX_DEBUG){let Tt=yt instanceof Error?yt.message:String(yt);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${Tt}`)}}}}function Kc(v){let _=0,k=null,R=!1,T=!1;for(let z=0;z<v.length;z++){let F=v[z];if(k){if(F===k){if(k=null,R||_===0)T=!0}continue}if(F==="'"||F==='"'||F==="`"){k=F;continue}if(F==="{")_++;else if(F==="}")_--;else if(v.startsWith("from",z)&&_===0)R=!0}return k===null&&_===0&&T}var w0=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function Ns(v,_){let k=_?Jn.dirname(_):ci.cwd(),R=ci.cwd(),T=v.split(`
2647
+ `),z=[],F=0;while(F<T.length){let V=T[F].trim();if(V.startsWith("interface ")||V.startsWith("export interface ")||V.startsWith("type ")||V.startsWith("export type ")){if(V.includes("{")&&!V.includes("}")){let H=0;for(;F<T.length;F++){for(let K of T[F])if(K==="{")H++;else if(K==="}")H--;if(H<=0)break}}F++;continue}if(V.startsWith("definePageMeta(")){let H=0,K=!1,X=F;for(let ce=F;ce<T.length&&!K;ce++){let ee=null,le=!1,ue=T[ce];for(let de=0;de<ue.length;de++){let pe=ue[de];if(le){le=!1;continue}if(pe==="\\"){le=!0;continue}if(ee){if(pe===ee)ee=null;continue}if(pe==='"'||pe==="'"||pe==="`"){ee=pe;continue}if(pe==="(")H++;else if(pe===")"){if(H--,H===0){F=ce+1,K=!0;break}}}}if(!K)F=T.length;let G=T.slice(X,F).join(`
2648
+ `),te=[];for(let ce of["title","description"]){let ee=new RegExp(`\\b${ce}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(G);if(ee)te.push(`${ce}: ${JSON.stringify(ee[2])}`)}if(te.length>0)z.push(`useSeoMeta({ ${te.join(", ")} });`);continue}if(V.startsWith("import ")||V==="import"||V.startsWith("import{")||/^import['"]/.test(V)){let H=V,K=0;while(!Kc(H)&&F+K+1<T.length)K++,H=`${H} ${T[F+K].trim()}`;F+=K;let X=H.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),G=H.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),te=H.match(/^import\s*['"](.+?)['"]/),ce=H,ee=(le)=>{if(le.startsWith("."))return Jn.resolve(k,le);if(le.startsWith("~/")||le.startsWith("@/"))return Jn.resolve(R,le.slice(2));try{return Bun.resolveSync(le,k)}catch{return le}};if(X){let[,le,ue]=X,de=ee(ue);z.push(`const ${le} = (await import('${de}')).default`),z.push(`module.exports.${le} = ${le};`)}else if(G){let[,le,ue]=G,de=ee(ue),pe=[],fe=[],Pe=x0.has(ue);for(let ke of le.split(",")){let we=ke.trim();if(!we)continue;let Me=we.split(/\s+as\s+/);if(Me.length===2){let[Ne,Le]=[Me[0].trim(),Me[1].trim()];if(Pe&&$h.has(Ne)){z.push(`const ${Le} = ${Ne};`);continue}pe.push(`${Ne}: ${Le}`),fe.push(Le)}else{if(Pe&&$h.has(we))continue;pe.push(we),fe.push(we)}}if(pe.length>0)z.push(`const { ${pe.join(", ")} } = await import('${de}')`);for(let ke of fe)z.push(`module.exports.${ke} = ${ke};`)}else if(te){let le=ee(te[1]);z.push(`await import('${le}')`)}else z.push(ce);F++;continue}if(w0.test(V))z.push(T[F]),F++;else if(V.startsWith("export const ")||V.startsWith("export let ")||V.startsWith("export var ")){let H=Rh(T,F),{type:K,name:X,value:G}=H;z.push(`${K} ${X} = ${G};`),z.push(`module.exports.${X} = ${X};`),F=H.nextIndex}else if(V.startsWith("export function ")||V.startsWith("export async function ")){let H=Lu(T,F);z.push(H.functionCode),z.push(`module.exports.${H.name} = ${H.name};`),F=H.nextIndex}else if(V.startsWith("const ")||V.startsWith("let ")||V.startsWith("var ")){let H=Rh(T,F),{type:K,name:X,value:G}=H;z.push(`${K} ${X} = ${G};`),z.push(`module.exports.${X} = ${X};`),F=H.nextIndex}else if(V.startsWith("function ")||V.startsWith("async function ")){let H=Lu(T,F);z.push(H.functionCode),z.push(`module.exports.${H.name} = ${H.name};`),F=H.nextIndex}else if(V.startsWith("export default function ")||V.startsWith("export default async function ")){let H=T[F].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...T];K[F]=H;let X=Lu(K,F);if(z.push(X.functionCode),X.name)z.push(`module.exports.default = ${X.name};`);F=X.nextIndex}else if(V.startsWith("export default ")){let H=V.replace(/^export\s+default\s+/,"").replace(/;$/,"");z.push(`module.exports.default = ${H};`),F++}else if(V.startsWith("class ")||V.startsWith("export class ")){let H=V.match(/(?:export\s+)?class\s+(\w+)/);if(H){let K=H[1],X=T[F].replace(/^export\s+/,""),G=0,te=F;for(;te<T.length;te++){let ce=T[te];for(let ee of ce)if(ee==="{")G++;else if(ee==="}")G--;if(te>F)X+=`
2649
+ `+ce;if(G<=0&&te>=F)break}z.push(X),z.push(`module.exports.${K} = ${K};`),F=te+1}else z.push(V),F++}else if(V.includes("module.exports"))z.push(V),F++;else if(V.trim()&&!V.startsWith("//"))z.push(V),F++;else F++}return v0(z.join(`
2650
+ `),k,R)}function v0(v,_,k){let R=v.length,T="",z=0,F=null,V=!1,H=!1,K=0;while(z<R){let X=v[z],G=v[z+1];if(V){if(T+=X,X===`
2651
+ `)V=!1;z++;continue}if(H){if(T+=X,X==="*"&&G==="/"){T+=G,z+=2,H=!1;continue}z++;continue}if(!F&&X==="/"&&G==="/"){V=!0,T+=X,z++;continue}if(!F&&X==="/"&&G==="*"){H=!0,T+=X,z++;continue}if(F){if(T+=X,X==="\\"){T+=G,z+=2;continue}if(X===F&&F!=="`"){F=null,z++;continue}if(F==="`"){if(X==="$"&&G==="{"){K++,T+=G,z+=2;continue}if(X==="`"){F=null,z++;continue}}z++;continue}if(K>0){if(X==="{")K++;else if(X==="}")K--}if(X==='"'||X==="'"||X==="`"){F=X,T+=X,z++;continue}if(X==="a"&&v.startsWith("await",z)){let te=S0(v,z);if(te){let{quote:ce,path:ee,end:le}=te;if(ee.startsWith(".")||ee.startsWith("~/")||ee.startsWith("@/")){let ue=ee.startsWith(".")?Jn.resolve(_,ee):Jn.resolve(k,ee.slice(2));T+=`await import(${ce}${ue}${ce})`,z=le;continue}}}T+=X,z++}return T}function S0(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 z=v.slice(T,k);k++;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!==")")return null;return{quote:R,path:z,end:k+1}}function Ph(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 Dh(v){let _=[],k=v.slice(1,-1).trim();if(!k)return _;let R=0,T=0,z="";while(R<k.length){let F=k[R];if(F==="{"||F==="["){let V=T===0?Ph(k,R):null;if(V){_.push(...Dh(V.pattern)),R=V.endPos,z="";continue}T++}else if(F==="}"||F==="]")T--;if(T>0){R++;continue}if(F===","){if(z.trim())_.push(z.trim());z="",R++;continue}if(F===":"){z="",R++;continue}if(F==="="){if(z.trim())_.push(z.trim());z="",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(F))z+=F;R++}if(z.trim())_.push(z.trim());return _}function Xc(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,z=null;k++;for(;k<v.length;k++){let F=v[k];if(z){if(F==="\\"){k++;continue}if(F===z)z=null;continue}if(F==="'"||F==='"'||F==="`"){z=F;continue}if(F==="("||F==="["||F==="{"||F==="<"){T++;continue}if(F===")"||F==="]"||F==="}"||F===">"){T--;continue}if(F==="="&&T<=0){let V=v[k+1],H=v[k-1];if(V!=="="&&V!==">"&&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 Ch(v,_,k,R){let T=null,z=!1;for(let F of v){if(z){z=!1;continue}if(F==="\\"){z=!0;continue}if(T){if(F===T)T=null;continue}if(F==="'"||F==='"'||F==="`"){T=F;continue}if(F===_)R++;else if(F===k)R--}return R}function Rh(v,_){let k=v[_].trim(),R=Xc(k),T=R?[k,R.type,R.name,R.value]:null;if(!T){let X=k.match(/^(?:export\s+)?(const|let|var)\s+/);if(X){let G=k.slice(X[0].length),te=_;if(G.startsWith("{")||G.startsWith("[")){let ee=G[0],le=ee==="{"?"}":"]",ue=Ch(G,ee,le,0),de=G;for(let pe=_+1;pe<v.length&&ue>0;pe++)de+=` ${v[pe].trim()}`,te=pe,ue=Ch(v[pe],ee,le,ue);if(ue>0)de=G,te=_;G=de}let ce=Ph(G,0);if(ce){let ee=X[1],le=ce.pattern,ue=G.slice(ce.endPos).trim();if(ue.startsWith("=")){let de=ue.slice(1).trim(),pe=de,fe=Math.max(te,_);if(Ah(de)){let Me=Th(v,fe,de);pe=Me.value,fe=Me.nextIndex}else fe=fe+1;pe=pe.trim().replace(/;$/,"");let Pe=Dh(le),ke=`__stx_src_${_}`,we=Pe.map((Me)=>`module.exports.${Me} = ${Me};`).join(`
2652
+ `);return{type:ee,name:ke,value:`${pe}; ${ee} ${le} = ${ke};
2653
+ ${we}`,nextIndex:fe}}}}throw Error(`Failed to parse variable declaration: ${k}`)}let[,z,F,V]=T,H=V,K=_;if(Ah(V)){let X=Th(v,_,V);H=X.value,K=X.nextIndex}else K=_+1;while(K<v.length){let X=v[K].trim();if(X.startsWith(".")||X.startsWith("?."))H+=`
2654
+ ${v[K]}`,K++;else break}return H=H.trim().replace(/;$/,""),{type:z,name:F,value:H,nextIndex:K}}function Lu(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,z=k.replace(/^export\s+/,""),F=_;if($0(k)){let V=_0(v,_,z);z=V.functionCode,F=V.nextIndex}else F=_+1;return{name:T,functionCode:z,nextIndex:F}}function Ah(v){let _=v.trim();if(_.startsWith("{"))return S(_,"{","}",0)===-1;if(_.startsWith("["))return S(_,"[","]",0)===-1;return!Oh(_)}function Oh(v){let _={paren:0,bracket:0,brace:0},k=null,R=0;for(let T=0;T<v.length;T++){let z=v[T];if((T>0?v[T-1]:"")==="\\"&&k)continue;if((z==='"'||z==="'")&&!k){k=z;continue}if(z===k&&k!=="`"){k=null;continue}if(z==="`"&&!k){k="`";continue}if(z==="`"&&k==="`"&&R===0){k=null;continue}if(k==="`"&&z==="$"&&v[T+1]==="{"){R++,T++;continue}if(R>0&&z==="{"){R++;continue}if(R>0&&z==="}"){R--;continue}if(k)continue;if(z==="(")_.paren++;else if(z===")")_.paren--;else if(z==="[")_.bracket++;else if(z==="]")_.bracket--;else if(z==="{")_.brace++;else if(z==="}")_.brace--}return _.paren===0&&_.bracket===0&&_.brace===0&&k===null}function Mh(v){let _=v.indexOf("(");if(_===-1)return v.indexOf("{");let k=S(v,"(",")",_);if(k===-1)return-1;return v.indexOf("{",k)}function $0(v){let _=Mh(v);if(_===-1)return!0;return S(v,"{","}",_)===-1}function Th(v,_,k){let R=k,T=_+1;while(T<v.length&&!Oh(R)){let z=v[T];R+=`
2655
+ ${z}`,T++}while(T<v.length){let z=v[T].trim();if(z.startsWith(".")||z.startsWith("?."))R+=`
2656
+ ${v[T]}`,T++;else break}return{value:R,nextIndex:T}}function _0(v,_,k){let R=k,T=_+1;while(T<v.length){let z=Mh(R);if(z!==-1){if(S(R,"{","}",z)!==-1)break}let F=v[T];R+=`
2657
+ ${F}`,T++}return{functionCode:R,nextIndex:T}}function Ih(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:{...ci.env}})},T=Object.keys(R).filter(dt),z=T.map((F)=>R[F]);try{return Function(...T,`'use strict'; return (${v});`)(...z)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...z)}catch{return}}}async function k0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let z of R){let[,,F,V]=z;try{let H=V.trim().replace(/;$/,""),K=Ih(H,_);if(K!==void 0)_[F]=K}catch(H){console.warn(`Failed to parse export ${F} 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 z of T){let[,,F,V]=z;if(!(F in _))try{let H=V.trim().replace(/;$/,""),K=Ih(H,_);if(K!==void 0)_[F]=K}catch{}}}function Ii(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 Oi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var Mo=new L(500),sc=new L(1000),Wu=new L(2000),Fu=new L(500),Fh=33554432,Vu=Fh;function E0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Vu)return;Vu=_,ic.setMaxBytes(_)}var ic=new L(2000,{maxBytes:Fh,sizeOf:(v)=>v.output.length});function C0(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 z={};for(let F of Object.keys(R).sort())z[F]=k(R[F]);return z}finally{_.delete(R)}};return JSON.stringify(k(v))}catch{return null}}function R0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function Bu(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hs(v){let _=process.cwd(),k=`${_}\x00${v}`,R=jh.get(k);if(R===void 0)R=Bun.hash(Vh(v,_).split(gt.sep).join("/")).toString(36).slice(0,6),jh.set(k,R);return R}var jh=new Map;function Vh(v,_){if(!gt.isAbsolute(v))return v;let k=(R)=>{try{return Hu.realpathSync(R)}catch{return R}};return gt.relative(k(_),k(v))}function rl(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function rt(v){return!rl(v)}var rc=new Map;function B(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=rc.get(_);if(k)return k;if(rc.size>=16)rc.clear();let R=new Bun.Transpiler(v);return rc.set(_,R),R}var Nh=new WeakMap,A0=256;function st(v){try{let _=B({loader:"ts",target:"browser",define:w()}),k=Nh.get(_);if(!k)k=new Map,Nh.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 z=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(V)=>{let H=z.length;return z.push(V),`"__STX_EXPR_${H}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(V)=>{let H=z.length;return z.push(V),`"__STX_EXPR_${H}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(V)=>{let H=z.length;return z.push(V),`"__STX_EXPR_${H}__"`});let F=_.transformSync(T);for(let V=0;V<z.length;V++)F=F.replace(`"__STX_EXPR_${V}__"`,z[V]),F=F.replace(`'__STX_EXPR_${V}__'`,z[V]);if(k.size>=A0){let V=k.keys().next();if(!V.done)k.delete(V.value)}return k.set(v,F),F}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function T0(v){let _=[],k=new Set,R=0,T=0,z=v.length,F=(X)=>{T++;while(T<z){if(v[T]==="\\"){T+=2;continue}if(v[T]===X){T++;return}T++}},V=()=>{T++;while(T<z){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let X=1;while(T<z&&X>0)if(v[T]==="{")X++,T++;else if(v[T]==="}")X--,T++;else if(v[T]==="'"||v[T]==='"')F(v[T]);else if(v[T]==="`")V();else T++;continue}T++}},H=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<z&&v[T]!==`
2658
+ `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<z-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},K=()=>{if(R!==0)return;let X=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(X){let ee=X[2].split(",").map((le)=>{let ue=le.trim().split(":");return ue[ue.length-1].trim()});for(let le of ee)if(le&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(le)&&!k.has(le))_.push(le),k.add(le);return}let G=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(G){let ee=G[2];if(!k.has(ee))_.push(ee),k.add(ee);return}let te=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let ee=te[1];if(!k.has(ee))_.push(ee),k.add(ee);return}let ce=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(ce){let ee=ce[1];if(!k.has(ee))_.push(ee),k.add(ee)}};while(T<z){if(H())continue;if(v[T]==="'"||v[T]==='"'){F(v[T]);continue}if(v[T]==="`"){V();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])))K();T++}return _}function I0(v){let _=[],k=0,R=0,T=null;for(let z=0;z<v.length;z++){let F=v[z];if(T){if(F==="\\"){z++;continue}if(F===T)T=null;continue}if(F==='"'||F==="'"||F==="`"){T=F;continue}if(F==="("||F==="["||F==="{")k++;else if(F===")"||F==="]"||F==="}")k--;else if(F===","&&k===0)_.push(v.slice(R,z)),R=z+1}if(R<v.length)_.push(v.slice(R));return _}function P0(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 z=v[R-1],F=v[R+1];if(z==="!"||z==="<"||z===">"||z==="=")continue;if(F==="="||F===">")continue;return R}}return-1}function D0(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,z=0,F=-1;for(;R>=0;R--){let H=v[R];if(H==="}")z++;else if(H==="{"){if(z--,z===0){F=R;break}}}if(F===-1)return;let V=v.slice(F+1,T);for(let H of I0(V)){let K=H.trim();if(!K||K.startsWith("..."))continue;let X=P0(K);if(X===-1)continue;let G=K.slice(0,X).trim();if(!/^[A-Z_$][\w$]*$/i.test(G))continue;if(_[G]!==void 0)continue;let te=K.slice(X+1).trim();if(!te)continue;try{let ce=Object.keys(_).filter(dt),ee=Function(...ce,`"use strict"; return (${te});`);_[G]=ee(...ce.map((le)=>_[le]))}catch{}}}catch{}}var O0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function sl(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(!O0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),z=ne(v,(K,X)=>(T.lastIndex=X,T.exec(K)?.index===X?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(z[0]?.token||""))return null;let F=0,V=!1;for(let K of z){if(F+=K.token.startsWith("</")?-1:1,F<0)return null;if(F===0){if(v.slice(K.end).trim())return null;V=!0;break}}if(!V)return null;let H=k[0].length;return v.slice(0,H)+_+v.slice(H)}async function mr(v,_,k,R,T){let z=v.endsWith(".stx")?v.slice(0,-4):v,F=(ke)=>ke.split("-").map((we)=>we.charAt(0).toUpperCase()+we.slice(1)).join(""),V=k.__importedComponents;if(V){for(let ke of[z,z.toLowerCase(),F(z),mn(z)])if(V.has(ke))return!0}let H=[...new Set([`${z}.stx`,`${F(z)}.stx`,`${mn(z)}.stx`])],K=typeof T.root==="string"?gt.resolve(T.root):void 0,X=K??gt.dirname(R),G=[],te=(ke)=>{if(ke&&!G.includes(ke))G.push(ke)},ce=k.__originalFilePath;if(ce)te(gt.join(gt.dirname(ce),"components"));te(_),te(T._rootComponentsDir),te(gt.join(gt.dirname(R),"components")),te(T.componentsDir);let ee=T._targetComponentFallbackNames?.some((ke)=>ke.toLowerCase()===z.toLowerCase());if(!ee)for(let ke of T._targetComponentDirs??[])te(ke);if(K)te(gt.resolve(K,"resources/views/components")),te(gt.resolve(K,"resources/components")),te(gt.resolve(K,"src/components")),te(gt.resolve(K,"components"));for(let ke of T._layerComponentDirs??[])te(ke);let le=T._pluginComponentDirs;if(Array.isArray(le))for(let ke of le)te(typeof ke==="string"?ke:null);if(te(T.fallbackComponentsDir),ee)for(let ke of T._targetComponentDirs??[])te(ke);if(z.startsWith("./")||z.startsWith("../"))return r(gt.resolve(gt.dirname(R),`${z}.stx`));let ue=Lh(gt.resolve(import.meta.dir,"components")),de=G.map((ke)=>gt.isAbsolute(ke)?ke:gt.resolve(X,ke)),pe=`${H.join("\x00")}\x00\x00${de.join("\x00")}`,fe=Wu.get(pe);if(fe!==void 0)return fe;let Pe=!1;e:for(let ke of de){if(Lh(ke)===ue)continue;for(let we of H)if(await r(gt.join(ke,we))){Pe=!0;break e}}return Wu.set(pe,Pe),Pe}function Lh(v){let _=Fu.get(v);if(_!==void 0)return _;let k=v;try{k=Hu.realpathSync(v)}catch{}return Fu.set(v,k),k}function ol(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function Li(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 M0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,z)=>{let F;try{F=x(T,_)}catch{return z}if(F===void 0||F===null)return"";let V=String(F);if(/<\/style/i.test(V))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 V};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,z)=>R(z,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,z)=>R(z,T))}var Bh=new Set;function zh(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&Bh.has(T))return;Bh.add(T);let z=_?` used in ${_}`:"",F=R?` Cause: ${R}.`:"",V=k.length>0?`
2659
+ searched:
2660
+ ${k.map((H)=>` - ${H}`).join(`
2661
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${z}, so it rendered as nothing.${F}${V}`)}function Wh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Vs(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 ot(v,_,k,R,T,z,F,V=new Set,H,K=Ir(T),X,G=v){let{extractVariables:te}=await Et("stx/variable-extractor",()=>import("./chunk-8er7jc3c.js")),ce=V??new Set;if(ce.has(v))return`[Circular component reference: ${v}]`;let ee=new Set(ce);ee.add(v);let le=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ue=le&&le!=="load"&&ol(le)?le:"";try{let de=(ut)=>ut.split("-").map((bt)=>bt.charAt(0).toUpperCase()+bt.slice(1)).join(""),pe=G.endsWith(".stx")?G.slice(0,-4):G,fe=null,Pe=T.__importedComponents;if(Pe){let ut=[pe,pe.toLowerCase(),de(pe),mn(pe)];for(let bt of ut)if(Pe.has(bt)){fe=Pe.get(bt);break}}let ke=[];if(!fe){let ut=[`${pe}.stx`,`${de(pe)}.stx`,`${mn(pe)}.stx`],bt=[...new Set(ut)],ft=T.__originalFilePath,_t=[];if(_t.push(...F._layerComponentDirs??[]),ft){let Ot=gt.join(gt.dirname(ft),"components");_t.push(Ot)}if(R)_t.push(R);let ln=F._rootComponentsDir;if(typeof ln==="string"&&!_t.includes(ln))_t.push(ln);let tn=gt.join(gt.dirname(z),"components");if(!_t.includes(tn))_t.push(tn);if(F.componentsDir&&F.componentsDir!==R&&!_t.includes(F.componentsDir))_t.push(F.componentsDir);let kr=F._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(pe),os=(X?.events??[]).map((Ot)=>Ot.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Cr=Object.hasOwn(_,"checked")||Boolean(X?.reactiveProps?.includes("checked")),as=Object.hasOwn(_,"value")||Boolean(X?.reactiveProps?.includes("value")),zo=!os.includes("valuechange")&&(Cr||os.includes("change")&&!as),Wo=F._targetComponentFallbackNames?.some((Ot)=>Ot.toLowerCase()===pe.toLowerCase())&&(!kr||zo);for(let Ot of Wo?[]:F._targetComponentDirs??[])if(Ot&&!_t.includes(Ot))_t.push(Ot);let Fn=typeof F.root==="string"?gt.resolve(F.root):void 0,Fo=Fn??gt.dirname(z),er=[];if(Fn)er.push(gt.resolve(Fn,"resources/views/components")),er.push(gt.resolve(Fn,"resources/components")),er.push(gt.resolve(Fn,"src/components")),er.push(gt.resolve(Fn,"components"));er.push(gt.resolve(import.meta.dir,"components"));for(let Ot of er)if(!_t.includes(Ot))_t.push(Ot);let di=F._pluginComponentDirs;if(Array.isArray(di)){for(let Ot of di)if(typeof Ot==="string"&&!_t.includes(Ot))_t.push(Ot)}if(F.fallbackComponentsDir&&!_t.includes(F.fallbackComponentsDir))_t.push(F.fallbackComponentsDir);if(Wo){for(let Ot of F._targetComponentDirs??[])if(Ot&&!_t.includes(Ot))_t.push(Ot)}let zi=[...new Set(_t.map((Ot)=>{if(!Ot)return Ot;return gt.isAbsolute(Ot)?Ot:gt.resolve(Fo,Ot)}))];_t.length=0,_t.push(...zi);let cs=`${pe}\x00${z}\x00${zi.join("\x00")}`,ac=sc.get(cs);if(ac)if(await r(ac))fe=ac;else sc.delete(cs);if(!fe&&(pe.startsWith("./")||pe.startsWith("../")))fe=gt.resolve(gt.dirname(z),`${pe}.stx`),ke.push(fe);else if(!fe)for(let Ot of _t){if(!Ot)continue;for(let Vo of bt){let Uo=gt.join(Ot,Vo);if(ke.push(Uo),await r(Uo)){fe=Uo;break}}if(fe)break;if(!fe)try{let Vo=await import("fs");if(!Vo.statSync(Ot,{throwIfNoEntry:!1})?.isDirectory())continue;let Zh=8,cc=[{path:Ot,depth:0}];while(cc.length>0&&!fe){let Ho=cc.pop();if(Ho.depth>=Zh)continue;let Ku;try{Ku=Vo.readdirSync(Ho.path,{withFileTypes:!0})}catch{continue}for(let qo of Ku){if(!qo.isDirectory())continue;if(qo.name==="node_modules"||qo.name.startsWith("."))continue;let Xu=gt.join(Ho.path,qo.name);for(let Gh of bt){let lc=gt.join(Xu,Gh);if(ke.push(lc),await r(lc)){fe=lc;break}}if(fe)break;cc.push({path:Xu,depth:Ho.depth+1})}}}catch{}if(fe)break}if(fe)sc.set(cs,fe)}if(!fe||!await r(fe))return zh(v,z,ke),Wh(v);H.add(fe);let we;if(Mo.has(fe))we=Mo.get(fe);else try{we=await Bun.file(fe).text(),Mo.set(fe,we)}catch(ut){let bt=ut instanceof Error?ut.message:String(ut);return zh(v,z,[fe],bt),Wh(v)}if(X)for(let ut of new Set([...Object.keys(_),...X.reactiveProps??[]])){let bt=ut.toLowerCase();if(bt.startsWith("aria-")||bt.startsWith("data-"))continue;let ft=ut.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${ft}\\b`).test(we))X.declaredProps.add(ut);if(new RegExp(`\\$props\\s*(?:\\.\\s*${ft}\\b|\\[\\s*['"]${ft}['"]\\s*\\])`).test(we)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${ft}['"]`).test(we))X.consumedProps?.add(ut)}let Me=new Set(["__originalFilePath","__importedComponents",aa,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ne={};for(let[ut,bt]of Object.entries(T))if(!ut.startsWith("__")||Me.has(ut))Ne[ut]=bt;let Le=K.length>0?{[ga]:[...K]}:{},Be=k;if(k.includes("@include")){let{processIncludes:ut}=await Et("stx/includes",()=>import("./chunk-taztcvv3.js"));Be=await ut(k,T,z,F,H)}if(/<[A-Z][\w.-]*[\s/>]/.test(Be)){let{processComponents:ut}=await Et("stx/component-renderer",()=>import("./chunk-ghfxfcr9.js"));Be=await ut(Be,{...T,__processedComponents:ce,...Le},z,F,H)}let ze=[];if(Li(Be)){let{processExpressions:ut}=await Et("stx/expressions",()=>import("./chunk-mfwrxz9z.js")),bt=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Le}:K.length>0?{...T,...Le}:T;Be=ut(Be,bt,z);for(let ft of Be.matchAll(/\{\{([\s\S]*?)\}\}/g))ze.push(ft[1].trim())}let je=Dn(Be),Fe=[],Ve=je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(ut,bt)=>{let ft=je.scripts[Number(bt)]||"",_t=ft.match(/^<script\b([^>]*)>/i)?.[1]||"",ln=_t.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),tn=!ln||["module","text/javascript","application/javascript"].includes(ln),kr=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${_t}`);if(!/\bserver\b/i.test(_t)&&tn&&!kr)return Fe.push(ft),"";return ft}),{extractSlotContent:Ue}=await Et("stx/slots",()=>import("./chunk-h30y9k44.js")),We=Ue(Ve),ct={};if(We.defaultSlot?.trim())ct.default=We.defaultSlot;for(let[ut,bt]of We.namedSlots)ct[ut]=bt.content;let $t=T.__stx_scope_seq??={n:0,key:Hs(String(T.__filename??z))},wt=Vh(v,process.cwd()),St=`stx_${(wt.endsWith(".stx")?wt.slice(0,-4):wt).replace(/[^a-zA-Z0-9]/g,"_")}_${++$t.n}_${$t.key}`,mt={...Ne,$uid:St,..._,props:_,slot:Ve,$slots:ct,__processedComponents:ee,__sections:{},__stx_signals_gate:Ee(we)||Li(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...ze]};D0(we,mt);let Ct=we,vt=oe(Ct);if(vt)Ct=vt.content.trim();let pt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Rt=[...we.matchAll(pt)];for(let[,ut,bt]of Rt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(ut))et(bt,fe,F.strict);let xt=[],qt=null,Ur=Rt.some((ut)=>/\bserver\b/.test(ut[1]||"")&&/\bcache\b/.test(ut[1]||"")),bn=null,kt=null,ht=null,At=0,Kt=null;if(E0(F),Ur&&Vu>0){let ut=C0({props:_,slot:Be,slotContext:k.trim()?R0(Ne):void 0,buildMode:F.buildMode??"",skipEventDirectives:F.skipEventDirectives===!0,clientLoopNames:[...K].sort(),layers:F._layerGraph?.layers.map((bt)=>bt.configFile),uid:St});if(ut!==null){bn=`${fe}\x00${h(we)}\x00${ut}`;let bt=ic.get(bn);if(bt){for(let ft of bt.dependencies)H.add(ft);if(Bd(T,bt.clientFactories),$t.n+=bt.uidsConsumed,bt.preservedClientExpressions.length>0){let ft=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let _t of bt.preservedClientExpressions)ft.add(_t);T.__stx_preserved_client_expressions=[...ft]}return bt.output}kt=new Set(H),ht=Nd(T),At=$t.n,Kt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Jt=new Set;for(let ut of Rt){let bt=ut[1]||"",ft=ut[2]||"",_t=bt.includes("server");if(rt(bt)&&ft.trim())ft=st(ft);if(_t&&ft){for(let tn of he(ft))Jt.add(tn);try{await te(ft,mt,fe,{onFailure:(tn)=>{if(tn.kind!=="unknown")qt=tn.kind}})}catch(tn){}}if(!_t){let tn=ft.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),kr=tn.includes("{{")&&tn.includes("}}"),os=tn.includes("{!!")&&tn.includes("!!}");if(kr||os)tn=Ss(tn,mt,fe);let Cr=bt.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");xt.push(`<script${Cr}>${tn}</script>`)}}let cn=Dn(we).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),li=cn?cn[1]:"",oc=cn?cn[2]:"",Yn="",He=li&&/\bscoped\b/i.test(li);if(cn)Yn=`<style${li}>${M0(oc,mt,fe)}</style>`;let qe=Ct;if(qe=qe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),cn)qe=qe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let ut=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,bt=[];if(qe=qe.replace(ut,(ft,_t)=>{let ln=_t.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(ln)bt.push(`<style${ln[1]}>${ln[2]}</style>`);return""}),qe=qe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),bt.length>0)Yn=`${Yn}${bt.join(`
2662
+ `)}`}if(k&&qe.includes("{{ text || slot }}"))qe=qe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:yt}=await Et("stx/slots",()=>import("./chunk-h30y9k44.js")),{defaultSlot:Tt,namedSlots:Yt}=We,on=xt.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)),Hr=(ut)=>on?ch(ut,St):ut,qu=new Map([...Yt].map(([ut,bt])=>[ut,{...bt,content:Hr(bt.content)}]));qe=await yt(qe,Hr(Tt),qu,mt);let No=Vs(xt),Lo=(Array.isArray(mt.__stx_client_signal_names)?mt.__stx_client_signal_names:[]).filter((ut)=>!Jt.has(ut));if(No.length>0||Lo.length>0)mt.__stx_client_signal_names=[...new Set([...Lo,...No])];else delete mt.__stx_client_signal_names;let ui=K.filter((ut)=>!Jt.has(ut)&&!(ut in _));if(ui.length>0)mt[ga]=ui;let Bo={...F,_rootComponentsDir:F._rootComponentsDir||F.componentsDir,componentsDir:gt.dirname(fe),skipSignalsRuntime:!0,skipEventDirectives:F._nativeHostAttrs===!0||on||xt.length===0,defaultLayout:void 0};mt.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let $r=await n(qe,mt,fe,Bo,H),is=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let ut of $r.matchAll(/\{\{([\s\S]*?)\}\}/g))is.add(ut[1].trim());if(is.size>0)T.__stx_preserved_client_expressions=[...is];let Qn=St,an=$r;if(on){let ut="";if(Object.keys(_).length>0)try{ut=` data-stx-props="${Bu(JSON.stringify(_))}"`}catch{}let bt=ue?` stx-hydrate="${Bu(ue)}"`:"",ft=Object.fromEntries(Object.entries(ct).map(([Cr,as])=>[Cr,Boolean(as)])),_t=Object.keys(ft).length>0?` data-stx-slots="${Bu(JSON.stringify(ft))}"`:"",ln=` data-stx-scope="${Qn}"${ut}${_t}${bt}`,tn=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test($r),kr=tn?"span":"div";an=sl($r,ln)??`<${kr}${ln} data-stx-component-wrapper${tn?' style="display:contents"':""}>${$r}</${kr}>`;let os=await Promise.all(xt.map(async(Cr)=>{let as=Cr.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!as)return Cr;let[,zo,Wo]=as,Fn=await L0(Wo,fe,F.buildMode==="compile"),Fo=wn(Fn.clientCode,Ce(mt)),{vendorStyleTags:er}=Fn,di=Fo?`function(__scopeId) {
2663
+ ${Fo}
2664
+ return (${Fn.factoryBody})(__scopeId);
2665
+ }`:Fn.factoryBody,zi=ue?null:yc(T,di),cs=zi?`window.__stxComponentFactories[${JSON.stringify(zi)}](${JSON.stringify(Qn)});`:`(${di})(${JSON.stringify(Qn)});`;if(ue)return`${er}<script type="stx/island" data-stx-island="${Qn}" data-stx-scoped data-stx-owner="${Qn}"${zo}>${cs}</script>`;return`${er}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Qn}"${zo}>${cs}</script>`}));if(an=an+`
2666
+ `+os.join(`
2667
+ `),Yn)an+=`
2668
+ `+Yn}else{if(Yn)an+=`
2669
+ `+Yn;if(xt.length>0){let ut=mt.__stx_event_bindings||[],bt=Ce(mt),ft=await Promise.all(xt.map(async(_t)=>{let ln=_t.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!ln)return _t;return await _e(ln[1],{eventBindings:ut,templateContent:an,filePath:fe,projectRoot:process.cwd(),serverData:bt,instanceId:St})}));an+=`
2670
+ `+ft.join(`
2671
+ `),mt.__stx_event_bindings=[]}}if(He){let ut=wa(an,fe);if(ut.hasScoped)an=ut.html}if(bn&&kt){let ut=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];ic.set(bn,{output:an,dependencies:[...H].filter((bt)=>!kt.has(bt)),clientFactories:ht?Ld(T,ht):[],uidsConsumed:$t.n-At,preservedClientExpressions:Kt?ut.filter((bt)=>!Kt.has(bt)):[]})}if(qt)an=`<!--stx-render-failed:${qt}-->${an}`;return Fe.length>0?`${an}
2672
+ ${Fe.join(`
2673
+ `)}`:an}catch(de){if(de instanceof q)throw de;return`[Error processing component: ${de instanceof Error?de.message:String(de)}]`}finally{ce.delete(v)}}async function r(v){return Bun.file(v).exists()}function Uu(v,_){let k=gt.resolve(_),R=gt.resolve(v),T=k.endsWith(gt.sep)?k:k+gt.sep;if(R===k||R.startsWith(T))return R;return null}async function j0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,z=gt.join(v,T);for(let F of z.endsWith(".stx")?[z]:[z,`${z}.stx`])if(await r(F)){if(R)console.log(`Found layout in ${v}: ${F}`);return k?.add(F),F}return null}async function hr(v,_,k,R){let T=await N0(v,_,k,R);if(T===null)return null;let z=Uu(T,process.cwd());if(z)return z;let F=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((V)=>typeof V==="string"&&V.length>0);for(let V of F){let H=gt.isAbsolute(V)?V:gt.resolve(process.cwd(),V);if(Uu(T,H))return gt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function N0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=gt.dirname(_),z=process.cwd();if(v.startsWith("/")){let te=gt.join(z,v),ce=Uu(te,z);if(!ce)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${ce}`);if(await r(ce)&&R)R.add(ce);return ce}let F=gt.join(T,v);if(await r(F)){if(k.debug)console.log(`Found direct path: ${F}`);if(R)R.add(F);return F}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let te of[".stx",".tsx",".jsx"]){let ce=`${F}${te}`;if(await r(ce)){if(k.debug)console.log(`Found direct path with extension: ${ce}`);if(R)R.add(ce);return ce}}let V=[];if(V.push(...k._layerLayoutDirs??[]),k.layoutsDir)V.push(gt.isAbsolute(k.layoutsDir)?k.layoutsDir:gt.resolve(process.cwd(),k.layoutsDir));let H=gt.resolve(T),K=process.cwd();for(let te=0;te<10;te++){let ce=gt.join(H,"layouts"),ee=!1;try{ee=Hu.statSync(ce,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(ee){V.push(ce);break}let le=gt.dirname(H);if(le===H||le.length<K.length)break;H=le}for(let te of V){let ce=await j0(te,v,R,k.debug);if(ce)return ce}if(k.fallbackLayoutsDir){let te=gt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:gt.resolve(process.cwd(),k.fallbackLayoutsDir),ce=v.startsWith("layouts/")?v.slice(8):v,ee=[gt.join(te,ce)];if(!v.endsWith(".stx"))ee.push(`${ee[0]}.stx`);for(let le of ee)if(await r(le)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${le}`);if(R)R.add(le);return le}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let te=v.split("layouts/"),ce=gt.join(k.partialsDir||T,"layouts",te[1]);if(await r(ce)){if(k.debug)console.log(`Found in layouts path: ${ce}`);if(R)R.add(ce);return ce}if(!ce.endsWith(".stx")){let ee=`${ce}.stx`;if(await r(ee)){if(k.debug)console.log(`Found in layouts path with extension: ${ee}`);if(R)R.add(ee);return ee}}}if(k.partialsDir){let te=gt.join(k.partialsDir,"layouts");if(await r(te)){let ce=gt.join(te,v);if(await r(ce)){if(k.debug)console.log(`Found in partials layouts dir: ${ce}`);if(R)R.add(ce);return ce}if(!v.endsWith(".stx")){let ee=`${ce}.stx`;if(await r(ee)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${ee}`);if(R)R.add(ee);return ee}}}}let X=k.partialsDir||gt.join(process.cwd(),"views"),G=gt.join(X,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 te=`${G}.stx`;if(await r(te)){if(k.debug)console.log(`Found in views path with extension: ${te}`);if(R)R.add(te);return te}}if(T.includes("temp")){let te=gt.join(gt.dirname(T),"layouts",v);if(await r(te)){if(k.debug)console.log(`Found in temp layouts dir: ${te}`);if(R)R.add(te);return te}if(!v.endsWith(".stx")){let ce=`${te}.stx`;if(await r(ce)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${ce}`);if(R)R.add(ce);return ce}}}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 ji(v,_,k){let R=0,T="",z="";try{if(typeof _==="number"&&_>=0){let F=v.split(`
2674
+ `),V=0;for(let H=0;H<F.length;H++)if(V+=F[H].length+1,V>=_){R=H+1,T=F[H].trim();let K=Math.max(0,H-2),X=Math.min(F.length,H+3);z=F.slice(K,X).map((G,te)=>{let ce=K+te+1;return`${ce===R?"> ":" "}${ce}: ${G}`}).join(`
2675
+ `);break}}else if(k){let F=v.indexOf(k);if(F>=0)return ji(v,F)}}catch{}return{lineNumber:R,lineContent:T,context:z}}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,z){let{lineNumber:F,context:V}=ji(R,T,z),H=k.split("/").pop(),K=0;if(typeof T==="number"&&T>=0&&R){let G=R.lastIndexOf(`
2676
+ `,Math.max(0,T-1));K=T-(G+1)+1}let X="";if(F>0)X+=`
2677
+ ${k}:${F}${K>0?`:${K}`:""}: ${v.toLowerCase()} error: ${_}
2678
+ `;if(X+=`
2679
+ ${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}
2680
+ `,X+=`${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}
2681
+ `,X+=`${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}
2682
+ `,X+=`
2683
+ ${Pt.cyan}${Pt.bold}File:${Pt.reset} ${Pt.dim}${H}${Pt.reset}`,F>0)X+=` ${Pt.gray}(line ${F}${K>0?`, col ${K}`:""})${Pt.reset}`;if(X+=`
2684
+ ${Pt.yellow}${Pt.bold}Message:${Pt.reset} ${_}
2685
+ `,V)X+=`
2686
+ ${Pt.blue}${Pt.bold}Context:${Pt.reset}
2687
+ ${Pt.dim}${V}${Pt.reset}
2688
+ `;return X}function ie(){Mo.clear(),sc.clear(),Wu.clear(),Fu.clear(),ic.clear()}function Sd(){return{size:Mo.size,maxSize:500}}var zu=m(128);async function L0(v,_,k){let R=h(v,_,k),T=zu.get(R);if(T){if(ir(T.deps))return T;zu.delete(R)}let z=bs(v,{filePath:_,projectRoot:process.cwd()}),F=z.code,V=vs(z.styles);F=Dt(F).code;let{hasUserImports:H,bundleClientScript:K}=await Et("stx/client-script-bundler",()=>import("./chunk-sfj84n72.js")),X=[],G=!1;if(H(F)){let pe=F;F=await K(pe,_,{projectRoot:process.cwd(),minify:k,collectInputs:X}),G=F===pe}let{stripStxRuntimeImports:te}=await Et("stx/signal-processing",()=>import("./chunk-yww6c9we.js"));F=te(F);let ce=I(F),ee=T0(ce),le=new Set(M(ce,!0).split(",").map((pe)=>pe.trim())),ue=`function(__scopeId) {
2689
+ ${Gt("const",[...na,...ee],ce)}
2690
+ const __scope = window.stx._scopes = window.stx._scopes || {};
2691
+ const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
2692
+ __scopeVars.$refs = __scopeVars.$refs || {};
2693
+ const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
2694
+ const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
2695
+ // A clone the runtime is setting up may not be in the document yet (rows
2696
+ // a loop builds inside a closed :if), where a lookup cannot see it, so the
2697
+ // runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
2698
+ const __setupRoot = window.__STX_SETUP_ROOT__;
2699
+ const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
2700
+ __scopeVars.$slots = Object.create(null);
2701
+ if (__componentElement) {
2702
+ try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
2703
+ catch {}
2704
+ }
2705
+ window.__STX_CURRENT_ELEMENT__ = __componentElement;
2706
+ let __componentProps = __componentElement && __componentElement.__stx_props;
2707
+ if (!__componentProps && __componentElement) {
2708
+ try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
2709
+ catch { __componentProps = {}; }
2710
+ }
2711
+ window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
2712
+
2713
+ // Scope-specific lifecycle callbacks. The queues drain as they run; the
2714
+ // hook lists keep what setup registered, because a component behind an :if
2715
+ // unmounts at each hide and mounts again at each show (signals.ts,
2716
+ // suspendSubtreeScopes).
2717
+ if (__scopeVars.__suspended && !__scopeVars.__mounted) {
2718
+ // Set up again after an :if hid it -- a <template :if> clones the
2719
+ // component afresh on every show, and the clone's script runs. This run's
2720
+ // hooks close over this run's state, so they replace the ones the hide
2721
+ // kept for a re-show rather than queueing beside them.
2722
+ __scopeVars.__mountCallbacks = [];
2723
+ __scopeVars.__destroyCallbacks = [];
2724
+ __scopeVars.__mountHooks = [];
2725
+ __scopeVars.__destroyHooks = [];
2726
+ }
2727
+ __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
2728
+ __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
2729
+ __scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
2730
+ __scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
2731
+ let __registeringSetupHooks = true;
2732
+ const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
2733
+ const onDestroy = (fn) => {
2734
+ __scopeVars.__destroyCallbacks.push(fn);
2735
+ // A teardown registered inside onMount belongs to this mount alone.
2736
+ // Replaying it AND registering the next mount's teardown doubles cleanup.
2737
+ if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
2738
+ };
2739
+
2740
+ try {
2741
+ ${ce}
2742
+
2743
+ // Register all defined signals and functions in this scope
2744
+ const __localVars = {};
2745
+ try {
2746
+ ${ee.map((pe)=>le.has(pe)?`Object.defineProperty(__localVars, '${pe}', ${Ko(pe)});`:`if (typeof ${pe} !== 'undefined') __localVars['${pe}'] = ${pe};`).join(`
2747
+ `)}
2748
+ }
2749
+ catch (e) {}
2750
+ Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
2751
+ if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
2752
+ }
2753
+ finally {
2754
+ __registeringSetupHooks = false;
2755
+ window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
2756
+ window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
2757
+ }
2758
+ }`,de={vendorStyleTags:V,factoryBody:ue,clientCode:ce,deps:vn([...X,...z.styles.map((pe)=>pe.resolvedPath)])};if(!G&&z.unresolved.length===0)zu.set(R,de);return de}var B0=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function z0(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 W0(v,_){let k=_;while(!0){let R=ss.join(k,"node_modules",v,"package.json");if(jo.existsSync(R))return ss.dirname(R);let T=ss.dirname(k);if(T===k)return null;k=T}}function F0(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 z=T.indexOf("*");if(z===-1)continue;let F=T.slice(0,z),V=T.slice(z+1);if(!_.startsWith(F)||!_.endsWith(V))continue;if(_.length<F.length+V.length)continue;if(!R||F.length>R.prefix.length)R={pattern:T,prefix:F,suffix:V}}if(R){let T=_.slice(R.prefix.length,_.length-R.suffix.length),z=k(v[R.pattern]);if(z)return z.replace("*",T)}return null}function V0(v,_){let k=z0(v);if(!k||!k.subpath)return null;let R=W0(k.pkg,_);if(!R)return null;let T;try{T=JSON.parse(jo.readFileSync(ss.join(R,"package.json"),"utf8"))}catch{return null}let z=`.${k.subpath}`,F=F0(T.exports,z);if(!F)return null;let V=ss.resolve(R,F);return jo.existsSync(V)?V:null}function bs(v,_){let k=_.filePath?ss.dirname(_.filePath):_.projectRoot||process.cwd(),R=_.projectRoot||process.cwd(),T=new Set,z=[],F=[];return{code:v.replace(B0,(H,K)=>{let X;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(X=K.startsWith("/")?K:ss.resolve(k,K),!jo.existsSync(X))throw Error(`file not found: ${X}`)}else{let G=null;try{G=Bun.resolveSync(K,R)}catch{G=V0(K,R)}if(!G)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);X=G}}catch(G){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${_.filePath||"<unknown>"}): ${G?.message||G}`),F.push(K),""}if(T.has(X))return"";T.add(X);try{let G=jo.readFileSync(X,"utf8");z.push({source:K,resolvedPath:X,contents:G})}catch(G){console.warn(`[stx:vendor-css] could not read ${X}: ${G?.message||G}`),F.push(K)}return""}),styles:z,unresolved:F}}function U0(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vs(v){if(v.length===0)return"";return`${v.map((_)=>`<style data-stx-vendor="${U0(_.source)}" data-stx-layer="vendor">
2759
+ @layer vendor {
2760
+ ${_.contents}
2761
+ }
2762
+ </style>`).join(`
2763
+ `)}
2764
+ `}var _c=y,Uh=m(256);function Dt(v){let _=h(v),k=Uh.get(_);if(!k)k=H0(v),Uh.set(_,k);return{code:k.code,imports:[...k.imports],models:[...k.models]}}function H0(v){let _=s(v),k=new Set;for(let V of v.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of V[1].split(",")){let K=H.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)k.add(K)}let R=Go(_),T=Y.filter((V)=>{if(k.has(V)||R.has(V))return!1;return ws(_,V,!0)}),z=Xh(_).filter((V)=>!k.has(V)&&!R.has(V));if(T.length===0&&z.length===0)return{code:v,imports:T,models:z};return{code:`${[T.length>0?`import { ${T.join(", ")} } from '@stacksjs/browser'`:"",z.length>0?"import '@stacksjs/browser'":"",z.length>0?`const { ${z.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2765
+ `)}
2766
+ ${v}`,imports:T,models:z}}var q0=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 Xh(v){let _=new Set,k=gc(v),R=Go(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 z of k.code.matchAll(T)){let F=z[1];if(q0.has(F)||R.has(F)||F.length<3)continue;if(k.shadows(F,z.index??0))continue;_.add(F)}return Array.from(_)}function K0(v){return Go(v)}var Hh=m(128);function pi(v){let _=h(v),k=Hh.get(_);if(!k)k=X0(v),Hh.set(_,k);return{code:k.code,stxImports:[...k.stxImports],browserImports:[...k.browserImports]}}function X0(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,z=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,F;while((F=z.exec(v))!==null){let G=F[1],te=F[2];if(F[0].includes("import type"))continue;let ce=[];for(let le of G.split(",")){let ue=le.trim();if(!ue||ue.startsWith("type "))continue;let de=ue.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!de)continue;let pe=de[1],fe=de[2]||pe;if(T.add(pe),T.add(fe),te==="stx"||te==="@stacksjs/stx")_.add(pe);else k.add(pe);if(fe!==pe)ce.push(`${fe} = ${pe}`)}let ee=ce.length>0?`var ${ce.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";R=R.replace(F[0],ee)}let V=K0(R);for(let G of _c){if(T.has(G)||V.has(G))continue;if(ws(R,G,!0))_.add(G)}let H=s(R),K=new Set;for(let G of R.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let te of G[1].split(",")){let ce=te.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let ee of ce){let le=ee.trim();if(le)K.add(le)}}for(let G of Y){if(T.has(G)||V.has(G)||K.has(G))continue;if(ws(H,G))k.add(G)}let X=Xh(H);for(let G of X)if(!T.has(G)&&!V.has(G))k.add(G);return{code:R,stxImports:Array.from(_),browserImports:Array.from(k)}}function ws(v,_,k=!1){let R=gc(v);v=R.code;let T=new RegExp(`\\b${_.replace(/[$]/g,"\\$")}\\b`,"g");for(let z of v.matchAll(T)){let F=z.index??0;if(R.shadows(_,F))continue;let V=F+_.length,H=F-1;while(H>=0&&/\s/.test(v[H]))H--;if(v[H]==="."&&v.slice(Math.max(0,H-2),H+1)!=="...")continue;let K=V;while(K<v.length&&/\s/.test(v[K]))K++;if(v[K]===":"&&v[K+1]!==":"&&(v[H]==="{"||v[H]===","))continue;if(k&&!/^\s*(?:<[^>]*>)?\s*\(/.test(v.slice(V)))continue;if(Z0(v,V))continue;return!0}return!1}function Z0(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 fi(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
2767
+ ${k.join(`
2768
+ `)}
2769
+ ${G0(v,_)}`;return""}function ed(v,_=[]){let{browserImports:k}=pi(v),R=new Set(_);return fi([],k.filter((T)=>!R.has(T)))}function G0(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
2770
+ [${k.join(", ")}].forEach(function (e) {
2771
+ if (e[1] !== 'undefined') return;
2772
+ console.error(
2773
+ '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
2774
+ + 'but the client runtime does not provide it. Either it is not exported to the browser, '
2775
+ + 'or it should be imported from a relative path so the bundler includes it.'
2776
+ );
2777
+ });
2778
+ `}function Ce(v){let _=v.__stxClientPayload;if(_&&typeof _==="object"){let R={};for(let T in _){let z=_[T];if(typeof z==="function")continue;R[T]=z}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 J0=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,qh=new Set;function Y0(v,_){let k=J0.test(v),R=_.length>32768;if(!k&&!R)return;if(qh.has(v))return;if(qh.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 wn(v,_){if(!_)return"";let k=Nt(v,new Set(Object.keys(_))),R=_.__stxDeclaredPayload===!0,T=[],z=Object.entries(_).sort(([F],[V])=>F<V?-1:F>V?1:0);for(let[F,V]of z){if(!/^[A-Za-z_$][\w$]*$/.test(F))continue;if(F.startsWith("__")||F.startsWith("$"))continue;if(!R&&!k.has(F))continue;if(Wi(v,F)){if(R)console.warn(`[stx] defineClientPayload declares "${F}", but this client block also declares "${F}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${F}" from defineClientPayload.`);continue}let H;try{H=JSON.stringify(V)}catch{continue}if(H===void 0)continue;Y0(F,H),T.push(` var ${F} = ${H.replace(/</g,"\\u003c")};`)}if(T.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2779
+ ${T.join(`
2780
+ `)}
2781
+ `}var Q0={left:0,middle:1,right:2};function e$(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=Q0[v.mouse];_.push(`if ($event.button !== ${k}) return`)}if(v.prevent)_.push("$event.preventDefault()");if(v.stop)_.push("$event.stopPropagation()");return _.join("; ")}function t$(v,_){let{elementId:k,event:R,modifiers:T}=v,z=dc(v.handler),F=e$(T),V=[];if(T.once)V.push("once: true");if(T.capture)V.push("capture: true");if(uc(R,T))V.push("passive: true");let H=V.length>0?`, { ${V.join(", ")} }`:"",K="";if(F)K+=`${F}; `;let X=z.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),G=`var $emit = function(name, detail) {
2782
+ $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2783
+ };`;function te(ce){if(/\$emit\s*\(/.test(ce))return`${G}
2784
+ ${ce}`;return`var scope = $el.closest('[data-stx-scope]');
2785
+ if (scope && scope.__stx_execute) {
2786
+ scope.__stx_execute('${X}', $event, $el);
2787
+ }
2788
+ else {
2789
+ ${ce}
2790
+ }`}if(T.debounce!==null)return` ;(function() {
2791
+ // eslint-disable-next-line pickier/no-unused-vars
2792
+ var $el = document.getElementById('${k}')
2793
+ if (!$el) return
2794
+ var __timer
2795
+ $el.addEventListener('${R}', function($event) {
2796
+ ${F?F+"; ":""}clearTimeout(__timer)
2797
+ __timer = setTimeout(function() { ${te(z)} }, ${T.debounce})
2798
+ }${H})
2799
+ })()`;if(T.throttle!==null)return` ;(function() {
2800
+ // eslint-disable-next-line pickier/no-unused-vars
2801
+ var $el = document.getElementById('${k}')
2802
+ if (!$el) return
2803
+ var __last = 0
2804
+ $el.addEventListener('${R}', function($event) {
2805
+ ${F?F+"; ":""}var __now = Date.now()
2806
+ if (__now - __last >= ${T.throttle}) {
2807
+ __last = __now
2808
+ ${te(z)}
2809
+ }
2810
+ }${H})
2811
+ })()`;if(/\$emit\s*\(/.test(z))return` var $el = document.getElementById('${k}')
2812
+ if ($el) $el.addEventListener('${R}', function($event) {
2813
+ ${K}${G}
2814
+ ${z}
2815
+ }${H})`;return` var $el = document.getElementById('${k}')
2816
+ if ($el) $el.addEventListener('${R}', function($event) {
2817
+ ${K}var scope = $el.closest('[data-stx-scope]');
2818
+ if (scope && scope.__stx_execute) {
2819
+ scope.__stx_execute('${X}', $event, $el);
2820
+ }
2821
+ else {
2822
+ ${z}
2823
+ }
2824
+ }${H})`}function n$(v){if(v.length===0)return"";return`
2825
+ // STX: auto-generated event bindings
2826
+ ${v.map((k,R)=>t$(k,R)).join(`
2827
+ `)}`}function Kh(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,z=R.length,F=0;while(F<z){let V=R[F];if(V==="'"||V==='"'||V==="`"){let H=V;if(F++,H==="`"){let K=0;while(F<z){if(R[F]==="\\"){F+=2;continue}if(R[F]==="`"&&K===0){F++;break}if(R[F]==="$"&&R[F+1]==="{"){K++,F+=2;continue}if(R[F]==="}"&&K>0){K--,F++;continue}F++}}else while(F<z){if(R[F]==="\\"){F+=2;continue}if(R[F]===H){F++;break}F++}continue}if(V==="/"&&R[F+1]==="/"){while(F<z&&R[F]!==`
2828
+ `)F++;continue}if(V==="/"&&R[F+1]==="*"){F+=2;while(F<z-1&&!(R[F]==="*"&&R[F+1]==="/"))F++;F+=2;continue}if(V==="{"){T++,F++;continue}if(V==="}"){T--,F++;continue}if(T===0){let H=R.slice(F),K=H.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let te=K[1];if(!te.startsWith("_")&&!k.has(te))_.push(te),k.add(te);F+=K[0].length;continue}let X=H.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(X){X[1].split(",").forEach((te)=>{let ce=te.trim(),ee=ce.indexOf(":"),le=ee>=0?ce.slice(ee+1).trim().split(/[\s=]/)[0]:ce.split(/[\s=]/)[0];if(le&&!le.startsWith("_")&&!k.has(le))_.push(le),k.add(le)}),F+=X[0].length;continue}let G=H.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(G){let te=G[1];if(!te.startsWith("_")&&!k.has(te))_.push(te),k.add(te);F+=G[0].length;continue}}F++}return _}var r$=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 s$(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(te){let ce;while((ce=k.exec(te))!==null){let ee=ce[0];if(!r$.has(ee))_.add(ee)}}let T=/\{\{([\s\S]*?)\}\}/g,z;while((z=T.exec(v))!==null)R(z[1]);let F=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((z=F.exec(v))!==null)R(z[1]);let V=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((z=V.exec(v))!==null)R(z[1]);let H=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((z=H.exec(v))!==null)R(z[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((z=K.exec(v))!==null)R(z[1]);let X=/@model\s*=\s*["']([^"']*)["']/gi;while((z=X.exec(v))!==null)R(z[1]);let G=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((z=G.exec(v))!==null)R(z[1]);return _}async function _e(v,_={}){let k=v,R="",T=!1,z=[],F=bs(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=F.code;let V=vs(F.styles),H=Dt(k);k=H.code,z=[...H.imports,...H.models];let{hasUserImports:K,bundleClientScript:X}=await Et("stx/client-script-bundler",()=>import("./chunk-sfj84n72.js"));if(K(k))k=await X(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let fe=pi(k);k=fe.code,R=fi(fe.stxImports,fe.browserImports.filter((Pe)=>!z.includes(Pe)))}if(R=`${wn(k,_.serverData)}${R}`,k=I(k),!T&&rt(_.attrs||""))k=st(k);let G=n$(_.eventBindings||[]),te=(_.attrs||"").trim(),ce=/\btype\s*=\s*["']module["']/i.test(te),ee=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(ce){let fe=te.replace(/\btype\s*=\s*["']module["']/i,"").trim(),Pe=`type="module" data-stx-scoped${ee}${fe?` ${fe}`:""}`;return`${V}<script ${Pe}>
2829
+ ${oi(`${R}${k}
2830
+ ${G}`)}
2831
+ </script>`}let le=io(v),ue=/function __stx_setup_/.test(k),de=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function pe(fe){let Pe=fe.length>0?`
2832
+ return ${Xo(k,fe)};`:"",ke=JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`);return`${V}<script data-stx-scoped data-stx-run="always"${ee}>
2833
+ window.stx.mount(function() {
2834
+ 'use strict';
2835
+ try {
2836
+ ${oi(`${R}${k}
2837
+ ${G}${Pe}`)}
2838
+ } catch (error) {
2839
+ console.error(${ke}, error);
2840
+ return {};
2841
+ }
2842
+ })</script>`}if(!de&&!ue){if(le)return pe(Kh(v));if(_.templateContent){let fe=Kh(v);if(fe.length>0){let Pe=s$(_.templateContent);if(fe.some((we)=>Pe.has(we)))return pe(fe)}}}return`${V}<script data-stx-scoped data-stx-run="always"${ee}>
2843
+ ;(function() {
2844
+ 'use strict';
2845
+ try {
2846
+ ${oi(`${R}${k}
2847
+ ${G}`)}
2848
+ } catch (error) {
2849
+ console.error(${JSON.stringify(`[stx] client block failed${_.filePath?` (${_.filePath})`:""}; this block will not hydrate`)}, error);
2850
+ }
2851
+ })()</script>`}
2852
+ export{ge,or,Ge,M,Nt,L,J,m,h,vn,ir,Y,w,Ke,bs,vs,_c,Dt,pi,ws,fi,ed,Ce,wn,_e,gi,mi,hi,xs,U,Xe,ne,Mt,re,ar,Ec,td,Tc,nd,$c,cr,b,Lt,Ee,Rc,Ss,Ac,rd,Z,Pc,sd,x,od,Ic,id,ad,cd,ld,Oc,Nc,ud,dd,yi,pd,xn,Sn,lr,Je,Te,se,jt,me,kn,Cn,$e,e,fd,bi,gd,vi,Dc,Mc,Bt,_n,md,Lc,jc,hd,f,Ye,Ft,Ze,Qe,wi,ur,et,oe,ks,Cs,_s,yd,dr,bd,En,tt,Es,Ts,Bc,he,xi,Si,ki,Ci,pr,$s,_i,Ei,Ti,Fc,Rs,j,ye,Q,vd,zc,As,Ps,$i,Ri,Is,Os,fr,Ai,Pi,Hc,nt,Tn,gr,zt,Vc,Uc,Wc,qc,Gc,u,Kc,Ns,Xc,Ii,Oi,Ds,Ni,Jc,wd,Yc,Re,Di,xd,Ms,Ls,js,Mi,Bs,Fs,zs,n,Zc,Qc,el,tl,nl,Hs,rl,rt,B,st,sl,mr,ol,Li,Vs,ot,r,hr,ji,g,ie,Sd,yr,A,il,Us,o,P,kd,Cd,be};